@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.
- package/README.md +41 -13
- package/dist/bin/automated-config/dist/generated/generatedConfigs.mjs +92 -46
- package/dist/components/Avatar/AvatarIcon.cjs +8 -2
- package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.js +9 -3
- package/dist/components/Avatar/AvatarIcon.js.map +1 -1
- package/dist/components/Avatar/AvatarImage.cjs +9 -2
- package/dist/components/Avatar/AvatarImage.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarImage.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarImage.js +10 -3
- package/dist/components/Avatar/AvatarImage.js.map +1 -1
- package/dist/components/Avatar/AvatarText.cjs +8 -2
- package/dist/components/Avatar/AvatarText.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarText.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarText.js +9 -3
- package/dist/components/Avatar/AvatarText.js.map +1 -1
- package/dist/components/Avatar/types.d.cts +7 -3
- package/dist/components/Avatar/types.d.cts.map +1 -1
- package/dist/components/Avatar/types.d.ts +7 -3
- package/dist/components/Avatar/types.d.ts.map +1 -1
- package/dist/components/Avatar/useAvatarFontScale.cjs +16 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.js +16 -0
- package/dist/components/Avatar/useAvatarFontScale.js.map +1 -0
- package/dist/components/Avatar/utils.cjs +9 -6
- package/dist/components/Avatar/utils.d.cts +2 -2
- package/dist/components/Avatar/utils.d.cts.map +1 -1
- package/dist/components/Avatar/utils.d.ts +2 -2
- package/dist/components/Avatar/utils.d.ts.map +1 -1
- package/dist/components/Avatar/utils.js +9 -6
- package/dist/components/Avatar/utils.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Button/buttonTheme.cjs +31 -9
- package/dist/components/Button/buttonTheme.d.cts +24 -5
- package/dist/components/Button/buttonTheme.d.cts.map +1 -1
- package/dist/components/Button/buttonTheme.d.ts +24 -5
- package/dist/components/Button/buttonTheme.d.ts.map +1 -1
- package/dist/components/Button/buttonTheme.js +31 -10
- package/dist/components/Button/buttonTheme.js.map +1 -1
- package/dist/components/Button.cjs +35 -8
- package/dist/components/Button.d.cts +7 -0
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.ts +7 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +35 -8
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +42 -9
- package/dist/components/Checkbox.d.cts +7 -0
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +42 -9
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +31 -14
- package/dist/components/Chip/ChipBase.d.cts.map +1 -1
- package/dist/components/Chip/ChipBase.d.ts.map +1 -1
- package/dist/components/Chip/ChipBase.js +31 -14
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Chip/ChipDismissible.cjs +3 -1
- package/dist/components/Chip/ChipDismissible.js +3 -1
- package/dist/components/Chip/ChipDismissible.js.map +1 -1
- package/dist/components/Chip/types.d.cts +7 -0
- package/dist/components/Chip/types.d.cts.map +1 -1
- package/dist/components/Chip/types.d.ts +7 -0
- package/dist/components/Chip/types.d.ts.map +1 -1
- package/dist/components/Icon.cjs +24 -5
- package/dist/components/Icon.d.cts +11 -2
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +11 -2
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +24 -5
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.cjs +17 -6
- package/dist/components/IconButton.d.cts +6 -0
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.ts +6 -0
- package/dist/components/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton.js +18 -7
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/Input.cjs +56 -18
- package/dist/components/Input.d.cts +5 -0
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +56 -18
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +7 -1
- package/dist/components/InputHelpText.d.cts +2 -0
- package/dist/components/InputHelpText.d.cts.map +1 -1
- package/dist/components/InputHelpText.d.ts +2 -0
- package/dist/components/InputHelpText.d.ts.map +1 -1
- package/dist/components/InputHelpText.js +7 -1
- package/dist/components/InputHelpText.js.map +1 -1
- package/dist/components/Link.cjs +13 -1
- package/dist/components/Link.d.cts +7 -0
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +13 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Pagination/Pagination.cjs +18 -10
- package/dist/components/Pagination/Pagination.d.cts +2 -0
- package/dist/components/Pagination/Pagination.d.cts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +18 -10
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.cjs +8 -2
- package/dist/components/Pagination/PaginationEllipsis.d.cts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.js +9 -3
- package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
- package/dist/components/Pagination/PaginationItem.cjs +2 -1
- package/dist/components/Pagination/PaginationItem.js +2 -1
- package/dist/components/Pagination/PaginationItem.js.map +1 -1
- package/dist/components/Pagination/PaginationLink.cjs +2 -1
- package/dist/components/Pagination/PaginationLink.js +2 -1
- package/dist/components/Pagination/PaginationLink.js.map +1 -1
- package/dist/components/Pagination/PaginationNext.cjs +3 -1
- package/dist/components/Pagination/PaginationNext.js +3 -1
- package/dist/components/Pagination/PaginationNext.js.map +1 -1
- package/dist/components/Pagination/PaginationPrev.cjs +3 -1
- package/dist/components/Pagination/PaginationPrev.js +3 -1
- package/dist/components/Pagination/PaginationPrev.js.map +1 -1
- package/dist/components/Pagination/paginationContext.d.cts +2 -0
- package/dist/components/Pagination/paginationContext.d.cts.map +1 -1
- package/dist/components/Pagination/paginationContext.d.ts +2 -0
- package/dist/components/Pagination/paginationContext.d.ts.map +1 -1
- package/dist/components/Pagination/paginationContext.js.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.cjs +8 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.cts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.ts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.js +9 -2
- package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +30 -11
- package/dist/components/Radio/Radio.d.cts +7 -0
- package/dist/components/Radio/Radio.d.cts.map +1 -1
- package/dist/components/Radio/Radio.d.ts +7 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +30 -11
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Select/Select.cjs +29 -6
- package/dist/components/Select/Select.d.cts +2 -0
- package/dist/components/Select/Select.d.cts.map +1 -1
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +29 -6
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectContent.cjs +31 -23
- package/dist/components/Select/SelectContent.d.cts.map +1 -1
- package/dist/components/Select/SelectContent.d.ts.map +1 -1
- package/dist/components/Select/SelectContent.js +32 -24
- package/dist/components/Select/SelectContent.js.map +1 -1
- package/dist/components/Select/SelectItem.cjs +25 -15
- package/dist/components/Select/SelectItem.d.cts.map +1 -1
- package/dist/components/Select/SelectItem.d.ts.map +1 -1
- package/dist/components/Select/SelectItem.js +25 -15
- package/dist/components/Select/SelectItem.js.map +1 -1
- package/dist/components/Select/SelectTrigger.cjs +27 -13
- package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +27 -13
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Select/types.d.cts +2 -0
- package/dist/components/Select/types.d.cts.map +1 -1
- package/dist/components/Select/types.d.ts +2 -0
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Switch.cjs +48 -8
- package/dist/components/Switch.d.cts +7 -0
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts +7 -0
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +48 -8
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +17 -3
- package/dist/components/Tabs/Tab.d.cts.map +1 -1
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +17 -3
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs +8 -3
- package/dist/components/Tabs/Tabs.d.cts +9 -1
- package/dist/components/Tabs/Tabs.d.cts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +9 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +8 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.cts +2 -0
- package/dist/components/Tabs/tabsContexts.d.cts.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.ts +2 -0
- package/dist/components/Tabs/tabsContexts.d.ts.map +1 -1
- package/dist/components/Tabs/tabsContexts.js.map +1 -1
- package/dist/components/Text.cjs +9 -1
- package/dist/components/Text.d.cts +11 -2
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +11 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +9 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.cjs +6 -2
- package/dist/components/UDSProvider.d.cts +9 -0
- package/dist/components/UDSProvider.d.cts.map +1 -1
- package/dist/components/UDSProvider.d.ts +9 -0
- package/dist/components/UDSProvider.d.ts.map +1 -1
- package/dist/components/UDSProvider.js +6 -2
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/components/internal/Overlay/index.cjs +1 -1
- package/dist/components/internal/Overlay/index.js +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +67 -0
- package/dist/fontScaling/FontScalingContext.d.cts +53 -0
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -0
- package/dist/fontScaling/FontScalingContext.d.ts +53 -0
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -0
- package/dist/fontScaling/FontScalingContext.js +63 -0
- package/dist/fontScaling/FontScalingContext.js.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.cjs +250 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js +251 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -0
- package/dist/fontScaling/constants.cjs +106 -0
- package/dist/fontScaling/constants.d.cts +60 -0
- package/dist/fontScaling/constants.d.cts.map +1 -0
- package/dist/fontScaling/constants.d.ts +60 -0
- package/dist/fontScaling/constants.d.ts.map +1 -0
- package/dist/fontScaling/constants.js +103 -0
- package/dist/fontScaling/constants.js.map +1 -0
- package/dist/fontScaling/index.cjs +14 -0
- package/dist/fontScaling/index.d.cts +8 -0
- package/dist/fontScaling/index.d.ts +8 -0
- package/dist/fontScaling/index.js +6 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +37 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +38 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -0
- package/dist/fontScaling/types.cjs +1 -0
- package/dist/fontScaling/types.d.cts +54 -0
- package/dist/fontScaling/types.d.cts.map +1 -0
- package/dist/fontScaling/types.d.ts +54 -0
- package/dist/fontScaling/types.d.ts.map +1 -0
- package/dist/fontScaling/types.js +1 -0
- package/dist/fontScaling/useFontScale.cjs +58 -0
- package/dist/fontScaling/useFontScale.d.cts +12 -0
- package/dist/fontScaling/useFontScale.d.cts.map +1 -0
- package/dist/fontScaling/useFontScale.d.ts +12 -0
- package/dist/fontScaling/useFontScale.d.ts.map +1 -0
- package/dist/fontScaling/useFontScale.js +57 -0
- package/dist/fontScaling/useFontScale.js.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.cjs +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js.map +1 -0
- package/dist/jest/mocks/react-native.cjs +19 -4
- package/dist/jest/mocks/react-native.d.cts +8 -5
- package/dist/jest/mocks/react-native.d.cts.map +1 -1
- package/dist/jest/mocks/react-native.d.ts +8 -5
- package/dist/jest/mocks/react-native.d.ts.map +1 -1
- package/dist/jest/mocks/react-native.js +18 -5
- package/dist/jest/mocks/react-native.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +28 -1
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +28 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/setup.cjs +4 -0
- package/dist/jest/setup.d.cts.map +1 -1
- package/dist/jest/setup.d.ts.map +1 -1
- package/dist/jest/setup.js +4 -0
- package/dist/jest/setup.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +530 -530
- package/dist/mobile/generated/fontMetrics.js +530 -530
- package/dist/mobile/generated/fontMetrics.js.map +1 -1
- package/dist/portal.cjs +8 -2
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +8 -2
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +214 -214
- package/fonts/index.mjs +214 -214
- package/fonts/uds-icons.ttf +0 -0
- package/generated/fontMetrics.ts +530 -530
- package/generated/styles.d.ts +5 -28
- package/generated/unistyles.d.ts +0 -27
- package/package.json +11 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/fontScaling/constants.ts
|
|
4
|
+
/**
|
|
5
|
+
* The largest OS font scale UDS components are designed to support.
|
|
6
|
+
*
|
|
7
|
+
* Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so
|
|
8
|
+
* no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger
|
|
9
|
+
* Text is claimable at "at least 200% or the maximum font size for the
|
|
10
|
+
* system", so a 2x ceiling still qualifies. Note that iOS offers scales beyond
|
|
11
|
+
* this (up to 3.571x): with this ceiling in place the top accessibility sizes
|
|
12
|
+
* render alike, and an app that wants to follow the OS further can raise or
|
|
13
|
+
* remove the caps via `UDSFontScalingProvider`.
|
|
14
|
+
*/
|
|
15
|
+
const MAX_SUPPORTED_FONT_SCALE = 2;
|
|
16
|
+
/**
|
|
17
|
+
* How far each text style would grow if only legibility mattered, following
|
|
18
|
+
* the shape of Apple's Dynamic Type ramps: the larger a style starts, the less
|
|
19
|
+
* it multiplies. At iOS's largest accessibility size the system grows body
|
|
20
|
+
* (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers
|
|
21
|
+
* are larger than largeTitle, so they taper hardest.
|
|
22
|
+
*
|
|
23
|
+
* Caps are chosen by the size a style starts at rather than by which family it
|
|
24
|
+
* belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`
|
|
25
|
+
* (20pt) matches `title4` (20pt). `null` means "no cap from the curve" — those
|
|
26
|
+
* are reading sizes, where legibility argues for following the OS.
|
|
27
|
+
*
|
|
28
|
+
* The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.
|
|
29
|
+
*/
|
|
30
|
+
const TYPE_SCALE_CURVE = {
|
|
31
|
+
display1: 1.5,
|
|
32
|
+
display2: 1.6,
|
|
33
|
+
display3: 1.75,
|
|
34
|
+
title1: 1.8,
|
|
35
|
+
title2: 2,
|
|
36
|
+
title3: 2.2,
|
|
37
|
+
title4: 2.4,
|
|
38
|
+
headline1: 2.5,
|
|
39
|
+
ui1: 2.2,
|
|
40
|
+
ui2: 2.4,
|
|
41
|
+
body1: null,
|
|
42
|
+
label1: null,
|
|
43
|
+
label2: null,
|
|
44
|
+
label3: null,
|
|
45
|
+
label4: null,
|
|
46
|
+
caption1: null,
|
|
47
|
+
caption2: null,
|
|
48
|
+
legal1: null,
|
|
49
|
+
ui3: null,
|
|
50
|
+
ui4: null,
|
|
51
|
+
ui5: null,
|
|
52
|
+
ui6: null
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Default per-variant caps on OS font scaling, applied by `Text` when no
|
|
56
|
+
* explicit prop or provider config overrides them: the legibility curve in
|
|
57
|
+
* {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.
|
|
58
|
+
*
|
|
59
|
+
* Keys are base variants; `/emphasized` twins resolve to their base.
|
|
60
|
+
*/
|
|
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
|
+
/**
|
|
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.
|
|
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
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
exports.DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;
|
|
103
|
+
exports.DEFAULT_DYNAMIC_TYPE_RAMPS = DEFAULT_DYNAMIC_TYPE_RAMPS;
|
|
104
|
+
exports.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = DEFAULT_MAX_FONT_SIZE_MULTIPLIERS;
|
|
105
|
+
exports.MAX_SUPPORTED_FONT_SCALE = MAX_SUPPORTED_FONT_SCALE;
|
|
106
|
+
exports.TYPE_SCALE_CURVE = TYPE_SCALE_CURVE;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
import { FontScalingCapValue } from "./types.cjs";
|
|
4
|
+
import { TextProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/fontScaling/constants.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The largest OS font scale UDS components are designed to support.
|
|
9
|
+
*
|
|
10
|
+
* Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so
|
|
11
|
+
* no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger
|
|
12
|
+
* Text is claimable at "at least 200% or the maximum font size for the
|
|
13
|
+
* system", so a 2x ceiling still qualifies. Note that iOS offers scales beyond
|
|
14
|
+
* this (up to 3.571x): with this ceiling in place the top accessibility sizes
|
|
15
|
+
* render alike, and an app that wants to follow the OS further can raise or
|
|
16
|
+
* remove the caps via `UDSFontScalingProvider`.
|
|
17
|
+
*/
|
|
18
|
+
declare const MAX_SUPPORTED_FONT_SCALE = 2;
|
|
19
|
+
/**
|
|
20
|
+
* How far each text style would grow if only legibility mattered, following
|
|
21
|
+
* the shape of Apple's Dynamic Type ramps: the larger a style starts, the less
|
|
22
|
+
* it multiplies. At iOS's largest accessibility size the system grows body
|
|
23
|
+
* (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers
|
|
24
|
+
* are larger than largeTitle, so they taper hardest.
|
|
25
|
+
*
|
|
26
|
+
* Caps are chosen by the size a style starts at rather than by which family it
|
|
27
|
+
* belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`
|
|
28
|
+
* (20pt) matches `title4` (20pt). `null` means "no cap from the curve" — those
|
|
29
|
+
* are reading sizes, where legibility argues for following the OS.
|
|
30
|
+
*
|
|
31
|
+
* The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.
|
|
32
|
+
*/
|
|
33
|
+
declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
|
|
34
|
+
/**
|
|
35
|
+
* Default per-variant caps on OS font scaling, applied by `Text` when no
|
|
36
|
+
* explicit prop or provider config overrides them: the legibility curve in
|
|
37
|
+
* {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.
|
|
38
|
+
*
|
|
39
|
+
* Keys are base variants; `/emphasized` twins resolve to their base.
|
|
40
|
+
*/
|
|
41
|
+
declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
|
|
42
|
+
/**
|
|
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.
|
|
47
|
+
*/
|
|
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']>>>>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
|
|
60
|
+
//# sourceMappingURL=constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
import { FontScalingCapValue } from "./types.js";
|
|
4
|
+
import { TextProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/fontScaling/constants.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The largest OS font scale UDS components are designed to support.
|
|
9
|
+
*
|
|
10
|
+
* Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so
|
|
11
|
+
* no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger
|
|
12
|
+
* Text is claimable at "at least 200% or the maximum font size for the
|
|
13
|
+
* system", so a 2x ceiling still qualifies. Note that iOS offers scales beyond
|
|
14
|
+
* this (up to 3.571x): with this ceiling in place the top accessibility sizes
|
|
15
|
+
* render alike, and an app that wants to follow the OS further can raise or
|
|
16
|
+
* remove the caps via `UDSFontScalingProvider`.
|
|
17
|
+
*/
|
|
18
|
+
declare const MAX_SUPPORTED_FONT_SCALE = 2;
|
|
19
|
+
/**
|
|
20
|
+
* How far each text style would grow if only legibility mattered, following
|
|
21
|
+
* the shape of Apple's Dynamic Type ramps: the larger a style starts, the less
|
|
22
|
+
* it multiplies. At iOS's largest accessibility size the system grows body
|
|
23
|
+
* (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers
|
|
24
|
+
* are larger than largeTitle, so they taper hardest.
|
|
25
|
+
*
|
|
26
|
+
* Caps are chosen by the size a style starts at rather than by which family it
|
|
27
|
+
* belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`
|
|
28
|
+
* (20pt) matches `title4` (20pt). `null` means "no cap from the curve" — those
|
|
29
|
+
* are reading sizes, where legibility argues for following the OS.
|
|
30
|
+
*
|
|
31
|
+
* The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.
|
|
32
|
+
*/
|
|
33
|
+
declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
|
|
34
|
+
/**
|
|
35
|
+
* Default per-variant caps on OS font scaling, applied by `Text` when no
|
|
36
|
+
* explicit prop or provider config overrides them: the legibility curve in
|
|
37
|
+
* {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.
|
|
38
|
+
*
|
|
39
|
+
* Keys are base variants; `/emphasized` twins resolve to their base.
|
|
40
|
+
*/
|
|
41
|
+
declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
|
|
42
|
+
/**
|
|
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.
|
|
47
|
+
*/
|
|
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']>>>>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
|
|
60
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
//#region src/fontScaling/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* The largest OS font scale UDS components are designed to support.
|
|
5
|
+
*
|
|
6
|
+
* Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so
|
|
7
|
+
* no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger
|
|
8
|
+
* Text is claimable at "at least 200% or the maximum font size for the
|
|
9
|
+
* system", so a 2x ceiling still qualifies. Note that iOS offers scales beyond
|
|
10
|
+
* this (up to 3.571x): with this ceiling in place the top accessibility sizes
|
|
11
|
+
* render alike, and an app that wants to follow the OS further can raise or
|
|
12
|
+
* remove the caps via `UDSFontScalingProvider`.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_SUPPORTED_FONT_SCALE = 2;
|
|
15
|
+
/**
|
|
16
|
+
* How far each text style would grow if only legibility mattered, following
|
|
17
|
+
* the shape of Apple's Dynamic Type ramps: the larger a style starts, the less
|
|
18
|
+
* it multiplies. At iOS's largest accessibility size the system grows body
|
|
19
|
+
* (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers
|
|
20
|
+
* are larger than largeTitle, so they taper hardest.
|
|
21
|
+
*
|
|
22
|
+
* Caps are chosen by the size a style starts at rather than by which family it
|
|
23
|
+
* belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`
|
|
24
|
+
* (20pt) matches `title4` (20pt). `null` means "no cap from the curve" — those
|
|
25
|
+
* are reading sizes, where legibility argues for following the OS.
|
|
26
|
+
*
|
|
27
|
+
* The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.
|
|
28
|
+
*/
|
|
29
|
+
const TYPE_SCALE_CURVE = {
|
|
30
|
+
display1: 1.5,
|
|
31
|
+
display2: 1.6,
|
|
32
|
+
display3: 1.75,
|
|
33
|
+
title1: 1.8,
|
|
34
|
+
title2: 2,
|
|
35
|
+
title3: 2.2,
|
|
36
|
+
title4: 2.4,
|
|
37
|
+
headline1: 2.5,
|
|
38
|
+
ui1: 2.2,
|
|
39
|
+
ui2: 2.4,
|
|
40
|
+
body1: null,
|
|
41
|
+
label1: null,
|
|
42
|
+
label2: null,
|
|
43
|
+
label3: null,
|
|
44
|
+
label4: null,
|
|
45
|
+
caption1: null,
|
|
46
|
+
caption2: null,
|
|
47
|
+
legal1: null,
|
|
48
|
+
ui3: null,
|
|
49
|
+
ui4: null,
|
|
50
|
+
ui5: null,
|
|
51
|
+
ui6: null
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Default per-variant caps on OS font scaling, applied by `Text` when no
|
|
55
|
+
* explicit prop or provider config overrides them: the legibility curve in
|
|
56
|
+
* {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.
|
|
57
|
+
*
|
|
58
|
+
* Keys are base variants; `/emphasized` twins resolve to their base.
|
|
59
|
+
*/
|
|
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
|
+
/**
|
|
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.
|
|
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
|
+
};
|
|
100
|
+
//#endregion
|
|
101
|
+
export { DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER, DEFAULT_DYNAMIC_TYPE_RAMPS, DEFAULT_MAX_FONT_SIZE_MULTIPLIERS, MAX_SUPPORTED_FONT_SCALE, TYPE_SCALE_CURVE };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_fontScaling_FontScalingContext = require("./FontScalingContext.cjs");
|
|
4
|
+
const require_fontScaling_useFontScale = require("./useFontScale.cjs");
|
|
5
|
+
const require_fontScaling_constants = require("./constants.cjs");
|
|
6
|
+
const require_fontScaling_useMaxFontSizeMultiplier = require("./useMaxFontSizeMultiplier.cjs");
|
|
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;
|
|
9
|
+
exports.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = require_fontScaling_constants.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS;
|
|
10
|
+
exports.MAX_SUPPORTED_FONT_SCALE = require_fontScaling_constants.MAX_SUPPORTED_FONT_SCALE;
|
|
11
|
+
exports.TYPE_SCALE_CURVE = require_fontScaling_constants.TYPE_SCALE_CURVE;
|
|
12
|
+
exports.UDSFontScalingProvider = require_fontScaling_FontScalingContext.UDSFontScalingProvider;
|
|
13
|
+
exports.useFontScale = require_fontScaling_useFontScale.useFontScale;
|
|
14
|
+
exports.useMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
import { FontScalingCapValue, FontScalingConfig } from "./types.cjs";
|
|
4
|
+
import { UDSFontScalingProvider, UDSFontScalingProviderProps } from "./FontScalingContext.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
|
+
import { useFontScale } from "./useFontScale.cjs";
|
|
7
|
+
import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.cjs";
|
|
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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
import { FontScalingCapValue, FontScalingConfig } from "./types.js";
|
|
4
|
+
import { UDSFontScalingProvider, UDSFontScalingProviderProps } from "./FontScalingContext.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
|
+
import { useFontScale } from "./useFontScale.js";
|
|
7
|
+
import { useMaxFontSizeMultiplier } from "./useMaxFontSizeMultiplier.js";
|
|
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 };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { UDSFontScalingProvider } from "./FontScalingContext.js";
|
|
3
|
+
import { useFontScale } from "./useFontScale.js";
|
|
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 };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_fontScaling_constants = require("./constants.cjs");
|
|
4
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.ts
|
|
5
|
+
const UNCAPPED = 0;
|
|
6
|
+
function toResolved(cap) {
|
|
7
|
+
return cap === null ? UNCAPPED : cap;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
11
|
+
*
|
|
12
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
13
|
+
* entry, then `default`) > built-in default table.
|
|
14
|
+
*
|
|
15
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
16
|
+
* global) when nothing applies, including for `variant="inherit"`. Only an
|
|
17
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
18
|
+
*/
|
|
19
|
+
function resolveMaxFontSizeMultiplier({ explicit, config, variant }) {
|
|
20
|
+
if (explicit !== void 0) return toResolved(explicit);
|
|
21
|
+
if (config?.enabled === false) return;
|
|
22
|
+
if (variant === void 0) return config?.default !== void 0 ? toResolved(config.default) : void 0;
|
|
23
|
+
if (variant === "control") {
|
|
24
|
+
if (config?.control !== void 0) return toResolved(config.control);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
const baseVariant = variant.split("/")[0];
|
|
28
|
+
const variantCap = config?.variants?.[variant];
|
|
29
|
+
if (variantCap !== void 0) return toResolved(variantCap);
|
|
30
|
+
const baseVariantCap = config?.variants?.[baseVariant];
|
|
31
|
+
if (baseVariantCap !== void 0) return toResolved(baseVariantCap);
|
|
32
|
+
if (config?.default !== void 0) return toResolved(config.default);
|
|
33
|
+
const builtIn = require_fontScaling_constants.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? require_fontScaling_constants.DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];
|
|
34
|
+
return typeof builtIn === "number" ? builtIn : void 0;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.resolveMaxFontSizeMultiplier = resolveMaxFontSizeMultiplier;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
import { FontScalingConfig } from "./types.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.d.ts
|
|
6
|
+
interface ResolveMaxFontSizeMultiplierOptions {
|
|
7
|
+
/** Explicit component prop. `null` = force-uncap. Wins over everything. */
|
|
8
|
+
explicit?: number | null;
|
|
9
|
+
/** Provider config, if any provider is mounted. */
|
|
10
|
+
config?: FontScalingConfig;
|
|
11
|
+
/**
|
|
12
|
+
* The text's resolved variant, `'control'` for control-internal text/icons,
|
|
13
|
+
* or `undefined` for `variant="inherit"` text (no variant opinion — nested
|
|
14
|
+
* text inherits its parent's cap natively).
|
|
15
|
+
*/
|
|
16
|
+
variant?: TextVariant | 'control';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
20
|
+
*
|
|
21
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
22
|
+
* entry, then `default`) > built-in default table.
|
|
23
|
+
*
|
|
24
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
25
|
+
* global) when nothing applies, including for `variant="inherit"`. Only an
|
|
26
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
27
|
+
*/
|
|
28
|
+
declare function resolveMaxFontSizeMultiplier({
|
|
29
|
+
explicit,
|
|
30
|
+
config,
|
|
31
|
+
variant
|
|
32
|
+
}: ResolveMaxFontSizeMultiplierOptions): number | undefined;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type ResolveMaxFontSizeMultiplierOptions, resolveMaxFontSizeMultiplier };
|
|
35
|
+
//# sourceMappingURL=resolveMaxFontSizeMultiplier.d.cts.map
|
|
@@ -0,0 +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;;;;;;;;;iBAiBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
import { FontScalingConfig } from "./types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.d.ts
|
|
6
|
+
interface ResolveMaxFontSizeMultiplierOptions {
|
|
7
|
+
/** Explicit component prop. `null` = force-uncap. Wins over everything. */
|
|
8
|
+
explicit?: number | null;
|
|
9
|
+
/** Provider config, if any provider is mounted. */
|
|
10
|
+
config?: FontScalingConfig;
|
|
11
|
+
/**
|
|
12
|
+
* The text's resolved variant, `'control'` for control-internal text/icons,
|
|
13
|
+
* or `undefined` for `variant="inherit"` text (no variant opinion — nested
|
|
14
|
+
* text inherits its parent's cap natively).
|
|
15
|
+
*/
|
|
16
|
+
variant?: TextVariant | 'control';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
20
|
+
*
|
|
21
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
22
|
+
* entry, then `default`) > built-in default table.
|
|
23
|
+
*
|
|
24
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
25
|
+
* global) when nothing applies, including for `variant="inherit"`. Only an
|
|
26
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
27
|
+
*/
|
|
28
|
+
declare function resolveMaxFontSizeMultiplier({
|
|
29
|
+
explicit,
|
|
30
|
+
config,
|
|
31
|
+
variant
|
|
32
|
+
}: ResolveMaxFontSizeMultiplierOptions): number | undefined;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type ResolveMaxFontSizeMultiplierOptions, resolveMaxFontSizeMultiplier };
|
|
35
|
+
//# sourceMappingURL=resolveMaxFontSizeMultiplier.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;iBAiBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { DEFAULT_MAX_FONT_SIZE_MULTIPLIERS } from "./constants.js";
|
|
3
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.ts
|
|
4
|
+
const UNCAPPED = 0;
|
|
5
|
+
function toResolved(cap) {
|
|
6
|
+
return cap === null ? UNCAPPED : cap;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
10
|
+
*
|
|
11
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
12
|
+
* entry, then `default`) > built-in default table.
|
|
13
|
+
*
|
|
14
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
15
|
+
* global) when nothing applies, including for `variant="inherit"`. Only an
|
|
16
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
17
|
+
*/
|
|
18
|
+
function resolveMaxFontSizeMultiplier({ explicit, config, variant }) {
|
|
19
|
+
if (explicit !== void 0) return toResolved(explicit);
|
|
20
|
+
if (config?.enabled === false) return;
|
|
21
|
+
if (variant === void 0) return config?.default !== void 0 ? toResolved(config.default) : void 0;
|
|
22
|
+
if (variant === "control") {
|
|
23
|
+
if (config?.control !== void 0) return toResolved(config.control);
|
|
24
|
+
return 2;
|
|
25
|
+
}
|
|
26
|
+
const baseVariant = variant.split("/")[0];
|
|
27
|
+
const variantCap = config?.variants?.[variant];
|
|
28
|
+
if (variantCap !== void 0) return toResolved(variantCap);
|
|
29
|
+
const baseVariantCap = config?.variants?.[baseVariant];
|
|
30
|
+
if (baseVariantCap !== void 0) return toResolved(baseVariantCap);
|
|
31
|
+
if (config?.default !== void 0) return toResolved(config.default);
|
|
32
|
+
const builtIn = DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];
|
|
33
|
+
return typeof builtIn === "number" ? builtIn : void 0;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { resolveMaxFontSizeMultiplier };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=resolveMaxFontSizeMultiplier.js.map
|
|
@@ -0,0 +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 `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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/fontScaling/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A cap on OS font scaling for a piece of text.
|
|
7
|
+
*
|
|
8
|
+
* - `number` (>= 1) — text scales with the OS setting up to this multiplier
|
|
9
|
+
* - `null` — explicitly uncapped: text follows the OS setting with no limit
|
|
10
|
+
*/
|
|
11
|
+
type FontScalingCapValue = number | null;
|
|
12
|
+
/**
|
|
13
|
+
* App-level font-scaling configuration, applied via `UDSFontScalingProvider`
|
|
14
|
+
* (or the `fontScaling` prop on `UDSGestureProvider`).
|
|
15
|
+
*
|
|
16
|
+
* Resolution order for any piece of text: explicit component prop, then this
|
|
17
|
+
* config, then the built-in defaults in `DEFAULT_MAX_FONT_SIZE_MULTIPLIERS`.
|
|
18
|
+
*
|
|
19
|
+
* The config object should be identity-stable (a module constant or memoized)
|
|
20
|
+
* — every UDS text element reads it from context.
|
|
21
|
+
*/
|
|
22
|
+
interface FontScalingConfig {
|
|
23
|
+
/**
|
|
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.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Fallback cap for any variant not listed in `variants`. Takes precedence
|
|
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.
|
|
36
|
+
*/
|
|
37
|
+
default?: FontScalingCapValue;
|
|
38
|
+
/**
|
|
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.
|
|
43
|
+
* @default 2
|
|
44
|
+
*/
|
|
45
|
+
control?: FontScalingCapValue;
|
|
46
|
+
/**
|
|
47
|
+
* Per-variant caps. A base-variant key (e.g. `display1`) also covers its
|
|
48
|
+
* `/emphasized` twin unless the emphasized key is listed explicitly.
|
|
49
|
+
*/
|
|
50
|
+
variants?: Partial<Record<TextVariant, FontScalingCapValue>>;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type FontScalingCapValue, type FontScalingConfig };
|
|
54
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|