@yahoo/uds-mobile 2.24.0-beta.1 → 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 (236) hide show
  1. package/README.md +37 -1
  2. package/dist/components/Avatar/AvatarIcon.cjs +8 -2
  3. package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -1
  4. package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -1
  5. package/dist/components/Avatar/AvatarIcon.js +9 -3
  6. package/dist/components/Avatar/AvatarIcon.js.map +1 -1
  7. package/dist/components/Avatar/AvatarImage.cjs +9 -2
  8. package/dist/components/Avatar/AvatarImage.d.cts.map +1 -1
  9. package/dist/components/Avatar/AvatarImage.d.ts.map +1 -1
  10. package/dist/components/Avatar/AvatarImage.js +10 -3
  11. package/dist/components/Avatar/AvatarImage.js.map +1 -1
  12. package/dist/components/Avatar/AvatarText.cjs +8 -2
  13. package/dist/components/Avatar/AvatarText.d.cts.map +1 -1
  14. package/dist/components/Avatar/AvatarText.d.ts.map +1 -1
  15. package/dist/components/Avatar/AvatarText.js +9 -3
  16. package/dist/components/Avatar/AvatarText.js.map +1 -1
  17. package/dist/components/Avatar/types.d.cts +7 -3
  18. package/dist/components/Avatar/types.d.cts.map +1 -1
  19. package/dist/components/Avatar/types.d.ts +7 -3
  20. package/dist/components/Avatar/types.d.ts.map +1 -1
  21. package/dist/components/Avatar/useAvatarFontScale.cjs +16 -0
  22. package/dist/components/Avatar/useAvatarFontScale.d.cts +7 -0
  23. package/dist/components/Avatar/useAvatarFontScale.d.cts.map +1 -0
  24. package/dist/components/Avatar/useAvatarFontScale.d.ts +7 -0
  25. package/dist/components/Avatar/useAvatarFontScale.d.ts.map +1 -0
  26. package/dist/components/Avatar/useAvatarFontScale.js +16 -0
  27. package/dist/components/Avatar/useAvatarFontScale.js.map +1 -0
  28. package/dist/components/Avatar/utils.cjs +9 -6
  29. package/dist/components/Avatar/utils.d.cts +2 -2
  30. package/dist/components/Avatar/utils.d.cts.map +1 -1
  31. package/dist/components/Avatar/utils.d.ts +2 -2
  32. package/dist/components/Avatar/utils.d.ts.map +1 -1
  33. package/dist/components/Avatar/utils.js +9 -6
  34. package/dist/components/Avatar/utils.js.map +1 -1
  35. package/dist/components/Button/buttonTheme.cjs +16 -7
  36. package/dist/components/Button/buttonTheme.d.cts +13 -6
  37. package/dist/components/Button/buttonTheme.d.cts.map +1 -1
  38. package/dist/components/Button/buttonTheme.d.ts +13 -6
  39. package/dist/components/Button/buttonTheme.d.ts.map +1 -1
  40. package/dist/components/Button/buttonTheme.js +16 -8
  41. package/dist/components/Button/buttonTheme.js.map +1 -1
  42. package/dist/components/Button.cjs +25 -11
  43. package/dist/components/Button.d.cts.map +1 -1
  44. package/dist/components/Button.d.ts.map +1 -1
  45. package/dist/components/Button.js +25 -11
  46. package/dist/components/Button.js.map +1 -1
  47. package/dist/components/Checkbox.cjs +16 -6
  48. package/dist/components/Checkbox.d.cts.map +1 -1
  49. package/dist/components/Checkbox.d.ts.map +1 -1
  50. package/dist/components/Checkbox.js +16 -6
  51. package/dist/components/Checkbox.js.map +1 -1
  52. package/dist/components/Chip/ChipBase.cjs +24 -21
  53. package/dist/components/Chip/ChipBase.js +24 -21
  54. package/dist/components/Chip/ChipBase.js.map +1 -1
  55. package/dist/components/Icon.cjs +22 -6
  56. package/dist/components/Icon.d.cts +6 -5
  57. package/dist/components/Icon.d.cts.map +1 -1
  58. package/dist/components/Icon.d.ts +6 -5
  59. package/dist/components/Icon.d.ts.map +1 -1
  60. package/dist/components/Icon.js +22 -6
  61. package/dist/components/Icon.js.map +1 -1
  62. package/dist/components/IconButton.cjs +17 -6
  63. package/dist/components/IconButton.d.cts +6 -0
  64. package/dist/components/IconButton.d.cts.map +1 -1
  65. package/dist/components/IconButton.d.ts +6 -0
  66. package/dist/components/IconButton.d.ts.map +1 -1
  67. package/dist/components/IconButton.js +18 -7
  68. package/dist/components/IconButton.js.map +1 -1
  69. package/dist/components/Input.cjs +56 -18
  70. package/dist/components/Input.d.cts +5 -0
  71. package/dist/components/Input.d.cts.map +1 -1
  72. package/dist/components/Input.d.ts +5 -0
  73. package/dist/components/Input.d.ts.map +1 -1
  74. package/dist/components/Input.js +56 -18
  75. package/dist/components/Input.js.map +1 -1
  76. package/dist/components/InputHelpText.cjs +7 -1
  77. package/dist/components/InputHelpText.d.cts +2 -0
  78. package/dist/components/InputHelpText.d.cts.map +1 -1
  79. package/dist/components/InputHelpText.d.ts +2 -0
  80. package/dist/components/InputHelpText.d.ts.map +1 -1
  81. package/dist/components/InputHelpText.js +7 -1
  82. package/dist/components/InputHelpText.js.map +1 -1
  83. package/dist/components/Link.cjs +13 -1
  84. package/dist/components/Link.d.cts +7 -0
  85. package/dist/components/Link.d.cts.map +1 -1
  86. package/dist/components/Link.d.ts +7 -0
  87. package/dist/components/Link.d.ts.map +1 -1
  88. package/dist/components/Link.js +13 -1
  89. package/dist/components/Link.js.map +1 -1
  90. package/dist/components/Pagination/Pagination.cjs +18 -10
  91. package/dist/components/Pagination/Pagination.d.cts +2 -0
  92. package/dist/components/Pagination/Pagination.d.cts.map +1 -1
  93. package/dist/components/Pagination/Pagination.d.ts +2 -0
  94. package/dist/components/Pagination/Pagination.d.ts.map +1 -1
  95. package/dist/components/Pagination/Pagination.js +18 -10
  96. package/dist/components/Pagination/Pagination.js.map +1 -1
  97. package/dist/components/Pagination/PaginationEllipsis.cjs +8 -2
  98. package/dist/components/Pagination/PaginationEllipsis.d.cts.map +1 -1
  99. package/dist/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
  100. package/dist/components/Pagination/PaginationEllipsis.js +9 -3
  101. package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
  102. package/dist/components/Pagination/PaginationItem.cjs +2 -1
  103. package/dist/components/Pagination/PaginationItem.js +2 -1
  104. package/dist/components/Pagination/PaginationItem.js.map +1 -1
  105. package/dist/components/Pagination/PaginationLink.cjs +2 -1
  106. package/dist/components/Pagination/PaginationLink.js +2 -1
  107. package/dist/components/Pagination/PaginationLink.js.map +1 -1
  108. package/dist/components/Pagination/PaginationNext.cjs +3 -1
  109. package/dist/components/Pagination/PaginationNext.js +3 -1
  110. package/dist/components/Pagination/PaginationNext.js.map +1 -1
  111. package/dist/components/Pagination/PaginationPrev.cjs +3 -1
  112. package/dist/components/Pagination/PaginationPrev.js +3 -1
  113. package/dist/components/Pagination/PaginationPrev.js.map +1 -1
  114. package/dist/components/Pagination/paginationContext.d.cts +2 -0
  115. package/dist/components/Pagination/paginationContext.d.cts.map +1 -1
  116. package/dist/components/Pagination/paginationContext.d.ts +2 -0
  117. package/dist/components/Pagination/paginationContext.d.ts.map +1 -1
  118. package/dist/components/Pagination/paginationContext.js.map +1 -1
  119. package/dist/components/Pagination/usePaginationControlStyles.cjs +8 -1
  120. package/dist/components/Pagination/usePaginationControlStyles.d.cts.map +1 -1
  121. package/dist/components/Pagination/usePaginationControlStyles.d.ts.map +1 -1
  122. package/dist/components/Pagination/usePaginationControlStyles.js +9 -2
  123. package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
  124. package/dist/components/Radio/Radio.cjs +4 -3
  125. package/dist/components/Radio/Radio.js +4 -3
  126. package/dist/components/Radio/Radio.js.map +1 -1
  127. package/dist/components/Select/Select.cjs +29 -6
  128. package/dist/components/Select/Select.d.cts +2 -0
  129. package/dist/components/Select/Select.d.cts.map +1 -1
  130. package/dist/components/Select/Select.d.ts +2 -0
  131. package/dist/components/Select/Select.d.ts.map +1 -1
  132. package/dist/components/Select/Select.js +29 -6
  133. package/dist/components/Select/Select.js.map +1 -1
  134. package/dist/components/Select/SelectContent.cjs +31 -23
  135. package/dist/components/Select/SelectContent.d.cts.map +1 -1
  136. package/dist/components/Select/SelectContent.d.ts.map +1 -1
  137. package/dist/components/Select/SelectContent.js +32 -24
  138. package/dist/components/Select/SelectContent.js.map +1 -1
  139. package/dist/components/Select/SelectItem.cjs +25 -15
  140. package/dist/components/Select/SelectItem.d.cts.map +1 -1
  141. package/dist/components/Select/SelectItem.d.ts.map +1 -1
  142. package/dist/components/Select/SelectItem.js +25 -15
  143. package/dist/components/Select/SelectItem.js.map +1 -1
  144. package/dist/components/Select/SelectTrigger.cjs +27 -13
  145. package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
  146. package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
  147. package/dist/components/Select/SelectTrigger.js +27 -13
  148. package/dist/components/Select/SelectTrigger.js.map +1 -1
  149. package/dist/components/Select/types.d.cts +2 -0
  150. package/dist/components/Select/types.d.cts.map +1 -1
  151. package/dist/components/Select/types.d.ts +2 -0
  152. package/dist/components/Select/types.d.ts.map +1 -1
  153. package/dist/components/Switch.cjs +31 -14
  154. package/dist/components/Switch.d.cts.map +1 -1
  155. package/dist/components/Switch.d.ts.map +1 -1
  156. package/dist/components/Switch.js +31 -14
  157. package/dist/components/Switch.js.map +1 -1
  158. package/dist/components/Tabs/Tab.cjs +8 -4
  159. package/dist/components/Tabs/Tab.d.cts.map +1 -1
  160. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  161. package/dist/components/Tabs/Tab.js +8 -4
  162. package/dist/components/Tabs/Tab.js.map +1 -1
  163. package/dist/components/Text.cjs +5 -0
  164. package/dist/components/Text.d.cts +6 -5
  165. package/dist/components/Text.d.cts.map +1 -1
  166. package/dist/components/Text.d.ts +6 -5
  167. package/dist/components/Text.d.ts.map +1 -1
  168. package/dist/components/Text.js +5 -0
  169. package/dist/components/Text.js.map +1 -1
  170. package/dist/components/UDSProvider.cjs +1 -1
  171. package/dist/components/UDSProvider.d.cts +4 -3
  172. package/dist/components/UDSProvider.d.cts.map +1 -1
  173. package/dist/components/UDSProvider.d.ts +4 -3
  174. package/dist/components/UDSProvider.d.ts.map +1 -1
  175. package/dist/components/UDSProvider.js +1 -1
  176. package/dist/components/UDSProvider.js.map +1 -1
  177. package/dist/fontScaling/FontScalingContext.cjs +35 -3
  178. package/dist/fontScaling/FontScalingContext.d.cts +20 -5
  179. package/dist/fontScaling/FontScalingContext.d.cts.map +1 -1
  180. package/dist/fontScaling/FontScalingContext.d.ts +20 -5
  181. package/dist/fontScaling/FontScalingContext.d.ts.map +1 -1
  182. package/dist/fontScaling/FontScalingContext.js +34 -5
  183. package/dist/fontScaling/FontScalingContext.js.map +1 -1
  184. package/dist/fontScaling/androidNonlinearFontScaling.cjs +250 -0
  185. package/dist/fontScaling/androidNonlinearFontScaling.d.cts +7 -0
  186. package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -0
  187. package/dist/fontScaling/androidNonlinearFontScaling.d.ts +7 -0
  188. package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -0
  189. package/dist/fontScaling/androidNonlinearFontScaling.js +251 -0
  190. package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -0
  191. package/dist/fontScaling/constants.cjs +37 -3
  192. package/dist/fontScaling/constants.d.cts +15 -4
  193. package/dist/fontScaling/constants.d.cts.map +1 -1
  194. package/dist/fontScaling/constants.d.ts +15 -4
  195. package/dist/fontScaling/constants.d.ts.map +1 -1
  196. package/dist/fontScaling/constants.js +37 -4
  197. package/dist/fontScaling/constants.js.map +1 -1
  198. package/dist/fontScaling/index.cjs +2 -1
  199. package/dist/fontScaling/index.d.cts +2 -2
  200. package/dist/fontScaling/index.d.ts +2 -2
  201. package/dist/fontScaling/index.js +3 -3
  202. package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +1 -2
  203. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +1 -2
  204. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -1
  205. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +1 -2
  206. package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -1
  207. package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +1 -2
  208. package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -1
  209. package/dist/fontScaling/types.d.cts +11 -8
  210. package/dist/fontScaling/types.d.cts.map +1 -1
  211. package/dist/fontScaling/types.d.ts +11 -8
  212. package/dist/fontScaling/types.d.ts.map +1 -1
  213. package/dist/fontScaling/useFontScale.cjs +30 -4
  214. package/dist/fontScaling/useFontScale.d.cts +6 -12
  215. package/dist/fontScaling/useFontScale.d.cts.map +1 -1
  216. package/dist/fontScaling/useFontScale.d.ts +6 -12
  217. package/dist/fontScaling/useFontScale.d.ts.map +1 -1
  218. package/dist/fontScaling/useFontScale.js +31 -6
  219. package/dist/fontScaling/useFontScale.js.map +1 -1
  220. package/dist/jest/mocks/styles.cjs +14 -1
  221. package/dist/jest/mocks/styles.d.cts.map +1 -1
  222. package/dist/jest/mocks/styles.d.ts.map +1 -1
  223. package/dist/jest/mocks/styles.js +14 -1
  224. package/dist/jest/mocks/styles.js.map +1 -1
  225. package/dist/mobile/generated/fontMetrics.cjs +530 -530
  226. package/dist/mobile/generated/fontMetrics.js +530 -530
  227. package/dist/mobile/generated/fontMetrics.js.map +1 -1
  228. package/dist/portal.cjs +8 -2
  229. package/dist/portal.d.cts.map +1 -1
  230. package/dist/portal.d.ts.map +1 -1
  231. package/dist/portal.js +8 -2
  232. package/dist/portal.js.map +1 -1
  233. package/fonts/index.cjs +214 -214
  234. package/fonts/index.mjs +214 -214
  235. package/generated/fontMetrics.ts +530 -530
  236. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"androidNonlinearFontScaling.d.ts","names":[],"sources":["../../src/fontScaling/androidNonlinearFontScaling.ts"],"mappings":";;;iBA8DS,oBAAA,CACP,QAAA,UACA,SAAA,UACA,eAAA"}
