@yahoo/uds-mobile 2.10.0 → 2.12.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 (197) hide show
  1. package/README.md +22 -24
  2. package/dist/bin/fixtures/dist/index.mjs +0 -10
  3. package/dist/bin/modes/dist/index.mjs +1 -0
  4. package/dist/bin/palette/dist/index.mjs +1 -0
  5. package/dist/components/AndroidBackHandler.js.map +1 -1
  6. package/dist/components/Avatar.cjs +1 -1
  7. package/dist/components/Avatar.d.cts +1 -1
  8. package/dist/components/Avatar.d.ts +1 -1
  9. package/dist/components/Avatar.js +1 -1
  10. package/dist/components/Avatar.js.map +1 -1
  11. package/dist/components/Badge.cjs +1 -1
  12. package/dist/components/Badge.d.cts +1 -1
  13. package/dist/components/Badge.d.ts +1 -1
  14. package/dist/components/Badge.js +1 -1
  15. package/dist/components/Badge.js.map +1 -1
  16. package/dist/components/Banner/Banner.js.map +1 -1
  17. package/dist/components/Banner/BannerContent.js.map +1 -1
  18. package/dist/components/Banner/BannerDescription.js.map +1 -1
  19. package/dist/components/Banner/BannerTitle.js.map +1 -1
  20. package/dist/components/Banner/utils.js.map +1 -1
  21. package/dist/components/BlurTarget.cjs +2 -1
  22. package/dist/components/BlurTarget.d.cts +2 -1
  23. package/dist/components/BlurTarget.d.cts.map +1 -1
  24. package/dist/components/BlurTarget.d.ts +2 -1
  25. package/dist/components/BlurTarget.d.ts.map +1 -1
  26. package/dist/components/BlurTarget.js +2 -1
  27. package/dist/components/BlurTarget.js.map +1 -1
  28. package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
  29. package/dist/components/BottomSheet/BottomSheetContent.js.map +1 -1
  30. package/dist/components/BottomSheet/BottomSheetDismiss.js.map +1 -1
  31. package/dist/components/BottomSheet/BottomSheetHandle.js.map +1 -1
  32. package/dist/components/BottomSheet/BottomSheetHeader.js.map +1 -1
  33. package/dist/components/BottomSheet/BottomSheetInternalProvider.js.map +1 -1
  34. package/dist/components/BottomSheet/BottomSheetProvider.js.map +1 -1
  35. package/dist/components/BottomSheet/BottomSheetTrigger.js.map +1 -1
  36. package/dist/components/BottomSheet/useBottomSheetDrag.js.map +1 -1
  37. package/dist/components/BottomSheet/useBottomSheetScroll.js.map +1 -1
  38. package/dist/components/BottomSheet/useBottomSheetSnapModel.js.map +1 -1
  39. package/dist/components/BottomSheet/useBottomSheetStore.js.map +1 -1
  40. package/dist/components/BottomSheet/useExpansionMargins.js.map +1 -1
  41. package/dist/components/BottomSheet/useKeyboardAvoidance.js.map +1 -1
  42. package/dist/components/BottomSheet/utils.js.map +1 -1
  43. package/dist/components/Box.cjs +1 -1
  44. package/dist/components/Box.d.cts +1 -1
  45. package/dist/components/Box.d.ts +1 -1
  46. package/dist/components/Box.js +1 -1
  47. package/dist/components/Box.js.map +1 -1
  48. package/dist/components/Button.cjs +1 -1
  49. package/dist/components/Button.d.cts +1 -1
  50. package/dist/components/Button.d.ts +1 -1
  51. package/dist/components/Button.js +1 -1
  52. package/dist/components/Button.js.map +1 -1
  53. package/dist/components/Checkbox.cjs +1 -1
  54. package/dist/components/Checkbox.d.cts +1 -1
  55. package/dist/components/Checkbox.d.ts +1 -1
  56. package/dist/components/Checkbox.js +1 -1
  57. package/dist/components/Checkbox.js.map +1 -1
  58. package/dist/components/Chip.cjs +1 -1
  59. package/dist/components/Chip.d.cts +1 -1
  60. package/dist/components/Chip.d.ts +1 -1
  61. package/dist/components/Chip.js +1 -1
  62. package/dist/components/Chip.js.map +1 -1
  63. package/dist/components/Divider/Divider.cjs +103 -0
  64. package/dist/components/Divider/Divider.d.cts +50 -0
  65. package/dist/components/Divider/Divider.d.cts.map +1 -0
  66. package/dist/components/Divider/Divider.d.ts +50 -0
  67. package/dist/components/Divider/Divider.d.ts.map +1 -0
  68. package/dist/components/Divider/Divider.js +103 -0
  69. package/dist/components/Divider/Divider.js.map +1 -0
  70. package/dist/components/Divider/DividerLabel.cjs +37 -0
  71. package/dist/components/Divider/DividerLabel.d.cts +18 -0
  72. package/dist/components/Divider/DividerLabel.d.cts.map +1 -0
  73. package/dist/components/Divider/DividerLabel.d.ts +18 -0
  74. package/dist/components/Divider/DividerLabel.d.ts.map +1 -0
  75. package/dist/components/Divider/DividerLabel.js +37 -0
  76. package/dist/components/Divider/DividerLabel.js.map +1 -0
  77. package/dist/components/Divider/DividerLine.cjs +62 -0
  78. package/dist/components/Divider/DividerLine.d.cts +19 -0
  79. package/dist/components/Divider/DividerLine.d.cts.map +1 -0
  80. package/dist/components/Divider/DividerLine.d.ts +19 -0
  81. package/dist/components/Divider/DividerLine.d.ts.map +1 -0
  82. package/dist/components/Divider/DividerLine.js +62 -0
  83. package/dist/components/Divider/DividerLine.js.map +1 -0
  84. package/dist/components/Divider/index.cjs +8 -0
  85. package/dist/components/Divider/index.d.cts +6 -0
  86. package/dist/components/Divider/index.d.ts +6 -0
  87. package/dist/components/Divider/index.js +5 -0
  88. package/dist/components/Divider/types.cjs +1 -0
  89. package/dist/components/Divider/types.d.cts +35 -0
  90. package/dist/components/Divider/types.d.cts.map +1 -0
  91. package/dist/components/Divider/types.d.ts +35 -0
  92. package/dist/components/Divider/types.d.ts.map +1 -0
  93. package/dist/components/Divider/types.js +1 -0
  94. package/dist/components/Divider/utils.cjs +33 -0
  95. package/dist/components/Divider/utils.d.cts +12 -0
  96. package/dist/components/Divider/utils.d.cts.map +1 -0
  97. package/dist/components/Divider/utils.d.ts +12 -0
  98. package/dist/components/Divider/utils.d.ts.map +1 -0
  99. package/dist/components/Divider/utils.js +31 -0
  100. package/dist/components/Divider/utils.js.map +1 -0
  101. package/dist/components/HStack.cjs +1 -1
  102. package/dist/components/HStack.d.cts +1 -1
  103. package/dist/components/HStack.d.ts +1 -1
  104. package/dist/components/HStack.js +1 -1
  105. package/dist/components/HStack.js.map +1 -1
  106. package/dist/components/Icon.cjs +1 -1
  107. package/dist/components/Icon.d.cts +2 -2
  108. package/dist/components/Icon.d.ts +2 -2
  109. package/dist/components/Icon.js +1 -1
  110. package/dist/components/Icon.js.map +1 -1
  111. package/dist/components/IconButton.cjs +1 -1
  112. package/dist/components/IconButton.d.cts +1 -1
  113. package/dist/components/IconButton.d.ts +1 -1
  114. package/dist/components/IconButton.js +1 -1
  115. package/dist/components/IconButton.js.map +1 -1
  116. package/dist/components/IconSlot.cjs +1 -1
  117. package/dist/components/IconSlot.d.cts +1 -1
  118. package/dist/components/IconSlot.d.ts +1 -1
  119. package/dist/components/IconSlot.js +1 -1
  120. package/dist/components/IconSlot.js.map +1 -1
  121. package/dist/components/Image.cjs +1 -1
  122. package/dist/components/Image.d.cts +1 -1
  123. package/dist/components/Image.d.ts +1 -1
  124. package/dist/components/Image.js +1 -1
  125. package/dist/components/Image.js.map +1 -1
  126. package/dist/components/Input.cjs +1 -1
  127. package/dist/components/Input.d.cts +1 -1
  128. package/dist/components/Input.d.ts +1 -1
  129. package/dist/components/Input.js +1 -1
  130. package/dist/components/Input.js.map +1 -1
  131. package/dist/components/Link.cjs +1 -1
  132. package/dist/components/Link.d.cts +1 -1
  133. package/dist/components/Link.d.ts +1 -1
  134. package/dist/components/Link.js +1 -1
  135. package/dist/components/Link.js.map +1 -1
  136. package/dist/components/Pressable.cjs +1 -1
  137. package/dist/components/Pressable.d.cts +1 -1
  138. package/dist/components/Pressable.d.ts +1 -1
  139. package/dist/components/Pressable.js +1 -1
  140. package/dist/components/Pressable.js.map +1 -1
  141. package/dist/components/Radio.cjs +1 -1
  142. package/dist/components/Radio.d.cts +1 -1
  143. package/dist/components/Radio.d.ts +1 -1
  144. package/dist/components/Radio.js +1 -1
  145. package/dist/components/Radio.js.map +1 -1
  146. package/dist/components/Screen.cjs +1 -1
  147. package/dist/components/Screen.d.cts +1 -1
  148. package/dist/components/Screen.d.ts +1 -1
  149. package/dist/components/Screen.js +1 -1
  150. package/dist/components/Screen.js.map +1 -1
  151. package/dist/components/Scrim.js.map +1 -1
  152. package/dist/components/Switch.cjs +1 -1
  153. package/dist/components/Switch.d.cts +1 -1
  154. package/dist/components/Switch.d.ts +1 -1
  155. package/dist/components/Switch.js +1 -1
  156. package/dist/components/Switch.js.map +1 -1
  157. package/dist/components/Tabs/Tab.js.map +1 -1
  158. package/dist/components/Tabs/TabList.js.map +1 -1
  159. package/dist/components/Tabs/TabPanel.js.map +1 -1
  160. package/dist/components/Tabs/Tabs.js.map +1 -1
  161. package/dist/components/Tabs/tabTheme.js.map +1 -1
  162. package/dist/components/Tabs/tabsContexts.js.map +1 -1
  163. package/dist/components/Text.cjs +1 -1
  164. package/dist/components/Text.d.cts +1 -1
  165. package/dist/components/Text.d.ts +1 -1
  166. package/dist/components/Text.js +1 -1
  167. package/dist/components/Text.js.map +1 -1
  168. package/dist/components/UDSProvider.js.map +1 -1
  169. package/dist/components/VStack.cjs +1 -1
  170. package/dist/components/VStack.d.cts +1 -1
  171. package/dist/components/VStack.d.ts +1 -1
  172. package/dist/components/VStack.js +1 -1
  173. package/dist/components/VStack.js.map +1 -1
  174. package/dist/jest/mocks/icons.js.map +1 -1
  175. package/dist/jest/mocks/react-native.js.map +1 -1
  176. package/dist/jest/mocks/reanimated.js.map +1 -1
  177. package/dist/jest/mocks/styles.cjs +15 -0
  178. package/dist/jest/mocks/styles.d.cts +3 -2
  179. package/dist/jest/mocks/styles.d.cts.map +1 -1
  180. package/dist/jest/mocks/styles.d.ts +3 -2
  181. package/dist/jest/mocks/styles.d.ts.map +1 -1
  182. package/dist/jest/mocks/styles.js +15 -1
  183. package/dist/jest/mocks/styles.js.map +1 -1
  184. package/dist/jest/mocks/svg.js.map +1 -1
  185. package/dist/jest/mocks/unistyles.js.map +1 -1
  186. package/dist/jest/setup.js.map +1 -1
  187. package/dist/portal.js.map +1 -1
  188. package/dist/types/dist/index.d.cts +12 -2
  189. package/dist/types/dist/index.d.cts.map +1 -1
  190. package/dist/types/dist/index.d.ts +12 -2
  191. package/dist/types/dist/index.d.ts.map +1 -1
  192. package/fonts/uds-icons.ttf +0 -0
  193. package/generated/styles.cjs +19 -13
  194. package/generated/styles.d.ts +12 -0
  195. package/generated/styles.mjs +19 -13
  196. package/generated/unistyles.d.ts +9 -9
  197. package/package.json +11 -1
