"use strict";

import React, { forwardRef } from "react";
import { Pressable } from "react-native";
import { useIONewTypeface, useIOTheme } from "../../context";
import { IOText } from "./IOText";
import { jsx as _jsx } from "react/jsx-runtime";
const fontName = "Titillio";
const legacyFontName = "TitilliumSansPro";

/**
 * `BodySmall` typographic style
 */
export const BodySmall = /*#__PURE__*/forwardRef(({
  weight: customWeight,
  color: customColor,
  asLink,
  avoidPressable,
  accessibilityRole = "link",
  textStyle: customTextStyle,
  onPress,
  ...props
}, ref) => {
  const theme = useIOTheme();
  const {
    newTypefaceEnabled
  } = useIONewTypeface();
  const defaultColor = asLink ? theme["interactiveElem-default"] : theme["textBody-tertiary"];
  const BodySmallProps = {
    ...props,
    dynamicTypeRamp: "footnote" /* iOS only */,
    font: newTypefaceEnabled ? fontName : legacyFontName,
    weight: customWeight ?? "Regular",
    size: 14,
    lineHeight: 21,
    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, {
        ...BodySmallProps,
        children: props.children
      })
    });
  }
  return /*#__PURE__*/_jsx(IOText, {
    ref: ref,
    ...BodySmallProps,
    onPress: asLink && avoidPressable ? onPress : undefined,
    children: props.children
  });
});
//# sourceMappingURL=BodySmall.js.map