@@ -0,0 +1,251 @@
1
+ /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
+ //#region src/fontScaling/androidNonlinearFontScaling.ts
3
+ /**
4
+ * Android 14+ converts SP through a size-dependent curve. `Configuration.fontScale`
5
+ * is only the user's preference; multiplying by it directly does not reproduce the
6
+ * size that native Text renders.
7
+ *
8
+ * These lookup tables mirror Android's `FontScaleConverterFactory`. Android 14
9
+ * shipped fewer preference curves than Android 15+, so callers must provide the
10
+ * platform version to select the same table native Text uses. Values between
11
+ * table entries are linearly interpolated, as they are in the platform implementation.
12
+ *
13
+ * @see https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/content/res/FontScaleConverterFactory.java
14
+ * @see https://android.googlesource.com/platform/prebuilts/fullsdk/sources/+/refs/heads/androidx-compose-integration-release/android-34/android/content/res/FontScaleConverterFactory.java
15
+ */
16
+ const COMMON_SP_SIZES = [
17
+ 8,
18
+ 10,
19
+ 12,
20
+ 14,
21
+ 18,
22
+ 20,
23
+ 24,
24
+ 30,
25
+ 100
26
+ ];
27
+ const ANDROID_14_FONT_SCALE_CURVES = [
28
+ {
29
+ scale: 1.15,
30
+ dp: [
31
+ 9.2,
32
+ 11.5,
33
+ 13.8,
34
+ 16.4,
35
+ 19.8,
36
+ 21.8,
37
+ 25.2,
38
+ 30,
39
+ 100
40
+ ]
41
+ },
42
+ {
43
+ scale: 1.3,
44
+ dp: [
45
+ 10.4,
46
+ 13,
47
+ 15.6,
48
+ 18.8,
49
+ 21.6,
50
+ 23.6,
51
+ 26.4,
52
+ 30,
53
+ 100
54
+ ]
55
+ },
56
+ {
57
+ scale: 1.5,
58
+ dp: [
59
+ 12,
60
+ 15,
61
+ 18,
62
+ 22,
63
+ 24,
64
+ 26,
65
+ 28,
66
+ 30,
67
+ 100
68
+ ]
69
+ },
70
+ {
71
+ scale: 1.8,
72
+ dp: [
73
+ 14.4,
74
+ 18,
75
+ 21.6,
76
+ 24.4,
77
+ 27.6,
78
+ 30.8,
79
+ 32.8,
80
+ 34.8,
81
+ 100
82
+ ]
83
+ },
84
+ {
85
+ scale: 2,
86
+ dp: [
87
+ 16,
88
+ 20,
89
+ 24,
90
+ 26,
91
+ 30,
92
+ 34,
93
+ 36,
94
+ 38,
95
+ 100
96
+ ]
97
+ }
98
+ ];
99
+ const ANDROID_15_FONT_SCALE_CURVES = [
100
+ {
101
+ scale: 1.05,
102
+ dp: [
103
+ 8.4,
104
+ 10.5,
105
+ 12.6,
106
+ 14.8,
107
+ 18.6,
108
+ 20.6,
109
+ 24.4,
110
+ 30,
111
+ 100
112
+ ]
113
+ },
114
+ {
115
+ scale: 1.1,
116
+ dp: [
117
+ 8.8,
118
+ 11,
119
+ 13.2,
120
+ 15.6,
121
+ 19.2,
122
+ 21.2,
123
+ 24.8,
124
+ 30,
125
+ 100
126
+ ]
127
+ },
128
+ {
129
+ scale: 1.15,
130
+ dp: [
131
+ 9.2,
132
+ 11.5,
133
+ 13.8,
134
+ 16.4,
135
+ 19.8,
136
+ 21.8,
137
+ 25.2,
138
+ 30,
139
+ 100
140
+ ]
141
+ },
142
+ {
143
+ scale: 1.2,
144
+ dp: [
145
+ 9.6,
146
+ 12,
147
+ 14.4,
148
+ 17.2,
149
+ 20.4,
150
+ 22.4,
151
+ 25.6,
152
+ 30,
153
+ 100
154
+ ]
155
+ },
156
+ {
157
+ scale: 1.3,
158
+ dp: [
159
+ 10.4,
160
+ 13,
161
+ 15.6,
162
+ 18.8,
163
+ 21.6,
164
+ 23.6,
165
+ 26.4,
166
+ 30,
167
+ 100
168
+ ]
169
+ },
170
+ {
171
+ scale: 1.5,
172
+ dp: [
173
+ 12,
174
+ 15,
175
+ 18,
176
+ 22,
177
+ 24,
178
+ 26,
179
+ 28,
180
+ 30,
181
+ 100
182
+ ]
183
+ },
184
+ {
185
+ scale: 1.8,
186
+ dp: [
187
+ 14.4,
188
+ 18,
189
+ 21.6,
190
+ 24.4,
191
+ 27.6,
192
+ 30.8,
193
+ 32.8,
194
+ 34.8,
195
+ 100
196
+ ]
197
+ },
198
+ {
199
+ scale: 2,
200
+ dp: [
201
+ 16,
202
+ 20,
203
+ 24,
204
+ 26,
205
+ 30,
206
+ 34,
207
+ 36,
208
+ 38,
209
+ 100
210
+ ]
211
+ }
212
+ ];
213
+ function lerp(start, end, amount) {
214
+ return start + (end - start) * amount;
215
+ }
216
+ function interpolateSize(fontSize, dpValues) {
217
+ if (fontSize <= 0) return fontSize;
218
+ for (let index = 0; index < COMMON_SP_SIZES.length; index += 1) {
219
+ const currentSp = COMMON_SP_SIZES[index];
220
+ if (fontSize === currentSp) return dpValues[index];
221
+ if (fontSize < currentSp) {
222
+ const previousSp = index === 0 ? 0 : COMMON_SP_SIZES[index - 1];
223
+ const previousDp = index === 0 ? 0 : dpValues[index - 1];
224
+ const amount = (fontSize - previousSp) / (currentSp - previousSp);
225
+ return lerp(previousDp, dpValues[index], amount);
226
+ }
227
+ }
228
+ const lastIndex = COMMON_SP_SIZES.length - 1;
229
+ return fontSize * (dpValues[lastIndex] / COMMON_SP_SIZES[lastIndex]);
230
+ }
231
+ /** Converts an SP value to the nonlinear DP size used by this Android API level. */
232
+ function convertAndroidSpToDp(fontSize, fontScale, platformVersion = 35) {
233
+ const curves = platformVersion === 34 ? ANDROID_14_FONT_SCALE_CURVES : ANDROID_15_FONT_SCALE_CURVES;
234
+ const firstCurve = curves[0];
235
+ const lastCurve = curves[curves.length - 1];
236
+ if (fontScale < firstCurve.scale || fontScale > lastCurve.scale) return fontSize * fontScale;
237
+ for (let index = 0; index < curves.length; index += 1) {
238
+ const curve = curves[index];
239
+ if (fontScale === curve.scale) return interpolateSize(fontSize, curve.dp);
240
+ if (fontScale < curve.scale) {
241
+ const previousCurve = curves[index - 1];
242
+ const amount = (fontScale - previousCurve.scale) / (curve.scale - previousCurve.scale);
243
+ return lerp(interpolateSize(fontSize, previousCurve.dp), interpolateSize(fontSize, curve.dp), amount);
244
+ }
245
+ }
246
+ return fontSize * fontScale;
247
+ }
248
+ //#endregion
249
+ export { convertAndroidSpToDp };
250
+
251
+ //# sourceMappingURL=androidNonlinearFontScaling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"androidNonlinearFontScaling.js","names":[],"sources":["../../src/fontScaling/androidNonlinearFontScaling.ts"],"sourcesContent":["/**\n * Android 14+ converts SP through a size-dependent curve. `Configuration.fontScale`\n * is only the user's preference; multiplying by it directly does not reproduce the\n * size that native Text renders.\n *\n * These lookup tables mirror Android's `FontScaleConverterFactory`. Android 14\n * shipped fewer preference curves than Android 15+, so callers must provide the\n * platform version to select the same table native Text uses. Values between\n * table entries are linearly interpolated, as they are in the platform implementation.\n *\n * @see https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/content/res/FontScaleConverterFactory.java\n * @see https://android.googlesource.com/platform/prebuilts/fullsdk/sources/+/refs/heads/androidx-compose-integration-release/android-34/android/content/res/FontScaleConverterFactory.java\n */\nconst COMMON_SP_SIZES = [8, 10, 12, 14, 18, 20, 24, 30, 100] as const;\n\nconst ANDROID_14_FONT_SCALE_CURVES = [\n { scale: 1.15, dp: [9.2, 11.5, 13.8, 16.4, 19.8, 21.8, 25.2, 30, 100] },\n { scale: 1.3, dp: [10.4, 13, 15.6, 18.8, 21.6, 23.6, 26.4, 30, 100] },\n { scale: 1.5, dp: [12, 15, 18, 22, 24, 26, 28, 30, 100] },\n { scale: 1.8, dp: [14.4, 18, 21.6, 24.4, 27.6, 30.8, 32.8, 34.8, 100] },\n { scale: 2, dp: [16, 20, 24, 26, 30, 34, 36, 38, 100] },\n] as const;\n\nconst ANDROID_15_FONT_SCALE_CURVES = [\n { scale: 1.05, dp: [8.4, 10.5, 12.6, 14.8, 18.6, 20.6, 24.4, 30, 100] },\n { scale: 1.1, dp: [8.8, 11, 13.2, 15.6, 19.2, 21.2, 24.8, 30, 100] },\n { scale: 1.15, dp: [9.2, 11.5, 13.8, 16.4, 19.8, 21.8, 25.2, 30, 100] },\n { scale: 1.2, dp: [9.6, 12, 14.4, 17.2, 20.4, 22.4, 25.6, 30, 100] },\n { scale: 1.3, dp: [10.4, 13, 15.6, 18.8, 21.6, 23.6, 26.4, 30, 100] },\n { scale: 1.5, dp: [12, 15, 18, 22, 24, 26, 28, 30, 100] },\n { scale: 1.8, dp: [14.4, 18, 21.6, 24.4, 27.6, 30.8, 32.8, 34.8, 100] },\n { scale: 2, dp: [16, 20, 24, 26, 30, 34, 36, 38, 100] },\n] as const;\n\nfunction lerp(start: number, end: number, amount: number): number {\n return start + (end - start) * amount;\n}\n\nfunction interpolateSize(fontSize: number, dpValues: readonly number[]): number {\n if (fontSize <= 0) {\n return fontSize;\n }\n\n for (let index = 0; index < COMMON_SP_SIZES.length; index += 1) {\n const currentSp = COMMON_SP_SIZES[index];\n if (fontSize === currentSp) {\n return dpValues[index] as number;\n }\n if (fontSize < currentSp) {\n const previousSp = index === 0 ? 0 : COMMON_SP_SIZES[index - 1];\n const previousDp = index === 0 ? 0 : (dpValues[index - 1] as number);\n const amount = (fontSize - previousSp) / (currentSp - previousSp);\n return lerp(previousDp, dpValues[index] as number, amount);\n }\n }\n\n // Android extrapolates beyond the table with the last entry's ratio.\n const lastIndex = COMMON_SP_SIZES.length - 1;\n return fontSize * ((dpValues[lastIndex] as number) / COMMON_SP_SIZES[lastIndex]);\n}\n\n/** Converts an SP value to the nonlinear DP size used by this Android API level. */\nfunction convertAndroidSpToDp(\n fontSize: number,\n fontScale: number,\n platformVersion: number = 35,\n): number {\n const curves =\n platformVersion === 34 ? ANDROID_14_FONT_SCALE_CURVES : ANDROID_15_FONT_SCALE_CURVES;\n const firstCurve = curves[0];\n const lastCurve = curves[curves.length - 1];\n\n // Outside Android's curve range, the platform falls back to a linear table.\n if (fontScale < firstCurve.scale || fontScale > lastCurve.scale) {\n return fontSize * fontScale;\n }\n\n for (let index = 0; index < curves.length; index += 1) {\n const curve = curves[index];\n if (fontScale === curve.scale) {\n return interpolateSize(fontSize, curve.dp);\n }\n if (fontScale < curve.scale) {\n const previousCurve = curves[index - 1];\n const amount = (fontScale - previousCurve.scale) / (curve.scale - previousCurve.scale);\n return lerp(\n interpolateSize(fontSize, previousCurve.dp),\n interpolateSize(fontSize, curve.dp),\n amount,\n );\n }\n }\n\n return fontSize * fontScale;\n}\n\nexport { convertAndroidSpToDp };\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,kBAAkB;CAAC;CAAG;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAE5D,MAAM,+BAA+B;CACnC;EAAE,OAAO;EAAM,IAAI;GAAC;GAAK;GAAM;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACvE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAM;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACrE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAAE;CACzD;EAAE,OAAO;EAAK,IAAI;GAAC;GAAM;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;EAAE;CACvE;EAAE,OAAO;EAAG,IAAI;GAAC;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAAE;CACxD;AAED,MAAM,+BAA+B;CACnC;EAAE,OAAO;EAAM,IAAI;GAAC;GAAK;GAAM;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACvE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAK;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACpE;EAAE,OAAO;EAAM,IAAI;GAAC;GAAK;GAAM;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACvE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAK;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACpE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAM;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;GAAI;EAAE;CACrE;EAAE,OAAO;EAAK,IAAI;GAAC;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAAE;CACzD;EAAE,OAAO;EAAK,IAAI;GAAC;GAAM;GAAI;GAAM;GAAM;GAAM;GAAM;GAAM;GAAM;GAAI;EAAE;CACvE;EAAE,OAAO;EAAG,IAAI;GAAC;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAAE;CACxD;AAED,SAAS,KAAK,OAAe,KAAa,QAAwB;CAChE,OAAO,SAAS,MAAM,SAAS;;AAGjC,SAAS,gBAAgB,UAAkB,UAAqC;CAC9E,IAAI,YAAY,GACd,OAAO;CAGT,KAAK,IAAI,QAAQ,GAAG,QAAQ,gBAAgB,QAAQ,SAAS,GAAG;EAC9D,MAAM,YAAY,gBAAgB;EAClC,IAAI,aAAa,WACf,OAAO,SAAS;EAElB,IAAI,WAAW,WAAW;GACxB,MAAM,aAAa,UAAU,IAAI,IAAI,gBAAgB,QAAQ;GAC7D,MAAM,aAAa,UAAU,IAAI,IAAK,SAAS,QAAQ;GACvD,MAAM,UAAU,WAAW,eAAe,YAAY;GACtD,OAAO,KAAK,YAAY,SAAS,QAAkB,OAAO;;;CAK9D,MAAM,YAAY,gBAAgB,SAAS;CAC3C,OAAO,YAAa,SAAS,aAAwB,gBAAgB;;;AAIvE,SAAS,qBACP,UACA,WACA,kBAA0B,IAClB;CACR,MAAM,SACJ,oBAAoB,KAAK,+BAA+B;CAC1D,MAAM,aAAa,OAAO;CAC1B,MAAM,YAAY,OAAO,OAAO,SAAS;CAGzC,IAAI,YAAY,WAAW,SAAS,YAAY,UAAU,OACxD,OAAO,WAAW;CAGpB,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,QAAQ,OAAO;EACrB,IAAI,cAAc,MAAM,OACtB,OAAO,gBAAgB,UAAU,MAAM,GAAG;EAE5C,IAAI,YAAY,MAAM,OAAO;GAC3B,MAAM,gBAAgB,OAAO,QAAQ;GACrC,MAAM,UAAU,YAAY,cAAc,UAAU,MAAM,QAAQ,cAAc;GAChF,OAAO,KACL,gBAAgB,UAAU,cAAc,GAAG,EAC3C,gBAAgB,UAAU,MAAM,GAAG,EACnC,OACD;;;CAIL,OAAO,WAAW"}
@@ -60,13 +60,47 @@ const TYPE_SCALE_CURVE = {
60
60
  */
61
61
  const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = Object.freeze(Object.fromEntries(Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [variant, cap === null ? 2 : Math.min(cap, 2)])));