@@ -30,7 +30,7 @@ const VARIANT_ERROR_MAP = {
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Checkbox } from '@yahoo/uds-mobile';
33
+ * import { Checkbox } from '@yahoo/uds-mobile/Checkbox';
34
34
  *
35
35
  * <Checkbox label="Agree to terms" />
36
36
  * <Checkbox label="Subscribe" checked={true} onChange={setChecked} />
@@ -30,7 +30,7 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Checkbox } from '@yahoo/uds-mobile';
33
+ * import { Checkbox } from '@yahoo/uds-mobile/Checkbox';
34
34
  *
35
35
  * <Checkbox label="Agree to terms" />
36
36
  * <Checkbox label="Subscribe" checked={true} onChange={setChecked} />
@@ -30,7 +30,7 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
30
30
  *
31
31
  * @example
32
32
  * ```tsx
33
- * import { Checkbox } from '@yahoo/uds-mobile';
33
+ * import { Checkbox } from '@yahoo/uds-mobile/Checkbox';
34
34
  *
35
35
  * <Checkbox label="Agree to terms" />
36
36
  * <Checkbox label="Subscribe" checked={true} onChange={setChecked} />
@@ -27,7 +27,7 @@ const VARIANT_ERROR_MAP = {
27
27
  *
28
28
  * @example
29
29
  * ```tsx
30
- * import { Checkbox } from '@yahoo/uds-mobile';
30
+ * import { Checkbox } from '@yahoo/uds-mobile/Checkbox';
31
31
  *
32
32
  * <Checkbox label="Agree to terms" />
