@yahoo/uds-mobile 2.9.0 → 2.11.0

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.
Files changed (206) hide show
  1. package/README.md +22 -24
  2. package/dist/components/Avatar.cjs +1 -1
  3. package/dist/components/Avatar.d.cts +1 -1
  4. package/dist/components/Avatar.d.ts +1 -1
  5. package/dist/components/Avatar.js +1 -1
  6. package/dist/components/Avatar.js.map +1 -1
  7. package/dist/components/Badge.cjs +1 -1
  8. package/dist/components/Badge.d.cts +1 -1
  9. package/dist/components/Badge.d.ts +1 -1
  10. package/dist/components/Badge.js +1 -1
  11. package/dist/components/Badge.js.map +1 -1
  12. package/dist/components/BlurTarget.cjs +2 -1
  13. package/dist/components/BlurTarget.d.cts +2 -1
  14. package/dist/components/BlurTarget.d.cts.map +1 -1
  15. package/dist/components/BlurTarget.d.ts +2 -1
  16. package/dist/components/BlurTarget.d.ts.map +1 -1
  17. package/dist/components/BlurTarget.js +2 -1
  18. package/dist/components/BlurTarget.js.map +1 -1
  19. package/dist/components/Box.cjs +1 -1
  20. package/dist/components/Box.d.cts +1 -1
  21. package/dist/components/Box.d.ts +1 -1
  22. package/dist/components/Box.js +1 -1
  23. package/dist/components/Box.js.map +1 -1
  24. package/dist/components/Button.cjs +1 -1
  25. package/dist/components/Button.d.cts +1 -1
  26. package/dist/components/Button.d.ts +1 -1
  27. package/dist/components/Button.js +1 -1
  28. package/dist/components/Button.js.map +1 -1
  29. package/dist/components/Checkbox.cjs +1 -1
  30. package/dist/components/Checkbox.d.cts +1 -1
  31. package/dist/components/Checkbox.d.ts +1 -1
  32. package/dist/components/Checkbox.js +1 -1
  33. package/dist/components/Checkbox.js.map +1 -1
  34. package/dist/components/Chip.cjs +1 -1
  35. package/dist/components/Chip.d.cts +1 -1
  36. package/dist/components/Chip.d.ts +1 -1
  37. package/dist/components/Chip.js +1 -1
  38. package/dist/components/Chip.js.map +1 -1
  39. package/dist/components/Divider/Divider.cjs +103 -0
  40. package/dist/components/Divider/Divider.d.cts +50 -0
  41. package/dist/components/Divider/Divider.d.cts.map +1 -0
  42. package/dist/components/Divider/Divider.d.ts +50 -0
  43. package/dist/components/Divider/Divider.d.ts.map +1 -0
  44. package/dist/components/Divider/Divider.js +103 -0
  45. package/dist/components/Divider/Divider.js.map +1 -0
  46. package/dist/components/Divider/DividerLabel.cjs +37 -0
  47. package/dist/components/Divider/DividerLabel.d.cts +18 -0
  48. package/dist/components/Divider/DividerLabel.d.cts.map +1 -0
  49. package/dist/components/Divider/DividerLabel.d.ts +18 -0
  50. package/dist/components/Divider/DividerLabel.d.ts.map +1 -0
  51. package/dist/components/Divider/DividerLabel.js +37 -0
  52. package/dist/components/Divider/DividerLabel.js.map +1 -0
  53. package/dist/components/Divider/DividerLine.cjs +62 -0
  54. package/dist/components/Divider/DividerLine.d.cts +19 -0
  55. package/dist/components/Divider/DividerLine.d.cts.map +1 -0
  56. package/dist/components/Divider/DividerLine.d.ts +19 -0
  57. package/dist/components/Divider/DividerLine.d.ts.map +1 -0
  58. package/dist/components/Divider/DividerLine.js +62 -0
  59. package/dist/components/Divider/DividerLine.js.map +1 -0
  60. package/dist/components/Divider/index.cjs +8 -0
  61. package/dist/components/Divider/index.d.cts +6 -0
  62. package/dist/components/Divider/index.d.ts +6 -0
  63. package/dist/components/Divider/index.js +5 -0
  64. package/dist/components/Divider/types.cjs +1 -0
  65. package/dist/components/Divider/types.d.cts +35 -0
  66. package/dist/components/Divider/types.d.cts.map +1 -0
  67. package/dist/components/Divider/types.d.ts +35 -0
  68. package/dist/components/Divider/types.d.ts.map +1 -0
  69. package/dist/components/Divider/types.js +1 -0
  70. package/dist/components/Divider/utils.cjs +33 -0
  71. package/dist/components/Divider/utils.d.cts +12 -0
  72. package/dist/components/Divider/utils.d.cts.map +1 -0
  73. package/dist/components/Divider/utils.d.ts +12 -0
  74. package/dist/components/Divider/utils.d.ts.map +1 -0
  75. package/dist/components/Divider/utils.js +31 -0
  76. package/dist/components/Divider/utils.js.map +1 -0
  77. package/dist/components/HStack.cjs +1 -1
  78. package/dist/components/HStack.d.cts +1 -1
  79. package/dist/components/HStack.d.ts +1 -1
  80. package/dist/components/HStack.js +1 -1
  81. package/dist/components/HStack.js.map +1 -1
  82. package/dist/components/Icon.cjs +1 -1
  83. package/dist/components/Icon.d.cts +2 -2
  84. package/dist/components/Icon.d.ts +2 -2
  85. package/dist/components/Icon.js +1 -1
  86. package/dist/components/Icon.js.map +1 -1
  87. package/dist/components/IconButton.cjs +1 -1
  88. package/dist/components/IconButton.d.cts +1 -1
  89. package/dist/components/IconButton.d.ts +1 -1
  90. package/dist/components/IconButton.js +1 -1
  91. package/dist/components/IconButton.js.map +1 -1
  92. package/dist/components/IconSlot.cjs +1 -1
  93. package/dist/components/IconSlot.d.cts +1 -1
  94. package/dist/components/IconSlot.d.ts +1 -1
  95. package/dist/components/IconSlot.js +1 -1
  96. package/dist/components/IconSlot.js.map +1 -1
  97. package/dist/components/Image.cjs +1 -1
  98. package/dist/components/Image.d.cts +1 -1
  99. package/dist/components/Image.d.ts +1 -1
  100. package/dist/components/Image.js +1 -1
  101. package/dist/components/Image.js.map +1 -1
  102. package/dist/components/Input.cjs +1 -1
  103. package/dist/components/Input.d.cts +1 -1
  104. package/dist/components/Input.d.ts +1 -1
  105. package/dist/components/Input.js +1 -1
  106. package/dist/components/Input.js.map +1 -1
  107. package/dist/components/Link.cjs +1 -1
  108. package/dist/components/Link.d.cts +1 -1
  109. package/dist/components/Link.d.ts +1 -1
  110. package/dist/components/Link.js +1 -1
  111. package/dist/components/Link.js.map +1 -1
  112. package/dist/components/Pressable.cjs +1 -1
  113. package/dist/components/Pressable.d.cts +1 -1
  114. package/dist/components/Pressable.d.ts +1 -1
  115. package/dist/components/Pressable.js +1 -1
  116. package/dist/components/Pressable.js.map +1 -1
  117. package/dist/components/Radio.cjs +1 -1
  118. package/dist/components/Radio.d.cts +1 -1
  119. package/dist/components/Radio.d.ts +1 -1
  120. package/dist/components/Radio.js +1 -1
  121. package/dist/components/Radio.js.map +1 -1
  122. package/dist/components/Screen.cjs +1 -1
  123. package/dist/components/Screen.d.cts +1 -1
  124. package/dist/components/Screen.d.ts +1 -1
  125. package/dist/components/Screen.js +1 -1
  126. package/dist/components/Screen.js.map +1 -1
  127. package/dist/components/Switch.cjs +1 -1
  128. package/dist/components/Switch.d.cts +1 -1
  129. package/dist/components/Switch.d.ts +1 -1
  130. package/dist/components/Switch.js +1 -1
  131. package/dist/components/Switch.js.map +1 -1
  132. package/dist/components/Tabs/Tab.cjs +174 -0
  133. package/dist/components/Tabs/Tab.d.cts +26 -0
  134. package/dist/components/Tabs/Tab.d.cts.map +1 -0
  135. package/dist/components/Tabs/Tab.d.ts +26 -0
  136. package/dist/components/Tabs/Tab.d.ts.map +1 -0
  137. package/dist/components/Tabs/Tab.js +174 -0
  138. package/dist/components/Tabs/Tab.js.map +1 -0
  139. package/dist/components/Tabs/TabList.cjs +142 -0
  140. package/dist/components/Tabs/TabList.d.cts +24 -0
  141. package/dist/components/Tabs/TabList.d.cts.map +1 -0
  142. package/dist/components/Tabs/TabList.d.ts +24 -0
  143. package/dist/components/Tabs/TabList.d.ts.map +1 -0
  144. package/dist/components/Tabs/TabList.js +141 -0
  145. package/dist/components/Tabs/TabList.js.map +1 -0
  146. package/dist/components/Tabs/TabPanel.cjs +31 -0
  147. package/dist/components/Tabs/TabPanel.d.cts +24 -0
  148. package/dist/components/Tabs/TabPanel.d.cts.map +1 -0
  149. package/dist/components/Tabs/TabPanel.d.ts +24 -0
  150. package/dist/components/Tabs/TabPanel.d.ts.map +1 -0
  151. package/dist/components/Tabs/TabPanel.js +31 -0
  152. package/dist/components/Tabs/TabPanel.js.map +1 -0
  153. package/dist/components/Tabs/Tabs.cjs +53 -0
  154. package/dist/components/Tabs/Tabs.d.cts +35 -0
  155. package/dist/components/Tabs/Tabs.d.cts.map +1 -0
  156. package/dist/components/Tabs/Tabs.d.ts +35 -0
  157. package/dist/components/Tabs/Tabs.d.ts.map +1 -0
  158. package/dist/components/Tabs/Tabs.js +53 -0
  159. package/dist/components/Tabs/Tabs.js.map +1 -0
  160. package/dist/components/Tabs/index.cjs +10 -0
  161. package/dist/components/Tabs/index.d.cts +13 -0
  162. package/dist/components/Tabs/index.d.cts.map +1 -0
  163. package/dist/components/Tabs/index.d.ts +13 -0
  164. package/dist/components/Tabs/index.d.ts.map +1 -0
  165. package/dist/components/Tabs/index.js +6 -0
  166. package/dist/components/Tabs/tabTheme.cjs +29 -0
  167. package/dist/components/Tabs/tabTheme.d.cts +23 -0
  168. package/dist/components/Tabs/tabTheme.d.cts.map +1 -0
  169. package/dist/components/Tabs/tabTheme.d.ts +23 -0
  170. package/dist/components/Tabs/tabTheme.d.ts.map +1 -0
  171. package/dist/components/Tabs/tabTheme.js +28 -0
  172. package/dist/components/Tabs/tabTheme.js.map +1 -0
  173. package/dist/components/Tabs/tabsContexts.cjs +91 -0
  174. package/dist/components/Tabs/tabsContexts.d.cts +35 -0
  175. package/dist/components/Tabs/tabsContexts.d.cts.map +1 -0
  176. package/dist/components/Tabs/tabsContexts.d.ts +35 -0
  177. package/dist/components/Tabs/tabsContexts.d.ts.map +1 -0
  178. package/dist/components/Tabs/tabsContexts.js +87 -0
  179. package/dist/components/Tabs/tabsContexts.js.map +1 -0
  180. package/dist/components/Text.cjs +1 -1
  181. package/dist/components/Text.d.cts +1 -1
  182. package/dist/components/Text.d.ts +1 -1
  183. package/dist/components/Text.js +1 -1
  184. package/dist/components/Text.js.map +1 -1
  185. package/dist/components/VStack.cjs +1 -1
  186. package/dist/components/VStack.d.cts +1 -1
  187. package/dist/components/VStack.d.ts +1 -1
  188. package/dist/components/VStack.js +1 -1
  189. package/dist/components/VStack.js.map +1 -1
  190. package/dist/jest/mocks/styles.cjs +22 -0
  191. package/dist/jest/mocks/styles.d.cts +4 -2
  192. package/dist/jest/mocks/styles.d.cts.map +1 -1
  193. package/dist/jest/mocks/styles.d.ts +4 -2
  194. package/dist/jest/mocks/styles.d.ts.map +1 -1
  195. package/dist/jest/mocks/styles.js +21 -1
  196. package/dist/jest/mocks/styles.js.map +1 -1
  197. package/dist/types/dist/index.d.cts +63 -2
  198. package/dist/types/dist/index.d.cts.map +1 -1
  199. package/dist/types/dist/index.d.ts +63 -2
  200. package/dist/types/dist/index.d.ts.map +1 -1
  201. package/fonts/uds-icons.ttf +0 -0
  202. package/generated/styles.cjs +87 -13
  203. package/generated/styles.d.ts +58 -0
  204. package/generated/styles.mjs +87 -13
  205. package/generated/unistyles.d.ts +62 -9
  206. package/package.json +21 -1
