"use strict";

import { forwardRef } from "react";
import { Pressable } from "react-native";
import { useIOTheme } from "../../context";
import { IOText } from "./IOText";
import { jsx as _jsx } from "react/jsx-runtime";
export const bodyFontSize = 16;
export const bodyLineHeight = 24;

/**
 * `Body` typographic style
 */
export const Body = /*#__PURE__*/forwardRef(({
  weight: customWeight,
  color: customColor,
  asLink,
  avoidPressable,
  accessibilityRole = "link",
  textStyle: customTextStyle,
  onPress,
  ...props
}, ref) => {
  const theme = useIOTheme();
  const defaultColor = asLink ? theme["interactiveElem-default"] : theme["textBody-tertiary"];
  const BodyProps = {
    ...props,
    dynamicTypeRamp: "body",
    // iOS only
    weight: customWeight || "Regular",
    size: bodyFontSize,
    lineHeight: bodyLineHeight,
    color: customColor ?? defaultColor,
    ...(asLink ? {
      accessibilityRole,
      textStyle: customTextStyle ?? {
        textDecorationLine: "underline"
      }
    } : {})
  };
  if (asLink && !avoidPressable) {
    return /*#__PURE__*/_jsx(Pressable, {
      onPress: onPress,
      ref: ref,
      accessibilityRole: accessibilityRole,
      children: /*#__PURE__*/_jsx(IOText, {
        ...BodyProps,
        children: props.children
      })
    });
  }
  return /*#__PURE__*/_jsx(IOText, {
    ref: ref,
    ...BodyProps,
    onPress: asLink && avoidPressable ? onPress : undefined,
    children: props.children
  });
});
//# sourceMappingURL=Body.js.map