@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
@@ -6,17 +6,36 @@ import { TextStyle } from "react-native";
6
6
  type ButtonTheme = {
7
7
  components: Record<string, any>;
8
8
  };
9
+ /** Base icon size for an IconButton size layer. */
10
+ declare function getIconButtonIconSize(theme: ButtonTheme, size: IconButtonSize): number;
9
11
  /** Safe line box for the icon font's em square plus any bbox overflow. */
10
12
  declare function getSafeIconCell(fontSize: number): number;
11
- /** Safe native content metrics while retaining the token-derived target control height. */
12
- declare function getButtonControlMetrics(theme: ButtonTheme, size: ButtonSize): {
13
+ /**
14
+ * Safe native content metrics while retaining the token-derived target control height.
15
+ *
16
+ * `fontScaleFactor` pre-scales container metrics only. A single number keeps
17
+ * the legacy linear behavior; distinct label/icon factors let Android 14+
18
+ * geometry follow its size-dependent nonlinear font curve. The returned
19
+ * `labelLineHeight`/`iconCellHeight` stay unscaled because native Text applies
20
+ * the same cap.
21
+ */
22
+ declare function getButtonControlMetrics(theme: ButtonTheme, size: ButtonSize, fontScaleFactor?: number | {
23
+ label: number;
24
+ icon: number;
25
+ iconCell?: number;
26
+ }): {
13
27
  minHeight: number;
14
28
  labelLineHeight: number;
15
29
  iconCellHeight: number;
16
30
  paddingVertical: number;
17
31
  };
18
- /** Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target. */
19
- declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButtonSize): {
32
+ /**
33
+ * Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target.
34
+ *
35
+ * `fontScaleFactor` behaves as in {@link getButtonControlMetrics}; an explicit
36
+ * token height stays fixed, with padding absorbing the scaled content.
37
+ */
38
+ declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButtonSize, fontScaleFactor?: number): {
20
39
  minHeight: number;
21
40
  iconCellHeight: number;
22
41
  paddingVertical: number;
@@ -25,5 +44,5 @@ declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButto
25
44
  /** Apply the metric-safe line height after the token typography styles. */
26
45
  declare function getButtonTextStyle(textStyle: TextStyle, labelLineHeight: number): TextStyle;
27
46
  //#endregion
28
- export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getSafeIconCell };
47
+ export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getIconButtonIconSize, getSafeIconCell };
29
48
  //# sourceMappingURL=buttonTheme.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buttonTheme.d.cts","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"mappings":";;;;;KAKK,WAAA;EAEH,UAAA,EAAY,MAAA;AAAA;;iBA4DE,eAAA,CAAgB,QAAA;;iBAiBhB,uBAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,UAAA;EAEN,SAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;AAAA;AAPF;AAAA,iBAgCgB,2BAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,cAAA;EAEN,SAAA;EACA,cAAA;EACA,eAAA;EACA,iBAAA;AAAA;;iBAyBc,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,eAAA,WAA0B,SAAA"}