62
62
  /**
63
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
64
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
65
- * supported ceiling rather than a looser per-variant cap.
63
+ * Default cap for control-internal text, icons, and geometry (Button,
64
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
65
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
66
+ * rather than a looser per-variant cap.
66
67
  */
67
68
  const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
69
+ /**
70
+ * iOS Dynamic Type curve used by each UDS typography tier. React Native uses
71
+ * the selected system text style's curve while preserving the configured UDS
72
+ * font size. Android ignores `dynamicTypeRamp` and continues to use its native
73
+ * nonlinear font scaling.
74
+ *
75
+ * Keys are base variants; `/emphasized` twins resolve to their base.
76
+ */
77
+ const DEFAULT_DYNAMIC_TYPE_RAMPS = {
78
+ display1: "largeTitle",
79
+ display2: "largeTitle",
80
+ display3: "largeTitle",
81
+ title1: "title1",
82
+ title2: "title2",
83
+ title3: "title3",
84
+ title4: "title3",
85
+ headline1: "headline",
86
+ body1: "body",
87
+ label1: "callout",
88
+ label2: "subheadline",
89
+ label3: "footnote",
90
+ label4: "caption1",
91
+ caption1: "caption1",
92
+ caption2: "caption2",
93
+ legal1: "caption2",
94
+ ui1: "title3",
95
+ ui2: "title3",
96
+ ui3: "callout",
97
+ ui4: "subheadline",
98
+ ui5: "footnote",
99
+ ui6: "caption2"
100
+ };
68
101
  //#endregion
