@yahoo/uds-mobile 1.3.0-beta.9 → 1.3.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 (165) hide show
  1. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  2. package/dist/bin/fixtures/dist/index.mjs +25 -1
  3. package/dist/bin/generateTheme.mjs +5 -5
  4. package/dist/bin/uds-mobile.mjs +10 -10
  5. package/dist/components/Avatar.cjs +12 -3
  6. package/dist/components/Avatar.d.cts +11 -3
  7. package/dist/components/Avatar.d.cts.map +1 -1
  8. package/dist/components/Avatar.d.mts +11 -3
  9. package/dist/components/Avatar.d.mts.map +1 -1
  10. package/dist/components/Avatar.mjs +10 -2
  11. package/dist/components/Avatar.mjs.map +1 -1
  12. package/dist/components/Badge.cjs +14 -3
  13. package/dist/components/Badge.d.cts +24 -6
  14. package/dist/components/Badge.d.cts.map +1 -1
  15. package/dist/components/Badge.d.mts +24 -6
  16. package/dist/components/Badge.d.mts.map +1 -1
  17. package/dist/components/Badge.mjs +12 -2
  18. package/dist/components/Badge.mjs.map +1 -1
  19. package/dist/components/Box.cjs +14 -10
  20. package/dist/components/Box.d.cts +15 -10
  21. package/dist/components/Box.d.cts.map +1 -1
  22. package/dist/components/Box.d.mts +15 -10
  23. package/dist/components/Box.d.mts.map +1 -1
  24. package/dist/components/Box.mjs +12 -9
  25. package/dist/components/Box.mjs.map +1 -1
  26. package/dist/components/Button.cjs +14 -4
  27. package/dist/components/Button.d.cts +21 -6
  28. package/dist/components/Button.d.cts.map +1 -1
  29. package/dist/components/Button.d.mts +21 -6
  30. package/dist/components/Button.d.mts.map +1 -1
  31. package/dist/components/Button.mjs +11 -2
  32. package/dist/components/Button.mjs.map +1 -1
  33. package/dist/components/Checkbox.cjs +15 -6
  34. package/dist/components/Checkbox.d.cts +14 -5
  35. package/dist/components/Checkbox.d.cts.map +1 -1
  36. package/dist/components/Checkbox.d.mts +14 -5
  37. package/dist/components/Checkbox.d.mts.map +1 -1
  38. package/dist/components/Checkbox.mjs +12 -4
  39. package/dist/components/Checkbox.mjs.map +1 -1
  40. package/dist/components/Chip.cjs +20 -3
  41. package/dist/components/Chip.d.cts +28 -6
  42. package/dist/components/Chip.d.cts.map +1 -1
  43. package/dist/components/Chip.d.mts +28 -6
  44. package/dist/components/Chip.d.mts.map +1 -1
  45. package/dist/components/Chip.mjs +18 -2
  46. package/dist/components/Chip.mjs.map +1 -1
  47. package/dist/components/HStack.cjs +8 -5
  48. package/dist/components/HStack.d.cts +9 -5
  49. package/dist/components/HStack.d.cts.map +1 -1
  50. package/dist/components/HStack.d.mts +9 -5
  51. package/dist/components/HStack.d.mts.map +1 -1
  52. package/dist/components/HStack.mjs +6 -4
  53. package/dist/components/HStack.mjs.map +1 -1
  54. package/dist/components/Icon.cjs +16 -5
  55. package/dist/components/Icon.d.cts +14 -3
  56. package/dist/components/Icon.d.cts.map +1 -1
  57. package/dist/components/Icon.d.mts +14 -3
  58. package/dist/components/Icon.d.mts.map +1 -1
  59. package/dist/components/Icon.mjs +14 -4
  60. package/dist/components/Icon.mjs.map +1 -1
  61. package/dist/components/IconButton.cjs +23 -4
  62. package/dist/components/IconButton.d.cts +28 -8
  63. package/dist/components/IconButton.d.cts.map +1 -1
  64. package/dist/components/IconButton.d.mts +28 -8
  65. package/dist/components/IconButton.d.mts.map +1 -1
  66. package/dist/components/IconButton.mjs +21 -3
  67. package/dist/components/IconButton.mjs.map +1 -1
  68. package/dist/components/IconSlot.cjs +8 -2
  69. package/dist/components/IconSlot.d.cts +7 -2
  70. package/dist/components/IconSlot.d.cts.map +1 -1
  71. package/dist/components/IconSlot.d.mts +7 -2
  72. package/dist/components/IconSlot.d.mts.map +1 -1
  73. package/dist/components/IconSlot.mjs +6 -1
  74. package/dist/components/IconSlot.mjs.map +1 -1
  75. package/dist/components/Image.cjs +18 -3
  76. package/dist/components/Image.d.cts +18 -3
  77. package/dist/components/Image.d.cts.map +1 -1
  78. package/dist/components/Image.d.mts +18 -3
  79. package/dist/components/Image.d.mts.map +1 -1
  80. package/dist/components/Image.mjs +16 -2
  81. package/dist/components/Image.mjs.map +1 -1
  82. package/dist/components/Input.cjs +19 -6
  83. package/dist/components/Input.d.cts +19 -6
  84. package/dist/components/Input.d.cts.map +1 -1
  85. package/dist/components/Input.d.mts +19 -6
  86. package/dist/components/Input.d.mts.map +1 -1
  87. package/dist/components/Input.mjs +17 -5
  88. package/dist/components/Input.mjs.map +1 -1
  89. package/dist/components/Link.cjs +19 -4
  90. package/dist/components/Link.d.cts +21 -4
  91. package/dist/components/Link.d.cts.map +1 -1
  92. package/dist/components/Link.d.mts +21 -4
  93. package/dist/components/Link.d.mts.map +1 -1
  94. package/dist/components/Link.mjs +16 -2
  95. package/dist/components/Link.mjs.map +1 -1
  96. package/dist/components/Pressable.cjs +17 -5
  97. package/dist/components/Pressable.d.cts +18 -5
  98. package/dist/components/Pressable.d.cts.map +1 -1
  99. package/dist/components/Pressable.d.mts +18 -5
  100. package/dist/components/Pressable.d.mts.map +1 -1
  101. package/dist/components/Pressable.mjs +14 -3
  102. package/dist/components/Pressable.mjs.map +1 -1
  103. package/dist/components/Radio.cjs +15 -6
  104. package/dist/components/Radio.d.cts +14 -5
  105. package/dist/components/Radio.d.cts.map +1 -1
  106. package/dist/components/Radio.d.mts +14 -5
  107. package/dist/components/Radio.d.mts.map +1 -1
  108. package/dist/components/Radio.mjs +12 -4
  109. package/dist/components/Radio.mjs.map +1 -1
  110. package/dist/components/Screen.cjs +9 -3
  111. package/dist/components/Screen.d.cts +15 -3
  112. package/dist/components/Screen.d.cts.map +1 -1
  113. package/dist/components/Screen.d.mts +15 -3
  114. package/dist/components/Screen.d.mts.map +1 -1
  115. package/dist/components/Screen.mjs +7 -2
  116. package/dist/components/Screen.mjs.map +1 -1
  117. package/dist/components/Switch.cjs +20 -4
  118. package/dist/components/Switch.d.cts +18 -3
  119. package/dist/components/Switch.d.cts.map +1 -1
  120. package/dist/components/Switch.d.mts +18 -3
  121. package/dist/components/Switch.d.mts.map +1 -1
  122. package/dist/components/Switch.mjs +17 -2
  123. package/dist/components/Switch.mjs.map +1 -1
  124. package/dist/components/Text.cjs +16 -6
  125. package/dist/components/Text.d.cts +18 -6
  126. package/dist/components/Text.d.cts.map +1 -1
  127. package/dist/components/Text.d.mts +18 -6
  128. package/dist/components/Text.d.mts.map +1 -1
  129. package/dist/components/Text.mjs +14 -5
  130. package/dist/components/Text.mjs.map +1 -1
  131. package/dist/components/VStack.cjs +8 -5
  132. package/dist/components/VStack.d.cts +9 -5
  133. package/dist/components/VStack.d.cts.map +1 -1
  134. package/dist/components/VStack.d.mts +9 -5
  135. package/dist/components/VStack.d.mts.map +1 -1
  136. package/dist/components/VStack.mjs +6 -4
  137. package/dist/components/VStack.mjs.map +1 -1
  138. package/dist/icons/dist/glyphMap.d.cts +0 -1
  139. package/dist/icons/dist/glyphMap.d.cts.map +1 -1
  140. package/dist/icons/dist/glyphMap.d.mts +0 -1
  141. package/dist/icons/dist/glyphMap.d.mts.map +1 -1
  142. package/dist/icons/dist/svgMap.d.cts +0 -1
  143. package/dist/icons/dist/svgMap.d.cts.map +1 -1
  144. package/dist/icons/dist/svgMap.d.mts +0 -1
  145. package/dist/icons/dist/svgMap.d.mts.map +1 -1
  146. package/dist/motion-tokens/dist/index.d.cts +1 -3
  147. package/dist/motion-tokens/dist/index.d.cts.map +1 -1
  148. package/dist/motion-tokens/dist/index.d.mts +1 -3
  149. package/dist/motion-tokens/dist/index.d.mts.map +1 -1
  150. package/dist/motion.cjs +1 -0
  151. package/dist/motion.d.cts +0 -1
  152. package/dist/motion.d.cts.map +1 -1
  153. package/dist/motion.d.mts +0 -1
  154. package/dist/motion.d.mts.map +1 -1
  155. package/dist/types/dist/index.d.cts +1 -3
  156. package/dist/types/dist/index.d.cts.map +1 -1
  157. package/dist/types/dist/index.d.mts +1 -3
  158. package/dist/types/dist/index.d.mts.map +1 -1
  159. package/dist/types.d.cts.map +1 -1
  160. package/dist/types.d.mts.map +1 -1
  161. package/generated/styles.cjs +96 -0
  162. package/generated/styles.d.ts +47 -0
  163. package/generated/styles.mjs +96 -0
  164. package/generated/unistyles.d.ts +79 -0
  165. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
 