1
+ {"version":3,"file":"buttonTheme.d.cts","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"mappings":";;;;;KAKK,WAAA;EAEH,UAAA,EAAY,MAAA;AAAA;;iBA6BL,qBAAA,CAAsB,KAAA,EAAO,WAAA,EAAa,IAAA,EAAM,cAAA;;iBAoCzC,eAAA,CAAgB,QAAA;AAjEZ;;;;;;;;;AAAA,iBA0FJ,uBAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,UAAA,EACN,eAAA;EAA4B,KAAA;EAAe,IAAA;EAAc,QAAA;AAAA;EAEzD,SAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;AAAA;;;;;;;iBA4Cc,2BAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,cAAA,EACN,eAAA;EAEA,SAAA;EACA,cAAA;EACA,eAAA;EACA,iBAAA;AAAA;;iBA4Bc,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,eAAA,WAA0B,SAAA"}
@@ -6,17 +6,36 @@ import { TextStyle } from "react-native";
6
6
  type ButtonTheme = {
7
7
  components: Record<string, any>;
8
8
  };
9
+ /** Base icon size for an IconButton size layer. */
10
+ declare function getIconButtonIconSize(theme: ButtonTheme, size: IconButtonSize): number;
9
11
  /** Safe line box for the icon font's em square plus any bbox overflow. */
10
12
  declare function getSafeIconCell(fontSize: number): number;
11
- /** Safe native content metrics while retaining the token-derived target control height. */
12
- declare function getButtonControlMetrics(theme: ButtonTheme, size: ButtonSize): {
13
+ /**
14
+ * Safe native content metrics while retaining the token-derived target control height.
15
+ *
16
+ * `fontScaleFactor` pre-scales container metrics only. A single number keeps
17
+ * the legacy linear behavior; distinct label/icon factors let Android 14+
18
+ * geometry follow its size-dependent nonlinear font curve. The returned
19
+ * `labelLineHeight`/`iconCellHeight` stay unscaled because native Text applies
20
+ * the same cap.
21
+ */
22
+ declare function getButtonControlMetrics(theme: ButtonTheme, size: ButtonSize, fontScaleFactor?: number | {
23
+ label: number;
24
+ icon: number;
25
+ iconCell?: number;
26
+ }): {
13
27
  minHeight: number;
14
28
  labelLineHeight: number;
15
29
  iconCellHeight: number;
16
30
  paddingVertical: number;
17
31
  };
18
- /** Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target. */
19
- declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButtonSize): {
32
+ /**
33
+ * Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target.
34
+ *
35
+ * `fontScaleFactor` behaves as in {@link getButtonControlMetrics}; an explicit
36
+ * token height stays fixed, with padding absorbing the scaled content.
37
+ */
38
+ declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButtonSize, fontScaleFactor?: number): {
20
39
  minHeight: number;
21
40
  iconCellHeight: number;
22
41
  paddingVertical: number;
@@ -25,5 +44,5 @@ declare function getIconButtonControlMetrics(theme: ButtonTheme, size: IconButto
25
44
  /** Apply the metric-safe line height after the token typography styles. */
26
45
  declare function getButtonTextStyle(textStyle: TextStyle, labelLineHeight: number): TextStyle;
27
46
  //#endregion
28
- export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getSafeIconCell };
47
+ export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getIconButtonIconSize, getSafeIconCell };
29
48
  //# sourceMappingURL=buttonTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buttonTheme.d.ts","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"mappings":";;;;;KAKK,WAAA;EAEH,UAAA,EAAY,MAAA;AAAA;;iBA4DE,eAAA,CAAgB,QAAA;;iBAiBhB,uBAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,UAAA;EAEN,SAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;AAAA;AAPF;AAAA,iBAgCgB,2BAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,cAAA;EAEN,SAAA;EACA,cAAA;EACA,eAAA;EACA,iBAAA;AAAA;;iBAyBc,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,eAAA,WAA0B,SAAA"}
1
+ {"version":3,"file":"buttonTheme.d.ts","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"mappings":";;;;;KAKK,WAAA;EAEH,UAAA,EAAY,MAAA;AAAA;;iBA6BL,qBAAA,CAAsB,KAAA,EAAO,WAAA,EAAa,IAAA,EAAM,cAAA;;iBAoCzC,eAAA,CAAgB,QAAA;AAjEZ;;;;;;;;;AAAA,iBA0FJ,uBAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,UAAA,EACN,eAAA;EAA4B,KAAA;EAAe,IAAA;EAAc,QAAA;AAAA;EAEzD,SAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;AAAA;;;;;;;iBA4Cc,2BAAA,CACd,KAAA,EAAO,WAAA,EACP,IAAA,EAAM,cAAA,EACN,eAAA;EAEA,SAAA;EACA,cAAA;EACA,eAAA;EACA,iBAAA;AAAA;;iBA4Bc,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,eAAA,WAA0B,SAAA"}
@@ -21,6 +21,10 @@ function getLayerStyle(theme, path) {
21
21
  function getIconSize(iconStyle) {
22
22
  return (typeof iconStyle.fontSize === "number" ? iconStyle.fontSize : void 0) ?? (typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : void 0) ?? 16;
23
23
  }
24
+ /** Base icon size for an IconButton size layer. */
25
+ function getIconButtonIconSize(theme, size) {
26
+ return getIconSize(getLayerStyle(theme, iconButtonSizePath(size, "icon")));
27
+ }
24
28
  function getVerticalPadding(rootStyle) {
25
29
  return (typeof rootStyle.paddingVertical === "number" ? rootStyle.paddingVertical : void 0) ?? (typeof rootStyle.padding === "number" ? rootStyle.padding : void 0) ?? 0;
26
30
  }
@@ -43,8 +47,16 @@ function getSafeIconCell(fontSize) {
43
47
  const overflowBelowEm = Math.max(0, -metrics.bbox.minY);
44
48
  return Math.ceil(fontSize) + getMetricHeight(overflowAboveEm, metrics.unitsPerEm, fontSize) + getMetricHeight(overflowBelowEm, metrics.unitsPerEm, fontSize);
45
49
  }
46
- /** Safe native content metrics while retaining the token-derived target control height. */
47
- function getButtonControlMetrics(theme, size) {
50
+ /**
51
+ * Safe native content metrics while retaining the token-derived target control height.
52
+ *
53
+ * `fontScaleFactor` pre-scales container metrics only. A single number keeps
54
+ * the legacy linear behavior; distinct label/icon factors let Android 14+
55
+ * geometry follow its size-dependent nonlinear font curve. The returned
56
+ * `labelLineHeight`/`iconCellHeight` stay unscaled because native Text applies
57
+ * the same cap.
58
+ */
59
+ function getButtonControlMetrics(theme, size, fontScaleFactor = 1) {
48
60
  const rootStyle = getLayerStyle(theme, buttonSizePath(size, "root"));
49
61
  const iconStyle = getLayerStyle(theme, buttonSizePath(size, "icon"));
50
62
  const textStyle = getLayerStyle(theme, buttonSizePath(size, "rootText"));
@@ -52,32 +64,41 @@ function getButtonControlMetrics(theme, size) {
52
64
  const iconSize = getIconSize(iconStyle);
53
65
  const fontSize = typeof textStyle.fontSize === "number" ? textStyle.fontSize : iconSize;
54
66
  const tokenLineHeight = typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : fontSize;
55
- const targetContentHeight = Math.max(iconSize, tokenLineHeight);
67
+ const labelScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.label;
68
+ const iconScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.icon;
69
+ const iconCellScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.iconCell ?? fontScaleFactor.icon;
70
+ const targetContentHeight = Math.max(iconSize * iconScaleFactor, tokenLineHeight * labelScaleFactor);
56
71
  const minHeight = Math.ceil(paddingVertical * 2 + targetContentHeight);
57
72
  const labelLineHeight = getSafeLabelLineHeight(textStyle, iconSize);
58
73
  const iconCellHeight = getSafeIconCell(iconSize);
74
+ const safeContentHeight = Math.max(labelLineHeight * labelScaleFactor, iconCellHeight * iconCellScaleFactor);
59
75
  return {
60
76
  minHeight,
61
77
  labelLineHeight,
62
78
  iconCellHeight,
63
- paddingVertical: Math.max(0, (minHeight - Math.max(labelLineHeight, iconCellHeight)) / 2)
79
+ paddingVertical: Math.max(0, (minHeight - safeContentHeight) / 2)
64
80
  };
65
81
  }
66
- /** Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target. */
67
- function getIconButtonControlMetrics(theme, size) {
82
+ /**
83
+ * Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target.
84
+ *
85
+ * `fontScaleFactor` behaves as in {@link getButtonControlMetrics}; an explicit
86
+ * token height stays fixed, with padding absorbing the scaled content.
87
+ */
88
+ function getIconButtonControlMetrics(theme, size, fontScaleFactor = 1) {
68
89
  const rootStyle = getLayerStyle(theme, iconButtonSizePath(size, "root"));
69
90
  const iconStyle = getLayerStyle(theme, iconButtonSizePath(size, "icon"));
70
- const iconSize = getIconSize(iconStyle);
91
+ const iconSize = getIconButtonIconSize(theme, size);
71
92
  const tokenLineHeight = typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : iconSize;
72
93
  const paddingVertical = getVerticalPadding(rootStyle);
73
94
  const explicitHeight = typeof rootStyle.height === "number" ? rootStyle.height : void 0;
74
95
  const hasExplicitHeight = SHARED_BUTTON_ICONBUTTON_SIZES.has(size) && explicitHeight !== void 0;
75
- const minHeight = hasExplicitHeight ? explicitHeight : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight));
96
+ const minHeight = hasExplicitHeight ? explicitHeight : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight) * fontScaleFactor);
76
97
  const iconCellHeight = getSafeIconCell(iconSize);
77
98
  return {
78
99
  minHeight,
79
100
  iconCellHeight,
80
- paddingVertical: Math.max(0, (minHeight - Math.max(iconSize, iconCellHeight)) / 2),
101
+ paddingVertical: Math.max(0, (minHeight - Math.max(iconSize, iconCellHeight) * fontScaleFactor) / 2),
81
102
  hasExplicitHeight
82
103
  };
83
104
  }
@@ -89,6 +110,6 @@ function getButtonTextStyle(textStyle, labelLineHeight) {
89
110
  };
90
111
  }
91
112
  //#endregion
92
- export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getSafeIconCell };
113
+ export { getButtonControlMetrics, getButtonTextStyle, getIconButtonControlMetrics, getIconButtonIconSize, getSafeIconCell };
93
114
 
