"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.ListItemAmount = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _context = require("../../context");
var _core = require("../../core");
var _accessibility = require("../../utils/accessibility");
var _icons = require("../icons");
var _typography = require("../typography");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const iconMargin = 8;
const ListItemAmount = ({
  label,
  iconName,
  iconColor,
  valueElementProps,
  valueString,
  accessibilityLabel,
  testID
}) => {
  const theme = (0, _context.useIOTheme)();
  const {
    dynamicFontScale,
    spacingScaleMultiplier,
    hugeFontEnabled
  } = (0, _accessibility.useIOFontDynamicScale)();
  const listItemAccessibilityLabel = (0, _react.useMemo)(() => accessibilityLabel ? accessibilityLabel : `${label}`, [label, accessibilityLabel]);
  const itemInfoTextComponent = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    accessible: false,
    importantForAccessibility: "no-hide-descendants",
    accessibilityElementsHidden: false,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.H6, {
      color: theme["textBody-tertiary"],
      children: label
    })
  });
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: _core.IOListItemStyles.listItem,
    testID: testID,
    accessible: true,
    accessibilityLabel: listItemAccessibilityLabel,
    children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
      style: [_core.IOListItemStyles.listItemInner, {
        columnGap: iconMargin * dynamicFontScale * spacingScaleMultiplier
      }],
      children: [iconName && !hugeFontEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
        allowFontScaling: true,
        name: iconName,
        color: iconColor ?? theme["icon-decorative"],
        size: _core.IOListItemVisualParams.iconSize
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
        style: {
          flex: 1
        },
        children: itemInfoTextComponent
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.H3, {
        ...valueElementProps,
        color: theme["textBody-default"],
        accessibilityLabel: `${listItemAccessibilityLabel}; ${valueElementProps?.accessibilityLabel ?? ""}`,
        children: valueString
      })]
    })
  });
};
exports.ListItemAmount = ListItemAmount;
var _default = exports.default = ListItemAmount;
//# sourceMappingURL=ListItemAmount.js.map