@yahoo/uds-mobile 2.24.0-beta.1 → 2.24.0-beta.11
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 +37 -1
- 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/Button/buttonTheme.cjs +16 -7
- package/dist/components/Button/buttonTheme.d.cts +13 -6
- package/dist/components/Button/buttonTheme.d.cts.map +1 -1
- package/dist/components/Button/buttonTheme.d.ts +13 -6
- package/dist/components/Button/buttonTheme.d.ts.map +1 -1
- package/dist/components/Button/buttonTheme.js +16 -8
- package/dist/components/Button/buttonTheme.js.map +1 -1
- package/dist/components/Button.cjs +25 -11
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +25 -11
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +16 -6
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +16 -6
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +24 -21
- package/dist/components/Chip/ChipBase.js +24 -21
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Icon.cjs +22 -6
- package/dist/components/Icon.d.cts +6 -5
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +6 -5
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +22 -6
- 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 +16 -1
- package/dist/components/Link.d.cts +6 -0
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.ts +6 -0
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +16 -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 +4 -3
- package/dist/components/Radio/Radio.js +4 -3
- 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 +31 -14
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +31 -14
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +8 -4
- 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 +8 -4
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Text.cjs +5 -0
- package/dist/components/Text.d.cts +6 -5
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +6 -5
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +5 -0
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.cjs +1 -1
- package/dist/components/UDSProvider.d.cts +4 -3
- package/dist/components/UDSProvider.d.cts.map +1 -1
- package/dist/components/UDSProvider.d.ts +4 -3
- package/dist/components/UDSProvider.d.ts.map +1 -1
- package/dist/components/UDSProvider.js +1 -1
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +35 -3
- package/dist/fontScaling/FontScalingContext.d.cts +20 -5
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -1
- package/dist/fontScaling/FontScalingContext.d.ts +20 -5
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -1
- package/dist/fontScaling/FontScalingContext.js +34 -5
- package/dist/fontScaling/FontScalingContext.js.map +1 -1
- 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 +37 -3
- package/dist/fontScaling/constants.d.cts +15 -4
- package/dist/fontScaling/constants.d.cts.map +1 -1
- package/dist/fontScaling/constants.d.ts +15 -4
- package/dist/fontScaling/constants.d.ts.map +1 -1
- package/dist/fontScaling/constants.js +37 -4
- package/dist/fontScaling/constants.js.map +1 -1
- package/dist/fontScaling/index.cjs +2 -1
- package/dist/fontScaling/index.d.cts +2 -2
- package/dist/fontScaling/index.d.ts +2 -2
- package/dist/fontScaling/index.js +3 -3
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +1 -2
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +1 -2
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -1
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +1 -2
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -1
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +1 -2
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -1
- package/dist/fontScaling/types.d.cts +11 -8
- package/dist/fontScaling/types.d.cts.map +1 -1
- package/dist/fontScaling/types.d.ts +11 -8
- package/dist/fontScaling/types.d.ts.map +1 -1
- package/dist/fontScaling/useFontScale.cjs +30 -4
- package/dist/fontScaling/useFontScale.d.cts +6 -12
- package/dist/fontScaling/useFontScale.d.cts.map +1 -1
- package/dist/fontScaling/useFontScale.d.ts +6 -12
- package/dist/fontScaling/useFontScale.d.ts.map +1 -1
- package/dist/fontScaling/useFontScale.js +31 -6
- package/dist/fontScaling/useFontScale.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +14 -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 +14 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +534 -534
- package/dist/mobile/generated/fontMetrics.js +534 -534
- 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/fonts/index.cjs +214 -214
- package/fonts/index.mjs +214 -214
- package/fonts/uds-icons.ttf +0 -0
- package/generated/fontMetrics.ts +534 -534
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VStack } from "../VStack.js";
|
|
3
3
|
import { useAnchoredPosition } from "../internal/Overlay/useAnchoredPosition.js";
|
|
4
4
|
import { PopoverPortalLayer } from "../Popover/PopoverPortalLayer.js";
|
|
5
|
-
import { useSelectContext } from "./selectContext.js";
|
|
5
|
+
import { SelectContext, SelectFieldContext, useSelectContext, useSelectFieldContext } from "./selectContext.js";
|
|
6
6
|
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { ScrollView, StyleSheet, View } from "react-native";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -28,7 +28,9 @@ const OFFSCREEN_REGISTRY_STYLE = StyleSheet.create({ registry: {
|
|
|
28
28
|
* Floating listbox container for {@link SelectItem} options.
|
|
29
29
|
*/
|
|
30
30
|
const SelectContent = memo(function SelectContent({ children, size: _size = "default", variant: _variant = "default", keepOpenOnInteractOutside = false, maxHeight = DEFAULT_MAX_HEIGHT, gutter = DEFAULT_OFFSET, sameWidth = true, style, testID }) {
|
|
31
|
-
const
|
|
31
|
+
const selectContext = useSelectContext();
|
|
32
|
+
const fieldContext = useSelectFieldContext();
|
|
33
|
+
const { open, setOpen, triggerRect, reduceMotion } = selectContext;
|
|
32
34
|
const [contentSize, setContentSize] = useState({
|
|
33
35
|
width: 0,
|
|
34
36
|
height: 0
|
|
@@ -112,28 +114,34 @@ const SelectContent = memo(function SelectContent({ children, size: _size = "def
|
|
|
112
114
|
open,
|
|
113
115
|
dismissible: !keepOpenOnInteractOutside,
|
|
114
116
|
onDismiss: dismiss,
|
|
115
|
-
children: () => /* @__PURE__ */ jsx(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
children: () => /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
118
|
+
value: selectContext,
|
|
119
|
+
children: /* @__PURE__ */ jsx(SelectFieldContext.Provider, {
|
|
120
|
+
value: fieldContext,
|
|
121
|
+
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
122
|
+
testID,
|
|
123
|
+
style: [
|
|
124
|
+
contentStyle,
|
|
125
|
+
animatedStyle,
|
|
126
|
+
{
|
|
127
|
+
overflow: "visible",
|
|
128
|
+
zIndex: 1e3
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
onLayout: handleLayout,
|
|
132
|
+
accessibilityRole: "menu",
|
|
133
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
134
|
+
style: panelStyle,
|
|
135
|
+
children: /* @__PURE__ */ jsx(ScrollView, {
|
|
136
|
+
keyboardShouldPersistTaps: "handled",
|
|
137
|
+
nestedScrollEnabled: true,
|
|
138
|
+
style: { maxHeight },
|
|
139
|
+
children: /* @__PURE__ */ jsx(VStack, {
|
|
140
|
+
alignItems: "stretch",
|
|
141
|
+
justifyContent: "flex-start",
|
|
142
|
+
children
|
|
143
|
+
})
|
|
144
|
+
})
|
|
137
145
|
})
|
|
138
146
|
})
|
|
139
147
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectContent.js","names":["RNScrollView"],"sources":["../../../src/components/Select/SelectContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\nimport { ScrollView as RNScrollView, StyleSheet, View } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport { selectContentStyles } from '../../../generated/styles';\nimport { useAnchoredPosition } from '../internal/Overlay';\nimport { PopoverPortalLayer } from '../Popover/PopoverPortalLayer';\nimport { VStack } from '../VStack';\nimport {
|
|
1
|
+
{"version":3,"file":"SelectContent.js","names":["RNScrollView"],"sources":["../../../src/components/Select/SelectContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\nimport { ScrollView as RNScrollView, StyleSheet, View } from 'react-native';\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport { selectContentStyles } from '../../../generated/styles';\nimport { useAnchoredPosition } from '../internal/Overlay';\nimport { PopoverPortalLayer } from '../Popover/PopoverPortalLayer';\nimport { VStack } from '../VStack';\nimport {\n SelectContext,\n SelectFieldContext,\n useSelectContext,\n useSelectFieldContext,\n} from './selectContext';\nimport type { SelectContentSize, SelectContentVariant } from './types';\n\nconst DEFAULT_OFFSET = 4;\nconst DEFAULT_MAX_HEIGHT = 240;\nconst ANIMATION_DURATION = 200;\n\nconst OFFSCREEN_REGISTRY_STYLE = StyleSheet.create({\n registry: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n opacity: 0,\n overflow: 'hidden',\n zIndex: -1,\n },\n});\n\ninterface SelectContentProps {\n children?: ReactNode;\n size?: SelectContentSize;\n variant?: SelectContentVariant;\n /** When true, the panel stays open when the user taps outside. */\n keepOpenOnInteractOutside?: boolean;\n /** Maximum height of the options list in pixels. @default 240 */\n maxHeight?: number;\n /** Distance between the trigger and the content panel. @default 4 */\n gutter?: number;\n /** When true, the content panel matches the trigger width. @default true */\n sameWidth?: boolean;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * **▾ Select content panel**\n *\n * Floating listbox container for {@link SelectItem} options.\n */\nconst SelectContent = memo(function SelectContent({\n children,\n size: _size = 'default',\n variant: _variant = 'default',\n keepOpenOnInteractOutside = false,\n maxHeight = DEFAULT_MAX_HEIGHT,\n gutter = DEFAULT_OFFSET,\n sameWidth = true,\n style,\n testID,\n}: SelectContentProps) {\n const selectContext = useSelectContext();\n const fieldContext = useSelectFieldContext();\n const { open, setOpen, triggerRect, reduceMotion } = selectContext;\n const [contentSize, setContentSize] = useState({ width: 0, height: 0 });\n const [shouldRender, setShouldRender] = useState(open);\n\n const dismiss = useCallback(() => {\n if (keepOpenOnInteractOutside) {\n return;\n }\n\n setOpen(false);\n }, [keepOpenOnInteractOutside, setOpen]);\n\n const {\n contentStyle,\n anchorReady,\n maxWidth: positionedMaxWidth,\n } = useAnchoredPosition({\n triggerRect,\n contentSize,\n placement: 'bottom',\n offset: gutter,\n sameWidth,\n width: sameWidth ? 'trigger' : 'content',\n avoidCollisions: true,\n collisionPadding: 12,\n });\n\n const isPositionedOpen = open && anchorReady && contentSize.height > 0;\n const progress = useDerivedValue(\n () =>\n withTiming(isPositionedOpen ? 1 : 0, {\n duration: reduceMotion ? 0 : ANIMATION_DURATION,\n easing: Easing.out(Easing.ease),\n }),\n [isPositionedOpen, reduceMotion],\n );\n\n const animatedStyle = useAnimatedStyle(() => ({\n opacity: progress.value,\n transform: [{ scale: 0.97 + progress.value * 0.03 }, { translateY: (1 - progress.value) * 8 }],\n }));\n\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n const { width, height } = event.nativeEvent.layout;\n setContentSize({ width, height });\n }, []);\n\n useEffect(() => {\n if (open) {\n setShouldRender(true);\n return;\n }\n\n if (reduceMotion) {\n setShouldRender(false);\n setContentSize({ width: 0, height: 0 });\n return;\n }\n\n const timeout = setTimeout(() => {\n setShouldRender(false);\n setContentSize({ width: 0, height: 0 });\n }, ANIMATION_DURATION);\n\n return () => clearTimeout(timeout);\n }, [open, reduceMotion]);\n\n selectContentStyles.useVariants({});\n\n const panelStyle = useMemo(\n () =>\n StyleSheet.flatten([\n selectContentStyles.root,\n {\n maxHeight,\n maxWidth: positionedMaxWidth > 0 ? positionedMaxWidth : undefined,\n overflow: 'hidden',\n zIndex: 1,\n },\n style,\n ]) as ViewStyle,\n [maxHeight, positionedMaxWidth, selectContentStyles.root, style],\n );\n\n return (\n <>\n {!open ? (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n pointerEvents=\"none\"\n style={OFFSCREEN_REGISTRY_STYLE.registry}\n >\n {children}\n </View>\n ) : null}\n\n {open && shouldRender ? (\n <PopoverPortalLayer\n open={open}\n dismissible={!keepOpenOnInteractOutside}\n onDismiss={dismiss}\n >\n {() => (\n <SelectContext.Provider value={selectContext}>\n <SelectFieldContext.Provider value={fieldContext}>\n <Animated.View\n testID={testID}\n style={[contentStyle, animatedStyle, { overflow: 'visible', zIndex: 1000 }]}\n onLayout={handleLayout}\n accessibilityRole=\"menu\"\n >\n <View style={panelStyle}>\n <RNScrollView\n keyboardShouldPersistTaps=\"handled\"\n nestedScrollEnabled\n style={{ maxHeight }}\n >\n <VStack alignItems=\"stretch\" justifyContent=\"flex-start\">\n {children}\n </VStack>\n </RNScrollView>\n </View>\n </Animated.View>\n </SelectFieldContext.Provider>\n </SelectContext.Provider>\n )}\n </PopoverPortalLayer>\n ) : null}\n </>\n );\n});\n\nSelectContent.displayName = 'SelectContent';\n\nexport { SelectContent, type SelectContentProps };\n"],"mappings":";;;;;;;;;;;AAuBA,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,MAAM,2BAA2B,WAAW,OAAO,EACjD,UAAU;CACR,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ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
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":";;;;;;;;;;;;;;;;;AAqCA,MAAM,aAAa,KAAK,SAAS,WAAW,EAC1C,OACA,UACA,UACA,OACA,UACkB;CAClB,MAAM,EACJ,OAAO,eACP,UACA,SACA,MACA,cACA,gBACA,kBACA,qBACA,cACA,UACE,kBAAkB;CACtB,MAAM,EAAE,0BAA0B;CAClC,MAAM,EAAE,UAAU,cAAc;CAChC,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CAEjD,MAAM,QAAQ,cAAc;EAC1B,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,SAAS;EAGzB,OAAO;IACN,CAAC,UAAU,MAAM,CAAC;CAErB,gBAAgB;EACd,aAAa,OAAO,MAAM;EAC1B,aAAa,eAAe,MAAM;IACjC;EAAC;EAAO;EAAc;EAAgB;EAAM,CAAC;CAEhD,MAAM,aAAa,kBAAkB;CAErC,MAAM,cAAc,kCAAkC;EACpD;EACA,eAHoB,qBAAqB;EAI1C,CAAC;CAEF,MAAM,YAAY,cACV,8BAA8B,OAAO,QAAQ,aAAa,WAAW,EAC3E;EAAC;EAAa;EAAY;EAAM,CACjC;CACD,MAAM,kBAAkB,sBACtB,wBACC,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa,KAAA,OAChE,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW,KAAA,GAClE;CAED,MAAM,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oBAAC,QAAD;GAAQ,WAAU;GAAI,YAAW;GAAS,gBAAe;GAAa,OAAO,EAAE,MAAM,GAAG;aACtF,oBAACC,MAAD;IAAQ,OAAO;IAAW,eAAe;IAA0B;IAChE;IACM,CAAA;GACF,CAAA,EAET,oBAAC,SAAS,MAAV;GAAe,OAAO;GAAoB,eAAc;aACtD,oBAAC,UAAD;IACE,MAAK;IACL,MAAK;IACL,SAAQ;IACe;IACvB,OAAO;IACP,CAAA;GACY,CAAA,CACJ;;EAEhB;AAEF,WAAW,cAAc"}
|
|
@@ -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,KA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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"}
|