@yahoo/uds-mobile 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -304,6 +304,7 @@ function generateComponents(config, colorMode) {
304
304
  }
305
305
  const targetObj = isRootLayer && TEXT_ONLY_PROPS.has(propName) ? textStyleObj : viewStyleObj;
306
306
  for (const rnProp of rnProps) targetObj[rnProp] = resolvedValue;
307
+ if (stateValue.type === "iconSizes") targetObj.iconSizeToken = stateValue.value;
307
308
  }
308
309
  if (shadowValues.length > 0) viewStyleObj.boxShadow = boxShadowToCssString(shadowValues);
309
310
  if (variantPath[0] === "textStyle") {
@@ -71,9 +71,9 @@ const Avatar = (0, react.forwardRef)(function Avatar({ src, alt, fallback, size
71
71
  const showIcon = !hasImage && !hasText;
72
72
  generated_styles.avatarStyles.useVariants({
73
73
  size,
74
- image: variant,
75
- text: variant,
76
- icon: variant
74
+ ...showImage && { image: variant },
75
+ ...showText && { text: variant },
76
+ ...showIcon && { icon: variant }
77
77
  });
78
78
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
79
79
  ref,
@@ -69,9 +69,9 @@ const Avatar = forwardRef(function Avatar({ src, alt, fallback, size = "md", var
69
69
  const showIcon = !hasImage && !hasText;
70
70
  avatarStyles.useVariants({
71
71
  size,
72
- image: variant,
73
- text: variant,
74
- icon: variant
72
+ ...showImage && { image: variant },
73
+ ...showText && { text: variant },
74
+ ...showIcon && { icon: variant }
75
75
  });
76
76
  return /* @__PURE__ */ jsxs(Box, {
77
77
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.mjs","names":["RNImage","Text"],"sources":["../../src/components/Avatar.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport { Image as RNImage } from 'react-native';\n\nimport { avatarStyles } from '../../generated/styles';\nimport { Box } from './Box';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\n/** Avatar size options */\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** Avatar variant options */\ntype AvatarVariant = 'primary' | 'secondary';\n\n/** Abbreviation strategy for generating initials */\ntype AbbreviationStrategy =\n | 'first'\n | 'last'\n | 'firstAndLast'\n | 'firstTwo'\n | 'firstThree'\n | 'firstOfEach'\n | ((name: string) => string);\n\ninterface AvatarProps extends ViewProps {\n /** Image source URL */\n src?: string;\n /** Alt text for the image, also used for generating initials */\n alt?: string;\n /** Explicit initials to display (overrides auto-generated from alt) */\n fallback?: string;\n /** Size of the avatar @default 'md' */\n size?: AvatarSize;\n /** Variant style @default 'primary' */\n variant?: AvatarVariant;\n /** Custom icon to display when no image or text fallback */\n icon?: IconSlotType;\n /** Strategy for generating initials from name @default 'firstAndLast' */\n abbreviationStrategy?: AbbreviationStrategy;\n}\n\nconst abbreviationStrategies: Record<\n Exclude<AbbreviationStrategy, (name: string) => string>,\n (initials: string[]) => string\n> = {\n first: (initials) => initials[0] ?? '',\n last: (initials) => initials[initials.length - 1] ?? '',\n firstAndLast: (initials) =>\n initials.length === 1 ? (initials[0] ?? '') : `${initials[0]}${initials[initials.length - 1]}`,\n firstTwo: (initials) => initials.slice(0, 2).join(''),\n firstThree: (initials) => initials.slice(0, 3).join(''),\n firstOfEach: (initials) => initials.join(''),\n};\n\n/** Generate initials from a name */\nfunction generateInitials(name?: string, strategy: AbbreviationStrategy = 'firstAndLast'): string {\n if (!name) {\n return '';\n }\n\n if (typeof strategy === 'function') {\n return strategy(name);\n }\n\n const words = name.trim().split(/\\s+/);\n const initials = words.map((word) => word[0]?.toUpperCase() ?? '');\n\n return abbreviationStrategies[strategy](initials);\n}\n\n/**\n * **Avatar component for user representation**\n *\n * @description\n * Displays a user avatar with image, initials fallback, or icon fallback.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Avatar } from '@yahoo/uds-mobile';\n *\n * // With image\n * <Avatar\n * src=\"https://example.com/photo.jpg\"\n * alt=\"Jane Doe\"\n * />\n *\n * // With initials fallback\n * <Avatar alt=\"Jane Doe\" />\n *\n * // With explicit initials\n * <Avatar fallback=\"JD\" />\n *\n * // With custom icon\n * <Avatar icon=\"Person\" variant=\"secondary\" />\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"image\"` automatically\n * - Uses `alt` prop as accessibility label\n * - Always provide meaningful `alt` text for user identification\n *\n * @see {@link Image} for general image display\n */\nconst Avatar = forwardRef<View, AvatarProps>(function Avatar(\n {\n src,\n alt,\n fallback,\n size = 'md',\n variant = 'primary',\n icon,\n abbreviationStrategy = 'firstAndLast',\n style,\n ...props\n },\n ref,\n) {\n const [imageError, setImageError] = useState(false);\n\n const initials = fallback || generateInitials(alt, abbreviationStrategy);\n\n const hasImage = src && !imageError;\n const hasText = initials.length > 0;\n const showImage = hasImage;\n const showText = !hasImage && hasText;\n const showIcon = !hasImage && !hasText;\n\n avatarStyles.useVariants({\n size,\n image: variant,\n text: variant,\n icon: variant,\n });\n\n return (\n <Box\n ref={ref}\n style={[\n avatarStyles.root,\n { alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },\n style,\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={alt}\n {...props}\n >\n {showImage && (\n <RNImage\n source={{ uri: src }}\n style={{ width: '100%', height: '100%' }}\n onError={() => setImageError(true)}\n accessibilityLabel={alt}\n />\n )}\n\n {showText && (\n <Text style={avatarStyles.text} numberOfLines={1}>\n {initials}\n </Text>\n )}\n\n {showIcon && <IconSlot icon={icon ?? 'Person'} variant=\"fill\" style={avatarStyles.icon} />}\n </Box>\n );\n});\n\nAvatar.displayName = 'Avatar';\n\nexport { Avatar, type AvatarProps };\n"],"mappings":";;;;;;;;;;AA2CA,MAAM,yBAGF;CACF,QAAQ,aAAa,SAAS,MAAM;CACpC,OAAO,aAAa,SAAS,SAAS,SAAS,MAAM;CACrD,eAAe,aACb,SAAS,WAAW,IAAK,SAAS,M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ACC;IAAK,OAAO,aAAa;IAAM,eAAe;cAC5C;KACI;GAGR,YAAY,oBAAC;IAAS,MAAM,QAAQ;IAAU,SAAQ;IAAO,OAAO,aAAa;KAAQ;;GACtF;EAER;AAEF,OAAO,cAAc"}
1
+ {"version":3,"file":"Avatar.mjs","names":["RNImage","Text"],"sources":["../../src/components/Avatar.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport { Image as RNImage } from 'react-native';\n\nimport { avatarStyles } from '../../generated/styles';\nimport { Box } from './Box';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\n/** Avatar size options */\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** Avatar variant options */\ntype AvatarVariant = 'primary' | 'secondary';\n\n/** Abbreviation strategy for generating initials */\ntype AbbreviationStrategy =\n | 'first'\n | 'last'\n | 'firstAndLast'\n | 'firstTwo'\n | 'firstThree'\n | 'firstOfEach'\n | ((name: string) => string);\n\ninterface AvatarProps extends ViewProps {\n /** Image source URL */\n src?: string;\n /** Alt text for the image, also used for generating initials */\n alt?: string;\n /** Explicit initials to display (overrides auto-generated from alt) */\n fallback?: string;\n /** Size of the avatar @default 'md' */\n size?: AvatarSize;\n /** Variant style @default 'primary' */\n variant?: AvatarVariant;\n /** Custom icon to display when no image or text fallback */\n icon?: IconSlotType;\n /** Strategy for generating initials from name @default 'firstAndLast' */\n abbreviationStrategy?: AbbreviationStrategy;\n}\n\nconst abbreviationStrategies: Record<\n Exclude<AbbreviationStrategy, (name: string) => string>,\n (initials: string[]) => string\n> = {\n first: (initials) => initials[0] ?? '',\n last: (initials) => initials[initials.length - 1] ?? '',\n firstAndLast: (initials) =>\n initials.length === 1 ? (initials[0] ?? '') : `${initials[0]}${initials[initials.length - 1]}`,\n firstTwo: (initials) => initials.slice(0, 2).join(''),\n firstThree: (initials) => initials.slice(0, 3).join(''),\n firstOfEach: (initials) => initials.join(''),\n};\n\n/** Generate initials from a name */\nfunction generateInitials(name?: string, strategy: AbbreviationStrategy = 'firstAndLast'): string {\n if (!name) {\n return '';\n }\n\n if (typeof strategy === 'function') {\n return strategy(name);\n }\n\n const words = name.trim().split(/\\s+/);\n const initials = words.map((word) => word[0]?.toUpperCase() ?? '');\n\n return abbreviationStrategies[strategy](initials);\n}\n\n/**\n * **Avatar component for user representation**\n *\n * @description\n * Displays a user avatar with image, initials fallback, or icon fallback.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Avatar } from '@yahoo/uds-mobile';\n *\n * // With image\n * <Avatar\n * src=\"https://example.com/photo.jpg\"\n * alt=\"Jane Doe\"\n * />\n *\n * // With initials fallback\n * <Avatar alt=\"Jane Doe\" />\n *\n * // With explicit initials\n * <Avatar fallback=\"JD\" />\n *\n * // With custom icon\n * <Avatar icon=\"Person\" variant=\"secondary\" />\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"image\"` automatically\n * - Uses `alt` prop as accessibility label\n * - Always provide meaningful `alt` text for user identification\n *\n * @see {@link Image} for general image display\n */\nconst Avatar = forwardRef<View, AvatarProps>(function Avatar(\n {\n src,\n alt,\n fallback,\n size = 'md',\n variant = 'primary',\n icon,\n abbreviationStrategy = 'firstAndLast',\n style,\n ...props\n },\n ref,\n) {\n const [imageError, setImageError] = useState(false);\n\n const initials = fallback || generateInitials(alt, abbreviationStrategy);\n\n const hasImage = src && !imageError;\n const hasText = initials.length > 0;\n const showImage = hasImage;\n const showText = !hasImage && hasText;\n const showIcon = !hasImage && !hasText;\n\n avatarStyles.useVariants({\n size,\n ...(showImage && { image: variant }),\n ...(showText && { text: variant }),\n ...(showIcon && { icon: variant }),\n });\n\n return (\n <Box\n ref={ref}\n style={[\n avatarStyles.root,\n { alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },\n style,\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={alt}\n {...props}\n >\n {showImage && (\n <RNImage\n source={{ uri: src }}\n style={{ width: '100%', height: '100%' }}\n onError={() => setImageError(true)}\n accessibilityLabel={alt}\n />\n )}\n\n {showText && (\n <Text style={avatarStyles.text} numberOfLines={1}>\n {initials}\n </Text>\n )}\n\n {showIcon && <IconSlot icon={icon ?? 'Person'} variant=\"fill\" style={avatarStyles.icon} />}\n </Box>\n );\n});\n\nAvatar.displayName = 'Avatar';\n\nexport { Avatar, type AvatarProps };\n"],"mappings":";;;;;;;;;;AA2CA,MAAM,yBAGF;CACF,QAAQ,aAAa,SAAS,MAAM;CACpC,OAAO,aAAa,SAAS,SAAS,SAAS,MAAM;CACrD,eAAe,aACb,SAAS,WAAW,IAAK,SAAS,MAAM,KAAM,GAAG,SAAS,KAAK,SAAS,SAAS,SAAS;CAC5F,WAAW,aAAa,SAAS,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG;CACrD,aAAa,aAAa,SAAS,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG;CACvD,cAAc,aAAa,SAAS,KAAK,GAAG;CAC7C;;AAGD,SAAS,iBAAiB,MAAe,WAAiC,gBAAwB;AAChG,KAAI,CAAC,KACH,QAAO;AAGT,KAAI,OAAO,aAAa,WACtB,QAAO,SAAS,KAAK;CAIvB,MAAM,WADQ,KAAK,MAAM,CAAC,MAAM,MAAM,CACf,KAAK,SAAS,KAAK,IAAI,aAAa,IAAI,GAAG;AAElE,QAAO,uBAAuB,UAAU,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCnD,MAAM,SAAS,WAA8B,SAAS,OACpD,EACE,KACA,KACA,UACA,OAAO,MACP,UAAU,WACV,MACA,uBAAuB,gBACvB,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CAEnD,MAAM,WAAW,YAAY,iBAAiB,KAAK,qBAAqB;CAExE,MAAM,WAAW,OAAO,CAAC;CACzB,MAAM,UAAU,SAAS,SAAS;CAClC,MAAM,YAAY;CAClB,MAAM,WAAW,CAAC,YAAY;CAC9B,MAAM,WAAW,CAAC,YAAY,CAAC;AAE/B,cAAa,YAAY;EACvB;EACA,GAAI,aAAa,EAAE,OAAO,SAAS;EACnC,GAAI,YAAY,EAAE,MAAM,SAAS;EACjC,GAAI,YAAY,EAAE,MAAM,SAAS;EAClC,CAAC;AAEF,QACE,qBAAC;EACM;EACL,OAAO;GACL,aAAa;GACb;IAAE,YAAY;IAAU,gBAAgB;IAAU,UAAU;IAAU;GACtE;GACD;EACD,mBAAkB;EAClB,oBAAoB;EACpB,GAAI;;GAEH,aACC,oBAACA;IACC,QAAQ,EAAE,KAAK,KAAK;IACpB,OAAO;KAAE,OAAO;KAAQ,QAAQ;KAAQ;IACxC,eAAe,cAAc,KAAK;IAClC,oBAAoB;KACpB;GAGH,YACC,oBAACC;IAAK,OAAO,aAAa;IAAM,eAAe;cAC5C;KACI;GAGR,YAAY,oBAAC;IAAS,MAAM,QAAQ;IAAU,SAAQ;IAAO,OAAO,aAAa;KAAQ;;GACtF;EAER;AAEF,OAAO,cAAc"}
@@ -136,6 +136,7 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
136
136
  const showLoading = !!loading;
137
137
  const showStartIcon = !!startIcon && !loading;
138
138
  const showEndIcon = !!endIcon && !loading;
139
+ const iconSizeToken = generated_styles.buttonStyles.icon.iconSizeToken ?? "sm";
139
140
  const startContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedIconSlot, {
140
141
  visible: showLoading || showStartIcon,
141
142
  iconSize,
@@ -145,6 +146,7 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
145
146
  color: generated_styles.buttonStyles.icon.color
146
147
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
147
148
  icon: startIcon,
149
+ size: iconSizeToken,
148
150
  variant: iconVariant,
149
151
  style: generated_styles.buttonStyles.icon
150
152
  })
@@ -155,6 +157,7 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
155
157
  gap: buttonGap,
156
158
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
157
159
  icon: endIcon,
160
+ size: iconSizeToken,
158
161
  variant: iconVariant,
159
162
  style: generated_styles.buttonStyles.icon
160
163
  })
@@ -133,6 +133,7 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
133
133
  const showLoading = !!loading;
134
134
  const showStartIcon = !!startIcon && !loading;
135
135
  const showEndIcon = !!endIcon && !loading;
136
+ const iconSizeToken = buttonStyles.icon.iconSizeToken ?? "sm";
136
137
  const startContent = /* @__PURE__ */ jsx(AnimatedIconSlot, {
137
138
  visible: showLoading || showStartIcon,
138
139
  iconSize,
@@ -142,6 +143,7 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
142
143
  color: buttonStyles.icon.color
143
144
  }) : /* @__PURE__ */ jsx(IconSlot, {
144
145
  icon: startIcon,
146
+ size: iconSizeToken,
145
147
  variant: iconVariant,
146
148
  style: buttonStyles.icon
147
149
  })
@@ -152,6 +154,7 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
152
154
  gap: buttonGap,
153
155
  children: /* @__PURE__ */ jsx(IconSlot, {
154
156
  icon: endIcon,
157
+ size: iconSizeToken,
155
158
  variant: iconVariant,
156
159
  style: buttonStyles.icon
157
160
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","names":["Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string | undefined, alpha: number): string {\n 'worklet';\n if (!shadow) {\n return '';\n }\n if (alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** The visual style variant of the button @default 'primary' */\n variant?: ButtonVariantFlat;\n /** The size of the button @default 'md' */\n size?: ButtonSize;\n /** The icon style variant @default 'outline' */\n iconVariant?: IconVariant;\n /** Icon displayed before the button label */\n startIcon?: IconSlotType;\n /** Icon displayed after the button label */\n endIcon?: IconSlotType;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Button label content */\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"button\"` automatically\n * - Announces loading state to screen readers\n * - Use `accessibilityLabel` for icon-only buttons\n *\n * @see {@link IconButton} for icon-only buttons\n * @see {@link Link} for navigation actions\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n children\n ) : (\n <Text numberOfLines={1} textAlign=\"center\" style={buttonStyles.text}>\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath]?.boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // Only animate shadow if the theme defines one for this variant\n ...(shadowPressed && {\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n }),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot visible={showLoading || showStartIcon} iconSize={iconSize} gap={buttonGap}>\n {showLoading ? (\n <ActivityIndicator size={buttonStyles.icon.fontSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot icon={startIcon} variant={iconVariant} style={buttonStyles.icon} />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot visible={showEndIcon} iconSize={iconSize} gap={buttonGap}>\n <IconSlot icon={endIcon} variant={iconVariant} style={buttonStyles.icon} />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAS,uBAAuB,QAA4B,OAAuB;AACjF;AACA,KAAI,CAAC,OACH,QAAO;AAET,KAAI,SAAS,EACX,QAAO;AAET,KAAI,SAAS,EACX,QAAO;AAGT,QAAO,OAAO,QAAQ,sDAAsD,GAAG,GAAG,GAAG,GAAG,MAAM;AAE5F,SAAO,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KADZ,WAAW,EAAE,GAAG,OACS,QAAQ,EAAE,CAAC;GACrD;;;;;;;AAYJ,SAAS,iBAAiB,EACxB,UACA,SACA,UACA,OAMC;CAGD,MAAM,WAAW,sBACT,WAAW,UAAU,IAAI,GAAG,qBAAqB,EACvD,CAAC,QAAQ,CACV;CAED,MAAM,gBAAgB,uBAAuB;EAE3C,MAAM,aAAa,WAAW;AAS9B,SAAO;GACL,OATY,YAAY,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC;GAUhE,SALc,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,QAAQ;GAMpE,WAAW,CAAC,EAAE,OALF,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,IAAK,EAAE,EAAE,QAAQ,EAK/C,CAAC;GACtB,UAAU;GACX;GACD;AAEF,QAAO,oBAAC,SAAS;EAAK,OAAO;EAAgB;GAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4ExE,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,UAAU,WACV,OAAO,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EACtE;GACF;GACD;CAGF,MAAM,cAAc,CAAC,CAAC;CACtB,MAAM,gBAAgB,CAAC,CAAC,aAAa,CAAC;CACtC,MAAM,cAAc,CAAC,CAAC,WAAW,CAAC;CAGlC,MAAM,eACJ,oBAAC;EAAiB,SAAS,eAAe;EAAyB;EAAU,KAAK;YAC/E,cACC,oBAAC;GAAkB,MAAM,aAAa,KAAK;GAAU,OAAO,aAAa,KAAK;IAAS,GAEvF,oBAAC;GAAS,MAAM;GAAW,SAAS;GAAa,OAAO,aAAa;IAAQ;GAE9D;CAIrB,MAAM,aACJ,oBAAC;EAAiB,SAAS;EAAuB;EAAU,KAAK;YAC/D,oBAAC;GAAS,MAAM;GAAS,SAAS;GAAa,OAAO,aAAa;IAAQ;GAC1D;CAGrB,MAAM,aAAa,cACX;EACJ,aAAa;EACb;EACA,OAAO,UAAU,aAAa,MAAM,EAAE,SAAS,CAAC,GAAG;EACpD,EACD;EAAC,aAAa;EAAM;EAAgB;EAAO;EAAQ,CACpD;AAGD,QACE,qBAAC;EACM;EACK;EACV,WAAW;EACX,YAAY;EACZ,eAAc;EACd,YAAW;EACX,gBAAe;EACf,UAAS;EACT,oBAAoB,UAAU,GAAG,sBAAsB,GAAG,aAAa;EACpD;EACnB,mBAAkB;EAClB,oBAAoB;EACpB,cAAa;EACb,OAAO;EACP,GAAI;;GAEH;GACA;GACA;;GACiB;EAEtB;AAEF,OAAO,cAAc"}
1
+ {"version":3,"file":"Button.mjs","names":["Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconSize, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string | undefined, alpha: number): string {\n 'worklet';\n if (!shadow) {\n return '';\n }\n if (alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** The visual style variant of the button @default 'primary' */\n variant?: ButtonVariantFlat;\n /** The size of the button @default 'md' */\n size?: ButtonSize;\n /** The icon style variant @default 'outline' */\n iconVariant?: IconVariant;\n /** Icon displayed before the button label */\n startIcon?: IconSlotType;\n /** Icon displayed after the button label */\n endIcon?: IconSlotType;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Button label content */\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"button\"` automatically\n * - Announces loading state to screen readers\n * - Use `accessibilityLabel` for icon-only buttons\n *\n * @see {@link IconButton} for icon-only buttons\n * @see {@link Link} for navigation actions\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n children\n ) : (\n <Text numberOfLines={1} textAlign=\"center\" style={buttonStyles.text}>\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath]?.boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // Only animate shadow if the theme defines one for this variant\n ...(shadowPressed && {\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n }),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n const iconSizeToken = (buttonStyles.icon.iconSizeToken as IconSize) ?? 'sm';\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot visible={showLoading || showStartIcon} iconSize={iconSize} gap={buttonGap}>\n {showLoading ? (\n <ActivityIndicator size={buttonStyles.icon.fontSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot\n icon={startIcon}\n size={iconSizeToken}\n variant={iconVariant}\n style={buttonStyles.icon}\n />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot visible={showEndIcon} iconSize={iconSize} gap={buttonGap}>\n <IconSlot\n icon={endIcon}\n size={iconSizeToken}\n variant={iconVariant}\n style={buttonStyles.icon}\n />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAS,uBAAuB,QAA4B,OAAuB;AACjF;AACA,KAAI,CAAC,OACH,QAAO;AAET,KAAI,SAAS,EACX,QAAO;AAET,KAAI,SAAS,EACX,QAAO;AAGT,QAAO,OAAO,QAAQ,sDAAsD,GAAG,GAAG,GAAG,GAAG,MAAM;AAE5F,SAAO,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KADZ,WAAW,EAAE,GAAG,OACS,QAAQ,EAAE,CAAC;GACrD;;;;;;;AAYJ,SAAS,iBAAiB,EACxB,UACA,SACA,UACA,OAMC;CAGD,MAAM,WAAW,sBACT,WAAW,UAAU,IAAI,GAAG,qBAAqB,EACvD,CAAC,QAAQ,CACV;CAED,MAAM,gBAAgB,uBAAuB;EAE3C,MAAM,aAAa,WAAW;AAS9B,SAAO;GACL,OATY,YAAY,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC;GAUhE,SALc,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,QAAQ;GAMpE,WAAW,CAAC,EAAE,OALF,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,IAAK,EAAE,EAAE,QAAQ,EAK/C,CAAC;GACtB,UAAU;GACX;GACD;AA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AAM,WACb,kBAAkB,QAAQ,iBACC;AAErD,SAAO;GACL,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,CAAC;GAEnC,GAAI,iBAAiB,EACnB,WAAW,uBAAuB,eAAe,cAAc,MAAM,EACtE;GACF;GACD;CAGF,MAAM,cAAc,CAAC,CAAC;CACtB,MAAM,gBAAgB,CAAC,CAAC,aAAa,CAAC;CACtC,MAAM,cAAc,CAAC,CAAC,WAAW,CAAC;CAElC,MAAM,gBAAiB,aAAa,KAAK,iBAA8B;CAGvE,MAAM,eACJ,oBAAC;EAAiB,SAAS,eAAe;EAAyB;EAAU,KAAK;YAC/E,cACC,oBAAC;GAAkB,MAAM,aAAa,KAAK;GAAU,OAAO,aAAa,KAAK;IAAS,GAEvF,oBAAC;GACC,MAAM;GACN,MAAM;GACN,SAAS;GACT,OAAO,aAAa;IACpB;GAEa;CAIrB,MAAM,aACJ,oBAAC;EAAiB,SAAS;EAAuB;EAAU,KAAK;YAC/D,oBAAC;GACC,MAAM;GACN,MAAM;GACN,SAAS;GACT,OAAO,aAAa;IACpB;GACe;CAGrB,MAAM,aAAa,cACX;EACJ,aAAa;EACb;EACA,OAAO,UAAU,aAAa,MAAM,EAAE,SAAS,CAAC,GAAG;EACpD,EACD;EAAC,aAAa;EAAM;EAAgB;EAAO;EAAQ,CACpD;AAGD,QACE,qBAAC;EACM;EACK;EACV,WAAW;EACX,YAAY;EACZ,eAAc;EACd,YAAW;EACX,gBAAe;EACf,UAAS;EACT,oBAAoB,UAAU,GAAG,sBAAsB,GAAG,aAAa;EACpD;EACnB,mBAAkB;EAClB,oBAAoB;EACpB,cAAa;EACb,OAAO;EACP,GAAI;;GAEH;GACA;GACA;;GACiB;EAEtB;AAEF,OAAO,cAAc"}
@@ -93,7 +93,9 @@ const OutlineOrFillIcon = (0, react.memo)(function OutlineOrFillIcon({ name, siz
93
93
  {
94
94
  fontFamily: "uds-icons",
95
95
  textAlign: "center",
96
- textAlignVertical: "center"
96
+ textAlignVertical: "center",
97
+ fontSize: pixelSize,
98
+ lineHeight: pixelSize
97
99
  },
98
100
  generated_styles.styles.foundation,
99
101
  dangerouslySetColor ? { color: dangerouslySetColor } : void 0,
@@ -106,7 +108,8 @@ const OutlineOrFillIcon = (0, react.memo)(function OutlineOrFillIcon({ name, siz
106
108
  dangerouslySetColor,
107
109
  dangerouslySetSize,
108
110
  style,
109
- generated_styles.styles.foundation
111
+ generated_styles.styles.foundation,
112
+ pixelSize
110
113
  ]),
111
114
  ...props,
112
115
  children: glyph
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.cts","names":[],"sources":["../../src/components/Icon.tsx"],"mappings":";;;;;;;;;;KAkCK,QAAA,GAAW,SAAA,GAAY,YAAA;AAAA,UAElB,SAAA,SAAkB,IAAA,CAAK,SAAA;;EAE/B,GAAA,GAAM,GAAA,CAAI,IAAA;EAJC;EAMX,IAAA,EAAM,QAAA;EANQ;EAQd,IAAA,GAAO,QAAA;EANC;EAQR,KAAA,GAAQ,UAAA;;EAER,OAAA,GAAU,WAAA;EAEV,eAAA,GAAkB,UAAA;EAElB,YAAA,GAAe,UAAA;EACf,oBAAA,GAAuB,UAAA;EACvB,kBAAA,GAAqB,UAAA;EACrB,uBAAA,GAA0B,UAAA;EAC1B,qBAAA,GAAwB,UAAA;EACxB,WAAA,GAAc,UAAA;EACd,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EACpB,WAAA,GAAc,UAAA;EACd,mBAAA,GAAsB,UAAA;EACtB,qBAAA,GAAwB,UAAA;EACxB,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EAEpB,UAAA,GAAa,UAAA;EAEb,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EACb,UAAA,GAAa,UAAA;EACb,aAAA,GAAgB,UAAA;EAChB,iB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AAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EACpB,WAAA,GAAc,UAAA;EACd,mBAAA,GAAsB,UAAA;EACtB,qBAAA,GAAwB,UAAA;EACxB,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EAEpB,UAAA,GAAa,UAAA;EAEb,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EACb,UAAA,GAAa,UAAA;EACb,aAAA,GAAgB,UAAA;EAChB,iBAAA,GAAoB,UAAA;EACpB,eAAA,GAAkB,UAAA;EAClB,OAAA,GAAU,UAAA;EAEV,WAAA,GAAc,UAAA;EACd,SAAA,GAAY,UAAA;EACZ,SAAA,GAAY,UAAA;EACZ,YAAA,GAAe,UAAA;EACf,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,MAAA,GAAS,UAAA;EALG;EAOZ,mBAAA;EALe;EAOf,kBAAA;EALiB;EAOjB,KAAA,GAAQ,SAAA,CAAU,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiNd,IAAA,EAAI,KAAA,CAAA,oBAAA,CAAA,SAAA;AAAA,cAaG,SAAA;AAAA,cACA,mBAAA"}
@@ -91,7 +91,9 @@ const OutlineOrFillIcon = memo(function OutlineOrFillIcon({ name, size = DEFAULT
91
91
  {
92
92
  fontFamily: "uds-icons",
93
93
  textAlign: "center",
94
- textAlignVertical: "center"
94
+ textAlignVertical: "center",
95
+ fontSize: pixelSize,
96
+ lineHeight: pixelSize
95
97
  },
96
98
  styles.foundation,
97
99
  dangerouslySetColor ? { color: dangerouslySetColor } : void 0,
@@ -104,7 +106,8 @@ const OutlineOrFillIcon = memo(function OutlineOrFillIcon({ name, size = DEFAULT
104
106
  dangerouslySetColor,
105
107
  dangerouslySetSize,
106
108
  style,
107
- styles.foundation
109
+ styles.foundation,
110
+ pixelSize
108
111
  ]),
109
112
  ...props,
110
113
  children: glyph
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.mjs","names":[],"sources":["../../src/components/Icon.tsx"],"sourcesContent":["import type { GlyphName } from '@yahoo/uds-icons/glyphMap';\nimport { glyphMap, glyphNames } from '@yahoo/uds-icons/glyphMap';\nimport type { SvgGlyphKey, SvgGlyphName } from '@yahoo/uds-icons/svgMap';\nimport { svgGlyphNames, svgMap } from '@yahoo/uds-icons/svgMap';\nimport { ICON_SIZE_MAP } from '@yahoo/uds-icons/tokens';\nimport type { IconSize, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type {\n StyleProp,\n Text as RNText,\n TextProps as RNTextProps,\n TextStyle,\n ViewProps,\n} from 'react-native';\nimport { Text, View } from 'react-native';\nimport { SvgXml } from 'react-native-svg';\n// eslint-disable-next-line uds/no-use-unistyles\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\n\nconst DEFAULT_PROPS = {\n size: 'md',\n color: 'primary',\n variant: 'outline',\n flexShrink: '0',\n} as const;\n\n/* -------------------------------------------------------------------------- */\n/* Icon Props */\n/* -------------------------------------------------------------------------- */\n\ntype IconName = GlyphName | SvgGlyphName;\n\ninterface IconProps extends Omit<RNTextProps, 'style'> {\n /** Ref to the underlying Text element */\n ref?: Ref<RNText>;\n /** The icon name */\n name: IconName;\n /** Icon size */\n size?: IconSize;\n /** Icon color */\n color?: StyleProps['color'];\n /** Icon variant (outline, fill, multicolor) */\n variant?: IconVariant;\n // Background\n backgroundColor?: StyleProps['backgroundColor'];\n // Border\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n // Flex\n flexShrink?: StyleProps['flexShrink'];\n // Spacing\n spacingStart?: StyleProps['spacingStart'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingTop?: StyleProps['spacingTop'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacing?: StyleProps['spacing'];\n // Offset\n offsetStart?: StyleProps['offsetStart'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetTop?: StyleProps['offsetTop'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetVertical?: StyleProps['offsetVertical'];\n offset?: StyleProps['offset'];\n /** Icon color override */\n dangerouslySetColor?: string;\n /** Icon font size override */\n dangerouslySetSize?: number;\n /** Optional style override */\n style?: StyleProp<TextStyle>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Multicolor Icon */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Separate component for multicolor SVG icons.\n * Uses useUnistyles() for reactive theme access - isolated here so\n * glyph-based icons don't pay the hook overhead.\n */\nconst MulticolorIcon = memo(function MulticolorIcon({\n name,\n size = DEFAULT_PROPS.size,\n flexShrink = DEFAULT_PROPS.flexShrink,\n backgroundColor,\n dangerouslySetSize,\n}: Omit<IconProps, 'variant'>) {\n // Reactive theme subscription - only multicolor icons need this\n const { rt } = useUnistyles();\n const colorScheme = rt.themeName === 'dark' ? 'dark' : 'light';\n\n const pixelSize = ICON_SIZE_MAP[size];\n const svgKey = `${name}-${colorScheme}-${pixelSize}` as SvgGlyphKey;\n const svgContent = svgMap[svgKey];\n\n if (!svgContent) {\n console.warn(`Multicolor icon \"${svgKey}\" not found`);\n return null;\n }\n\n styles.useVariants({\n flexShrink,\n backgroundColor,\n });\n\n return (\n <View style={styles.foundation as ViewProps['style']}>\n <SvgXml\n xml={svgContent}\n width={dangerouslySetSize ?? pixelSize}\n height={dangerouslySetSize ?? pixelSize}\n />\n </View>\n );\n});\n\nconst OutlineOrFillIcon = memo(function OutlineOrFillIcon({\n name,\n size = DEFAULT_PROPS.size,\n color = DEFAULT_PROPS.color,\n variant = DEFAULT_PROPS.variant,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n flexShrink = '0',\n // Spacing\n spacingStart,\n spacingEnd,\n spacingTop,\n spacingBottom,\n spacingHorizontal,\n spacingVertical,\n spacing,\n // Offset\n offsetStart,\n offsetEnd,\n offsetTop,\n offsetBottom,\n offsetHorizontal,\n offsetVertical,\n offset,\n // Dangerously set props\n dangerouslySetColor,\n dangerouslySetSize,\n style,\n ref,\n ...props\n}: Omit<IconProps, 'variant'> & { variant?: 'outline' | 'fill' }) {\n const pixelSize = ICON_SIZE_MAP[size];\n // Glyph-based icons - no useUnistyles needed, styles.useVariants is reactive\n styles.useVariants({\n color,\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n flexShrink,\n // Spacing\n spacingStart,\n spacingEnd,\n spacingTop,\n spacingBottom,\n spacingHorizontal,\n spacingVertical,\n spacing,\n // Offset\n offsetStart,\n offsetEnd,\n offsetTop,\n offsetBottom,\n offsetHorizontal,\n offsetVertical,\n offset,\n });\n const glyphName = `${name}-${variant}-${pixelSize}`;\n const glyph = (glyphMap as Record<string, string>)[glyphName];\n const textStyles: StyleProp<TextStyle> = useMemo(\n () => [\n {\n fontFamily: 'uds-icons',\n textAlign: 'center',\n textAlignVertical: 'center',\n },\n styles.foundation,\n dangerouslySetColor ? { color: dangerouslySetColor } : undefined,\n dangerouslySetSize\n ? {\n fontSize: dangerouslySetSize,\n lineHeight: dangerouslySetSize,\n }\n : undefined,\n style,\n ],\n [dangerouslySetColor, dangerouslySetSize, style, styles.foundation],\n );\n\n return (\n <Text\n ref={ref}\n accessibilityRole=\"image\"\n accessibilityLabel={name}\n style={textStyles}\n {...props}\n >\n {glyph}\n </Text>\n );\n});\n\n/**\n * **🎨 An icon component using UDS icon fonts**\n *\n * @description\n * Renders icons from the UDS icon library. Supports multiple variants\n * (outline, fill, multicolor) and sizes.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Icon } from '@yahoo/uds-mobile';\n *\n * <Icon name=\"ChevronRight\" size=\"md\" color=\"primary\" />\n * <Icon name=\"Star\" variant=\"fill\" color=\"accent\" />\n * <Icon name=\"Yahoo\" variant=\"multicolor\" />\n * ```\n *\n * @usage\n * - Use name prop to specify the icon\n * - Use variant prop for outline/fill/multicolor\n * - Use size prop for icon size (xs, sm, md, lg, xl)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"image\"` automatically\n * - Icon name is used as accessibility label\n * - For decorative icons, set `accessibilityElementsHidden`\n *\n * @see {@link IconButton} for clickable icons\n * @see {@link IconSlot} for flexible icon rendering in components\n */\nconst Icon = memo(function Icon({ variant, ...props }: IconProps) {\n // Delegate to MulticolorIcon for SVG-based icons (has its own useUnistyles)\n if (variant === 'multicolor') {\n return <MulticolorIcon {...props} />;\n }\n\n return <OutlineOrFillIcon variant={variant} {...props} />;\n});\n\nIcon.displayName = 'Icon';\n\nexport { Icon };\nexport type { IconName, IconProps };\nexport const iconNames = glyphNames;\nexport const multicolorIconNames = svgGlyphNames;\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,gBAAgB;CACpB,MAAM;CACN,OAAO;CACP,SAAS;CACT,YAAY;CACb;;;;;;AA0ED,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,MACA,OAAO,cAAc,MACrB,aAAa,cAAc,YAC3B,iBACA,sBAC6B;CAE7B,MAAM,EAAE,OAAO,cAAc;CAC7B,MAAM,cAAc,GAAG,cAAc,SAAS,SAAS;CAEvD,MAAM,YAAY,cAAc;CAChC,MAAM,SAAS,GAAG,KAAK,GAAG,YAAY,GAAG;CACzC,MAAM,aAAa,OAAO;AAE1B,KAAI,CAAC,YAAY;AACf,UAAQ,KAAK,oBAAoB,OAAO,aAAa;AACrD,SAAO;;AAGT,QAAO,YAAY;EACjB;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EAAK,OAAO,OAAO;YAClB,oBAAC;GACC,KAAK;GACL,OAAO,sBAAsB;GAC7B,QAAQ,sBAAsB;IAC9B;GACG;EAET;AAEF,MAAM,oBAAoB,KAAK,SAAS,kBAAkB,EACxD,MACA,OAAO,cAAc,MACrB,QAAQ,cAAc,OACtB,UAAU,cAAc,SAExB,iBAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,aAAa,KAEb,cACA,YACA,YACA,eACA,mBACA,iBACA,SAEA,aACA,WACA,WACA,cACA,kBACA,gBACA,QAEA,qBACA,oBACA,OACA,KACA,GAAG,SAC6D;CAChE,MAAM,YAAY,cAAc;AAEhC,QAAO,YAAY;EACjB;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,QAAS,SADG,GAAG,KAAK,GAAG,QAAQ,GAAG;AAsBxC,QACE,oBAAC;EACM;EACL,mBAAkB;EAClB,oBAAoB;EACpB,OAzBqC,cACjC;GACJ;IACE,YAAY;IACZ,WAAW;IACX,mBAAmB;IACpB;GACD,OAAO;GACP,sBAAsB,EAAE,OAAO,qBAAqB,GAAG;GACvD,qBACI;IACE,UAAU;IACV,YAAY;IACb,GACD;GACJ;GACD,EACD;GAAC;GAAqB;GAAoB;GAAO,OAAO;GAAW,CACpE;EAQG,GAAI;YAEH;GACI;EAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCF,MAAM,OAAO,KAAK,SAAS,KAAK,EAAE,SAAS,GAAG,SAAoB;AAEhE,KAAI,YAAY,aACd,QAAO,oBAAC,kBAAe,GAAI,QAAS;AAGtC,QAAO,oBAAC;EAA2B;EAAS,GAAI;GAAS;EACzD;AAEF,KAAK,cAAc;AAInB,MAAa,YAAY;AACzB,MAAa,sBAAsB"}
1
+ {"version":3,"file":"Icon.mjs","names":[],"sources":["../../src/components/Icon.tsx"],"sourcesContent":["import type { GlyphName } from '@yahoo/uds-icons/glyphMap';\nimport { glyphMap, glyphNames } from '@yahoo/uds-icons/glyphMap';\nimport type { SvgGlyphKey, SvgGlyphName } from '@yahoo/uds-icons/svgMap';\nimport { svgGlyphNames, svgMap } from '@yahoo/uds-icons/svgMap';\nimport { ICON_SIZE_MAP } from '@yahoo/uds-icons/tokens';\nimport type { IconSize, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type {\n StyleProp,\n Text as RNText,\n TextProps as RNTextProps,\n TextStyle,\n ViewProps,\n} from 'react-native';\nimport { Text, View } from 'react-native';\nimport { SvgXml } from 'react-native-svg';\n// eslint-disable-next-line uds/no-use-unistyles\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\n\nconst DEFAULT_PROPS = {\n size: 'md',\n color: 'primary',\n variant: 'outline',\n flexShrink: '0',\n} as const;\n\n/* -------------------------------------------------------------------------- */\n/* Icon Props */\n/* -------------------------------------------------------------------------- */\n\ntype IconName = GlyphName | SvgGlyphName;\n\ninterface IconProps extends Omit<RNTextProps, 'style'> {\n /** Ref to the underlying Text element */\n ref?: Ref<RNText>;\n /** The icon name */\n name: IconName;\n /** Icon size */\n size?: IconSize;\n /** Icon color */\n color?: StyleProps['color'];\n /** Icon variant (outline, fill, multicolor) */\n variant?: IconVariant;\n // Background\n backgroundColor?: StyleProps['backgroundColor'];\n // Border\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n // Flex\n flexShrink?: StyleProps['flexShrink'];\n // Spacing\n spacingStart?: StyleProps['spacingStart'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingTop?: StyleProps['spacingTop'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacing?: StyleProps['spacing'];\n // Offset\n offsetStart?: StyleProps['offsetStart'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetTop?: StyleProps['offsetTop'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetVertical?: StyleProps['offsetVertical'];\n offset?: StyleProps['offset'];\n /** Icon color override */\n dangerouslySetColor?: string;\n /** Icon font size override */\n dangerouslySetSize?: number;\n /** Optional style override */\n style?: StyleProp<TextStyle>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Multicolor Icon */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Separate component for multicolor SVG icons.\n * Uses useUnistyles() for reactive theme access - isolated here so\n * glyph-based icons don't pay the hook overhead.\n */\nconst MulticolorIcon = memo(function MulticolorIcon({\n name,\n size = DEFAULT_PROPS.size,\n flexShrink = DEFAULT_PROPS.flexShrink,\n backgroundColor,\n dangerouslySetSize,\n}: Omit<IconProps, 'variant'>) {\n // Reactive theme subscription - only multicolor icons need this\n const { rt } = useUnistyles();\n const colorScheme = rt.themeName === 'dark' ? 'dark' : 'light';\n\n const pixelSize = ICON_SIZE_MAP[size];\n const svgKey = `${name}-${colorScheme}-${pixelSize}` as SvgGlyphKey;\n const svgContent = svgMap[svgKey];\n\n if (!svgContent) {\n console.warn(`Multicolor icon \"${svgKey}\" not found`);\n return null;\n }\n\n styles.useVariants({\n flexShrink,\n backgroundColor,\n });\n\n return (\n <View style={styles.foundation as ViewProps['style']}>\n <SvgXml\n xml={svgContent}\n width={dangerouslySetSize ?? pixelSize}\n height={dangerouslySetSize ?? pixelSize}\n />\n </View>\n );\n});\n\nconst OutlineOrFillIcon = memo(function OutlineOrFillIcon({\n name,\n size = DEFAULT_PROPS.size,\n color = DEFAULT_PROPS.color,\n variant = DEFAULT_PROPS.variant,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n flexShrink = '0',\n // Spacing\n spacingStart,\n spacingEnd,\n spacingTop,\n spacingBottom,\n spacingHorizontal,\n spacingVertical,\n spacing,\n // Offset\n offsetStart,\n offsetEnd,\n offsetTop,\n offsetBottom,\n offsetHorizontal,\n offsetVertical,\n offset,\n // Dangerously set props\n dangerouslySetColor,\n dangerouslySetSize,\n style,\n ref,\n ...props\n}: Omit<IconProps, 'variant'> & { variant?: 'outline' | 'fill' }) {\n const pixelSize = ICON_SIZE_MAP[size];\n // Glyph-based icons - no useUnistyles needed, styles.useVariants is reactive\n styles.useVariants({\n color,\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n flexShrink,\n // Spacing\n spacingStart,\n spacingEnd,\n spacingTop,\n spacingBottom,\n spacingHorizontal,\n spacingVertical,\n spacing,\n // Offset\n offsetStart,\n offsetEnd,\n offsetTop,\n offsetBottom,\n offsetHorizontal,\n offsetVertical,\n offset,\n });\n const glyphName = `${name}-${variant}-${pixelSize}`;\n const glyph = (glyphMap as Record<string, string>)[glyphName];\n const textStyles: StyleProp<TextStyle> = useMemo(\n () => [\n {\n fontFamily: 'uds-icons',\n textAlign: 'center',\n textAlignVertical: 'center',\n fontSize: pixelSize,\n lineHeight: pixelSize,\n },\n styles.foundation,\n dangerouslySetColor ? { color: dangerouslySetColor } : undefined,\n dangerouslySetSize\n ? {\n fontSize: dangerouslySetSize,\n lineHeight: dangerouslySetSize,\n }\n : undefined,\n style,\n ],\n [dangerouslySetColor, dangerouslySetSize, style, styles.foundation, pixelSize],\n );\n\n return (\n <Text\n ref={ref}\n accessibilityRole=\"image\"\n accessibilityLabel={name}\n style={textStyles}\n {...props}\n >\n {glyph}\n </Text>\n );\n});\n\n/**\n * **🎨 An icon component using UDS icon fonts**\n *\n * @description\n * Renders icons from the UDS icon library. Supports multiple variants\n * (outline, fill, multicolor) and sizes.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Icon } from '@yahoo/uds-mobile';\n *\n * <Icon name=\"ChevronRight\" size=\"md\" color=\"primary\" />\n * <Icon name=\"Star\" variant=\"fill\" color=\"accent\" />\n * <Icon name=\"Yahoo\" variant=\"multicolor\" />\n * ```\n *\n * @usage\n * - Use name prop to specify the icon\n * - Use variant prop for outline/fill/multicolor\n * - Use size prop for icon size (xs, sm, md, lg, xl)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"image\"` automatically\n * - Icon name is used as accessibility label\n * - For decorative icons, set `accessibilityElementsHidden`\n *\n * @see {@link IconButton} for clickable icons\n * @see {@link IconSlot} for flexible icon rendering in components\n */\nconst Icon = memo(function Icon({ variant, ...props }: IconProps) {\n // Delegate to MulticolorIcon for SVG-based icons (has its own useUnistyles)\n if (variant === 'multicolor') {\n return <MulticolorIcon {...props} />;\n }\n\n return <OutlineOrFillIcon variant={variant} {...props} />;\n});\n\nIcon.displayName = 'Icon';\n\nexport { Icon };\nexport type { IconName, IconProps };\nexport const iconNames = glyphNames;\nexport const multicolorIconNames = svgGlyphNames;\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,gBAAgB;CACpB,MAAM;CACN,OAAO;CACP,SAAS;CACT,YAAY;CACb;;;;;;AA0ED,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,MACA,OAAO,cAAc,MACrB,aAAa,cAAc,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AAG;GACvD,qBACI;IACE,UAAU;IACV,YAAY;IACb,GACD;GACJ;GACD,EACD;GAAC;GAAqB;GAAoB;GAAO,OAAO;GAAY;GAAU,CAC/E;EAQG,GAAI;YAEH;GACI;EAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCF,MAAM,OAAO,KAAK,SAAS,KAAK,EAAE,SAAS,GAAG,SAAoB;AAEhE,KAAI,YAAY,aACd,QAAO,oBAAC,kBAAe,GAAI,QAAS;AAGtC,QAAO,oBAAC;EAA2B;EAAS,GAAI;GAAS;EACzD;AAEF,KAAK,cAAc;AAInB,MAAa,YAAY;AACzB,MAAa,sBAAsB"}
@@ -1228,6 +1228,7 @@ export declare const avatarStyles: {
1228
1228
  borderRadius: number;
1229
1229
  color: string;
1230
1230
  fontSize: number;
1231
+ iconSizeToken: 'lg' | 'md' | 'sm';
1231
1232
  lineHeight: number;
1232
1233
  };
1233
1234
  } & {
@@ -1265,7 +1266,7 @@ export declare const badgeStyles: {
1265
1266
  lineHeight: number;
1266
1267
  color: string;
1267
1268
  };
1268
- icon: { fontSize: number; lineHeight: number; color: string };
1269
+ icon: { fontSize: number; iconSizeToken: 'lg' | 'md' | 'sm'; lineHeight: number; color: string };
1269
1270
  } & {
1270
1271
  useVariants: (
1271
1272
  variants:
@@ -1342,7 +1343,7 @@ export declare const buttonStyles: {
1342
1343
  lineHeight: number;
1343
1344
  color: string;
1344
1345
  };
1345
- icon: { fontSize: number; lineHeight: number; color: string };
1346
+ icon: { fontSize: number; iconSizeToken: 'sm' | 'xs'; lineHeight: number; color: string };
1346
1347
  } & {
1347
1348
  useVariants: (
1348
1349
  variants:
@@ -1488,7 +1489,7 @@ export declare const chipStyles: {
1488
1489
  letterSpacing: number;
1489
1490
  lineHeight: number;
1490
1491
  };
1491
- icon: { color: string; fontSize: number; lineHeight: number };
1492
+ icon: { color: string; fontSize: number; iconSizeToken: 'sm'; lineHeight: number };
1492
1493
  } & {
1493
1494
  useVariants: (
1494
1495
  variants:
@@ -1537,7 +1538,7 @@ export declare const dividerStyles: {
1537
1538
 
1538
1539
  export declare const iconButtonStyles: {
1539
1540
  root: { padding: number };
1540
- icon: { fontSize: number; lineHeight: number };
1541
+ icon: { fontSize: number; iconSizeToken: 'md' | 'sm' | 'lg' | 'xs'; lineHeight: number };
1541
1542
  } & {
1542
1543
  useVariants: (
1543
1544
  variants:
@@ -1547,8 +1548,8 @@ export declare const iconButtonStyles: {
1547
1548
  };
1548
1549
 
1549
1550
  export declare const inputStyles: {
1550
- endIcon: { fontSize: number; lineHeight: number; color: string };
1551
- helperIcon: { fontSize: number; lineHeight: number; color: string };
1551
+ endIcon: { fontSize: number; iconSizeToken: 'md'; lineHeight: number; color: string };
1552
+ helperIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
1552
1553
  helperText: {
1553
1554
  fontFamily: 'YASans';
1554
1555
  fontSize: number;
@@ -1579,7 +1580,7 @@ export declare const inputStyles: {
1579
1580
  color: string;
1580
1581
  };
1581
1582
  labelRequired: { color: string };
1582
- startIcon: { fontSize: number; lineHeight: number; color: string };
1583
+ startIcon: { fontSize: number; iconSizeToken: 'md'; lineHeight: number; color: string };
1583
1584
  } & {
1584
1585
  useVariants: (
1585
1586
  variants:
@@ -1673,7 +1674,7 @@ export declare const linkStyles: {
1673
1674
  lineHeight: number;
1674
1675
  };
1675
1676
  text: { color: string; textDecorationLine: 'underline' | 'none' };
1676
- icon: { lineHeight: number; fontSize: number };
1677
+ icon: { lineHeight: number; fontSize: number; iconSizeToken: 'md' | 'sm' | 'lg' };
1677
1678
  iconEnd: { color: string };
1678
1679
  iconStart: { color: string };
1679
1680
  } & {
@@ -1764,9 +1765,9 @@ export declare const menuContentStyles: {
1764
1765
  export declare const menuItemStyles: {
1765
1766
  root: { backgroundColor: string };
1766
1767
  icon: { color: string };
1767
- endIcon: { color: string; fontSize: number; lineHeight: number };
1768
+ endIcon: { color: string; fontSize: number; iconSizeToken: 'sm'; lineHeight: number };
1768
1769
  line: { borderColor: 'transparent'; borderWidth: number };
1769
- startIcon: { color: string; fontSize: number; lineHeight: number };
1770
+ startIcon: { color: string; fontSize: number; iconSizeToken: 'sm'; lineHeight: number };
1770
1771
  } & {
1771
1772
  useVariants: (
1772
1773
  variants:
@@ -1829,7 +1830,7 @@ export declare const switchStyles: {
1829
1830
  root: { gap: number; paddingHorizontal: number; paddingVertical: number };
1830
1831
  text: { fontFamily: 'YASans'; fontSize: number; letterSpacing: number; lineHeight: number };
1831
1832
  handle: { height: number; width: number; backgroundColor: string; boxShadow: string };
1832
- handleIcon: { fontSize: number; lineHeight: number; color: string };
1833
+ handleIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
1833
1834
  switch: {
1834
1835
  borderWidth: number;
1835
1836
  height: number;
@@ -1852,8 +1853,8 @@ export declare const switchStyles: {
1852
1853
  export declare const toastStyles: {
1853
1854
  root: { borderRadius: number; gap: number; paddingHorizontal: number; paddingVertical: number };
1854
1855
  text: { color: string };
1855
- icon: { fontSize: number; lineHeight: number; color: string };
1856
- closeIcon: { fontSize: number; lineHeight: number; color: string };
1856
+ icon: { fontSize: number; iconSizeToken: 'md'; lineHeight: number; color: string };
1857
+ closeIcon: { fontSize: number; iconSizeToken: 'sm'; lineHeight: number; color: string };
1857
1858
  label: { fontFamily: 'YASans-SmBd'; fontSize: number; letterSpacing: number; lineHeight: number };
1858
1859
  } & {
1859
1860
  useVariants: (
@@ -1878,7 +1879,7 @@ export declare const toastStyles: {
1878
1879
  export declare const tooltipStyles: {
1879
1880
  root: { gap: number; paddingHorizontal: number; paddingVertical: number };
1880
1881
  text: { color: string };
1881
- icon: { fontSize: number; lineHeight: number; color: string };
1882
+ icon: { fontSize: number; iconSizeToken: 'xs'; lineHeight: number; color: string };
1882
1883
  body: { fontFamily: 'YASans-SmBd'; fontSize: number; letterSpacing: number; lineHeight: number };
1883
1884
  endContent: {
1884
1885
  fontFamily: 'YASans-Medium';
@@ -36,6 +36,7 @@ interface ComponentTheme {
36
36
  };
37
37
  'avatar/size/lg/icon/rest': {
38
38
  fontSize: number;
39
+ iconSizeToken: string;
39
40
  lineHeight: number;
40
41
  };
41
42
  'avatar/size/lg/root/rest': {
@@ -51,6 +52,7 @@ interface ComponentTheme {
51
52
  };
52
53
  'avatar/size/md/icon/rest': {
53
54
  fontSize: number;
55
+ iconSizeToken: string;
54
56
  lineHeight: number;
55
57
  };
56
58
  'avatar/size/md/root/rest': {
@@ -66,6 +68,7 @@ interface ComponentTheme {
66
68
  };
67
69
  'avatar/size/sm/icon/rest': {
68
70
  fontSize: number;
71
+ iconSizeToken: string;
69
72
  lineHeight: number;
70
73
  };
71
74
  'avatar/size/sm/root/rest': {
@@ -81,6 +84,7 @@ interface ComponentTheme {
81
84
  };
82
85
  'avatar/size/xl/icon/rest': {
83
86
  fontSize: number;
87
+ iconSizeToken: string;
84
88
  lineHeight: number;
85
89
  };
86
90
  'avatar/size/xl/root/rest': {
@@ -96,6 +100,7 @@ interface ComponentTheme {
96
100
  };
97
101
  'avatar/size/xs/icon/rest': {
98
102
  fontSize: number;
103
+ iconSizeToken: string;
99
104
  lineHeight: number;
100
105
  };
101
106
  'avatar/size/xs/root/rest': {
@@ -127,6 +132,7 @@ interface ComponentTheme {
127
132
  };
128
133
  'badge/size/lg/icon/rest': {
129
134
  fontSize: number;
135
+ iconSizeToken: string;
130
136
  lineHeight: number;
131
137
  };
132
138
  'badge/size/lg/root/rest': {
@@ -142,6 +148,7 @@ interface ComponentTheme {
142
148
  };
143
149
  'badge/size/md/icon/rest': {
144
150
  fontSize: number;
151
+ iconSizeToken: string;
145
152
  lineHeight: number;
146
153
  };
147
154
  'badge/size/md/root/rest': {
@@ -157,6 +164,7 @@ interface ComponentTheme {
157
164
  };
158
165
  'badge/size/sm/icon/rest': {
159
166
  fontSize: number;
167
+ iconSizeToken: string;
160
168
  lineHeight: number;
161
169
  };
162
170
  'badge/size/sm/root/rest': {
@@ -172,6 +180,7 @@ interface ComponentTheme {
172
180
  };
173
181
  'badge/size/xs/icon/rest': {
174
182
  fontSize: number;
183
+ iconSizeToken: string;
175
184
  lineHeight: number;
176
185
  };
177
186
  'badge/size/xs/root/rest': {
@@ -331,6 +340,7 @@ interface ComponentTheme {
331
340
  };
332
341
  'button/size/lg/icon/rest': {
333
342
  fontSize: number;
343
+ iconSizeToken: string;
334
344
  lineHeight: number;
335
345
  };
336
346
  'button/size/lg/root/rest': {
@@ -346,6 +356,7 @@ interface ComponentTheme {
346
356
  };
347
357
  'button/size/md/icon/rest': {
348
358
  fontSize: number;
359
+ iconSizeToken: string;
349
360
  lineHeight: number;
350
361
  };
351
362
  'button/size/md/root/rest': {
@@ -361,6 +372,7 @@ interface ComponentTheme {
361
372
  };
362
373
  'button/size/sm/icon/rest': {
363
374
  fontSize: number;
375
+ iconSizeToken: string;
364
376
  lineHeight: number;
365
377
  };
366
378
  'button/size/sm/root/rest': {
@@ -376,6 +388,7 @@ interface ComponentTheme {
376
388
  };
377
389
  'button/size/xs/icon/rest': {
378
390
  fontSize: number;
391
+ iconSizeToken: string;
379
392
  lineHeight: number;
380
393
  };
381
394
  'button/size/xs/root/rest': {
@@ -1656,6 +1669,7 @@ interface ComponentTheme {
1656
1669
  };
1657
1670
  'chip/size/md/icon/rest': {
1658
1671
  fontSize: number;
1672
+ iconSizeToken: string;
1659
1673
  lineHeight: number;
1660
1674
  };
1661
1675
  'chip/size/md/root/rest': {
@@ -1672,6 +1686,7 @@ interface ComponentTheme {
1672
1686
  };
1673
1687
  'chip/size/sm/icon/rest': {
1674
1688
  fontSize: number;
1689
+ iconSizeToken: string;
1675
1690
  lineHeight: number;
1676
1691
  };
1677
1692
  'chip/size/sm/root/rest': {
@@ -1928,6 +1943,7 @@ interface ComponentTheme {
1928
1943
  };
1929
1944
  'iconButton/size/lg/icon/rest': {
1930
1945
  fontSize: number;
1946
+ iconSizeToken: string;
1931
1947
  lineHeight: number;
1932
1948
  };
1933
1949
  'iconButton/size/lg/root/rest': {
@@ -1935,6 +1951,7 @@ interface ComponentTheme {
1935
1951
  };
1936
1952
  'iconButton/size/md/icon/rest': {
1937
1953
  fontSize: number;
1954
+ iconSizeToken: string;
1938
1955
  lineHeight: number;
1939
1956
  };
1940
1957
  'iconButton/size/md/root/rest': {
@@ -1942,6 +1959,7 @@ interface ComponentTheme {
1942
1959
  };
1943
1960
  'iconButton/size/sm/icon/rest': {
1944
1961
  fontSize: number;
1962
+ iconSizeToken: string;
1945
1963
  lineHeight: number;
1946
1964
  };
1947
1965
  'iconButton/size/sm/root/rest': {
@@ -1949,6 +1967,7 @@ interface ComponentTheme {
1949
1967
  };
1950
1968
  'iconButton/size/xl/icon/rest': {
1951
1969
  fontSize: number;
1970
+ iconSizeToken: string;
1952
1971
  lineHeight: number;
1953
1972
  };
1954
1973
  'iconButton/size/xl/root/rest': {
@@ -1956,6 +1975,7 @@ interface ComponentTheme {
1956
1975
  };
1957
1976
  'iconButton/size/xs/icon/rest': {
1958
1977
  fontSize: number;
1978
+ iconSizeToken: string;
1959
1979
  lineHeight: number;
1960
1980
  };
1961
1981
  'iconButton/size/xs/root/rest': {
@@ -1963,10 +1983,12 @@ interface ComponentTheme {
1963
1983
  };
1964
1984
  'input/size/lg/endIcon/rest': {
1965
1985
  fontSize: number;
1986
+ iconSizeToken: string;
1966
1987
  lineHeight: number;
1967
1988
  };
1968
1989
  'input/size/lg/helperIcon/rest': {
1969
1990
  fontSize: number;
1991
+ iconSizeToken: string;
1970
1992
  lineHeight: number;
1971
1993
  };
1972
1994
  'input/size/lg/helperText/rest': {
@@ -2003,14 +2025,17 @@ interface ComponentTheme {
2003
2025
  };
2004
2026
  'input/size/lg/startIcon/rest': {
2005
2027
  fontSize: number;
2028
+ iconSizeToken: string;
2006
2029
  lineHeight: number;
2007
2030
  };
2008
2031
  'input/size/md/endIcon/rest': {
2009
2032
  fontSize: number;
2033
+ iconSizeToken: string;
2010
2034
  lineHeight: number;
2011
2035
  };
2012
2036
  'input/size/md/helperIcon/rest': {
2013
2037
  fontSize: number;
2038
+ iconSizeToken: string;
2014
2039
  lineHeight: number;
2015
2040
  };
2016
2041
  'input/size/md/helperText/rest': {
@@ -2047,6 +2072,7 @@ interface ComponentTheme {
2047
2072
  };
2048
2073
  'input/size/md/startIcon/rest': {
2049
2074
  fontSize: number;
2075
+ iconSizeToken: string;
2050
2076
  lineHeight: number;
2051
2077
  };
2052
2078
  'input/variant/default/value/empty/endIcon/disabled': {
@@ -2343,6 +2369,7 @@ interface ComponentTheme {
2343
2369
  };
2344
2370
  'link/textStyle/body1/icon/rest': {
2345
2371
  fontSize: number;
2372
+ iconSizeToken: string;
2346
2373
  lineHeight: number;
2347
2374
  };
2348
2375
  'link/textStyle/body1/root/disabled': {
@@ -2389,6 +2416,7 @@ interface ComponentTheme {
2389
2416
  };
2390
2417
  'link/textStyle/caption1/icon/rest': {
2391
2418
  fontSize: number;
2419
+ iconSizeToken: string;
2392
2420
  lineHeight: number;
2393
2421
  };
2394
2422
  'link/textStyle/caption1/root/disabled': {
@@ -2435,6 +2463,7 @@ interface ComponentTheme {
2435
2463
  };
2436
2464
  'link/textStyle/caption2/icon/rest': {
2437
2465
  fontSize: number;
2466
+ iconSizeToken: string;
2438
2467
  lineHeight: number;
2439
2468
  };
2440
2469
  'link/textStyle/caption2/root/disabled': {
@@ -2481,6 +2510,7 @@ interface ComponentTheme {
2481
2510
  };
2482
2511
  'link/textStyle/display1/icon/rest': {
2483
2512
  fontSize: number;
2513
+ iconSizeToken: string;
2484
2514
  lineHeight: number;
2485
2515
  };
2486
2516
  'link/textStyle/display1/root/disabled': {
@@ -2527,6 +2557,7 @@ interface ComponentTheme {
2527
2557
  };
2528
2558
  'link/textStyle/display2/icon/rest': {
2529
2559
  fontSize: number;
2560
+ iconSizeToken: string;
2530
2561
  lineHeight: number;
2531
2562
  };
2532
2563
  'link/textStyle/display2/root/disabled': {
@@ -2573,6 +2604,7 @@ interface ComponentTheme {
2573
2604
  };
2574
2605
  'link/textStyle/display3/icon/rest': {
2575
2606
  fontSize: number;
2607
+ iconSizeToken: string;
2576
2608
  lineHeight: number;
2577
2609
  };
2578
2610
  'link/textStyle/display3/root/disabled': {
@@ -2619,6 +2651,7 @@ interface ComponentTheme {
2619
2651
  };
2620
2652
  'link/textStyle/headline1/icon/rest': {
2621
2653
  fontSize: number;
2654
+ iconSizeToken: string;
2622
2655
  lineHeight: number;
2623
2656
  };
2624
2657
  'link/textStyle/headline1/root/disabled': {
@@ -2665,6 +2698,7 @@ interface ComponentTheme {
2665
2698
  };
2666
2699
  'link/textStyle/label1/icon/rest': {
2667
2700
  fontSize: number;
2701
+ iconSizeToken: string;
2668
2702
  lineHeight: number;
2669
2703
  };
2670
2704
  'link/textStyle/label1/root/disabled': {
@@ -2711,6 +2745,7 @@ interface ComponentTheme {
2711
2745
  };
2712
2746
  'link/textStyle/label2/icon/rest': {
2713
2747
  fontSize: number;
2748
+ iconSizeToken: string;
2714
2749
  lineHeight: number;
2715
2750
  };
2716
2751
  'link/textStyle/label2/root/disabled': {
@@ -2757,6 +2792,7 @@ interface ComponentTheme {
2757
2792
  };
2758
2793
  'link/textStyle/label3/icon/rest': {
2759
2794
  fontSize: number;
2795
+ iconSizeToken: string;
2760
2796
  lineHeight: number;
2761
2797
  };
2762
2798
  'link/textStyle/label3/root/disabled': {
@@ -2803,6 +2839,7 @@ interface ComponentTheme {
2803
2839
  };
2804
2840
  'link/textStyle/label4/icon/rest': {
2805
2841
  fontSize: number;
2842
+ iconSizeToken: string;
2806
2843
  lineHeight: number;
2807
2844
  };
2808
2845
  'link/textStyle/label4/root/disabled': {
@@ -2849,6 +2886,7 @@ interface ComponentTheme {
2849
2886
  };
2850
2887
  'link/textStyle/legal1/icon/rest': {
2851
2888
  fontSize: number;
2889
+ iconSizeToken: string;
2852
2890
  lineHeight: number;
2853
2891
  };
2854
2892
  'link/textStyle/legal1/root/disabled': {
@@ -2895,6 +2933,7 @@ interface ComponentTheme {
2895
2933
  };
2896
2934
  'link/textStyle/title1/icon/rest': {
2897
2935
  fontSize: number;
2936
+ iconSizeToken: string;
2898
2937
  lineHeight: number;
2899
2938
  };
2900
2939
  'link/textStyle/title1/root/disabled': {
@@ -2941,6 +2980,7 @@ interface ComponentTheme {
2941
2980
  };
2942
2981
  'link/textStyle/title2/icon/rest': {
2943
2982
  fontSize: number;
2983
+ iconSizeToken: string;
2944
2984
  lineHeight: number;
2945
2985
  };
2946
2986
  'link/textStyle/title2/root/disabled': {
@@ -2987,6 +3027,7 @@ interface ComponentTheme {
2987
3027
  };
2988
3028
  'link/textStyle/title3/icon/rest': {
2989
3029
  fontSize: number;
3030
+ iconSizeToken: string;
2990
3031
  lineHeight: number;
2991
3032
  };
2992
3033
  'link/textStyle/title3/root/disabled': {
@@ -3033,6 +3074,7 @@ interface ComponentTheme {
3033
3074
  };
3034
3075
  'link/textStyle/title4/icon/rest': {
3035
3076
  fontSize: number;
3077
+ iconSizeToken: string;
3036
3078
  lineHeight: number;
3037
3079
  };
3038
3080
  'link/textStyle/title4/root/disabled': {
@@ -3079,6 +3121,7 @@ interface ComponentTheme {
3079
3121
  };
3080
3122
  'link/textStyle/ui1/icon/rest': {
3081
3123
  fontSize: number;
3124
+ iconSizeToken: string;
3082
3125
  lineHeight: number;
3083
3126
  };
3084
3127
  'link/textStyle/ui1/root/disabled': {
@@ -3125,6 +3168,7 @@ interface ComponentTheme {
3125
3168
  };
3126
3169
  'link/textStyle/ui2/icon/rest': {
3127
3170
  fontSize: number;
3171
+ iconSizeToken: string;
3128
3172
  lineHeight: number;
3129
3173
  };
3130
3174
  'link/textStyle/ui2/root/disabled': {
@@ -3171,6 +3215,7 @@ interface ComponentTheme {
3171
3215
  };
3172
3216
  'link/textStyle/ui3/icon/rest': {
3173
3217
  fontSize: number;
3218
+ iconSizeToken: string;
3174
3219
  lineHeight: number;
3175
3220
  };
3176
3221
  'link/textStyle/ui3/root/disabled': {
@@ -3217,6 +3262,7 @@ interface ComponentTheme {
3217
3262
  };
3218
3263
  'link/textStyle/ui4/icon/rest': {
3219
3264
  fontSize: number;
3265
+ iconSizeToken: string;
3220
3266
  lineHeight: number;
3221
3267
  };
3222
3268
  'link/textStyle/ui4/root/disabled': {
@@ -3263,6 +3309,7 @@ interface ComponentTheme {
3263
3309
  };
3264
3310
  'link/textStyle/ui5/icon/rest': {
3265
3311
  fontSize: number;
3312
+ iconSizeToken: string;
3266
3313
  lineHeight: number;
3267
3314
  };
3268
3315
  'link/textStyle/ui5/root/disabled': {
@@ -3309,6 +3356,7 @@ interface ComponentTheme {
3309
3356
  };
3310
3357
  'link/textStyle/ui6/icon/rest': {
3311
3358
  fontSize: number;
3359
+ iconSizeToken: string;
3312
3360
  lineHeight: number;
3313
3361
  };
3314
3362
  'link/textStyle/ui6/root/disabled': {
@@ -3504,10 +3552,12 @@ interface ComponentTheme {
3504
3552
  };
3505
3553
  'menuItem/size/default/endIcon/rest': {
3506
3554
  fontSize: number;
3555
+ iconSizeToken: string;
3507
3556
  lineHeight: number;
3508
3557
  };
3509
3558
  'menuItem/size/default/startIcon/rest': {
3510
3559
  fontSize: number;
3560
+ iconSizeToken: string;
3511
3561
  lineHeight: number;
3512
3562
  };
3513
3563
  'radio/size/md/radio/rest': {
@@ -3712,6 +3762,7 @@ interface ComponentTheme {
3712
3762
  };
3713
3763
  'switch/size/md/handleIcon/rest': {
3714
3764
  fontSize: number;
3765
+ iconSizeToken: string;
3715
3766
  lineHeight: number;
3716
3767
  };
3717
3768
  'switch/size/md/root/rest': {
@@ -3737,6 +3788,7 @@ interface ComponentTheme {
3737
3788
  };
3738
3789
  'switch/size/sm/handleIcon/rest': {
3739
3790
  fontSize: number;
3791
+ iconSizeToken: string;
3740
3792
  lineHeight: number;
3741
3793
  };
3742
3794
  'switch/size/sm/root/rest': {
@@ -3780,10 +3832,12 @@ interface ComponentTheme {
3780
3832
  };
3781
3833
  'toast/size/default/closeIcon/rest': {
3782
3834
  fontSize: number;
3835
+ iconSizeToken: string;
3783
3836
  lineHeight: number;
3784
3837
  };
3785
3838
  'toast/size/default/icon/rest': {
3786
3839
  fontSize: number;
3840
+ iconSizeToken: string;
3787
3841
  lineHeight: number;
3788
3842
  };
3789
3843
  'toast/size/default/label/rest': {
@@ -3857,6 +3911,7 @@ interface ComponentTheme {
3857
3911
  };
3858
3912
  'tooltip/size/default/icon/rest': {
3859
3913
  fontSize: number;
3914
+ iconSizeToken: string;
3860
3915
  lineHeight: number;
3861
3916
  };
3862
3917
  'tooltip/size/default/root/rest': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahoo/uds-mobile",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "uds-mobile": "./cli/uds-mobile.js"
@@ -231,7 +231,7 @@
231
231
  }
232
232
  },
233
233
  "dependencies": {
234
- "lodash-es": "^4.17.21"
234
+ "lodash-es": "^4.17.23"
235
235
  },
236
236
  "peerDependencies": {
237
237
  "expo-font": "~14.0.0",