@yahoo/uds-mobile 2.24.0-beta.6 → 2.24.0-beta.7

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 CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  `@yahoo/uds-mobile` brings UDS to React Native. It provides:
20
20
 
21
- - **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, InputHelpText, Link, Radio, RadioGroup, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
21
+ - **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, InputHelpText, Link, Pagination, Radio, RadioGroup, Select, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
22
22
  - **Theming**: Full light/dark mode support with automatic system preference detection
23
23
  - **Design Token Integration**: Colors, typography, spacing, and motion configs synced from UDS tokens
24
24
  - **Animations**: Smooth, physics-based animations using Reanimated with motion parity to web
@@ -505,6 +505,11 @@ See the [Accessibility and text scaling guide](https://uds.build/docs/mobile/acc
505
505
  default cap table, per-component overrides, custom-component hooks, known limits, and device test
506
506
  matrix.
507
507
 
508
+ When upgrading from manual scaling workarounds, remove app-level geometry multiplication only after
509
+ comparing the screen with UDS defaults; applying both can make controls oversized. App-owned
510
+ composite controls should use `useFontScale(cap, baseSize)`. As a temporary rollback,
511
+ `fontScaling={{ enabled: false }}` restores unrestricted native scaling.
512
+
508
513
  ## Fonts
509
514
 
510
515
  ### Font Handling
@@ -56,16 +56,28 @@ const Select = (0, react.memo)(function Select({ label, helpText, helperTextIcon
56
56
  }
57
57
  });
58
58
  const registerItem = (0, react.useCallback)((itemValue, itemLabel) => {
59
- if (itemsRef.current.get(itemValue) === itemLabel) return;
60
- itemsRef.current.set(itemValue, itemLabel);
59
+ const existing = itemsRef.current.get(itemValue);
60
+ itemsRef.current.set(itemValue, {
61
+ label: itemLabel,
62
+ registrations: (existing?.registrations ?? 0) + 1
63
+ });
64
+ if (existing?.label === itemLabel) return;
61
65
  setItemsVersion((version) => version + 1);
62
66
  }, []);
63
67
  const unregisterItem = (0, react.useCallback)((itemValue) => {
64
- if (!itemsRef.current.has(itemValue)) return;
68
+ const existing = itemsRef.current.get(itemValue);
69
+ if (!existing) return;
70
+ if (existing.registrations > 1) {
71
+ itemsRef.current.set(itemValue, {
72
+ ...existing,
73
+ registrations: existing.registrations - 1
74
+ });
75
+ return;
76
+ }
65
77
  itemsRef.current.delete(itemValue);
66
78
  setItemsVersion((version) => version + 1);
67
79
  }, []);
68
- const getItemLabel = (0, react.useCallback)((itemValue) => itemsRef.current.get(itemValue), []);
80
+ const getItemLabel = (0, react.useCallback)((itemValue) => itemsRef.current.get(itemValue)?.label, []);
69
81
  const fieldContext = (0, react.useMemo)(() => ({
70
82
  size,
71
83
  disabled,
@@ -54,16 +54,28 @@ const Select = memo(function Select({ label, helpText, helperTextIcon, placehold
54
54
  }
55
55
  });
56
56
  const registerItem = useCallback((itemValue, itemLabel) => {
57
- if (itemsRef.current.get(itemValue) === itemLabel) return;
58
- itemsRef.current.set(itemValue, itemLabel);
57
+ const existing = itemsRef.current.get(itemValue);
58
+ itemsRef.current.set(itemValue, {
59
+ label: itemLabel,
60
+ registrations: (existing?.registrations ?? 0) + 1
61
+ });
62
+ if (existing?.label === itemLabel) return;
59
63
  setItemsVersion((version) => version + 1);
60
64
  }, []);
61
65
  const unregisterItem = useCallback((itemValue) => {
62
- if (!itemsRef.current.has(itemValue)) return;
66
+ const existing = itemsRef.current.get(itemValue);
67
+ if (!existing) return;
68
+ if (existing.registrations > 1) {
69
+ itemsRef.current.set(itemValue, {
70
+ ...existing,
71
+ registrations: existing.registrations - 1
72
+ });
73
+ return;
74
+ }
63
75
  itemsRef.current.delete(itemValue);
64
76
  setItemsVersion((version) => version + 1);
65
77
  }, []);
66
- const getItemLabel = useCallback((itemValue) => itemsRef.current.get(itemValue), []);
78
+ const getItemLabel = useCallback((itemValue) => itemsRef.current.get(itemValue)?.label, []);
67
79
  const fieldContext = useMemo(() => ({
68
80
  size,
69
81
  disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { UniversalSelectProps } from '@yahoo/uds-types';\nimport { isFunction } from 'lodash-es';\nimport type { ReactNode } from 'react';\nimport { memo, useCallback, useId, useMemo, useRef, useState } from 'react';\nimport type { View } from 'react-native';\n\nimport { inputStyles } from '../../../generated/styles';\nimport { useMaxFontSizeMultiplier } from '../../fontScaling/useMaxFontSizeMultiplier';\nimport { HStack } from '../HStack';\nimport type { IconSlotType } from '../IconSlot';\nimport { InputHelpText } from '../InputHelpText';\nimport { useControllableState } from '../internal/Overlay';\nimport { Text } from '../Text';\nimport { VStack } from '../VStack';\nimport { SelectContext, SelectFieldContext } from './selectContext';\nimport { SelectTrigger } from './SelectTrigger';\nimport type { SelectContextValue, SelectFieldContextValue } from './types';\n\ninterface SelectProps extends Omit<UniversalSelectProps<IconSlotType>, 'width'> {\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /** Selected value for controlled usage. */\n value?: string;\n /** Initial value for uncontrolled usage. @default '' */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (value: string) => void;\n /** Container width. @default '100%' */\n width?: number | `${number}%` | '100%';\n /** Caps text, icons, and field geometry at the control scale. Set null to remove the cap. @default 2 */\n maxFontSizeMultiplier?: number | null;\n children?: ReactNode;\n testID?: string;\n}\n\n/**\n * **⚙️ A composable Select component**\n *\n * @description\n * Select lets users pick one value from a list. Compose with `SelectContent` and\n * `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Select, SelectContent, SelectItem } from '@yahoo/uds-mobile/Select';\n *\n * <Select label=\"Country\" placeholder=\"Select a country\" defaultValue=\"us\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"ca\">Canada</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nconst Select = memo(function Select({\n label,\n helpText,\n helperTextIcon,\n placeholder,\n size = 'md',\n disabled,\n required,\n hasError,\n readOnly,\n width = '100%',\n maxFontSizeMultiplier,\n reduceMotion = false,\n startIcon,\n endIcon,\n value: valueProp,\n defaultValue = '',\n onChange,\n children,\n testID,\n}: SelectProps) {\n const generatedId = useId();\n const uid = `uds-select-${generatedId}`;\n const resolvedMaxFontSizeMultiplier =\n useMaxFontSizeMultiplier('control', maxFontSizeMultiplier) ?? 0;\n const triggerRef = useRef<View | null>(null);\n const [triggerRect, setTriggerRect] = useState<SelectContextValue['triggerRect']>(null);\n const [highlightedValue, setHighlightedValue] = useState<string | null>(null);\n const itemsRef = useRef(new Map<string, string>());\n const [, setItemsVersion] = useState(0);\n\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue,\n onChange,\n });\n\n const [open, setOpen] = useControllableState({\n defaultValue: false,\n onChange: (nextOpen) => {\n if (!nextOpen) {\n setHighlightedValue(null);\n }\n },\n });\n\n const registerItem = useCallback((itemValue: string, itemLabel: string) => {\n if (itemsRef.current.get(itemValue) === itemLabel) {\n return;\n }\n\n itemsRef.current.set(itemValue, itemLabel);\n setItemsVersion((version) => version + 1);\n }, []);\n\n const unregisterItem = useCallback((itemValue: string) => {\n if (!itemsRef.current.has(itemValue)) {\n return;\n }\n\n itemsRef.current.delete(itemValue);\n setItemsVersion((version) => version + 1);\n }, []);\n\n const getItemLabel = useCallback((itemValue: string) => itemsRef.current.get(itemValue), []);\n\n const fieldContext = useMemo<SelectFieldContextValue>(\n () => ({\n size,\n disabled,\n readOnly,\n required,\n hasError,\n width,\n reduceMotion,\n placeholder,\n uid,\n maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,\n }),\n [\n disabled,\n hasError,\n placeholder,\n readOnly,\n reduceMotion,\n required,\n resolvedMaxFontSizeMultiplier,\n size,\n uid,\n width,\n ],\n );\n\n const contextValue = useMemo<SelectContextValue>(\n () => ({\n value,\n setValue,\n open,\n setOpen,\n triggerRef,\n triggerRect,\n setTriggerRect,\n registerItem,\n unregisterItem,\n getItemLabel,\n highlightedValue,\n setHighlightedValue,\n field: fieldContext,\n reduceMotion,\n }),\n [\n fieldContext,\n getItemLabel,\n highlightedValue,\n open,\n reduceMotion,\n registerItem,\n setOpen,\n setValue,\n triggerRect,\n unregisterItem,\n value,\n ],\n );\n\n const hasValue = value.length > 0;\n const valueState = hasValue ? 'filled' : 'empty';\n\n inputStyles.useVariants({\n size,\n value: valueState,\n pressed: open,\n readonly: readOnly,\n invalid: hasError,\n });\n\n const rootStyle = useMemo(() => [{ width, opacity: disabled ? 0.5 : 1 }], [disabled, width]);\n\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content = isFunction(label) ? label() : label;\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-end\" spacingBottom=\"2\">\n <Text maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier} style={inputStyles.label}>\n {content}\n </Text>\n {required && (\n <Text\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={inputStyles.labelRequired}\n >\n *\n </Text>\n )}\n </HStack>\n );\n }, [\n label,\n required,\n resolvedMaxFontSizeMultiplier,\n inputStyles.label,\n inputStyles.labelRequired,\n ]);\n\n const helpTextContent = useMemo(() => {\n if (!helpText) {\n return null;\n }\n\n const content = isFunction(helpText) ? helpText() : helpText;\n return (\n <InputHelpText\n startIcon={helperTextIcon}\n size={size}\n isFilled={valueState === 'filled'}\n disabled={disabled}\n readOnly={readOnly}\n hasError={hasError}\n pressed={open}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n >\n {content}\n </InputHelpText>\n );\n }, [\n disabled,\n hasError,\n helpText,\n helperTextIcon,\n open,\n readOnly,\n resolvedMaxFontSizeMultiplier,\n size,\n valueState,\n ]);\n\n return (\n <SelectContext.Provider value={contextValue}>\n <SelectFieldContext.Provider value={fieldContext}>\n <VStack testID={testID} style={rootStyle}>\n {labelContent}\n\n <SelectTrigger startIcon={startIcon} endIcon={endIcon} />\n\n {helpTextContent}\n\n {children}\n </VStack>\n </SelectFieldContext.Provider>\n </SelectContext.Provider>\n );\n});\n\nSelect.displayName = 'Select';\n\nexport { Select, type SelectProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,OACA,UACA,gBACA,aACA,OAAO,MACP,UACA,UACA,UACA,UACA,QAAQ,QACR,uBACA,eAAe,OACf,WACA,SACA,OAAO,WACP,eAAe,IACf,UACA,UACA,UACc;CAEd,MAAM,MAAM,cADQ,OACiB;CACrC,MAAM,gCACJ,yBAAyB,WAAW,sBAAsB,IAAI;CAChE,MAAM,aAAa,OAAoB,KAAK;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAA4C,KAAK;CACvF,MAAM,CAAC,kBAAkB,uBAAuB,SAAwB,KAAK;CAC7E,MAAM,WAAW,uBAAO,IAAI,KAAqB,CAAC;CAClD,MAAM,GAAG,mBAAmB,SAAS,EAAE;CAEvC,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,OAAO;EACP;EACA;EACD,CAAC;CAEF,MAAM,CAAC,MAAM,WAAW,qBAAqB;EAC3C,cAAc;EACd,WAAW,aAAa;GACtB,IAAI,CAAC,UACH,oBAAoB,KAAK;;EAG9B,CAAC;CAEF,MAAM,eAAe,aAAa,WAAmB,cAAsB;EACzE,IAAI,SAAS,QAAQ,IAAI,UAAU,KAAK,WACtC;EAGF,SAAS,QAAQ,IAAI,WAAW,UAAU;EAC1C,iBAAiB,YAAY,UAAU,EAAE;IACxC,EAAE,CAAC;CAEN,MAAM,iBAAiB,aAAa,cAAsB;EACxD,IAAI,CAAC,SAAS,QAAQ,IAAI,UAAU,EAClC;EAGF,SAAS,QAAQ,OAAO,UAAU;EAClC,iBAAiB,YAAY,UAAU,EAAE;IACxC,EAAE,CAAC;CAEN,M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ACA;EACA;EACA;EACA;EACD,CAAC;CAEF,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAAC,mBAAmB,UAApB;GAA6B,OAAO;aAClC,qBAAC,QAAD;IAAgB;IAAQ,OAAO;cAA/B;KACG;KAED,oBAAC,eAAD;MAA0B;MAAoB;MAAW,CAAA;KAExD;KAEA;KACM;;GACmB,CAAA;EACP,CAAA;EAE3B;AAEF,OAAO,cAAc"}
1
+ {"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { UniversalSelectProps } from '@yahoo/uds-types';\nimport { isFunction } from 'lodash-es';\nimport type { ReactNode } from 'react';\nimport { memo, useCallback, useId, useMemo, useRef, useState } from 'react';\nimport type { View } from 'react-native';\n\nimport { inputStyles } from '../../../generated/styles';\nimport { useMaxFontSizeMultiplier } from '../../fontScaling/useMaxFontSizeMultiplier';\nimport { HStack } from '../HStack';\nimport type { IconSlotType } from '../IconSlot';\nimport { InputHelpText } from '../InputHelpText';\nimport { useControllableState } from '../internal/Overlay';\nimport { Text } from '../Text';\nimport { VStack } from '../VStack';\nimport { SelectContext, SelectFieldContext } from './selectContext';\nimport { SelectTrigger } from './SelectTrigger';\nimport type { SelectContextValue, SelectFieldContextValue } from './types';\n\ninterface SelectProps extends Omit<UniversalSelectProps<IconSlotType>, 'width'> {\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /** Selected value for controlled usage. */\n value?: string;\n /** Initial value for uncontrolled usage. @default '' */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (value: string) => void;\n /** Container width. @default '100%' */\n width?: number | `${number}%` | '100%';\n /** Caps text, icons, and field geometry at the control scale. Set null to remove the cap. @default 2 */\n maxFontSizeMultiplier?: number | null;\n children?: ReactNode;\n testID?: string;\n}\n\n/**\n * **⚙️ A composable Select component**\n *\n * @description\n * Select lets users pick one value from a list. Compose with `SelectContent` and\n * `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Select, SelectContent, SelectItem } from '@yahoo/uds-mobile/Select';\n *\n * <Select label=\"Country\" placeholder=\"Select a country\" defaultValue=\"us\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"ca\">Canada</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nconst Select = memo(function Select({\n label,\n helpText,\n helperTextIcon,\n placeholder,\n size = 'md',\n disabled,\n required,\n hasError,\n readOnly,\n width = '100%',\n maxFontSizeMultiplier,\n reduceMotion = false,\n startIcon,\n endIcon,\n value: valueProp,\n defaultValue = '',\n onChange,\n children,\n testID,\n}: SelectProps) {\n const generatedId = useId();\n const uid = `uds-select-${generatedId}`;\n const resolvedMaxFontSizeMultiplier =\n useMaxFontSizeMultiplier('control', maxFontSizeMultiplier) ?? 0;\n const triggerRef = useRef<View | null>(null);\n const [triggerRect, setTriggerRect] = useState<SelectContextValue['triggerRect']>(null);\n const [highlightedValue, setHighlightedValue] = useState<string | null>(null);\n // Android's portal can briefly overlap the hidden registry item and its visible copy.\n // Count registrations so one copy unmounting does not erase the selected value's label.\n const itemsRef = useRef(new Map<string, { label: string; registrations: number }>());\n const [, setItemsVersion] = useState(0);\n\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue,\n onChange,\n });\n\n const [open, setOpen] = useControllableState({\n defaultValue: false,\n onChange: (nextOpen) => {\n if (!nextOpen) {\n setHighlightedValue(null);\n }\n },\n });\n\n const registerItem = useCallback((itemValue: string, itemLabel: string) => {\n const existing = itemsRef.current.get(itemValue);\n itemsRef.current.set(itemValue, {\n label: itemLabel,\n registrations: (existing?.registrations ?? 0) + 1,\n });\n\n if (existing?.label === itemLabel) {\n return;\n }\n\n setItemsVersion((version) => version + 1);\n }, []);\n\n const unregisterItem = useCallback((itemValue: string) => {\n const existing = itemsRef.current.get(itemValue);\n if (!existing) {\n return;\n }\n\n if (existing.registrations > 1) {\n itemsRef.current.set(itemValue, {\n ...existing,\n registrations: existing.registrations - 1,\n });\n return;\n }\n\n itemsRef.current.delete(itemValue);\n setItemsVersion((version) => version + 1);\n }, []);\n\n const getItemLabel = useCallback(\n (itemValue: string) => itemsRef.current.get(itemValue)?.label,\n [],\n );\n\n const fieldContext = useMemo<SelectFieldContextValue>(\n () => ({\n size,\n disabled,\n readOnly,\n required,\n hasError,\n width,\n reduceMotion,\n placeholder,\n uid,\n maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,\n }),\n [\n disabled,\n hasError,\n placeholder,\n readOnly,\n reduceMotion,\n required,\n resolvedMaxFontSizeMultiplier,\n size,\n uid,\n width,\n ],\n );\n\n const contextValue = useMemo<SelectContextValue>(\n () => ({\n value,\n setValue,\n open,\n setOpen,\n triggerRef,\n triggerRect,\n setTriggerRect,\n registerItem,\n unregisterItem,\n getItemLabel,\n highlightedValue,\n setHighlightedValue,\n field: fieldContext,\n reduceMotion,\n }),\n [\n fieldContext,\n getItemLabel,\n highlightedValue,\n open,\n reduceMotion,\n registerItem,\n setOpen,\n setValue,\n triggerRect,\n unregisterItem,\n value,\n ],\n );\n\n const hasValue = value.length > 0;\n const valueState = hasValue ? 'filled' : 'empty';\n\n inputStyles.useVariants({\n size,\n value: valueState,\n pressed: open,\n readonly: readOnly,\n invalid: hasError,\n });\n\n const rootStyle = useMemo(() => [{ width, opacity: disabled ? 0.5 : 1 }], [disabled, width]);\n\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content = isFunction(label) ? label() : label;\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-end\" spacingBottom=\"2\">\n <Text maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier} style={inputStyles.label}>\n {content}\n </Text>\n {required && (\n <Text\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={inputStyles.labelRequired}\n >\n *\n </Text>\n )}\n </HStack>\n );\n }, [\n label,\n required,\n resolvedMaxFontSizeMultiplier,\n inputStyles.label,\n inputStyles.labelRequired,\n ]);\n\n const helpTextContent = useMemo(() => {\n if (!helpText) {\n return null;\n }\n\n const content = isFunction(helpText) ? helpText() : helpText;\n return (\n <InputHelpText\n startIcon={helperTextIcon}\n size={size}\n isFilled={valueState === 'filled'}\n disabled={disabled}\n readOnly={readOnly}\n hasError={hasError}\n pressed={open}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n >\n {content}\n </InputHelpText>\n );\n }, [\n disabled,\n hasError,\n helpText,\n helperTextIcon,\n open,\n readOnly,\n resolvedMaxFontSizeMultiplier,\n size,\n valueState,\n ]);\n\n return (\n <SelectContext.Provider value={contextValue}>\n <SelectFieldContext.Provider value={fieldContext}>\n <VStack testID={testID} style={rootStyle}>\n {labelContent}\n\n <SelectTrigger startIcon={startIcon} endIcon={endIcon} />\n\n {helpTextContent}\n\n {children}\n </VStack>\n </SelectFieldContext.Provider>\n </SelectContext.Provider>\n );\n});\n\nSelect.displayName = 'Select';\n\nexport { Select, type SelectProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,OACA,UACA,gBACA,aACA,OAAO,MACP,UACA,UACA,UACA,UACA,QAAQ,QACR,uBACA,eAAe,OACf,WACA,SACA,OAAO,WACP,eAAe,IACf,UACA,UACA,UACc;CAEd,MAAM,MAAM,cADQ,OACiB;CACrC,MAAM,gCACJ,yBAAyB,WAAW,sBAAsB,IAAI;CAChE,MAAM,aAAa,OAAoB,KAAK;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAA4C,KAAK;CACvF,MAAM,CAAC,kBAAkB,uBAAuB,SAAwB,KAAK;CAG7E,MAAM,WAAW,uBAAO,IAAI,KAAuD,CAAC;CACpF,MAAM,GAAG,mBAAmB,SAAS,EAAE;CAEvC,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,OAAO;EACP;EACA;EACD,CAAC;CAEF,MAAM,CAAC,MAAM,WAAW,qBAA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E,CAAC,UAAU,MAAM,CAAC;CAE5F,MAAM,eAAe,cAAc;EACjC,IAAI,CAAC,OACH,OAAO;EAGT,MAAM,UAAU,WAAW,MAAM,GAAG,OAAO,GAAG;EAC9C,OACE,qBAAC,QAAD;GAAQ,WAAU;GAAI,YAAW;GAAW,eAAc;aAA1D,CACE,oBAAC,MAAD;IAAM,uBAAuB;IAA+B,OAAO,YAAY;cAC5E;IACI,CAAA,EACN,YACC,oBAAC,MAAD;IACE,uBAAuB;IACvB,OAAO,YAAY;cACpB;IAEM,CAAA,CAEF;;IAEV;EACD;EACA;EACA;EACA,YAAY;EACZ,YAAY;EACb,CAAC;CAEF,MAAM,kBAAkB,cAAc;EACpC,IAAI,CAAC,UACH,OAAO;EAGT,MAAM,UAAU,WAAW,SAAS,GAAG,UAAU,GAAG;EACpD,OACE,oBAAC,eAAD;GACE,WAAW;GACL;GACN,UAAU,eAAe;GACf;GACA;GACA;GACV,SAAS;GACT,uBAAuB;aAEtB;GACa,CAAA;IAEjB;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAAC,mBAAmB,UAApB;GAA6B,OAAO;aAClC,qBAAC,QAAD;IAAgB;IAAQ,OAAO;cAA/B;KACG;KAED,oBAAC,eAAD;MAA0B;MAAoB;MAAW,CAAA;KAExD;KAEA;KACM;;GACmB,CAAA;EACP,CAAA;EAE3B;AAEF,OAAO,cAAc"}
@@ -31,7 +31,9 @@ const OFFSCREEN_REGISTRY_STYLE = react_native.StyleSheet.create({ registry: {
31
31
  * Floating listbox container for {@link SelectItem} options.
32
32
  */
33
33
  const SelectContent = (0, react.memo)(function SelectContent({ children, size: _size = "default", variant: _variant = "default", keepOpenOnInteractOutside = false, maxHeight = DEFAULT_MAX_HEIGHT, gutter = DEFAULT_OFFSET, sameWidth = true, style, testID }) {
34
- const { open, setOpen, triggerRect, reduceMotion } = require_components_Select_selectContext.useSelectContext();
34
+ const selectContext = require_components_Select_selectContext.useSelectContext();
35
+ const fieldContext = require_components_Select_selectContext.useSelectFieldContext();
36
+ const { open, setOpen, triggerRect, reduceMotion } = selectContext;
35
37
  const [contentSize, setContentSize] = (0, react.useState)({
36
38
  width: 0,
37
39
  height: 0
@@ -115,28 +117,34 @@ const SelectContent = (0, react.memo)(function SelectContent({ children, size: _
115
117
  open,
116
118
  dismissible: !keepOpenOnInteractOutside,
117
119
  onDismiss: dismiss,
118
- children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
119
- testID,
120
- style: [
121
- contentStyle,
122
- animatedStyle,
123
- {
124
- overflow: "visible",
125
- zIndex: 1e3
126
- }
127
- ],
128
- onLayout: handleLayout,
129
- accessibilityRole: "menu",
130
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
131
- style: panelStyle,
132
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
133
- keyboardShouldPersistTaps: "handled",
134
- nestedScrollEnabled: true,
135
- style: { maxHeight },
136
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_VStack.VStack, {
137
- alignItems: "stretch",
138
- justifyContent: "flex-start",
139
- children
120
+ children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Select_selectContext.SelectContext.Provider, {
121
+ value: selectContext,
122
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Select_selectContext.SelectFieldContext.Provider, {
123
+ value: fieldContext,
124
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
125
+ testID,
126
+ style: [
127
+ contentStyle,
128
+ animatedStyle,
129
+ {
130
+ overflow: "visible",
131
+ zIndex: 1e3
132
+ }
133
+ ],
134
+ onLayout: handleLayout,
135
+ accessibilityRole: "menu",
136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
137
+ style: panelStyle,
138
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
139
+ keyboardShouldPersistTaps: "handled",
140
+ nestedScrollEnabled: true,
141
+ style: { maxHeight },
142
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_VStack.VStack, {
143
+ alignItems: "stretch",
144
+ justifyContent: "flex-start",
145
+ children
146
+ })
147
+ })
140
148
  })
141
149
  })
142
150
  })
@@ -1 +1 @@
1
- {"version":3,"file":"SelectContent.d.cts","names":[],"sources":["../../../src/components/Select/SelectContent.tsx"],"mappings":";;;;;;;UAmCU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,IAAA,GAAO,iBAAA;EACP,OAAA,GAAU,oBAAA;EAHgB;EAK1B,yBAAA;EAJW;EAMX,SAAA;EAJU;EAMV,MAAA;EAGQ;EADR,SAAA;EACA,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
1
+ {"version":3,"file":"SelectContent.d.cts","names":[],"sources":["../../../src/components/Select/SelectContent.tsx"],"mappings":";;;;;;;UAwCU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,IAAA,GAAO,iBAAA;EACP,OAAA,GAAU,oBAAA;EAHgB;EAK1B,yBAAA;EAJW;EAMX,SAAA;EAJU;EAMV,MAAA;EAGQ;EADR,SAAA;EACA,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectContent.d.ts","names":[],"sources":["../../../src/components/Select/SelectContent.tsx"],"mappings":";;;;;;;UAmCU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,IAAA,GAAO,iBAAA;EACP,OAAA,GAAU,oBAAA;EAHgB;EAK1B,yBAAA;EAJW;EAMX,SAAA;EAJU;EAMV,MAAA;EAGQ;EADR,SAAA;EACA,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
1
+ {"version":3,"file":"SelectContent.d.ts","names":[],"sources":["../../../src/components/Select/SelectContent.tsx"],"mappings":";;;;;;;UAwCU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,IAAA,GAAO,iBAAA;EACP,OAAA,GAAU,oBAAA;EAHgB;EAK1B,yBAAA;EAJW;EAMX,SAAA;EAJU;EAMV,MAAA;EAGQ;EADR,SAAA;EACA,KAAA,GAAQ,SAAA,CAAU,SAAA;EAClB,MAAA;AAAA;;;;;;cAQI,aAAA,EAAa,OAAA,CAAA,oBAAA,CAAA,kBAAA"}
@@ -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 { open, setOpen, triggerRect, reduceMotion } = useSelectContext();
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(Animated.View, {
116
- testID,
117
- style: [
118
- contentStyle,
119
- animatedStyle,
120
- {
121
- overflow: "visible",
122
- zIndex: 1e3
123
- }
124
- ],
125
- onLayout: handleLayout,
126
- accessibilityRole: "menu",
127
- children: /* @__PURE__ */ jsx(View, {
128
- style: panelStyle,
129
- children: /* @__PURE__ */ jsx(ScrollView, {
130
- keyboardShouldPersistTaps: "handled",
131
- nestedScrollEnabled: true,
132
- style: { maxHeight },
133
- children: /* @__PURE__ */ jsx(VStack, {
134
- alignItems: "stretch",
135
- justifyContent: "flex-start",
136
- children
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 { useSelectContext } 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 { open, setOpen, triggerRect, reduceMotion } = useSelectContext();\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 <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 )}\n </PopoverPortalLayer>\n ) : null}\n </>\n );\n});\n\nSelectContent.displayName = 'SelectContent';\n\nexport { SelectContent, type SelectContentProps };\n"],"mappings":";;;;;;;;;;;AAkBA,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;CACR,SAAS;CACT,UAAU;CACV,QAAQ;CACT,EACF,CAAC;;;;;;AAuBF,MAAM,gBAAgB,KAAK,SAAS,cAAc,EAChD,UACA,MAAM,QAAQ,WACd,SAAS,WAAW,WACpB,4BAA4B,OAC5B,YAAY,oBACZ,SAAS,gBACT,YAAY,MACZ,OACA,UACqB;CACrB,MAAM,EAAE,MAAM,SAAS,aAAa,iBAAiB,kBAAkB;CACvE,MAAM,CAAC,aAAa,kBAAkB,SAAS;EAAE,OAAO;EAAG,QAAQ;EAAG,CAAC;CACvE,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,MAAM,UAAU,kBAAkB;EAChC,IAAI,2BACF;EAGF,QAAQ,MAAM;IACb,CAAC,2BAA2B,QAAQ,CAAC;CAExC,MAAM,EACJ,cACA,aACA,UAAU,uBACR,oBAAoB;EACtB;EACA;EACA,WAAW;EACX,QAAQ;EACR;EACA,OAAO,YAAY,YAAY;EAC/B,iBAAiB;EACjB,kBAAkB;EACnB,CAAC;CAEF,MAAM,mBAAmB,QAAQ,eAAe,YAA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,oBAAC,SAAS,MAAV;GACU;GACR,OAAO;IAAC;IAAc;IAAe;KAAE,UAAU;KAAW,QAAQ;KAAM;IAAC;GAC3E,UAAU;GACV,mBAAkB;aAElB,oBAAC,MAAD;IAAM,OAAO;cACX,oBAACA,YAAD;KACE,2BAA0B;KAC1B,qBAAA;KACA,OAAO,EAAE,WAAW;eAEpB,oBAAC,QAAD;MAAQ,YAAW;MAAU,gBAAe;MACzC;MACM,CAAA;KACI,CAAA;IACV,CAAA;GACO,CAAA;EAEC,CAAA,GACnB,KACH,EAAA,CAAA;EAEL;AAEF,cAAc,cAAc"}
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;CAC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}
@@ -60,9 +60,10 @@ const TYPE_SCALE_CURVE = {
60
60
  */
61
61
  const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = Object.freeze(Object.fromEntries(Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [variant, cap === null ? 2 : Math.min(cap, 2)])));
62
62
  /**
63
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
64
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
65
- * supported ceiling rather than a looser per-variant cap.
63
+ * Default cap for control-internal text, icons, and geometry (Button,
64
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
65
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
66
+ * rather than a looser per-variant cap.
66
67
  */
67
68
  const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
68
69
  /**
@@ -40,9 +40,10 @@ declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScaling
40
40
  */
41
41
  declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
42
42
  /**
43
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
44
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
45
- * supported ceiling rather than a looser per-variant cap.
43
+ * Default cap for control-internal text, icons, and geometry (Button,
44
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
45
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
46
+ * rather than a looser per-variant cap.
46
47
  */
47
48
  declare const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
48
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;cAexB,wCAAA;AAf2C;;;;;AAeH;;;AAfG,cAyB3C,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
1
+ {"version":3,"file":"constants.d.cts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;cAgBxB,wCAAA;;;;;AAAwC;;;;cAUxC,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
@@ -40,9 +40,10 @@ declare const TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScaling
40
40
  */
41
41
  declare const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>>;
42
42
  /**
43
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
44
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
45
- * supported ceiling rather than a looser per-variant cap.
43
+ * Default cap for control-internal text, icons, and geometry (Button,
44
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
45
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
46
+ * rather than a looser per-variant cap.
46
47
  */
47
48
  declare const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
48
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;cAexB,wCAAA;AAf2C;;;;;AAeH;;;AAfG,cAyB3C,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
1
+ {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/fontScaling/constants.ts"],"mappings":";;;;;;;;AAGmD;;;;;AAarB;;;;cAAxB,wBAAA;;;;;;;;;;;;;AAgB0E;;cAA1E,gBAAA,EAAkB,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;;cAgCvD,iCAAA,EAAmC,QAAA,CACvC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;;;;;;;cAgBxB,wCAAA;;;;;AAAwC;;;;cAUxC,0BAAA,EAA4B,QAAA,CAChC,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAA"}
@@ -59,9 +59,10 @@ const TYPE_SCALE_CURVE = {
59
59
  */
60
60
  const DEFAULT_MAX_FONT_SIZE_MULTIPLIERS = Object.freeze(Object.fromEntries(Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [variant, cap === null ? 2 : Math.min(cap, 2)])));
61
61
  /**
62
- * Default cap for control-internal text and icons (Button, Checkbox, Radio,
63
- * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the
64
- * supported ceiling rather than a looser per-variant cap.
62
+ * Default cap for control-internal text, icons, and geometry (Button,
63
+ * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and
64
+ * Icon). Controls have bounded layouts, so they get the supported ceiling
65
+ * rather than a looser per-variant cap.
65
66
  */
66
67
  const DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = 2;
67
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/fontScaling/constants.ts"],"sourcesContent":["import type { TextProps as RNTextProps } from 'react-native';\n\nimport type { TextVariant } from '../components/Text';\nimport type { FontScalingCapValue } from './types';\n\n/**\n * The largest OS font scale UDS components are designed to support.\n *\n * Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so\n * no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger\n * Text is claimable at \"at least 200% or the maximum font size for the\n * system\", so a 2x ceiling still qualifies. Note that iOS offers scales beyond\n * this (up to 3.571x): with this ceiling in place the top accessibility sizes\n * render alike, and an app that wants to follow the OS further can raise or\n * remove the caps via `UDSFontScalingProvider`.\n */\nconst MAX_SUPPORTED_FONT_SCALE = 2;\n\n/**\n * How far each text style would grow if only legibility mattered, following\n * the shape of Apple's Dynamic Type ramps: the larger a style starts, the less\n * it multiplies. At iOS's largest accessibility size the system grows body\n * (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers\n * are larger than largeTitle, so they taper hardest.\n *\n * Caps are chosen by the size a style starts at rather than by which family it\n * belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`\n * (20pt) matches `title4` (20pt). `null` means \"no cap from the curve\" — those\n * are reading sizes, where legibility argues for following the OS.\n *\n * The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.\n */\nconst TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>> = {\n display1: 1.5,\n display2: 1.6,\n display3: 1.75,\n title1: 1.8,\n title2: 2,\n title3: 2.2,\n title4: 2.4,\n headline1: 2.5,\n ui1: 2.2,\n ui2: 2.4,\n body1: null,\n label1: null,\n label2: null,\n label3: null,\n label4: null,\n caption1: null,\n caption2: null,\n legal1: null,\n ui3: null,\n ui4: null,\n ui5: null,\n ui6: null,\n};\n\n/**\n * Default per-variant caps on OS font scaling, applied by `Text` when no\n * explicit prop or provider config overrides them: the legibility curve in\n * {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<\n Partial<Record<TextVariant, FontScalingCapValue>>\n> = Object.freeze(\n Object.fromEntries(\n Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [\n variant,\n cap === null ? MAX_SUPPORTED_FONT_SCALE : Math.min(cap, MAX_SUPPORTED_FONT_SCALE),\n ]),\n ) as Partial<Record<TextVariant, FontScalingCapValue>>,\n);\n\n/**\n * Default cap for control-internal text and icons (Button, Checkbox, Radio,\n * Switch, Chip, Tabs, Icon). Controls have bounded layouts, so they get the\n * supported ceiling rather than a looser per-variant cap.\n */\nconst DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = MAX_SUPPORTED_FONT_SCALE;\n\n/**\n * iOS Dynamic Type curve used by each UDS typography tier. React Native uses\n * the selected system text style's curve while preserving the configured UDS\n * font size. Android ignores `dynamicTypeRamp` and continues to use its native\n * nonlinear font scaling.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_DYNAMIC_TYPE_RAMPS: Readonly<\n Partial<Record<TextVariant, NonNullable<RNTextProps['dynamicTypeRamp']>>>\n> = {\n display1: 'largeTitle',\n display2: 'largeTitle',\n display3: 'largeTitle',\n title1: 'title1',\n title2: 'title2',\n title3: 'title3',\n title4: 'title3',\n headline1: 'headline',\n body1: 'body',\n label1: 'callout',\n label2: 'subheadline',\n label3: 'footnote',\n label4: 'caption1',\n caption1: 'caption1',\n caption2: 'caption2',\n legal1: 'caption2',\n ui1: 'title3',\n ui2: 'title3',\n ui3: 'callout',\n ui4: 'subheadline',\n ui5: 'footnote',\n ui6: 'caption2',\n};\n\nexport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_DYNAMIC_TYPE_RAMPS,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n MAX_SUPPORTED_FONT_SCALE,\n TYPE_SCALE_CURVE,\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,2BAA2B;;;;;;;;;;;;;;;AAgBjC,MAAM,mBAAgF;CACpF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;;;;;;;;AASD,MAAM,oCAEF,OAAO,OACT,OAAO,YACL,OAAO,QAAQ,iBAAiB,CAAC,KAAK,CAAC,SAAS,SAAS,CACvD,SACA,QAAQ,OAAA,IAAkC,KAAK,IAAI,KAAA,EAA8B,CAClF,CAAC,CACH,CACF;;;;;;AAOD,MAAM,2CAAA;;;;;;;;;AAUN,MAAM,6BAEF;CACF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/fontScaling/constants.ts"],"sourcesContent":["import type { TextProps as RNTextProps } from 'react-native';\n\nimport type { TextVariant } from '../components/Text';\nimport type { FontScalingCapValue } from './types';\n\n/**\n * The largest OS font scale UDS components are designed to support.\n *\n * Yahoo's inclusive-design guidance is to solve for text scaling up to 2x, so\n * no default cap exceeds it. Apple's Accessibility Nutrition Label for Larger\n * Text is claimable at \"at least 200% or the maximum font size for the\n * system\", so a 2x ceiling still qualifies. Note that iOS offers scales beyond\n * this (up to 3.571x): with this ceiling in place the top accessibility sizes\n * render alike, and an app that wants to follow the OS further can raise or\n * remove the caps via `UDSFontScalingProvider`.\n */\nconst MAX_SUPPORTED_FONT_SCALE = 2;\n\n/**\n * How far each text style would grow if only legibility mattered, following\n * the shape of Apple's Dynamic Type ramps: the larger a style starts, the less\n * it multiplies. At iOS's largest accessibility size the system grows body\n * (17pt) by 3.12x but largeTitle (34pt) by only ~1.71x, and UDS display tiers\n * are larger than largeTitle, so they taper hardest.\n *\n * Caps are chosen by the size a style starts at rather than by which family it\n * belongs to, which is why `ui1` (24pt) matches `title3` (24pt) and `ui2`\n * (20pt) matches `title4` (20pt). `null` means \"no cap from the curve\" — those\n * are reading sizes, where legibility argues for following the OS.\n *\n * The exported defaults are this curve clamped to {@link MAX_SUPPORTED_FONT_SCALE}.\n */\nconst TYPE_SCALE_CURVE: Readonly<Partial<Record<TextVariant, FontScalingCapValue>>> = {\n display1: 1.5,\n display2: 1.6,\n display3: 1.75,\n title1: 1.8,\n title2: 2,\n title3: 2.2,\n title4: 2.4,\n headline1: 2.5,\n ui1: 2.2,\n ui2: 2.4,\n body1: null,\n label1: null,\n label2: null,\n label3: null,\n label4: null,\n caption1: null,\n caption2: null,\n legal1: null,\n ui3: null,\n ui4: null,\n ui5: null,\n ui6: null,\n};\n\n/**\n * Default per-variant caps on OS font scaling, applied by `Text` when no\n * explicit prop or provider config overrides them: the legibility curve in\n * {@link TYPE_SCALE_CURVE}, clamped to the 2x we support.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_MAX_FONT_SIZE_MULTIPLIERS: Readonly<\n Partial<Record<TextVariant, FontScalingCapValue>>\n> = Object.freeze(\n Object.fromEntries(\n Object.entries(TYPE_SCALE_CURVE).map(([variant, cap]) => [\n variant,\n cap === null ? MAX_SUPPORTED_FONT_SCALE : Math.min(cap, MAX_SUPPORTED_FONT_SCALE),\n ]),\n ) as Partial<Record<TextVariant, FontScalingCapValue>>,\n);\n\n/**\n * Default cap for control-internal text, icons, and geometry (Button,\n * Checkbox, Radio, Switch, Chip, Tabs, Input, Select, Avatar, Pagination, and\n * Icon). Controls have bounded layouts, so they get the supported ceiling\n * rather than a looser per-variant cap.\n */\nconst DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER = MAX_SUPPORTED_FONT_SCALE;\n\n/**\n * iOS Dynamic Type curve used by each UDS typography tier. React Native uses\n * the selected system text style's curve while preserving the configured UDS\n * font size. Android ignores `dynamicTypeRamp` and continues to use its native\n * nonlinear font scaling.\n *\n * Keys are base variants; `/emphasized` twins resolve to their base.\n */\nconst DEFAULT_DYNAMIC_TYPE_RAMPS: Readonly<\n Partial<Record<TextVariant, NonNullable<RNTextProps['dynamicTypeRamp']>>>\n> = {\n display1: 'largeTitle',\n display2: 'largeTitle',\n display3: 'largeTitle',\n title1: 'title1',\n title2: 'title2',\n title3: 'title3',\n title4: 'title3',\n headline1: 'headline',\n body1: 'body',\n label1: 'callout',\n label2: 'subheadline',\n label3: 'footnote',\n label4: 'caption1',\n caption1: 'caption1',\n caption2: 'caption2',\n legal1: 'caption2',\n ui1: 'title3',\n ui2: 'title3',\n ui3: 'callout',\n ui4: 'subheadline',\n ui5: 'footnote',\n ui6: 'caption2',\n};\n\nexport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_DYNAMIC_TYPE_RAMPS,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n MAX_SUPPORTED_FONT_SCALE,\n TYPE_SCALE_CURVE,\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,2BAA2B;;;;;;;;;;;;;;;AAgBjC,MAAM,mBAAgF;CACpF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN;;;;;;;;AASD,MAAM,oCAEF,OAAO,OACT,OAAO,YACL,OAAO,QAAQ,iBAAiB,CAAC,KAAK,CAAC,SAAS,SAAS,CACvD,SACA,QAAQ,OAAA,IAAkC,KAAK,IAAI,KAAA,EAA8B,CAClF,CAAC,CACH,CACF;;;;;;;AAQD,MAAM,2CAAA;;;;;;;;;AAUN,MAAM,6BAEF;CACF,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACN"}
@@ -36,8 +36,9 @@ interface FontScalingConfig {
36
36
  default?: FontScalingCapValue;
37
37
  /**
38
38
  * Cap for control-internal text, icons, and geometry in Button, Checkbox,
39
- * Radio, Switch, Chip, and Tabs, plus standalone `Icon` glyphs and
40
- * multicolor SVGs.
39
+ * Radio, Switch, Chip, Tabs, Input, Select, Avatar, and Pagination, plus
40
+ * standalone `Icon` glyphs and multicolor SVGs. Link resolves through its
41
+ * typography variant instead of the control cap.
41
42
  * @default 2
42
43
  */
43
44
  control?: FontScalingCapValue;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAmBmB;;;;;;EAZnB,OAAA,GAAU,mBAAA;;;;;;;EAOV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAoBmB;;;;;;EAbnB,OAAA,GAAU,mBAAA;;;;;;;;EAQV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
@@ -36,8 +36,9 @@ interface FontScalingConfig {
36
36
  default?: FontScalingCapValue;
37
37
  /**
38
38
  * Cap for control-internal text, icons, and geometry in Button, Checkbox,
39
- * Radio, Switch, Chip, and Tabs, plus standalone `Icon` glyphs and
40
- * multicolor SVGs.
39
+ * Radio, Switch, Chip, Tabs, Input, Select, Avatar, and Pagination, plus
40
+ * standalone `Icon` glyphs and multicolor SVGs. Link resolves through its
41
+ * typography variant instead of the control cap.
41
42
  * @default 2
42
43
  */
43
44
  control?: FontScalingCapValue;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAmBmB;;;;;;EAZnB,OAAA,GAAU,mBAAA;;;;;;;EAOV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAoBmB;;;;;;EAbnB,OAAA,GAAU,mBAAA;;;;;;;;EAQV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahoo/uds-mobile",
3
- "version": "2.24.0-beta.6",
3
+ "version": "2.24.0-beta.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "uds-mobile": "./cli/uds-mobile.js"