@@ -71,7 +71,7 @@ interface PressableProps extends PressableProps$1, SizeProps {
71
71
  *
72
72
  * @example
73
73
  * ```tsx
74
- * import { Pressable } from '@yahoo/uds-mobile';
74
+ * import { Pressable } from '@yahoo/uds-mobile/Pressable';
75
75
  *
76
76
  * <Pressable
77
77
  * backgroundColor="primary"
@@ -71,7 +71,7 @@ interface PressableProps extends PressableProps$1, SizeProps {
71
71
  *
72
72
  * @example
73
73
  * ```tsx
74
- * import { Pressable } from '@yahoo/uds-mobile';
74
+ * import { Pressable } from '@yahoo/uds-mobile/Pressable';
75
75
  *
76
76
  * <Pressable
77
77
  * backgroundColor="primary"
@@ -18,7 +18,7 @@ import Animated from "react-native-reanimated";
18
18
  *
19
19
  * @example
20
20
  * ```tsx
21
- * import { Pressable } from '@yahoo/uds-mobile';
21
+ * import { Pressable } from '@yahoo/uds-mobile/Pressable';
22
22
  *
23
23
  * <Pressable
24
24
  * backgroundColor="primary"
@@ -1 +1 @@
1
- {"version":3,"file":"Pressable.js","names":["RNPressable"],"sources":["../../src/components/Pressable.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useCallback } from 'react';\nimport type {\n PressableProps as RNPressableProps,\n PressableStateCallbackType,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { Pressable as RNPressable } from 'react-native';\nimport Animated from 'react-native-reanimated';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\n\ninterface PressableProps extends RNPressableProps, SizeProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Background color */\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 alignContent?: StyleProps['alignContent'];\n alignItems?: StyleProps['alignItems'];\n alignSelf?: StyleProps['alignSelf'];\n flex?: StyleProps['flex'];\n flexDirection?: StyleProps['flexDirection'];\n flexGrow?: StyleProps['flexGrow'];\n flexShrink?: StyleProps['flexShrink'];\n flexWrap?: StyleProps['flexWrap'];\n justifyContent?: StyleProps['justifyContent'];\n // Layout\n display?: StyleProps['display'];\n overflow?: StyleProps['overflow'];\n // Spacing\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n // Offset\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n // Gap\n columnGap?: StyleProps['columnGap'];\n rowGap?: StyleProps['rowGap'];\n // Opacity\n opacity?: number;\n}\n\n/**\n * **👆 A pressable component with UDS styling**\n *\n * @description\n * A styled pressable component that wraps React Native's Pressable with\n * UDS styling support. Use this as a building block for custom interactive\n * components.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Pressable } from '@yahoo/uds-mobile';\n *\n * <Pressable\n * backgroundColor=\"primary\"\n * spacing=\"4\"\n * borderRadius=\"md\"\n * onPress={() => console.log('Pressed!')}\n * >\n * <Text>Press me</Text>\n * </Pressable>\n * ```\n *\n * @usage\n * - Use for interactive elements that need press feedback\n * - Use for custom button-like components\n * - Supports all Box styling props\n *\n * @accessibility\n * - Set `accessibilityRole` appropriate to the component's purpose\n * - Provide `accessibilityLabel` for screen readers\n * - Use `accessibilityState` to communicate state changes\n *\n * @see {@link Button} for standard button actions\n * @see {@link Box} for non-interactive containers\n */\nconst Pressable = memo(function Pressable({\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 alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display = 'flex',\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n // Size\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n // Opacity\n opacity,\n // Style - extracted to merge with variants\n style,\n ref,\n // Rest\n ...props\n}: PressableProps) {\n styles.useVariants({\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 alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display,\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n });\n\n // Merge variant styles with user-provided style prop\n // Handle the case where style can be a function (for press states)\n const pressableStyles = useCallback(\n (state: PressableStateCallbackType) => {\n const userStyle = typeof style === 'function' ? style(state) : style;\n return [\n width ? { width } : undefined,\n height ? { height } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n opacity ? { opacity } : undefined,\n styles.foundation as StyleProp<ViewStyle>,\n userStyle,\n ];\n },\n [width, height, minWidth, maxWidth, minHeight, maxHeight, opacity, style, styles.foundation],\n );\n\n return <RNPressable ref={ref} style={pressableStyles} {...props} />;\n});\n\nPressable.displayName = 'Pressable';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(Pressable);\n\nexport { AnimatedPressable, Pressable, type PressableProps };\n"],"mappings":";;;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,UAAU"}
1
+ {"version":3,"file":"Pressable.js","names":["RNPressable"],"sources":["../../src/components/Pressable.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useCallback } from 'react';\nimport type {\n PressableProps as RNPressableProps,\n PressableStateCallbackType,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { Pressable as RNPressable } from 'react-native';\nimport Animated from 'react-native-reanimated';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\n\ninterface PressableProps extends RNPressableProps, SizeProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Background color */\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 alignContent?: StyleProps['alignContent'];\n alignItems?: StyleProps['alignItems'];\n alignSelf?: StyleProps['alignSelf'];\n flex?: StyleProps['flex'];\n flexDirection?: StyleProps['flexDirection'];\n flexGrow?: StyleProps['flexGrow'];\n flexShrink?: StyleProps['flexShrink'];\n flexWrap?: StyleProps['flexWrap'];\n justifyContent?: StyleProps['justifyContent'];\n // Layout\n display?: StyleProps['display'];\n overflow?: StyleProps['overflow'];\n // Spacing\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n // Offset\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n // Gap\n columnGap?: StyleProps['columnGap'];\n rowGap?: StyleProps['rowGap'];\n // Opacity\n opacity?: number;\n}\n\n/**\n * **👆 A pressable component with UDS styling**\n *\n * @description\n * A styled pressable component that wraps React Native's Pressable with\n * UDS styling support. Use this as a building block for custom interactive\n * components.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Pressable } from '@yahoo/uds-mobile/Pressable';\n *\n * <Pressable\n * backgroundColor=\"primary\"\n * spacing=\"4\"\n * borderRadius=\"md\"\n * onPress={() => console.log('Pressed!')}\n * >\n * <Text>Press me</Text>\n * </Pressable>\n * ```\n *\n * @usage\n * - Use for interactive elements that need press feedback\n * - Use for custom button-like components\n * - Supports all Box styling props\n *\n * @accessibility\n * - Set `accessibilityRole` appropriate to the component's purpose\n * - Provide `accessibilityLabel` for screen readers\n * - Use `accessibilityState` to communicate state changes\n *\n * @see {@link Button} for standard button actions\n * @see {@link Box} for non-interactive containers\n */\nconst Pressable = memo(function Pressable({\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 alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display = 'flex',\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n // Size\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n // Opacity\n opacity,\n // Style - extracted to merge with variants\n style,\n ref,\n // Rest\n ...props\n}: PressableProps) {\n styles.useVariants({\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 alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display,\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n });\n\n // Merge variant styles with user-provided style prop\n // Handle the case where style can be a function (for press states)\n const pressableStyles = useCallback(\n (state: PressableStateCallbackType) => {\n const userStyle = typeof style === 'function' ? style(state) : style;\n return [\n width ? { width } : undefined,\n height ? { height } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n opacity ? { opacity } : undefined,\n styles.foundation as StyleProp<ViewStyle>,\n userStyle,\n ];\n },\n [width, height, minWidth, maxWidth, minHeight, maxHeight, opacity, style, styles.foundation],\n );\n\n return <RNPressable ref={ref} style={pressableStyles} {...props} />;\n});\n\nPressable.displayName = 'Pressable';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(Pressable);\n\nexport { AnimatedPressable, Pressable, type PressableProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,MAAM,YAAY,KAAK,SAAS,UAAU,EAExC,iBAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,cACA,YACA,WACA,MACA,eACA,UACA,YACA,UACA,gBAEA,UAAU,QACV,UAEA,SACA,mBACA,iBACA,eACA,YACA,cACA,YAEA,QACA,gBACA,kBACA,cACA,WACA,aACA,WAEA,WACA,QAEA,OACA,QACA,UACA,UACA,WACA,WAEA,SAEA,OACA,KAEA,GAAG,SACc;AACjB,QAAO,YAAY;EAEjB;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACD,CAAC;AAsBF,QAAO,oBAACA,aAAD;EAAkB;EAAK,OAlBN,aACrB,UAAsC;GACrC,MAAM,YAAY,OAAO,UAAU,aAAa,MAAM,MAAM,GAAG;AAC/D,UAAO;IACL,QAAQ,EAAE,OAAO,GAAG,KAAA;IACpB,SAAS,EAAE,QAAQ,GAAG,KAAA;IACtB,WAAW,EAAE,UAAU,GAAG,KAAA;IAC1B,WAAW,EAAE,UAAU,GAAG,KAAA;IAC1B,YAAY,EAAE,WAAW,GAAG,KAAA;IAC5B,YAAY,EAAE,WAAW,GAAG,KAAA;IAC5B,UAAU,EAAE,SAAS,GAAG,KAAA;IACxB,OAAO;IACP;IACD;KAEH;GAAC;GAAO;GAAQ;GAAU;GAAU;GAAW;GAAW;GAAS;GAAO,OAAO;GAAW,CAG1C;EAAE,GAAI;EAAS,CAAA;EACnE;AAEF,UAAU,cAAc;AAExB,MAAM,oBAAoB,SAAS,wBAAwB,UAAU"}
@@ -30,7 +30,7 @@ const VARIANT_ERROR_MAP = {
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Radio } from '@yahoo/uds-mobile';
33
+ * import { Radio } from '@yahoo/uds-mobile/Radio';
34
34
  *
35
35
  * <Radio label="Option A" />
36
36
  * <Radio label="Option B" checked={true} onChange={setChecked} />
@@ -30,7 +30,7 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Radio } from '@yahoo/uds-mobile';
33
+ * import { Radio } from '@yahoo/uds-mobile/Radio';
34
34
  *
35
35
  * <Radio label="Option A" />
36
36
  * <Radio label="Option B" checked={true} onChange={setChecked} />
@@ -30,7 +30,7 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Radio } from '@yahoo/uds-mobile';
33
+ * import { Radio } from '@yahoo/uds-mobile/Radio';
34
34
  *