94
115
  //# sourceMappingURL=buttonTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buttonTheme.js","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"sourcesContent":["import type { ButtonSize, IconButtonSize } from '@yahoo/uds-types';\nimport type { TextStyle, ViewStyle } from 'react-native';\n\nimport { fontMetrics } from '../../../generated/fontMetrics';\n\ntype ButtonTheme = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: Record<string, any>;\n};\n\nconst SHARED_BUTTON_ICONBUTTON_SIZES = new Set<IconButtonSize>(['xs', 'sm', 'md', 'lg']);\n// Covers common native font boxes (roughly 1.2em) plus pixel-rounding headroom.\nconst UNKNOWN_FONT_LINE_HEIGHT_RATIO = 1.3;\n\nfunction buttonSizePath(size: ButtonSize, layer: 'root' | 'icon' | 'rootText'): string {\n return `button/size/${size}/${layer}/rest`;\n}\n\nfunction iconButtonSizePath(size: IconButtonSize, layer: 'root' | 'icon'): string {\n return `iconButton/size/${size}/${layer}/rest`;\n}\n\nfunction getLayerStyle(theme: ButtonTheme, path: string): ViewStyle | TextStyle {\n const style = theme.components[path];\n return style && typeof style === 'object' ? style : {};\n}\n\nfunction getIconSize(iconStyle: TextStyle): number {\n return (\n (typeof iconStyle.fontSize === 'number' ? iconStyle.fontSize : undefined) ??\n (typeof iconStyle.lineHeight === 'number' ? iconStyle.lineHeight : undefined) ??\n 16\n );\n}\n\nfunction getVerticalPadding(rootStyle: ViewStyle): number {\n return (\n (typeof rootStyle.paddingVertical === 'number' ? rootStyle.paddingVertical : undefined) ??\n (typeof rootStyle.padding === 'number' ? rootStyle.padding : undefined) ??\n 0\n );\n}\n\nfunction getMetricHeight(value: number, unitsPerEm: number, fontSize: number): number {\n return Math.ceil((Math.max(0, value) / unitsPerEm) * fontSize);\n}\n\nfunction getSafeLabelLineHeight(textStyle: TextStyle, fallbackFontSize: number): number {\n const fontSize = typeof textStyle.fontSize === 'number' ? textStyle.fontSize : fallbackFontSize;\n const tokenLineHeight =\n typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : fontSize;\n const metrics =\n typeof textStyle.fontFamily === 'string' ? fontMetrics[textStyle.fontFamily] : undefined;\n\n if (!metrics || metrics.unitsPerEm <= 0) {\n return Math.max(tokenLineHeight, Math.ceil(fontSize * UNKNOWN_FONT_LINE_HEIGHT_RATIO));\n }\n\n const metricsLineHeight =\n getMetricHeight(metrics.ascent, metrics.unitsPerEm, fontSize) +\n getMetricHeight(-metrics.descent, metrics.unitsPerEm, fontSize) +\n getMetricHeight(metrics.lineGap, metrics.unitsPerEm, fontSize);\n\n return Math.max(tokenLineHeight, metricsLineHeight);\n}\n\n/** Safe line box for the icon font's em square plus any bbox overflow. */\nexport function getSafeIconCell(fontSize: number): number {\n const metrics = fontMetrics['uds-icons'];\n if (!metrics || metrics.unitsPerEm <= 0) {\n return Math.ceil(fontSize * UNKNOWN_FONT_LINE_HEIGHT_RATIO);\n }\n\n const overflowAboveEm = Math.max(0, metrics.bbox.maxY - metrics.unitsPerEm);\n const overflowBelowEm = Math.max(0, -metrics.bbox.minY);\n\n return (\n Math.ceil(fontSize) +\n getMetricHeight(overflowAboveEm, metrics.unitsPerEm, fontSize) +\n getMetricHeight(overflowBelowEm, metrics.unitsPerEm, fontSize)\n );\n}\n\n/** Safe native content metrics while retaining the token-derived target control height. */\nexport function getButtonControlMetrics(\n theme: ButtonTheme,\n size: ButtonSize,\n): {\n minHeight: number;\n labelLineHeight: number;\n iconCellHeight: number;\n paddingVertical: number;\n} {\n const rootStyle = getLayerStyle(theme, buttonSizePath(size, 'root')) as ViewStyle;\n const iconStyle = getLayerStyle(theme, buttonSizePath(size, 'icon')) as TextStyle;\n const textStyle = getLayerStyle(theme, buttonSizePath(size, 'rootText')) as TextStyle;\n const paddingVertical = getVerticalPadding(rootStyle);\n const iconSize = getIconSize(iconStyle);\n const fontSize = typeof textStyle.fontSize === 'number' ? textStyle.fontSize : iconSize;\n const tokenLineHeight =\n typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : fontSize;\n const targetContentHeight = Math.max(iconSize, tokenLineHeight);\n const minHeight = Math.ceil(paddingVertical * 2 + targetContentHeight);\n const labelLineHeight = getSafeLabelLineHeight(textStyle, iconSize);\n const iconCellHeight = getSafeIconCell(iconSize);\n const safeContentHeight = Math.max(labelLineHeight, iconCellHeight);\n\n return {\n minHeight,\n labelLineHeight,\n iconCellHeight,\n paddingVertical: Math.max(0, (minHeight - safeContentHeight) / 2),\n };\n}\n\n/** Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target. */\nexport function getIconButtonControlMetrics(\n theme: ButtonTheme,\n size: IconButtonSize,\n): {\n minHeight: number;\n iconCellHeight: number;\n paddingVertical: number;\n hasExplicitHeight: boolean;\n} {\n const rootStyle = getLayerStyle(theme, iconButtonSizePath(size, 'root')) as ViewStyle;\n const iconStyle = getLayerStyle(theme, iconButtonSizePath(size, 'icon')) as TextStyle;\n const iconSize = getIconSize(iconStyle);\n const tokenLineHeight =\n typeof iconStyle.lineHeight === 'number' ? iconStyle.lineHeight : iconSize;\n const paddingVertical = getVerticalPadding(rootStyle);\n const explicitHeight = typeof rootStyle.height === 'number' ? rootStyle.height : undefined;\n const hasExplicitHeight =\n SHARED_BUTTON_ICONBUTTON_SIZES.has(size) && explicitHeight !== undefined;\n const minHeight = hasExplicitHeight\n ? (explicitHeight as number)\n : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight));\n const iconCellHeight = getSafeIconCell(iconSize);\n\n return {\n minHeight,\n iconCellHeight,\n paddingVertical: Math.max(0, (minHeight - Math.max(iconSize, iconCellHeight)) / 2),\n hasExplicitHeight,\n };\n}\n\n/** Apply the metric-safe line height after the token typography styles. */\nexport function getButtonTextStyle(textStyle: TextStyle, labelLineHeight: number): TextStyle {\n return {\n ...textStyle,\n lineHeight: labelLineHeight,\n };\n}\n"],"mappings":";;;AAUA,MAAM,iCAAiC,IAAI,IAAoB;CAAC;CAAM;CAAM;CAAM;CAAK,CAAC;AAExF,MAAM,iCAAiC;AAEvC,SAAS,eAAe,MAAkB,OAA6C;CACrF,OAAO,eAAe,KAAK,GAAG,MAAM;;AAGtC,SAAS,mBAAmB,MAAsB,OAAgC;CAChF,OAAO,mBAAmB,KAAK,GAAG,MAAM;;AAG1C,SAAS,cAAc,OAAoB,MAAqC;CAC9E,MAAM,QAAQ,MAAM,WAAW;CAC/B,OAAO,SAAS,OAAO,UAAU,WAAW,QAAQ,EAAE;;AAGxD,SAAS,YAAY,WAA8B;CACjD,QACG,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW,KAAA,OAC9D,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa,KAAA,MACnE;;AAIJ,SAAS,mBAAmB,WAA8B;CACxD,QACG,OAAO,UAAU,oBAAoB,WAAW,UAAU,kBAAkB,KAAA,OAC5E,OAAO,UAAU,YAAY,WAAW,UAAU,UAAU,KAAA,MAC7D;;AAIJ,SAAS,gBAAgB,OAAe,YAAoB,UAA0B;CACpF,OAAO,KAAK,KAAM,KAAK,IAAI,GAAG,MAAM,GAAG,aAAc,SAAS;;AAGhE,SAAS,uBAAuB,WAAsB,kBAAkC;CACtF,MAAM,WAAW,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW;CAC/E,MAAM,kBACJ,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa;CACpE,MAAM,UACJ,OAAO,UAAU,eAAe,WAAW,YAAY,UAAU,cAAc,KAAA;CAEjF,IAAI,CAAC,WAAW,QAAQ,cAAc,GACpC,OAAO,KAAK,IAAI,iBAAiB,KAAK,KAAK,WAAW,+BAA+B,CAAC;CAGxF,MAAM,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ClE;;;AAIH,SAAgB,4BACd,OACA,MAMA;CACA,MAAM,YAAY,cAAc,OAAO,mBAAmB,MAAM,OAAO,CAAC;CACxE,MAAM,YAAY,cAAc,OAAO,mBAAmB,MAAM,OAAO,CAAC;CACxE,MAAM,WAAW,YAAY,UAAU;CACvC,MAAM,kBACJ,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa;CACpE,MAAM,kBAAkB,mBAAmB,UAAU;CACrD,MAAM,iBAAiB,OAAO,UAAU,WAAW,WAAW,UAAU,SAAS,KAAA;CACjF,MAAM,oBACJ,+BAA+B,IAAI,KAAK,IAAI,mBAAmB,KAAA;CACjE,MAAM,YAAY,oBACb,iBACD,KAAK,KAAK,kBAAkB,IAAI,KAAK,IAAI,UAAU,gBAAgB,CAAC;CACxE,MAAM,iBAAiB,gBAAgB,SAAS;CAEhD,OAAO;EACL;EACA;EACA,iBAAiB,KAAK,IAAI,IAAI,YAAY,KAAK,IAAI,UAAU,eAAe,IAAI,EAAE;EAClF;EACD;;;AAIH,SAAgB,mBAAmB,WAAsB,iBAAoC;CAC3F,OAAO;EACL,GAAG;EACH,YAAY;EACb"}