69
102
  exports.DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;
103
+ exports.DEFAULT_DYNAMIC_TYPE_RAMPS = DEFAULT_DYNAMIC_TYPE_RAMPS;
70
104
  exports.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = DEFAULT_MAX_FONT_SIZE_MULTIPLIERS;
71
105
  exports.MAX_SUPPORTED_FONT_SCALE = MAX_SUPPORTED_FONT_SCALE;
72
106
  exports.TYPE_SCALE_CURVE = TYPE_SCALE_CURVE;
@@ -1,6 +1,7 @@
1
1
 
2
2
  import { TextVariant } from "../components/Text.cjs";
3
3
  import { FontScalingCapValue } from "./types.cjs";
4
+ import { TextProps } from "react-native";
4
5
 
5
6
  //#region src/fontScaling/constants.d.ts
6
7
  /**
@@ -39,11 +40,21 @@ declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScaling
39
40
  */
40
41
  declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
41
42
  /**
42
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
43
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
44
- * supported ceiling rather than a looser per-variant cap.
43
+ * Default cap for control-internal text, icons, and geometry (Button,
44
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
45
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
46
+ * rather than a looser per-variant cap.
45
47
  */
46
48
  declare const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
49
+ /**
50
+ * iOS Dynamic Type curve used by each UDS typography tier. React Native uses
51
+ * the selected system text style's curve while preserving the configured UDS
52
+ * font size. Android ignores `dynamicTypeRamp` and continues to use its native
53
+ * nonlinear font scaling.
54
+ *
55
+ * Keys are base variants; `/emphasized` twins resolve to their base.
56
+ */
57
+ declare const DEFAULT_DYNAMIC_TYPE_RAMPS: Readonly<Partial<Record<TextVariant, NonNullable<TextProps['dynamicTypeRamp']>>>>;
47
58
  //#endregion