2
2
  import { UniversalCheckboxProps } from "../types/dist/index.mjs";
3
- import * as react14 from "react";
3
+ import * as react from "react";
4
4
  import { Ref } from "react";
5
5
  import { View, ViewProps } from "react-native";
6
6
 
7
7
  //#region src/components/Checkbox.d.ts
8
8
  interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps {
9
+ /** Ref to the underlying View */
9
10
  ref?: Ref<View>;
10
11
  /** Default checked state for uncontrolled mode */
11
12
  defaultChecked?: boolean;
@@ -19,13 +20,14 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
19
20
  /**
20
21
  * **⚙️ A checkbox component**
21
22
  *
22
- * @componentType Client component
23
- *
24
23
  * @description
25
24
  * A checkbox component allows users to select one or multiple options from a set.
26
25
  * It represents a binary state, typically as checked or unchecked, and optionally
27
26
  * includes a third "indeterminate" state to indicate partial selection.
28
27
  *
28
+ * @category Form
29
+ * @platform mobile
30
+ *
29
31
  * @example
30
32
  * ```tsx
31
33
  * import { Checkbox } from '@yahoo/uds-mobile';
@@ -40,9 +42,16 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
40
42
  * - Settings: For toggling preferences
41
43
  * - Filters: For multi-select filtering
42
44
  *
43
- * @see The {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
45
+ * @accessibility
46
+ * - Sets `accessibilityRole="checkbox"` automatically
47
+ * - Announces checked/unchecked/mixed state
48
+ * - Label is used as accessibility label
49
+ * - Supports `reduceMotion` for users who prefer reduced motion
50
+ *
51
+ * @see {@link Radio} for single-select options
52
+ * @see {@link Switch} for binary toggles
44
53
  */
45
- declare const Checkbox: react14.NamedExoticComponent<CheckboxProps>;
54
+ declare const Checkbox: react.NamedExoticComponent<CheckboxProps>;
46
55
  //#endregion
47
56
  export { Checkbox, type CheckboxProps };
48
57
  //# sourceMappingURL=Checkbox.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":[],"mappings":";;;;;;;UAyBU,aAAA,SAAsB,KAAK,qBAAqB;QAClD,IAAI;;EADF,cAAA,CAAA,EAAc,OAAA;EAAa;EACzB,QAAA,CAAA,EAAA,OAAA;EAAJ;EADwB,QAAA,CAAA,EAAA,OAAA;EAA0B;EAAsB,QAAA,CAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,GAAA,IAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsD1E,UAAQ,OAAA,CAAA,qBAAA"}
1
+ {"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../src/components/Checkbox.tsx"],"mappings":";;;;;;;UAyBU,aAAA,SAAsB,IAAA,CAAK,SAAA,YAAqB,sBAAA;;EAExD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,cAAA;;EAEA,QAAA;EAJU;EAMV,QAAA;EAR8B;EAU9B,QAAA,IAAY,OAAA;AAAA;;;;;;;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;;cAqDxB,QAAA,EAAQ,KAAA,CAAA,oBAAA,CAAA,aAAA"}
@@ -18,13 +18,14 @@ const VARIANT_ERROR_MAP = {
18
18
  /**
19
19
  * **⚙️ A checkbox component**
20
20
  *
21
- * @componentType Client component
22
- *
23
21
  * @description
24
22
  * A checkbox component allows users to select one or multiple options from a set.
25
23
  * It represents a binary state, typically as checked or unchecked, and optionally
26
24
  * includes a third "indeterminate" state to indicate partial selection.
27
25
  *
26
+ * @category Form
27
+ * @platform mobile
28
+ *
28
29
  * @example
29
30
  * ```tsx
30
31
  * import { Checkbox } from '@yahoo/uds-mobile';
@@ -39,9 +40,16 @@ const VARIANT_ERROR_MAP = {
39
40
  * - Settings: For toggling preferences
40
41
  * - Filters: For multi-select filtering
41
42
  *
42
- * @see The {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
43
+ * @accessibility
44
+ * - Sets `accessibilityRole="checkbox"` automatically
45
+ * - Announces checked/unchecked/mixed state
46
+ * - Label is used as accessibility label
47
+ * - Supports `reduceMotion` for users who prefer reduced motion
48
+ *
49
+ * @see {@link Radio} for single-select options
50
+ * @see {@link Switch} for binary toggles
43
51
  */
44
- const Checkbox = memo(function Checkbox$1({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
52
+ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
45
53
  const uid = `uds-checkbox-${useId()}`;
46
54
  const isControlled = checkedProp !== void 0;
47
55
  const [internalChecked, setInternalChecked] = useState(isControlled ? checkedProp : defaultChecked ?? false);
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":["VARIANT_ERROR_MAP: Record<CheckboxVariant, CheckboxStyleVariant>","Checkbox","valueState: CheckboxValueState","styleVariant: CheckboxStyleVariant"],"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, {\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n withSpring,\n} 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?: 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 * @componentType Client 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 * @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 * @see The {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info\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 // Icon visibility animation\n // When reduceMotion is true, still show/hide the icon but without animation\n const iconProgress = useDerivedValue(\n () => (shouldAnimate ? withSpring(showIcon ? 1 : 0, BUTTON_SPRING_CONFIG) : showIcon ? 1 : 0),\n [showIcon, shouldAnimate],\n );\n\n const checkboxAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n const iconAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(iconProgress.value, [0, 1], [0, 1]),\n transform: [{ scale: interpolate(iconProgress.value, [0, 1], [0.5, 1]) }],\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 },\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 <Animated.View style={iconAnimatedStyle}>\n <Icon name={iconName} size=\"sm\" style={checkboxStyles.checkboxIcon} />\n </Animated.View>\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox, type CheckboxProps };\n"],"mappings":"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"}
1
+ {"version":3,"file":"Checkbox.mjs","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, {\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n withSpring,\n} 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 // Icon visibility animation\n // When reduceMotion is true, still show/hide the icon but without animation\n const iconProgress = useDerivedValue(\n () => (shouldAnimate ? withSpring(showIcon ? 1 : 0, BUTTON_SPRING_CONFIG) : showIcon ? 1 : 0),\n [showIcon, shouldAnimate],\n );\n\n const checkboxAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n const iconAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(iconProgress.value, [0, 1], [0, 1]),\n transform: [{ scale: interpolate(iconProgress.value, [0, 1], [0.5, 1]) }],\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 },\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 <Animated.View style={iconAnimatedStyle}>\n <Icon name={iconName} size=\"sm\" style={checkboxStyles.checkboxIcon} />\n </Animated.View>\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox, type CheckboxProps };\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
4
  const require_components_IconSlot = require('./IconSlot.cjs');
4
5
  const require_components_Text = require('./Text.cjs');
5
6
  const require_components_HStack = require('./HStack.cjs');
@@ -16,9 +17,12 @@ let react_jsx_runtime = require("react/jsx-runtime");
16
17
  * Chips help people make selections, filter content, or trigger actions.
17
18
  * They can be toggleable, dismissible, or simple pressable elements.
18
19
  *
20
+ * @category Interactive
21
+ * @platform mobile
22
+ *
19
23
  * @example
20
24
  * ```tsx
21
- * import { Chip } from '~/components/ui/Chip';
25
+ * import { Chip } from '@yahoo/uds-mobile';
22
26
  *
23
27
  * // Basic chip
24
28
  * <Chip>Label</Chip>
@@ -32,8 +36,21 @@ let react_jsx_runtime = require("react/jsx-runtime");
32
36
  * // With icons
33
37
  * <Chip startIcon="Star" variant="brand">Favorite</Chip>
34
38
  * ```
39
+ *
40
+ * @usage
41
+ * - Filters: For multi-select filtering options
42
+ * - Tags: For displaying and removing tags
43
+ * - Actions: For quick contextual actions
44
+ *
45
+ * @accessibility
46
+ * - Toggle chips use `accessibilityRole="checkbox"` with checked state
47
+ * - Action chips use `accessibilityRole="button"`
48
+ * - Dismiss button has customizable `dismissButtonAriaLabel`
49
+ *
50
+ * @see {@link Badge} for non-interactive status indicators
51
+ * @see {@link Button} for primary actions
35
52
  */
36
- const Chip = (0, react.memo)(function Chip$1({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, disabled = false, isToggled = false, onPress, onToggle, onDismiss, dismissButtonAriaLabel = "Dismiss", children, style, ref, ...rest }) {
53
+ const Chip = (0, react.memo)(function Chip({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, disabled = false, isToggled = false, onPress, onToggle, onDismiss, dismissButtonAriaLabel = "Dismiss", children, style, ref, ...rest }) {
37
54
  const isInteractive = Boolean(onPress || onToggle);
38
55
  const isDismissible = Boolean(onDismiss);
39
56
  const isDisabled = disabled;
@@ -1,22 +1,27 @@
1
1
 
2
2
  import { ChipSize, ChipVariant } from "../types/dist/index.cjs";
3
3
  import { IconSlotType } from "./IconSlot.cjs";
4
- import * as react4 from "react";
4
+ import * as react from "react";
5
5
  import { Ref } from "react";
6
6
  import { View, ViewProps } from "react-native";
7
7
 
8
8
  //#region src/components/Chip.d.ts
9
9
  interface ChipProps extends Omit<ViewProps, 'children'> {
10
+ /** Ref to the underlying View */
10
11
  ref?: Ref<View>;
11
- /** @default 'primary' */
12
+ /** The visual style variant @default 'primary' */
12
13
  variant?: ChipVariant;
13
- /** @default 'md' */
14
+ /** The size of the chip @default 'md' */
14
15
  size?: ChipSize;
16
+ /** Minimum width of the chip in pixels */
15
17
  minWidth?: number;
16
- /** @default 200 */
18
+ /** Maximum width of the chip in pixels @default 200 */
17
19
  maxWidth?: number;
20
+ /** Icon displayed at the start of the chip */
18
21
  startIcon?: IconSlotType;
22
+ /** Icon displayed at the end of the chip */
19
23
  endIcon?: IconSlotType;
24
+ /** Whether the chip is disabled */
20
25
  disabled?: boolean;
21
26
  /** Called when the chip is pressed. Makes the chip interactive. */
22
27
  onPress?: () => void;
@@ -28,6 +33,7 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
28
33
  onDismiss?: () => void;
29
34
  /** Accessibility label for the dismiss button. */
30
35
  dismissButtonAriaLabel?: string;
36
+ /** Chip label content */
31
37
  children?: React.ReactNode;
32
38
  }
33
39
  /**
@@ -37,9 +43,12 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
37
43
  * Chips help people make selections, filter content, or trigger actions.
38
44
  * They can be toggleable, dismissible, or simple pressable elements.
39
45
  *
46
+ * @category Interactive
47
+ * @platform mobile
48
+ *
40
49
  * @example
41
50
  * ```tsx
42
- * import { Chip } from '~/components/ui/Chip';
51
+ * import { Chip } from '@yahoo/uds-mobile';
43
52
  *
44
53
  * // Basic chip
45
54
  * <Chip>Label</Chip>
@@ -53,8 +62,21 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
53
62
  * // With icons
54
63
  * <Chip startIcon="Star" variant="brand">Favorite</Chip>
55
64
  * ```
65
+ *
66
+ * @usage
67
+ * - Filters: For multi-select filtering options
68
+ * - Tags: For displaying and removing tags
69
+ * - Actions: For quick contextual actions
70
+ *
71
+ * @accessibility
72
+ * - Toggle chips use `accessibilityRole="checkbox"` with checked state
73
+ * - Action chips use `accessibilityRole="button"`
74
+ * - Dismiss button has customizable `dismissButtonAriaLabel`
75
+ *
76
+ * @see {@link Badge} for non-interactive status indicators
77
+ * @see {@link Button} for primary actions
56
78
  */
57
- declare const Chip: react4.NamedExoticComponent<ChipProps>;
79
+ declare const Chip: react.NamedExoticComponent<ChipProps>;
58
80
  //#endregion
59
81
  export { Chip, type ChipProps };
60
82
  //# sourceMappingURL=Chip.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.cts","names":[],"sources":["../../src/components/Chip.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAYU,SAAA,SAAkB,KAAK;QACzB,IAAI;;EADF,OAAA,CAAA,EAGE,WAHQ;EAAa;EACrB,IAAA,CAAA,EAIH,QAJG;EAAJ,QAAA,CAAA,EAAA,MAAA;EAEI;EAEH,QAAA,CAAA,EAAA,MAAA;EAIK,SAAA,CAAA,EAAA,YAAA;EACF,OAAA,CAAA,EAAA,YAAA;EAYC,QAAM,CAAA,EAAA,OAAA;EAtBS;EAAI,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAiD1B;;;;;;;;aA3BO,KAAA,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;cA2Bb,MAAI,MAAA,CAAA,qBAAA"}
1
+ {"version":3,"file":"Chip.d.cts","names":[],"sources":["../../src/components/Chip.tsx"],"mappings":";;;;;;;;UAYU,SAAA,SAAkB,IAAA,CAAK,SAAA;;EAE/B,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,OAAA,GAAU,WAAA;;EAEV,IAAA,GAAO,QAAA;EAJG;EAMV,QAAA;EAJU;EAMV,QAAA;EAEY;EAAZ,SAAA,GAAY,YAAA;EAgBD;EAdX,OAAA,GAAU,YAAA;EAdoB;EAgB9B,QAAA;EAhB0B;EAkB1B,OAAA;EAhBA;EAkBA,SAAA;EAlBU;EAoBV,QAAA,IAAY,OAAA;EAlBF;EAoBV,SAAA;EAlBO;EAoBP,sBAAA;EAhBA;EAkBA,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;;;;;;;;;;;;;;;AAAS;;;;;;;;;;;;;;;;;;;;;;;;;;cA2CtB,IAAA,EAAI,KAAA,CAAA,oBAAA,CAAA,SAAA"}
@@ -1,22 +1,27 @@
1
1
 
2
2
  import { ChipSize, ChipVariant } from "../types/dist/index.mjs";
3
3
  import { IconSlotType } from "./IconSlot.mjs";
4
- import * as react18 from "react";
4
+ import * as react from "react";
5
5
  import { Ref } from "react";
6
6
  import { View, ViewProps } from "react-native";
7
7
 
8
8
  //#region src/components/Chip.d.ts
9
9
  interface ChipProps extends Omit<ViewProps, 'children'> {
10
+ /** Ref to the underlying View */
10
11
  ref?: Ref<View>;
11
- /** @default 'primary' */
12
+ /** The visual style variant @default 'primary' */
12
13
  variant?: ChipVariant;
13
- /** @default 'md' */
14
+ /** The size of the chip @default 'md' */
14
15
  size?: ChipSize;
16
+ /** Minimum width of the chip in pixels */
15
17
  minWidth?: number;
16
- /** @default 200 */
18
+ /** Maximum width of the chip in pixels @default 200 */
17
19
  maxWidth?: number;
20
+ /** Icon displayed at the start of the chip */
18
21
  startIcon?: IconSlotType;
22
+ /** Icon displayed at the end of the chip */
19
23
  endIcon?: IconSlotType;
24
+ /** Whether the chip is disabled */
20
25
  disabled?: boolean;
21
26
  /** Called when the chip is pressed. Makes the chip interactive. */
22
27
  onPress?: () => void;
@@ -28,6 +33,7 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
28
33
  onDismiss?: () => void;
29
34
  /** Accessibility label for the dismiss button. */
30
35
  dismissButtonAriaLabel?: string;
36
+ /** Chip label content */
31
37
  children?: React.ReactNode;
32
38
  }
33
39
  /**
@@ -37,9 +43,12 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
37
43
  * Chips help people make selections, filter content, or trigger actions.
38
44
  * They can be toggleable, dismissible, or simple pressable elements.
39
45
  *
46
+ * @category Interactive
47
+ * @platform mobile
48
+ *
40
49
  * @example
41
50
  * ```tsx
42
- * import { Chip } from '~/components/ui/Chip';
51
+ * import { Chip } from '@yahoo/uds-mobile';
43
52
  *
44
53
  * // Basic chip
45
54
  * <Chip>Label</Chip>
@@ -53,8 +62,21 @@ interface ChipProps extends Omit<ViewProps, 'children'> {
53
62
  * // With icons
54
63
  * <Chip startIcon="Star" variant="brand">Favorite</Chip>
55
64
  * ```
65
+ *
66
+ * @usage
67
+ * - Filters: For multi-select filtering options
68
+ * - Tags: For displaying and removing tags
69
+ * - Actions: For quick contextual actions
70
+ *
71
+ * @accessibility
72
+ * - Toggle chips use `accessibilityRole="checkbox"` with checked state
73
+ * - Action chips use `accessibilityRole="button"`
74
+ * - Dismiss button has customizable `dismissButtonAriaLabel`
75
+ *
76
+ * @see {@link Badge} for non-interactive status indicators
77
+ * @see {@link Button} for primary actions
56
78
  */
57
- declare const Chip: react18.NamedExoticComponent<ChipProps>;
79
+ declare const Chip: react.NamedExoticComponent<ChipProps>;
58
80
  //#endregion
59
81
  export { Chip, type ChipProps };
60
82
  //# sourceMappingURL=Chip.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.mts","names":[],"sources":["../../src/components/Chip.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAYU,SAAA,SAAkB,KAAK;QACzB,IAAI;;EADF,OAAA,CAAA,EAGE,WAHQ;EAAa;EACrB,IAAA,CAAA,EAIH,QAJG;EAAJ,QAAA,CAAA,EAAA,MAAA;EAEI;EAEH,QAAA,CAAA,EAAA,MAAA;EAIK,SAAA,CAAA,EAAA,YAAA;EACF,OAAA,CAAA,EAAA,YAAA;EAYC,QAAM,CAAA,EAAA,OAAA;EAtBS;EAAI,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAiD1B;;;;;;;;aA3BO,KAAA,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;cA2Bb,MAAI,OAAA,CAAA,qBAAA"}
1
+ {"version":3,"file":"Chip.d.mts","names":[],"sources":["../../src/components/Chip.tsx"],"mappings":";;;;;;;;UAYU,SAAA,SAAkB,IAAA,CAAK,SAAA;;EAE/B,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,OAAA,GAAU,WAAA;;EAEV,IAAA,GAAO,QAAA;EAJG;EAMV,QAAA;EAJU;EAMV,QAAA;EAEY;EAAZ,SAAA,GAAY,YAAA;EAgBD;EAdX,OAAA,GAAU,YAAA;EAdoB;EAgB9B,QAAA;EAhB0B;EAkB1B,OAAA;EAhBA;EAkBA,SAAA;EAlBU;EAoBV,QAAA,IAAY,OAAA;EAlBF;EAoBV,SAAA;EAlBO;EAoBP,sBAAA;EAhBA;EAkBA,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;;;;;;;;;;;;;;;AAAS;;;;;;;;;;;;;;;;;;;;;;;;;;cA2CtB,IAAA,EAAI,KAAA,CAAA,oBAAA,CAAA,SAAA"}
@@ -15,9 +15,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
15
  * Chips help people make selections, filter content, or trigger actions.
16
16
  * They can be toggleable, dismissible, or simple pressable elements.
17
17
  *
18
+ * @category Interactive
19
+ * @platform mobile
20
+ *
18
21
  * @example
19
22
  * ```tsx
20
- * import { Chip } from '~/components/ui/Chip';
23
+ * import { Chip } from '@yahoo/uds-mobile';
21
24
  *
22
25
  * // Basic chip
23
26
  * <Chip>Label</Chip>
@@ -31,8 +34,21 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
31
34
  * // With icons
32
35
  * <Chip startIcon="Star" variant="brand">Favorite</Chip>
33
36
  * ```
37
+ *
38
+ * @usage
39
+ * - Filters: For multi-select filtering options
40
+ * - Tags: For displaying and removing tags
41
+ * - Actions: For quick contextual actions
42
+ *
43
+ * @accessibility
44
+ * - Toggle chips use `accessibilityRole="checkbox"` with checked state
45
+ * - Action chips use `accessibilityRole="button"`
46
+ * - Dismiss button has customizable `dismissButtonAriaLabel`
47
+ *
48
+ * @see {@link Badge} for non-interactive status indicators
49
+ * @see {@link Button} for primary actions
34
50
  */
35
- const Chip = memo(function Chip$1({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, disabled = false, isToggled = false, onPress, onToggle, onDismiss, dismissButtonAriaLabel = "Dismiss", children, style, ref, ...rest }) {
51
+ const Chip = memo(function Chip({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, disabled = false, isToggled = false, onPress, onToggle, onDismiss, dismissButtonAriaLabel = "Dismiss", children, style, ref, ...rest }) {
36
52
  const isInteractive = Boolean(onPress || onToggle);
37
53
  const isDismissible = Boolean(onDismiss);
38
54
  const isDisabled = disabled;
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.mjs","names":["Chip"],"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?: Ref<View>;\n /** @default 'primary' */\n variant?: ChipVariant;\n /** @default 'md' */\n size?: ChipSize;\n minWidth?: number;\n /** @default 200 */\n maxWidth?: number;\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\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 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 * @example\n * ```tsx\n * import { Chip } from '~/components/ui/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 */\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,OAAO,KAAK,SAASA,OAAK,EAC9B,UAAU,WACV,OAAO,MACP,UACA,WAAW,KACX,WACA,SACA,WAAW,OACX,YAAY,OACZ,SACA,UACA,WACA,yBAAyB,WACzB,UACA,OACA,KACA,GAAG,QACS;CACZ,MAAM,gBAAgB,QAAQ,WAAW,SAAS;CAClD,MAAM,gBAAgB,QAAQ,UAAU;CACxC,MAAM,aAAa;CAEnB,MAAM,cAAc,YAAY,OAAO;AAKvC,YAAW,YAAY;EACrB;EACA,MAAM;EACN,aAAa;EACb,QAAQ;EACT,CAAC;CAEF,MAAM,cAAc,kBAAkB;AACpC,MAAI,WACF;AAGF,MAAI,SACF,UAAS,CAAC,UAAU;WACX,QACT,UAAS;IAEV;EAAC;EAAY;EAAU;EAAW;EAAQ,CAAC;CAE9C,MAAM,gBAAgB,kBAAkB;AACtC,MAAI,WACF;AAEF,eAAa;IACZ,CAAC,YAAY,UAAU,CAAC;CAE3B,MAAM,UACJ;EACG,aAAa,oBAAC;GAAS,MAAM;GAAW,SAAQ;GAAO,OAAO,WAAW;IAAQ;EAClF,oBAAC;GAAK,eAAe;GAAG,WAAU;GAAS,YAAW;GAAI,OAAO,WAAW;GACzE;IACI;EACN,gBACC,oBAAC;GACC,SAAS,aAAa,SAAY;GAClC,UAAU;GACV,oBAAoB;GACpB,mBAAkB;aAElB,oBAAC;IAAS,MAAM,WAAW;IAAS,SAAQ;IAAO,OAAO,WAAW;KAAQ;IACnE,GAEZ,WAAW,oBAAC;GAAS,MAAM;GAAS,SAAQ;GAAO,OAAO,WAAW;IAAQ;KAE9E;CAGL,MAAM,YAAY;EAChB,UAAU;EACV,SAAS,WAAW,YAAY;EACjC;CAGD,MAAM,cAAc;EAClB;EACA,OAHiB,cAAc,CAAC,WAAW,MAAM,MAAM,EAAE,CAAC,WAAW,MAAM,MAAM,CAAC;EAIlF,eAAe;EACf,YAAY;EACZ,UAAU;EACV,WAAW;EACX;EACA;EACA,UAAU;EACV,SAAS,aAAa,KAAM;EAC5B,oBAAoB;EACpB,GAAG;EACJ;AAGD,KAAI,cACF,QACE,oBAAC;EACC,SAAS;EACT,mBAAmB,WAAW,aAAa;EAC3C,GAAI;YAEH;GACS;AAKhB,QACE,oBAAC;EAAO,mBAAmB,gBAAgB,WAAW;EAAW,GAAI;EAAa,GAAI;YACnF;GACM;EAEX;AAEF,KAAK,cAAc"}
1
+ {"version":3,"file":"Chip.mjs","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAM,OAAO,KAAK,SAAS,KAAK,EAC9B,UAAU,WACV,OAAO,MACP,UACA,WAAW,KACX,WACA,SACA,WAAW,OACX,YAAY,OACZ,SACA,UACA,WACA,yBAAyB,WACzB,UACA,OACA,KACA,GAAG,QACS;CACZ,MAAM,gBAAgB,QAAQ,WAAW,SAAS;CAClD,MAAM,gBAAgB,QAAQ,UAAU;CACxC,MAAM,aAAa;CAEnB,MAAM,cAAc,YAAY,OAAO;AAKvC,YAAW,YAAY;EACrB;EACA,MAAM;EACN,aAAa;EACb,QAAQ;EACT,CAAC;CAEF,MAAM,cAAc,kBAAkB;AACpC,MAAI,WACF;AAGF,MAAI,SACF,UAAS,CAAC,UAAU;WACX,QACT,UAAS;IAEV;EAAC;EAAY;EAAU;EAAW;EAAQ,CAAC;CAE9C,MAAM,gBAAgB,kBAAkB;AACtC,MAAI,WACF;AAEF,eAAa;IACZ,CAAC,YAAY,UAAU,CAAC;CAE3B,MAAM,UACJ;EACG,aAAa,oBAAC;GAAS,MAAM;GAAW,SAAQ;GAAO,OAAO,WAAW;IAAQ;EAClF,oBAAC;GAAK,eAAe;GAAG,WAAU;GAAS,YAAW;GAAI,OAAO,WAAW;GACzE;IACI;EACN,gBACC,oBAAC;GACC,SAAS,aAAa,SAAY;GAClC,UAAU;GACV,oBAAoB;GACpB,mBAAkB;aAElB,oBAAC;IAAS,MAAM,WAAW;IAAS,SAAQ;IAAO,OAAO,WAAW;KAAQ;IACnE,GAEZ,WAAW,oBAAC;GAAS,MAAM;GAAS,SAAQ;GAAO,OAAO,WAAW;IAAQ;KAE9E;CAGL,MAAM,YAAY;EAChB,UAAU;EACV,SAAS,WAAW,YAAY;EACjC;CAGD,MAAM,cAAc;EAClB;EACA,OAHiB,cAAc,CAAC,WAAW,MAAM,MAAM,EAAE,CAAC,WAAW,MAAM,MAAM,CAAC;EAIlF,eAAe;EACf,YAAY;EACZ,UAAU;EACV,WAAW;EACX;EACA;EACA,UAAU;EACV,SAAS,aAAa,KAAM;EAC5B,oBAAoB;EACpB,GAAG;EACJ;AAGD,KAAI,cACF,QACE,oBAAC;EACC,SAAS;EACT,mBAAmB,WAAW,aAAa;EAC3C,GAAI;YAEH;GACS;AAKhB,QACE,oBAAC;EAAO,mBAAmB,gBAAgB,WAAW;EAAW,GAAI;EAAa,GAAI;YACnF;GACM;EAEX;AAEF,KAAK,cAAc"}
@@ -1,5 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
4
  const require_components_Box = require('./Box.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -12,6 +13,9 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
13
  * A convenience component for creating horizontal layouts. It's a Box with
13
14
  * `flexDirection="row"` preset.
14
15
  *
16
+ * @category Layout
17
+ * @platform mobile
18
+ *
15
19
  * @example
16
20
  * ```tsx
17
21
  * import { HStack } from '@yahoo/uds-mobile';
@@ -26,11 +30,10 @@ let react_jsx_runtime = require("react/jsx-runtime");
26
30
  * - Use for horizontal arrangements of elements
27
31
  * - Use gap prop for consistent spacing between children
28
32
  *
29
- * @see The {@link https://uds.build/docs/components/h-stack HStack Docs} for more info
30
- *
31
- * @related [VStack](https://uds.build/docs/components/v-stack), [Box](https://uds.build/docs/components/box)
33
+ * @see {@link VStack} for vertical layouts
34
+ * @see {@link Box} for custom flex layouts
32
35
  */
33
- const HStack = (0, react.memo)(function HStack$1({ gap, children, ref, ...props }) {
36
+ const HStack = (0, react.memo)(function HStack({ gap, children, ref, ...props }) {
34
37
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
35
38
  ref,
36
39
  flexDirection: "row",
@@ -1,13 +1,15 @@
1
1
 
2
2
  import { BoxProps } from "./Box.cjs";
3
- import * as react6 from "react";
3
+ import * as react from "react";
4
4
  import { Ref } from "react";
5
5
  import { View } from "react-native";
6
6
  import { StyleProps } from "../../generated/styles";
7
7
 
8
8
  //#region src/components/HStack.d.ts
9
9
  interface HStackProps extends Omit<BoxProps, 'ref'> {
10
+ /** Gap between child elements */
10
11
  gap?: StyleProps['columnGap'];
12
+ /** Ref to the underlying View */
11
13
  ref?: Ref<View>;
12
14
  }
13
15
  /**
@@ -17,6 +19,9 @@ interface HStackProps extends Omit<BoxProps, 'ref'> {
17
19
  * A convenience component for creating horizontal layouts. It's a Box with
18
20
  * `flexDirection="row"` preset.
19
21
  *
22
+ * @category Layout
23
+ * @platform mobile
24
+ *
20
25
  * @example
21
26
  * ```tsx
22
27
  * import { HStack } from '@yahoo/uds-mobile';
@@ -31,11 +36,10 @@ interface HStackProps extends Omit<BoxProps, 'ref'> {
31
36
  * - Use for horizontal arrangements of elements
32
37
  * - Use gap prop for consistent spacing between children
33
38
  *
34
- * @see The {@link https://uds.build/docs/components/h-stack HStack Docs} for more info
35
- *
36
- * @related [VStack](https://uds.build/docs/components/v-stack), [Box](https://uds.build/docs/components/box)
39
+ * @see {@link VStack} for vertical layouts
40
+ * @see {@link Box} for custom flex layouts
37
41
  */
38
- declare const HStack: react6.NamedExoticComponent<HStackProps>;
42
+ declare const HStack: react.NamedExoticComponent<HStackProps>;
39
43
  //#endregion
40
44
  export { HStack, type HStackProps };
41
45
  //# sourceMappingURL=HStack.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HStack.d.cts","names":[],"sources":["../../src/components/HStack.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAQU,WAAA,SAAoB,KAAK;QAC3B;QACA,IAAI;AAL0B;;;;;;;AAGJ;;;;;;;;;;;;;;;;;;;cA8B5B,QAAM,MAAA,CAAA,qBAAA"}
1
+ {"version":3,"file":"HStack.d.cts","names":[],"sources":["../../src/components/HStack.tsx"],"mappings":";;;;;;;;UAQU,WAAA,SAAoB,IAAA,CAAK,QAAA;;EAEjC,GAAA,GAAM,UAAA;EAFE;EAIR,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;;;;;;AAAI;;;;;;;;;;;cA8BV,MAAA,EAAM,KAAA,CAAA,oBAAA,CAAA,WAAA"}
@@ -1,13 +1,15 @@
1
1
 
2
2
  import { BoxProps } from "./Box.mjs";
3
- import * as react0 from "react";
3
+ import * as react from "react";
4
4
  import { Ref } from "react";
5
5
  import { View } from "react-native";
6
6
  import { StyleProps } from "../../generated/styles";
7
7
 
8
8
  //#region src/components/HStack.d.ts
9
9
  interface HStackProps extends Omit<BoxProps, 'ref'> {
10
+ /** Gap between child elements */
10
11
  gap?: StyleProps['columnGap'];
12
+ /** Ref to the underlying View */
11
13
  ref?: Ref<View>;
12
14
  }
13
15
  /**
@@ -17,6 +19,9 @@ interface HStackProps extends Omit<BoxProps, 'ref'> {
17
19
  * A convenience component for creating horizontal layouts. It's a Box with
18
20
  * `flexDirection="row"` preset.
19
21
  *
22
+ * @category Layout
23
+ * @platform mobile
24
+ *
20
25
  * @example
21
26
  * ```tsx
22
27
  * import { HStack } from '@yahoo/uds-mobile';
@@ -31,11 +36,10 @@ interface HStackProps extends Omit<BoxProps, 'ref'> {
31
36
  * - Use for horizontal arrangements of elements
32
37
  * - Use gap prop for consistent spacing between children
33
38
  *
34
- * @see The {@link https://uds.build/docs/components/h-stack HStack Docs} for more info
35
- *
36
- * @related [VStack](https://uds.build/docs/components/v-stack), [Box](https://uds.build/docs/components/box)
39
+ * @see {@link VStack} for vertical layouts
40
+ * @see {@link Box} for custom flex layouts
37
41
  */
38
- declare const HStack: react0.NamedExoticComponent<HStackProps>;
42
+ declare const HStack: react.NamedExoticComponent<HStackProps>;
39
43
  //#endregion
40
44
  export { HStack, type HStackProps };
41
45
  //# sourceMappingURL=HStack.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HStack.d.mts","names":[],"sources":["../../src/components/HStack.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAQU,WAAA,SAAoB,KAAK;QAC3B;QACA,IAAI;AAL0B;;;;;;;AAGJ;;;;;;;;;;;;;;;;;;;cA8B5B,QAAM,MAAA,CAAA,qBAAA"}
1
+ {"version":3,"file":"HStack.d.mts","names":[],"sources":["../../src/components/HStack.tsx"],"mappings":";;;;;;;;UAQU,WAAA,SAAoB,IAAA,CAAK,QAAA;;EAEjC,GAAA,GAAM,UAAA;EAFE;EAIR,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;;;;;;AAAI;;;;;;;;;;;cA8BV,MAAA,EAAM,KAAA,CAAA,oBAAA,CAAA,WAAA"}
@@ -11,6 +11,9 @@ import { jsx } from "react/jsx-runtime";
11
11
  * A convenience component for creating horizontal layouts. It's a Box with
12
12
  * `flexDirection="row"` preset.
13
13
  *
14
+ * @category Layout
15
+ * @platform mobile
16
+ *
14
17
  * @example
15
18
  * ```tsx
16
19
  * import { HStack } from '@yahoo/uds-mobile';
@@ -25,11 +28,10 @@ import { jsx } from "react/jsx-runtime";
25
28
  * - Use for horizontal arrangements of elements
26
29
  * - Use gap prop for consistent spacing between children
27
30
  *
28
- * @see The {@link https://uds.build/docs/components/h-stack HStack Docs} for more info
29
- *
30
- * @related [VStack](https://uds.build/docs/components/v-stack), [Box](https://uds.build/docs/components/box)
31
+ * @see {@link VStack} for vertical layouts
32
+ * @see {@link Box} for custom flex layouts
31
33
  */
32
- const HStack = memo(function HStack$1({ gap, children, ref, ...props }) {
34
+ const HStack = memo(function HStack({ gap, children, ref, ...props }) {
33
35
  return /* @__PURE__ */ jsx(Box, {
34
36
  ref,
35
37
  flexDirection: "row",
@@ -1 +1 @@
1
- {"version":3,"file":"HStack.mjs","names":["HStack"],"sources":["../../src/components/HStack.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo } from 'react';\nimport type { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport type { BoxProps } from './Box';\nimport { Box } from './Box';\n\ninterface HStackProps extends Omit<BoxProps, 'ref'> {\n gap?: StyleProps['columnGap'];\n ref?: Ref<View>;\n}\n\n/**\n * **📦 A horizontal stack layout component**\n *\n * @description\n * A convenience component for creating horizontal layouts. It's a Box with\n * `flexDirection=\"row\"` preset.\n *\n * @example\n * ```tsx\n * import { HStack } from '@yahoo/uds-mobile';\n *\n * <HStack gap=\"4\" alignItems=\"center\">\n * <Text>Item 1</Text>\n * <Text>Item 2</Text>\n * </HStack>\n * ```\n *\n * @usage\n * - Use for horizontal arrangements of elements\n * - Use gap prop for consistent spacing between children\n *\n * @see The {@link https://uds.build/docs/components/h-stack HStack Docs} for more info\n *\n * @related [VStack](https://uds.build/docs/components/v-stack), [Box](https://uds.build/docs/components/box)\n */\nconst HStack = memo(function HStack({ gap, children, ref, ...props }: HStackProps) {\n return (\n <Box ref={ref} flexDirection=\"row\" rowGap={gap} columnGap={gap} {...props}>\n {children}\n </Box>\n );\n});\n\nHStack.displayName = 'HStack';\n\nexport { HStack, type HStackProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,SAAS,KAAK,SAASA,SAAO,EAAE,KAAK,UAAU,KAAK,GAAG,SAAsB;AACjF,QACE,oBAAC;EAAS;EAAK,eAAc;EAAM,QAAQ;EAAK,WAAW;EAAK,GAAI;EACjE;GACG;EAER;AAEF,OAAO,cAAc"}
1
+ {"version":3,"file":"HStack.mjs","names":[],"sources":["../../src/components/HStack.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo } from 'react';\nimport type { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport type { BoxProps } from './Box';\nimport { Box } from './Box';\n\ninterface HStackProps extends Omit<BoxProps, 'ref'> {\n /** Gap between child elements */\n gap?: StyleProps['columnGap'];\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/**\n * **📦 A horizontal stack layout component**\n *\n * @description\n * A convenience component for creating horizontal layouts. It's a Box with\n * `flexDirection=\"row\"` preset.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { HStack } from '@yahoo/uds-mobile';\n *\n * <HStack gap=\"4\" alignItems=\"center\">\n * <Text>Item 1</Text>\n * <Text>Item 2</Text>\n * </HStack>\n * ```\n *\n * @usage\n * - Use for horizontal arrangements of elements\n * - Use gap prop for consistent spacing between children\n *\n * @see {@link VStack} for vertical layouts\n * @see {@link Box} for custom flex layouts\n */\nconst HStack = memo(function HStack({ gap, children, ref, ...props }: HStackProps) {\n return (\n <Box ref={ref} flexDirection=\"row\" rowGap={gap} columnGap={gap} {...props}>\n {children}\n </Box>\n );\n});\n\nHStack.displayName = 'HStack';\n\nexport { HStack, type HStackProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAS,KAAK,SAAS,OAAO,EAAE,KAAK,UAAU,KAAK,GAAG,SAAsB;AACjF,QACE,oBAAC;EAAS;EAAK,eAAc;EAAM,QAAQ;EAAK,WAAW;EAAK,GAAI;EACjE;GACG;EAER;AAEF,OAAO,cAAc"}