1
+ {"version":3,"file":"buttonTheme.js","names":[],"sources":["../../../src/components/Button/buttonTheme.ts"],"sourcesContent":["import type { ButtonSize, IconButtonSize } from '@yahoo/uds-types';\nimport type { TextStyle, ViewStyle } from 'react-native';\n\nimport { fontMetrics } from '../../../generated/fontMetrics';\n\ntype ButtonTheme = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: Record<string, any>;\n};\n\nconst SHARED_BUTTON_ICONBUTTON_SIZES = new Set<IconButtonSize>(['xs', 'sm', 'md', 'lg']);\n// Covers common native font boxes (roughly 1.2em) plus pixel-rounding headroom.\nconst UNKNOWN_FONT_LINE_HEIGHT_RATIO = 1.3;\n\nfunction buttonSizePath(size: ButtonSize, layer: 'root' | 'icon' | 'rootText'): string {\n return `button/size/${size}/${layer}/rest`;\n}\n\nfunction iconButtonSizePath(size: IconButtonSize, layer: 'root' | 'icon'): string {\n return `iconButton/size/${size}/${layer}/rest`;\n}\n\nfunction getLayerStyle(theme: ButtonTheme, path: string): ViewStyle | TextStyle {\n const style = theme.components[path];\n return style && typeof style === 'object' ? style : {};\n}\n\nfunction getIconSize(iconStyle: TextStyle): number {\n return (\n (typeof iconStyle.fontSize === 'number' ? iconStyle.fontSize : undefined) ??\n (typeof iconStyle.lineHeight === 'number' ? iconStyle.lineHeight : undefined) ??\n 16\n );\n}\n\n/** Base icon size for an IconButton size layer. */\nfunction getIconButtonIconSize(theme: ButtonTheme, size: IconButtonSize): number {\n return getIconSize(getLayerStyle(theme, iconButtonSizePath(size, 'icon')) as TextStyle);\n}\n\nfunction getVerticalPadding(rootStyle: ViewStyle): number {\n return (\n (typeof rootStyle.paddingVertical === 'number' ? rootStyle.paddingVertical : undefined) ??\n (typeof rootStyle.padding === 'number' ? rootStyle.padding : undefined) ??\n 0\n );\n}\n\nfunction getMetricHeight(value: number, unitsPerEm: number, fontSize: number): number {\n return Math.ceil((Math.max(0, value) / unitsPerEm) * fontSize);\n}\n\nfunction getSafeLabelLineHeight(textStyle: TextStyle, fallbackFontSize: number): number {\n const fontSize = typeof textStyle.fontSize === 'number' ? textStyle.fontSize : fallbackFontSize;\n const tokenLineHeight =\n typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : fontSize;\n const metrics =\n typeof textStyle.fontFamily === 'string' ? fontMetrics[textStyle.fontFamily] : undefined;\n\n if (!metrics || metrics.unitsPerEm <= 0) {\n return Math.max(tokenLineHeight, Math.ceil(fontSize * UNKNOWN_FONT_LINE_HEIGHT_RATIO));\n }\n\n const metricsLineHeight =\n getMetricHeight(metrics.ascent, metrics.unitsPerEm, fontSize) +\n getMetricHeight(-metrics.descent, metrics.unitsPerEm, fontSize) +\n getMetricHeight(metrics.lineGap, metrics.unitsPerEm, fontSize);\n\n return Math.max(tokenLineHeight, metricsLineHeight);\n}\n\n/** Safe line box for the icon font's em square plus any bbox overflow. */\nexport function getSafeIconCell(fontSize: number): number {\n const metrics = fontMetrics['uds-icons'];\n if (!metrics || metrics.unitsPerEm <= 0) {\n return Math.ceil(fontSize * UNKNOWN_FONT_LINE_HEIGHT_RATIO);\n }\n\n const overflowAboveEm = Math.max(0, metrics.bbox.maxY - metrics.unitsPerEm);\n const overflowBelowEm = Math.max(0, -metrics.bbox.minY);\n\n return (\n Math.ceil(fontSize) +\n getMetricHeight(overflowAboveEm, metrics.unitsPerEm, fontSize) +\n getMetricHeight(overflowBelowEm, metrics.unitsPerEm, fontSize)\n );\n}\n\n/**\n * Safe native content metrics while retaining the token-derived target control height.\n *\n * `fontScaleFactor` pre-scales container metrics only. A single number keeps\n * the legacy linear behavior; distinct label/icon factors let Android 14+\n * geometry follow its size-dependent nonlinear font curve. The returned\n * `labelLineHeight`/`iconCellHeight` stay unscaled because native Text applies\n * the same cap.\n */\nexport function getButtonControlMetrics(\n theme: ButtonTheme,\n size: ButtonSize,\n fontScaleFactor: number | { label: number; icon: number; iconCell?: number } = 1,\n): {\n minHeight: number;\n labelLineHeight: number;\n iconCellHeight: number;\n paddingVertical: number;\n} {\n const rootStyle = getLayerStyle(theme, buttonSizePath(size, 'root')) as ViewStyle;\n const iconStyle = getLayerStyle(theme, buttonSizePath(size, 'icon')) as TextStyle;\n const textStyle = getLayerStyle(theme, buttonSizePath(size, 'rootText')) as TextStyle;\n const paddingVertical = getVerticalPadding(rootStyle);\n const iconSize = getIconSize(iconStyle);\n const fontSize = typeof textStyle.fontSize === 'number' ? textStyle.fontSize : iconSize;\n const tokenLineHeight =\n typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : fontSize;\n const labelScaleFactor =\n typeof fontScaleFactor === 'number' ? fontScaleFactor : fontScaleFactor.label;\n const iconScaleFactor =\n typeof fontScaleFactor === 'number' ? fontScaleFactor : fontScaleFactor.icon;\n const iconCellScaleFactor =\n typeof fontScaleFactor === 'number'\n ? fontScaleFactor\n : (fontScaleFactor.iconCell ?? fontScaleFactor.icon);\n const targetContentHeight = Math.max(\n iconSize * iconScaleFactor,\n tokenLineHeight * labelScaleFactor,\n );\n const minHeight = Math.ceil(paddingVertical * 2 + targetContentHeight);\n const labelLineHeight = getSafeLabelLineHeight(textStyle, iconSize);\n const iconCellHeight = getSafeIconCell(iconSize);\n const safeContentHeight = Math.max(\n labelLineHeight * labelScaleFactor,\n iconCellHeight * iconCellScaleFactor,\n );\n\n return {\n minHeight,\n labelLineHeight,\n iconCellHeight,\n paddingVertical: Math.max(0, (minHeight - safeContentHeight) / 2),\n };\n}\n\n/**\n * Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target.\n *\n * `fontScaleFactor` behaves as in {@link getButtonControlMetrics}; an explicit\n * token height stays fixed, with padding absorbing the scaled content.\n */\nexport function getIconButtonControlMetrics(\n theme: ButtonTheme,\n size: IconButtonSize,\n fontScaleFactor = 1,\n): {\n minHeight: number;\n iconCellHeight: number;\n paddingVertical: number;\n hasExplicitHeight: boolean;\n} {\n const rootStyle = getLayerStyle(theme, iconButtonSizePath(size, 'root')) as ViewStyle;\n const iconStyle = getLayerStyle(theme, iconButtonSizePath(size, 'icon')) as TextStyle;\n const iconSize = getIconButtonIconSize(theme, size);\n const tokenLineHeight =\n typeof iconStyle.lineHeight === 'number' ? iconStyle.lineHeight : iconSize;\n const paddingVertical = getVerticalPadding(rootStyle);\n const explicitHeight = typeof rootStyle.height === 'number' ? rootStyle.height : undefined;\n const hasExplicitHeight =\n SHARED_BUTTON_ICONBUTTON_SIZES.has(size) && explicitHeight !== undefined;\n const minHeight = hasExplicitHeight\n ? (explicitHeight as number)\n : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight) * fontScaleFactor);\n const iconCellHeight = getSafeIconCell(iconSize);\n\n return {\n minHeight,\n iconCellHeight,\n paddingVertical: Math.max(\n 0,\n (minHeight - Math.max(iconSize, iconCellHeight) * fontScaleFactor) / 2,\n ),\n hasExplicitHeight,\n };\n}\n\n/** Apply the metric-safe line height after the token typography styles. */\nexport function getButtonTextStyle(textStyle: TextStyle, labelLineHeight: number): TextStyle {\n return {\n ...textStyle,\n lineHeight: labelLineHeight,\n };\n}\n\nexport { getIconButtonIconSize };\n"],"mappings":";;;AAUA,MAAM,iCAAiC,IAAI,IAAoB;CAAC;CAAM;CAAM;CAAM;CAAK,CAAC;AAExF,MAAM,iCAAiC;AAEvC,SAAS,eAAe,MAAkB,OAA6C;CACrF,OAAO,eAAe,KAAK,GAAG,MAAM;;AAGtC,SAAS,mBAAmB,MAAsB,OAAgC;CAChF,OAAO,mBAAmB,KAAK,GAAG,MAAM;;AAG1C,SAAS,cAAc,OAAoB,MAAqC;CAC9E,MAAM,QAAQ,MAAM,WAAW;CAC/B,OAAO,SAAS,OAAO,UAAU,WAAW,QAAQ,EAAE;;AAGxD,SAAS,YAAY,WAA8B;CACjD,QACG,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW,KAAA,OAC9D,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa,KAAA,MACnE;;;AAKJ,SAAS,sBAAsB,OAAoB,MAA8B;CAC/E,OAAO,YAAY,cAAc,OAAO,mBAAmB,MAAM,OAAO,CAAC,CAAc;;AAGzF,SAAS,mBAAmB,WAA8B;CACxD,QACG,OAAO,UAAU,oBAAoB,WAAW,UAAU,kBAAkB,KAAA,OAC5E,OAAO,UAAU,YAAY,WAAW,UAAU,UAAU,KAAA,MAC7D;;AAIJ,SAAS,gBAAgB,OAAe,YAAoB,UAA0B;CACpF,OAAO,KAAK,KAAM,KAAK,IAAI,GAAG,MAAM,GAAG,aAAc,SAAS;;AAGhE,SAAS,uBAAuB,WAAsB,kBAAkC;CACtF,MAAM,WAAW,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW;CAC/E,MAAM,kBACJ,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa;CACpE,MAAM,UACJ,OAAO,UAAU,eAAe,WAAW,YAAY,UAAU,cAAc,KAAA;CAEjF,IAAI,CAAC,WAAW,QAAQ,cAAc,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gB;CACnD,MAAM,sBAAsB,KAAK,IAC/B,WAAW,iBACX,kBAAkB,iBACnB;CACD,MAAM,YAAY,KAAK,KAAK,kBAAkB,IAAI,oBAAoB;CACtE,MAAM,kBAAkB,uBAAuB,WAAW,SAAS;CACnE,MAAM,iBAAiB,gBAAgB,SAAS;CAChD,MAAM,oBAAoB,KAAK,IAC7B,kBAAkB,kBAClB,iBAAiB,oBAClB;CAED,OAAO;EACL;EACA;EACA;EACA,iBAAiB,KAAK,IAAI,IAAI,YAAY,qBAAqB,EAAE;EAClE;;;;;;;;AASH,SAAgB,4BACd,OACA,MACA,kBAAkB,GAMlB;CACA,MAAM,YAAY,cAAc,OAAO,mBAAmB,MAAM,OAAO,CAAC;CACxE,MAAM,YAAY,cAAc,OAAO,mBAAmB,MAAM,OAAO,CAAC;CACxE,MAAM,WAAW,sBAAsB,OAAO,KAAK;CACnD,MAAM,kBACJ,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa;CACpE,MAAM,kBAAkB,mBAAmB,UAAU;CACrD,MAAM,iBAAiB,OAAO,UAAU,WAAW,WAAW,UAAU,SAAS,KAAA;CACjF,MAAM,oBACJ,+BAA+B,IAAI,KAAK,IAAI,mBAAmB,KAAA;CACjE,MAAM,YAAY,oBACb,iBACD,KAAK,KAAK,kBAAkB,IAAI,KAAK,IAAI,UAAU,gBAAgB,GAAG,gBAAgB;CAC1F,MAAM,iBAAiB,gBAAgB,SAAS;CAEhD,OAAO;EACL;EACA;EACA,iBAAiB,KAAK,IACpB,IACC,YAAY,KAAK,IAAI,UAAU,eAAe,GAAG,mBAAmB,EACtE;EACD;EACD;;;AAIH,SAAgB,mBAAmB,WAAsB,iBAAoC;CAC3F,OAAO;EACL,GAAG;EACH,YAAY;EACb"}
@@ -3,6 +3,9 @@ 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_FontScalingContext = require("../fontScaling/FontScalingContext.cjs");
7
+ const require_fontScaling_useFontScale = require("../fontScaling/useFontScale.cjs");
8
+ const require_fontScaling_useMaxFontSizeMultiplier = require("../fontScaling/useMaxFontSizeMultiplier.cjs");
6
9
  const require_components_Button_buttonTheme = require("./Button/buttonTheme.cjs");
