"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FeatureInfo = void 0;
var _components = require("../../components");
var _context = require("../../context");
var _jsxRuntime = require("react/jsx-runtime");
const DEFAULT_ICON_SIZE = 24;
const DEFAULT_PICTOGRAM_SIZE = 48;
const FeatureInfo = ({
  action,
  body,
  iconName,
  pictogramProps,
  variant = "neutral"
}) => {
  const theme = (0, _context.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__*/(0, _jsxRuntime.jsx)(_components.Body, {
        color: contentColor,
        testID: "infoScreenBody",
        children: body
      });
    }
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
      children: body
    });
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.HStack, {
    style: {
      alignItems: "center"
    },
    space: 24,
    children: [iconName && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
      allowFontScaling: true,
      name: iconName,
      size: DEFAULT_ICON_SIZE,
      color: theme["icon-decorative"]
    }), pictogramProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pictogram, {
      ...pictogramProps,
      allowFontScaling: true,
      size: DEFAULT_PICTOGRAM_SIZE
    }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.VStack, {
      allowScaleSpacing: true,
      space: 4,
      style: {
        flexShrink: 1
      },
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FeatureInfoContent, {}), action && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Body, {
        asLink: true,
        weight: "Semibold",
        onPress: action.onPress,
        color: actionColor,
        accessible: true,
        importantForAccessibility: "yes",
        accessibilityElementsHidden: false,
        accessibilityRole: accessibilityRole,
        children: action.label
      })]
    })]
  });
};
exports.FeatureInfo = FeatureInfo;
//# sourceMappingURL=FeatureInfo.js.map