"use strict";

import { Pressable, View } from "react-native";
import Animated from "react-native-reanimated";
import { IOListItemStyles, IOListItemVisualParams } from "../../core";
import { useIOTheme } from "../../context";
import { useListItemAnimation } from "../../hooks";
import { useIOFontDynamicScale } from "../../utils/accessibility";
import { Icon } from "../icons";
import { BodySmall, H6 } from "../typography";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
export const ListItemInfoCopy = ({
  label,
  value,
  numberOfLines = 2,
  onPress,
  icon,
  accessibilityLabel,
  accessibilityHint,
  testID
}) => {
  const theme = useIOTheme();
  const {
    onPressIn,
    onPressOut,
    scaleAnimatedStyle,
    backgroundAnimatedStyle
  } = useListItemAnimation();
  const {
    dynamicFontScale,
    spacingScaleMultiplier,
    hugeFontEnabled
  } = useIOFontDynamicScale();
  const componentValueToAccessibility = typeof value === "string" ? value : "";
  const listItemAccessibilityLabel = accessibilityLabel || `${label}; ${componentValueToAccessibility}`;
  const foregroundColor = theme["interactiveElem-default"];
  const listItemInfoCopyContent = /*#__PURE__*/_jsxs(_Fragment, {
    children: [/*#__PURE__*/_jsx(BodySmall, {
      weight: "Regular",
      color: theme["textBody-tertiary"],
      children: label
    }), typeof value === "string" ? /*#__PURE__*/_jsx(H6, {
      color: foregroundColor,
      numberOfLines: numberOfLines,
      children: value
    }) : value]
  });
  return /*#__PURE__*/_jsx(Pressable, {
    onPress: onPress,
    onPressIn: onPressIn,
    onPressOut: onPressOut,
    onTouchEnd: onPressOut,
    accessible: true,
    accessibilityLabel: listItemAccessibilityLabel,
    accessibilityHint: accessibilityHint,
    accessibilityRole: "button",
    testID: testID,
    children: /*#__PURE__*/_jsx(Animated.View, {
      importantForAccessibility: "no-hide-descendants",
      accessibilityElementsHidden: true,
      style: [IOListItemStyles.listItem, backgroundAnimatedStyle],
      children: /*#__PURE__*/_jsxs(Animated.View, {
        style: [IOListItemStyles.listItemInner, {
          columnGap: IOListItemVisualParams.iconMargin * dynamicFontScale * spacingScaleMultiplier
        }, scaleAnimatedStyle],
        children: [icon && !hugeFontEnabled && /*#__PURE__*/_jsx(Icon, {
          allowFontScaling: true,
          name: icon,
          color: theme["icon-decorative"],
          size: IOListItemVisualParams.iconSize
        }), /*#__PURE__*/_jsx(View, {
          style: {
            flex: 1
          },
          children: listItemInfoCopyContent
        }), /*#__PURE__*/_jsx(Icon, {
          allowFontScaling: true,
          name: "copy",
          color: foregroundColor,
          size: IOListItemVisualParams.chevronSize
        })]
      })
    })
  });
};
//# sourceMappingURL=ListItemInfoCopy.js.map