33
33
  * <Checkbox label="Subscribe" checked={true} onChange={setChecked} />
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":["import type { CheckboxValue, CheckboxVariant, UniversalCheckboxProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated';\n\nimport { checkboxStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Icon } from './Icon';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from CheckboxValue - maps boolean to 'checked'/'unchecked' string literals */\ntype CheckboxValueState = Exclude<CheckboxValue, boolean> | 'checked' | 'unchecked';\n\ninterface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the checkbox is disabled */\n disabled?: boolean;\n /** Whether the checkbox 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 CheckboxStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<CheckboxVariant, CheckboxStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Checkbox Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A checkbox component**\n *\n * @description\n * A checkbox component allows users to select one or multiple options from a set.\n * It represents a binary state, typically as checked or unchecked, and optionally\n * includes a third \"indeterminate\" state to indicate partial selection.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Checkbox } from '@yahoo/uds-mobile';\n *\n * <Checkbox label=\"Agree to terms\" />\n * <Checkbox label=\"Subscribe\" checked={true} onChange={setChecked} />\n * <Checkbox label=\"Partial\" checked=\"indeterminate\" />\n * ```\n *\n * @usage\n * - Forms: For selecting options\n * - Settings: For toggling preferences\n * - Filters: For multi-select filtering\n *\n * @accessibility\n * - Sets `accessibilityRole=\"checkbox\"` automatically\n * - Announces checked/unchecked/mixed state\n * - Label is used as accessibility label\n * - Supports `reduceMotion` for users who prefer reduced motion\n *\n * @see {@link Radio} for single-select options\n * @see {@link Switch} for binary toggles\n */\nconst Checkbox = memo(function Checkbox({\n // Checkbox 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}: CheckboxProps) {\n const generatedId = useId();\n const uid = `uds-checkbox-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<CheckboxValue>(\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: CheckboxValueState = useMemo(() => {\n if (checked === 'indeterminate') {\n return 'indeterminate';\n }\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n const iconName = valueState === 'indeterminate' ? 'Minus' : 'Check';\n const showIcon = valueState !== 'unchecked';\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 checkboxAnimatedStyle = 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 === 'indeterminate' ? true : !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: CheckboxStyleVariant = hasError\n ? VARIANT_ERROR_MAP[variantProp]\n : variantProp;\n\n checkboxStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked, indeterminate\n disabled,\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [checkboxStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [checkboxStyles.root, disabled],\n );\n\n const checkboxBoxStyle = useMemo(\n () => [\n checkboxStyles.checkbox,\n { alignItems: 'center' as const, justifyContent: 'center' as const, borderRadius: 4 },\n checkboxAnimatedStyle,\n ],\n [checkboxStyles.checkbox, checkboxAnimatedStyle],\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={checkboxStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={checkboxStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, checkboxStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked:\n valueState === 'checked'\n ? true\n : valueState === 'indeterminate'\n ? ('mixed' as const)\n : false,\n }),\n [disabled, valueState],\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=\"checkbox\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={checkboxBoxStyle}>\n {showIcon && <Icon name={iconName} size=\"sm\" style={checkboxStyles.checkboxIcon} />}\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox, type CheckboxProps };\n"],"mappings":";;;;;;;;;;;;AAwCA,MAAM,oBAAmE;CACvE,SAAS;CACT,WAAW;CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAM,WAAW,KAAK,SAAS,SAAS,EAEtC,OACA,gBAAgB,SAChB,SAAS,cAAc,WACvB,OAAO,MACP,SAAS,aACT,UACA,cAEA,gBACA,UACA,UACA,UACA,KACA,GAAG,aACa;CAEhB,MAAM,MAAM,gBADQ,OACmB;CAGvC,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,aAAiC,cAAc;AACnD,MAAI,YAAY,gBACd,QAAO;AAET,SAAO,UAAU,YAAY;IAC5B,CAAC,QAAQ,CAAC;CAEb,MAAM,WAAW,eAAe,kBAAkB,UAAU;CAC5D,MAAM,WAAW,eAAe;CAGhC,MAAM,gBAAgB,CAAC;CAGvB,MAAM,gBAAgB,sBAElB,gBACI,WAAW,UAAU,cAAc,OAAO,cAAc,MAAM,qBAAqB,GACnF,cAAc,MACpB,CAAC,SAAS,cAAc,CACzB;CAED,MAAM,wBAAwB,wBAAwB,EACpD,WAAW,CAAC,EAAE,OA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ACvB;AAGD,QACE,qBAAC,WAAD;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;aACnB,YAAY,oBAAC,MAAD;IAAM,MAAM;IAAU,MAAK;IAAK,OAAO,eAAe;IAAgB,CAAA;GACrE,CAAA,EAEf,aACS;;EAEd;AAEF,SAAS,cAAc"}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":["import type { CheckboxValue, CheckboxVariant, UniversalCheckboxProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated';\n\nimport { checkboxStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Icon } from './Icon';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from CheckboxValue - maps boolean to 'checked'/'unchecked' string literals */\ntype CheckboxValueState = Exclude<CheckboxValue, boolean> | 'checked' | 'unchecked';\n\ninterface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the checkbox is disabled */\n disabled?: boolean;\n /** Whether the checkbox 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 CheckboxStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<CheckboxVariant, CheckboxStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Checkbox Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A checkbox component**\n *\n * @description\n * A checkbox component allows users to select one or multiple options from a set.\n * It represents a binary state, typically as checked or unchecked, and optionally\n * includes a third \"indeterminate\" state to indicate partial selection.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Checkbox } from '@yahoo/uds-mobile/Checkbox';\n *\n * <Checkbox label=\"Agree to terms\" />\n * <Checkbox label=\"Subscribe\" checked={true} onChange={setChecked} />\n * <Checkbox label=\"Partial\" checked=\"indeterminate\" />\n * ```\n *\n * @usage\n * - Forms: For selecting options\n * - Settings: For toggling preferences\n * - Filters: For multi-select filtering\n *\n * @accessibility\n * - Sets `accessibilityRole=\"checkbox\"` automatically\n * - Announces checked/unchecked/mixed state\n * - Label is used as accessibility label\n * - Supports `reduceMotion` for users who prefer reduced motion\n *\n * @see {@link Radio} for single-select options\n * @see {@link Switch} for binary toggles\n */\nconst Checkbox = memo(function Checkbox({\n // Checkbox 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}: CheckboxProps) {\n const generatedId = useId();\n const uid = `uds-checkbox-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<CheckboxValue>(\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: CheckboxValueState = useMemo(() => {\n if (checked === 'indeterminate') {\n return 'indeterminate';\n }\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n const iconName = valueState === 'indeterminate' ? 'Minus' : 'Check';\n const showIcon = valueState !== 'unchecked';\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 checkboxAnimatedStyle = 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 === 'indeterminate' ? true : !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: CheckboxStyleVariant = hasError\n ? VARIANT_ERROR_MAP[variantProp]\n : variantProp;\n\n checkboxStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked, indeterminate\n disabled,\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [checkboxStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [checkboxStyles.root, disabled],\n );\n\n const checkboxBoxStyle = useMemo(\n () => [\n checkboxStyles.checkbox,\n { alignItems: 'center' as const, justifyContent: 'center' as const, borderRadius: 4 },\n checkboxAnimatedStyle,\n ],\n [checkboxStyles.checkbox, checkboxAnimatedStyle],\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={checkboxStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={checkboxStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, checkboxStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked:\n valueState === 'checked'\n ? true\n : valueState === 'indeterminate'\n ? ('mixed' as const)\n : false,\n }),\n [disabled, valueState],\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=\"checkbox\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={checkboxBoxStyle}>\n {showIcon && <Icon name={iconName} size=\"sm\" style={checkboxStyles.checkboxIcon} />}\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox, type CheckboxProps };\n"],"mappings":";;;;;;;;;;;;AAwCA,MAAM,oBAAmE;CACvE,SAAS;CACT,WAAW;CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAM,WAAW,KAAK,SAAS,SAAS,EAEtC,OACA,gBAAgB,SAChB,SAAS,cAAc,WACvB,OAAO,MACP,SAAS,aACT,UACA,cAEA,gBACA,UACA,UACA,UACA,KACA,GAAG,aAC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,cAAc;GAAG;EACrF;EACD,EACD,CAAC,eAAe,UAAU,sBAAsB,CACjD;CAGD,MAAM,eAAe,cAAc;EACjC,IAAI,CAAC,OACH,OAAO;EAGT,MAAM,UACJ,OAAO,UAAU,aAAa,OAAO,GAAG,eAAe,MAAM,GAAG,QAAQ,OAAO,MAAM;EAEvF,MAAM,cACJ,OAAO,YAAY,WAAW,oBAAC,MAAD;GAAM,OAAO,eAAe;aAAO;GAAe,CAAA,GAAG;EAErF,IAAI,UACF,OACE,qBAAC,QAAD;GAAQ,WAAU;GAAI,YAAW;aAAjC,CACG,aACD,oBAAC,MAAD;IAAM,OAAO,eAAe;cAAM;IAAQ,CAAA,CACnC;;EAIb,OAAO;IACN;EAAC;EAAO;EAAU,eAAe;EAAK,CAAC;CAE1C,MAAM,YAAY,eACT;EACL;EACA,SACE,eAAe,YACX,OACA,eAAe,kBACZ,UACD;EACT,GACD,CAAC,UAAU,WAAW,CACvB;CAGD,OACE,qBAAC,WAAD;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;aACnB,YAAY,oBAAC,MAAD;IAAM,MAAM;IAAU,MAAK;IAAK,OAAO,eAAe;IAAgB,CAAA;GACrE,CAAA,EAEf,aACS;;EAEd;AAEF,SAAS,cAAc"}
@@ -21,7 +21,7 @@ let generated_styles = require("../../generated/styles");
21
21
  *
22
22
  * @example
23
23
  * ```tsx
24
- * import { Chip } from '@yahoo/uds-mobile';
24
+ * import { Chip } from '@yahoo/uds-mobile/Chip';
25
25
  *
26
26
  * // Basic chip
27
27
  * <Chip>Label</Chip>
@@ -48,7 +48,7 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
48
48
  *
49
49
  * @example
50
50
  * ```tsx
51
- * import { Chip } from '@yahoo/uds-mobile';
51
+ * import { Chip } from '@yahoo/uds-mobile/Chip';
52
52
  *
53
53
  * // Basic chip
54
54
  * <Chip>Label</Chip>
@@ -48,7 +48,7 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
48
48
  *
49
49
  * @example
50
50
  * ```tsx
51
- * import { Chip } from '@yahoo/uds-mobile';
51
+ * import { Chip } from '@yahoo/uds-mobile/Chip';
52
52
  *
53
53
  * // Basic chip
54
54
  * <Chip>Label</Chip>
@@ -19,7 +19,7 @@ import { chipStyles } from "../../generated/styles";
19
19
  *
20
20
  * @example
21
21
  * ```tsx
22
- * import { Chip } from '@yahoo/uds-mobile';
22
+ * import { Chip } from '@yahoo/uds-mobile/Chip';
23
23
  *
24
24
  * // Basic chip
25
25
  * <Chip>Label</Chip>
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","names":[],"sources":["../../src/components/Chip.tsx"],"sourcesContent":["import type { ChipSize, ChipVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useMemo } from 'react';\nimport type { View, ViewProps } from 'react-native';\n\nimport { chipStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\ninterface ChipProps extends Omit<ViewProps, 'children'> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** The visual style variant @default 'primary' */\n variant?: ChipVariant;\n /** The size of the chip @default 'md' */\n size?: ChipSize;\n /** Minimum width of the chip in pixels */\n minWidth?: number;\n /** Maximum width of the chip in pixels @default 200 */\n maxWidth?: number;\n /** Icon displayed at the start of the chip */\n startIcon?: IconSlotType;\n /** Icon displayed at the end of the chip */\n endIcon?: IconSlotType;\n /** Whether the chip is disabled */\n disabled?: boolean;\n /** Called when the chip is pressed. Makes the chip interactive. */\n onPress?: () => void;\n /** Whether the chip is toggled/selected. */\n isToggled?: boolean;\n /** Called when the chip toggle state changes. */\n onToggle?: (toggled: boolean) => void;\n /** Called when the dismiss button is pressed. Shows a dismiss icon. */\n onDismiss?: () => void;\n /** Accessibility label for the dismiss button. */\n dismissButtonAriaLabel?: string;\n /** Chip label content */\n children?: React.ReactNode;\n}\n\n/**\n * **A chip component for selections, filters, or actions**\n *\n * @description\n * Chips help people make selections, filter content, or trigger actions.\n * They can be toggleable, dismissible, or simple pressable elements.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Chip } from '@yahoo/uds-mobile';\n *\n * // Basic chip\n * <Chip>Label</Chip>\n *\n * // Toggle chip\n * <Chip isToggled={selected} onToggle={setSelected}>Filter</Chip>\n *\n * // Dismissible chip\n * <Chip onDismiss={() => removeChip()}>Tag</Chip>\n *\n * // With icons\n * <Chip startIcon=\"Star\" variant=\"brand\">Favorite</Chip>\n * ```\n *\n * @usage\n * - Filters: For multi-select filtering options\n * - Tags: For displaying and removing tags\n * - Actions: For quick contextual actions\n *\n * @accessibility\n * - Toggle chips use `accessibilityRole=\"checkbox\"` with checked state\n * - Action chips use `accessibilityRole=\"button\"`\n * - Dismiss button has customizable `dismissButtonAriaLabel`\n *\n * @see {@link Badge} for non-interactive status indicators\n * @see {@link Button} for primary actions\n */\nconst Chip = memo(function Chip({\n variant = 'primary',\n size = 'md',\n minWidth,\n maxWidth = 200,\n startIcon,\n endIcon,\n disabled = false,\n isToggled = false,\n onPress,\n onToggle,\n onDismiss,\n dismissButtonAriaLabel = 'Dismiss',\n children,\n style,\n ref,\n ...rest\n}: ChipProps) {\n const isInteractive = Boolean(onPress || onToggle);\n const isDismissible = Boolean(onDismiss);\n const isDisabled = disabled;\n // Determine which variant type to use for styling\n const toggleState = isToggled ? 'on' : 'off';\n\n // Apply layer-based styles\n // Note: Chip doesn't have disabled variants in theme - handled via opacity\n // Note: pressed state is applied dynamically via Pressable's style callback\n chipStyles.useVariants({\n size,\n link: variant,\n dismissible: variant,\n toggle: toggleState,\n });\n\n const handlePress = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (onToggle) {\n onToggle(!isToggled);\n } else if (onPress) {\n onPress();\n }\n }, [isDisabled, onToggle, isToggled, onPress]);\n\n const handleDismiss = useCallback(() => {\n if (isDisabled) {\n return;\n }\n onDismiss?.();\n }, [isDisabled, onDismiss]);\n\n const content = (\n <>\n {startIcon && <IconSlot icon={startIcon} variant=\"fill\" style={chipStyles.icon} />}\n <Text numberOfLines={1} textAlign=\"center\" flexShrink=\"1\" style={chipStyles.text}>\n {children}\n </Text>\n {isDismissible ? (\n <Pressable\n onPress={isDisabled ? undefined : handleDismiss}\n disabled={isDisabled}\n accessibilityLabel={dismissButtonAriaLabel}\n accessibilityRole=\"button\"\n >\n <IconSlot icon={endIcon ?? 'Cross'} variant=\"fill\" style={chipStyles.icon} />\n </Pressable>\n ) : (\n endIcon && <IconSlot icon={endIcon} variant=\"fill\" style={chipStyles.icon} />\n )}\n </>\n );\n\n const a11yState = {\n disabled: isDisabled,\n checked: onToggle ? isToggled : undefined,\n };\n\n const rootStyles = useMemo(() => [chipStyles.root, style], [chipStyles.root, style]);\n const sharedProps = {\n ref,\n style: rootStyles,\n flexDirection: 'row',\n alignItems: 'center',\n overflow: 'hidden',\n alignSelf: 'flex-start',\n maxWidth,\n minWidth,\n disabled: isDisabled,\n opacity: isDisabled ? 0.5 : undefined,\n accessibilityState: a11yState,\n ...rest,\n } as const;\n\n // Interactive chip (toggle or button)\n if (isInteractive) {\n return (\n <Pressable\n onPress={handlePress}\n accessibilityRole={onToggle ? 'checkbox' : 'button'}\n {...sharedProps}\n >\n {content}\n </Pressable>\n );\n }\n\n // Non-interactive chip (display only or dismissible)\n return (\n <HStack accessibilityRole={isDismissible ? 'button' : undefined} {...sharedProps} {...rest}>\n {content}\n </HStack>\n );\n});\n\nChip.displayName = 'Chip';\n\nexport { Chip, type ChipProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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,WAAW,MAAM,MAAM,EAAE,CAAC,WAAW,MAAM,MAAM,CAGhE;EACjB,eAAe;EACf,YAAY;EACZ,UAAU;EACV,WAAW;EACX;EACA;EACA,UAAU;EACV,SAAS,aAAa,KAAM,KAAA;EAC5B,oBAAoB;EACpB,GAAG;EACJ;AAGD,KAAI,cACF,QACE,oBAAC,WAAD;EACE,SAAS;EACT,mBAAmB,WAAW,aAAa;EAC3C,GAAI;YAEH;EACS,CAAA;AAKhB,QACE,oBAAC,QAAD;EAAQ,mBAAmB,gBAAgB,WAAW,KAAA;EAAW,GAAI;EAAa,GAAI;YACnF;EACM,CAAA;EAEX;AAEF,KAAK,cAAc"}
1
+ {"version":3,"file":"Chip.js","names":[],"sources":["../../src/components/Chip.tsx"],"sourcesContent":["import type { ChipSize, ChipVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useMemo } from 'react';\nimport type { View, ViewProps } from 'react-native';\n\nimport { chipStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\ninterface ChipProps extends Omit<ViewProps, 'children'> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** The visual style variant @default 'primary' */\n variant?: ChipVariant;\n /** The size of the chip @default 'md' */\n size?: ChipSize;\n /** Minimum width of the chip in pixels */\n minWidth?: number;\n /** Maximum width of the chip in pixels @default 200 */\n maxWidth?: number;\n /** Icon displayed at the start of the chip */\n startIcon?: IconSlotType;\n /** Icon displayed at the end of the chip */\n endIcon?: IconSlotType;\n /** Whether the chip is disabled */\n disabled?: boolean;\n /** Called when the chip is pressed. Makes the chip interactive. */\n onPress?: () => void;\n /** Whether the chip is toggled/selected. */\n isToggled?: boolean;\n /** Called when the chip toggle state changes. */\n onToggle?: (toggled: boolean) => void;\n /** Called when the dismiss button is pressed. Shows a dismiss icon. */\n onDismiss?: () => void;\n /** Accessibility label for the dismiss button. */\n dismissButtonAriaLabel?: string;\n /** Chip label content */\n children?: React.ReactNode;\n}\n\n/**\n * **A chip component for selections, filters, or actions**\n *\n * @description\n * Chips help people make selections, filter content, or trigger actions.\n * They can be toggleable, dismissible, or simple pressable elements.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Chip } from '@yahoo/uds-mobile/Chip';\n *\n * // Basic chip\n * <Chip>Label</Chip>\n *\n * // Toggle chip\n * <Chip isToggled={selected} onToggle={setSelected}>Filter</Chip>\n *\n * // Dismissible chip\n * <Chip onDismiss={() => removeChip()}>Tag</Chip>\n *\n * // With icons\n * <Chip startIcon=\"Star\" variant=\"brand\">Favorite</Chip>\n * ```\n *\n * @usage\n * - Filters: For multi-select filtering options\n * - Tags: For displaying and removing tags\n * - Actions: For quick contextual actions\n *\n * @accessibility\n * - Toggle chips use `accessibilityRole=\"checkbox\"` with checked state\n * - Action chips use `accessibilityRole=\"button\"`\n * - Dismiss button has customizable `dismissButtonAriaLabel`\n *\n * @see {@link Badge} for non-interactive status indicators\n * @see {@link Button} for primary actions\n */\nconst Chip = memo(function Chip({\n variant = 'primary',\n size = 'md',\n minWidth,\n maxWidth = 200,\n startIcon,\n endIcon,\n disabled = false,\n isToggled = false,\n onPress,\n onToggle,\n onDismiss,\n dismissButtonAriaLabel = 'Dismiss',\n children,\n style,\n ref,\n ...rest\n}: ChipProps) {\n const isInteractive = Boolean(onPress || onToggle);\n const isDismissible = Boolean(onDismiss);\n const isDisabled = disabled;\n // Determine which variant type to use for styling\n const toggleState = isToggled ? 'on' : 'off';\n\n // Apply layer-based styles\n // Note: Chip doesn't have disabled variants in theme - handled via opacity\n // Note: pressed state is applied dynamically via Pressable's style callback\n chipStyles.useVariants({\n size,\n link: variant,\n dismissible: variant,\n toggle: toggleState,\n });\n\n const handlePress = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (onToggle) {\n onToggle(!isToggled);\n } else if (onPress) {\n onPress();\n }\n }, [isDisabled, onToggle, isToggled, onPress]);\n\n const handleDismiss = useCallback(() => {\n if (isDisabled) {\n return;\n }\n onDismiss?.();\n }, [isDisabled, onDismiss]);\n\n const content = (\n <>\n {startIcon && <IconSlot icon={startIcon} variant=\"fill\" style={chipStyles.icon} />}\n <Text numberOfLines={1} textAlign=\"center\" flexShrink=\"1\" style={chipStyles.text}>\n {children}\n </Text>\n {isDismissible ? (\n <Pressable\n onPress={isDisabled ? undefined : handleDismiss}\n disabled={isDisabled}\n accessibilityLabel={dismissButtonAriaLabel}\n accessibilityRole=\"button\"\n >\n <IconSlot icon={endIcon ?? 'Cross'} variant=\"fill\" style={chipStyles.icon} />\n </Pressable>\n ) : (\n endIcon && <IconSlot icon={endIcon} variant=\"fill\" style={chipStyles.icon} />\n )}\n </>\n );\n\n const a11yState = {\n disabled: isDisabled,\n checked: onToggle ? isToggled : undefined,\n };\n\n const rootStyles = useMemo(() => [chipStyles.root, style], [chipStyles.root, style]);\n const sharedProps = {\n ref,\n style: rootStyles,\n flexDirection: 'row',\n alignItems: 'center',\n overflow: 'hidden',\n alignSelf: 'flex-start',\n maxWidth,\n minWidth,\n disabled: isDisabled,\n opacity: isDisabled ? 0.5 : undefined,\n accessibilityState: a11yState,\n ...rest,\n } as const;\n\n // Interactive chip (toggle or button)\n if (isInteractive) {\n return (\n <Pressable\n onPress={handlePress}\n accessibilityRole={onToggle ? 'checkbox' : 'button'}\n {...sharedProps}\n >\n {content}\n </Pressable>\n );\n }\n\n // Non-interactive chip (display only or dismissible)\n return (\n <HStack accessibilityRole={isDismissible ? 'button' : undefined} {...sharedProps} {...rest}>\n {content}\n </HStack>\n );\n});\n\nChip.displayName = 'Chip';\n\nexport { Chip, type ChipProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAM,OAAO,KAAK,SAAS,KAAK,EAC9B,UAAU,WACV,OAAO,MACP,UACA,WAAW,KACX,WACA,SACA,WAAW,OACX,YA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SAAS,aAAa,KAAM,KAAA;EAC5B,oBAAoB;EACpB,GAAG;EACJ;CAGD,IAAI,eACF,OACE,oBAAC,WAAD;EACE,SAAS;EACT,mBAAmB,WAAW,aAAa;EAC3C,GAAI;YAEH;EACS,CAAA;CAKhB,OACE,oBAAC,QAAD;EAAQ,mBAAmB,gBAAgB,WAAW,KAAA;EAAW,GAAI;EAAa,GAAI;YACnF;EACM,CAAA;EAEX;AAEF,KAAK,cAAc"}
@@ -0,0 +1,103 @@
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_Box = require("../Box.cjs");
5
+ const require_components_HStack = require("../HStack.cjs");
6
+ const require_components_VStack = require("../VStack.cjs");
7
+ const require_components_Divider_DividerLabel = require("./DividerLabel.cjs");
8
+ const require_components_Divider_DividerLine = require("./DividerLine.cjs");
9
+ const require_components_Divider_utils = require("./utils.cjs");
10
+ let react = require("react");
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ let generated_styles = require("../../../generated/styles");
13
+ //#region src/components/Divider/Divider.tsx
14
+ /**
15
+ * **A divider component that can be used to visually separate components**
16
+ *
17
+ * @description
18
+ * Divider is a visual separator for grouping content. It supports horizontal
19
+ * and vertical orientation, optional label content, configurable label
20
+ * positioning, and the same primary, secondary, tertiary, and muted variants
21
+ * as the web component.
22
+ *
23
+ * For custom composition, import `DividerLine` and `DividerLabel` from the same
24
+ * subpath and compose them inside `Divider`, `HStack`, or `VStack`.
25
+ *
26
+ * @category Layout
27
+ * @platform mobile
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * import { Divider, DividerLabel, DividerLine } from '@yahoo/uds-mobile/Divider';
32
+ *
33
+ * <Divider />
34
+ * <Divider variant="secondary" />
35
+ * <Divider contentPosition="start">Section</Divider>
36
+ * <Divider>
37
+ * <DividerLine />
38
+ * <DividerLabel>Custom</DividerLabel>
39
+ * <DividerLine />
40
+ * </Divider>
41
+ * ```
42
+ *
43
+ * @usage
44
+ * - Separate related content groups in lists, settings screens, and stacked layouts
45
+ * - Use `vertical` inside horizontal layouts when a visual split is needed
46
+ * - Use `DividerLine` and `DividerLabel` when a layout needs custom composition
47
+ *
48
+ * @accessibility
49
+ * - Divider is visual-only by default
50
+ * - Use a text label only when the separator needs visible section context
51
+ *
52
+ * @see {@link DividerLine} for a standalone configured divider line
53
+ * @see {@link DividerLabel} for a standalone configured divider label
54
+ */
55
+ const Divider = (0, react.memo)(function Divider({ variant = "primary", vertical = false, contentPosition = "center", gap, children, style, ref, ...boxProps }) {
56
+ generated_styles.dividerStyles.useVariants({ variant });
57
+ const rootStyle = (0, react.useMemo)(() => [
58
+ { flexShrink: 0 },
59
+ gap === void 0 ? generated_styles.dividerStyles.root : void 0,
60
+ style
61
+ ], [
62
+ gap,
63
+ generated_styles.dividerStyles.root,
64
+ style
65
+ ]);
66
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vertical ? require_components_VStack.VStack : require_components_HStack.HStack, {
67
+ ref,
68
+ alignItems: "center",
69
+ flex: "1",
70
+ gap,
71
+ ...boxProps,
72
+ style: rootStyle,
73
+ children: require_components_Divider_utils.hasManualLine(children) ? require_components_Divider_utils.renderManualChildren(children, variant, vertical) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
74
+ contentPosition !== "start" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Divider_DividerLine.DividerLine, {
75
+ variant,
76
+ vertical
77
+ }),
78
+ require_components_Divider_utils.shouldWrapInLabel(children) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Divider_DividerLabel.DividerLabel, {
79
+ variant,
80
+ children
81
+ }) : children,
82
+ contentPosition !== "end" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Divider_DividerLine.DividerLine, {
83
+ variant,
84
+ vertical
85
+ })
86
+ ] })
87
+ });
88
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
89
+ ref,
90
+ display: "flex",
91
+ flexDirection: vertical ? "column" : "row",
92
+ width: vertical ? void 0 : "100%",
93
+ ...boxProps,
94
+ style: rootStyle,
95
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Divider_DividerLine.DividerLine, {
96
+ variant,
97
+ vertical
98
+ })
99
+ });
100
+ });
101
+ Divider.displayName = "Divider";
102
+ //#endregion
103
+ exports.Divider = Divider;
@@ -0,0 +1,50 @@
1
+
2
+ import { DividerProps } from "./types.cjs";
3
+ import * as _$react from "react";
4
+
5
+ //#region src/components/Divider/Divider.d.ts
6
+ /**
7
+ * **A divider component that can be used to visually separate components**
8
+ *
9
+ * @description
10
+ * Divider is a visual separator for grouping content. It supports horizontal
11
+ * and vertical orientation, optional label content, configurable label
12
+ * positioning, and the same primary, secondary, tertiary, and muted variants
13
+ * as the web component.
14
+ *
15
+ * For custom composition, import `DividerLine` and `DividerLabel` from the same
16
+ * subpath and compose them inside `Divider`, `HStack`, or `VStack`.
17
+ *
18
+ * @category Layout
19
+ * @platform mobile
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * import { Divider, DividerLabel, DividerLine } from '@yahoo/uds-mobile/Divider';
24
+ *
25
+ * <Divider />
26
+ * <Divider variant="secondary" />
27
+ * <Divider contentPosition="start">Section</Divider>
28
+ * <Divider>
29
+ * <DividerLine />
30
+ * <DividerLabel>Custom</DividerLabel>
31
+ * <DividerLine />
32
+ * </Divider>
33
+ * ```
34
+ *
35
+ * @usage
36
+ * - Separate related content groups in lists, settings screens, and stacked layouts
37
+ * - Use `vertical` inside horizontal layouts when a visual split is needed
38
+ * - Use `DividerLine` and `DividerLabel` when a layout needs custom composition
39
+ *
40
+ * @accessibility
41
+ * - Divider is visual-only by default
42
+ * - Use a text label only when the separator needs visible section context
43
+ *
44
+ * @see {@link DividerLine} for a standalone configured divider line
45
+ * @see {@link DividerLabel} for a standalone configured divider label
46
+ */
47
+ declare const Divider: _$react.NamedExoticComponent<DividerProps>;
48
+ //#endregion
49
+ export { Divider };
50
+ //# sourceMappingURL=Divider.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.d.cts","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"mappings":";;;;;;;;AAS4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4CtC,OAAA,EAAO,OAAA,CAAA,oBAAA,CAAA,YAAA"}
@@ -0,0 +1,50 @@
1
+
2
+ import { DividerProps } from "./types.js";
3
+ import * as _$react from "react";
4
+
5
+ //#region src/components/Divider/Divider.d.ts
6
+ /**
7
+ * **A divider component that can be used to visually separate components**
8
+ *
9
+ * @description
10
+ * Divider is a visual separator for grouping content. It supports horizontal
11
+ * and vertical orientation, optional label content, configurable label
12
+ * positioning, and the same primary, secondary, tertiary, and muted variants
13
+ * as the web component.
14
+ *
15
+ * For custom composition, import `DividerLine` and `DividerLabel` from the same
16
+ * subpath and compose them inside `Divider`, `HStack`, or `VStack`.
17
+ *
18
+ * @category Layout
19
+ * @platform mobile
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * import { Divider, DividerLabel, DividerLine } from '@yahoo/uds-mobile/Divider';
24
+ *
25
+ * <Divider />
26
+ * <Divider variant="secondary" />
27
+ * <Divider contentPosition="start">Section</Divider>
28
+ * <Divider>
29
+ * <DividerLine />
30
+ * <DividerLabel>Custom</DividerLabel>
31
+ * <DividerLine />
32
+ * </Divider>
33
+ * ```
34
+ *
35
+ * @usage
36
+ * - Separate related content groups in lists, settings screens, and stacked layouts
37
+ * - Use `vertical` inside horizontal layouts when a visual split is needed
38
+ * - Use `DividerLine` and `DividerLabel` when a layout needs custom composition
39
+ *
40
+ * @accessibility
41
+ * - Divider is visual-only by default
42
+ * - Use a text label only when the separator needs visible section context
43
+ *
44
+ * @see {@link DividerLine} for a standalone configured divider line
45
+ * @see {@link DividerLabel} for a standalone configured divider label
46
+ */
47
+ declare const Divider: _$react.NamedExoticComponent<DividerProps>;
48
+ //#endregion
49
+ export { Divider };
50
+ //# sourceMappingURL=Divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.d.ts","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"mappings":";;;;;;;;AAS4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4CtC,OAAA,EAAO,OAAA,CAAA,oBAAA,CAAA,YAAA"}
@@ -0,0 +1,103 @@
1
+ /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
+ import { Box } from "../Box.js";
3
+ import { HStack } from "../HStack.js";
4
+ import { VStack } from "../VStack.js";
5
+ import { DividerLabel } from "./DividerLabel.js";
6
+ import { DividerLine } from "./DividerLine.js";
7
+ import { hasManualLine, renderManualChildren, shouldWrapInLabel } from "./utils.js";
8
+ import { memo, useMemo } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { dividerStyles } from "../../../generated/styles";
11
+ //#region src/components/Divider/Divider.tsx
12
+ /**
13
+ * **A divider component that can be used to visually separate components**
14
+ *
15
+ * @description
16
+ * Divider is a visual separator for grouping content. It supports horizontal
17
+ * and vertical orientation, optional label content, configurable label
18
+ * positioning, and the same primary, secondary, tertiary, and muted variants
19
+ * as the web component.
20
+ *
21
+ * For custom composition, import `DividerLine` and `DividerLabel` from the same
22
+ * subpath and compose them inside `Divider`, `HStack`, or `VStack`.
23
+ *
24
+ * @category Layout
25
+ * @platform mobile
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * import { Divider, DividerLabel, DividerLine } from '@yahoo/uds-mobile/Divider';
30
+ *
31
+ * <Divider />
32
+ * <Divider variant="secondary" />
33
+ * <Divider contentPosition="start">Section</Divider>
34
+ * <Divider>
35
+ * <DividerLine />
36
+ * <DividerLabel>Custom</DividerLabel>
37
+ * <DividerLine />
38
+ * </Divider>
39
+ * ```
40
+ *
41
+ * @usage
42
+ * - Separate related content groups in lists, settings screens, and stacked layouts
43
+ * - Use `vertical` inside horizontal layouts when a visual split is needed
44
+ * - Use `DividerLine` and `DividerLabel` when a layout needs custom composition
45
+ *
46
+ * @accessibility
47
+ * - Divider is visual-only by default
48
+ * - Use a text label only when the separator needs visible section context
49
+ *
50
+ * @see {@link DividerLine} for a standalone configured divider line
51
+ * @see {@link DividerLabel} for a standalone configured divider label
52
+ */
53
+ const Divider = memo(function Divider({ variant = "primary", vertical = false, contentPosition = "center", gap, children, style, ref, ...boxProps }) {
54
+ dividerStyles.useVariants({ variant });
55
+ const rootStyle = useMemo(() => [
56
+ { flexShrink: 0 },
57
+ gap === void 0 ? dividerStyles.root : void 0,
58
+ style
59
+ ], [
60
+ gap,
61
+ dividerStyles.root,
62
+ style
63
+ ]);
64
+ if (children) return /* @__PURE__ */ jsx(vertical ? VStack : HStack, {
65
+ ref,
66
+ alignItems: "center",
67
+ flex: "1",
68
+ gap,
69
+ ...boxProps,
70
+ style: rootStyle,
71
+ children: hasManualLine(children) ? renderManualChildren(children, variant, vertical) : /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ contentPosition !== "start" && /* @__PURE__ */ jsx(DividerLine, {
73
+ variant,
74
+ vertical
75
+ }),
76
+ shouldWrapInLabel(children) ? /* @__PURE__ */ jsx(DividerLabel, {
77
+ variant,
78
+ children
79
+ }) : children,
80
+ contentPosition !== "end" && /* @__PURE__ */ jsx(DividerLine, {
81
+ variant,
82
+ vertical
83
+ })
84
+ ] })
85
+ });
86
+ return /* @__PURE__ */ jsx(Box, {
87
+ ref,
88
+ display: "flex",
89
+ flexDirection: vertical ? "column" : "row",
90
+ width: vertical ? void 0 : "100%",
91
+ ...boxProps,
92
+ style: rootStyle,
93
+ children: /* @__PURE__ */ jsx(DividerLine, {
94
+ variant,
95
+ vertical
96
+ })
97
+ });
98
+ });
99
+ Divider.displayName = "Divider";
100
+ //#endregion
101
+ export { Divider };
102
+
103
+ //# sourceMappingURL=Divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.js","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import { memo, useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { dividerStyles } from '../../../generated/styles';\nimport { Box } from '../Box';\nimport { HStack } from '../HStack';\nimport { VStack } from '../VStack';\nimport { DividerLabel } from './DividerLabel';\nimport { DividerLine } from './DividerLine';\nimport type { DividerProps } from './types';\nimport { hasManualLine, renderManualChildren, shouldWrapInLabel } from './utils';\n\n/**\n * **A divider component that can be used to visually separate components**\n *\n * @description\n * Divider is a visual separator for grouping content. It supports horizontal\n * and vertical orientation, optional label content, configurable label\n * positioning, and the same primary, secondary, tertiary, and muted variants\n * as the web component.\n *\n * For custom composition, import `DividerLine` and `DividerLabel` from the same\n * subpath and compose them inside `Divider`, `HStack`, or `VStack`.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Divider, DividerLabel, DividerLine } from '@yahoo/uds-mobile/Divider';\n *\n * <Divider />\n * <Divider variant=\"secondary\" />\n * <Divider contentPosition=\"start\">Section</Divider>\n * <Divider>\n * <DividerLine />\n * <DividerLabel>Custom</DividerLabel>\n * <DividerLine />\n * </Divider>\n * ```\n *\n * @usage\n * - Separate related content groups in lists, settings screens, and stacked layouts\n * - Use `vertical` inside horizontal layouts when a visual split is needed\n * - Use `DividerLine` and `DividerLabel` when a layout needs custom composition\n *\n * @accessibility\n * - Divider is visual-only by default\n * - Use a text label only when the separator needs visible section context\n *\n * @see {@link DividerLine} for a standalone configured divider line\n * @see {@link DividerLabel} for a standalone configured divider label\n */\nconst Divider = memo(function Divider({\n variant = 'primary',\n vertical = false,\n contentPosition = 'center',\n gap,\n children,\n style,\n ref,\n ...boxProps\n}: DividerProps) {\n dividerStyles.useVariants({ variant });\n\n const rootStyle: StyleProp<ViewStyle> = useMemo(\n () => [{ flexShrink: 0 }, gap === undefined ? dividerStyles.root : undefined, style],\n [gap, dividerStyles.root, style],\n );\n\n if (children) {\n const InternalComponent = vertical ? VStack : HStack;\n\n return (\n <InternalComponent\n ref={ref}\n alignItems=\"center\"\n flex=\"1\"\n gap={gap}\n {...boxProps}\n style={rootStyle}\n >\n {hasManualLine(children) ? (\n renderManualChildren(children, variant, vertical)\n ) : (\n <>\n {contentPosition !== 'start' && <DividerLine variant={variant} vertical={vertical} />}\n {shouldWrapInLabel(children) ? (\n <DividerLabel variant={variant}>{children}</DividerLabel>\n ) : (\n children\n )}\n {contentPosition !== 'end' && <DividerLine variant={variant} vertical={vertical} />}\n </>\n )}\n </InternalComponent>\n );\n }\n\n return (\n <Box\n ref={ref}\n display=\"flex\"\n flexDirection={vertical ? 'column' : 'row'}\n width={vertical ? undefined : '100%'}\n {...boxProps}\n style={rootStyle}\n >\n <DividerLine variant={variant} vertical={vertical} />\n </Box>\n );\n});\n\nDivider.displayName = 'Divider';\n\nexport { Divider };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,UAAU,KAAK,SAAS,QAAQ,EACpC,UAAU,WACV,WAAW,OACX,kBAAkB,UAClB,KACA,UACA,OACA,KACA,GAAG,YACY;CACf,cAAc,YAAY,EAAE,SAAS,CAAC;CAEtC,MAAM,YAAkC,cAChC;EAAC,EAAE,YAAY,GAAG;EAAE,QAAQ,KAAA,IAAY,cAAc,OAAO,KAAA;EAAW;EAAM,EACpF;EAAC;EAAK,cAAc;EAAM;EAAM,CACjC;CAED,IAAI,UAGF,OACE,oBAHwB,WAAW,SAAS,QAG5C;EACO;EACL,YAAW;EACX,MAAK;EACA;EACL,GAAI;EACJ,OAAO;YAEN,cAAc,SAAS,GACtB,qBAAqB,UAAU,SAAS,SAAS,GAEjD,qBAAA,UAAA,EAAA,UAAA;GACG,oBAAoB,WAAW,oBAAC,aAAD;IAAsB;IAAmB;IAAY,CAAA;GACpF,kBAAkB,SAAS,GAC1B,oBAAC,cAAD;IAAuB;IAAU;IAAwB,CAAA,GAEzD;GAED,oBAAoB,SAAS,oBAAC,aAAD;IAAsB;IAAmB;IAAY,CAAA;GAClF,EAAA,CAAA;EAEa,CAAA;CAIxB,OACE,oBAAC,KAAD;EACO;EACL,SAAQ;EACR,eAAe,WAAW,WAAW;EACrC,OAAO,WAAW,KAAA,IAAY;EAC9B,GAAI;EACJ,OAAO;YAEP,oBAAC,aAAD;GAAsB;GAAmB;GAAY,CAAA;EACjD,CAAA;EAER;AAEF,QAAQ,cAAc"}
@@ -0,0 +1,37 @@
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_Text = require("../Text.cjs");
5
+ let react = require("react");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let generated_styles = require("../../../generated/styles");
8
+ //#region src/components/Divider/DividerLabel.tsx
9
+ /**
10
+ * **The configured label element used by Divider.**
11
+ *
12
+ * @description
13
+ * DividerLabel applies the configured divider label typography and color.
14
+ *
15
+ * @category Layout
16
+ * @platform mobile
17
+ */
18
+ const DividerLabel = (0, react.memo)(function DividerLabel({ variant: variantProp, style, children, ref, ...textProps }) {
19
+ const variant = variantProp ?? "primary";
20
+ generated_styles.dividerStyles.useVariants({ variant });
21
+ const labelStyle = (0, react.useMemo)(() => [
22
+ { flexShrink: 0 },
23
+ generated_styles.dividerStyles.label,
24
+ style
25
+ ], [generated_styles.dividerStyles.label, style]);
26
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
27
+ ref,
28
+ color: "primary",
29
+ variant: "label3",
30
+ ...textProps,
31
+ style: labelStyle,
32
+ children
33
+ });
34
+ });
35
+ DividerLabel.displayName = "DividerLabel";
36
+ //#endregion
37
+ exports.DividerLabel = DividerLabel;
@@ -0,0 +1,18 @@
1
+
2
+ import { DividerLabelProps } from "./types.cjs";
3
+ import * as _$react from "react";
4
+
5
+ //#region src/components/Divider/DividerLabel.d.ts
6
+ /**
7
+ * **The configured label element used by Divider.**
8
+ *
9
+ * @description
10
+ * DividerLabel applies the configured divider label typography and color.
11
+ *
12
+ * @category Layout
13
+ * @platform mobile
14
+ */
15
+ declare const DividerLabel: _$react.NamedExoticComponent<DividerLabelProps>;
16
+ //#endregion
17
+ export { DividerLabel };
18
+ //# sourceMappingURL=DividerLabel.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DividerLabel.d.cts","names":[],"sources":["../../../src/components/Divider/DividerLabel.tsx"],"mappings":";;;;;;;;AAIiD;;;;;;cAW3C,YAAA,EAAY,OAAA,CAAA,oBAAA,CAAA,iBAAA"}
@@ -0,0 +1,18 @@
1
+
2
+ import { DividerLabelProps } from "./types.js";
3
+ import * as _$react from "react";
4
+
5
+ //#region src/components/Divider/DividerLabel.d.ts
6
+ /**
7
+ * **The configured label element used by Divider.**
8
+ *
9
+ * @description
10
+ * DividerLabel applies the configured divider label typography and color.
11
+ *
12
+ * @category Layout
13
+ * @platform mobile
14
+ */
15
+ declare const DividerLabel: _$react.NamedExoticComponent<DividerLabelProps>;
16
+ //#endregion
17
+ export { DividerLabel };
18
+ //# sourceMappingURL=DividerLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DividerLabel.d.ts","names":[],"sources":["../../../src/components/Divider/DividerLabel.tsx"],"mappings":";;;;;;;;AAIiD;;;;;;cAW3C,YAAA,EAAY,OAAA,CAAA,oBAAA,CAAA,iBAAA"}
@@ -0,0 +1,37 @@
1
+ /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
+ import { Text } from "../Text.js";
3
+ import { memo, useMemo } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { dividerStyles } from "../../../generated/styles";
6
+ //#region src/components/Divider/DividerLabel.tsx
7
+ /**
8
+ * **The configured label element used by Divider.**
9
+ *
10
+ * @description
11
+ * DividerLabel applies the configured divider label typography and color.
12
+ *
13
+ * @category Layout
14
+ * @platform mobile
15
+ */
16
+ const DividerLabel = memo(function DividerLabel({ variant: variantProp, style, children, ref, ...textProps }) {
17
+ const variant = variantProp ?? "primary";
18
+ dividerStyles.useVariants({ variant });
19
+ const labelStyle = useMemo(() => [
20
+ { flexShrink: 0 },
21
+ dividerStyles.label,
22
+ style
23
+ ], [dividerStyles.label, style]);
24
+ return /* @__PURE__ */ jsx(Text, {
25
+ ref,
26
+ color: "primary",
27
+ variant: "label3",
28
+ ...textProps,
29
+ style: labelStyle,
30
+ children
31
+ });
32
+ });
33
+ DividerLabel.displayName = "DividerLabel";
34
+ //#endregion
35
+ export { DividerLabel };
36
+
37
+ //# sourceMappingURL=DividerLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DividerLabel.js","names":[],"sources":["../../../src/components/Divider/DividerLabel.tsx"],"sourcesContent":["import { memo, useMemo } from 'react';\n\nimport { dividerStyles } from '../../../generated/styles';\nimport { Text } from '../Text';\nimport type { DividerLabelProps } from './types';\n\n/**\n * **The configured label element used by Divider.**\n *\n * @description\n * DividerLabel applies the configured divider label typography and color.\n *\n * @category Layout\n * @platform mobile\n */\nconst DividerLabel = memo(function DividerLabel({\n variant: variantProp,\n style,\n children,\n ref,\n ...textProps\n}: DividerLabelProps) {\n const variant = variantProp ?? 'primary';\n\n dividerStyles.useVariants({ variant });\n\n const labelStyle = useMemo(\n () => [{ flexShrink: 0 }, dividerStyles.label, style],\n [dividerStyles.label, style],\n );\n\n return (\n <Text ref={ref} color=\"primary\" variant=\"label3\" {...textProps} style={labelStyle}>\n {children}\n </Text>\n );\n});\n\nDividerLabel.displayName = 'DividerLabel';\n\nexport { DividerLabel };\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,eAAe,KAAK,SAAS,aAAa,EAC9C,SAAS,aACT,OACA,UACA,KACA,GAAG,aACiB;CACpB,MAAM,UAAU,eAAe;CAE/B,cAAc,YAAY,EAAE,SAAS,CAAC;CAEtC,MAAM,aAAa,cACX;EAAC,EAAE,YAAY,GAAG;EAAE,cAAc;EAAO;EAAM,EACrD,CAAC,cAAc,OAAO,MAAM,CAC7B;CAED,OACE,oBAAC,MAAD;EAAW;EAAK,OAAM;EAAU,SAAQ;EAAS,GAAI;EAAW,OAAO;EACpE;EACI,CAAA;EAET;AAEF,aAAa,cAAc"}