@yahoo/uds-mobile 1.3.0-beta.8 → 1.3.0
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/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +2 -2
- package/dist/bin/fixtures/dist/index.mjs +25 -1
- package/dist/bin/generateTheme.mjs +5 -5
- package/dist/bin/uds-mobile.mjs +10 -10
- package/dist/components/Avatar.cjs +13 -4
- package/dist/components/Avatar.d.cts +11 -3
- package/dist/components/Avatar.d.cts.map +1 -1
- package/dist/components/Avatar.d.mts +11 -3
- package/dist/components/Avatar.d.mts.map +1 -1
- package/dist/components/Avatar.mjs +11 -3
- package/dist/components/Avatar.mjs.map +1 -1
- package/dist/components/Badge.cjs +15 -4
- package/dist/components/Badge.d.cts +24 -6
- package/dist/components/Badge.d.cts.map +1 -1
- package/dist/components/Badge.d.mts +24 -6
- package/dist/components/Badge.d.mts.map +1 -1
- package/dist/components/Badge.mjs +13 -3
- package/dist/components/Badge.mjs.map +1 -1
- package/dist/components/Box.cjs +15 -11
- package/dist/components/Box.d.cts +15 -10
- package/dist/components/Box.d.cts.map +1 -1
- package/dist/components/Box.d.mts +15 -10
- package/dist/components/Box.d.mts.map +1 -1
- package/dist/components/Box.mjs +13 -10
- package/dist/components/Box.mjs.map +1 -1
- package/dist/components/Button.cjs +15 -5
- package/dist/components/Button.d.cts +21 -6
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.mts +21 -6
- package/dist/components/Button.d.mts.map +1 -1
- package/dist/components/Button.mjs +12 -3
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/Checkbox.cjs +16 -7
- package/dist/components/Checkbox.d.cts +14 -5
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.mts +14 -5
- package/dist/components/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox.mjs +13 -5
- package/dist/components/Checkbox.mjs.map +1 -1
- package/dist/components/Chip.cjs +21 -4
- package/dist/components/Chip.d.cts +28 -6
- package/dist/components/Chip.d.cts.map +1 -1
- package/dist/components/Chip.d.mts +28 -6
- package/dist/components/Chip.d.mts.map +1 -1
- package/dist/components/Chip.mjs +19 -3
- package/dist/components/Chip.mjs.map +1 -1
- package/dist/components/HStack.cjs +9 -6
- package/dist/components/HStack.d.cts +9 -5
- package/dist/components/HStack.d.cts.map +1 -1
- package/dist/components/HStack.d.mts +9 -5
- package/dist/components/HStack.d.mts.map +1 -1
- package/dist/components/HStack.mjs +7 -5
- package/dist/components/HStack.mjs.map +1 -1
- package/dist/components/Icon.cjs +17 -6
- package/dist/components/Icon.d.cts +14 -3
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.mts +14 -3
- package/dist/components/Icon.d.mts.map +1 -1
- package/dist/components/Icon.mjs +15 -5
- package/dist/components/Icon.mjs.map +1 -1
- package/dist/components/IconButton.cjs +24 -5
- package/dist/components/IconButton.d.cts +28 -8
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.mts +28 -8
- package/dist/components/IconButton.d.mts.map +1 -1
- package/dist/components/IconButton.mjs +22 -4
- package/dist/components/IconButton.mjs.map +1 -1
- package/dist/components/IconSlot.cjs +9 -3
- package/dist/components/IconSlot.d.cts +7 -2
- package/dist/components/IconSlot.d.cts.map +1 -1
- package/dist/components/IconSlot.d.mts +7 -2
- package/dist/components/IconSlot.d.mts.map +1 -1
- package/dist/components/IconSlot.mjs +7 -2
- package/dist/components/IconSlot.mjs.map +1 -1
- package/dist/components/Image.cjs +19 -4
- package/dist/components/Image.d.cts +18 -3
- package/dist/components/Image.d.cts.map +1 -1
- package/dist/components/Image.d.mts +18 -3
- package/dist/components/Image.d.mts.map +1 -1
- package/dist/components/Image.mjs +17 -3
- package/dist/components/Image.mjs.map +1 -1
- package/dist/components/Input.cjs +20 -7
- package/dist/components/Input.d.cts +19 -6
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.mts +19 -6
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs +18 -6
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Link.cjs +20 -5
- package/dist/components/Link.d.cts +21 -4
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.mts +21 -4
- package/dist/components/Link.d.mts.map +1 -1
- package/dist/components/Link.mjs +17 -3
- package/dist/components/Link.mjs.map +1 -1
- package/dist/components/Pressable.cjs +18 -6
- package/dist/components/Pressable.d.cts +18 -5
- package/dist/components/Pressable.d.cts.map +1 -1
- package/dist/components/Pressable.d.mts +18 -5
- package/dist/components/Pressable.d.mts.map +1 -1
- package/dist/components/Pressable.mjs +15 -4
- package/dist/components/Pressable.mjs.map +1 -1
- package/dist/components/Radio.cjs +16 -7
- package/dist/components/Radio.d.cts +14 -5
- package/dist/components/Radio.d.cts.map +1 -1
- package/dist/components/Radio.d.mts +14 -5
- package/dist/components/Radio.d.mts.map +1 -1
- package/dist/components/Radio.mjs +13 -5
- package/dist/components/Radio.mjs.map +1 -1
- package/dist/components/Screen.cjs +10 -4
- package/dist/components/Screen.d.cts +15 -3
- package/dist/components/Screen.d.cts.map +1 -1
- package/dist/components/Screen.d.mts +15 -3
- package/dist/components/Screen.d.mts.map +1 -1
- package/dist/components/Screen.mjs +8 -3
- package/dist/components/Screen.mjs.map +1 -1
- package/dist/components/Switch.cjs +21 -5
- package/dist/components/Switch.d.cts +18 -3
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.mts +18 -3
- package/dist/components/Switch.d.mts.map +1 -1
- package/dist/components/Switch.mjs +18 -3
- package/dist/components/Switch.mjs.map +1 -1
- package/dist/components/Text.cjs +17 -7
- package/dist/components/Text.d.cts +18 -6
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.mts +18 -6
- package/dist/components/Text.d.mts.map +1 -1
- package/dist/components/Text.mjs +15 -6
- package/dist/components/Text.mjs.map +1 -1
- package/dist/components/VStack.cjs +9 -6
- package/dist/components/VStack.d.cts +9 -5
- package/dist/components/VStack.d.cts.map +1 -1
- package/dist/components/VStack.d.mts +9 -5
- package/dist/components/VStack.d.mts.map +1 -1
- package/dist/components/VStack.mjs +7 -5
- package/dist/components/VStack.mjs.map +1 -1
- package/dist/icons/dist/glyphMap.cjs +2 -2
- package/dist/icons/dist/glyphMap.d.cts +0 -2
- package/dist/icons/dist/glyphMap.d.cts.map +1 -1
- package/dist/icons/dist/glyphMap.d.mts +0 -2
- package/dist/icons/dist/glyphMap.d.mts.map +1 -1
- package/dist/icons/dist/glyphMap.mjs +2 -2
- package/dist/icons/dist/glyphMap.mjs.map +1 -1
- package/dist/icons/dist/svgMap.cjs +2 -2
- package/dist/icons/dist/svgMap.d.cts +0 -2
- package/dist/icons/dist/svgMap.d.cts.map +1 -1
- package/dist/icons/dist/svgMap.d.mts +0 -2
- package/dist/icons/dist/svgMap.d.mts.map +1 -1
- package/dist/icons/dist/svgMap.mjs +2 -2
- package/dist/icons/dist/svgMap.mjs.map +1 -1
- package/dist/icons/dist/tokens.cjs +2 -2
- package/dist/icons/dist/tokens.mjs +2 -2
- package/dist/icons/dist/tokens.mjs.map +1 -1
- package/dist/motion-tokens/dist/index.cjs +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -3
- package/dist/motion-tokens/dist/index.d.cts.map +1 -1
- package/dist/motion-tokens/dist/index.d.mts +1 -3
- package/dist/motion-tokens/dist/index.d.mts.map +1 -1
- package/dist/motion-tokens/dist/index.mjs +1 -1
- package/dist/motion.cjs +2 -1
- package/dist/motion.d.cts +0 -1
- package/dist/motion.d.cts.map +1 -1
- package/dist/motion.d.mts +0 -1
- package/dist/motion.d.mts.map +1 -1
- package/dist/motion.mjs +1 -1
- package/dist/types/dist/index.d.cts +1 -3
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.mts +1 -3
- package/dist/types/dist/index.d.mts.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +0 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +1 -1
- package/fonts/index.cjs +205 -205
- package/fonts/index.mjs +205 -205
- package/generated/styles.cjs +119 -23
- package/generated/styles.d.ts +48 -1
- package/generated/styles.mjs +119 -23
- package/generated/unistyles.d.ts +97 -18
- package/package.json +1 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.cts","names":[],"sources":["../../src/components/Pressable.tsx"],"
|
|
1
|
+
{"version":3,"file":"Pressable.d.cts","names":[],"sources":["../../src/components/Pressable.tsx"],"mappings":";;;;;;;;;UAgBU,cAAA,SAAuB,gBAAA,EAAkB,SAAA;;EAEjD,GAAA,GAAM,GAAA,CAAI,IAAA;;EAEV,eAAA,GAAkB,UAAA;EAElB,YAAA,GAAe,UAAA;EACf,oBAAA,GAAuB,UAAA;EACvB,kBAAA,GAAqB,UAAA;EACrB,uBAAA,GAA0B,UAAA;EAC1B,qBAAA,GAAwB,UAAA;EACxB,WAAA,GAAc,UAAA;EACd,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EACpB,WAAA,GAAc,UAAA;EACd,mBAAA,GAAsB,UAAA;EACtB,qBAAA,GAAwB,UAAA;EACxB,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EAEpB,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EACb,SAAA,GAAY,UAAA;EACZ,IAAA,GAAO,UAAA;EACP,aAAA,GAAgB,UAAA;EAChB,QAAA,GAAW,UAAA;EACX,UAAA,GAAa,UAAA;EACb,QAAA,GAAW,UAAA;EACX,cAAA,GAAiB,UAAA;EAEjB,OAAA,GAAU,UAAA;EACV,QAAA,GAAW,UAAA;EAEX,OAAA,GAAU,UAAA;EACV,iBAAA,GAAoB,UAAA;EACpB,eAAA,GAAkB,UAAA;EAClB,aAAA,GAAgB,UAAA;EAChB,UAAA,GAAa,UAAA;EACb,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EAEb,MAAA,GAAS,UAAA;EACT,cAAA,GAAiB,UAAA;EACjB,gBAAA,GAAmB,UAAA;EACnB,YAAA,GAAe,UAAA;EACf,SAAA,GAAY,UAAA;EACZ,WAAA,GAAc,UAAA;EACd,SAAA,GAAY,UAAA;EAEZ,SAAA,GAAY,UAAA;EACZ,MAAA,GAAS,UAAA;EAET,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyCI,SAAA,EAAS,KAAA,CAAA,oBAAA,CAAA,cAAA;AAAA,cAoJT,iBAAA,EAAiB,KAAA,CAAA,iBAAA,CAAA,wBAAA,CAAA,aAAA,CAAA,cAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { SizeProps } from "../types.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { PressableProps as PressableProps$1, View } from "react-native";
|
|
6
6
|
import { StyleProps } from "../../generated/styles";
|
|
@@ -8,7 +8,9 @@ import * as react_native_reanimated0 from "react-native-reanimated";
|
|
|
8
8
|
|
|
9
9
|
//#region src/components/Pressable.d.ts
|
|
10
10
|
interface PressableProps extends PressableProps$1, SizeProps {
|
|
11
|
+
/** Ref to the underlying View */
|
|
11
12
|
ref?: Ref<View>;
|
|
13
|
+
/** Background color */
|
|
12
14
|
backgroundColor?: StyleProps['backgroundColor'];
|
|
13
15
|
borderRadius?: StyleProps['borderRadius'];
|
|
14
16
|
borderTopStartRadius?: StyleProps['borderTopStartRadius'];
|
|
@@ -61,7 +63,11 @@ interface PressableProps extends PressableProps$1, SizeProps {
|
|
|
61
63
|
*
|
|
62
64
|
* @description
|
|
63
65
|
* A styled pressable component that wraps React Native's Pressable with
|
|
64
|
-
* UDS styling support.
|
|
66
|
+
* UDS styling support. Use this as a building block for custom interactive
|
|
67
|
+
* components.
|
|
68
|
+
*
|
|
69
|
+
* @category Interactive
|
|
70
|
+
* @platform mobile
|
|
65
71
|
*
|
|
66
72
|
* @example
|
|
67
73
|
* ```tsx
|
|
@@ -79,12 +85,19 @@ interface PressableProps extends PressableProps$1, SizeProps {
|
|
|
79
85
|
*
|
|
80
86
|
* @usage
|
|
81
87
|
* - Use for interactive elements that need press feedback
|
|
88
|
+
* - Use for custom button-like components
|
|
82
89
|
* - Supports all Box styling props
|
|
83
90
|
*
|
|
84
|
-
* @
|
|
91
|
+
* @accessibility
|
|
92
|
+
* - Set `accessibilityRole` appropriate to the component's purpose
|
|
93
|
+
* - Provide `accessibilityLabel` for screen readers
|
|
94
|
+
* - Use `accessibilityState` to communicate state changes
|
|
95
|
+
*
|
|
96
|
+
* @see {@link Button} for standard button actions
|
|
97
|
+
* @see {@link Box} for non-interactive containers
|
|
85
98
|
*/
|
|
86
|
-
declare const Pressable:
|
|
87
|
-
declare const AnimatedPressable:
|
|
99
|
+
declare const Pressable: react.NamedExoticComponent<PressableProps>;
|
|
100
|
+
declare const AnimatedPressable: react.FunctionComponent<react_native_reanimated0.AnimatedProps<PressableProps>>;
|
|
88
101
|
//#endregion
|
|
89
102
|
export { AnimatedPressable, Pressable, type PressableProps };
|
|
90
103
|
//# sourceMappingURL=Pressable.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.mts","names":[],"sources":["../../src/components/Pressable.tsx"],"
|
|
1
|
+
{"version":3,"file":"Pressable.d.mts","names":[],"sources":["../../src/components/Pressable.tsx"],"mappings":";;;;;;;;;UAgBU,cAAA,SAAuB,gBAAA,EAAkB,SAAA;;EAEjD,GAAA,GAAM,GAAA,CAAI,IAAA;;EAEV,eAAA,GAAkB,UAAA;EAElB,YAAA,GAAe,UAAA;EACf,oBAAA,GAAuB,UAAA;EACvB,kBAAA,GAAqB,UAAA;EACrB,uBAAA,GAA0B,UAAA;EAC1B,qBAAA,GAAwB,UAAA;EACxB,WAAA,GAAc,UAAA;EACd,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EACpB,WAAA,GAAc,UAAA;EACd,mBAAA,GAAsB,UAAA;EACtB,qBAAA,GAAwB,UAAA;EACxB,gBAAA,GAAmB,UAAA;EACnB,cAAA,GAAiB,UAAA;EACjB,cAAA,GAAiB,UAAA;EACjB,iBAAA,GAAoB,UAAA;EAEpB,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EACb,SAAA,GAAY,UAAA;EACZ,IAAA,GAAO,UAAA;EACP,aAAA,GAAgB,UAAA;EAChB,QAAA,GAAW,UAAA;EACX,UAAA,GAAa,UAAA;EACb,QAAA,GAAW,UAAA;EACX,cAAA,GAAiB,UAAA;EAEjB,OAAA,GAAU,UAAA;EACV,QAAA,GAAW,UAAA;EAEX,OAAA,GAAU,UAAA;EACV,iBAAA,GAAoB,UAAA;EACpB,eAAA,GAAkB,UAAA;EAClB,aAAA,GAAgB,UAAA;EAChB,UAAA,GAAa,UAAA;EACb,YAAA,GAAe,UAAA;EACf,UAAA,GAAa,UAAA;EAEb,MAAA,GAAS,UAAA;EACT,cAAA,GAAiB,UAAA;EACjB,gBAAA,GAAmB,UAAA;EACnB,YAAA,GAAe,UAAA;EACf,SAAA,GAAY,UAAA;EACZ,WAAA,GAAc,UAAA;EACd,SAAA,GAAY,UAAA;EAEZ,SAAA,GAAY,UAAA;EACZ,MAAA,GAAS,UAAA;EAET,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyCI,SAAA,EAAS,KAAA,CAAA,oBAAA,CAAA,cAAA;AAAA,cAoJT,iBAAA,EAAiB,KAAA,CAAA,iBAAA,CAAA,wBAAA,CAAA,aAAA,CAAA,cAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { memo, useCallback } from "react";
|
|
3
3
|
import { Pressable as Pressable$1 } from "react-native";
|
|
4
4
|
import { styles } from "../../generated/styles";
|
|
@@ -11,7 +11,11 @@ import Animated from "react-native-reanimated";
|
|
|
11
11
|
*
|
|
12
12
|
* @description
|
|
13
13
|
* A styled pressable component that wraps React Native's Pressable with
|
|
14
|
-
* UDS styling support.
|
|
14
|
+
* UDS styling support. Use this as a building block for custom interactive
|
|
15
|
+
* components.
|
|
16
|
+
*
|
|
17
|
+
* @category Interactive
|
|
18
|
+
* @platform mobile
|
|
15
19
|
*
|
|
16
20
|
* @example
|
|
17
21
|
* ```tsx
|
|
@@ -29,11 +33,18 @@ import Animated from "react-native-reanimated";
|
|
|
29
33
|
*
|
|
30
34
|
* @usage
|
|
31
35
|
* - Use for interactive elements that need press feedback
|
|
36
|
+
* - Use for custom button-like components
|
|
32
37
|
* - Supports all Box styling props
|
|
33
38
|
*
|
|
34
|
-
* @
|
|
39
|
+
* @accessibility
|
|
40
|
+
* - Set `accessibilityRole` appropriate to the component's purpose
|
|
41
|
+
* - Provide `accessibilityLabel` for screen readers
|
|
42
|
+
* - Use `accessibilityState` to communicate state changes
|
|
43
|
+
*
|
|
44
|
+
* @see {@link Button} for standard button actions
|
|
45
|
+
* @see {@link Box} for non-interactive containers
|
|
35
46
|
*/
|
|
36
|
-
const Pressable = memo(function Pressable
|
|
47
|
+
const Pressable = memo(function Pressable({ backgroundColor, borderRadius, borderTopStartRadius, borderTopEndRadius, borderBottomStartRadius, borderBottomEndRadius, borderColor, borderStartColor, borderEndColor, borderTopColor, borderBottomColor, borderWidth, borderVerticalWidth, borderHorizontalWidth, borderStartWidth, borderEndWidth, borderTopWidth, borderBottomWidth, alignContent, alignItems, alignSelf, flex, flexDirection, flexGrow, flexShrink, flexWrap, justifyContent, display = "flex", overflow, spacing, spacingHorizontal, spacingVertical, spacingBottom, spacingEnd, spacingStart, spacingTop, offset, offsetVertical, offsetHorizontal, offsetBottom, offsetEnd, offsetStart, offsetTop, columnGap, rowGap, width, height, minWidth, maxWidth, minHeight, maxHeight, opacity, style, ref, ...props }) {
|
|
37
48
|
styles.useVariants({
|
|
38
49
|
backgroundColor,
|
|
39
50
|
borderRadius,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.mjs","names":["
|
|
1
|
+
{"version":3,"file":"Pressable.mjs","names":["RNPressable"],"sources":["../../src/components/Pressable.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useCallback } from 'react';\nimport type {\n PressableProps as RNPressableProps,\n PressableStateCallbackType,\n StyleProp,\n View,\n ViewStyle,\n} from 'react-native';\nimport { Pressable as RNPressable } from 'react-native';\nimport Animated from 'react-native-reanimated';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\n\ninterface PressableProps extends RNPressableProps, SizeProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Background color */\n backgroundColor?: StyleProps['backgroundColor'];\n // Border\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n // Flex\n alignContent?: StyleProps['alignContent'];\n alignItems?: StyleProps['alignItems'];\n alignSelf?: StyleProps['alignSelf'];\n flex?: StyleProps['flex'];\n flexDirection?: StyleProps['flexDirection'];\n flexGrow?: StyleProps['flexGrow'];\n flexShrink?: StyleProps['flexShrink'];\n flexWrap?: StyleProps['flexWrap'];\n justifyContent?: StyleProps['justifyContent'];\n // Layout\n display?: StyleProps['display'];\n overflow?: StyleProps['overflow'];\n // Spacing\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n // Offset\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n // Gap\n columnGap?: StyleProps['columnGap'];\n rowGap?: StyleProps['rowGap'];\n // Opacity\n opacity?: number;\n}\n\n/**\n * **👆 A pressable component with UDS styling**\n *\n * @description\n * A styled pressable component that wraps React Native's Pressable with\n * UDS styling support. Use this as a building block for custom interactive\n * components.\n *\n * @category Interactive\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Pressable } from '@yahoo/uds-mobile';\n *\n * <Pressable\n * backgroundColor=\"primary\"\n * spacing=\"4\"\n * borderRadius=\"md\"\n * onPress={() => console.log('Pressed!')}\n * >\n * <Text>Press me</Text>\n * </Pressable>\n * ```\n *\n * @usage\n * - Use for interactive elements that need press feedback\n * - Use for custom button-like components\n * - Supports all Box styling props\n *\n * @accessibility\n * - Set `accessibilityRole` appropriate to the component's purpose\n * - Provide `accessibilityLabel` for screen readers\n * - Use `accessibilityState` to communicate state changes\n *\n * @see {@link Button} for standard button actions\n * @see {@link Box} for non-interactive containers\n */\nconst Pressable = memo(function Pressable({\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display = 'flex',\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n // Size\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n // Opacity\n opacity,\n // Style - extracted to merge with variants\n style,\n ref,\n // Rest\n ...props\n}: PressableProps) {\n styles.useVariants({\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // Layout\n display,\n overflow,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Gap\n columnGap,\n rowGap,\n });\n\n // Merge variant styles with user-provided style prop\n // Handle the case where style can be a function (for press states)\n const pressableStyles = useCallback(\n (state: PressableStateCallbackType) => {\n const userStyle = typeof style === 'function' ? style(state) : style;\n return [\n width ? { width } : undefined,\n height ? { height } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n opacity ? { opacity } : undefined,\n styles.foundation as StyleProp<ViewStyle>,\n userStyle,\n ];\n },\n [width, height, minWidth, maxWidth, minHeight, maxHeight, opacity, style, styles.foundation],\n );\n\n return <RNPressable ref={ref} style={pressableStyles} {...props} />;\n});\n\nPressable.displayName = 'Pressable';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(Pressable);\n\nexport { AnimatedPressable, Pressable, type PressableProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,MAAM,YAAY,KAAK,SAAS,UAAU,EAExC,iBAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,cACA,YACA,WACA,MACA,eACA,UACA,YACA,UACA,gBAEA,UAAU,QACV,UAEA,SACA,mBACA,iBACA,eACA,YACA,cACA,YAEA,QACA,gBACA,kBACA,cACA,WACA,aACA,WAEA,WACA,QAEA,OACA,QACA,UACA,UACA,WACA,WAEA,SAEA,OACA,KAEA,GAAG,SACc;AACjB,QAAO,YAAY;EAEjB;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACD,CAAC;AAsBF,QAAO,oBAACA;EAAiB;EAAK,OAlBN,aACrB,UAAsC;GACrC,MAAM,YAAY,OAAO,UAAU,aAAa,MAAM,MAAM,GAAG;AAC/D,UAAO;IACL,QAAQ,EAAE,OAAO,GAAG;IACpB,SAAS,EAAE,QAAQ,GAAG;IACtB,WAAW,EAAE,UAAU,GAAG;IAC1B,WAAW,EAAE,UAAU,GAAG;IAC1B,YAAY,EAAE,WAAW,GAAG;IAC5B,YAAY,EAAE,WAAW,GAAG;IAC5B,UAAU,EAAE,SAAS,GAAG;IACxB,OAAO;IACP;IACD;KAEH;GAAC;GAAO;GAAQ;GAAU;GAAU;GAAW;GAAW;GAAS;GAAO,OAAO;GAAW,CAC7F;EAEqD,GAAI;GAAS;EACnE;AAEF,UAAU,cAAc;AAExB,MAAM,oBAAoB,SAAS,wBAAwB,UAAU"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
4
|
const require_index = require('../motion-tokens/dist/index.cjs');
|
|
4
5
|
const require_motion = require('../motion.cjs');
|
|
5
6
|
const require_components_Text = require('./Text.cjs');
|
|
@@ -9,7 +10,7 @@ let react = require("react");
|
|
|
9
10
|
let generated_styles = require("../../generated/styles");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
12
|
let react_native_reanimated = require("react-native-reanimated");
|
|
12
|
-
react_native_reanimated =
|
|
13
|
+
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
13
14
|
|
|
14
15
|
//#region src/components/Radio.tsx
|
|
15
16
|
const VARIANT_ERROR_MAP = {
|
|
@@ -19,13 +20,14 @@ const VARIANT_ERROR_MAP = {
|
|
|
19
20
|
/**
|
|
20
21
|
* **⚙️ A radio component**
|
|
21
22
|
*
|
|
22
|
-
* @componentType Client component
|
|
23
|
-
*
|
|
24
23
|
* @description
|
|
25
24
|
* A radio component allows users to select one option from a set.
|
|
26
25
|
* Unlike checkbox, radio buttons cannot have multiple selected in a group,
|
|
27
26
|
* allowing only one selection at a time.
|
|
28
27
|
*
|
|
28
|
+
* @category Form
|
|
29
|
+
* @platform mobile
|
|
30
|
+
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```tsx
|
|
31
33
|
* import { Radio } from '@yahoo/uds-mobile';
|
|
@@ -38,9 +40,16 @@ const VARIANT_ERROR_MAP = {
|
|
|
38
40
|
* - Forms: For selecting a single option from multiple choices
|
|
39
41
|
* - Settings: For toggling between mutually exclusive preferences
|
|
40
42
|
*
|
|
41
|
-
* @
|
|
43
|
+
* @accessibility
|
|
44
|
+
* - Sets `accessibilityRole="radio"` automatically
|
|
45
|
+
* - Announces checked/unchecked state
|
|
46
|
+
* - Label is used as accessibility label
|
|
47
|
+
* - Supports `reduceMotion` for users who prefer reduced motion
|
|
48
|
+
*
|
|
49
|
+
* @see {@link Checkbox} for multi-select options
|
|
50
|
+
* @see {@link Switch} for binary toggles
|
|
42
51
|
*/
|
|
43
|
-
const Radio = (0, react.memo)(function Radio
|
|
52
|
+
const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
|
|
44
53
|
const uid = `uds-radio-${(0, react.useId)()}`;
|
|
45
54
|
const isControlled = checkedProp !== void 0;
|
|
46
55
|
const [internalChecked, setInternalChecked] = (0, react.useState)(isControlled ? checkedProp : defaultChecked ?? false);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { UniversalRadioProps } from "../types/dist/index.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Radio.d.ts
|
|
8
8
|
interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
9
|
+
/** Ref to the underlying View */
|
|
9
10
|
ref?: Ref<View>;
|
|
10
11
|
/** Default checked state for uncontrolled mode */
|
|
11
12
|
defaultChecked?: boolean;
|
|
@@ -19,13 +20,14 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
19
20
|
/**
|
|
20
21
|
* **⚙️ A radio component**
|
|
21
22
|
*
|
|
22
|
-
* @componentType Client component
|
|
23
|
-
*
|
|
24
23
|
* @description
|
|
25
24
|
* A radio component allows users to select one option from a set.
|
|
26
25
|
* Unlike checkbox, radio buttons cannot have multiple selected in a group,
|
|
27
26
|
* allowing only one selection at a time.
|
|
28
27
|
*
|
|
28
|
+
* @category Form
|
|
29
|
+
* @platform mobile
|
|
30
|
+
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```tsx
|
|
31
33
|
* import { Radio } from '@yahoo/uds-mobile';
|
|
@@ -38,9 +40,16 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
38
40
|
* - Forms: For selecting a single option from multiple choices
|
|
39
41
|
* - Settings: For toggling between mutually exclusive preferences
|
|
40
42
|
*
|
|
41
|
-
* @
|
|
43
|
+
* @accessibility
|
|
44
|
+
* - Sets `accessibilityRole="radio"` automatically
|
|
45
|
+
* - Announces checked/unchecked state
|
|
46
|
+
* - Label is used as accessibility label
|
|
47
|
+
* - Supports `reduceMotion` for users who prefer reduced motion
|
|
48
|
+
*
|
|
49
|
+
* @see {@link Checkbox} for multi-select options
|
|
50
|
+
* @see {@link Switch} for binary toggles
|
|
42
51
|
*/
|
|
43
|
-
declare const Radio:
|
|
52
|
+
declare const Radio: react.NamedExoticComponent<RadioProps>;
|
|
44
53
|
//#endregion
|
|
45
54
|
export { Radio, type RadioProps };
|
|
46
55
|
//# sourceMappingURL=Radio.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.cts","names":[],"sources":["../../src/components/Radio.tsx"],"
|
|
1
|
+
{"version":3,"file":"Radio.d.cts","names":[],"sources":["../../src/components/Radio.tsx"],"mappings":";;;;;;;UAwBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,cAAA;;EAEA,QAAA;EAJU;EAMV,QAAA;EAR2B;EAU3B,QAAA,IAAY,OAAA;AAAA;;;;;;;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,KAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { UniversalRadioProps } from "../types/dist/index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Radio.d.ts
|
|
8
8
|
interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
9
|
+
/** Ref to the underlying View */
|
|
9
10
|
ref?: Ref<View>;
|
|
10
11
|
/** Default checked state for uncontrolled mode */
|
|
11
12
|
defaultChecked?: boolean;
|
|
@@ -19,13 +20,14 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
19
20
|
/**
|
|
20
21
|
* **⚙️ A radio component**
|
|
21
22
|
*
|
|
22
|
-
* @componentType Client component
|
|
23
|
-
*
|
|
24
23
|
* @description
|
|
25
24
|
* A radio component allows users to select one option from a set.
|
|
26
25
|
* Unlike checkbox, radio buttons cannot have multiple selected in a group,
|
|
27
26
|
* allowing only one selection at a time.
|
|
28
27
|
*
|
|
28
|
+
* @category Form
|
|
29
|
+
* @platform mobile
|
|
30
|
+
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```tsx
|
|
31
33
|
* import { Radio } from '@yahoo/uds-mobile';
|
|
@@ -38,9 +40,16 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
38
40
|
* - Forms: For selecting a single option from multiple choices
|
|
39
41
|
* - Settings: For toggling between mutually exclusive preferences
|
|
40
42
|
*
|
|
41
|
-
* @
|
|
43
|
+
* @accessibility
|
|
44
|
+
* - Sets `accessibilityRole="radio"` automatically
|
|
45
|
+
* - Announces checked/unchecked state
|
|
46
|
+
* - Label is used as accessibility label
|
|
47
|
+
* - Supports `reduceMotion` for users who prefer reduced motion
|
|
48
|
+
*
|
|
49
|
+
* @see {@link Checkbox} for multi-select options
|
|
50
|
+
* @see {@link Switch} for binary toggles
|
|
42
51
|
*/
|
|
43
|
-
declare const Radio:
|
|
52
|
+
declare const Radio: react.NamedExoticComponent<RadioProps>;
|
|
44
53
|
//#endregion
|
|
45
54
|
export { Radio, type RadioProps };
|
|
46
55
|
//# sourceMappingURL=Radio.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.mts","names":[],"sources":["../../src/components/Radio.tsx"],"
|
|
1
|
+
{"version":3,"file":"Radio.d.mts","names":[],"sources":["../../src/components/Radio.tsx"],"mappings":";;;;;;;UAwBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,cAAA;;EAEA,QAAA;EAJU;EAMV,QAAA;EAR2B;EAU3B,QAAA,IAAY,OAAA;AAAA;;;;;;;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,KAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { SCALE_EFFECTS } from "../motion-tokens/dist/index.mjs";
|
|
3
3
|
import { BUTTON_SPRING_CONFIG } from "../motion.mjs";
|
|
4
4
|
import { Text } from "./Text.mjs";
|
|
@@ -17,13 +17,14 @@ const VARIANT_ERROR_MAP = {
|
|
|
17
17
|
/**
|
|
18
18
|
* **⚙️ A radio component**
|
|
19
19
|
*
|
|
20
|
-
* @componentType Client component
|
|
21
|
-
*
|
|
22
20
|
* @description
|
|
23
21
|
* A radio component allows users to select one option from a set.
|
|
24
22
|
* Unlike checkbox, radio buttons cannot have multiple selected in a group,
|
|
25
23
|
* allowing only one selection at a time.
|
|
26
24
|
*
|
|
25
|
+
* @category Form
|
|
26
|
+
* @platform mobile
|
|
27
|
+
*
|
|
27
28
|
* @example
|
|
28
29
|
* ```tsx
|
|
29
30
|
* import { Radio } from '@yahoo/uds-mobile';
|
|
@@ -36,9 +37,16 @@ const VARIANT_ERROR_MAP = {
|
|
|
36
37
|
* - Forms: For selecting a single option from multiple choices
|
|
37
38
|
* - Settings: For toggling between mutually exclusive preferences
|
|
38
39
|
*
|
|
39
|
-
* @
|
|
40
|
+
* @accessibility
|
|
41
|
+
* - Sets `accessibilityRole="radio"` automatically
|
|
42
|
+
* - Announces checked/unchecked state
|
|
43
|
+
* - Label is used as accessibility label
|
|
44
|
+
* - Supports `reduceMotion` for users who prefer reduced motion
|
|
45
|
+
*
|
|
46
|
+
* @see {@link Checkbox} for multi-select options
|
|
47
|
+
* @see {@link Switch} for binary toggles
|
|
40
48
|
*/
|
|
41
|
-
const Radio = memo(function Radio
|
|
49
|
+
const Radio = memo(function Radio({ label, labelPosition = "start", variant: variantProp = "primary", size = "md", checked: checkedProp, hasError, reduceMotion, defaultChecked, disabled, required, onChange, ref, ...viewProps }) {
|
|
42
50
|
const uid = `uds-radio-${useId()}`;
|
|
43
51
|
const isControlled = checkedProp !== void 0;
|
|
44
52
|
const [internalChecked, setInternalChecked] = useState(isControlled ? checkedProp : defaultChecked ?? false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.mjs","names":["VARIANT_ERROR_MAP: Record<RadioVariant, RadioStyleVariant>","Radio","valueState: RadioValueState","styleVariant: RadioStyleVariant"],"sources":["../../src/components/Radio.tsx"],"sourcesContent":["import type { RadioVariant, UniversalRadioProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { radioStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from RadioValue - maps boolean to 'checked'/'unchecked' string literals */\ntype RadioValueState = 'checked' | 'unchecked';\n\ninterface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the radio is disabled */\n disabled?: boolean;\n /** Whether the radio is required */\n required?: boolean;\n /** Callback fired when the checked state changes */\n onChange?: (checked: boolean) => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Variant Mapping */\n/* -------------------------------------------------------------------------- */\n\n/** All style variants available in the generated styles (includes error variants) */\ntype RadioStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<RadioVariant, RadioStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Radio Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A radio component**\n *\n * @componentType Client component\n *\n * @description\n * A radio component allows users to select one option from a set.\n * Unlike checkbox, radio buttons cannot have multiple selected in a group,\n * allowing only one selection at a time.\n *\n * @example\n * ```tsx\n * import { Radio } from '@yahoo/uds-mobile';\n *\n * <Radio label=\"Option A\" />\n * <Radio label=\"Option B\" checked={true} onChange={setChecked} />\n * ```\n *\n * @usage\n * - Forms: For selecting a single option from multiple choices\n * - Settings: For toggling between mutually exclusive preferences\n *\n * @see The {@link https://uds.build/docs/components/radio Radio Docs} for more info\n */\nconst Radio = memo(function Radio({\n // Radio props\n label,\n labelPosition = 'start',\n variant: variantProp = 'primary',\n size = 'md',\n checked: checkedProp,\n hasError,\n reduceMotion,\n // Native props\n defaultChecked,\n disabled,\n required,\n onChange,\n ref,\n ...viewProps\n}: RadioProps) {\n const generatedId = useId();\n const uid = `uds-radio-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<boolean>(\n isControlled ? checkedProp : (defaultChecked ?? false),\n );\n const [pressed, setPressed] = useState(false);\n\n // Use controlled value if provided, otherwise use internal state\n const checked = isControlled ? checkedProp : internalChecked;\n\n /* ------------------------------ Derived Values ---------------------------- */\n const valueState: RadioValueState = useMemo(() => {\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n /* -------------------------------- Animation ------------------------------- */\n const shouldAnimate = !reduceMotion;\n\n // Scale animation for press feedback (disabled when reduceMotion is true)\n const scaleProgress = useDerivedValue(\n () =>\n shouldAnimate\n ? withSpring(pressed ? SCALE_EFFECTS.down : SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG)\n : SCALE_EFFECTS.none, // No scale effect when reduceMotion is true\n [pressed, shouldAnimate],\n );\n\n // Circle visibility animation (for the inner dot)\n // When reduceMotion is true, still show/hide the circle but without animation\n const circleProgress = useDerivedValue(\n () => (shouldAnimate ? withSpring(checked ? 1 : 0, BUTTON_SPRING_CONFIG) : checked ? 1 : 0),\n [checked, shouldAnimate],\n );\n\n const radioAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n const circleAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(circleProgress.value, [0, 1], [0, 1]),\n transform: [{ scale: interpolate(circleProgress.value, [0, 1], [0.5, 1]) }],\n }));\n\n /* -------------------------------- Handlers -------------------------------- */\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n\n onChange?.(newChecked);\n }, [disabled, checked, isControlled, onChange]);\n\n const handlePressIn = useCallback(() => {\n setPressed(true);\n }, []);\n\n const handlePressOut = useCallback(() => {\n setPressed(false);\n }, []);\n\n /* --------------------------------- Styles --------------------------------- */\n // Compute the style variant (primary/secondary maps to alert variants when hasError)\n const styleVariant: RadioStyleVariant = hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp;\n\n radioStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [radioStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [radioStyles.root, disabled],\n );\n\n const radioBoxStyle = useMemo(\n () => [\n radioStyles.radio,\n {\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n borderRadius: 9999,\n },\n radioAnimatedStyle,\n ],\n [radioStyles.radio, radioAnimatedStyle],\n );\n\n // Inner circle size: fixed 8x8px to match web implementation\n const INNER_CIRCLE_SIZE = 8;\n\n const circleStyle = useMemo(\n () => [\n radioStyles.radioCircle,\n {\n width: INNER_CIRCLE_SIZE,\n height: INNER_CIRCLE_SIZE,\n borderRadius: 9999,\n },\n circleAnimatedStyle,\n ],\n [radioStyles.radioCircle, circleAnimatedStyle],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content =\n typeof label === 'function' ? label() : isValidElement(label) ? label : String(label);\n\n const textContent =\n typeof content === 'string' ? <Text style={radioStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={radioStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, radioStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked,\n }),\n [disabled, checked],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <Pressable\n ref={ref}\n nativeID={uid}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n disabled={disabled}\n flexDirection={labelPosition === 'start' ? 'row' : 'row-reverse'}\n alignItems=\"center\"\n alignSelf=\"flex-start\"\n accessibilityRole=\"radio\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={radioBoxStyle}>\n <Animated.View style={circleStyle} />\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nRadio.displayName = 'Radio';\n\nexport { Radio, type RadioProps };\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Radio.mjs","names":[],"sources":["../../src/components/Radio.tsx"],"sourcesContent":["import type { RadioVariant, UniversalRadioProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useId, useMemo, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport Animated, {\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { radioStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport { HStack } from './HStack';\nimport { Pressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------------- */\n\n/** Derived from RadioValue - maps boolean to 'checked'/'unchecked' string literals */\ntype RadioValueState = 'checked' | 'unchecked';\n\ninterface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Default checked state for uncontrolled mode */\n defaultChecked?: boolean;\n /** Whether the radio is disabled */\n disabled?: boolean;\n /** Whether the radio is required */\n required?: boolean;\n /** Callback fired when the checked state changes */\n onChange?: (checked: boolean) => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Variant Mapping */\n/* -------------------------------------------------------------------------- */\n\n/** All style variants available in the generated styles (includes error variants) */\ntype RadioStyleVariant = 'primary' | 'secondary' | 'alert' | 'alert-secondary';\n\nconst VARIANT_ERROR_MAP: Record<RadioVariant, RadioStyleVariant> = {\n primary: 'alert',\n secondary: 'alert-secondary',\n};\n\n/* -------------------------------------------------------------------------- */\n/* Radio Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **⚙️ A radio component**\n *\n * @description\n * A radio component allows users to select one option from a set.\n * Unlike checkbox, radio buttons cannot have multiple selected in a group,\n * allowing only one selection at a time.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Radio } from '@yahoo/uds-mobile';\n *\n * <Radio label=\"Option A\" />\n * <Radio label=\"Option B\" checked={true} onChange={setChecked} />\n * ```\n *\n * @usage\n * - Forms: For selecting a single option from multiple choices\n * - Settings: For toggling between mutually exclusive preferences\n *\n * @accessibility\n * - Sets `accessibilityRole=\"radio\"` automatically\n * - Announces checked/unchecked state\n * - Label is used as accessibility label\n * - Supports `reduceMotion` for users who prefer reduced motion\n *\n * @see {@link Checkbox} for multi-select options\n * @see {@link Switch} for binary toggles\n */\nconst Radio = memo(function Radio({\n // Radio props\n label,\n labelPosition = 'start',\n variant: variantProp = 'primary',\n size = 'md',\n checked: checkedProp,\n hasError,\n reduceMotion,\n // Native props\n defaultChecked,\n disabled,\n required,\n onChange,\n ref,\n ...viewProps\n}: RadioProps) {\n const generatedId = useId();\n const uid = `uds-radio-${generatedId}`;\n\n /* --------------------------------- State ---------------------------------- */\n const isControlled = checkedProp !== undefined;\n const [internalChecked, setInternalChecked] = useState<boolean>(\n isControlled ? checkedProp : (defaultChecked ?? false),\n );\n const [pressed, setPressed] = useState(false);\n\n // Use controlled value if provided, otherwise use internal state\n const checked = isControlled ? checkedProp : internalChecked;\n\n /* ------------------------------ Derived Values ---------------------------- */\n const valueState: RadioValueState = useMemo(() => {\n return checked ? 'checked' : 'unchecked';\n }, [checked]);\n\n /* -------------------------------- Animation ------------------------------- */\n const shouldAnimate = !reduceMotion;\n\n // Scale animation for press feedback (disabled when reduceMotion is true)\n const scaleProgress = useDerivedValue(\n () =>\n shouldAnimate\n ? withSpring(pressed ? SCALE_EFFECTS.down : SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG)\n : SCALE_EFFECTS.none, // No scale effect when reduceMotion is true\n [pressed, shouldAnimate],\n );\n\n // Circle visibility animation (for the inner dot)\n // When reduceMotion is true, still show/hide the circle but without animation\n const circleProgress = useDerivedValue(\n () => (shouldAnimate ? withSpring(checked ? 1 : 0, BUTTON_SPRING_CONFIG) : checked ? 1 : 0),\n [checked, shouldAnimate],\n );\n\n const radioAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n const circleAnimatedStyle = useAnimatedStyle(() => ({\n opacity: interpolate(circleProgress.value, [0, 1], [0, 1]),\n transform: [{ scale: interpolate(circleProgress.value, [0, 1], [0.5, 1]) }],\n }));\n\n /* -------------------------------- Handlers -------------------------------- */\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n\n onChange?.(newChecked);\n }, [disabled, checked, isControlled, onChange]);\n\n const handlePressIn = useCallback(() => {\n setPressed(true);\n }, []);\n\n const handlePressOut = useCallback(() => {\n setPressed(false);\n }, []);\n\n /* --------------------------------- Styles --------------------------------- */\n // Compute the style variant (primary/secondary maps to alert variants when hasError)\n const styleVariant: RadioStyleVariant = hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp;\n\n radioStyles.useVariants({\n size,\n variant: styleVariant, // primary, secondary, alert, alert-secondary\n value: valueState, // checked, unchecked\n pressed,\n });\n\n const rootStyle = useMemo(\n () => [radioStyles.root, { opacity: disabled ? 0.5 : 1 }],\n [radioStyles.root, disabled],\n );\n\n const radioBoxStyle = useMemo(\n () => [\n radioStyles.radio,\n {\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n borderRadius: 9999,\n },\n radioAnimatedStyle,\n ],\n [radioStyles.radio, radioAnimatedStyle],\n );\n\n // Inner circle size: fixed 8x8px to match web implementation\n const INNER_CIRCLE_SIZE = 8;\n\n const circleStyle = useMemo(\n () => [\n radioStyles.radioCircle,\n {\n width: INNER_CIRCLE_SIZE,\n height: INNER_CIRCLE_SIZE,\n borderRadius: 9999,\n },\n circleAnimatedStyle,\n ],\n [radioStyles.radioCircle, circleAnimatedStyle],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n const content =\n typeof label === 'function' ? label() : isValidElement(label) ? label : String(label);\n\n const textContent =\n typeof content === 'string' ? <Text style={radioStyles.text}>{content}</Text> : content;\n\n if (required) {\n return (\n <HStack columnGap=\"1\" alignItems=\"flex-start\">\n {textContent}\n <Text style={radioStyles.text}>*</Text>\n </HStack>\n );\n }\n\n return textContent;\n }, [label, required, radioStyles.text]);\n\n const a11yState = useMemo(\n () => ({\n disabled,\n checked,\n }),\n [disabled, checked],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <Pressable\n ref={ref}\n nativeID={uid}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n disabled={disabled}\n flexDirection={labelPosition === 'start' ? 'row' : 'row-reverse'}\n alignItems=\"center\"\n alignSelf=\"flex-start\"\n accessibilityRole=\"radio\"\n accessibilityState={a11yState}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n {...viewProps}\n style={rootStyle}\n >\n <Animated.View style={radioBoxStyle}>\n <Animated.View style={circleStyle} />\n </Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nRadio.displayName = 'Radio';\n\nexport { Radio, type RadioProps };\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,oBAA6D;CACjE,SAAS;CACT,WAAW;CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCD,MAAM,QAAQ,KAAK,SAAS,MAAM,EAEhC,OACA,gBAAgB,SAChB,SAAS,cAAc,WACvB,OAAO,MACP,SAAS,aACT,UACA,cAEA,gBACA,UACA,UACA,UACA,KACA,GAAG,aACU;CAEb,MAAM,MAAM,aADQ,OAAO;CAI3B,MAAM,eAAe,gBAAgB;CACrC,MAAM,CAAC,iBAAiB,sBAAsB,SAC5C,eAAe,cAAe,kBAAkB,MACjD;CACD,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAG7C,MAAM,UAAU,eAAe,cAAc;CAG7C,MAAM,aAA8B,cAAc;AAChD,SAAO,UAAU,YAAY;IAC5B,CAAC,QAAQ,CAAC;CAGb,MAAM,gBAAgB,CAAC;CAGvB,MAAM,gBAAgB,sBAElB,gBACI,WAAW,UAAU,cAAc,OAAO,cAAc,MAAM,qBAAqB,GACnF,cAAc,MACpB,CAAC,SAAS,cAAc,CACzB;CAID,MAAM,iBAAiB,sBACd,gBAAgB,WAAW,UAAU,IAAI,GAAG,qBAAqB,GAAG,UAAU,IAAI,GACzF,CAAC,SAAS,cAAc,CACzB;CAED,MAAM,qBAAqB,wBAAwB,EACjD,WAAW,CAAC,EAAE,OAAO,cAAc,OAAO,CAAC,EAC5C,EAAE;CAEH,MAAM,sBAAsB,wBAAwB;EAClD,SAAS,YAAY,eAAe,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;EAC1D,WAAW,CAAC,EAAE,OAAO,YAAY,eAAe,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,IAAK,EAAE,CAAC,EAAE,CAAC;EAC5E,EAAE;CAGH,MAAM,cAAc,kBAAkB;AACpC,MAAI,SACF;EAGF,MAAM,aAAa,CAAC;AAEpB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAGhC,aAAW,WAAW;IACrB;EAAC;EAAU;EAAS;EAAc;EAAS,CAAC;CAE/C,MAAM,gBAAgB,kBAAkB;AACtC,aAAW,KAAK;IACf,EAAE,CAAC;CAEN,MAAM,iBAAiB,kBAAkB;AACvC,aAAW,MAAM;IAChB,EAAE,CAAC;CAIN,MAAM,eAAkC,WAAW,kBAAkB,eAAe;AAEpF,aAAY,YAAY;EACtB;EACA,SAAS;EACT,OAAO;EACP;EACD,CAAC;CAEF,MAAM,YAAY,cACV,CAAC,YAAY,MAAM,EAAE,SAAS,WAAW,KAAM,GAAG,CAAC,EACzD,CAAC,YAAY,MAAM,SAAS,CAC7B;CAED,MAAM,gBAAgB,cACd;EACJ,YAAY;EACZ;GACE,YAAY;GACZ,gBAAgB;GAChB,cAAc;GACf;EACD;EACD,EACD,CAAC,YAAY,OAAO,mBAAmB,CACxC;CAGD,MAAM,oBAAoB;CAE1B,MAAM,cAAc,cACZ;EACJ,YAAY;EACZ;GACE,OAAO;GACP,QAAQ;GACR,cAAc;GACf;EACD;EACD,EACD,CAAC,YAAY,aAAa,oBAAoB,CAC/C;CAGD,MAAM,eAAe,cAAc;AACjC,MAAI,CAAC,MACH,QAAO;EAGT,MAAM,UACJ,OAAO,UAAU,aAAa,OAAO,GAAG,eAAe,MAAM,GAAG,QAAQ,OAAO,MAAM;EAEvF,MAAM,cACJ,OAAO,YAAY,WAAW,oBAAC;GAAK,OAAO,YAAY;aAAO;IAAe,GAAG;AAElF,MAAI,SACF,QACE,qBAAC;GAAO,WAAU;GAAI,YAAW;cAC9B,aACD,oBAAC;IAAK,OAAO,YAAY;cAAM;KAAQ;IAChC;AAIb,SAAO;IACN;EAAC;EAAO;EAAU,YAAY;EAAK,CAAC;CAEvC,MAAM,YAAY,eACT;EACL;EACA;EACD,GACD,CAAC,UAAU,QAAQ,CACpB;AAGD,QACE,qBAAC;EACM;EACL,UAAU;EACV,SAAS;EACT,WAAW;EACX,YAAY;EACF;EACV,eAAe,kBAAkB,UAAU,QAAQ;EACnD,YAAW;EACX,WAAU;EACV,mBAAkB;EAClB,oBAAoB;EACpB,oBAAoB,OAAO,UAAU,WAAW,QAAQ;EACxD,GAAI;EACJ,OAAO;aAEP,oBAAC,SAAS;GAAK,OAAO;aACpB,oBAAC,SAAS,QAAK,OAAO,cAAe;IACvB,EAEf;GACS;EAEd;AAEF,MAAM,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
4
|
const require_components_HStack = require('./HStack.cjs');
|
|
4
5
|
const require_components_VStack = require('./VStack.cjs');
|
|
5
6
|
let react = require("react");
|
|
@@ -17,6 +18,9 @@ let react_native_unistyles = require("react-native-unistyles");
|
|
|
17
18
|
* consistent padding and background styling. Uses Unistyles' built-in
|
|
18
19
|
* safe area insets via the `rt` runtime object.
|
|
19
20
|
*
|
|
21
|
+
* @category Layout
|
|
22
|
+
* @platform mobile
|
|
23
|
+
*
|
|
20
24
|
* @example
|
|
21
25
|
* ```tsx
|
|
22
26
|
* import { Screen } from '@yahoo/uds-mobile';
|
|
@@ -38,10 +42,12 @@ let react_native_unistyles = require("react-native-unistyles");
|
|
|
38
42
|
* - Use as the root component for screens
|
|
39
43
|
* - Use stickyHeader for persistent header content
|
|
40
44
|
* - Content is automatically scrollable
|
|
45
|
+
* - Safe area insets are handled automatically
|
|
41
46
|
*
|
|
42
|
-
* @see
|
|
47
|
+
* @see {@link VStack} for non-scrollable vertical layouts
|
|
48
|
+
* @see {@link Box} for custom containers
|
|
43
49
|
*/
|
|
44
|
-
const Screen = (0, react.memo)(function Screen
|
|
50
|
+
const Screen = (0, react.memo)(function Screen({ children, backgroundColor = "primary", spacingHorizontal = "6", spacingTop = "6", gap, stickyHeader, stickyHeaderProps, style, ref, ...props }) {
|
|
45
51
|
const { style: stickyHeaderStyle, ...stickyHeaderPropsWithoutStyle } = stickyHeaderProps ?? {};
|
|
46
52
|
generated_styles.styles.useVariants({
|
|
47
53
|
backgroundColor,
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import { HStackProps } from "./HStack.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { ReactNode, Ref } from "react";
|
|
5
5
|
import { ScrollView, ScrollViewProps } from "react-native";
|
|
6
6
|
import { StyleProps } from "../../generated/styles";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Screen.d.ts
|
|
9
9
|
interface ScreenProps extends ScrollViewProps {
|
|
10
|
+
/** Ref to the underlying ScrollView */
|
|
10
11
|
ref?: Ref<ScrollView>;
|
|
12
|
+
/** Background color of the screen */
|
|
11
13
|
backgroundColor?: StyleProps['backgroundColor'];
|
|
14
|
+
/** Horizontal padding for screen content */
|
|
12
15
|
spacingHorizontal?: StyleProps['spacingHorizontal'];
|
|
16
|
+
/** Top padding for screen content */
|
|
13
17
|
spacingTop?: StyleProps['spacingTop'];
|
|
18
|
+
/** Gap between child elements */
|
|
14
19
|
gap?: StyleProps['columnGap'];
|
|
20
|
+
/** Content that sticks to the top of the screen when scrolling */
|
|
15
21
|
stickyHeader?: ReactNode;
|
|
22
|
+
/** Props passed to the sticky header container */
|
|
16
23
|
stickyHeaderProps?: HStackProps;
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
@@ -23,6 +30,9 @@ interface ScreenProps extends ScrollViewProps {
|
|
|
23
30
|
* consistent padding and background styling. Uses Unistyles' built-in
|
|
24
31
|
* safe area insets via the `rt` runtime object.
|
|
25
32
|
*
|
|
33
|
+
* @category Layout
|
|
34
|
+
* @platform mobile
|
|
35
|
+
*
|
|
26
36
|
* @example
|
|
27
37
|
* ```tsx
|
|
28
38
|
* import { Screen } from '@yahoo/uds-mobile';
|
|
@@ -44,10 +54,12 @@ interface ScreenProps extends ScrollViewProps {
|
|
|
44
54
|
* - Use as the root component for screens
|
|
45
55
|
* - Use stickyHeader for persistent header content
|
|
46
56
|
* - Content is automatically scrollable
|
|
57
|
+
* - Safe area insets are handled automatically
|
|
47
58
|
*
|
|
48
|
-
* @see
|
|
59
|
+
* @see {@link VStack} for non-scrollable vertical layouts
|
|
60
|
+
* @see {@link Box} for custom containers
|
|
49
61
|
*/
|
|
50
|
-
declare const Screen:
|
|
62
|
+
declare const Screen: react.NamedExoticComponent<ScreenProps>;
|
|
51
63
|
//#endregion
|
|
52
64
|
export { Screen, type ScreenProps };
|
|
53
65
|
//# sourceMappingURL=Screen.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.cts","names":[],"sources":["../../src/components/Screen.tsx"],"
|
|
1
|
+
{"version":3,"file":"Screen.d.cts","names":[],"sources":["../../src/components/Screen.tsx"],"mappings":";;;;;;;;UAYU,WAAA,SAAoB,eAAA;;EAE5B,GAAA,GAAM,GAAA,CAAI,UAAA;EAFU;EAIpB,eAAA,GAAkB,UAAA;EAFR;EAIV,iBAAA,GAAoB,UAAA;EAFF;EAIlB,UAAA,GAAa,UAAA;EAAA;EAEb,GAAA,GAAM,UAAA;EAES;EAAf,YAAA,GAAe,SAAA;EAZa;EAc5B,iBAAA,GAAoB,WAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAW;;;;;;;;;;;;;;;;;;;cAwC3B,MAAA,EAAM,KAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import { HStackProps } from "./HStack.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { ReactNode, Ref } from "react";
|
|
5
5
|
import { ScrollView, ScrollViewProps } from "react-native";
|
|
6
6
|
import { StyleProps } from "../../generated/styles";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Screen.d.ts
|
|
9
9
|
interface ScreenProps extends ScrollViewProps {
|
|
10
|
+
/** Ref to the underlying ScrollView */
|
|
10
11
|
ref?: Ref<ScrollView>;
|
|
12
|
+
/** Background color of the screen */
|
|
11
13
|
backgroundColor?: StyleProps['backgroundColor'];
|
|
14
|
+
/** Horizontal padding for screen content */
|
|
12
15
|
spacingHorizontal?: StyleProps['spacingHorizontal'];
|
|
16
|
+
/** Top padding for screen content */
|
|
13
17
|
spacingTop?: StyleProps['spacingTop'];
|
|
18
|
+
/** Gap between child elements */
|
|
14
19
|
gap?: StyleProps['columnGap'];
|
|
20
|
+
/** Content that sticks to the top of the screen when scrolling */
|
|
15
21
|
stickyHeader?: ReactNode;
|
|
22
|
+
/** Props passed to the sticky header container */
|
|
16
23
|
stickyHeaderProps?: HStackProps;
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
@@ -23,6 +30,9 @@ interface ScreenProps extends ScrollViewProps {
|
|
|
23
30
|
* consistent padding and background styling. Uses Unistyles' built-in
|
|
24
31
|
* safe area insets via the `rt` runtime object.
|
|
25
32
|
*
|
|
33
|
+
* @category Layout
|
|
34
|
+
* @platform mobile
|
|
35
|
+
*
|
|
26
36
|
* @example
|
|
27
37
|
* ```tsx
|
|
28
38
|
* import { Screen } from '@yahoo/uds-mobile';
|
|
@@ -44,10 +54,12 @@ interface ScreenProps extends ScrollViewProps {
|
|
|
44
54
|
* - Use as the root component for screens
|
|
45
55
|
* - Use stickyHeader for persistent header content
|
|
46
56
|
* - Content is automatically scrollable
|
|
57
|
+
* - Safe area insets are handled automatically
|
|
47
58
|
*
|
|
48
|
-
* @see
|
|
59
|
+
* @see {@link VStack} for non-scrollable vertical layouts
|
|
60
|
+
* @see {@link Box} for custom containers
|
|
49
61
|
*/
|
|
50
|
-
declare const Screen:
|
|
62
|
+
declare const Screen: react.NamedExoticComponent<ScreenProps>;
|
|
51
63
|
//#endregion
|
|
52
64
|
export { Screen, type ScreenProps };
|
|
53
65
|
//# sourceMappingURL=Screen.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.mts","names":[],"sources":["../../src/components/Screen.tsx"],"
|
|
1
|
+
{"version":3,"file":"Screen.d.mts","names":[],"sources":["../../src/components/Screen.tsx"],"mappings":";;;;;;;;UAYU,WAAA,SAAoB,eAAA;;EAE5B,GAAA,GAAM,GAAA,CAAI,UAAA;EAFU;EAIpB,eAAA,GAAkB,UAAA;EAFR;EAIV,iBAAA,GAAoB,UAAA;EAFF;EAIlB,UAAA,GAAa,UAAA;EAAA;EAEb,GAAA,GAAM,UAAA;EAES;EAAf,YAAA,GAAe,SAAA;EAZa;EAc5B,iBAAA,GAAoB,WAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAW;;;;;;;;;;;;;;;;;;;cAwC3B,MAAA,EAAM,KAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { HStack } from "./HStack.mjs";
|
|
3
3
|
import { VStack } from "./VStack.mjs";
|
|
4
4
|
import { memo, useMemo } from "react";
|
|
@@ -16,6 +16,9 @@ import { StyleSheet } from "react-native-unistyles";
|
|
|
16
16
|
* consistent padding and background styling. Uses Unistyles' built-in
|
|
17
17
|
* safe area insets via the `rt` runtime object.
|
|
18
18
|
*
|
|
19
|
+
* @category Layout
|
|
20
|
+
* @platform mobile
|
|
21
|
+
*
|
|
19
22
|
* @example
|
|
20
23
|
* ```tsx
|
|
21
24
|
* import { Screen } from '@yahoo/uds-mobile';
|
|
@@ -37,10 +40,12 @@ import { StyleSheet } from "react-native-unistyles";
|
|
|
37
40
|
* - Use as the root component for screens
|
|
38
41
|
* - Use stickyHeader for persistent header content
|
|
39
42
|
* - Content is automatically scrollable
|
|
43
|
+
* - Safe area insets are handled automatically
|
|
40
44
|
*
|
|
41
|
-
* @see
|
|
45
|
+
* @see {@link VStack} for non-scrollable vertical layouts
|
|
46
|
+
* @see {@link Box} for custom containers
|
|
42
47
|
*/
|
|
43
|
-
const Screen = memo(function Screen
|
|
48
|
+
const Screen = memo(function Screen({ children, backgroundColor = "primary", spacingHorizontal = "6", spacingTop = "6", gap, stickyHeader, stickyHeaderProps, style, ref, ...props }) {
|
|
44
49
|
const { style: stickyHeaderStyle, ...stickyHeaderPropsWithoutStyle } = stickyHeaderProps ?? {};
|
|
45
50
|
styles.useVariants({
|
|
46
51
|
backgroundColor,
|