@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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_components_HStack = require("../HStack.cjs");
|
|
5
|
+
const require_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
|
|
5
6
|
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
6
7
|
const require_components_Select_selectContext = require("./selectContext.cjs");
|
|
7
8
|
const require_components_Select_selectItemTheme = require("./selectItemTheme.cjs");
|
|
@@ -18,7 +19,8 @@ react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
|
18
19
|
* A single selectable option inside {@link SelectContent}.
|
|
19
20
|
*/
|
|
20
21
|
const SelectItem = (0, react.memo)(function SelectItem({ value, disabled, children, style, testID }) {
|
|
21
|
-
const { value: selectedValue, setValue, setOpen, open, registerItem, unregisterItem, highlightedValue, setHighlightedValue, reduceMotion } = require_components_Select_selectContext.useSelectContext();
|
|
22
|
+
const { value: selectedValue, setValue, setOpen, open, registerItem, unregisterItem, highlightedValue, setHighlightedValue, reduceMotion, field } = require_components_Select_selectContext.useSelectContext();
|
|
23
|
+
const { maxFontSizeMultiplier } = field;
|
|
22
24
|
const { theme } = (0, react_native_unistyles.useUnistyles)();
|
|
23
25
|
const [isPressed, setIsPressed] = (0, react.useState)(false);
|
|
24
26
|
const label = (0, react.useMemo)(() => {
|
|
@@ -39,26 +41,32 @@ const SelectItem = (0, react.memo)(function SelectItem({ value, disabled, childr
|
|
|
39
41
|
isPressed,
|
|
40
42
|
isHighlighted: highlightedValue === value
|
|
41
43
|
});
|
|
42
|
-
const
|
|
43
|
-
require_components_Select_selectItemTheme.getMergedSelectItemLayerStyle(theme, "root", interaction, isSelected),
|
|
44
|
-
{
|
|
45
|
-
flexDirection: "row",
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
justifyContent: "space-between",
|
|
48
|
-
width: "100%",
|
|
49
|
-
opacity: disabled ? .5 : 1
|
|
50
|
-
},
|
|
51
|
-
style
|
|
52
|
-
], [
|
|
53
|
-
disabled,
|
|
44
|
+
const textStyle = (0, react.useMemo)(() => require_components_Select_selectItemTheme.getMergedSelectItemLayerStyle(theme, "text", interaction, isSelected), [
|
|
54
45
|
interaction,
|
|
55
46
|
isSelected,
|
|
56
|
-
style,
|
|
57
47
|
theme
|
|
58
48
|
]);
|
|
59
|
-
const
|
|
49
|
+
const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(maxFontSizeMultiplier, (typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : void 0) ?? (typeof textStyle.fontSize === "number" ? textStyle.fontSize : void 0));
|
|
50
|
+
const rootStyle = (0, react.useMemo)(() => {
|
|
51
|
+
const configuredRoot = require_components_Select_selectItemTheme.getMergedSelectItemLayerStyle(theme, "root", interaction, isSelected);
|
|
52
|
+
return [
|
|
53
|
+
configuredRoot,
|
|
54
|
+
fontScaleFactor !== 1 && typeof configuredRoot.paddingVertical === "number" ? { paddingVertical: Math.round(configuredRoot.paddingVertical * fontScaleFactor) } : void 0,
|
|
55
|
+
{
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
justifyContent: "space-between",
|
|
59
|
+
width: "100%",
|
|
60
|
+
opacity: disabled ? .5 : 1
|
|
61
|
+
},
|
|
62
|
+
style
|
|
63
|
+
];
|
|
64
|
+
}, [
|
|
65
|
+
disabled,
|
|
66
|
+
fontScaleFactor,
|
|
60
67
|
interaction,
|
|
61
68
|
isSelected,
|
|
69
|
+
style,
|
|
62
70
|
theme
|
|
63
71
|
]);
|
|
64
72
|
const endIconStyle = (0, react.useMemo)(() => require_components_Select_selectItemTheme.getMergedSelectItemLayerStyle(theme, "endIcon", interaction, isSelected), [
|
|
@@ -119,6 +127,7 @@ const SelectItem = (0, react.memo)(function SelectItem({ value, disabled, childr
|
|
|
119
127
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
120
128
|
style: textStyle,
|
|
121
129
|
numberOfLines: 1,
|
|
130
|
+
maxFontSizeMultiplier,
|
|
122
131
|
children
|
|
123
132
|
})
|
|
124
133
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
@@ -128,6 +137,7 @@ const SelectItem = (0, react.memo)(function SelectItem({ value, disabled, childr
|
|
|
128
137
|
icon: "Check",
|
|
129
138
|
size: "sm",
|
|
130
139
|
variant: "fill",
|
|
140
|
+
maxFontSizeMultiplier,
|
|
131
141
|
style: endIconStyle
|
|
132
142
|
})
|
|
133
143
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItem.d.cts","names":[],"sources":["../../../src/components/Select/SelectItem.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"SelectItem.d.cts","names":[],"sources":["../../../src/components/Select/SelectItem.tsx"],"mappings":";;;;;;UAsBU,eAAA;;EAER,KAAA;EAFQ;EAIR,QAAA;EACA,QAAA,GAAW,SAAA;EACX,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItem.d.ts","names":[],"sources":["../../../src/components/Select/SelectItem.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"SelectItem.d.ts","names":[],"sources":["../../../src/components/Select/SelectItem.tsx"],"mappings":";;;;;;UAsBU,eAAA;;EAER,KAAA;EAFQ;EAIR,QAAA;EACA,QAAA,GAAW,SAAA;EACX,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { HStack } from "../HStack.js";
|
|
3
|
+
import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
|
|
3
4
|
import { IconSlot } from "../IconSlot.js";
|
|
4
5
|
import { useSelectContext } from "./selectContext.js";
|
|
5
6
|
import { getMergedSelectItemLayerStyle, resolveSelectItemInteractionState } from "./selectItemTheme.js";
|
|
@@ -15,7 +16,8 @@ import Animated, { Easing, useAnimatedStyle, useDerivedValue, withTiming } from
|
|
|
15
16
|
* A single selectable option inside {@link SelectContent}.
|
|
16
17
|
*/
|
|
17
18
|
const SelectItem = memo(function SelectItem({ value, disabled, children, style, testID }) {
|
|
18
|
-
const { value: selectedValue, setValue, setOpen, open, registerItem, unregisterItem, highlightedValue, setHighlightedValue, reduceMotion } = useSelectContext();
|
|
19
|
+
const { value: selectedValue, setValue, setOpen, open, registerItem, unregisterItem, highlightedValue, setHighlightedValue, reduceMotion, field } = useSelectContext();
|
|
20
|
+
const { maxFontSizeMultiplier } = field;
|
|
19
21
|
const { theme } = useUnistyles();
|
|
20
22
|
const [isPressed, setIsPressed] = useState(false);
|
|
21
23
|
const label = useMemo(() => {
|
|
@@ -36,26 +38,32 @@ const SelectItem = memo(function SelectItem({ value, disabled, children, style,
|
|
|
36
38
|
isPressed,
|
|
37
39
|
isHighlighted: highlightedValue === value
|
|
38
40
|
});
|
|
39
|
-
const
|
|
40
|
-
getMergedSelectItemLayerStyle(theme, "root", interaction, isSelected),
|
|
41
|
-
{
|
|
42
|
-
flexDirection: "row",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
justifyContent: "space-between",
|
|
45
|
-
width: "100%",
|
|
46
|
-
opacity: disabled ? .5 : 1
|
|
47
|
-
},
|
|
48
|
-
style
|
|
49
|
-
], [
|
|
50
|
-
disabled,
|
|
41
|
+
const textStyle = useMemo(() => getMergedSelectItemLayerStyle(theme, "text", interaction, isSelected), [
|
|
51
42
|
interaction,
|
|
52
43
|
isSelected,
|
|
53
|
-
style,
|
|
54
44
|
theme
|
|
55
45
|
]);
|
|
56
|
-
const
|
|
46
|
+
const fontScaleFactor = useComponentFontScale(maxFontSizeMultiplier, (typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : void 0) ?? (typeof textStyle.fontSize === "number" ? textStyle.fontSize : void 0));
|
|
47
|
+
const rootStyle = useMemo(() => {
|
|
48
|
+
const configuredRoot = getMergedSelectItemLayerStyle(theme, "root", interaction, isSelected);
|
|
49
|
+
return [
|
|
50
|
+
configuredRoot,
|
|
51
|
+
fontScaleFactor !== 1 && typeof configuredRoot.paddingVertical === "number" ? { paddingVertical: Math.round(configuredRoot.paddingVertical * fontScaleFactor) } : void 0,
|
|
52
|
+
{
|
|
53
|
+
flexDirection: "row",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "space-between",
|
|
56
|
+
width: "100%",
|
|
57
|
+
opacity: disabled ? .5 : 1
|
|
58
|
+
},
|
|
59
|
+
style
|
|
60
|
+
];
|
|
61
|
+
}, [
|
|
62
|
+
disabled,
|
|
63
|
+
fontScaleFactor,
|
|
57
64
|
interaction,
|
|
58
65
|
isSelected,
|
|
66
|
+
style,
|
|
59
67
|
theme
|
|
60
68
|
]);
|
|
61
69
|
const endIconStyle = useMemo(() => getMergedSelectItemLayerStyle(theme, "endIcon", interaction, isSelected), [
|
|
@@ -116,6 +124,7 @@ const SelectItem = memo(function SelectItem({ value, disabled, children, style,
|
|
|
116
124
|
children: /* @__PURE__ */ jsx(Text, {
|
|
117
125
|
style: textStyle,
|
|
118
126
|
numberOfLines: 1,
|
|
127
|
+
maxFontSizeMultiplier,
|
|
119
128
|
children
|
|
120
129
|
})
|
|
121
130
|
}), /* @__PURE__ */ jsx(Animated.View, {
|
|
@@ -125,6 +134,7 @@ const SelectItem = memo(function SelectItem({ value, disabled, children, style,
|
|
|
125
134
|
icon: "Check",
|
|
126
135
|
size: "sm",
|
|
127
136
|
variant: "fill",
|
|
137
|
+
maxFontSizeMultiplier,
|
|
128
138
|
style: endIconStyle
|
|
129
139
|
})
|
|
130
140
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItem.js","names":["RNPressable","RNText"],"sources":["../../../src/components/Select/SelectItem.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\nimport { Pressable as RNPressable, Text as RNText } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n// eslint-disable-next-line uds/no-use-unistyles -- selectItem selected state uses theme paths\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { HStack } from '../HStack';\nimport { IconSlot } from '../IconSlot';\nimport { useSelectContext } from './selectContext';\nimport {\n getMergedSelectItemLayerStyle,\n resolveSelectItemInteractionState,\n} from './selectItemTheme';\n\ninterface SelectItemProps {\n /** Value submitted when this option is selected. */\n value: string;\n /** Whether this option is disabled. */\n disabled?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * **▾ Select item**\n *\n * A single selectable option inside {@link SelectContent}.\n */\nconst SelectItem = memo(function SelectItem({\n value,\n disabled,\n children,\n style,\n testID,\n}: SelectItemProps) {\n const {\n value: selectedValue,\n setValue,\n setOpen,\n open,\n registerItem,\n unregisterItem,\n highlightedValue,\n setHighlightedValue,\n reduceMotion,\n } = useSelectContext();\n const { theme } = useUnistyles();\n const [isPressed, setIsPressed] = useState(false);\n\n const label = useMemo(() => {\n if (typeof children === 'string' || typeof children === 'number') {\n return String(children);\n }\n\n return value;\n }, [children, value]);\n\n useEffect(() => {\n registerItem(value, label);\n return () => unregisterItem(value);\n }, [label, registerItem, unregisterItem, value]);\n\n const isSelected = selectedValue === value;\n const isHighlighted = highlightedValue === value;\n const interaction = resolveSelectItemInteractionState({\n isPressed,\n isHighlighted,\n });\n\n const
|
|
1
|
+
{"version":3,"file":"SelectItem.js","names":["RNPressable","RNText"],"sources":["../../../src/components/Select/SelectItem.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native';\nimport { Pressable as RNPressable, Text as RNText } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n// eslint-disable-next-line uds/no-use-unistyles -- selectItem selected state uses theme paths\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { useComponentFontScale } from '../../fontScaling/useFontScale';\nimport { HStack } from '../HStack';\nimport { IconSlot } from '../IconSlot';\nimport { useSelectContext } from './selectContext';\nimport {\n getMergedSelectItemLayerStyle,\n resolveSelectItemInteractionState,\n} from './selectItemTheme';\n\ninterface SelectItemProps {\n /** Value submitted when this option is selected. */\n value: string;\n /** Whether this option is disabled. */\n disabled?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * **▾ Select item**\n *\n * A single selectable option inside {@link SelectContent}.\n */\nconst SelectItem = memo(function SelectItem({\n value,\n disabled,\n children,\n style,\n testID,\n}: SelectItemProps) {\n const {\n value: selectedValue,\n setValue,\n setOpen,\n open,\n registerItem,\n unregisterItem,\n highlightedValue,\n setHighlightedValue,\n reduceMotion,\n field,\n } = useSelectContext();\n const { maxFontSizeMultiplier } = field;\n const { theme } = useUnistyles();\n const [isPressed, setIsPressed] = useState(false);\n\n const label = useMemo(() => {\n if (typeof children === 'string' || typeof children === 'number') {\n return String(children);\n }\n\n return value;\n }, [children, value]);\n\n useEffect(() => {\n registerItem(value, label);\n return () => unregisterItem(value);\n }, [label, registerItem, unregisterItem, value]);\n\n const isSelected = selectedValue === value;\n const isHighlighted = highlightedValue === value;\n const interaction = resolveSelectItemInteractionState({\n isPressed,\n isHighlighted,\n });\n\n const textStyle = useMemo(\n () => getMergedSelectItemLayerStyle(theme, 'text', interaction, isSelected) as TextStyle,\n [interaction, isSelected, theme],\n );\n const fontScaleFactor = useComponentFontScale(\n maxFontSizeMultiplier,\n (typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : undefined) ??\n (typeof textStyle.fontSize === 'number' ? textStyle.fontSize : undefined),\n );\n\n const rootStyle = useMemo(() => {\n const configuredRoot = getMergedSelectItemLayerStyle(\n theme,\n 'root',\n interaction,\n isSelected,\n ) as ViewStyle;\n return [\n configuredRoot,\n fontScaleFactor !== 1 && typeof configuredRoot.paddingVertical === 'number'\n ? { paddingVertical: Math.round(configuredRoot.paddingVertical * fontScaleFactor) }\n : undefined,\n {\n flexDirection: 'row' as const,\n alignItems: 'center' as const,\n justifyContent: 'space-between' as const,\n width: '100%' as const,\n opacity: disabled ? 0.5 : 1,\n },\n style,\n ] as StyleProp<ViewStyle>;\n }, [disabled, fontScaleFactor, interaction, isSelected, style, theme]);\n\n const endIconStyle = useMemo(\n () => getMergedSelectItemLayerStyle(theme, 'endIcon', interaction, isSelected),\n [interaction, isSelected, theme],\n );\n\n const checkScale = useDerivedValue(\n () =>\n withTiming(isSelected ? 1 : 0, {\n duration: reduceMotion ? 0 : 120,\n easing: Easing.out(Easing.ease),\n }),\n [isSelected, reduceMotion],\n );\n\n const checkAnimatedStyle = useAnimatedStyle(() => ({\n opacity: checkScale.value,\n transform: [{ scale: 0.7 + checkScale.value * 0.3 }],\n }));\n\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n setValue(value);\n setOpen(false);\n setHighlightedValue(null);\n }, [disabled, setHighlightedValue, setOpen, setValue, value]);\n\n const handlePressIn = useCallback(() => {\n if (disabled) {\n return;\n }\n\n setIsPressed(true);\n setHighlightedValue(value);\n }, [disabled, setHighlightedValue, value]);\n\n const handlePressOut = useCallback(() => {\n setIsPressed(false);\n }, []);\n\n if (!open) {\n return null;\n }\n\n return (\n <RNPressable\n testID={testID}\n disabled={disabled}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n style={rootStyle}\n accessibilityRole=\"menuitem\"\n accessibilityState={{ disabled: !!disabled, selected: isSelected }}\n >\n <HStack columnGap=\"2\" alignItems=\"center\" justifyContent=\"flex-start\" style={{ flex: 1 }}>\n <RNText style={textStyle} numberOfLines={1} maxFontSizeMultiplier={maxFontSizeMultiplier}>\n {children}\n </RNText>\n </HStack>\n\n <Animated.View style={checkAnimatedStyle} pointerEvents=\"none\">\n <IconSlot\n icon=\"Check\"\n size=\"sm\"\n variant=\"fill\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={endIconStyle}\n />\n </Animated.View>\n </RNPressable>\n );\n});\n\nSelectItem.displayName = 'SelectItem';\n\nexport { SelectItem, type SelectItemProps };\n"],"mappings":"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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
|
|
4
5
|
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
5
6
|
const require_components_internal_Overlay_measureTrigger = require("../internal/Overlay/measureTrigger.cjs");
|
|
6
7
|
const require_components_Select_selectContext = require("./selectContext.cjs");
|
|
@@ -13,7 +14,7 @@ react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
|
13
14
|
//#region src/components/Select/SelectTrigger.tsx
|
|
14
15
|
const SelectTrigger = (0, react.memo)(function SelectTrigger({ startIcon, endIcon }) {
|
|
15
16
|
const { value, open, setOpen, triggerRef, triggerRect, setTriggerRect, getItemLabel, setHighlightedValue, reduceMotion } = require_components_Select_selectContext.useSelectContext();
|
|
16
|
-
const { size, disabled, readOnly, hasError, placeholder, uid, width } = require_components_Select_selectContext.useSelectFieldContext();
|
|
17
|
+
const { size, disabled, readOnly, hasError, placeholder, uid, width, maxFontSizeMultiplier } = require_components_Select_selectContext.useSelectFieldContext();
|
|
17
18
|
const hasValue = value.length > 0;
|
|
18
19
|
const valueState = hasValue ? "filled" : "empty";
|
|
19
20
|
const isInteractive = !readOnly && !disabled;
|
|
@@ -26,17 +27,27 @@ const SelectTrigger = (0, react.memo)(function SelectTrigger({ startIcon, endIco
|
|
|
26
27
|
readonly: readOnly,
|
|
27
28
|
invalid: hasError
|
|
28
29
|
});
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
generated_styles.inputStyles.inputWrapperStatic
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(maxFontSizeMultiplier, (typeof generated_styles.inputStyles.inputWrapperStatic.lineHeight === "number" ? generated_styles.inputStyles.inputWrapperStatic.lineHeight : void 0) ?? (typeof generated_styles.inputStyles.inputWrapperStatic.fontSize === "number" ? generated_styles.inputStyles.inputWrapperStatic.fontSize : void 0));
|
|
31
|
+
const inputWrapperStyle = (0, react.useMemo)(() => {
|
|
32
|
+
const { gap, paddingVertical } = generated_styles.inputStyles.inputWrapperStatic;
|
|
33
|
+
const scaledMetrics = fontScaleFactor === 1 ? void 0 : {
|
|
34
|
+
...typeof gap === "number" && { gap: Math.round(gap * fontScaleFactor) },
|
|
35
|
+
...typeof paddingVertical === "number" && { paddingVertical: Math.round(paddingVertical * fontScaleFactor) }
|
|
36
|
+
};
|
|
37
|
+
return [
|
|
38
|
+
generated_styles.inputStyles.inputWrapper,
|
|
39
|
+
generated_styles.inputStyles.inputWrapperStatic,
|
|
40
|
+
generated_styles.inputStyles.inputWrapperDynamic,
|
|
41
|
+
scaledMetrics,
|
|
42
|
+
{
|
|
43
|
+
flexDirection: "row",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
width,
|
|
46
|
+
alignSelf: "stretch"
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
}, [
|
|
50
|
+
fontScaleFactor,
|
|
40
51
|
generated_styles.inputStyles.inputWrapper,
|
|
41
52
|
generated_styles.inputStyles.inputWrapperDynamic,
|
|
42
53
|
generated_styles.inputStyles.inputWrapperStatic,
|
|
@@ -45,7 +56,7 @@ const SelectTrigger = (0, react.memo)(function SelectTrigger({ startIcon, endIco
|
|
|
45
56
|
const textContainerStyle = (0, react.useMemo)(() => [{
|
|
46
57
|
flex: 1,
|
|
47
58
|
justifyContent: "center"
|
|
48
|
-
}, typeof generated_styles.inputStyles.input.height === "number" ? { minHeight: generated_styles.inputStyles.input.height } : null], [generated_styles.inputStyles.input]);
|
|
59
|
+
}, typeof generated_styles.inputStyles.input.height === "number" ? { minHeight: Math.round(generated_styles.inputStyles.input.height * fontScaleFactor) } : null], [fontScaleFactor, generated_styles.inputStyles.input]);
|
|
49
60
|
const textInputStyle = (0, react.useMemo)(() => [
|
|
50
61
|
{
|
|
51
62
|
fontFamily: generated_styles.inputStyles.inputWrapperStatic.fontFamily,
|
|
@@ -111,12 +122,14 @@ const SelectTrigger = (0, react.memo)(function SelectTrigger({ startIcon, endIco
|
|
|
111
122
|
startIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
112
123
|
icon: startIcon,
|
|
113
124
|
variant: "outline",
|
|
125
|
+
maxFontSizeMultiplier,
|
|
114
126
|
style: generated_styles.inputStyles.startIcon
|
|
115
127
|
}) : null,
|
|
116
128
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
117
129
|
style: textContainerStyle,
|
|
118
130
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
119
131
|
numberOfLines: 1,
|
|
132
|
+
maxFontSizeMultiplier,
|
|
120
133
|
style: textInputStyle,
|
|
121
134
|
children: displayText
|
|
122
135
|
})
|
|
@@ -128,6 +141,7 @@ const SelectTrigger = (0, react.memo)(function SelectTrigger({ startIcon, endIco
|
|
|
128
141
|
icon: useAnimatedChevron ? "ChevronDown" : endIcon,
|
|
129
142
|
size: "sm",
|
|
130
143
|
variant: "outline",
|
|
144
|
+
maxFontSizeMultiplier,
|
|
131
145
|
style: generated_styles.inputStyles.endIcon
|
|
132
146
|
})
|
|
133
147
|
}) : null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTrigger.d.cts","names":[],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"SelectTrigger.d.cts","names":[],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"mappings":";;;;;UAiBU,kBAAA;EACR,SAAA,GAAY,YAAA;EACZ,OAAA,GAAU,YAAA;AAAA;AAAA,cAGN,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTrigger.d.ts","names":[],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"SelectTrigger.d.ts","names":[],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"mappings":";;;;;UAiBU,kBAAA;EACR,SAAA,GAAY,YAAA;EACZ,OAAA,GAAU,YAAA;AAAA;AAAA,cAGN,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
|
|
2
3
|
import { IconSlot } from "../IconSlot.js";
|
|
3
4
|
import { measureTrigger } from "../internal/Overlay/measureTrigger.js";
|
|
4
5
|
import { useSelectContext, useSelectFieldContext } from "./selectContext.js";
|
|
@@ -10,7 +11,7 @@ import Animated, { Easing, useAnimatedStyle, useDerivedValue, withTiming } from
|
|
|
10
11
|
//#region src/components/Select/SelectTrigger.tsx
|
|
11
12
|
const SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }) {
|
|
12
13
|
const { value, open, setOpen, triggerRef, triggerRect, setTriggerRect, getItemLabel, setHighlightedValue, reduceMotion } = useSelectContext();
|
|
13
|
-
const { size, disabled, readOnly, hasError, placeholder, uid, width } = useSelectFieldContext();
|
|
14
|
+
const { size, disabled, readOnly, hasError, placeholder, uid, width, maxFontSizeMultiplier } = useSelectFieldContext();
|
|
14
15
|
const hasValue = value.length > 0;
|
|
15
16
|
const valueState = hasValue ? "filled" : "empty";
|
|
16
17
|
const isInteractive = !readOnly && !disabled;
|
|
@@ -23,17 +24,27 @@ const SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }) {
|
|
|
23
24
|
readonly: readOnly,
|
|
24
25
|
invalid: hasError
|
|
25
26
|
});
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
inputStyles.inputWrapperStatic
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
const fontScaleFactor = useComponentFontScale(maxFontSizeMultiplier, (typeof inputStyles.inputWrapperStatic.lineHeight === "number" ? inputStyles.inputWrapperStatic.lineHeight : void 0) ?? (typeof inputStyles.inputWrapperStatic.fontSize === "number" ? inputStyles.inputWrapperStatic.fontSize : void 0));
|
|
28
|
+
const inputWrapperStyle = useMemo(() => {
|
|
29
|
+
const { gap, paddingVertical } = inputStyles.inputWrapperStatic;
|
|
30
|
+
const scaledMetrics = fontScaleFactor === 1 ? void 0 : {
|
|
31
|
+
...typeof gap === "number" && { gap: Math.round(gap * fontScaleFactor) },
|
|
32
|
+
...typeof paddingVertical === "number" && { paddingVertical: Math.round(paddingVertical * fontScaleFactor) }
|
|
33
|
+
};
|
|
34
|
+
return [
|
|
35
|
+
inputStyles.inputWrapper,
|
|
36
|
+
inputStyles.inputWrapperStatic,
|
|
37
|
+
inputStyles.inputWrapperDynamic,
|
|
38
|
+
scaledMetrics,
|
|
39
|
+
{
|
|
40
|
+
flexDirection: "row",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
width,
|
|
43
|
+
alignSelf: "stretch"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}, [
|
|
47
|
+
fontScaleFactor,
|
|
37
48
|
inputStyles.inputWrapper,
|
|
38
49
|
inputStyles.inputWrapperDynamic,
|
|
39
50
|
inputStyles.inputWrapperStatic,
|
|
@@ -42,7 +53,7 @@ const SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }) {
|
|
|
42
53
|
const textContainerStyle = useMemo(() => [{
|
|
43
54
|
flex: 1,
|
|
44
55
|
justifyContent: "center"
|
|
45
|
-
}, typeof inputStyles.input.height === "number" ? { minHeight: inputStyles.input.height } : null], [inputStyles.input]);
|
|
56
|
+
}, typeof inputStyles.input.height === "number" ? { minHeight: Math.round(inputStyles.input.height * fontScaleFactor) } : null], [fontScaleFactor, inputStyles.input]);
|
|
46
57
|
const textInputStyle = useMemo(() => [
|
|
47
58
|
{
|
|
48
59
|
fontFamily: inputStyles.inputWrapperStatic.fontFamily,
|
|
@@ -108,12 +119,14 @@ const SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }) {
|
|
|
108
119
|
startIcon ? /* @__PURE__ */ jsx(IconSlot, {
|
|
109
120
|
icon: startIcon,
|
|
110
121
|
variant: "outline",
|
|
122
|
+
maxFontSizeMultiplier,
|
|
111
123
|
style: inputStyles.startIcon
|
|
112
124
|
}) : null,
|
|
113
125
|
/* @__PURE__ */ jsx(View, {
|
|
114
126
|
style: textContainerStyle,
|
|
115
127
|
children: /* @__PURE__ */ jsx(Text, {
|
|
116
128
|
numberOfLines: 1,
|
|
129
|
+
maxFontSizeMultiplier,
|
|
117
130
|
style: textInputStyle,
|
|
118
131
|
children: displayText
|
|
119
132
|
})
|
|
@@ -125,6 +138,7 @@ const SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }) {
|
|
|
125
138
|
icon: useAnimatedChevron ? "ChevronDown" : endIcon,
|
|
126
139
|
size: "sm",
|
|
127
140
|
variant: "outline",
|
|
141
|
+
maxFontSizeMultiplier,
|
|
128
142
|
style: inputStyles.endIcon
|
|
129
143
|
})
|
|
130
144
|
}) : null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTrigger.js","names":["RNPressable","RNView","RNText"],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport type { View } from 'react-native';\nimport { Pressable as RNPressable, Text as RNText, View as RNView } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport { inputStyles } from '../../../generated/styles';\nimport type { IconSlotType } from '../IconSlot';\nimport { IconSlot } from '../IconSlot';\nimport { measureTrigger } from '../internal/Overlay';\nimport { useSelectContext, useSelectFieldContext } from './selectContext';\n\ninterface SelectTriggerProps {\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n}\n\nconst SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }: SelectTriggerProps) {\n const {\n value,\n open,\n setOpen,\n triggerRef,\n triggerRect,\n setTriggerRect,\n getItemLabel,\n setHighlightedValue,\n reduceMotion,\n } = useSelectContext();\n const { size, disabled, readOnly, hasError, placeholder, uid, width }
|
|
1
|
+
{"version":3,"file":"SelectTrigger.js","names":["RNPressable","RNView","RNText"],"sources":["../../../src/components/Select/SelectTrigger.tsx"],"sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport type { View } from 'react-native';\nimport { Pressable as RNPressable, Text as RNText, View as RNView } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport { inputStyles } from '../../../generated/styles';\nimport { useComponentFontScale } from '../../fontScaling/useFontScale';\nimport type { IconSlotType } from '../IconSlot';\nimport { IconSlot } from '../IconSlot';\nimport { measureTrigger } from '../internal/Overlay';\nimport { useSelectContext, useSelectFieldContext } from './selectContext';\n\ninterface SelectTriggerProps {\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n}\n\nconst SelectTrigger = memo(function SelectTrigger({ startIcon, endIcon }: SelectTriggerProps) {\n const {\n value,\n open,\n setOpen,\n triggerRef,\n triggerRect,\n setTriggerRect,\n getItemLabel,\n setHighlightedValue,\n reduceMotion,\n } = useSelectContext();\n const { size, disabled, readOnly, hasError, placeholder, uid, width, maxFontSizeMultiplier } =\n useSelectFieldContext();\n\n const hasValue = value.length > 0;\n const valueState = hasValue ? 'filled' : 'empty';\n const isInteractive = !readOnly && !disabled;\n const useAnimatedChevron = endIcon === undefined;\n const displayText = hasValue ? (getItemLabel(value) ?? value) : (placeholder ?? '');\n\n inputStyles.useVariants({\n size,\n value: valueState,\n pressed: open,\n readonly: readOnly,\n invalid: hasError,\n });\n const fontScaleFactor = useComponentFontScale(\n maxFontSizeMultiplier,\n (typeof inputStyles.inputWrapperStatic.lineHeight === 'number'\n ? inputStyles.inputWrapperStatic.lineHeight\n : undefined) ??\n (typeof inputStyles.inputWrapperStatic.fontSize === 'number'\n ? inputStyles.inputWrapperStatic.fontSize\n : undefined),\n );\n\n const inputWrapperStyle = useMemo(() => {\n const { gap, paddingVertical } = inputStyles.inputWrapperStatic;\n const scaledMetrics =\n fontScaleFactor === 1\n ? undefined\n : {\n ...(typeof gap === 'number' && { gap: Math.round(gap * fontScaleFactor) }),\n ...(typeof paddingVertical === 'number' && {\n paddingVertical: Math.round(paddingVertical * fontScaleFactor),\n }),\n };\n\n return [\n inputStyles.inputWrapper,\n inputStyles.inputWrapperStatic,\n inputStyles.inputWrapperDynamic,\n scaledMetrics,\n {\n flexDirection: 'row' as const,\n alignItems: 'center' as const,\n width,\n alignSelf: 'stretch' as const,\n },\n ];\n }, [\n fontScaleFactor,\n inputStyles.inputWrapper,\n inputStyles.inputWrapperDynamic,\n inputStyles.inputWrapperStatic,\n width,\n ]);\n\n const textContainerStyle = useMemo(\n () => [\n {\n flex: 1,\n justifyContent: 'center' as const,\n },\n typeof inputStyles.input.height === 'number'\n ? { minHeight: Math.round(inputStyles.input.height * fontScaleFactor) }\n : null,\n ],\n [fontScaleFactor, inputStyles.input],\n );\n\n const textInputStyle = useMemo(\n () => [\n {\n fontFamily: inputStyles.inputWrapperStatic.fontFamily,\n fontSize: inputStyles.inputWrapperStatic.fontSize,\n letterSpacing: inputStyles.inputWrapperStatic.letterSpacing,\n // Match TextInput vertical centering: wrapper lineHeight is for layout, not single-line text.\n lineHeight: inputStyles.inputWrapperStatic.fontSize,\n paddingVertical: 0,\n },\n inputStyles.input,\n { height: undefined },\n !hasValue ? inputStyles.inputPlaceholder : null,\n ],\n [hasValue, inputStyles.input, inputStyles.inputPlaceholder, inputStyles.inputWrapperStatic],\n );\n\n const chevronProgress = useDerivedValue(\n () =>\n withTiming(open ? 1 : 0, {\n duration: reduceMotion ? 0 : 200,\n easing: Easing.out(Easing.ease),\n }),\n [open, reduceMotion],\n );\n\n const chevronAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ rotate: `${chevronProgress.value * 180}deg` }],\n }));\n\n const handleRef = useCallback(\n (node: View | null) => {\n triggerRef.current = node;\n },\n [triggerRef],\n );\n\n const handlePress = useCallback(() => {\n if (!isInteractive) {\n return;\n }\n\n if (open) {\n setOpen(false);\n setHighlightedValue(null);\n return;\n }\n\n measureTrigger(triggerRef.current, triggerRect, setTriggerRect);\n setHighlightedValue(null);\n setOpen(true);\n }, [isInteractive, open, setHighlightedValue, setOpen, setTriggerRect, triggerRect, triggerRef]);\n\n return (\n <RNPressable\n ref={handleRef}\n testID=\"select-trigger\"\n onPress={handlePress}\n disabled={!isInteractive}\n style={{ width, alignSelf: 'stretch' }}\n accessibilityRole=\"button\"\n accessibilityLabel={displayText || uid}\n accessibilityState={{\n disabled: !isInteractive,\n expanded: open,\n selected: hasValue,\n }}\n >\n <RNView style={inputWrapperStyle} pointerEvents=\"none\">\n {startIcon ? (\n <IconSlot\n icon={startIcon}\n variant=\"outline\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={inputStyles.startIcon}\n />\n ) : null}\n\n <RNView style={textContainerStyle}>\n <RNText\n numberOfLines={1}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={textInputStyle}\n >\n {displayText}\n </RNText>\n </RNView>\n\n {useAnimatedChevron || endIcon ? (\n <Animated.View\n style={useAnimatedChevron ? chevronAnimatedStyle : undefined}\n testID=\"select-chevron\"\n >\n <IconSlot\n icon={useAnimatedChevron ? 'ChevronDown' : endIcon!}\n size=\"sm\"\n variant=\"outline\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={inputStyles.endIcon}\n />\n </Animated.View>\n ) : null}\n </RNView>\n </RNPressable>\n );\n});\n\nSelectTrigger.displayName = 'SelectTrigger';\n\nexport { SelectTrigger, type SelectTriggerProps };\n"],"mappings":";;;;;;;;;;;AAsBA,MAAM,gBAAgB,KAAK,SAAS,cAAc,EAAE,WAAW,WAA+B;CAC5F,MAAM,EACJ,OACA,MACA,SACA,YACA,aACA,gBACA,cACA,qBACA,iBACE,kBAAkB;CACtB,MAAM,EAAE,MAAM,UAAU,UAAU,UAAU,aAAa,KAAK,OAAO,0BACnE,uBAAuB;CAEzB,MAAM,WAAW,MAAM,SAAS;CAChC,MAAM,aAAa,WAAW,WAAW;CACzC,MAAM,gBAAgB,CAAC,YAAY,CAAC;CACpC,MAAM,qBAAqB,YAAY,KAAA;CACvC,MAAM,cAAc,WAAY,aAAa,MAAM,IAAI,QAAU,eAAe;CAEhF,YAAY,YAAY;EACtB;EACA,OAAO;EACP,SAAS;EACT,UAAU;EACV,SAAS;EACV,CAAC;CACF,MAAM,kBAAkB,sBACtB,wBACC,OAAO,YAAY,mBAAmB,eAAe,WAClD,YAAY,mBAAmB,aAC/B,KAAA,OACD,OAAO,YAAY,mBAAmB,aAAa,WAChD,YAAY,mBAAmB,WAC/B,KAAA,GACP;CAED,MAAM,oBAAoB,cAAc;EACtC,MAAM,EAAE,KAAK,oBAAoB,YAAY;EAC7C,MAAM,gBACJ,oBAAoB,IAChB,KAAA,IACA;GACE,GAAI,OAAO,QAAQ,YAAY,EAAE,KAAK,KAAK,MAAM,MAAM,gBAAgB,EAAE;GACzE,GAAI,OAAO,oBAAoB,YAAY,EACzC,iBAAiB,KAAK,MAAM,kBAAkB,gBAAgB,EAC/D;GACF;EAEP,OAAO;GACL,YAAY;GACZ,YAAY;GACZ,YAAY;GACZ;GACA;IACE,eAAe;IACf,YAAY;IACZ;IACA,WAAW;IACZ;GACF;IACA;EACD;EACA,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ;EACD,CAAC;CAEF,MAAM,qBAAqB,cACnB,CACJ;EACE,MAAM;EACN,gBAAgB;EACjB,EACD,OAAO,YAAY,MAAM,WAAW,WAChC,EAAE,WAAW,KAAK,MAAM,YAAY,MAAM,SAAS,gBAAgB,EAAE,GACrE,KACL,EACD,CAAC,iBAAiB,YAAY,MAAM,CACrC;CAED,MAAM,iBAAiB,cACf;EACJ;GACE,YAAY,YAAY,mBAAmB;GAC3C,UAAU,YAAY,mBAAmB;GACzC,eAAe,YAAY,mBAAmB;GAE9C,YAAY,YAAY,mBAAmB;GAC3C,iBAAiB;GAClB;EACD,YAAY;EACZ,EAAE,QAAQ,KAAA,GAAW;EACrB,CAAC,WAAW,YAAY,mBAAmB;EAC5C,EACD;EAAC;EAAU,YAAY;EAAO,YAAY;EAAkB,YAAY;EAAmB,CAC5F;CAED,MAAM,kBAAkB,sBAEpB,WAAW,OAAO,IAAI,GAAG;EACvB,UAAU,eAAe,IAAI;EAC7B,QAAQ,OAAO,IAAI,OAAO,KAAK;EAChC,CAAC,EACJ,CAAC,MAAM,aAAa,CACrB;CAED,MAAM,uBAAuB,wBAAwB,EACnD,WAAW,CAAC,EAAE,QAAQ,GAAG,gBAAgB,QAAQ,IAAI,MAAM,CAAC,EAC7D,EAAE;CAyBH,OACE,oBAACA,WAAD;EACE,KAzBc,aACf,SAAsB;GACrB,WAAW,UAAU;KAEvB,CAAC,WAAW,CAqBI;EACd,QAAO;EACP,SApBgB,kBAAkB;GACpC,IAAI,CAAC,eACH;GAGF,IAAI,MAAM;IACR,QAAQ,MAAM;IACd,oBAAoB,KAAK;IACzB;;GAGF,eAAe,WAAW,SAAS,aAAa,eAAe;GAC/D,oBAAoB,KAAK;GACzB,QAAQ,KAAK;KACZ;GAAC;GAAe;GAAM;GAAqB;GAAS;GAAgB;GAAa;GAAW,CAMvE;EACpB,UAAU,CAAC;EACX,OAAO;GAAE;GAAO,WAAW;GAAW;EACtC,mBAAkB;EAClB,oBAAoB,eAAe;EACnC,oBAAoB;GAClB,UAAU,CAAC;GACX,UAAU;GACV,UAAU;GACX;YAED,qBAACC,MAAD;GAAQ,OAAO;GAAmB,eAAc;aAAhD;IACG,YACC,oBAAC,UAAD;KACE,MAAM;KACN,SAAQ;KACe;KACvB,OAAO,YAAY;KACnB,CAAA,GACA;IAEJ,oBAACA,MAAD;KAAQ,OAAO;eACb,oBAACC,MAAD;MACE,eAAe;MACQ;MACvB,OAAO;gBAEN;MACM,CAAA;KACF,CAAA;IAER,sBAAsB,UACrB,oBAAC,SAAS,MAAV;KACE,OAAO,qBAAqB,uBAAuB,KAAA;KACnD,QAAO;eAEP,oBAAC,UAAD;MACE,MAAM,qBAAqB,gBAAgB;MAC3C,MAAK;MACL,SAAQ;MACe;MACvB,OAAO,YAAY;MACnB,CAAA;KACY,CAAA,GACd;IACG;;EACG,CAAA;EAEhB;AAEF,cAAc,cAAc"}
|
|
@@ -19,6 +19,8 @@ interface SelectFieldContextValue {
|
|
|
19
19
|
reduceMotion?: boolean;
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
uid: string;
|
|
22
|
+
/** Resolved React Native control cap (0 means explicitly uncapped). */
|
|
23
|
+
maxFontSizeMultiplier?: number;
|
|
22
24
|
}
|
|
23
25
|
interface SelectContextValue {
|
|
24
26
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Select/types.ts"],"mappings":";;;;;;;KAMY,iBAAA;AAAA,KACA,oBAAA;AAAA,KACA,cAAA;AAAA,KACA,iBAAA;AAAA,UAEK,uBAAA;EACf,IAAA,EAAM,SAAA;EACN,QAAA;EACA,QAAA;EACA,QAAA;EACA,QAAA;EACA,KAAA;EACA,YAAA;EACA,WAAA;EACA,GAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,IAAA;EACA,OAAA,GAAU,IAAA;EACV,UAAA,EAAY,SAAA,CAAU,IAAA;EACtB,WAAA,EAAa,YAAA;EACb,cAAA,GAAiB,IAAA,EAAM,YAAA;EACvB,YAAA,GAAe,KAAA,UAAe,KAAA;EAC9B,cAAA,GAAiB,KAAA;EACjB,YAAA,GAAe,KAAA;EACf,gBAAA;EACA,mBAAA,GAAsB,KAAA;EACtB,KAAA,EAAO,uBAAA;EACP,YAAA;AAAA;AAAA,KAGU,0BAAA;AAAA,KAEA,eAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Select/types.ts"],"mappings":";;;;;;;KAMY,iBAAA;AAAA,KACA,oBAAA;AAAA,KACA,cAAA;AAAA,KACA,iBAAA;AAAA,UAEK,uBAAA;EACf,IAAA,EAAM,SAAA;EACN,QAAA;EACA,QAAA;EACA,QAAA;EACA,QAAA;EACA,KAAA;EACA,YAAA;EACA,WAAA;EACA,GAAA;EAZwB;EAcxB,qBAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,IAAA;EACA,OAAA,GAAU,IAAA;EACV,UAAA,EAAY,SAAA,CAAU,IAAA;EACtB,WAAA,EAAa,YAAA;EACb,cAAA,GAAiB,IAAA,EAAM,YAAA;EACvB,YAAA,GAAe,KAAA,UAAe,KAAA;EAC9B,cAAA,GAAiB,KAAA;EACjB,YAAA,GAAe,KAAA;EACf,gBAAA;EACA,mBAAA,GAAsB,KAAA;EACtB,KAAA,EAAO,uBAAA;EACP,YAAA;AAAA;AAAA,KAGU,0BAAA;AAAA,KAEA,eAAA"}
|
|
@@ -19,6 +19,8 @@ interface SelectFieldContextValue {
|
|
|
19
19
|
reduceMotion?: boolean;
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
uid: string;
|
|
22
|
+
/** Resolved React Native control cap (0 means explicitly uncapped). */
|
|
23
|
+
maxFontSizeMultiplier?: number;
|
|
22
24
|
}
|
|
23
25
|
interface SelectContextValue {
|
|
24
26
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Select/types.ts"],"mappings":";;;;;;;KAMY,iBAAA;AAAA,KACA,oBAAA;AAAA,KACA,cAAA;AAAA,KACA,iBAAA;AAAA,UAEK,uBAAA;EACf,IAAA,EAAM,SAAA;EACN,QAAA;EACA,QAAA;EACA,QAAA;EACA,QAAA;EACA,KAAA;EACA,YAAA;EACA,WAAA;EACA,GAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,IAAA;EACA,OAAA,GAAU,IAAA;EACV,UAAA,EAAY,SAAA,CAAU,IAAA;EACtB,WAAA,EAAa,YAAA;EACb,cAAA,GAAiB,IAAA,EAAM,YAAA;EACvB,YAAA,GAAe,KAAA,UAAe,KAAA;EAC9B,cAAA,GAAiB,KAAA;EACjB,YAAA,GAAe,KAAA;EACf,gBAAA;EACA,mBAAA,GAAsB,KAAA;EACtB,KAAA,EAAO,uBAAA;EACP,YAAA;AAAA;AAAA,KAGU,0BAAA;AAAA,KAEA,eAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Select/types.ts"],"mappings":";;;;;;;KAMY,iBAAA;AAAA,KACA,oBAAA;AAAA,KACA,cAAA;AAAA,KACA,iBAAA;AAAA,UAEK,uBAAA;EACf,IAAA,EAAM,SAAA;EACN,QAAA;EACA,QAAA;EACA,QAAA;EACA,QAAA;EACA,KAAA;EACA,YAAA;EACA,WAAA;EACA,GAAA;EAZwB;EAcxB,qBAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,IAAA;EACA,OAAA,GAAU,IAAA;EACV,UAAA,EAAY,SAAA,CAAU,IAAA;EACtB,WAAA,EAAa,YAAA;EACb,cAAA,GAAiB,IAAA,EAAM,YAAA;EACvB,YAAA,GAAe,KAAA,UAAe,KAAA;EAC9B,cAAA,GAAiB,KAAA;EACjB,YAAA,GAAe,KAAA;EACf,gBAAA;EACA,mBAAA,GAAsB,KAAA;EACtB,KAAA,EAAO,uBAAA;EACP,YAAA;AAAA;AAAA,KAGU,0BAAA;AAAA,KAEA,eAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_fontScaling_useFontScale = require("../fontScaling/useFontScale.cjs");
|
|
5
|
+
const require_fontScaling_useMaxFontSizeMultiplier = require("../fontScaling/useMaxFontSizeMultiplier.cjs");
|
|
6
|
+
const require_components_Button_buttonTheme = require("./Button/buttonTheme.cjs");
|
|
4
7
|
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
5
8
|
const require_components_FormLabel = require("./FormLabel.cjs");
|
|
6
9
|
let react = require("react");
|
|
@@ -12,10 +15,6 @@ let react_native_reanimated = require("react-native-reanimated");
|
|
|
12
15
|
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
13
16
|
let react_native_unistyles_reanimated = require("react-native-unistyles/reanimated");
|
|
14
17
|
//#region src/components/Switch.tsx
|
|
15
|
-
const HANDLE_TRAVEL = {
|
|
16
|
-
md: 20,
|
|
17
|
-
sm: 12
|
|
18
|
-
};
|
|
19
18
|
const ANIMATION_DURATION = 120;
|
|
20
19
|
/**
|
|
21
20
|
* **Switch component for toggling options**
|
|
@@ -50,13 +49,14 @@ const ANIMATION_DURATION = 120;
|
|
|
50
49
|
* @see {@link Checkbox} for forms with submit actions
|
|
51
50
|
* @see {@link Radio} for single-select options
|
|
52
51
|
*/
|
|
53
|
-
const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = false, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, disabled = false, required, accessibilityHint, reduceMotion = false, ref, ...viewProps }) {
|
|
52
|
+
const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = false, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, disabled = false, required, maxFontSizeMultiplier, accessibilityHint, reduceMotion = false, ref, ...viewProps }) {
|
|
54
53
|
const isControlled = isOnProp !== void 0;
|
|
55
54
|
const [internalIsOn, setInternalIsOn] = (0, react.useState)(defaultIsOn);
|
|
56
55
|
const [prefersReducedMotion, setPrefersReducedMotion] = (0, react.useState)(false);
|
|
57
56
|
const isOn = isControlled ? isOnProp : internalIsOn;
|
|
58
57
|
const activeVariant = isOn ? "on" : "off";
|
|
59
58
|
const { theme } = (0, react_native_unistyles.useUnistyles)();
|
|
59
|
+
const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
60
60
|
(0, react.useEffect)(() => {
|
|
61
61
|
const checkReducedMotion = async () => {
|
|
62
62
|
setPrefersReducedMotion(await react_native.AccessibilityInfo.isReduceMotionEnabled());
|
|
@@ -67,7 +67,6 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
67
67
|
}, []);
|
|
68
68
|
const animationDuration = reduceMotion || prefersReducedMotion ? 0 : ANIMATION_DURATION;
|
|
69
69
|
const progress = (0, react_native_reanimated.useDerivedValue)(() => (0, react_native_reanimated.withTiming)(isOn ? 1 : 0, { duration: animationDuration }), [isOn, animationDuration]);
|
|
70
|
-
const travelDistance = HANDLE_TRAVEL[size] * (react_native.I18nManager.isRTL ? -1 : 1);
|
|
71
70
|
const handlePress = (0, react.useCallback)(() => {
|
|
72
71
|
if (disabled) return;
|
|
73
72
|
const newValue = !isOn;
|
|
@@ -83,6 +82,15 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
83
82
|
size,
|
|
84
83
|
variant: activeVariant
|
|
85
84
|
}) ?? generated_styles.switchStyles;
|
|
85
|
+
const labelBaseSize = resolvedSwitchStyles.text.lineHeight ?? resolvedSwitchStyles.text.fontSize;
|
|
86
|
+
const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof labelBaseSize === "number" ? labelBaseSize : void 0);
|
|
87
|
+
const handleIconSize = resolvedSwitchStyles.handleIcon.fontSize;
|
|
88
|
+
const handleIconScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof handleIconSize === "number" ? handleIconSize : void 0);
|
|
89
|
+
const scaledHandleIconSize = typeof handleIconSize === "number" ? Math.round(handleIconSize * handleIconScaleFactor) : void 0;
|
|
90
|
+
const scaledTrackWidth = Math.round(resolvedSwitchStyles.switch.width * fontScaleFactor);
|
|
91
|
+
const scaledTrackPadding = Math.round(resolvedSwitchStyles.switch.padding * fontScaleFactor);
|
|
92
|
+
const scaledHandleWidth = Math.round(resolvedSwitchStyles.handle.width * fontScaleFactor);
|
|
93
|
+
const travelDistance = Math.max(0, scaledTrackWidth - scaledHandleWidth - scaledTrackPadding * 2) * (react_native.I18nManager.isRTL ? -1 : 1);
|
|
86
94
|
const variantLayerStyles = (0, react.useMemo)(() => {
|
|
87
95
|
const components = theme.components;
|
|
88
96
|
const getLayerStyle = (layer) => components[`switch/variant/default/active/${activeVariant}/${layer}/rest`];
|
|
@@ -103,24 +111,37 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
103
111
|
return { transform: [{ translateX: progress.value * travelDistance }] };
|
|
104
112
|
});
|
|
105
113
|
const rootStyle = (0, react.useMemo)(() => [resolvedSwitchStyles.root, switchStaticStyles.root({ disabled })], [resolvedSwitchStyles.root, disabled]);
|
|
114
|
+
const scaleDimensions = (0, react.useCallback)((style) => {
|
|
115
|
+
if (!style || fontScaleFactor === 1) return;
|
|
116
|
+
const { width, height, padding } = style;
|
|
117
|
+
return typeof width === "number" && typeof height === "number" ? {
|
|
118
|
+
width: Math.round(width * fontScaleFactor),
|
|
119
|
+
height: Math.round(height * fontScaleFactor),
|
|
120
|
+
...typeof padding === "number" && { padding: Math.round(padding * fontScaleFactor) }
|
|
121
|
+
} : void 0;
|
|
122
|
+
}, [fontScaleFactor]);
|
|
106
123
|
const trackStyle = (0, react.useMemo)(() => [
|
|
107
124
|
resolvedSwitchStyles.switch,
|
|
108
125
|
switchStaticStyles.track,
|
|
109
126
|
variantLayerStyles.switch,
|
|
127
|
+
scaleDimensions(resolvedSwitchStyles.switch),
|
|
110
128
|
react_native.Platform.OS !== "web" && animatedTrackStyle
|
|
111
129
|
], [
|
|
112
130
|
resolvedSwitchStyles.switch,
|
|
113
131
|
variantLayerStyles.switch,
|
|
132
|
+
scaleDimensions,
|
|
114
133
|
animatedTrackStyle
|
|
115
134
|
]);
|
|
116
135
|
const handleStyle = (0, react.useMemo)(() => [
|
|
117
136
|
resolvedSwitchStyles.handle,
|
|
118
137
|
switchStaticStyles.handle,
|
|
119
138
|
variantLayerStyles.handle,
|
|
139
|
+
scaleDimensions(resolvedSwitchStyles.handle),
|
|
120
140
|
animatedHandleStyle
|
|
121
141
|
], [
|
|
122
142
|
resolvedSwitchStyles.handle,
|
|
123
143
|
variantLayerStyles.handle,
|
|
144
|
+
scaleDimensions,
|
|
124
145
|
animatedHandleStyle
|
|
125
146
|
]);
|
|
126
147
|
const accessibilityLabel = typeof label === "string" ? label : void 0;
|
|
@@ -131,6 +152,7 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
131
152
|
label,
|
|
132
153
|
required,
|
|
133
154
|
showRequiredAsterisk: required,
|
|
155
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
134
156
|
style: [resolvedSwitchStyles.text, variantLayerStyles.text]
|
|
135
157
|
});
|
|
136
158
|
const a11yValue = (0, react.useMemo)(() => ({ text: isOn ? "On" : "Off" }), [isOn]);
|
|
@@ -161,14 +183,32 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
161
183
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
162
184
|
icon: onIcon,
|
|
163
185
|
variant: "fill",
|
|
164
|
-
|
|
186
|
+
dangerouslySetSize: scaledHandleIconSize,
|
|
187
|
+
allowFontScaling: false,
|
|
188
|
+
style: [
|
|
189
|
+
resolvedSwitchStyles.handleIcon,
|
|
190
|
+
variantLayerStyles.handleIcon,
|
|
191
|
+
scaledHandleIconSize === void 0 ? void 0 : {
|
|
192
|
+
fontSize: scaledHandleIconSize,
|
|
193
|
+
lineHeight: require_components_Button_buttonTheme.getSafeIconCell(scaledHandleIconSize)
|
|
194
|
+
}
|
|
195
|
+
]
|
|
165
196
|
})
|
|
166
197
|
}), offIcon && !isOn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
167
198
|
style: switchStaticStyles.iconContainer,
|
|
168
199
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
169
200
|
icon: offIcon,
|
|
170
201
|
variant: "fill",
|
|
171
|
-
|
|
202
|
+
dangerouslySetSize: scaledHandleIconSize,
|
|
203
|
+
allowFontScaling: false,
|
|
204
|
+
style: [
|
|
205
|
+
resolvedSwitchStyles.handleIcon,
|
|
206
|
+
variantLayerStyles.handleIcon,
|
|
207
|
+
scaledHandleIconSize === void 0 ? void 0 : {
|
|
208
|
+
fontSize: scaledHandleIconSize,
|
|
209
|
+
lineHeight: require_components_Button_buttonTheme.getSafeIconCell(scaledHandleIconSize)
|
|
210
|
+
}
|
|
211
|
+
]
|
|
172
212
|
})
|
|
173
213
|
})]
|
|
174
214
|
})
|
|
@@ -15,6 +15,13 @@ interface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<Ico
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
/** Whether the switch is required (shows asterisk with label) */
|
|
17
17
|
required?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Caps how far the track, handle, and label grow with the OS text-size
|
|
20
|
+
* setting; all scale by the same factor. Set null to remove the cap;
|
|
21
|
+
* override app-wide via UDSFontScalingProvider.
|
|
22
|
+
* @default 2
|
|
23
|
+
*/
|
|
24
|
+
maxFontSizeMultiplier?: number | null;
|
|
18
25
|
/** Accessibility hint describing what happens when activated */
|
|
19
26
|
accessibilityHint?: AccessibilityProps['accessibilityHint'];
|
|
20
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.cts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"Switch.d.cts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;UAyBU,WAAA,SAAoB,IAAA,CAAK,SAAA,YAAqB,oBAAA,CAAqB,YAAA;;EAE3E,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,QAAA,IAAY,KAAA;;EAEZ,QAAA;EAN2E;EAQ3E,QAAA;EANM;;;;;;EAaN,qBAAA;EAfiC;EAiBjC,iBAAA,GAAoB,kBAAA;AAAA;;;;;;;;;;;;;AAAkB;;;;;;;;;;;;;;;;;;;;;cAsClC,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
|