@yahoo/uds-mobile 2.23.3 → 2.24.0-beta.10

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 (298) hide show
  1. package/README.md +41 -13
  2. package/dist/bin/automated-config/dist/generated/generatedConfigs.mjs +92 -46
  3. package/dist/components/Avatar/AvatarIcon.cjs +8 -2
  4. package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -1
  5. package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -1
  6. package/dist/components/Avatar/AvatarIcon.js +9 -3
  7. package/dist/components/Avatar/AvatarIcon.js.map +1 -1
  8. package/dist/components/Avatar/AvatarImage.cjs +9 -2
  9. package/dist/components/Avatar/AvatarImage.d.cts.map +1 -1
  10. package/dist/components/Avatar/AvatarImage.d.ts.map +1 -1
  11. package/dist/components/Avatar/AvatarImage.js +10 -3
  12. package/dist/components/Avatar/AvatarImage.js.map +1 -1
  13. package/dist/components/Avatar/AvatarText.cjs +8 -2
  14. package/dist/components/Avatar/AvatarText.d.cts.map +1 -1
  15. package/dist/components/Avatar/AvatarText.d.ts.map +1 -1
  16. package/dist/components/Avatar/AvatarText.js +9 -3
  17. package/dist/components/Avatar/AvatarText.js.map +1 -1
  18. package/dist/components/Avatar/types.d.cts +7 -3
  19. package/dist/components/Avatar/types.d.cts.map +1 -1
  20. package/dist/components/Avatar/types.d.ts +7 -3
  21. package/dist/components/Avatar/types.d.ts.map +1 -1
  22. package/dist/components/Avatar/useAvatarFontScale.cjs +16 -0
  23. package/dist/components/Avatar/useAvatarFontScale.d.cts +7 -0
  24. package/dist/components/Avatar/useAvatarFontScale.d.cts.map +1 -0
  25. package/dist/components/Avatar/useAvatarFontScale.d.ts +7 -0
  26. package/dist/components/Avatar/useAvatarFontScale.d.ts.map +1 -0
  27. package/dist/components/Avatar/useAvatarFontScale.js +16 -0
  28. package/dist/components/Avatar/useAvatarFontScale.js.map +1 -0
  29. package/dist/components/Avatar/utils.cjs +9 -6
  30. package/dist/components/Avatar/utils.d.cts +2 -2
  31. package/dist/components/Avatar/utils.d.cts.map +1 -1
  32. package/dist/components/Avatar/utils.d.ts +2 -2
  33. package/dist/components/Avatar/utils.d.ts.map +1 -1
  34. package/dist/components/Avatar/utils.js +9 -6
  35. package/dist/components/Avatar/utils.js.map +1 -1
  36. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  37. package/dist/components/BottomSheet/BottomSheet.js +1 -1
  38. package/dist/components/Button/buttonTheme.cjs +31 -9
  39. package/dist/components/Button/buttonTheme.d.cts +24 -5
  40. package/dist/components/Button/buttonTheme.d.cts.map +1 -1
  41. package/dist/components/Button/buttonTheme.d.ts +24 -5
  42. package/dist/components/Button/buttonTheme.d.ts.map +1 -1
  43. package/dist/components/Button/buttonTheme.js +31 -10
  44. package/dist/components/Button/buttonTheme.js.map +1 -1
  45. package/dist/components/Button.cjs +35 -8
  46. package/dist/components/Button.d.cts +7 -0
  47. package/dist/components/Button.d.cts.map +1 -1
  48. package/dist/components/Button.d.ts +7 -0
  49. package/dist/components/Button.d.ts.map +1 -1
  50. package/dist/components/Button.js +35 -8
  51. package/dist/components/Button.js.map +1 -1
  52. package/dist/components/Checkbox.cjs +42 -9
  53. package/dist/components/Checkbox.d.cts +7 -0
  54. package/dist/components/Checkbox.d.cts.map +1 -1
  55. package/dist/components/Checkbox.d.ts +7 -0
  56. package/dist/components/Checkbox.d.ts.map +1 -1
  57. package/dist/components/Checkbox.js +42 -9
  58. package/dist/components/Checkbox.js.map +1 -1
  59. package/dist/components/Chip/ChipBase.cjs +31 -14
  60. package/dist/components/Chip/ChipBase.d.cts.map +1 -1
  61. package/dist/components/Chip/ChipBase.d.ts.map +1 -1
  62. package/dist/components/Chip/ChipBase.js +31 -14
  63. package/dist/components/Chip/ChipBase.js.map +1 -1
  64. package/dist/components/Chip/ChipDismissible.cjs +3 -1
  65. package/dist/components/Chip/ChipDismissible.js +3 -1
  66. package/dist/components/Chip/ChipDismissible.js.map +1 -1
  67. package/dist/components/Chip/types.d.cts +7 -0
  68. package/dist/components/Chip/types.d.cts.map +1 -1
  69. package/dist/components/Chip/types.d.ts +7 -0
  70. package/dist/components/Chip/types.d.ts.map +1 -1
  71. package/dist/components/Icon.cjs +24 -5
  72. package/dist/components/Icon.d.cts +11 -2
  73. package/dist/components/Icon.d.cts.map +1 -1
  74. package/dist/components/Icon.d.ts +11 -2
  75. package/dist/components/Icon.d.ts.map +1 -1
  76. package/dist/components/Icon.js +24 -5
  77. package/dist/components/Icon.js.map +1 -1
  78. package/dist/components/IconButton.cjs +17 -6
  79. package/dist/components/IconButton.d.cts +6 -0
  80. package/dist/components/IconButton.d.cts.map +1 -1
  81. package/dist/components/IconButton.d.ts +6 -0
  82. package/dist/components/IconButton.d.ts.map +1 -1
  83. package/dist/components/IconButton.js +18 -7
  84. package/dist/components/IconButton.js.map +1 -1
  85. package/dist/components/Input.cjs +56 -18
  86. package/dist/components/Input.d.cts +5 -0
  87. package/dist/components/Input.d.cts.map +1 -1
  88. package/dist/components/Input.d.ts +5 -0
  89. package/dist/components/Input.d.ts.map +1 -1
  90. package/dist/components/Input.js +56 -18
  91. package/dist/components/Input.js.map +1 -1
  92. package/dist/components/InputHelpText.cjs +7 -1
  93. package/dist/components/InputHelpText.d.cts +2 -0
  94. package/dist/components/InputHelpText.d.cts.map +1 -1
  95. package/dist/components/InputHelpText.d.ts +2 -0
  96. package/dist/components/InputHelpText.d.ts.map +1 -1
  97. package/dist/components/InputHelpText.js +7 -1
  98. package/dist/components/InputHelpText.js.map +1 -1
  99. package/dist/components/Link.cjs +13 -1
  100. package/dist/components/Link.d.cts +7 -0
  101. package/dist/components/Link.d.cts.map +1 -1
  102. package/dist/components/Link.d.ts +7 -0
  103. package/dist/components/Link.d.ts.map +1 -1
  104. package/dist/components/Link.js +13 -1
  105. package/dist/components/Link.js.map +1 -1
  106. package/dist/components/Pagination/Pagination.cjs +18 -10
  107. package/dist/components/Pagination/Pagination.d.cts +2 -0
  108. package/dist/components/Pagination/Pagination.d.cts.map +1 -1
  109. package/dist/components/Pagination/Pagination.d.ts +2 -0
  110. package/dist/components/Pagination/Pagination.d.ts.map +1 -1
  111. package/dist/components/Pagination/Pagination.js +18 -10
  112. package/dist/components/Pagination/Pagination.js.map +1 -1
  113. package/dist/components/Pagination/PaginationEllipsis.cjs +8 -2
  114. package/dist/components/Pagination/PaginationEllipsis.d.cts.map +1 -1
  115. package/dist/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
  116. package/dist/components/Pagination/PaginationEllipsis.js +9 -3
  117. package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
  118. package/dist/components/Pagination/PaginationItem.cjs +2 -1
  119. package/dist/components/Pagination/PaginationItem.js +2 -1
  120. package/dist/components/Pagination/PaginationItem.js.map +1 -1
  121. package/dist/components/Pagination/PaginationLink.cjs +2 -1
  122. package/dist/components/Pagination/PaginationLink.js +2 -1
  123. package/dist/components/Pagination/PaginationLink.js.map +1 -1
  124. package/dist/components/Pagination/PaginationNext.cjs +3 -1
  125. package/dist/components/Pagination/PaginationNext.js +3 -1
  126. package/dist/components/Pagination/PaginationNext.js.map +1 -1
  127. package/dist/components/Pagination/PaginationPrev.cjs +3 -1
  128. package/dist/components/Pagination/PaginationPrev.js +3 -1
  129. package/dist/components/Pagination/PaginationPrev.js.map +1 -1
  130. package/dist/components/Pagination/paginationContext.d.cts +2 -0
  131. package/dist/components/Pagination/paginationContext.d.cts.map +1 -1
  132. package/dist/components/Pagination/paginationContext.d.ts +2 -0
  133. package/dist/components/Pagination/paginationContext.d.ts.map +1 -1
  134. package/dist/components/Pagination/paginationContext.js.map +1 -1
  135. package/dist/components/Pagination/usePaginationControlStyles.cjs +8 -1
  136. package/dist/components/Pagination/usePaginationControlStyles.d.cts.map +1 -1
  137. package/dist/components/Pagination/usePaginationControlStyles.d.ts.map +1 -1
  138. package/dist/components/Pagination/usePaginationControlStyles.js +9 -2
  139. package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
  140. package/dist/components/Radio/Radio.cjs +30 -11
  141. package/dist/components/Radio/Radio.d.cts +7 -0
  142. package/dist/components/Radio/Radio.d.cts.map +1 -1
  143. package/dist/components/Radio/Radio.d.ts +7 -0
  144. package/dist/components/Radio/Radio.d.ts.map +1 -1
  145. package/dist/components/Radio/Radio.js +30 -11
  146. package/dist/components/Radio/Radio.js.map +1 -1
  147. package/dist/components/Select/Select.cjs +29 -6
  148. package/dist/components/Select/Select.d.cts +2 -0
  149. package/dist/components/Select/Select.d.cts.map +1 -1
  150. package/dist/components/Select/Select.d.ts +2 -0
  151. package/dist/components/Select/Select.d.ts.map +1 -1
  152. package/dist/components/Select/Select.js +29 -6
  153. package/dist/components/Select/Select.js.map +1 -1
  154. package/dist/components/Select/SelectContent.cjs +31 -23
  155. package/dist/components/Select/SelectContent.d.cts.map +1 -1
  156. package/dist/components/Select/SelectContent.d.ts.map +1 -1
  157. package/dist/components/Select/SelectContent.js +32 -24
  158. package/dist/components/Select/SelectContent.js.map +1 -1
  159. package/dist/components/Select/SelectItem.cjs +25 -15
  160. package/dist/components/Select/SelectItem.d.cts.map +1 -1
  161. package/dist/components/Select/SelectItem.d.ts.map +1 -1
  162. package/dist/components/Select/SelectItem.js +25 -15
  163. package/dist/components/Select/SelectItem.js.map +1 -1
  164. package/dist/components/Select/SelectTrigger.cjs +27 -13
  165. package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
  166. package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
  167. package/dist/components/Select/SelectTrigger.js +27 -13
  168. package/dist/components/Select/SelectTrigger.js.map +1 -1
  169. package/dist/components/Select/types.d.cts +2 -0
  170. package/dist/components/Select/types.d.cts.map +1 -1
  171. package/dist/components/Select/types.d.ts +2 -0
  172. package/dist/components/Select/types.d.ts.map +1 -1
  173. package/dist/components/Switch.cjs +48 -8
  174. package/dist/components/Switch.d.cts +7 -0
  175. package/dist/components/Switch.d.cts.map +1 -1
  176. package/dist/components/Switch.d.ts +7 -0
  177. package/dist/components/Switch.d.ts.map +1 -1
  178. package/dist/components/Switch.js +48 -8
  179. package/dist/components/Switch.js.map +1 -1
  180. package/dist/components/Tabs/Tab.cjs +17 -3
  181. package/dist/components/Tabs/Tab.d.cts.map +1 -1
  182. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  183. package/dist/components/Tabs/Tab.js +17 -3
  184. package/dist/components/Tabs/Tab.js.map +1 -1
  185. package/dist/components/Tabs/Tabs.cjs +8 -3
  186. package/dist/components/Tabs/Tabs.d.cts +9 -1
  187. package/dist/components/Tabs/Tabs.d.cts.map +1 -1
  188. package/dist/components/Tabs/Tabs.d.ts +9 -1
  189. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  190. package/dist/components/Tabs/Tabs.js +8 -3
  191. package/dist/components/Tabs/Tabs.js.map +1 -1
  192. package/dist/components/Tabs/tabsContexts.d.cts +2 -0
  193. package/dist/components/Tabs/tabsContexts.d.cts.map +1 -1
  194. package/dist/components/Tabs/tabsContexts.d.ts +2 -0
  195. package/dist/components/Tabs/tabsContexts.d.ts.map +1 -1
  196. package/dist/components/Tabs/tabsContexts.js.map +1 -1
  197. package/dist/components/Text.cjs +9 -1
  198. package/dist/components/Text.d.cts +11 -2
  199. package/dist/components/Text.d.cts.map +1 -1
  200. package/dist/components/Text.d.ts +11 -2
  201. package/dist/components/Text.d.ts.map +1 -1
  202. package/dist/components/Text.js +9 -1
  203. package/dist/components/Text.js.map +1 -1
  204. package/dist/components/UDSProvider.cjs +6 -2
  205. package/dist/components/UDSProvider.d.cts +9 -0
  206. package/dist/components/UDSProvider.d.cts.map +1 -1
  207. package/dist/components/UDSProvider.d.ts +9 -0
  208. package/dist/components/UDSProvider.d.ts.map +1 -1
  209. package/dist/components/UDSProvider.js +6 -2
  210. package/dist/components/UDSProvider.js.map +1 -1
  211. package/dist/components/internal/Overlay/index.cjs +1 -1
  212. package/dist/components/internal/Overlay/index.js +1 -1
  213. package/dist/fontScaling/FontScalingContext.cjs +67 -0
  214. package/dist/fontScaling/FontScalingContext.d.cts +53 -0
  215. package/dist/fontScaling/FontScalingContext.d.cts.map +1 -0
  216. package/dist/fontScaling/FontScalingContext.d.ts +53 -0
  217. package/dist/fontScaling/FontScalingContext.d.ts.map +1 -0
  218. package/dist/fontScaling/FontScalingContext.js +63 -0
  219. package/dist/fontScaling/FontScalingContext.js.map +1 -0
  220. package/dist/fontScaling/androidNonlinearFontScaling.cjs +250 -0
  221. package/dist/fontScaling/androidNonlinearFontScaling.d.cts +7 -0
  222. package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -0
  223. package/dist/fontScaling/androidNonlinearFontScaling.d.ts +7 -0
  224. package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -0
  225. package/dist/fontScaling/androidNonlinearFontScaling.js +251 -0
  226. package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -0
  227. package/dist/fontScaling/constants.cjs +106 -0
  228. package/dist/fontScaling/constants.d.cts +60 -0
  229. package/dist/fontScaling/constants.d.cts.map +1 -0
  230. package/dist/fontScaling/constants.d.ts +60 -0
  231. package/dist/fontScaling/constants.d.ts.map +1 -0
  232. package/dist/fontScaling/constants.js +103 -0
  233. package/dist/fontScaling/constants.js.map +1 -0
  234. package/dist/fontScaling/index.cjs +14 -0
  235. package/dist/fontScaling/index.d.cts +8 -0
  236. package/dist/fontScaling/index.d.ts +8 -0
  237. package/dist/fontScaling/index.js +6 -0
  238. package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +37 -0
  239. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +35 -0
  240. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -0
  241. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +35 -0
  242. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -0
  243. package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +38 -0
  244. package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -0
  245. package/dist/fontScaling/types.cjs +1 -0
  246. package/dist/fontScaling/types.d.cts +54 -0
  247. package/dist/fontScaling/types.d.cts.map +1 -0
  248. package/dist/fontScaling/types.d.ts +54 -0
  249. package/dist/fontScaling/types.d.ts.map +1 -0
  250. package/dist/fontScaling/types.js +1 -0
  251. package/dist/fontScaling/useFontScale.cjs +58 -0
  252. package/dist/fontScaling/useFontScale.d.cts +12 -0
  253. package/dist/fontScaling/useFontScale.d.cts.map +1 -0
  254. package/dist/fontScaling/useFontScale.d.ts +12 -0
  255. package/dist/fontScaling/useFontScale.d.ts.map +1 -0
  256. package/dist/fontScaling/useFontScale.js +57 -0
  257. package/dist/fontScaling/useFontScale.js.map +1 -0
  258. package/dist/fontScaling/useMaxFontSizeMultiplier.cjs +24 -0
  259. package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts +16 -0
  260. package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts.map +1 -0
  261. package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts +16 -0
  262. package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts.map +1 -0
  263. package/dist/fontScaling/useMaxFontSizeMultiplier.js +24 -0
  264. package/dist/fontScaling/useMaxFontSizeMultiplier.js.map +1 -0
  265. package/dist/jest/mocks/react-native.cjs +19 -4
  266. package/dist/jest/mocks/react-native.d.cts +8 -5
  267. package/dist/jest/mocks/react-native.d.cts.map +1 -1
  268. package/dist/jest/mocks/react-native.d.ts +8 -5
  269. package/dist/jest/mocks/react-native.d.ts.map +1 -1
  270. package/dist/jest/mocks/react-native.js +18 -5
  271. package/dist/jest/mocks/react-native.js.map +1 -1
  272. package/dist/jest/mocks/styles.cjs +28 -1
  273. package/dist/jest/mocks/styles.d.cts.map +1 -1
  274. package/dist/jest/mocks/styles.d.ts.map +1 -1
  275. package/dist/jest/mocks/styles.js +28 -1
  276. package/dist/jest/mocks/styles.js.map +1 -1
  277. package/dist/jest/setup.cjs +4 -0
  278. package/dist/jest/setup.d.cts.map +1 -1
  279. package/dist/jest/setup.d.ts.map +1 -1
  280. package/dist/jest/setup.js +4 -0
  281. package/dist/jest/setup.js.map +1 -1
  282. package/dist/mobile/generated/fontMetrics.cjs +530 -530
  283. package/dist/mobile/generated/fontMetrics.js +530 -530
  284. package/dist/mobile/generated/fontMetrics.js.map +1 -1
  285. package/dist/portal.cjs +8 -2
  286. package/dist/portal.d.cts.map +1 -1
  287. package/dist/portal.d.ts.map +1 -1
  288. package/dist/portal.js +8 -2
  289. package/dist/portal.js.map +1 -1
  290. package/dist/types/dist/index.d.cts.map +1 -1
  291. package/dist/types/dist/index.d.ts.map +1 -1
  292. package/fonts/index.cjs +214 -214
  293. package/fonts/index.mjs +214 -214
  294. package/fonts/uds-icons.ttf +0 -0
  295. package/generated/fontMetrics.ts +530 -530
  296. package/generated/styles.d.ts +5 -28
  297. package/generated/unistyles.d.ts +0 -27
  298. package/package.json +11 -1
