"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ListItemInfoCopy = void 0;
var _reactNative = require("react-native");
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
var _core = require("../../core");
var _context = require("../../context");
var _hooks = require("../../hooks");
var _accessibility = require("../../utils/accessibility");
var _icons = require("../icons");
var _typography = require("../typography");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const ListItemInfoCopy = ({
  label,
  value,
  numberOfLines = 2,
  onPress,
  icon,
  accessibilityLabel,
  accessibilityHint,
  testID
}) => {
  const theme = (0, _context.useIOTheme)();
  const {
    onPressIn,
    onPressOut,
    scaleAnimatedStyle,
    backgroundAnimatedStyle
  } = (0, _hooks.useListItemAnimation)();
  const {
    dynamicFontScale,
    spacingScaleMultiplier,
    hugeFontEnabled
  } = (0, _accessibility.useIOFontDynamicScale)();
  const componentValueToAccessibility = typeof value === "string" ? value : "";
  const listItemAccessibilityLabel = accessibilityLabel || `${label}; ${componentValueToAccessibility}`;
  const foregroundColor = theme["interactiveElem-default"];
  const listItemInfoCopyContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.BodySmall, {
      weight: "Regular",
      color: theme["textBody-tertiary"],
      children: label
    }), typeof value === "string" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.H6, {
      color: foregroundColor,
      numberOfLines: numberOfLines,
      children: value
    }) : value]
  });
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
    onPress: onPress,
    onPressIn: onPressIn,
    onPressOut: onPressOut,
    onTouchEnd: onPressOut,
    accessible: true,
    accessibilityLabel: listItemAccessibilityLabel,
    accessibilityHint: accessibilityHint,
    accessibilityRole: "button",
    testID: testID,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
      importantForAccessibility: "no-hide-descendants",
      accessibilityElementsHidden: true,
      style: [_core.IOListItemStyles.listItem, backgroundAnimatedStyle],
      children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
        style: [_core.IOListItemStyles.listItemInner, {
          columnGap: _core.IOListItemVisualParams.iconMargin * dynamicFontScale * spacingScaleMultiplier
        }, scaleAnimatedStyle],
        children: [icon && !hugeFontEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
          allowFontScaling: true,
          name: icon,
          color: theme["icon-decorative"],
          size: _core.IOListItemVisualParams.iconSize
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
          style: {
            flex: 1
          },
          children: listItemInfoCopyContent
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
          allowFontScaling: true,
          name: "copy",
          color: foregroundColor,
          size: _core.IOListItemVisualParams.chevronSize
        })]
      })
    })
  });
};
exports.ListItemInfoCopy = ListItemInfoCopy;
//# sourceMappingURL=ListItemInfoCopy.js.map