7
10
  const require_components_IconSlot = require("./IconSlot.cjs");
8
11
  const require_components_Text = require("./Text.cjs");
@@ -84,10 +87,12 @@ function AnimatedIconSlot({ children, visible, iconSize, iconCellHeight, gap })
84
87
  * @see {@link IconButton} for icon-only buttons
85
88
  * @see {@link Link} for navigation actions
86
89
  */
87
- const Button = (0, react.memo)(function Button({ variant = "primary", size = "md", iconVariant = "outline", startIcon, endIcon, loading, disabled, width: _width, children, style, accessibilityLabel, accessibilityHint, disableEffects = false, onPressIn, onPressOut, ref, ...props }) {
90
+ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md", iconVariant = "outline", startIcon, endIcon, loading, disabled, width: _width, children, style, accessibilityLabel, accessibilityHint, disableEffects = false, maxFontSizeMultiplier, onPressIn, onPressOut, ref, ...props }) {
88
91
  const shouldAnimate = !disableEffects;
92
+ const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
89
93
  const { theme } = (0, react_native_unistyles.useUnistyles)();
90
- const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = (0, react.useMemo)(() => require_components_Button_buttonTheme.getButtonControlMetrics(theme, size), [theme, size]);
94
+ const baseMetrics = (0, react.useMemo)(() => require_components_Button_buttonTheme.getButtonControlMetrics(theme, size), [theme, size]);
95
+ const labelScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, baseMetrics.labelLineHeight);
91
96
  const [pressed, setPressed] = (0, react.useState)(false);
92
97
  generated_styles.buttonStyles.useVariants({
93
98
  size,
@@ -97,6 +102,19 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
97
102
  });
98
103
  const buttonGap = generated_styles.buttonStyles.root.gap;
99
104
  const iconSize = generated_styles.buttonStyles.icon.fontSize;
105
+ const iconScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, iconSize);
106
+ const iconCellScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, baseMetrics.iconCellHeight);
107
+ const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = (0, react.useMemo)(() => require_components_Button_buttonTheme.getButtonControlMetrics(theme, size, {
108
+ label: labelScaleFactor,
109
+ icon: iconScaleFactor,
110
+ iconCell: iconCellScaleFactor
111
+ }), [
112
+ theme,
113
+ size,
114
+ labelScaleFactor,
115
+ iconScaleFactor,
116
+ iconCellScaleFactor
117
+ ]);
100
118
  const animatedTheme = (0, react_native_unistyles_reanimated.useAnimatedTheme)();