@@ -3,12 +3,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
4
4
  const require_index = require("../motion-tokens/dist/index.cjs");
5
5
  const require_motion = require("../motion.cjs");
6
+ const require_fontScaling_useFontScale = require("../fontScaling/useFontScale.cjs");
7
+ const require_fontScaling_useMaxFontSizeMultiplier = require("../fontScaling/useMaxFontSizeMultiplier.cjs");
8
+ const require_components_Button_buttonTheme = require("./Button/buttonTheme.cjs");
6
9
  const require_components_Icon = require("./Icon.cjs");
7
10
  const require_components_Pressable = require("./Pressable.cjs");
8
11
  const require_components_FormLabel = require("./FormLabel.cjs");
9
12
  let react = require("react");
10
13
  let react_jsx_runtime = require("react/jsx-runtime");
11
14
  let generated_styles = require("../../generated/styles");
15
+ let _yahoo_uds_icons_tokens = require("@yahoo/uds-icons/tokens");
12
16
  let react_native_reanimated = require("react-native-reanimated");
13
17
  react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
14
18
  //#region src/components/Checkbox.tsx
@@ -50,8 +54,9 @@ const VARIANT_ERROR_MAP = {
50
54
  * @see {@link Radio} for single-select options
51
55
  * @see {@link Switch} for binary toggles
52
56
  */
53
- const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
57
+ const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, maxFontSizeMultiplier, onChange, ref, ...viewProps }) {
54
58
  const uid = `uds-checkbox-${(0, react.useId)()}`;
59
+ const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
55
60
  const isControlled = checkedProp !== void 0;
56
61
  const [internalChecked, setInternalChecked] = (0, react.useState)(isControlled ? checkedProp : defaultChecked ?? false);
57
62
  const [pressed, setPressed] = (0, react.useState)(false);
@@ -90,15 +95,33 @@ const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "sta
90
95
  disabled,
91
96
  pressed
92
97
  });