48
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
59
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
49
60
  //# sourceMappingURL=constants.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;AACmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;cAexB,wCAAA"}
1
+ {"version":3,"file":"constants.d.cts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;cAgBxB,wCAAA;;;;;AAAwC;;;;cAUxC,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
@@ -1,6 +1,7 @@
1
1
 
2
2
  import { TextVariant } from "../components/Text.js";
3
3
  import { FontScalingCapValue } from "./types.js";
4
+ import { TextProps } from "react-native";
4
5
 
5
6
  //#region src/fontScaling/constants.d.ts
6
7
  /**
@@ -39,11 +40,21 @@ declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScaling
39
40
  */
40
41
  declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
41
42
  /**
42
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
43
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
44
- * supported ceiling rather than a looser per-variant cap.
43
+ * Default cap for control-internal text, icons, and geometry (Button,
44
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
45
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
46
+ * rather than a looser per-variant cap.
45
47
  */
46
48
  declare const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
49
+ /**
50
+ * iOS Dynamic Type curve used by each UDS typography tier. React Native uses
51
+ * the selected system text style's curve while preserving the configured UDS
52
+ * font size. Android ignores `dynamicTypeRamp` and continues to use its native
53
+ * nonlinear font scaling.
54
+ *
55
+ * Keys are base variants; `/emphasized` twins resolve to their base.
56
+ */
57
+ declare const DEFAULT_DYNAMIC_TYPE_RAMPS: Readonly<Partial<Record<TextVariant, NonNullable<TextProps['dynamicTypeRamp']>>>>;
47
58
  //#endregion
48
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
59
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
49
60
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;AACmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;cAexB,wCAAA"}
1
+ {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;cAgBxB,wCAAA;;;;;AAAwC;;;;cAUxC,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
@@ -59,12 +59,45 @@ const TYPE_SCALE_CURVE = {
59
59
  */
60
60
  const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = Object.freeze(Object.fromEntries(Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [variant, cap === null ? 2 : Math.min(cap, 2)])));
61
61
  /**
62
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
63
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
64
- * supported ceiling rather than a looser per-variant cap.
62
+ * Default cap for control-internal text, icons, and geometry (Button,
63
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
64
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
65
+ * rather than a looser per-variant cap.
65
66
  */
66
67
  const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
68
+ /**
69
+ * iOS Dynamic Type curve used by each UDS typography tier. React Native uses
70
+ * the selected system text style's curve while preserving the configured UDS
71
+ * font size. Android ignores `dynamicTypeRamp` and continues to use its native
72
+ * nonlinear font scaling.
73
+ *
74
+ * Keys are base variants; `/emphasized` twins resolve to their base.
75
+ */
76
+ const DEFAULT_DYNAMIC_TYPE_RAMPS = {
77
+ display1: "largeTitle",
78
+ display2: "largeTitle",
79
+ display3: "largeTitle",
80
+ title1: "title1",
81
+ title2: "title2",
82
+ title3: "title3",
83
+ title4: "title3",
84
+ headline1: "headline",
85
+ body1: "body",
86
+ label1: "callout",
87
+ label2: "subheadline",
88
+ label3: "footnote",
89
+ label4: "caption1",
90
+ caption1: "caption1",
91
+ caption2: "caption2",
92
+ legal1: "caption2",
93
+ ui1: "title3",
94
+ ui2: "title3",
95
+ ui3: "callout",
96
+ ui4: "subheadline",
97
+ ui5: "footnote",
98
+ ui6: "caption2"
99
+ };
67
100
  //#endregion
68
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
101
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
69
102
 
70
103
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/fontScaling/constants.ts"],"sourcesContent":["import type { TextVariant } from '../components/Text';\nimport type { FontScalingCapValue } from './types';\n\n/**\n * The largest OS font scale UDS components are designed to support.\n *\n * Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so\n * no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger\n * Text is claimable at \"at least 200% or the maximum font size for the\n * system\", so a 2x ceiling still qualifies. Note that iOS offers scales beyond\n * this (up to 3.571x): with this ceiling in place the top accessibility sizes\n * render alike, and an app that wants to follow the OS further can raise or\n * remove the caps via `UDSFontScalingProvider`.\n */\nconst MAX_SUPPORTED_FONT_SCALE = 2;\n\n/**\n * How far each text style would grow if only legibility mattered, following\n * the shape of Apple's Dynamic Type ramps: the larger a style starts, the less\n * it multiplies. At iOS's largest accessibility size the system grows body\n * (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers\n * are larger than largeTitle, so they taper hardest.\n *\n * Caps are chosen by the size a style starts at rather than by which family it\n * belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`\n * (20pt) matches `title4` (20pt). `null` means \"no cap from the curve\" — those\n * are reading sizes, where legibility argues for following the OS.\n *\n * The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.\n */\nconst TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>> = {\n display1: 1.5,\n display2: 1.6,\n display3: 1.75,\n title1: 1.8,\n title2: 2,\n title3: 2.2,\n title4: 2.4,\n headline1: 2.5,\n ui1: 2.2,\n ui2: 2.4,\n body1: null,\n label1: null,\n label2: null,\n label3: null,\n label4: null,\n caption1: null,\n caption2: null,\n legal1: null,\n ui3: null,\n ui4: null,\n ui5: null,\n ui6: null,\n};\n\n/**\n * Default per-variant caps on OS font scaling, applied by `Text` when no\n * explicit prop or provider config overrides them: the legibility curve in\n * {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<\n Partial<Record<TextVariant, FontScalingCapValue>>\n> = Object.freeze(\n Object.fromEntries(\n Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [\n variant,\n cap === null ? MAX_SUPPORTED_FONT_SCALE : Math.min(cap, MAX_SUPPORTED_FONT_SCALE),\n ]),\n ) as Partial<Record<TextVariant, FontScalingCapValue>>,\n);\n\n/**\n * Default cap for control-internal text and icons (Button, Checkbox, Radio,\n * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the\n * supported ceiling rather than a looser per-variant cap.\n */\nconst DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = MAX_SUPPORTED_FONT_SCALE;\n\nexport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n MAX_SUPPORTED_FONT_SCALE,\n TYPE_SCALE_CURVE,\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,2BAA2B;;;;;;;;;;;;;;;AAgBjC,MAAM,mBAAgF;CACpF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;;;;;;;;AASD,MAAM,oCAEF,OAAO,OACT,OAAO,YACL,OAAO,QAAQ,iBAAiB,CAAC,KAAK,CAAC,SAAS,SAAS,CACvD,SACA,QAAQ,OAAA,IAAkC,KAAK,IAAI,KAAA,EAA8B,CAClF,CAAC,CACH,CACF;;;;;;AAOD,MAAM,2CAAA"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/fontScaling/constants.ts"],"sourcesContent":["import type { TextProps as RNTextProps } from 'react-native';\n\nimport type { TextVariant } from '../components/Text';\nimport type { FontScalingCapValue } from './types';\n\n/**\n * The largest OS font scale UDS components are designed to support.\n *\n * Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so\n * no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger\n * Text is claimable at \"at least 200% or the maximum font size for the\n * system\", so a 2x ceiling still qualifies. Note that iOS offers scales beyond\n * this (up to 3.571x): with this ceiling in place the top accessibility sizes\n * render alike, and an app that wants to follow the OS further can raise or\n * remove the caps via `UDSFontScalingProvider`.\n */\nconst MAX_SUPPORTED_FONT_SCALE = 2;\n\n/**\n * How far each text style would grow if only legibility mattered, following\n * the shape of Apple's Dynamic Type ramps: the larger a style starts, the less\n * it multiplies. At iOS's largest accessibility size the system grows body\n * (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers\n * are larger than largeTitle, so they taper hardest.\n *\n * Caps are chosen by the size a style starts at rather than by which family it\n * belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`\n * (20pt) matches `title4` (20pt). `null` means \"no cap from the curve\" — those\n * are reading sizes, where legibility argues for following the OS.\n *\n * The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.\n */\nconst TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>> = {\n display1: 1.5,\n display2: 1.6,\n display3: 1.75,\n title1: 1.8,\n title2: 2,\n title3: 2.2,\n title4: 2.4,\n headline1: 2.5,\n ui1: 2.2,\n ui2: 2.4,\n body1: null,\n label1: null,\n label2: null,\n label3: null,\n label4: null,\n caption1: null,\n caption2: null,\n legal1: null,\n ui3: null,\n ui4: null,\n ui5: null,\n ui6: null,\n};\n\n/**\n * Default per-variant caps on OS font scaling, applied by `Text` when no\n * explicit prop or provider config overrides them: the legibility curve in\n * {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<\n Partial<Record<TextVariant, FontScalingCapValue>>\n> = Object.freeze(\n Object.fromEntries(\n Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [\n variant,\n cap === null ? MAX_SUPPORTED_FONT_SCALE : Math.min(cap, MAX_SUPPORTED_FONT_SCALE),\n ]),\n ) as Partial<Record<TextVariant, FontScalingCapValue>>,\n);\n\n/**\n * Default cap for control-internal text, icons, and geometry (Button,\n * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and\n * Icon). Controls have bounded layouts, so they get the supported ceiling\n * rather than a looser per-variant cap.\n */\nconst DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = MAX_SUPPORTED_FONT_SCALE;\n\n/**\n * iOS Dynamic Type curve used by each UDS typography tier. React Native uses\n * the selected system text style's curve while preserving the configured UDS\n * font size. Android ignores `dynamicTypeRamp` and continues to use its native\n * nonlinear font scaling.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_DYNAMIC_TYPE_RAMPS: Readonly<\n Partial<Record<TextVariant, NonNullable<RNTextProps['dynamicTypeRamp']>>>\n> = {\n display1: 'largeTitle',\n display2: 'largeTitle',\n display3: 'largeTitle',\n title1: 'title1',\n title2: 'title2',\n title3: 'title3',\n title4: 'title3',\n headline1: 'headline',\n body1: 'body',\n label1: 'callout',\n label2: 'subheadline',\n label3: 'footnote',\n label4: 'caption1',\n caption1: 'caption1',\n caption2: 'caption2',\n legal1: 'caption2',\n ui1: 'title3',\n ui2: 'title3',\n ui3: 'callout',\n ui4: 'subheadline',\n ui5: 'footnote',\n ui6: 'caption2',\n};\n\nexport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_DYNAMIC_TYPE_RAMPS,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n MAX_SUPPORTED_FONT_SCALE,\n TYPE_SCALE_CURVE,\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,2BAA2B;;;;;;;;;;;;;;;AAgBjC,MAAM,mBAAgF;CACpF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;;;;;;;;AASD,MAAM,oCAEF,OAAO,OACT,OAAO,YACL,OAAO,QAAQ,iBAAiB,CAAC,KAAK,CAAC,SAAS,SAAS,CACvD,SACA,QAAQ,OAAA,IAAkC,KAAK,IAAI,KAAA,EAA8B,CAClF,CAAC,CACH,CACF;;;;;;;AAQD,MAAM,2CAAA;;;;;;;;;AAUN,MAAM,6BAEF;CACF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
@@ -1,10 +1,11 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_fontScaling_FontScalingContext = require("./FontScalingContext.cjs");
4
+ const require_fontScaling_useFontScale = require("./useFontScale.cjs");
4
5
  const require_fontScaling_constants = require("./constants.cjs");
5
6
  const require_fontScaling_useMaxFontSizeMultiplier = require("./useMaxFontSizeMultiplier.cjs");
6
- const require_fontScaling_useFontScale = require("./useFontScale.cjs");
7
7
  exports.DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = require_fontScaling_constants.DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;
8
+ exports.DEFAULT_DYNAMIC_TYPE_RAMPS = require_fontScaling_constants.DEFAULT_DYNAMIC_TYPE_RAMPS;
8
9
  exports.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = require_fontScaling_constants.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS;
9
10
  exports.MAX_SUPPORTED_FONT_SCALE = require_fontScaling_constants.MAX_SUPPORTED_FONT_SCALE;
10
11
  exports.TYPE_SCALE_CURVE = require_fontScaling_constants.TYPE_SCALE_CURVE;
@@ -2,7 +2,7 @@
2
2
  import { TextVariant } from "../components/Text.cjs";
3
3
  import { FontScalingCapValue, FontScalingConfig } from "./types.cjs";
4
4
  import { UDSFontScalingProvider, UDSFontScalingProviderProps } from "./FontScalingContext.cjs";
5
- import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.cjs";
5
+ import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.cjs";
6
6
  import { useFontScale } from "./useFontScale.cjs";
7
7
  import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.cjs";
8
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, type FontScalingCapValue, type FontScalingConfig, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, type TextVariant, UDSFontScalingProvider, type UDSFontScalingProviderProps, useFontScale, useMaxFontSizeMultiplier };
8
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, type FontScalingCapValue, type FontScalingConfig, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, type TextVariant, UDSFontScalingProvider, type UDSFontScalingProviderProps, useFontScale, useMaxFontSizeMultiplier };
@@ -2,7 +2,7 @@
2
2
  import { TextVariant } from "../components/Text.js";