101
119
  const scale = (0, react_native_reanimated.useSharedValue)(require_index.SCALE_EFFECTS.none);
102
120
  const handlePressIn = (0, react.useCallback)((event) => {
@@ -117,9 +135,14 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
117
135
  scale,
118
136
  onPressOut
119
137
  ]);
120
- const childrenNode = children && ((0, react.isValidElement)(children) ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
138
+ const childrenNode = children && ((0, react.isValidElement)(children) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fontScaling_FontScalingContext.ResolvedControlFontScalingProvider, {
139
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
140
+ children
141
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
142
+ variant: "inherit",
121
143
  numberOfLines: 1,
122
144
  textAlign: "center",
145
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
123
146
  style: require_components_Button_buttonTheme.getButtonTextStyle(generated_styles.buttonStyles.text, labelLineHeight),
124
147
  children
125
148
  }));
@@ -142,30 +165,34 @@ const Button = (0, react.memo)(function Button({ variant = "primary", size = "md
142
165
  const showStartIcon = !!startIcon && !loading;
143
166
  const showEndIcon = !!endIcon && !loading;
144
167
  const iconSizeToken = generated_styles.buttonStyles.icon.iconSizeToken ?? "sm";
168
+ const scaledIconSize = Math.round(iconSize * iconScaleFactor);
169
+ const scaledIconCellHeight = Math.ceil(iconCellHeight * iconCellScaleFactor);
145
170
  const startContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedIconSlot, {
146
171
  visible: showLoading || showStartIcon,
147
- iconSize,
148
- iconCellHeight,
172
+ iconSize: scaledIconSize,
173
+ iconCellHeight: scaledIconCellHeight,
149
174
  gap: buttonGap,
150
175
  children: showLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ActivityIndicator, {
151
- size: generated_styles.buttonStyles.icon.fontSize,
176
+ size: scaledIconSize,
152
177
  color: generated_styles.buttonStyles.icon.color
153
178
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
154
179
  icon: startIcon,
155
180
  size: iconSizeToken,
156
181
  variant: iconVariant,
182
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
157
183
  style: [generated_styles.buttonStyles.icon, { lineHeight: iconCellHeight }]
158
184
  })
159
185
  });
160
186
  const endContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedIconSlot, {
161
187
  visible: showEndIcon,
162
- iconSize,
163
- iconCellHeight,
188
+ iconSize: scaledIconSize,
189
+ iconCellHeight: scaledIconCellHeight,
164
190
  gap: buttonGap,
165
191
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
166
192
  icon: endIcon,
167
193
  size: iconSizeToken,
168
194
  variant: iconVariant,
195
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
169
196
  style: [generated_styles.buttonStyles.icon, { lineHeight: iconCellHeight }]
170
197
  })
171
198
  });