98
+ const boxBaseSize = generated_styles.checkboxStyles.checkbox.width;
99
+ const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof boxBaseSize === "number" ? boxBaseSize : void 0);
100
+ const markScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, _yahoo_uds_icons_tokens.ICON_SIZE_MAP.sm);
101
+ const scaledMarkSize = Math.round(_yahoo_uds_icons_tokens.ICON_SIZE_MAP.sm * markScaleFactor);
102
+ const hasScaledLayout = fontScaleFactor !== 1;
93
103
  const rootStyle = (0, react.useMemo)(() => [generated_styles.checkboxStyles.root, { opacity: disabled ? .5 : 1 }], [generated_styles.checkboxStyles.root, disabled]);
94
- const checkboxBoxStyle = (0, react.useMemo)(() => [
104
+ const checkboxBoxStyle = (0, react.useMemo)(() => {
105
+ const { width, height, borderRadius } = generated_styles.checkboxStyles.checkbox;
106
+ const scaledBox = fontScaleFactor !== 1 && typeof width === "number" && typeof height === "number" ? {
107
+ width: Math.round(width * fontScaleFactor),
108
+ height: Math.round(height * fontScaleFactor),
109
+ ...typeof borderRadius === "number" && { borderRadius: Math.round(borderRadius * fontScaleFactor) }
110
+ } : void 0;
111
+ return [
112
+ generated_styles.checkboxStyles.checkbox,
113
+ scaledBox,
114
+ {
115
+ alignItems: "center",
116
+ justifyContent: "center"
117
+ },
118
+ checkboxAnimatedStyle
119
+ ];
120
+ }, [
95
121
  generated_styles.checkboxStyles.checkbox,
96
- {
97
- alignItems: "center",
98
- justifyContent: "center"
99
- },
122
+ fontScaleFactor,
100
123
  checkboxAnimatedStyle
101
- ], [generated_styles.checkboxStyles.checkbox, checkboxAnimatedStyle]);
124
+ ]);
102
125
  const labelContent = (0, react.useMemo)(() => {
103
126
  if (!label) return null;
104
127
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
@@ -108,12 +131,16 @@ const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "sta
108
131
  required,
109
132
  showRequiredAsterisk: required,
110
133
  hasError,
134
+ flexShrink: hasScaledLayout ? "1" : void 0,
135
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
111
136
  style: generated_styles.checkboxStyles.text
112
137
  });
113
138
  }, [
114
139
  label,
115
140
  required,
116
141
  hasError,
142
+ hasScaledLayout,
143
+ resolvedMaxFontSizeMultiplier,
117
144
  generated_styles.checkboxStyles.text
118
145
  ]);
119
146
  const a11yState = (0, react.useMemo)(() => ({
@@ -129,7 +156,8 @@ const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "sta
129
156
  disabled,
130
157
  flexDirection: labelPosition === "start" ? "row" : "row-reverse",
131
158
  alignItems: "center",
132
- alignSelf: "flex-start",
159
+ alignSelf: hasScaledLayout ? "stretch" : "flex-start",
160
+ minHeight: hasScaledLayout ? 52 : void 0,
133
161
  accessibilityRole: "checkbox",
134
162
  accessibilityState: a11yState,
135
163
  accessibilityLabel: typeof label === "string" ? label : void 0,
@@ -140,7 +168,12 @@ const Checkbox = (0, react.memo)(function Checkbox({ label, labelPosition = "sta
140
168
  children: showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
141
169
  name: iconName,
142
170
  size: "sm",
143
- style: generated_styles.checkboxStyles.checkboxIcon
171
+ dangerouslySetSize: scaledMarkSize,
172
+ allowFontScaling: false,
173
+ style: [generated_styles.checkboxStyles.checkboxIcon, markScaleFactor !== 1 ? {
174
+ fontSize: scaledMarkSize,
175
+ lineHeight: require_components_Button_buttonTheme.getSafeIconCell(scaledMarkSize)
176
+ } : void 0]
144
177
  })
145
178
  }), labelContent]
146
179
  });
@@ -14,6 +14,13 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
14
14
  disabled?: boolean;
15
15
  /** Whether the checkbox is required */
16
16
  required?: boolean;
17
+ /**
18
+ * Caps how far the box, checkmark, and label grow with the OS text-size
19
+ * setting; all three scale by the same factor. Set null to remove the cap;
20
+ * override app-wide via UDSFontScalingProvider.
21
+ * @default 2
22
+ */
23
+ maxFontSizeMultiplier?: number | null;
17
24
  /** Callback fired when the checked state changes */
18
25
  onChange?: (checked: boolean) => void;
19
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.cts","names":[],"sources":["../../src/components/Checkbox.tsx"],"mappings":";;;;;;;UAmBU,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,OAAA,CAAA,oBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"Checkbox.d.cts","names":[],"sources":["../../src/components/Checkbox.tsx"],"mappings":";;;;;;;UAuBU,aAAA,SAAsB,IAAA,CAAK,SAAA,YAAqB,sBAAA;;EAExD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,cAAA;;EAEA,QAAA;EAJU;EAMV,QAAA;EAR8B;;;;;;EAe9B,qBAAA;EAbA;EAeA,QAAA,IAAY,OAAA;AAAA;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;cAqDxB,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
@@ -14,6 +14,13 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
14
14
  disabled?: boolean;
15
15
  /** Whether the checkbox is required */
16
16
  required?: boolean;
17
+ /**
18
+ * Caps how far the box, checkmark, and label grow with the OS text-size
19
+ * setting; all three scale by the same factor. Set null to remove the cap;
20
+ * override app-wide via UDSFontScalingProvider.
21
+ * @default 2
22
+ */
23
+ maxFontSizeMultiplier?: number | null;
17
24
  /** Callback fired when the checked state changes */