3
3
  import { FontScalingCapValue, FontScalingConfig } from "./types.js";
4
4
  import { UDSFontScalingProvider, UDSFontScalingProviderProps } from "./FontScalingContext.js";
5
- import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.js";
5
+ import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.js";
6
6
  import { useFontScale } from "./useFontScale.js";
7
7
  import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.js";
8
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, type FontScalingCapValue, type FontScalingConfig, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, type TextVariant, UDSFontScalingProvider, type UDSFontScalingProviderProps, useFontScale, useMaxFontSizeMultiplier };
8
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, type FontScalingCapValue, type FontScalingConfig, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, type TextVariant, UDSFontScalingProvider, type UDSFontScalingProviderProps, useFontScale, useMaxFontSizeMultiplier };
@@ -1,6 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
2
  import { UDSFontScalingProvider } from "./FontScalingContext.js";
3
- import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.js";
4
- import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.js";
5
3
  import { useFontScale } from "./useFontScale.js";
6
- export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, UDSFontScalingProvider, useFontScale, useMaxFontSizeMultiplier };
4
+ import { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE } from "./constants.js";
5
+ import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.js";
6
+ export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE, UDSFontScalingProvider, useFontScale, useMaxFontSizeMultiplier };
@@ -13,8 +13,7 @@ function toResolved(cap) {
13
13
  * entry, then `default`) > built-in default table.
