"use strict";

import { Body, HStack, Icon, Pictogram, VStack } from "../../components";
import { useIOTheme } from "../../context";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
const DEFAULT_ICON_SIZE = 24;
const DEFAULT_PICTOGRAM_SIZE = 48;
export const FeatureInfo = ({
  action,
  body,
  iconName,
  pictogramProps,
  variant = "neutral"
}) => {
  const theme = useIOTheme();

  /* Already defined in the `BodySmall` component as a fallback value,
  but I keep it here to avoid possible future inconsistencies. */
  const accessibilityRole = action?.accessibilityRole ?? "link";
  const variantMap = {
    contrast: {
      action: "white",
      content: "white"
    },
    neutral: {
      action: theme["interactiveElem-default"],
      content: theme["textBody-tertiary"]
    }
  };
  const {
    action: actionColor,
    content: contentColor
  } = variantMap[variant];
  const FeatureInfoContent = () => {
    if (typeof body === "string") {
      return /*#__PURE__*/_jsx(Body, {
        color: contentColor,
        testID: "infoScreenBody",
        children: body
      });
    }
    return /*#__PURE__*/_jsx(_Fragment, {
      children: body
    });
  };
  return /*#__PURE__*/_jsxs(HStack, {
    style: {
      alignItems: "center"
    },
    space: 24,
    children: [iconName && /*#__PURE__*/_jsx(Icon, {
      allowFontScaling: true,
      name: iconName,
      size: DEFAULT_ICON_SIZE,
      color: theme["icon-decorative"]
    }), pictogramProps && /*#__PURE__*/_jsx(Pictogram, {
      ...pictogramProps,
      allowFontScaling: true,
      size: DEFAULT_PICTOGRAM_SIZE
    }), /*#__PURE__*/_jsxs(VStack, {
      allowScaleSpacing: true,
      space: 4,
      style: {
        flexShrink: 1
      },
      children: [/*#__PURE__*/_jsx(FeatureInfoContent, {}), action && /*#__PURE__*/_jsx(Body, {
        asLink: true,
        weight: "Semibold",
        onPress: action.onPress,
        color: actionColor,
        accessible: true,
        importantForAccessibility: "yes",
        accessibilityElementsHidden: false,
        accessibilityRole: accessibilityRole,
        children: action.label
      })]
    })]
  });
};
//# sourceMappingURL=FeatureInfo.js.map