18
25
  onChange?: (checked: boolean) => void;
19
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","names":[],"sources":["../../src/components/Checkbox.tsx"],"mappings":";;;;;;;UAmBU,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,OAAA,CAAA,oBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"Checkbox.d.ts","names":[],"sources":["../../src/components/Checkbox.tsx"],"mappings":";;;;;;;UAuBU,aAAA,SAAsB,IAAA,CAAK,SAAA,YAAqB,sBAAA;;EAExD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,cAAA;;EAEA,QAAA;EAJU;EAMV,QAAA;EAR8B;;;;;;EAe9B,qBAAA;EAbA;EAeA,QAAA,IAAY,OAAA;AAAA;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;cAqDxB,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
@@ -1,12 +1,16 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
2
  import { SCALE_EFFECTS } from "../motion-tokens/dist/index.js";
3
3
  import { BUTTON_SPRING_CONFIG } from "../motion.js";
4
+ import { useComponentFontScale } from "../fontScaling/useFontScale.js";
5
+ import { useMaxFontSizeMultiplier } from "../fontScaling/useMaxFontSizeMultiplier.js";
6
+ import { getSafeIconCell } from "./Button/buttonTheme.js";
4
7
  import { Icon } from "./Icon.js";
5
8
  import { Pressable } from "./Pressable.js";
6
9
  import { FormLabel } from "./FormLabel.js";
7
10
  import { memo, useCallback, useId, useMemo, useState } from "react";
8
11
  import { jsx, jsxs } from "react/jsx-runtime";
9
12
  import { checkboxStyles } from "../../generated/styles";
13
+ import { ICON_SIZE_MAP } from "@yahoo/uds-icons/tokens";
10
14
  import Animated, { useAnimatedStyle, useDerivedValue, withSpring } from "react-native-reanimated";
11
15
  //#region src/components/Checkbox.tsx
12
16
  const VARIANT_ERROR_MAP = {
@@ -47,8 +51,9 @@ const VARIANT_ERROR_MAP = {
47
51
  * @see {@link Radio} for single-select options
48
52
  * @see {@link Switch} for binary toggles
49
53
  */
50
- const Checkbox = memo(function Checkbox({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
54
+ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, maxFontSizeMultiplier, onChange, ref, ...viewProps }) {
51
55
  const uid = `uds-checkbox-${useId()}`;
56
+ const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
52
57
  const isControlled = checkedProp !== void 0;
53
58
  const [internalChecked, setInternalChecked] = useState(isControlled ? checkedProp : defaultChecked ?? false);
54
59
  const [pressed, setPressed] = useState(false);
@@ -87,15 +92,33 @@ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", varian
87
92
  disabled,
88
93
  pressed
89
94
  });
95
+ const boxBaseSize = checkboxStyles.checkbox.width;
96
+ const fontScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof boxBaseSize === "number" ? boxBaseSize : void 0);
97
+ const markScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, ICON_SIZE_MAP.sm);
98
+ const scaledMarkSize = Math.round(ICON_SIZE_MAP.sm * markScaleFactor);
99
+ const hasScaledLayout = fontScaleFactor !== 1;
90
100
  const rootStyle = useMemo(() => [checkboxStyles.root, { opacity: disabled ? .5 : 1 }], [checkboxStyles.root, disabled]);
91
- const checkboxBoxStyle = useMemo(() => [
101
+ const checkboxBoxStyle = useMemo(() => {
102
+ const { width, height, borderRadius } = checkboxStyles.checkbox;
103
+ const scaledBox = fontScaleFactor !== 1 && typeof width === "number" && typeof height === "number" ? {
104
+ width: Math.round(width * fontScaleFactor),
105
+ height: Math.round(height * fontScaleFactor),
106
+ ...typeof borderRadius === "number" && { borderRadius: Math.round(borderRadius * fontScaleFactor) }
107
+ } : void 0;
108
+ return [
109
+ checkboxStyles.checkbox,
110
+ scaledBox,
111
+ {
112
+ alignItems: "center",
113
+ justifyContent: "center"
114
+ },
115
+ checkboxAnimatedStyle
116
+ ];
117
+ }, [
92
118
  checkboxStyles.checkbox,
93
- {
94
- alignItems: "center",
95
- justifyContent: "center"
96
- },
119
+ fontScaleFactor,
97
120
  checkboxAnimatedStyle
98
- ], [checkboxStyles.checkbox, checkboxAnimatedStyle]);
121
+ ]);
99
122
  const labelContent = useMemo(() => {
100
123
  if (!label) return null;
101
124
  return /* @__PURE__ */ jsx(FormLabel, {
@@ -105,12 +128,16 @@ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", varian
105
128
  required,
106
129
  showRequiredAsterisk: required,
107
130
  hasError,
131
+ flexShrink: hasScaledLayout ? "1" : void 0,
132
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
108
133
  style: checkboxStyles.text
109
134
  });
110
135
  }, [
111
136
  label,
112
137
  required,
113
138
  hasError,
139
+ hasScaledLayout,
140
+ resolvedMaxFontSizeMultiplier,
114
141
  checkboxStyles.text
115
142
  ]);