35
35
  * <Radio label="Option A" />
36
36
  * <Radio label="Option B" checked={true} onChange={setChecked} />
@@ -27,7 +27,7 @@ const VARIANT_ERROR_MAP = {
27
27
  *
28
28
  * @example
29
29
  * ```tsx
30
- * import { Radio } from '@yahoo/uds-mobile';
30
+ * import { Radio } from '@yahoo/uds-mobile/Radio';
31
31
  *
32
32
  * <Radio label="Option A" />
33
33
  * <Radio label="Option B" checked={true} onChange={setChecked} />
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":["Text","Pressable"],"sources":["../../src/components/Radio.tsx"],"sourcesContent":["import type { RadioVariant, UniversalRadioProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { View } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated';\n\nimport { radioStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from RadioValue - maps boolean to 'checked'/'unchecked' string literals */\ntype RadioValueState = 'checked' | 'unchecked';\n\ninterface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the radio is disabled */\n disabled?: boolean;\n /** Whether the radio is required */\n required?: boolean;\n /** Callback fired when the checked state changes */\n onChange?: (checked: boolean) => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Variant Mapping */\n/* -------------------------------------------------------------------------- */\n\n/** All style variants available in the generated styles (includes error variants) */\ntype RadioStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<RadioVariant, RadioStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Radio Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A radio component**\n *\n * @description\n * A radio component allows users to select one option from a set.\n * Unlike checkbox, radio buttons cannot have multiple selected in a group,\n * allowing only one selection at a time.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Radio } from '@yahoo/uds-mobile';\n *\n * <Radio label=\"Option A\" />\n * <Radio label=\"Option B\" checked={true} onChange={setChecked} />\n * ```\n *\n * @usage\n * - Forms: For selecting a single option from multiple choices\n * - Settings: For toggling between mutually exclusive preferences\n *\n * @accessibility\n * - Sets `accessibilityRole=\"radio\"` automatically\n * - Announces checked/unchecked state\n * - Label is used as accessibility label\n * - Supports `reduceMotion` for users who prefer reduced motion\n *\n * @see {@link Checkbox} for multi-select options\n * @see {@link Switch} for binary toggles\n */\nconst Radio = memo(function Radio({\n // Radio props\n label,\n labelPosition = 'start',\n variant: variantProp = 'primary',\n size = 'md',\n checked: checkedProp,\n hasError,\n reduceMotion,\n // Native props\n defaultChecked,\n disabled,\n required,\n onChange,\n ref,\n ...viewProps\n}: RadioProps) {\n const generatedId = useId();\n const uid = `uds-radio-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<boolean>(\n isControlled ? checkedProp : (defaultChecked ?? false),\n );\n const [pressed, setPressed] = useState(false);\n\n // Use controlled value if provided, otherwise use internal state\n const checked = isControlled ? checkedProp : internalChecked;\n\n /* ------------------------------ Derived Values ---------------------------- */\n const valueState: RadioValueState = useMemo(() => {\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n /* -------------------------------- Animation ------------------------------- */\n const shouldAnimate = !reduceMotion;\n\n // Scale animation for press feedback (disabled when reduceMotion is true)\n const scaleProgress = useDerivedValue(\n () =>\n shouldAnimate\n ? withSpring(pressed ? SCALE_EFFECTS.down : SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG)\n : SCALE_EFFECTS.none, // No scale effect when reduceMotion is true\n [pressed, shouldAnimate],\n );\n\n const radioAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n /* -------------------------------- Handlers -------------------------------- */\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n\n onChange?.(newChecked);\n }, [disabled, checked, isControlled, onChange]);\n\n const handlePressIn = useCallback(() => {\n setPressed(true);\n }, []);\n\n const handlePressOut = useCallback(() => {\n setPressed(false);\n }, []);\n\n /* --------------------------------- Styles --------------------------------- */\n // Compute the style variant (primary/secondary maps to alert variants when hasError)\n const styleVariant: RadioStyleVariant = hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp;\n\n radioStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [radioStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [radioStyles.root, disabled],\n );\n\n const radioBoxStyle = useMemo(\n () => [\n radioStyles.radio,\n {\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n borderRadius: 9999,\n },\n radioAnimatedStyle,\n ],\n [radioStyles.radio, radioAnimatedStyle],\n );\n\n // Inner circle size: fixed 8x8px to match web implementation\n const INNER_CIRCLE_SIZE = 8;\n\n const circleStyle = useMemo(\n () => [\n radioStyles.radioCircle,\n {\n width: INNER_CIRCLE_SIZE,\n height: INNER_CIRCLE_SIZE,\n borderRadius: 9999,\n },\n ],\n [radioStyles.radioCircle],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content =\n typeof label === 'function' ? label() : isValidElement(label) ? label : String(label);\n\n const textContent =\n typeof content === 'string' ? <Text style={radioStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={radioStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, radioStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked,\n }),\n [disabled, checked],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <Pressable\n ref={ref}\n nativeID={uid}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n disabled={disabled}\n flexDirection={labelPosition === 'start' ? 'row' : 'row-reverse'}\n alignItems=\"center\"\n alignSelf=\"flex-start\"\n accessibilityRole=\"radio\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={radioBoxStyle}>{checked && <View style={circleStyle} />}</Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nRadio.displayName = 'Radio';\n\nexport { Radio, type RadioProps };\n"],"mappings":";;;;;;;;;;;;AAwCA,MAAM,oBAA6D;CACjE,SAAS;CACT,WAAW;CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCD,MAAM,QAAQ,KAAK,SAAS,MAAM,EAEhC,OACA,gBAAgB,SAChB,SAAS,cAAc,WACvB,OAAO,MACP,SAAS,aACT,UACA,cAEA,gBACA,UACA,UACA,UACA,KACA,GAAG,aACU;CAEb,MAAM,MAAM,aADQ,OACgB;CAGpC,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,CAAC,iBAAiB,sBAAsB,SAC5C,eAAe,cAAe,kBAAkB,MACjD;CACD,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAG7C,MAAM,UAAU,eAAe,cAAc;CAG7C,MAAM,aAA8B,cAAc;AAChD,SAAO,UAAU,YAAY;IAC5B,CAAC,QAAQ,CAAC;CAGb,MAAM,gBAAgB,CAAC;CAGvB,MAAM,gBAAgB,sBAElB,gBACI,WAAW,UAAU,cAAc,OAAO,cAAc,MAAM,qBAAqB,GACnF,cAAc,MACpB,CAAC,SAAS,cAAc,CACzB;CAED,MAAM,qBAAqB,wBAAwB,EACjD,WAAW,CAAC,EAAE,OAAO,cAAc,OAAO,CAAC,EAC5C,EAAE;CAGH,MAAM,cAAc,kBAAkB;AACpC,MAAI,SACF;EAGF,MAAM,aAAa,CAAC;AAEpB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAGhC,aAAW,WAAW;IACrB;EAAC;EAAU;EAAS;EAAc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AAW;EACX,WAAU;EACV,mBAAkB;EAClB,oBAAoB;EACpB,oBAAoB,OAAO,UAAU,WAAW,QAAQ,KAAA;EACxD,GAAI;EACJ,OAAO;YAdT,CAgBE,oBAAC,SAAS,MAAV;GAAe,OAAO;aAAgB,WAAW,oBAAC,MAAD,EAAM,OAAO,aAAe,CAAA;GAAiB,CAAA,EAE7F,aACS;;EAEd;AAEF,MAAM,cAAc"}
1
+ {"version":3,"file":"Radio.js","names":["Text","Pressable"],"sources":["../../src/components/Radio.tsx"],"sourcesContent":["import type { RadioVariant, UniversalRadioProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { View } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated';\n\nimport { radioStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from RadioValue - maps boolean to 'checked'/'unchecked' string literals */\ntype RadioValueState = 'checked' | 'unchecked';\n\ninterface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the radio is disabled */\n disabled?: boolean;\n /** Whether the radio is required */\n required?: boolean;\n /** Callback fired when the checked state changes */\n onChange?: (checked: boolean) => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Variant Mapping */\n/* -------------------------------------------------------------------------- */\n\n/** All style variants available in the generated styles (includes error variants) */\ntype RadioStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<RadioVariant, RadioStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Radio Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A radio component**\n *\n * @description\n * A radio component allows users to select one option from a set.\n * Unlike checkbox, radio buttons cannot have multiple selected in a group,\n * allowing only one selection at a time.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Radio } from '@yahoo/uds-mobile/Radio';\n *\n * <Radio label=\"Option A\" />\n * <Radio label=\"Option B\" checked={true} onChange={setChecked} />\n * ```\n *\n * @usage\n * - Forms: For selecting a single option from multiple choices\n * - Settings: For toggling between mutually exclusive preferences\n *\n * @accessibility\n * - Sets `accessibilityRole=\"radio\"` automatically\n * - Announces checked/unchecked state\n * - Label is used as accessibility label\n * - Supports `reduceMotion` for users who prefer reduced motion\n *\n * @see {@link Checkbox} for multi-select options\n * @see {@link Switch} for binary toggles\n */\nconst Radio = memo(function Radio({\n // Radio props\n label,\n labelPosition = 'start',\n variant: variantProp = 'primary',\n size = 'md',\n checked: checkedProp,\n hasError,\n reduceMotion,\n // Native props\n defaultChecked,\n disabled,\n required,\n onChange,\n ref,\n ...viewProps\n}: RadioProps) {\n const generatedId = useId();\n const uid = `uds-radio-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<boolean>(\n isControlled ? checkedProp : (defaultChecked ?? false),\n );\n const [pressed, setPressed] = useState(false);\n\n // Use controlled value if provided, otherwise use internal state\n const checked = isControlled ? checkedProp : internalChecked;\n\n /* ------------------------------ Derived Values ---------------------------- */\n const valueState: RadioValueState = useMemo(() => {\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n /* -------------------------------- Animation ------------------------------- */\n const shouldAnimate = !reduceMotion;\n\n // Scale animation for press feedback (disabled when reduceMotion is true)\n const scaleProgress = useDerivedValue(\n () =>\n shouldAnimate\n ? withSpring(pressed ? SCALE_EFFECTS.down : SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG)\n : SCALE_EFFECTS.none, // No scale effect when reduceMotion is true\n [pressed, shouldAnimate],\n );\n\n const radioAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n /* -------------------------------- Handlers -------------------------------- */\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n\n onChange?.(newChecked);\n }, [disabled, checked, isControlled, onChange]);\n\n const handlePressIn = useCallback(() => {\n setPressed(true);\n }, []);\n\n const handlePressOut = useCallback(() => {\n setPressed(false);\n }, []);\n\n /* --------------------------------- Styles --------------------------------- */\n // Compute the style variant (primary/secondary maps to alert variants when hasError)\n const styleVariant: RadioStyleVariant = hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp;\n\n radioStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [radioStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [radioStyles.root, disabled],\n );\n\n const radioBoxStyle = useMemo(\n () => [\n radioStyles.radio,\n {\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n borderRadius: 9999,\n },\n radioAnimatedStyle,\n ],\n [radioStyles.radio, radioAnimatedStyle],\n );\n\n // Inner circle size: fixed 8x8px to match web implementation\n const INNER_CIRCLE_SIZE = 8;\n\n const circleStyle = useMemo(\n () => [\n radioStyles.radioCircle,\n {\n width: INNER_CIRCLE_SIZE,\n height: INNER_CIRCLE_SIZE,\n borderRadius: 9999,\n },\n ],\n [radioStyles.radioCircle],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content =\n typeof label === 'function' ? label() : isValidElement(label) ? label : String(label);\n\n const textContent =\n typeof content === 'string' ? <Text style={radioStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={radioStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, radioStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked,\n }),\n [disabled, checked],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <Pressable\n ref={ref}\n nativeID={uid}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n disabled={disabled}\n flexDirection={labelPosition === 'start' ? 'row' : 'row-reverse'}\n alignItems=\"center\"\n alignSelf=\"flex-start\"\n accessibilityRole=\"radio\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={radioBoxStyle}>{checked && <View style={circleStyle} />}</Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nRadio.displayName = 'Radio';\n\nexport { Radio, type RadioProps };\n"],"mappings":";;;;;;;;;;;;AAwCA,MAAM,oBAA6D;CACjE,SAAS;CACT,WAAW;CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCD,MAAM,QAAQ,KAAK,SAAS,MAAM,EAEhC,OACA,gBAAgB,SAChB,SAAS,cAAc,WACvB,OAAO,MACP,SAAS,aACT,UACA,cAEA,gBACA,UACA,UACA,UACA,KACA,GAAG,aACU;CAEb,MAAM,MAAM,aADQ,OACgB;CAGpC,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,CAAC,iBAAiB,sBAAsB,SAC5C,eAAe,cAAe,kBAAkB,MACjD;CACD,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAG7C,MAAM,UAAU,eAAe,cAAc;CAG7C,MAAM,aAA8B,cAAc;AAChD,SAAO,UAAU,YAAY;IAC5B,CAAC,QAAQ,CAAC;CAGb,MAAM,gBAAgB,CAAC;CAGvB,MAAM,gBAAgB,sBAElB,gBACI,WAAW,UAAU,cAAc,OAAO,cAAc,MAAM,qBAAqB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AD;IAAM,OAAO,YAAY;cAAM;IAAQ,CAAA,CAChC;;AAIb,SAAO;IACN;EAAC;EAAO;EAAU,YAAY;EAAK,CAAC;CAEvC,MAAM,YAAY,eACT;EACL;EACA;EACD,GACD,CAAC,UAAU,QAAQ,CACpB;AAGD,QACE,qBAACC,aAAD;EACO;EACL,UAAU;EACV,SAAS;EACT,WAAW;EACX,YAAY;EACF;EACV,eAAe,kBAAkB,UAAU,QAAQ;EACnD,YAAW;EACX,WAAU;EACV,mBAAkB;EAClB,oBAAoB;EACpB,oBAAoB,OAAO,UAAU,WAAW,QAAQ,KAAA;EACxD,GAAI;EACJ,OAAO;YAdT,CAgBE,oBAAC,SAAS,MAAV;GAAe,OAAO;aAAgB,WAAW,oBAAC,MAAD,EAAM,OAAO,aAAe,CAAA;GAAiB,CAAA,EAE7F,aACS;;EAEd;AAEF,MAAM,cAAc"}
@@ -22,7 +22,7 @@ let react_native_unistyles = require("react-native-unistyles");
22
22
  *
23
23
  * @example
24
24
  * ```tsx
25
- * import { Screen } from '@yahoo/uds-mobile';
25
+ * import { Screen } from '@yahoo/uds-mobile/Screen';
26
26
  *
27
27
  * <Screen backgroundColor="primary" spacingHorizontal="6">
28
28
  * <Text>Screen content</Text>
@@ -35,7 +35,7 @@ interface ScreenProps extends ScrollViewProps {
35
35
  *
36
36
  * @example
37
37
  * ```tsx
38
- * import { Screen } from '@yahoo/uds-mobile';
38
+ * import { Screen } from '@yahoo/uds-mobile/Screen';
39
39
  *
40
40
  * <Screen backgroundColor="primary" spacingHorizontal="6">
41
41
  * <Text>Screen content</Text>
@@ -35,7 +35,7 @@ interface ScreenProps extends ScrollViewProps {
35
35
  *
36
36
  * @example
37
37
  * ```tsx
38
- * import { Screen } from '@yahoo/uds-mobile';
38
+ * import { Screen } from '@yahoo/uds-mobile/Screen';
39
39
  *
40
40
  * <Screen backgroundColor="primary" spacingHorizontal="6">
41
41
  * <Text>Screen content</Text>
@@ -20,7 +20,7 @@ import { StyleSheet as StyleSheet$1 } from "react-native-unistyles";
20
20
  *
21
21
  * @example
22
22
  * ```tsx
23
- * import { Screen } from '@yahoo/uds-mobile';
23
+ * import { Screen } from '@yahoo/uds-mobile/Screen';
24
24
  *
25
25
  * <Screen backgroundColor="primary" spacingHorizontal="6">
26
26
  * <Text>Screen content</Text>
@@ -1 +1 @@
1
- {"version":3,"file":"Screen.js","names":["StyleSheet"],"sources":["../../src/components/Screen.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { ScrollViewProps, ViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { HStackProps } from './HStack';\nimport { HStack } from './HStack';\nimport { VStack } from './VStack';\n\ninterface ScreenProps extends ScrollViewProps {\n /** Ref to the underlying ScrollView */\n ref?: Ref<ScrollView>;\n /** Background color of the screen */\n backgroundColor?: StyleProps['backgroundColor'];\n /** Horizontal padding for screen content */\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n /** Top padding for screen content */\n spacingTop?: StyleProps['spacingTop'];\n /** Gap between child elements */\n gap?: StyleProps['columnGap'];\n /** Content that sticks to the top of the screen when scrolling */\n stickyHeader?: ReactNode;\n /** Props passed to the sticky header container */\n stickyHeaderProps?: HStackProps;\n}\n\n/**\n * **📱 A screen container with safe area handling**\n *\n * @description\n * A scrollable screen component that handles safe area insets and provides\n * consistent padding and background styling. Uses Unistyles' built-in\n * safe area insets via the `rt` runtime object.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Screen } from '@yahoo/uds-mobile';\n *\n * <Screen backgroundColor=\"primary\" spacingHorizontal=\"6\">\n * <Text>Screen content</Text>\n * </Screen>\n *\n * // With sticky header\n * <Screen\n * stickyHeader={<Text>Header</Text>}\n * stickyHeaderProps={{ backgroundColor: 'secondary' }}\n * >\n * <Text>Content</Text>\n * </Screen>\n * ```\n *\n * @usage\n * - Use as the root component for screens\n * - Use stickyHeader for persistent header content\n * - Content is automatically scrollable\n * - Safe area insets are handled automatically\n *\n * @see {@link VStack} for non-scrollable vertical layouts\n * @see {@link Box} for custom containers\n */\nconst Screen = memo(function Screen({\n children,\n // Background\n backgroundColor = 'primary',\n // Spacing\n spacingHorizontal = '6',\n spacingTop = '6',\n gap,\n // Header\n stickyHeader,\n stickyHeaderProps,\n style,\n ref,\n ...props\n}: ScreenProps) {\n const { style: stickyHeaderStyle, ...stickyHeaderPropsWithoutStyle } = stickyHeaderProps ?? {};\n\n styles.useVariants({\n backgroundColor,\n flex: '1',\n flexDirection: 'column',\n columnGap: gap,\n });\n\n // styles.foundation must be in deps - it returns a new reference when variants change\n const scrollStyles = useMemo(\n () => [styles.foundation as ViewProps['style'], style],\n [styles.foundation, style],\n );\n\n return (\n <VStack backgroundColor=\"primary\" style={screenStyles.wrapper}>\n <ScrollView\n ref={ref}\n style={scrollStyles}\n stickyHeaderIndices={stickyHeader ? [0] : undefined}\n {...props}\n >\n {stickyHeader && (\n <HStack\n spacingHorizontal=\"6\"\n spacingBottom=\"4\"\n backgroundColor=\"primary\"\n justifyContent=\"flex-end\"\n style={stickyHeaderStyle}\n {...stickyHeaderPropsWithoutStyle}\n >\n {stickyHeader}\n </HStack>\n )}\n <VStack flex=\"1\" spacingHorizontal={spacingHorizontal} spacingTop={spacingTop} gap={gap}>\n {children}\n </VStack>\n </ScrollView>\n </VStack>\n );\n});\n\nScreen.displayName = 'Screen';\n\nconst screenStyles = StyleSheet.create((_theme, rt) => ({\n wrapper: {\n flex: 1, // apply insets to the container,\n // so it will add required paddings\n paddingTop: rt.insets.top,\n paddingBottom: rt.insets.bottom,\n paddingLeft: rt.insets.left,\n paddingRight: rt.insets.right,\n },\n}));\n\nexport { Screen, type ScreenProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,UAEA,kBAAkB,WAElB,oBAAoB,KACpB,aAAa,KACb,KAEA,cACA,mBACA,OACA,KACA,GAAG,SACW;CACd,MAAM,EAAE,OAAO,mBAAmB,GAAG,kCAAkC,qBAAqB,EAAE;AAE9F,QAAO,YAAY;EACjB;EACA,MAAM;EACN,eAAe;EACf,WAAW;EACZ,CAAC;CAGF,MAAM,eAAe,cACb,CAAC,OAAO,YAAkC,MAAM,EACtD,CAAC,OAAO,YAAY,MAAM,CAC3B;AAED,QACE,oBAAC,QAAD;EAAQ,iBAAgB;EAAU,OAAO,aAAa;YACpD,qBAAC,YAAD;GACO;GACL,OAAO;GACP,qBAAqB,eAAe,CAAC,EAAE,GAAG,KAAA;GAC1C,GAAI;aAJN,CAMG,gBACC,oBAAC,QAAD;IACE,mBAAkB;IAClB,eAAc;IACd,iBAAgB;IAChB,gBAAe;IACf,OAAO;IACP,GAAI;cAEH;IACM,CAAA,EAEX,oBAAC,QAAD;IAAQ,MAAK;IAAuB;IAA+B;IAAiB;IACjF;IACM,CAAA,CACE;;EACN,CAAA;EAEX;AAEF,OAAO,cAAc;AAErB,MAAM,eAAeA,aAAW,QAAQ,QAAQ,QAAQ,EACtD,SAAS;CACP,MAAM;CAEN,YAAY,GAAG,OAAO;CACtB,eAAe,GAAG,OAAO;CACzB,aAAa,GAAG,OAAO;CACvB,cAAc,GAAG,OAAO;CACzB,EACF,EAAE"}
1
+ {"version":3,"file":"Screen.js","names":["StyleSheet"],"sources":["../../src/components/Screen.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { ScrollViewProps, ViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { HStackProps } from './HStack';\nimport { HStack } from './HStack';\nimport { VStack } from './VStack';\n\ninterface ScreenProps extends ScrollViewProps {\n /** Ref to the underlying ScrollView */\n ref?: Ref<ScrollView>;\n /** Background color of the screen */\n backgroundColor?: StyleProps['backgroundColor'];\n /** Horizontal padding for screen content */\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n /** Top padding for screen content */\n spacingTop?: StyleProps['spacingTop'];\n /** Gap between child elements */\n gap?: StyleProps['columnGap'];\n /** Content that sticks to the top of the screen when scrolling */\n stickyHeader?: ReactNode;\n /** Props passed to the sticky header container */\n stickyHeaderProps?: HStackProps;\n}\n\n/**\n * **📱 A screen container with safe area handling**\n *\n * @description\n * A scrollable screen component that handles safe area insets and provides\n * consistent padding and background styling. Uses Unistyles' built-in\n * safe area insets via the `rt` runtime object.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Screen } from '@yahoo/uds-mobile/Screen';\n *\n * <Screen backgroundColor=\"primary\" spacingHorizontal=\"6\">\n * <Text>Screen content</Text>\n * </Screen>\n *\n * // With sticky header\n * <Screen\n * stickyHeader={<Text>Header</Text>}\n * stickyHeaderProps={{ backgroundColor: 'secondary' }}\n * >\n * <Text>Content</Text>\n * </Screen>\n * ```\n *\n * @usage\n * - Use as the root component for screens\n * - Use stickyHeader for persistent header content\n * - Content is automatically scrollable\n * - Safe area insets are handled automatically\n *\n * @see {@link VStack} for non-scrollable vertical layouts\n * @see {@link Box} for custom containers\n */\nconst Screen = memo(function Screen({\n children,\n // Background\n backgroundColor = 'primary',\n // Spacing\n spacingHorizontal = '6',\n spacingTop = '6',\n gap,\n // Header\n stickyHeader,\n stickyHeaderProps,\n style,\n ref,\n ...props\n}: ScreenProps) {\n const { style: stickyHeaderStyle, ...stickyHeaderPropsWithoutStyle } = stickyHeaderProps ?? {};\n\n styles.useVariants({\n backgroundColor,\n flex: '1',\n flexDirection: 'column',\n columnGap: gap,\n });\n\n // styles.foundation must be in deps - it returns a new reference when variants change\n const scrollStyles = useMemo(\n () => [styles.foundation as ViewProps['style'], style],\n [styles.foundation, style],\n );\n\n return (\n <VStack backgroundColor=\"primary\" style={screenStyles.wrapper}>\n <ScrollView\n ref={ref}\n style={scrollStyles}\n stickyHeaderIndices={stickyHeader ? [0] : undefined}\n {...props}\n >\n {stickyHeader && (\n <HStack\n spacingHorizontal=\"6\"\n spacingBottom=\"4\"\n backgroundColor=\"primary\"\n justifyContent=\"flex-end\"\n style={stickyHeaderStyle}\n {...stickyHeaderPropsWithoutStyle}\n >\n {stickyHeader}\n </HStack>\n )}\n <VStack flex=\"1\" spacingHorizontal={spacingHorizontal} spacingTop={spacingTop} gap={gap}>\n {children}\n </VStack>\n </ScrollView>\n </VStack>\n );\n});\n\nScreen.displayName = 'Screen';\n\nconst screenStyles = StyleSheet.create((_theme, rt) => ({\n wrapper: {\n flex: 1, // apply insets to the container,\n // so it will add required paddings\n paddingTop: rt.insets.top,\n paddingBottom: rt.insets.bottom,\n paddingLeft: rt.insets.left,\n paddingRight: rt.insets.right,\n },\n}));\n\nexport { Screen, type ScreenProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,UAEA,kBAAkB,WAElB,oBAAoB,KACpB,aAAa,KACb,KAEA,cACA,mBACA,OACA,KACA,GAAG,SACW;CACd,MAAM,EAAE,OAAO,mBAAmB,GAAG,kCAAkC,qBAAqB,EAAE;AAE9F,QAAO,YAAY;EACjB;EACA,MAAM;EACN,eAAe;EACf,WAAW;EACZ,CAAC;CAGF,MAAM,eAAe,cACb,CAAC,OAAO,YAAkC,MAAM,EACtD,CAAC,OAAO,YAAY,MAAM,CAC3B;AAED,QACE,oBAAC,QAAD;EAAQ,iBAAgB;EAAU,OAAO,aAAa;YACpD,qBAAC,YAAD;GACO;GACL,OAAO;GACP,qBAAqB,eAAe,CAAC,EAAE,GAAG,KAAA;GAC1C,GAAI;aAJN,CAMG,gBACC,oBAAC,QAAD;IACE,mBAAkB;IAClB,eAAc;IACd,iBAAgB;IAChB,gBAAe;IACf,OAAO;IACP,GAAI;cAEH;IACM,CAAA,EAEX,oBAAC,QAAD;IAAQ,MAAK;IAAuB;IAA+B;IAAiB;IACjF;IACM,CAAA,CACE;;EACN,CAAA;EAEX;AAEF,OAAO,cAAc;AAErB,MAAM,eAAeA,aAAW,QAAQ,QAAQ,QAAQ,EACtD,SAAS;CACP,MAAM;CAEN,YAAY,GAAG,OAAO;CACtB,eAAe,GAAG,OAAO;CACzB,aAAa,GAAG,OAAO;CACvB,cAAc,GAAG,OAAO;CACzB,EACF,EAAE"}
@@ -30,7 +30,7 @@ const ANIMATION_DURATION = 120;
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Switch } from '@yahoo/uds-mobile';
33
+ * import { Switch } from '@yahoo/uds-mobile/Switch';
34
34
  *
35
35
  * <Switch label="Notifications" />
36
36
  * <Switch isOn={enabled} onChange={setEnabled} label="Dark mode" />
@@ -30,7 +30,7 @@ interface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<Ico
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Switch } from '@yahoo/uds-mobile';
33
+ * import { Switch } from '@yahoo/uds-mobile/Switch';
34
34
  *
35
35
  * <Switch label="Notifications" />
36
36
  * <Switch isOn={enabled} onChange={setEnabled} label="Dark mode" />
@@ -30,7 +30,7 @@ interface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<Ico
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Switch } from '@yahoo/uds-mobile';
33
+ * import { Switch } from '@yahoo/uds-mobile/Switch';
34
34
  *
35
35
  * <Switch label="Notifications" />
36
36
  * <Switch isOn={enabled} onChange={setEnabled} label="Dark mode" />
@@ -27,7 +27,7 @@ const ANIMATION_DURATION = 120;
27
27
  *
28
28
  * @example
29
29
  * ```tsx
30
- * import { Switch } from '@yahoo/uds-mobile';
30
+ * import { Switch } from '@yahoo/uds-mobile/Switch';
31
31
  *
32
32
  * <Switch label="Notifications" />
33
33
  * <Switch isOn={enabled} onChange={setEnabled} label="Dark mode" />
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","names":["Text","StyleSheet"],"sources":["../../src/components/Switch.tsx"],"sourcesContent":["import type { SwitchSize, UniversalSwitchProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { AccessibilityProps, StyleProp, View, ViewProps, ViewStyle } from 'react-native';\nimport { AccessibilityInfo, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';\nimport { StyleSheet } from 'react-native-unistyles';\nimport { useAnimatedVariantColor } from 'react-native-unistyles/reanimated';\n\nimport { switchStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\ninterface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<IconSlotType> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Callback when the switch value changes */\n onChange?: (value: boolean) => void;\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Whether the switch is required (shows asterisk with label) */\n required?: boolean;\n /** Accessibility hint describing what happens when activated */\n accessibilityHint?: AccessibilityProps['accessibilityHint'];\n}\n\nconst HANDLE_TRAVEL: Record<SwitchSize, number> = {\n md: 20,\n sm: 12,\n};\n\nconst ANIMATION_DURATION = 120;\n\n/**\n * **Switch component for toggling options**\n *\n * @description\n * A switch (also called a toggle) is a binary on/off input control.\n * It allows users to pick between two clearly opposite choices.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Switch } from '@yahoo/uds-mobile';\n *\n * <Switch label=\"Notifications\" />\n * <Switch isOn={enabled} onChange={setEnabled} label=\"Dark mode\" />\n * <Switch onIcon=\"Check\" offIcon=\"Cross\" label=\"Sync\" />\n * ```\n *\n * @usage\n * - Settings: For toggling preferences on/off\n * - Feature flags: For enabling/disabling features\n * - Immediate effect toggles (no submit button needed)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"switch\"` automatically\n * - Announces on/off state to screen readers\n * - Respects system reduce motion preference\n * - Supports `reduceMotion` prop to disable animations\n *\n * @see {@link Checkbox} for forms with submit actions\n * @see {@link Radio} for single-select options\n */\nconst Switch = memo(function Switch({\n isOn: isOnProp,\n defaultIsOn = false,\n onChange,\n label,\n labelPosition = 'start',\n size = 'md',\n onIcon,\n offIcon,\n disabled = false,\n required,\n accessibilityHint,\n reduceMotion = false,\n ref,\n ...viewProps\n}: SwitchProps) {\n const isControlled = isOnProp !== undefined;\n const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n const isOn = isControlled ? isOnProp : internalIsOn;\n\n // Check system reduced motion preference\n useEffect(() => {\n const checkReducedMotion = async () => {\n const isReduceMotionEnabled = await AccessibilityInfo.isReduceMotionEnabled();\n setPrefersReducedMotion(isReduceMotionEnabled);\n };\n checkReducedMotion();\n\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setPrefersReducedMotion,\n );\n return () => subscription.remove();\n }, []);\n\n const shouldReduceMotion = reduceMotion || prefersReducedMotion;\n const animationDuration = shouldReduceMotion ? 0 : ANIMATION_DURATION;\n\n const progress = useDerivedValue(\n () => withTiming(isOn ? 1 : 0, { duration: animationDuration }),\n [isOn, animationDuration],\n );\n\n const travelDistance = HANDLE_TRAVEL[size];\n\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newValue = !isOn;\n\n if (!isControlled) {\n setInternalIsOn(newValue);\n }\n\n onChange?.(newValue);\n }, [disabled, isOn, isControlled, onChange]);\n\n switchStyles.useVariants({\n size,\n variant: isOn ? 'on' : 'off',\n });\n\n // Get animated track color from design tokens (changes when variant changes)\n const trackBackgroundColor = useAnimatedVariantColor(switchStyles.switch, 'backgroundColor');\n\n const animatedTrackStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n backgroundColor: withTiming(trackBackgroundColor.value, { duration: animationDuration }),\n };\n });\n\n const animatedHandleStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n transform: [{ translateX: progress.value * travelDistance }],\n };\n });\n\n const rootStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.root, switchStaticStyles.root({ disabled })],\n [switchStyles.root, disabled],\n );\n\n const trackStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.switch, switchStaticStyles.track, animatedTrackStyle],\n [switchStyles.switch, animatedTrackStyle],\n );\n\n const handleStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.handle, switchStaticStyles.handle, animatedHandleStyle],\n [switchStyles.handle, animatedHandleStyle],\n );\n\n const accessibilityLabel = typeof label === 'string' ? label : undefined;\n const resolvedAccessibilityHint = accessibilityHint ?? 'Double tap to toggle';\n\n const resolvedLabel = typeof label === 'function' ? label() : label;\n const labelContent = resolvedLabel && (\n <HStack gap=\"2\" alignItems=\"center\">\n <Text style={switchStyles.text}>{resolvedLabel}</Text>\n {required && <Text color=\"alert\">*</Text>}\n </HStack>\n );\n\n const a11yValue = useMemo(() => ({ text: isOn ? 'On' : 'Off' }), [isOn]);\n\n return (\n <Pressable\n ref={ref}\n onPress={handlePress}\n disabled={disabled}\n accessible\n accessibilityRole=\"switch\"\n accessibilityState={{ checked: isOn, disabled }}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={resolvedAccessibilityHint}\n accessibilityValue={a11yValue}\n {...viewProps}\n style={rootStyle}\n >\n {labelPosition === 'start' && labelContent}\n\n <Animated.View style={trackStyle} importantForAccessibility=\"no-hide-descendants\">\n <Animated.View style={handleStyle}>\n {onIcon && isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={onIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n {offIcon && !isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={offIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n </Animated.View>\n </Animated.View>\n\n {labelPosition === 'end' && labelContent}\n </Pressable>\n );\n});\n\nSwitch.displayName = 'Switch';\n\nconst switchStaticStyles = StyleSheet.create((theme) => ({\n handle: {\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n },\n iconContainer: {\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n },\n track: {\n justifyContent: 'center',\n borderRadius: theme.borderRadius.full,\n },\n root: ({ disabled }: { disabled: boolean }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'flex-start',\n opacity: disabled ? 0.5 : 1,\n }),\n}));\n\nexport { Switch, type SwitchProps };\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,gBAA4C;CAChD,IAAI;CACJ,IAAI;CACL;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmC3B,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,MAAM,UACN,cAAc,OACd,UACA,OACA,gBAAgB,SAChB,OAAO,MACP,QACA,SACA,WAAW,OACX,UACA,mBACA,eAAe,OACf,KACA,GAAG,aACW;CACd,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,CAAC,cAAc,mBAAmB,SAAS,YAAY;CAC7D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,MAAM;CACvE,MAAM,OAAO,eAAe,WAAW;AAGvC,iBAAgB;EACd,MAAM,qBAAqB,YAAY;AAErC,2BAAwB,MADY,kBAAkB,uBAAuB,CAC/B;;AAEhD,sBAAoB;EAEpB,MAAM,eAAe,kBAAkB,iBACrC,uBACA,wBACD;AACD,eAAa,aAAa,QAAQ;IACjC,EAAE,CAAC;CAGN,MAAM,oBADqB,gBAAgB,uBACI,IAAI;CAEnD,MAAM,WAAW,sBACT,WAAW,OAAO,IAAI,GAAG,EAAE,UAAU,mBAAmB,CAAC,EAC/D,CAAC,MAAM,kBAAkB,CAC1B;CAED,MAAM,iBAAiB,cAAc;CAErC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K,CAAC;AAExE,QACE,qBAAC,WAAD;EACO;EACL,SAAS;EACC;EACV,YAAA;EACA,mBAAkB;EAClB,oBAAoB;GAAE,SAAS;GAAM;GAAU;EAC3B;EACpB,mBAAmB;EACnB,oBAAoB;EACpB,GAAI;EACJ,OAAO;YAXT;GAaG,kBAAkB,WAAW;GAE9B,oBAAC,SAAS,MAAV;IAAe,OAAO;IAAY,2BAA0B;cAC1D,qBAAC,SAAS,MAAV;KAAe,OAAO;eAAtB,CACG,UAAU,QACT,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAQ,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC3D,CAAA,EAEjB,WAAW,CAAC,QACX,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAS,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC5D,CAAA,CAEJ;;IACF,CAAA;GAEf,kBAAkB,SAAS;GAClB;;EAEd;AAEF,OAAO,cAAc;AAErB,MAAM,qBAAqBC,aAAW,QAAQ,WAAW;CACvD,QAAQ;EACN,cAAc,MAAM,aAAa;EACjC,YAAY;EACZ,gBAAgB;EACjB;CACD,eAAe;EACb,UAAU;EACV,YAAY;EACZ,gBAAgB;EACjB;CACD,OAAO;EACL,gBAAgB;EAChB,cAAc,MAAM,aAAa;EAClC;CACD,OAAO,EAAE,gBAAuC;EAC9C,eAAe;EACf,YAAY;EACZ,WAAW;EACX,SAAS,WAAW,KAAM;EAC3B;CACF,EAAE"}
1
+ {"version":3,"file":"Switch.js","names":["Text","StyleSheet"],"sources":["../../src/components/Switch.tsx"],"sourcesContent":["import type { SwitchSize, UniversalSwitchProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { AccessibilityProps, StyleProp, View, ViewProps, ViewStyle } from 'react-native';\nimport { AccessibilityInfo, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';\nimport { StyleSheet } from 'react-native-unistyles';\nimport { useAnimatedVariantColor } from 'react-native-unistyles/reanimated';\n\nimport { switchStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\ninterface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<IconSlotType> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Callback when the switch value changes */\n onChange?: (value: boolean) => void;\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Whether the switch is required (shows asterisk with label) */\n required?: boolean;\n /** Accessibility hint describing what happens when activated */\n accessibilityHint?: AccessibilityProps['accessibilityHint'];\n}\n\nconst HANDLE_TRAVEL: Record<SwitchSize, number> = {\n md: 20,\n sm: 12,\n};\n\nconst ANIMATION_DURATION = 120;\n\n/**\n * **Switch component for toggling options**\n *\n * @description\n * A switch (also called a toggle) is a binary on/off input control.\n * It allows users to pick between two clearly opposite choices.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Switch } from '@yahoo/uds-mobile/Switch';\n *\n * <Switch label=\"Notifications\" />\n * <Switch isOn={enabled} onChange={setEnabled} label=\"Dark mode\" />\n * <Switch onIcon=\"Check\" offIcon=\"Cross\" label=\"Sync\" />\n * ```\n *\n * @usage\n * - Settings: For toggling preferences on/off\n * - Feature flags: For enabling/disabling features\n * - Immediate effect toggles (no submit button needed)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"switch\"` automatically\n * - Announces on/off state to screen readers\n * - Respects system reduce motion preference\n * - Supports `reduceMotion` prop to disable animations\n *\n * @see {@link Checkbox} for forms with submit actions\n * @see {@link Radio} for single-select options\n */\nconst Switch = memo(function Switch({\n isOn: isOnProp,\n defaultIsOn = false,\n onChange,\n label,\n labelPosition = 'start',\n size = 'md',\n onIcon,\n offIcon,\n disabled = false,\n required,\n accessibilityHint,\n reduceMotion = false,\n ref,\n ...viewProps\n}: SwitchProps) {\n const isControlled = isOnProp !== undefined;\n const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n const isOn = isControlled ? isOnProp : internalIsOn;\n\n // Check system reduced motion preference\n useEffect(() => {\n const checkReducedMotion = async () => {\n const isReduceMotionEnabled = await AccessibilityInfo.isReduceMotionEnabled();\n setPrefersReducedMotion(isReduceMotionEnabled);\n };\n checkReducedMotion();\n\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setPrefersReducedMotion,\n );\n return () => subscription.remove();\n }, []);\n\n const shouldReduceMotion = reduceMotion || prefersReducedMotion;\n const animationDuration = shouldReduceMotion ? 0 : ANIMATION_DURATION;\n\n const progress = useDerivedValue(\n () => withTiming(isOn ? 1 : 0, { duration: animationDuration }),\n [isOn, animationDuration],\n );\n\n const travelDistance = HANDLE_TRAVEL[size];\n\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newValue = !isOn;\n\n if (!isControlled) {\n setInternalIsOn(newValue);\n }\n\n onChange?.(newValue);\n }, [disabled, isOn, isControlled, onChange]);\n\n switchStyles.useVariants({\n size,\n variant: isOn ? 'on' : 'off',\n });\n\n // Get animated track color from design tokens (changes when variant changes)\n const trackBackgroundColor = useAnimatedVariantColor(switchStyles.switch, 'backgroundColor');\n\n const animatedTrackStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n backgroundColor: withTiming(trackBackgroundColor.value, { duration: animationDuration }),\n };\n });\n\n const animatedHandleStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n transform: [{ translateX: progress.value * travelDistance }],\n };\n });\n\n const rootStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.root, switchStaticStyles.root({ disabled })],\n [switchStyles.root, disabled],\n );\n\n const trackStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.switch, switchStaticStyles.track, animatedTrackStyle],\n [switchStyles.switch, animatedTrackStyle],\n );\n\n const handleStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.handle, switchStaticStyles.handle, animatedHandleStyle],\n [switchStyles.handle, animatedHandleStyle],\n );\n\n const accessibilityLabel = typeof label === 'string' ? label : undefined;\n const resolvedAccessibilityHint = accessibilityHint ?? 'Double tap to toggle';\n\n const resolvedLabel = typeof label === 'function' ? label() : label;\n const labelContent = resolvedLabel && (\n <HStack gap=\"2\" alignItems=\"center\">\n <Text style={switchStyles.text}>{resolvedLabel}</Text>\n {required && <Text color=\"alert\">*</Text>}\n </HStack>\n );\n\n const a11yValue = useMemo(() => ({ text: isOn ? 'On' : 'Off' }), [isOn]);\n\n return (\n <Pressable\n ref={ref}\n onPress={handlePress}\n disabled={disabled}\n accessible\n accessibilityRole=\"switch\"\n accessibilityState={{ checked: isOn, disabled }}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={resolvedAccessibilityHint}\n accessibilityValue={a11yValue}\n {...viewProps}\n style={rootStyle}\n >\n {labelPosition === 'start' && labelContent}\n\n <Animated.View style={trackStyle} importantForAccessibility=\"no-hide-descendants\">\n <Animated.View style={handleStyle}>\n {onIcon && isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={onIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n {offIcon && !isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={offIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n </Animated.View>\n </Animated.View>\n\n {labelPosition === 'end' && labelContent}\n </Pressable>\n );\n});\n\nSwitch.displayName = 'Switch';\n\nconst switchStaticStyles = StyleSheet.create((theme) => ({\n handle: {\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n },\n iconContainer: {\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n },\n track: {\n justifyContent: 'center',\n borderRadius: theme.borderRadius.full,\n },\n root: ({ disabled }: { disabled: boolean }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'flex-start',\n opacity: disabled ? 0.5 : 1,\n }),\n}));\n\nexport { Switch, type SwitchProps };\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,gBAA4C;CAChD,IAAI;CACJ,IAAI;CACL;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmC3B,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,MAAM,UACN,cAAc,OACd,UACA,OACA,gBAAgB,SAChB,OAAO,MACP,QACA,SACA,WAAW,OACX,UACA,mBACA,eAAe,OACf,KACA,GAAG,aACW;CACd,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,CAAC,cAAc,mBAAmB,SAAS,YAAY;CAC7D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,MAAM;CACvE,MAAM,OAAO,eAAe,WAAW;AAGvC,iBAAgB;EACd,MAAM,qBAAqB,YAAY;AAErC,2BAAwB,MADY,kBAAkB,uBAAuB,CAC/B;;AAEhD,sBAAoB;EAEpB,MAAM,eAAe,kBAAkB,iBACrC,uBACA,wBACD;AACD,eAAa,aAAa,QAAQ;IACjC,EAAE,CAAC;CAGN,MAAM,oBADqB,gBAAgB,uBACI,IAAI;CAEnD,MAAM,WAAW,sBACT,WAAW,OAAO,IAAI,GAAG,EAAE,UAAU,mBAAmB,CAAC,EAC/D,CAAC,MAAM,kBAAkB,CAC1B;CAED,MAAM,iBAAiB,cAAc;CAErC,MAAM,cAAc,kBAAkB;AACpC,MAAI,SACF;EAGF,MAAM,WAAW,CAAC;AAElB,MAAI,CAAC,aACH,iBAAgB,SAAS;AAG3B,aAAW,SAAS;IACnB;EAAC;EAAU;EAAM;EAAc;EAAS,CAAC;AAE5C,cAAa,YAAY;EACvB;EACA,SAAS,OAAO,OAAO;EACxB,CAAC;CAGF,MAAM,uBAAuB,wBAAwB,aAAa,QAAQ,kBA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C,SAAS,MAAV;KAAe,OAAO;eAAtB,CACG,UAAU,QACT,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAQ,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC3D,CAAA,EAEjB,WAAW,CAAC,QACX,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAS,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC5D,CAAA,CAEJ;;IACF,CAAA;GAEf,kBAAkB,SAAS;GAClB;;EAEd;AAEF,OAAO,cAAc;AAErB,MAAM,qBAAqBC,aAAW,QAAQ,WAAW;CACvD,QAAQ;EACN,cAAc,MAAM,aAAa;EACjC,YAAY;EACZ,gBAAgB;EACjB;CACD,eAAe;EACb,UAAU;EACV,YAAY;EACZ,gBAAgB;EACjB;CACD,OAAO;EACL,gBAAgB;EAChB,cAAc,MAAM,aAAa;EAClC;CACD,OAAO,EAAE,gBAAuC;EAC9C,eAAe;EACf,YAAY;EACZ,WAAW;EACX,SAAS,WAAW,KAAM;EAC3B;CACF,EAAE"}
@@ -0,0 +1,174 @@
1
+ /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("../../_virtual/_rolldown/runtime.cjs");
4
+ const require_components_IconSlot = require("../IconSlot.cjs");
5
+ const require_components_Pressable = require("../Pressable.cjs");
6
+ const require_components_Tabs_tabsContexts = require("./tabsContexts.cjs");
7
+ const require_components_Tabs_tabTheme = require("./tabTheme.cjs");
8
+ let react = require("react");
9
+ let react_native = require("react-native");
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ let react_native_unistyles = require("react-native-unistyles");
12
+ //#region src/components/Tabs/Tab.tsx
13
+ const PRIMARY_TAB_UNDERLINE_HEIGHT = 2;
14
+ const CLEAR_SELECTION_CHROME = {
15
+ backgroundColor: "transparent",
16
+ borderWidth: 0,
17
+ borderColor: "transparent",
18
+ shadowOpacity: 0,
19
+ elevation: 0,
20
+ boxShadow: []
21
+ };
22
+ function TabLabel({ style, children }) {
23
+ if (typeof children === "string" || typeof children === "number") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
24
+ style,
25
+ children
26
+ });
27
+ return children;
28
+ }
29
+ /**
30
+ * **⚙️ Tab**
31
+ *
32
+ * @description
33
+ * A single selectable tab. Must be used inside {@link TabList} within {@link Tabs}.
34
+ *
35
+ * @category Navigation
36
+ * @platform mobile
37
+ */
38
+ const Tab = (0, react.memo)(function Tab({ value, children, startIcon, endIcon, disabled, style, ...pressableRest }) {
39
+ const generatedId = (0, react.useId)();
40
+ const uid = value ?? `uds-tab-${generatedId}`;
41
+ const { variant: visualVariant, reduceMotion } = require_components_Tabs_tabsContexts.useTabsVisualContext();
42
+ const { selectedId, setSelectedId, registerTab, unregisterTab, setTabLayout } = require_components_Tabs_tabsContexts.useTabSelectionContext();
43
+ const { theme } = (0, react_native_unistyles.useUnistyles)();
44
+ const [pressed, setPressed] = (0, react.useState)(false);
45
+ const selected = !disabled && selectedId === uid;
46
+ const active = selected ? "on" : "off";
47
+ const interaction = pressed ? "pressed" : "rest";
48
+ (0, react.useEffect)(() => {
49
+ registerTab(uid);
50
+ return () => {
51
+ unregisterTab(uid);
52
+ };
53
+ }, [
54
+ uid,
55
+ registerTab,
56
+ unregisterTab
57
+ ]);
58
+ const rootBase = (0, react.useMemo)(() => require_components_Tabs_tabTheme.getMergedTabLayerStyle(theme, visualVariant, active, "root", interaction), [
59
+ theme,
60
+ visualVariant,
61
+ active,
62
+ interaction
63
+ ]);
64
+ const textStyle = (0, react.useMemo)(() => require_components_Tabs_tabTheme.getMergedTabLayerStyle(theme, visualVariant, active, "rootText", interaction), [
65
+ theme,
66
+ visualVariant,
67
+ active,
68
+ interaction
69
+ ]);
70
+ const iconStyle = (0, react.useMemo)(() => require_components_Tabs_tabTheme.getMergedTabLayerStyle(theme, visualVariant, active, "icon", interaction), [
71
+ theme,
72
+ visualVariant,
73
+ active,
74
+ interaction
75
+ ]);
76
+ const iconColor = (() => {
77
+ const c = iconStyle?.color;
78
+ if (c === void 0 || c === null) return;
79
+ return c;
80
+ })();
81
+ /** Inactive primary tabs use transparent underline tokens on web; RN has no CSS vars for that layer. */
82
+ const showPrimaryPerTabUnderline = visualVariant === "primary" && !(selected && !reduceMotion);
83
+ const primaryUnderlineColor = (0, react.useMemo)(() => {
84
+ if (visualVariant !== "primary") return;
85
+ if (selected && reduceMotion) {
86
+ const c = require_components_Tabs_tabTheme.getTabLayerStyle(theme, "primary", "on", "rootText", "rest").color;
87
+ if (typeof c === "string") return c;
88
+ }
89
+ return "transparent";
90
+ }, [
91
+ visualVariant,
92
+ selected,
93
+ reduceMotion,
94
+ theme
95
+ ]);
96
+ const rootStyle = (0, react.useMemo)(() => {
97
+ const base = {
98
+ ...rootBase,
99
+ flexDirection: "row",
100
+ alignItems: "center",
101
+ flexShrink: 0,
102
+ zIndex: 1,
103
+ position: "relative"
104
+ };
105
+ if (selected && !reduceMotion) return {
106
+ ...base,
107
+ ...CLEAR_SELECTION_CHROME
108
+ };
109
+ return base;
110
+ }, [
111
+ rootBase,
112
+ selected,
113
+ reduceMotion
114
+ ]);
115
+ const onLayout = (0, react.useCallback)((e) => {
116
+ setTabLayout(uid, e.nativeEvent.layout);
117
+ }, [uid, setTabLayout]);
118
+ const onPress = (0, react.useCallback)(() => {
119
+ if (disabled) return;
120
+ setSelectedId(uid);
121
+ }, [
122
+ disabled,
123
+ setSelectedId,
124
+ uid
125
+ ]);
126
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Pressable.Pressable, {
127
+ accessibilityRole: "tab",
128
+ accessibilityState: {
129
+ selected,
130
+ disabled: !!disabled
131
+ },
132
+ disabled,
133
+ onPress,
134
+ onPressIn: () => setPressed(true),
135
+ onPressOut: () => setPressed(false),
136
+ onLayout,
137
+ style: [rootStyle, style],
138
+ ...pressableRest,
139
+ children: [
140
+ startIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
141
+ icon: startIcon,
142
+ size: "sm",
143
+ style: iconStyle,
144
+ ...iconColor !== void 0 ? { color: iconColor } : {}
145
+ }) : null,
146
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabLabel, {
147
+ style: textStyle,
148
+ children
149
+ }),
150
+ endIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
151
+ icon: endIcon,
152
+ size: "sm",
153
+ style: iconStyle,
154
+ ...iconColor !== void 0 ? { color: iconColor } : {}
155
+ }) : null,
156
+ showPrimaryPerTabUnderline && primaryUnderlineColor && primaryUnderlineColor !== "transparent" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
157
+ accessibilityElementsHidden: true,
158
+ importantForAccessibility: "no-hide-descendants",
159
+ pointerEvents: "none",
160
+ style: {
161
+ position: "absolute",
162
+ left: 0,
163
+ right: 0,
164
+ bottom: 0,
165
+ height: PRIMARY_TAB_UNDERLINE_HEIGHT,
166
+ backgroundColor: primaryUnderlineColor
167
+ }
168
+ }) : null
169
+ ]
170
+ });
171
+ });
172
+ Tab.displayName = "Tab";
173
+ //#endregion
174
+ exports.Tab = Tab;
@@ -0,0 +1,26 @@
1
+
2
+ import { UniversalTabProps } from "../../types/dist/index.cjs";
3
+ import { IconSlotType } from "../IconSlot.cjs";
4
+ import * as _$react from "react";
5
+ import { PressableProps, ViewStyle } from "react-native";
6
+
7
+ //#region src/components/Tabs/Tab.d.ts
8
+ interface TabProps extends Omit<PressableProps, 'children' | 'style' | 'disabled' | 'onPress'>, Omit<UniversalTabProps, 'asChild' | 'className' | 'startIcon' | 'endIcon'> {
9
+ children: UniversalTabProps['children'];
10
+ startIcon?: IconSlotType;
11
+ endIcon?: IconSlotType;
12
+ style?: ViewStyle;
13
+ }
14
+ /**
15
+ * **⚙️ Tab**
16
+ *
17
+ * @description
18
+ * A single selectable tab. Must be used inside {@link TabList} within {@link Tabs}.
19
+ *
20
+ * @category Navigation
21
+ * @platform mobile
22
+ */
23
+ declare const Tab: _$react.NamedExoticComponent<TabProps>;
24
+ //#endregion
25
+ export { Tab, type TabProps };
26
+ //# sourceMappingURL=Tab.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.d.cts","names":[],"sources":["../../../src/components/Tabs/Tab.tsx"],"mappings":";;;;;;;UAiBU,QAAA,SAEN,IAAA,CAAK,cAAA,kDACL,IAAA,CAAK,iBAAA;EACP,QAAA,EAAU,iBAAA;EACV,SAAA,GAAY,YAAA;EACZ,OAAA,GAAU,YAAA;EACV,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;cA4BJ,GAAA,EAAG,OAAA,CAAA,oBAAA,CAAA,QAAA"}
@@ -0,0 +1,26 @@
1
+
2
+ import { UniversalTabProps } from "../../types/dist/index.js";
3
+ import { IconSlotType } from "../IconSlot.js";
4
+ import * as _$react from "react";
5
+ import { PressableProps, ViewStyle } from "react-native";
6
+
7
+ //#region src/components/Tabs/Tab.d.ts
8
+ interface TabProps extends Omit<PressableProps, 'children' | 'style' | 'disabled' | 'onPress'>, Omit<UniversalTabProps, 'asChild' | 'className' | 'startIcon' | 'endIcon'> {
9
+ children: UniversalTabProps['children'];
10
+ startIcon?: IconSlotType;
11
+ endIcon?: IconSlotType;
12
+ style?: ViewStyle;
13
+ }
14
+ /**
15
+ * **⚙️ Tab**
16
+ *
17
+ * @description
18
+ * A single selectable tab. Must be used inside {@link TabList} within {@link Tabs}.
19
+ *
20
+ * @category Navigation
21
+ * @platform mobile
22
+ */
23
+ declare const Tab: _$react.NamedExoticComponent<TabProps>;
24
+ //#endregion
25
+ export { Tab, type TabProps };
26
+ //# sourceMappingURL=Tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.d.ts","names":[],"sources":["../../../src/components/Tabs/Tab.tsx"],"mappings":";;;;;;;UAiBU,QAAA,SAEN,IAAA,CAAK,cAAA,kDACL,IAAA,CAAK,iBAAA;EACP,QAAA,EAAU,iBAAA;EACV,SAAA,GAAY,YAAA;EACZ,OAAA,GAAU,YAAA;EACV,KAAA,GAAQ,SAAA;AAAA;;;;;;;;;;cA4BJ,GAAA,EAAG,OAAA,CAAA,oBAAA,CAAA,QAAA"}