14
14
  *
15
15
  * Returns `undefined` (native behavior: inherit from parent text or app
16
- * global) when nothing applies — including for built-in uncapped variants, so
17
- * body text nested inside capped text still inherits the parent's cap. Only an
16
+ * global) when nothing applies, including for `variant="inherit"`. Only an
18
17
  * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
19
18
  */
20
19
  function resolveMaxFontSizeMultiplier({ explicit, config, variant }) {
@@ -22,8 +22,7 @@ interface ResolveMaxFontSizeMultiplierOptions {
22
22
  * entry, then `default`) > built-in default table.
23
23
  *
24
24
  * Returns `undefined` (native behavior: inherit from parent text or app
25
- * global) when nothing applies — including for built-in uncapped variants, so
26
- * body text nested inside capped text still inherits the parent's cap. Only an
25
+ * global) when nothing applies, including for `variant="inherit"`. Only an
27
26
  * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
28
27
  */
29
28
  declare function resolveMaxFontSizeMultiplier({
@@ -1 +1 @@
1
- {"version":3,"file":"resolveMaxFontSizeMultiplier.d.cts","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"mappings":";;;;;UAWU,mCAAA;;EAER,QAAA;EAF2C;EAI3C,MAAA,GAAS,iBAAA;EAMY;;;;;EAArB,OAAA,GAAU,WAAA;AAAA;;AAAW;;;;;;;;;;iBAkBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
1
+ {"version":3,"file":"resolveMaxFontSizeMultiplier.d.cts","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"mappings":";;;;;UAWU,mCAAA;;EAER,QAAA;EAF2C;EAI3C,MAAA,GAAS,iBAAA;EAMY;;;;;EAArB,OAAA,GAAU,WAAA;AAAA;;AAAW;;;;;;;;;iBAiBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
@@ -22,8 +22,7 @@ interface ResolveMaxFontSizeMultiplierOptions {
22
22
  * entry, then `default`) > built-in default table.
23
23
  *
24
24
  * Returns `undefined` (native behavior: inherit from parent text or app
25
- * global) when nothing applies — including for built-in uncapped variants, so
26
- * body text nested inside capped text still inherits the parent's cap. Only an
25
+ * global) when nothing applies, including for `variant="inherit"`. Only an
27
26
  * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
28
27
  */
29
28
  declare function resolveMaxFontSizeMultiplier({
@@ -1 +1 @@
1
- {"version":3,"file":"resolveMaxFontSizeMultiplier.d.ts","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"mappings":";;;;;UAWU,mCAAA;;EAER,QAAA;EAF2C;EAI3C,MAAA,GAAS,iBAAA;EAMY;;;;;EAArB,OAAA,GAAU,WAAA;AAAA;;AAAW;;;;;;;;;;iBAkBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
1
+ {"version":3,"file":"resolveMaxFontSizeMultiplier.d.ts","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"mappings":";;;;;UAWU,mCAAA;;EAER,QAAA;EAF2C;EAI3C,MAAA,GAAS,iBAAA;EAMY;;;;;EAArB,OAAA,GAAU,WAAA;AAAA;;AAAW;;;;;;;;;iBAiBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
@@ -12,8 +12,7 @@ function toResolved(cap) {
12
12
  * entry, then `default`) > built-in default table.
13
13
  *
14
14
  * Returns `undefined` (native behavior: inherit from parent text or app
15
- * global) when nothing applies — including for built-in uncapped variants, so
16
- * body text nested inside capped text still inherits the parent's cap. Only an
15
+ * global) when nothing applies, including for `variant="inherit"`. Only an
17
16
  * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
18
17
  */
19
18
  function resolveMaxFontSizeMultiplier({ explicit, config, variant }) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolveMaxFontSizeMultiplier.js","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"sourcesContent":["import type { TextVariant } from '../components/Text';\nimport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n} from './constants';\nimport type { FontScalingCapValue, FontScalingConfig } from './types';\n\n// React Native: maxFontSizeMultiplier of 0 means \"no max, ignore parent/global\n// default\" — the only way to force-uncap text nested inside capped text.\nconst UNCAPPED = 0;\n\ninterface ResolveMaxFontSizeMultiplierOptions {\n /** Explicit component prop. `null` = force-uncap. Wins over everything. */\n explicit?: number | null;\n /** Provider config, if any provider is mounted. */\n config?: FontScalingConfig;\n /**\n * The text's resolved variant, `'control'` for control-internal text/icons,\n * or `undefined` for `variant=\"inherit\"` text (no variant opinion — nested\n * text inherits its parent's cap natively).\n */\n variant?: TextVariant | 'control';\n}\n\nfunction toResolved(cap: FontScalingCapValue): number {\n return cap === null ? UNCAPPED : cap;\n}\n\n/**\n * Resolves the `maxFontSizeMultiplier` to hand to React Native.\n *\n * Precedence: explicit prop > provider config (variant entry, then base-variant\n * entry, then `default`) > built-in default table.\n *\n * Returns `undefined` (native behavior: inherit from parent text or app\n * global) when nothing applies — including for built-in uncapped variants, so\n * body text nested inside capped text still inherits the parent's cap. Only an\n * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.\n */\nfunction resolveMaxFontSizeMultiplier({\n explicit,\n config,\n variant,\n}: ResolveMaxFontSizeMultiplierOptions): number | undefined {\n if (explicit !== undefined) {\n return toResolved(explicit);\n }\n\n if (config?.enabled === false) {\n return undefined;\n }\n\n if (variant === undefined) {\n return config?.default !== undefined ? toResolved(config.default) : undefined;\n }\n\n if (variant === 'control') {\n if (config?.control !== undefined) {\n return toResolved(config.control);\n }\n return DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;\n }\n\n const baseVariant = variant.split('/')[0] as TextVariant;\n\n const variantCap = config?.variants?.[variant];\n if (variantCap !== undefined) {\n return toResolved(variantCap);\n }\n const baseVariantCap = config?.variants?.[baseVariant];\n if (baseVariantCap !== undefined) {\n return toResolved(baseVariantCap);\n }\n if (config?.default !== undefined) {\n return toResolved(config.default);\n }\n\n // Future: a theme-level typography[variant].maxFontSizeMultiplier slots here.\n\n const builtIn =\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];\n return typeof builtIn === 'number' ? builtIn : undefined;\n}\n\nexport { resolveMaxFontSizeMultiplier, type ResolveMaxFontSizeMultiplierOptions };\n"],"mappings":";;;AASA,MAAM,WAAW;AAejB,SAAS,WAAW,KAAkC;CACpD,OAAO,QAAQ,OAAO,WAAW;;;;;;;;;;;;;AAcnC,SAAS,6BAA6B,EACpC,UACA,QACA,WAC0D;CAC1D,IAAI,aAAa,KAAA,GACf,OAAO,WAAW,SAAS;CAG7B,IAAI,QAAQ,YAAY,OACtB;CAGF,IAAI,YAAY,KAAA,GACd,OAAO,QAAQ,YAAY,KAAA,IAAY,WAAW,OAAO,QAAQ,GAAG,KAAA;CAGtE,IAAI,YAAY,WAAW;EACzB,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;EAEnC,OAAA;;CAGF,MAAM,cAAc,QAAQ,MAAM,IAAI,CAAC;CAEvC,MAAM,aAAa,QAAQ,WAAW;CACtC,IAAI,eAAe,KAAA,GACjB,OAAO,WAAW,WAAW;CAE/B,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,IAAI,mBAAmB,KAAA,GACrB,OAAO,WAAW,eAAe;CAEnC,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;CAKnC,MAAM,UACJ,kCAAkC,YAAY,kCAAkC;CAClF,OAAO,OAAO,YAAY,WAAW,UAAU,KAAA"}
1
+ {"version":3,"file":"resolveMaxFontSizeMultiplier.js","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"sourcesContent":["import type { TextVariant } from '../components/Text';\nimport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n} from './constants';\nimport type { FontScalingCapValue, FontScalingConfig } from './types';\n\n// React Native: maxFontSizeMultiplier of 0 means \"no max, ignore parent/global\n// default\" — the only way to force-uncap text nested inside capped text.\nconst UNCAPPED = 0;\n\ninterface ResolveMaxFontSizeMultiplierOptions {\n /** Explicit component prop. `null` = force-uncap. Wins over everything. */\n explicit?: number | null;\n /** Provider config, if any provider is mounted. */\n config?: FontScalingConfig;\n /**\n * The text's resolved variant, `'control'` for control-internal text/icons,\n * or `undefined` for `variant=\"inherit\"` text (no variant opinion — nested\n * text inherits its parent's cap natively).\n */\n variant?: TextVariant | 'control';\n}\n\nfunction toResolved(cap: FontScalingCapValue): number {\n return cap === null ? UNCAPPED : cap;\n}\n\n/**\n * Resolves the `maxFontSizeMultiplier` to hand to React Native.\n *\n * Precedence: explicit prop > provider config (variant entry, then base-variant\n * entry, then `default`) > built-in default table.\n *\n * Returns `undefined` (native behavior: inherit from parent text or app\n * global) when nothing applies, including for `variant=\"inherit\"`. Only an\n * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.\n */\nfunction resolveMaxFontSizeMultiplier({\n explicit,\n config,\n variant,\n}: ResolveMaxFontSizeMultiplierOptions): number | undefined {\n if (explicit !== undefined) {\n return toResolved(explicit);\n }\n\n if (config?.enabled === false) {\n return undefined;\n }\n\n if (variant === undefined) {\n return config?.default !== undefined ? toResolved(config.default) : undefined;\n }\n\n if (variant === 'control') {\n if (config?.control !== undefined) {\n return toResolved(config.control);\n }\n return DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;\n }\n\n const baseVariant = variant.split('/')[0] as TextVariant;\n\n const variantCap = config?.variants?.[variant];\n if (variantCap !== undefined) {\n return toResolved(variantCap);\n }\n const baseVariantCap = config?.variants?.[baseVariant];\n if (baseVariantCap !== undefined) {\n return toResolved(baseVariantCap);\n }\n if (config?.default !== undefined) {\n return toResolved(config.default);\n }\n\n // Future: a theme-level typography[variant].maxFontSizeMultiplier slots here.\n\n const builtIn =\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];\n return typeof builtIn === 'number' ? builtIn : undefined;\n}\n\nexport { resolveMaxFontSizeMultiplier, type ResolveMaxFontSizeMultiplierOptions };\n"],"mappings":";;;AASA,MAAM,WAAW;AAejB,SAAS,WAAW,KAAkC;CACpD,OAAO,QAAQ,OAAO,WAAW;;;;;;;;;;;;AAanC,SAAS,6BAA6B,EACpC,UACA,QACA,WAC0D;CAC1D,IAAI,aAAa,KAAA,GACf,OAAO,WAAW,SAAS;CAG7B,IAAI,QAAQ,YAAY,OACtB;CAGF,IAAI,YAAY,KAAA,GACd,OAAO,QAAQ,YAAY,KAAA,IAAY,WAAW,OAAO,QAAQ,GAAG,KAAA;CAGtE,IAAI,YAAY,WAAW;EACzB,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;EAEnC,OAAA;;CAGF,MAAM,cAAc,QAAQ,MAAM,IAAI,CAAC;CAEvC,MAAM,aAAa,QAAQ,WAAW;CACtC,IAAI,eAAe,KAAA,GACjB,OAAO,WAAW,WAAW;CAE/B,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,IAAI,mBAAmB,KAAA,GACrB,OAAO,WAAW,eAAe;CAEnC,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;CAKnC,MAAM,UACJ,kCAAkC,YAAY,kCAAkC;CAClF,OAAO,OAAO,YAAY,WAAW,UAAU,KAAA"}
@@ -21,22 +21,25 @@ type FontScalingCapValue = number | null;
21
21
  */
22
22
  interface FontScalingConfig {
23
23
  /**
24
- * Master switch for UDS-applied caps. When `false`, no caps are applied
25
- * anywhere and text follows native OS scaling. Container-metric fixes
26
- * (Button/Checkbox growing to fit scaled text) remain active.
24
+ * Master switch for UDS-added font-scaling behavior. When `false`, native
25
+ * text keeps its pre-feature scaling behavior while UDS caps, Dynamic Type
26
+ * ramps, multicolor-icon scaling, and scale-aware geometry are disabled.
27
+ * Explicit component and native text props still apply.
27
28
  * @default true
28
29
  */
29
30
  enabled?: boolean;
30
31
  /**
31
32
  * Fallback cap for any variant not listed in `variants`. Takes precedence
32
- * over the built-in default table, including its uncapped entries — setting
33
- * `default: 2` caps body/label/caption text that UDS leaves uncapped by
34
- * default.
33
+ * over the built-in default table. For example, `default: 1.75` replaces the
34
+ * built-in 2x cap for body, label, and caption text unless a variant-specific
35
+ * override applies.
35
36
  */
36
37
  default?: FontScalingCapValue;
37
38
  /**
38
- * Cap for control-internal text and icons: Button labels and icons,
39
- * Checkbox boxes/checkmarks/labels, and standalone `Icon` glyphs.
39
+ * Cap for control-internal text, icons, and geometry in Button, IconButton,
40
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, and Pagination,
41
+ * plus standalone `Icon` glyphs and multicolor SVGs. Link resolves through
42
+ * its typography variant instead of the control cap.
40
43
  * @default 2
41
44
  */
42
45
  control?: FontScalingCapValue;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAkBmB;;;;;;EAXnB,OAAA,GAAU,mBAAA;;;;;;EAMV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAQR;;;;;;;EAAA,OAAA;EAoB0B;;;;;;EAb1B,OAAA,GAAU,mBAAA;;;;;;;;EAQV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}