116
143
  const a11yState = useMemo(() => ({
@@ -126,7 +153,8 @@ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", varian
126
153
  disabled,
127
154
  flexDirection: labelPosition === "start" ? "row" : "row-reverse",
128
155
  alignItems: "center",
129
- alignSelf: "flex-start",
156
+ alignSelf: hasScaledLayout ? "stretch" : "flex-start",
157
+ minHeight: hasScaledLayout ? 52 : void 0,
130
158
  accessibilityRole: "checkbox",
131
159
  accessibilityState: a11yState,
132
160
  accessibilityLabel: typeof label === "string" ? label : void 0,
@@ -137,7 +165,12 @@ const Checkbox = memo(function Checkbox({ label, labelPosition = "start", varian
137
165
  children: showIcon && /* @__PURE__ */ jsx(Icon, {
138
166
  name: iconName,
139
167
  size: "sm",
140
- style: checkboxStyles.checkboxIcon
168
+ dangerouslySetSize: scaledMarkSize,
169
+ allowFontScaling: false,
170
+ style: [checkboxStyles.checkboxIcon, markScaleFactor !== 1 ? {
171
+ fontSize: scaledMarkSize,
172
+ lineHeight: getSafeIconCell(scaledMarkSize)
173
+ } : void 0]
141
174
  })
142
175
  }), labelContent]
143
176
  });
@@ -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 { 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 { FormLabel } from './FormLabel';\nimport { Icon } from './Icon';\nimport { Pressable } from './Pressable';\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 },\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 return (\n <FormLabel\n color=\"inherit\"\n variant=\"inherit\"\n label={label}\n required={required}\n showRequiredAsterisk={required}\n hasError={hasError}\n style={checkboxStyles.text}\n />\n );\n }, [label, required, hasError, 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":";;;;;;;;;;;AAuCA,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;EACnD,IAAI,YAAY,iBACd,OAAO;EAET,OAAO,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,OAAO,cAAc,OAAO,CAAC,EAC5C,EAAE;CAGH,MAAM,cAAc,kBAAkB;EACpC,IAAI,UACF;EAGF,MAAM,aAAa,YAAY,kBAAkB,OAAO,CAAC;EAEzD,IAAI,CAAC,cACH,mBAAmB,WAAW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Ed;AAEF,SAAS,cAAc"}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":["import { ICON_SIZE_MAP } from '@yahoo/uds-icons/tokens';\nimport type { CheckboxValue, CheckboxVariant, UniversalCheckboxProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { 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 { useComponentFontScale } from '../fontScaling/useFontScale';\nimport { useMaxFontSizeMultiplier } from '../fontScaling/useMaxFontSizeMultiplier';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { getSafeIconCell } from './Button/buttonTheme';\nimport { FormLabel } from './FormLabel';\nimport { Icon } from './Icon';\nimport { Pressable } from './Pressable';\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 /**\n * Caps how far the box, checkmark, and label grow with the OS text-size\n * setting; all three scale by the same factor. Set null to remove the cap;\n * override app-wide via UDSFontScalingProvider.\n * @default 2\n */\n maxFontSizeMultiplier?: number | null;\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 maxFontSizeMultiplier,\n onChange,\n ref,\n ...viewProps\n}: CheckboxProps) {\n const generatedId = useId();\n const uid = `uds-checkbox-${generatedId}`;\n\n // One resolved cap governs box, checkmark, and label. Android may resolve a\n // slightly different nonlinear factor for each base size.\n const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier('control', maxFontSizeMultiplier);\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 boxBaseSize = checkboxStyles.checkbox.width;\n const fontScaleFactor = useComponentFontScale(\n resolvedMaxFontSizeMultiplier,\n typeof boxBaseSize === 'number' ? boxBaseSize : undefined,\n );\n // The check/minus glyph is drawn at the 'sm' icon size; use its own native\n // Android curve before disabling native scaling on the manually-sized glyph.\n const markScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, ICON_SIZE_MAP.sm);\n const scaledMarkSize = Math.round(ICON_SIZE_MAP.sm * markScaleFactor);\n const hasScaledLayout = fontScaleFactor !== 1;\n\n const rootStyle = useMemo(\n () => [checkboxStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [checkboxStyles.root, disabled],\n );\n\n const checkboxBoxStyle = useMemo(() => {\n // The box grows by the capped factor to keep containing the checkmark.\n // borderWidth stays fixed (stroke weight doesn't scale in the OS's own\n // controls either).\n const { width, height, borderRadius } = checkboxStyles.checkbox;\n const scaledBox =\n fontScaleFactor !== 1 && typeof width === 'number' && typeof height === 'number'\n ? {\n width: Math.round(width * fontScaleFactor),\n height: Math.round(height * fontScaleFactor),\n ...(typeof borderRadius === 'number' && {\n borderRadius: Math.round(borderRadius * fontScaleFactor),\n }),\n }\n : undefined;\n\n return [\n checkboxStyles.checkbox,\n scaledBox,\n { alignItems: 'center' as const, justifyContent: 'center' as const },\n checkboxAnimatedStyle,\n ];\n }, [checkboxStyles.checkbox, fontScaleFactor, checkboxAnimatedStyle]);\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n return (\n <FormLabel\n color=\"inherit\"\n variant=\"inherit\"\n label={label}\n required={required}\n showRequiredAsterisk={required}\n hasError={hasError}\n flexShrink={hasScaledLayout ? '1' : undefined}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={checkboxStyles.text}\n />\n );\n }, [\n label,\n required,\n hasError,\n hasScaledLayout,\n resolvedMaxFontSizeMultiplier,\n checkboxStyles.text,\n ]);\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={hasScaledLayout ? 'stretch' : 'flex-start'}\n minHeight={hasScaledLayout ? 52 : undefined}\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 && (\n <Icon\n name={iconName}\n size=\"sm\"\n // Size the mark from the same factor that scaled the box, with\n // native scaling off: letting the box scale in JS while the glyph\n // scaled natively left the two to round independently (and to\n // disagree outright under Android's non-linear scaling), which\n // drifted the mark off-centre as sizes grew.\n dangerouslySetSize={scaledMarkSize}\n allowFontScaling={false}\n style={[\n checkboxStyles.checkboxIcon,\n markScaleFactor !== 1\n ? {\n fontSize: scaledMarkSize,\n lineHeight: getSafeIconCell(scaledMarkSize),\n }\n : undefined,\n ]}\n />\n )}\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox, type CheckboxProps };\n"],"mappings":";;;;;;;;;;;;;;;AAkDA,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,uBACA,UACA,KACA,GAAG,aACa;CAEhB,MAAM,MAAM,gBADQ,OACmB;CAIvC,MAAM,gCAAgC,yBAAyB,WAAW,sBAAsB;CAGhG,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,CAAC,iBAAiB,sBAAsB,SAC5C,eAAe,cAAe,kBAAkB,MACjD;CACD,MAAM,CAAC,SAAS,cAAc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;KACE,UAAU;KACV,YAAY,gBAAgB,eAAe;KAC5C,GACD,KAAA,EACL;IACD,CAAA;GAEU,CAAA,EAEf,aACS;;EAEd;AAEF,SAAS,cAAc"}
@@ -1,6 +1,8 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../../_virtual/_rolldown/runtime.cjs");
4
+ const require_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
5
+ const require_fontScaling_useMaxFontSizeMultiplier = require("../../fontScaling/useMaxFontSizeMultiplier.cjs");
4
6
  const require_components_IconSlot = require("../IconSlot.cjs");
5
7
  const require_components_Text = require("../Text.cjs");
6
8
  const require_components_Chip_chipTheme = require("./chipTheme.cjs");
@@ -13,30 +15,20 @@ const DEFAULT_CHIP_SIZE = "md";
13
15
  const DEFAULT_CHIP_VARIANT = "primary";
14
16
  const DEFAULT_MAX_WIDTH = 200;
15
17
  const DEFAULT_TOGGLE_STATE = "off";
16
- const ChipBase = (0, react.memo)(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STATE, variant = DEFAULT_CHIP_VARIANT, size = "md", minWidth, maxWidth = 200, startIcon, endIcon, endContent, disabled = false, pressable = false, onPress, accessibilityRole, accessibilityState, children, style, ref, ...viewProps }) {
18
+ const ChipBase = (0, react.memo)(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STATE, variant = DEFAULT_CHIP_VARIANT, size = "md", minWidth, maxWidth = 200, startIcon, endIcon, endContent, disabled = false, pressable = false, maxFontSizeMultiplier, onPress, accessibilityRole, accessibilityState, children, style, ref, ...viewProps }) {
17
19
  const { theme } = (0, react_native_unistyles.useUnistyles)();
18
20
  const [pressed, setPressed] = (0, react.useState)(false);
19
21
  const interactionState = pressed ? "pressed" : "rest";
20
- const rootStyle = (0, react.useMemo)(() => [
21
- chipStaticStyles.root,
22
- require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "root", interactionState),
23
- minWidth === void 0 ? void 0 : { minWidth },
24
- maxWidth === void 0 ? void 0 : { maxWidth },
25
- disabled ? chipStaticStyles.disabled : void 0,
26
- style
27
- ], [
28
- disabled,
22
+ const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
23
+ const rootLayerStyle = (0, react.useMemo)(() => require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "root", interactionState), [
29
24
  interactionState,
30
25
  kind,
31
- maxWidth,
32
- minWidth,
33
26
  size,
34
- style,
35
27
  theme,
36
28
  toggleState,
37
29
  variant
38
30
  ]);
39
- const textStyle = (0, react.useMemo)(() => [chipStaticStyles.text, require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "rootText", interactionState)], [
31
+ const textLayerStyle = (0, react.useMemo)(() => require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "rootText", interactionState), [
40
32
  interactionState,
41
33
  kind,
42
34
  size,
@@ -44,6 +36,28 @@ const ChipBase = (0, react.memo)(function ChipBase({ kind, toggleState = DEFAULT
44
36
  toggleState,
45
37
  variant
46
38
  ]);
39
+ const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, (typeof textLayerStyle.lineHeight === "number" ? textLayerStyle.lineHeight : void 0) ?? (typeof textLayerStyle.fontSize === "number" ? textLayerStyle.fontSize : void 0));
40
+ const rootStyle = (0, react.useMemo)(() => {
41
+ const scaledLayer = fontScaleFactor !== 1 && typeof rootLayerStyle.height === "number" ? { height: Math.round(rootLayerStyle.height * fontScaleFactor) } : void 0;
42
+ const resolvedMaxWidth = maxWidth === 200 ? Math.round(maxWidth * fontScaleFactor) : maxWidth;
43
+ return [
44
+ chipStaticStyles.root,
45
+ rootLayerStyle,
46
+ scaledLayer,
47
+ minWidth === void 0 ? void 0 : { minWidth },
48
+ resolvedMaxWidth === void 0 ? void 0 : { maxWidth: resolvedMaxWidth },
49
+ disabled ? chipStaticStyles.disabled : void 0,
50
+ style
51
+ ];
52
+ }, [
53
+ disabled,
54
+ fontScaleFactor,
55
+ maxWidth,
56
+ minWidth,
57
+ rootLayerStyle,
58
+ style
59
+ ]);
60
+ const textStyle = (0, react.useMemo)(() => [chipStaticStyles.text, textLayerStyle], [textLayerStyle]);
47
61
  const iconStyle = (0, react.useMemo)(() => require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "icon", interactionState), [
48
62
  interactionState,
49
63
  kind,
@@ -56,18 +70,21 @@ const ChipBase = (0, react.memo)(function ChipBase({ kind, toggleState = DEFAULT
56
70
  startIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
57
71
  icon: startIcon,
58
72
  variant: "fill",
73
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
59
74
  style: iconStyle
60
75
  }) : null,
61
76
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
62
77
  color: "inherit",
63
78
  variant: "inherit",
64
79
  numberOfLines: 1,
80
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
65
81
  style: textStyle,
66
82
  children
67
83
  }),
68
84
  endContent ?? (endIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
69
85
  icon: endIcon,
70
86
  variant: "fill",
87
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
71
88
  style: iconStyle
72
89
  }) : null)
73
90
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"ChipBase.d.cts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAWM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"ChipBase.d.cts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAaM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChipBase.d.ts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAWM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
1
+ {"version":3,"file":"ChipBase.d.ts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAaM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
@@ -1,4 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
+ import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
3
+ import { useMaxFontSizeMultiplier } from "../../fontScaling/useMaxFontSizeMultiplier.js";
2
4
  import { IconSlot } from "../IconSlot.js";
3
5
  import { Text as Text$1 } from "../Text.js";
4
6
  import { getMergedChipLayerStyle } from "./chipTheme.js";
@@ -11,30 +13,20 @@ const DEFAULT_CHIP_SIZE = "md";
11
13
  const DEFAULT_CHIP_VARIANT = "primary";
12
14
  const DEFAULT_MAX_WIDTH = 200;
13
15
  const DEFAULT_TOGGLE_STATE = "off";
14
- const ChipBase = memo(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STATE, variant = DEFAULT_CHIP_VARIANT, size = "md", minWidth, maxWidth = 200, startIcon, endIcon, endContent, disabled = false, pressable = false, onPress, accessibilityRole, accessibilityState, children, style, ref, ...viewProps }) {
16
+ const ChipBase = memo(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STATE, variant = DEFAULT_CHIP_VARIANT, size = "md", minWidth, maxWidth = 200, startIcon, endIcon, endContent, disabled = false, pressable = false, maxFontSizeMultiplier, onPress, accessibilityRole, accessibilityState, children, style, ref, ...viewProps }) {
15
17
  const { theme } = useUnistyles();
16
18
  const [pressed, setPressed] = useState(false);
17
19
  const interactionState = pressed ? "pressed" : "rest";
18
- const rootStyle = useMemo(() => [
19
- chipStaticStyles.root,
20
- getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "root", interactionState),
21
- minWidth === void 0 ? void 0 : { minWidth },
22
- maxWidth === void 0 ? void 0 : { maxWidth },
23
- disabled ? chipStaticStyles.disabled : void 0,
24
- style
25
- ], [
26
- disabled,
20
+ const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
21
+ const rootLayerStyle = useMemo(() => getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "root", interactionState), [
27
22
  interactionState,
28
23
  kind,
29
- maxWidth,
30
- minWidth,
31
24
  size,
32
- style,
33
25
  theme,
34
26
  toggleState,
35
27
  variant
36
28
  ]);
37
- const textStyle = useMemo(() => [chipStaticStyles.text, getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "rootText", interactionState)], [
29
+ const textLayerStyle = useMemo(() => getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "rootText", interactionState), [
38
30
  interactionState,
39
31
  kind,
40
32
  size,
@@ -42,6 +34,28 @@ const ChipBase = memo(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STA
42
34
  toggleState,
43
35
  variant
44
36
  ]);
37
+ const fontScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, (typeof textLayerStyle.lineHeight === "number" ? textLayerStyle.lineHeight : void 0) ?? (typeof textLayerStyle.fontSize === "number" ? textLayerStyle.fontSize : void 0));
38
+ const rootStyle = useMemo(() => {
39
+ const scaledLayer = fontScaleFactor !== 1 && typeof rootLayerStyle.height === "number" ? { height: Math.round(rootLayerStyle.height * fontScaleFactor) } : void 0;
40
+ const resolvedMaxWidth = maxWidth === 200 ? Math.round(maxWidth * fontScaleFactor) : maxWidth;
41
+ return [
42
+ chipStaticStyles.root,
43
+ rootLayerStyle,
44
+ scaledLayer,
45
+ minWidth === void 0 ? void 0 : { minWidth },
46
+ resolvedMaxWidth === void 0 ? void 0 : { maxWidth: resolvedMaxWidth },
47
+ disabled ? chipStaticStyles.disabled : void 0,
48
+ style
49
+ ];
50
+ }, [
51
+ disabled,
52
+ fontScaleFactor,
53
+ maxWidth,
54
+ minWidth,
55
+ rootLayerStyle,
56
+ style
57
+ ]);
58
+ const textStyle = useMemo(() => [chipStaticStyles.text, textLayerStyle], [textLayerStyle]);
45
59
  const iconStyle = useMemo(() => getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "icon", interactionState), [
46
60
  interactionState,
47
61
  kind,
@@ -54,18 +68,21 @@ const ChipBase = memo(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STA
54
68
  startIcon ? /* @__PURE__ */ jsx(IconSlot, {
55
69
  icon: startIcon,
56
70
  variant: "fill",
71
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
57
72
  style: iconStyle
58
73
  }) : null,
59
74
  /* @__PURE__ */ jsx(Text$1, {
60
75
  color: "inherit",
61
76
  variant: "inherit",
62
77
  numberOfLines: 1,
78
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
63
79
  style: textStyle,
64
80
  children
65
81
  }),
66
82
  endContent ?? (endIcon ? /* @__PURE__ */ jsx(IconSlot, {
67
83
  icon: endIcon,
68
84
  variant: "fill",
85
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
69
86
  style: iconStyle
70
87
  }) : null)
71
88
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"ChipBase.js","names":["Text"],"sources":["../../../src/components/Chip/ChipBase.tsx"],"sourcesContent":["import { memo, useMemo, useState } from 'react';\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native';\nimport { Pressable, StyleSheet, View } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- chip toggle styles need variant + active token lookups\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { IconSlot } from '../IconSlot';\nimport { Text } from '../Text';\nimport { getMergedChipLayerStyle } from './chipTheme';\nimport type { ChipBaseProps, ChipInteractionState, ChipSize, ChipVariant } from './types';\n\nconst DEFAULT_CHIP_SIZE: ChipSize = 'md';\nconst DEFAULT_CHIP_VARIANT: ChipVariant = 'primary';\nconst DEFAULT_MAX_WIDTH = 200;\nconst DEFAULT_TOGGLE_STATE = 'off';\n\nconst ChipBase = memo(function ChipBase({\n kind,\n toggleState = DEFAULT_TOGGLE_STATE,\n variant = DEFAULT_CHIP_VARIANT,\n size = DEFAULT_CHIP_SIZE,\n minWidth,\n maxWidth = DEFAULT_MAX_WIDTH,\n startIcon,\n endIcon,\n endContent,\n disabled = false,\n pressable = false,\n onPress,\n accessibilityRole,\n accessibilityState,\n children,\n style,\n ref,\n ...viewProps\n}: ChipBaseProps) {\n const { theme } = useUnistyles();\n const [pressed, setPressed] = useState(false);\n const interactionState: ChipInteractionState = pressed ? 'pressed' : 'rest';\n\n const rootStyle = useMemo<StyleProp<ViewStyle>>(\n () => [\n chipStaticStyles.root,\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'root',\n interactionState,\n ) as ViewStyle,\n minWidth === undefined ? undefined : { minWidth },\n maxWidth === undefined ? undefined : { maxWidth },\n disabled ? chipStaticStyles.disabled : undefined,\n style,\n ],\n [\n disabled,\n interactionState,\n kind,\n maxWidth,\n minWidth,\n size,\n style,\n theme,\n toggleState,\n variant,\n ],\n );\n\n const textStyle = useMemo<StyleProp<TextStyle>>(\n () => [\n chipStaticStyles.text,\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'rootText',\n interactionState,\n ) as TextStyle,\n ],\n [interactionState, kind, size, theme, toggleState, variant],\n );\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'icon',\n interactionState,\n ) as TextStyle,\n [interactionState, kind, size, theme, toggleState, variant],\n );\n\n const content = (\n <>\n {startIcon ? <IconSlot icon={startIcon} variant=\"fill\" style={iconStyle} /> : null}\n <Text color=\"inherit\" variant=\"inherit\" numberOfLines={1} style={textStyle}>\n {children}\n </Text>\n {endContent ??\n (endIcon ? <IconSlot icon={endIcon} variant=\"fill\" style={iconStyle} /> : null)}\n </>\n );\n\n if (pressable) {\n return (\n <Pressable\n ref={ref}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ disabled, ...accessibilityState }}\n disabled={disabled}\n onPress={disabled ? undefined : onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n {...viewProps}\n style={rootStyle}\n >\n {content}\n </Pressable>\n );\n }\n\n return (\n <View\n ref={ref}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ disabled, ...accessibilityState }}\n {...viewProps}\n style={rootStyle}\n >\n {content}\n </View>\n );\n});\n\nChipBase.displayName = 'ChipBase';\n\nconst chipStaticStyles = StyleSheet.create({\n disabled: {\n opacity: 0.5,\n },\n root: {\n alignItems: 'center',\n alignSelf: 'flex-start',\n flexDirection: 'row',\n overflow: 'hidden',\n },\n text: {\n flexShrink: 1,\n textAlign: 'center',\n },\n});\n\nexport { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT, DEFAULT_MAX_WIDTH };\n"],"mappings":";;;;;;;;;AAWA,MAAM,oBAA8B;AACpC,MAAM,uBAAoC;AAC1C,MAAM,oBAAoB;AAC1B,MAAM,uBAAuB;AAE7B,MAAM,WAAW,KAAK,SAAS,SAAS,EACtC,MACA,cAAc,sBACd,UAAU,sBACV,OAAA,MACA,UACA,WAAA,KACA,WACA,SACA,YACA,WAAW,OAC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,CAAA;CAIhB,OACE,oBAAC,MAAD;EACO;EACc;EACnB,oBAAoB;GAAE;GAAU,GAAG;GAAoB;EACvD,GAAI;EACJ,OAAO;YAEN;EACI,CAAA;EAET;AAEF,SAAS,cAAc;AAEvB,MAAM,mBAAmB,WAAW,OAAO;CACzC,UAAU,EACR,SAAS,IACV;CACD,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,eAAe;EACf,UAAU;EACX;CACD,MAAM;EACJ,YAAY;EACZ,WAAW;EACZ;CACF,CAAC"}
1
+ {"version":3,"file":"ChipBase.js","names":["Text"],"sources":["../../../src/components/Chip/ChipBase.tsx"],"sourcesContent":["import { memo, useMemo, useState } from 'react';\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native';\nimport { Pressable, StyleSheet, View } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- chip toggle styles need variant + active token lookups\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { useComponentFontScale } from '../../fontScaling/useFontScale';\nimport { useMaxFontSizeMultiplier } from '../../fontScaling/useMaxFontSizeMultiplier';\nimport { IconSlot } from '../IconSlot';\nimport { Text } from '../Text';\nimport { getMergedChipLayerStyle } from './chipTheme';\nimport type { ChipBaseProps, ChipInteractionState, ChipSize, ChipVariant } from './types';\n\nconst DEFAULT_CHIP_SIZE: ChipSize = 'md';\nconst DEFAULT_CHIP_VARIANT: ChipVariant = 'primary';\nconst DEFAULT_MAX_WIDTH = 200;\nconst DEFAULT_TOGGLE_STATE = 'off';\n\nconst ChipBase = memo(function ChipBase({\n kind,\n toggleState = DEFAULT_TOGGLE_STATE,\n variant = DEFAULT_CHIP_VARIANT,\n size = DEFAULT_CHIP_SIZE,\n minWidth,\n maxWidth = DEFAULT_MAX_WIDTH,\n startIcon,\n endIcon,\n endContent,\n disabled = false,\n pressable = false,\n maxFontSizeMultiplier,\n onPress,\n accessibilityRole,\n accessibilityState,\n children,\n style,\n ref,\n ...viewProps\n}: ChipBaseProps) {\n const { theme } = useUnistyles();\n const [pressed, setPressed] = useState(false);\n const interactionState: ChipInteractionState = pressed ? 'pressed' : 'rest';\n\n // One capped factor governs the label, icons, and the chip's fixed height.\n const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier('control', maxFontSizeMultiplier);\n const rootLayerStyle = useMemo(\n () =>\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'root',\n interactionState,\n ) as ViewStyle,\n [interactionState, kind, size, theme, toggleState, variant],\n );\n const textLayerStyle = useMemo(\n () =>\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'rootText',\n interactionState,\n ) as TextStyle,\n [interactionState, kind, size, theme, toggleState, variant],\n );\n const fontScaleFactor = useComponentFontScale(\n resolvedMaxFontSizeMultiplier,\n (typeof textLayerStyle.lineHeight === 'number' ? textLayerStyle.lineHeight : undefined) ??\n (typeof textLayerStyle.fontSize === 'number' ? textLayerStyle.fontSize : undefined),\n );\n\n const rootStyle = useMemo<StyleProp<ViewStyle>>(() => {\n // The chip's fixed height grows with its capped content; the default max\n // width grows too so capped labels don't truncate earlier than today. An\n // explicit maxWidth/minWidth from the consumer is respected as-is.\n const scaledLayer =\n fontScaleFactor !== 1 && typeof rootLayerStyle.height === 'number'\n ? { height: Math.round(rootLayerStyle.height * fontScaleFactor) }\n : undefined;\n const resolvedMaxWidth =\n maxWidth === DEFAULT_MAX_WIDTH ? Math.round(maxWidth * fontScaleFactor) : maxWidth;\n\n return [\n chipStaticStyles.root,\n rootLayerStyle,\n scaledLayer,\n minWidth === undefined ? undefined : { minWidth },\n resolvedMaxWidth === undefined ? undefined : { maxWidth: resolvedMaxWidth },\n disabled ? chipStaticStyles.disabled : undefined,\n style,\n ];\n }, [disabled, fontScaleFactor, maxWidth, minWidth, rootLayerStyle, style]);\n\n const textStyle = useMemo<StyleProp<TextStyle>>(\n () => [chipStaticStyles.text, textLayerStyle],\n [textLayerStyle],\n );\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedChipLayerStyle(\n theme,\n kind,\n variant,\n size,\n toggleState,\n 'icon',\n interactionState,\n ) as TextStyle,\n [interactionState, kind, size, theme, toggleState, variant],\n );\n\n const content = (\n <>\n {startIcon ? (\n <IconSlot\n icon={startIcon}\n variant=\"fill\"\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={iconStyle}\n />\n ) : null}\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n numberOfLines={1}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={textStyle}\n >\n {children}\n </Text>\n {endContent ??\n (endIcon ? (\n <IconSlot\n icon={endIcon}\n variant=\"fill\"\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={iconStyle}\n />\n ) : null)}\n </>\n );\n\n if (pressable) {\n return (\n <Pressable\n ref={ref}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ disabled, ...accessibilityState }}\n disabled={disabled}\n onPress={disabled ? undefined : onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n {...viewProps}\n style={rootStyle}\n >\n {content}\n </Pressable>\n );\n }\n\n return (\n <View\n ref={ref}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ disabled, ...accessibilityState }}\n {...viewProps}\n style={rootStyle}\n >\n {content}\n </View>\n );\n});\n\nChipBase.displayName = 'ChipBase';\n\nconst chipStaticStyles = StyleSheet.create({\n disabled: {\n opacity: 0.5,\n },\n root: {\n alignItems: 'center',\n alignSelf: 'flex-start',\n flexDirection: 'row',\n overflow: 'hidden',\n },\n text: {\n flexShrink: 1,\n textAlign: 'center',\n },\n});\n\nexport { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT, DEFAULT_MAX_WIDTH };\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,oBAA8B;AACpC,MAAM,uBAAoC;AAC1C,MAAM,oBAAoB;AAC1B,MAAM,uBAAuB;AAE7B,MAAM,WAAW,KAAK,SAAS,SAA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wBACE,OACA,MACA,SACA,MACA,aACA,QACA,iBACD,EACH;EAAC;EAAkB;EAAM;EAAM;EAAO;EAAa;EAAQ,CAC5D;CAED,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA;EACG,YACC,oBAAC,UAAD;GACE,MAAM;GACN,SAAQ;GACR,uBAAuB;GACvB,OAAO;GACP,CAAA,GACA;EACJ,oBAACA,QAAD;GACE,OAAM;GACN,SAAQ;GACR,eAAe;GACf,uBAAuB;GACvB,OAAO;GAEN;GACI,CAAA;EACN,eACE,UACC,oBAAC,UAAD;GACE,MAAM;GACN,SAAQ;GACR,uBAAuB;GACvB,OAAO;GACP,CAAA,GACA;EACL,EAAA,CAAA;CAGL,IAAI,WACF,OACE,oBAAC,WAAD;EACO;EACc;EACnB,oBAAoB;GAAE;GAAU,GAAG;GAAoB;EAC7C;EACV,SAAS,WAAW,KAAA,IAAY;EAChC,iBAAiB,WAAW,KAAK;EACjC,kBAAkB,WAAW,MAAM;EACnC,GAAI;EACJ,OAAO;YAEN;EACS,CAAA;CAIhB,OACE,oBAAC,MAAD;EACO;EACc;EACnB,oBAAoB;GAAE;GAAU,GAAG;GAAoB;EACvD,GAAI;EACJ,OAAO;YAEN;EACI,CAAA;EAET;AAEF,SAAS,cAAc;AAEvB,MAAM,mBAAmB,WAAW,OAAO;CACzC,UAAU,EACR,SAAS,IACV;CACD,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,eAAe;EACf,UAAU;EACX;CACD,MAAM;EACJ,YAAY;EACZ,WAAW;EACZ;CACF,CAAC"}
@@ -9,7 +9,7 @@ let react_native = require("react-native");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let react_native_unistyles = require("react-native-unistyles");
11
11
  //#region src/components/Chip/ChipDismissible.tsx
12
- const ChipDismissible = (0, react.memo)(function ChipDismissible({ onDismiss, dismissButtonAriaLabel = "Dismiss", dismissIcon, disabled = false, variant = require_components_Chip_ChipBase.DEFAULT_CHIP_VARIANT, size = "md", ...props }) {
12
+ const ChipDismissible = (0, react.memo)(function ChipDismissible({ onDismiss, dismissButtonAriaLabel = "Dismiss", dismissIcon, disabled = false, variant = require_components_Chip_ChipBase.DEFAULT_CHIP_VARIANT, size = "md", maxFontSizeMultiplier, ...props }) {
13
13
  const { theme } = (0, react_native_unistyles.useUnistyles)();
14
14
  const handleDismiss = (0, react.useCallback)(() => {
15
15
  if (!disabled) onDismiss?.();
@@ -24,6 +24,7 @@ const ChipDismissible = (0, react.memo)(function ChipDismissible({ onDismiss, di
24
24
  variant,
25
25
  size,
26
26
  disabled,
27
+ maxFontSizeMultiplier,
27
28
  endContent: onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
28
29
  accessibilityLabel: dismissButtonAriaLabel,
29
30
  accessibilityRole: "button",
@@ -34,6 +35,7 @@ const ChipDismissible = (0, react.memo)(function ChipDismissible({ onDismiss, di
34
35
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
35
36
  icon: dismissIcon ?? "Cross",
36
37
  variant: "fill",
38
+ maxFontSizeMultiplier,
37
39
  style: iconStyle
38
40
  })
39
41
  }) : null,
@@ -7,7 +7,7 @@ import { Pressable, StyleSheet } from "react-native";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { useUnistyles } from "react-native-unistyles";
9
9
  //#region src/components/Chip/ChipDismissible.tsx
10
- const ChipDismissible = memo(function ChipDismissible({ onDismiss, dismissButtonAriaLabel = "Dismiss", dismissIcon, disabled = false, variant = DEFAULT_CHIP_VARIANT, size = "md", ...props }) {
10
+ const ChipDismissible = memo(function ChipDismissible({ onDismiss, dismissButtonAriaLabel = "Dismiss", dismissIcon, disabled = false, variant = DEFAULT_CHIP_VARIANT, size = "md", maxFontSizeMultiplier, ...props }) {
11
11
  const { theme } = useUnistyles();
12
12
  const handleDismiss = useCallback(() => {
13
13
  if (!disabled) onDismiss?.();
@@ -22,6 +22,7 @@ const ChipDismissible = memo(function ChipDismissible({ onDismiss, dismissButton
22
22
  variant,
23
23
  size,
24
24
  disabled,
25
+ maxFontSizeMultiplier,
25
26
  endContent: onDismiss ? /* @__PURE__ */ jsx(Pressable, {
26
27
  accessibilityLabel: dismissButtonAriaLabel,
27
28
  accessibilityRole: "button",
@@ -32,6 +33,7 @@ const ChipDismissible = memo(function ChipDismissible({ onDismiss, dismissButton
32
33
  children: /* @__PURE__ */ jsx(IconSlot, {
33
34
  icon: dismissIcon ?? "Cross",
34
35
  variant: "fill",
36
+ maxFontSizeMultiplier,
35
37
  style: iconStyle
36
38
  })
37
39
  }) : null,
@@ -1 +1 @@
1
- {"version":3,"file":"ChipDismissible.js","names":[],"sources":["../../../src/components/Chip/ChipDismissible.tsx"],"sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport type { StyleProp, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- dismiss icon must match chip subcomponent tokens\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { IconSlot } from '../IconSlot';\nimport { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT } from './ChipBase';\nimport { getMergedChipLayerStyle } from './chipTheme';\nimport type { ChipDismissibleProps } from './types';\n\nconst ChipDismissible = memo(function ChipDismissible({\n onDismiss,\n dismissButtonAriaLabel = 'Dismiss',\n dismissIcon,\n disabled = false,\n variant = DEFAULT_CHIP_VARIANT,\n size = DEFAULT_CHIP_SIZE,\n ...props\n}: ChipDismissibleProps) {\n const { theme } = useUnistyles();\n const handleDismiss = useCallback(() => {\n if (!disabled) {\n onDismiss?.();\n }\n }, [disabled, onDismiss]);\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedChipLayerStyle(\n theme,\n 'dismissible',\n variant,\n size,\n 'off',\n 'icon',\n 'rest',\n ) as TextStyle,\n [size, theme, variant],\n );\n\n return (\n <ChipBase\n kind=\"dismissible\"\n variant={variant}\n size={size}\n disabled={disabled}\n endContent={\n onDismiss ? (\n <Pressable\n accessibilityLabel={dismissButtonAriaLabel}\n accessibilityRole=\"button\"\n disabled={disabled}\n hitSlop={8}\n onPress={handleDismiss}\n style={chipDismissibleStyles.button}\n >\n <IconSlot icon={dismissIcon ?? 'Cross'} variant=\"fill\" style={iconStyle} />\n </Pressable>\n ) : null\n }\n {...props}\n />\n );\n});\n\nChipDismissible.displayName = 'ChipDismissible';\n\nconst chipDismissibleStyles = StyleSheet.create({\n button: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport { ChipDismissible };\n"],"mappings":";;;;;;;;;AAWA,MAAM,kBAAkB,KAAK,SAAS,gBAAgB,EACpD,WACA,yBAAyB,WACzB,aACA,WAAW,OACX,UAAU,sBACV,OAAA,MACA,GAAG,SACoB;CACvB,MAAM,EAAE,UAAU,cAAc;CAChC,MAAM,gBAAgB,kBAAkB;EACtC,IAAI,CAAC,UACH,aAAa;IAEd,CAAC,UAAU,UAAU,CAAC;CAEzB,MAAM,YAAY,cAEd,wBACE,OACA,eACA,SACA,MACA,OACA,QACA,OACD,EACH;EAAC;EAAM;EAAO;EAAQ,CACvB;CAED,OACE,oBAAC,UAAD;EACE,MAAK;EACI;EACH;EACI;EACV,YACE,YACE,oBAAC,WAAD;GACE,oBAAoB;GACpB,mBAAkB;GACR;GACV,SAAS;GACT,SAAS;GACT,OAAO,sBAAsB;aAE7B,oBAAC,UAAD;IAAU,MAAM,eAAe;IAAS,SAAQ;IAAO,OAAO;IAAa,CAAA;GACjE,CAAA,GACV;EAEN,GAAI;EACJ,CAAA;EAEJ;AAEF,gBAAgB,cAAc;AAE9B,MAAM,wBAAwB,WAAW,OAAO,EAC9C,QAAQ;CACN,YAAY;CACZ,gBAAgB;CACjB,EACF,CAAC"}
1
+ {"version":3,"file":"ChipDismissible.js","names":[],"sources":["../../../src/components/Chip/ChipDismissible.tsx"],"sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport type { StyleProp, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- dismiss icon must match chip subcomponent tokens\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { IconSlot } from '../IconSlot';\nimport { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT } from './ChipBase';\nimport { getMergedChipLayerStyle } from './chipTheme';\nimport type { ChipDismissibleProps } from './types';\n\nconst ChipDismissible = memo(function ChipDismissible({\n onDismiss,\n dismissButtonAriaLabel = 'Dismiss',\n dismissIcon,\n disabled = false,\n variant = DEFAULT_CHIP_VARIANT,\n size = DEFAULT_CHIP_SIZE,\n maxFontSizeMultiplier,\n ...props\n}: ChipDismissibleProps) {\n const { theme } = useUnistyles();\n const handleDismiss = useCallback(() => {\n if (!disabled) {\n onDismiss?.();\n }\n }, [disabled, onDismiss]);\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedChipLayerStyle(\n theme,\n 'dismissible',\n variant,\n size,\n 'off',\n 'icon',\n 'rest',\n ) as TextStyle,\n [size, theme, variant],\n );\n\n return (\n <ChipBase\n kind=\"dismissible\"\n variant={variant}\n size={size}\n disabled={disabled}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n endContent={\n onDismiss ? (\n <Pressable\n accessibilityLabel={dismissButtonAriaLabel}\n accessibilityRole=\"button\"\n disabled={disabled}\n hitSlop={8}\n onPress={handleDismiss}\n style={chipDismissibleStyles.button}\n >\n <IconSlot\n icon={dismissIcon ?? 'Cross'}\n variant=\"fill\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={iconStyle}\n />\n </Pressable>\n ) : null\n }\n {...props}\n />\n );\n});\n\nChipDismissible.displayName = 'ChipDismissible';\n\nconst chipDismissibleStyles = StyleSheet.create({\n button: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport { ChipDismissible };\n"],"mappings":";;;;;;;;;AAWA,MAAM,kBAAkB,KAAK,SAAS,gBAAgB,EACpD,WACA,yBAAyB,WACzB,aACA,WAAW,OACX,UAAU,sBACV,OAAA,MACA,uBACA,GAAG,SACoB;CACvB,MAAM,EAAE,UAAU,cAAc;CAChC,MAAM,gBAAgB,kBAAkB;EACtC,IAAI,CAAC,UACH,aAAa;IAEd,CAAC,UAAU,UAAU,CAAC;CAEzB,MAAM,YAAY,cAEd,wBACE,OACA,eACA,SACA,MACA,OACA,QACA,OACD,EACH;EAAC;EAAM;EAAO;EAAQ,CACvB;CAED,OACE,oBAAC,UAAD;EACE,MAAK;EACI;EACH;EACI;EACa;EACvB,YACE,YACE,oBAAC,WAAD;GACE,oBAAoB;GACpB,mBAAkB;GACR;GACV,SAAS;GACT,SAAS;GACT,OAAO,sBAAsB;aAE7B,oBAAC,UAAD;IACE,MAAM,eAAe;IACrB,SAAQ;IACe;IACvB,OAAO;IACP,CAAA;GACQ,CAAA,GACV;EAEN,GAAI;EACJ,CAAA;EAEJ;AAEF,gBAAgB,cAAc;AAE9B,MAAM,wBAAwB,WAAW,OAAO,EAC9C,QAAQ;CACN,YAAY;CACZ,gBAAgB;CACjB,EACF,CAAC"}