@@ -29,6 +29,13 @@ interface ButtonProps extends Omit<PressableProps$1, 'children' | 'disabled'> {
29
29
  * @default false
30
30
  */
31
31
  disableEffects?: boolean;
32
+ /**
33
+ * Caps how far the label and icons grow with the OS text-size setting; the
34
+ * button grows to fit the scaled content. Set null to remove the cap;
35
+ * override app-wide via UDSFontScalingProvider.
36
+ * @default 2
37
+ */
38
+ maxFontSizeMultiplier?: number | null;
32
39
  /** Ref to the underlying View */
33
40
  ref?: Ref<View>;
34
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.cts","names":[],"sources":["../../src/components/Button.tsx"],"mappings":";;;;;;;;;UAqHU,WAAA,SAAoB,IAAA,CAAK,gBAAA;;EAEjC,OAAA,GAAU,iBAAA;EAFF;EAIR,IAAA,GAAO,UAAA;;EAEP,WAAA,GAAc,WAAA;EAJJ;EAMV,SAAA,GAAY,YAAA;EAFE;EAId,OAAA,GAAU,YAAA;EAAA;EAEV,OAAA;EAWU;EATV,QAAA;EAd4B;EAgB5B,QAAA,GAAW,KAAA,CAAM,SAAA;EAhBe;;;;EAqBhC,cAAA;EAjBA;EAmBA,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;;;;;;AAAI;;;;;;;;;;;;;;;;cAuCV,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
1
+ {"version":3,"file":"Button.d.cts","names":[],"sources":["../../src/components/Button.tsx"],"mappings":";;;;;;;;;UAwHU,WAAA,SAAoB,IAAA,CAAK,gBAAA;;EAEjC,OAAA,GAAU,iBAAA;EAFF;EAIR,IAAA,GAAO,UAAA;;EAEP,WAAA,GAAc,WAAA;EAJJ;EAMV,SAAA,GAAY,YAAA;EAFE;EAId,OAAA,GAAU,YAAA;EAAA;EAEV,OAAA;EAkBU;EAhBV,QAAA;EAd4B;EAgB5B,QAAA,GAAW,KAAA,CAAM,SAAA;EAhBe;;;;EAqBhC,cAAA;EAjBA;;;;;;EAwBA,qBAAA;EAlBU;EAoBV,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;AAAI;;;;;;;;;;;;;;;;;;;;;;cAuCV,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
@@ -29,6 +29,13 @@ interface ButtonProps extends Omit<PressableProps$1, 'children' | 'disabled'> {
29
29
  * @default false
30
30
  */
31
31
  disableEffects?: boolean;
32
+ /**
33
+ * Caps how far the label and icons grow with the OS text-size setting; the
34
+ * button grows to fit the scaled content. Set null to remove the cap;
35
+ * override app-wide via UDSFontScalingProvider.
36
+ * @default 2
37
+ */
38
+ maxFontSizeMultiplier?: number | null;
32
39
  /** Ref to the underlying View */
33
40
  ref?: Ref<View>;
34
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","names":[],"sources":["../../src/components/Button.tsx"],"mappings":";;;;;;;;;UAqHU,WAAA,SAAoB,IAAA,CAAK,gBAAA;;EAEjC,OAAA,GAAU,iBAAA;EAFF;EAIR,IAAA,GAAO,UAAA;;EAEP,WAAA,GAAc,WAAA;EAJJ;EAMV,SAAA,GAAY,YAAA;EAFE;EAId,OAAA,GAAU,YAAA;EAAA;EAEV,OAAA;EAWU;EATV,QAAA;EAd4B;EAgB5B,QAAA,GAAW,KAAA,CAAM,SAAA;EAhBe;;;;EAqBhC,cAAA;EAjBA;EAmBA,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;;;;;;AAAI;;;;;;;;;;;;;;;;cAuCV,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
1
+ {"version":3,"file":"Button.d.ts","names":[],"sources":["../../src/components/Button.tsx"],"mappings":";;;;;;;;;UAwHU,WAAA,SAAoB,IAAA,CAAK,gBAAA;;EAEjC,OAAA,GAAU,iBAAA;EAFF;EAIR,IAAA,GAAO,UAAA;;EAEP,WAAA,GAAc,WAAA;EAJJ;EAMV,SAAA,GAAY,YAAA;EAFE;EAId,OAAA,GAAU,YAAA;EAAA;EAEV,OAAA;EAkBU;EAhBV,QAAA;EAd4B;EAgB5B,QAAA,GAAW,KAAA,CAAM,SAAA;EAhBe;;;;EAqBhC,cAAA;EAjBA;;;;;;EAwBA,qBAAA;EAlBU;EAoBV,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;AAAI;;;;;;;;;;;;;;;;;;;;;;cAuCV,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
@@ -1,6 +1,9 @@
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 { ResolvedControlFontScalingProvider } from "../fontScaling/FontScalingContext.js";
5
+ import { useComponentFontScale } from "../fontScaling/useFontScale.js";
6
+ import { useMaxFontSizeMultiplier } from "../fontScaling/useMaxFontSizeMultiplier.js";
4
7
  import { getButtonControlMetrics, getButtonTextStyle } from "./Button/buttonTheme.js";
5
8
  import { IconSlot } from "./IconSlot.js";
6
9
  import { Text as Text$1 } from "./Text.js";
@@ -81,10 +84,12 @@ function AnimatedIconSlot({ children, visible, iconSize, iconCellHeight, gap })
81
84
  * @see {@link IconButton} for icon-only buttons
82
85
  * @see {@link Link} for navigation actions
83
86
  */
84
- const Button = memo(function Button({ variant = "primary", size = "md", iconVariant = "outline", startIcon, endIcon, loading, disabled, width: _width, children, style, accessibilityLabel, accessibilityHint, disableEffects = false, onPressIn, onPressOut, ref, ...props }) {
87
+ const Button = memo(function Button({ variant = "primary", size = "md", iconVariant = "outline", startIcon, endIcon, loading, disabled, width: _width, children, style, accessibilityLabel, accessibilityHint, disableEffects = false, maxFontSizeMultiplier, onPressIn, onPressOut, ref, ...props }) {
85
88
  const shouldAnimate = !disableEffects;
89
+ const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
86
90
  const { theme } = useUnistyles();
87
- const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = useMemo(() => getButtonControlMetrics(theme, size), [theme, size]);
91
+ const baseMetrics = useMemo(() => getButtonControlMetrics(theme, size), [theme, size]);
92
+ const labelScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, baseMetrics.labelLineHeight);
88
93
  const [pressed, setPressed] = useState(false);
89
94
  buttonStyles.useVariants({
90
95
  size,
@@ -94,6 +99,19 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
94
99
  });
95
100
  const buttonGap = buttonStyles.root.gap;
96
101
  const iconSize = buttonStyles.icon.fontSize;
102
+ const iconScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, iconSize);
103
+ const iconCellScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, baseMetrics.iconCellHeight);
104
+ const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = useMemo(() => getButtonControlMetrics(theme, size, {
105
+ label: labelScaleFactor,
106
+ icon: iconScaleFactor,
107
+ iconCell: iconCellScaleFactor
108
+ }), [
109
+ theme,
110
+ size,
111
+ labelScaleFactor,
112
+ iconScaleFactor,
113
+ iconCellScaleFactor
114
+ ]);
97
115
  const animatedTheme = useAnimatedTheme();
98
116
  const scale = useSharedValue(SCALE_EFFECTS.none);
99
117
  const handlePressIn = useCallback((event) => {
@@ -114,9 +132,14 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
114
132
  scale,
115
133
  onPressOut
116
134
  ]);
117
- const childrenNode = children && (isValidElement(children) ? children : /* @__PURE__ */ jsx(Text$1, {
135
+ const childrenNode = children && (isValidElement(children) ? /* @__PURE__ */ jsx(ResolvedControlFontScalingProvider, {
136
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
137
+ children
138
+ }) : /* @__PURE__ */ jsx(Text$1, {
139
+ variant: "inherit",
118
140
  numberOfLines: 1,
119
141
  textAlign: "center",
142
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
120
143
  style: getButtonTextStyle(buttonStyles.text, labelLineHeight),
121
144
  children
122
145
  }));
@@ -139,30 +162,34 @@ const Button = memo(function Button({ variant = "primary", size = "md", iconVari
139
162
  const showStartIcon = !!startIcon && !loading;
140
163
  const showEndIcon = !!endIcon && !loading;
141
164
  const iconSizeToken = buttonStyles.icon.iconSizeToken ?? "sm";
165
+ const scaledIconSize = Math.round(iconSize * iconScaleFactor);
166
+ const scaledIconCellHeight = Math.ceil(iconCellHeight * iconCellScaleFactor);
142
167
  const startContent = /* @__PURE__ */ jsx(AnimatedIconSlot, {
143
168
  visible: showLoading || showStartIcon,
144
- iconSize,
145
- iconCellHeight,
169
+ iconSize: scaledIconSize,
170
+ iconCellHeight: scaledIconCellHeight,
146
171
  gap: buttonGap,
147
172
  children: showLoading ? /* @__PURE__ */ jsx(ActivityIndicator, {
148
- size: buttonStyles.icon.fontSize,
173
+ size: scaledIconSize,
149
174
  color: buttonStyles.icon.color
150
175
  }) : /* @__PURE__ */ jsx(IconSlot, {
151
176
  icon: startIcon,
152
177
  size: iconSizeToken,
153
178
  variant: iconVariant,
179
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
154
180
  style: [buttonStyles.icon, { lineHeight: iconCellHeight }]
155
181
  })
156
182
  });
157
183
  const endContent = /* @__PURE__ */ jsx(AnimatedIconSlot, {
158
184
  visible: showEndIcon,
159
- iconSize,
160
- iconCellHeight,
185
+ iconSize: scaledIconSize,
186
+ iconCellHeight: scaledIconCellHeight,
161
187
  gap: buttonGap,
162
188
  children: /* @__PURE__ */ jsx(IconSlot, {
163
189
  icon: endIcon,
164
190
  size: iconSizeToken,
165
191
  variant: iconVariant,
192
+ maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
166
193
  style: [buttonStyles.icon, { lineHeight: iconCellHeight }]
167
194
  })
168
195
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconSize, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\n// eslint-disable-next-line uds/no-use-unistyles -- button control height from theme size layers\nimport { useUnistyles } from 'react-native-unistyles';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { getButtonControlMetrics, getButtonTextStyle } from './Button/buttonTheme';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string | undefined, alpha: number): string {\n 'worklet';\n if (!shadow) {\n return '';\n }\n if (alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n iconCellHeight,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n iconCellHeight: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n minHeight: iconCellHeight,\n justifyContent: 'center' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** The visual style variant of the button @default 'primary' */\n variant?: ButtonVariantFlat;\n /** The size of the button @default 'md' */\n size?: ButtonSize;\n /** The icon style variant @default 'outline' */\n iconVariant?: IconVariant;\n /** Icon displayed before the button label */\n startIcon?: IconSlotType;\n /** Icon displayed after the button label */\n endIcon?: IconSlotType;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Button label content */\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile/Button';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"button\"` automatically\n * - Announces loading state to screen readers\n * - Use `accessibilityLabel` for icon-only buttons\n *\n * @see {@link IconButton} for icon-only buttons\n * @see {@link Link} for navigation actions\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n const { theme } = useUnistyles();\n const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = useMemo(\n () => getButtonControlMetrics(theme, size),\n [theme, size],\n );\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n children\n ) : (\n <Text\n numberOfLines={1}\n textAlign=\"center\"\n style={getButtonTextStyle(buttonStyles.text, labelLineHeight)}\n >\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath]?.boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // Only animate shadow if the theme defines one for this variant\n ...(shadowPressed && {\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n }),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n const iconSizeToken = (buttonStyles.icon.iconSizeToken as IconSize) ?? 'sm';\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot\n visible={showLoading || showStartIcon}\n iconSize={iconSize}\n iconCellHeight={iconCellHeight}\n gap={buttonGap}\n >\n {showLoading ? (\n <ActivityIndicator size={buttonStyles.icon.fontSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot\n icon={startIcon}\n size={iconSizeToken}\n variant={iconVariant}\n style={[buttonStyles.icon, { lineHeight: iconCellHeight }]}\n />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot\n visible={showEndIcon}\n iconSize={iconSize}\n iconCellHeight={iconCellHeight}\n gap={buttonGap}\n >\n <IconSlot\n icon={endIcon}\n size={iconSizeToken}\n variant={iconVariant}\n style={[buttonStyles.icon, { lineHeight: iconCellHeight }]}\n />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n { minHeight, paddingVertical },\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, minHeight, paddingVertical, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,SAAS,uBAAuB,QAA4B,OAAuB;AACjF;CACA,IAAI,CAAC,QACH,OAAO;CAET,IAAI,SAAS,GACX,OAAO;CAET,IAAI,S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J,oBAAC,kBAAD;EACE,SAAS,eAAe;EACd;EACM;EAChB,KAAK;YAEJ,cACC,oBAAC,mBAAD;GAAmB,MAAM,aAAa,KAAK;GAAU,OAAO,aAAa,KAAK;GAAS,CAAA,GAEvF,oBAAC,UAAD;GACE,MAAM;GACN,MAAM;GACN,SAAS;GACT,OAAO,CAAC,aAAa,MAAM,EAAE,YAAY,gBAAgB,CAAC;GAC1D,CAAA;EAEa,CAAA;CAIrB,MAAM,aACJ,oBAAC,kBAAD;EACE,SAAS;EACC;EACM;EAChB,KAAK;YAEL,oBAAC,UAAD;GACE,MAAM;GACN,MAAM;GACN,SAAS;GACT,OAAO,CAAC,aAAa,MAAM,EAAE,YAAY,gBAAgB,CAAC;GAC1D,CAAA;EACe,CAAA;CAGrB,MAAM,aAAa,cACX;EACJ,aAAa;EACb;GAAE;GAAW;GAAiB;EAC9B;EACA,OAAO,UAAU,aAAa,MAAM,EAAE,SAAS,CAAC,GAAG;EACpD,EACD;EAAC,aAAa;EAAM;EAAW;EAAiB;EAAgB;EAAO;EAAQ,CAChF;CAGD,OACE,qBAAC,mBAAD;EACO;EACK;EACV,WAAW;EACX,YAAY;EACZ,eAAc;EACd,YAAW;EACX,gBAAe;EACf,UAAS;EACT,oBAAoB,UAAU,GAAG,sBAAsB,GAAG,aAAa;EACpD;EACnB,mBAAkB;EAClB,oBAAoB;EACpB,cAAa;EACb,OAAO;EACP,GAAI;YAfN;GAiBG;GACA;GACA;GACiB;;EAEtB;AAEF,OAAO,cAAc"}
1
+ {"version":3,"file":"Button.js","names":["Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconSize, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\n// eslint-disable-next-line uds/no-use-unistyles -- button control height from theme size layers\nimport { useUnistyles } from 'react-native-unistyles';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { ResolvedControlFontScalingProvider } from '../fontScaling/FontScalingContext';\nimport { useComponentFontScale } from '../fontScaling/useFontScale';\nimport { useMaxFontSizeMultiplier } from '../fontScaling/useMaxFontSizeMultiplier';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { getButtonControlMetrics, getButtonTextStyle } from './Button/buttonTheme';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string | undefined, alpha: number): string {\n 'worklet';\n if (!shadow) {\n return '';\n }\n if (alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n iconCellHeight,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n iconCellHeight: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n minHeight: iconCellHeight,\n justifyContent: 'center' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** The visual style variant of the button @default 'primary' */\n variant?: ButtonVariantFlat;\n /** The size of the button @default 'md' */\n size?: ButtonSize;\n /** The icon style variant @default 'outline' */\n iconVariant?: IconVariant;\n /** Icon displayed before the button label */\n startIcon?: IconSlotType;\n /** Icon displayed after the button label */\n endIcon?: IconSlotType;\n /** Shows a loading spinner and disables the button */\n loading?: boolean;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Button label content */\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n /**\n * Caps how far the label and icons grow with the OS text-size setting; the\n * button grows to fit the scaled content. Set null to remove the cap;\n * override app-wide via UDSFontScalingProvider.\n * @default 2\n */\n maxFontSizeMultiplier?: number | null;\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile/Button';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"button\"` automatically\n * - Announces loading state to screen readers\n * - Use `accessibilityLabel` for icon-only buttons\n *\n * @see {@link IconButton} for icon-only buttons\n * @see {@link Link} for navigation actions\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n maxFontSizeMultiplier,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n // Inside a control, \"no cap resolved\" must force-uncap (0) rather than let\n // the label's own variant default or an inherited cap apply.\n const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier('control', maxFontSizeMultiplier);\n\n const { theme } = useUnistyles();\n const baseMetrics = useMemo(() => getButtonControlMetrics(theme, size), [theme, size]);\n const labelScaleFactor = useComponentFontScale(\n resolvedMaxFontSizeMultiplier,\n baseMetrics.labelLineHeight,\n );\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n const iconScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, iconSize);\n const iconCellScaleFactor = useComponentFontScale(\n resolvedMaxFontSizeMultiplier,\n baseMetrics.iconCellHeight,\n );\n const { minHeight, labelLineHeight, iconCellHeight, paddingVertical } = useMemo(\n () =>\n getButtonControlMetrics(theme, size, {\n label: labelScaleFactor,\n icon: iconScaleFactor,\n iconCell: iconCellScaleFactor,\n }),\n [theme, size, labelScaleFactor, iconScaleFactor, iconCellScaleFactor],\n );\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n <ResolvedControlFontScalingProvider maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}>\n {children}\n </ResolvedControlFontScalingProvider>\n ) : (\n <Text\n variant=\"inherit\"\n numberOfLines={1}\n textAlign=\"center\"\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={getButtonTextStyle(buttonStyles.text, labelLineHeight)}\n >\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath]?.boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // Only animate shadow if the theme defines one for this variant\n ...(shadowPressed && {\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n }),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n const iconSizeToken = (buttonStyles.icon.iconSizeToken as IconSize) ?? 'sm';\n\n // Containers pre-scale by the capped factor; icon styles stay unscaled and\n // native grows them by the same capped multiplier.\n const scaledIconSize = Math.round(iconSize * iconScaleFactor);\n const scaledIconCellHeight = Math.ceil(iconCellHeight * iconCellScaleFactor);\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot\n visible={showLoading || showStartIcon}\n iconSize={scaledIconSize}\n iconCellHeight={scaledIconCellHeight}\n gap={buttonGap}\n >\n {showLoading ? (\n <ActivityIndicator size={scaledIconSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot\n icon={startIcon}\n size={iconSizeToken}\n variant={iconVariant}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={[buttonStyles.icon, { lineHeight: iconCellHeight }]}\n />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot\n visible={showEndIcon}\n iconSize={scaledIconSize}\n iconCellHeight={scaledIconCellHeight}\n gap={buttonGap}\n >\n <IconSlot\n icon={endIcon}\n size={iconSizeToken}\n variant={iconVariant}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={[buttonStyles.icon, { lineHeight: iconCellHeight }]}\n />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n { minHeight, paddingVertical },\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, minHeight, paddingVertical, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,uBAAuB,QAA4B,OAAuB;AACjF;CACA,IAAI,CAAC,QACH,OAAO;CAET,IAAI,SAAS,GACX,OAAO;CAET,IAAI,SAAS,GACX,OAAO;CAGT,OAAO,OAAO,QAAQ,sDAAsD,GAAG,GAAG,GAAG,GAAG,MAAM;EAE5F,OAAO,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KADZ,WAAW,EAAE,GAAG,OACS,QAAQ,EAAE,CAAC;GACrD;;;;;;;AAYJ,SAAS,iBAAiB,EACxB,UACA,SACA,UACA,gBACA,OAOC;CAGD,MAAM,WAAW,sBACT,WAAW,UAAU,IA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