@yahoo/uds-mobile 2.12.0 → 2.14.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/README.md +3 -1
- package/dist/bin/mobile/scripts/utils/configToRNMappings.mjs +2 -0
- package/dist/components/Checkbox.cjs +10 -15
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +11 -16
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/FormLabel.cjs +31 -0
- package/dist/components/FormLabel.d.cts +21 -0
- package/dist/components/FormLabel.d.cts.map +1 -0
- package/dist/components/FormLabel.d.ts +21 -0
- package/dist/components/FormLabel.d.ts.map +1 -0
- package/dist/components/FormLabel.js +31 -0
- package/dist/components/FormLabel.js.map +1 -0
- package/dist/components/{Radio.cjs → Radio/Radio.cjs} +41 -24
- package/dist/components/{Radio.d.cts → Radio/Radio.d.cts} +2 -2
- package/dist/components/Radio/Radio.d.cts.map +1 -0
- package/dist/components/{Radio.d.ts → Radio/Radio.d.ts} +2 -2
- package/dist/components/Radio/Radio.d.ts.map +1 -0
- package/dist/components/{Radio.js → Radio/Radio.js} +41 -24
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/RadioGroup.cjs +84 -0
- package/dist/components/Radio/RadioGroup.d.cts +52 -0
- package/dist/components/Radio/RadioGroup.d.cts.map +1 -0
- package/dist/components/Radio/RadioGroup.d.ts +52 -0
- package/dist/components/Radio/RadioGroup.d.ts.map +1 -0
- package/dist/components/Radio/RadioGroup.js +84 -0
- package/dist/components/Radio/RadioGroup.js.map +1 -0
- package/dist/components/Radio/RadioGroupContext.cjs +12 -0
- package/dist/components/Radio/RadioGroupContext.d.cts +20 -0
- package/dist/components/Radio/RadioGroupContext.d.cts.map +1 -0
- package/dist/components/Radio/RadioGroupContext.d.ts +20 -0
- package/dist/components/Radio/RadioGroupContext.d.ts.map +1 -0
- package/dist/components/Radio/RadioGroupContext.js +11 -0
- package/dist/components/Radio/RadioGroupContext.js.map +1 -0
- package/dist/components/Radio/index.cjs +6 -0
- package/dist/components/Radio/index.d.cts +4 -0
- package/dist/components/Radio/index.d.ts +4 -0
- package/dist/components/Radio/index.js +4 -0
- package/dist/components/Switch.cjs +8 -13
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +8 -13
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Text.cjs +12 -6
- package/dist/components/Text.d.cts +3 -2
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +3 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +12 -6
- package/dist/components/Text.js.map +1 -1
- package/dist/types/dist/index.d.cts +52 -2
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +52 -2
- package/dist/types/dist/index.d.ts.map +1 -1
- package/generated/styles.cjs +4 -0
- package/generated/styles.d.ts +2 -1
- package/generated/styles.mjs +4 -0
- package/generated/unistyles.d.ts +6 -0
- package/package.json +25 -5
- package/dist/components/Radio.d.cts.map +0 -1
- package/dist/components/Radio.d.ts.map +0 -1
- package/dist/components/Radio.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_components_Radio_RadioGroupContext = require("./RadioGroupContext.cjs");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
//#region src/components/Radio/RadioGroup.tsx
|
|
9
|
+
/**
|
|
10
|
+
* **⚙️ A radio group component**
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* A radio group coordinates multiple Radio components so one option can be selected at a time.
|
|
14
|
+
*
|
|
15
|
+
* @category Form
|
|
16
|
+
* @platform mobile
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
21
|
+
* import { RadioGroup } from '@yahoo/uds-mobile/RadioGroup';
|
|
22
|
+
*
|
|
23
|
+
* <RadioGroup value={value} onChange={setValue}>
|
|
24
|
+
* <Radio value="email" label="Email" />
|
|
25
|
+
* <Radio value="sms" label="SMS" />
|
|
26
|
+
* </RadioGroup>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @accessibility
|
|
30
|
+
* - Sets `accessibilityRole="radiogroup"` automatically
|
|
31
|
+
* - Child Radio components keep `accessibilityRole="radio"` and checked state
|
|
32
|
+
*/
|
|
33
|
+
const RadioGroup = (0, react.memo)(function RadioGroup({ name, value: valueProp, defaultValue, onChange, disabled, hasError, reduceMotion, size, variant, nativeID, flexDirection = "column", accessibilityState, children, ref, ...boxProps }) {
|
|
34
|
+
const isControlled = valueProp !== void 0;
|
|
35
|
+
const [internalValue, setInternalValue] = (0, react.useState)(defaultValue);
|
|
36
|
+
const value = isControlled ? valueProp : internalValue;
|
|
37
|
+
const setValue = (0, react.useCallback)((nextValue) => {
|
|
38
|
+
if (nextValue === value) return;
|
|
39
|
+
if (!isControlled) setInternalValue(nextValue);
|
|
40
|
+
onChange?.(nextValue);
|
|
41
|
+
}, [
|
|
42
|
+
isControlled,
|
|
43
|
+
onChange,
|
|
44
|
+
value
|
|
45
|
+
]);
|
|
46
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
47
|
+
name,
|
|
48
|
+
value,
|
|
49
|
+
disabled,
|
|
50
|
+
hasError,
|
|
51
|
+
reduceMotion,
|
|
52
|
+
size,
|
|
53
|
+
variant,
|
|
54
|
+
setValue
|
|
55
|
+
}), [
|
|
56
|
+
name,
|
|
57
|
+
value,
|
|
58
|
+
disabled,
|
|
59
|
+
hasError,
|
|
60
|
+
reduceMotion,
|
|
61
|
+
size,
|
|
62
|
+
variant,
|
|
63
|
+
setValue
|
|
64
|
+
]);
|
|
65
|
+
const groupAccessibilityState = (0, react.useMemo)(() => ({
|
|
66
|
+
...accessibilityState,
|
|
67
|
+
disabled: accessibilityState?.disabled ?? disabled
|
|
68
|
+
}), [accessibilityState, disabled]);
|
|
69
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Radio_RadioGroupContext.RadioGroupContext.Provider, {
|
|
70
|
+
value: contextValue,
|
|
71
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
72
|
+
ref,
|
|
73
|
+
nativeID: nativeID ?? name,
|
|
74
|
+
accessibilityRole: "radiogroup",
|
|
75
|
+
accessibilityState: groupAccessibilityState,
|
|
76
|
+
flexDirection,
|
|
77
|
+
...boxProps,
|
|
78
|
+
children
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
RadioGroup.displayName = "RadioGroup";
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioSize, RadioVariant, UniversalRadioGroupProps } from "../../types/dist/index.cjs";
|
|
3
|
+
import { BoxProps } from "../Box.cjs";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { Ref } from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
|
|
8
|
+
//#region src/components/Radio/RadioGroup.d.ts
|
|
9
|
+
interface RadioGroupProps extends Omit<BoxProps, 'ref' | 'onChange'>, Omit<UniversalRadioGroupProps, 'asChild' | 'onChange'> {
|
|
10
|
+
/** Ref to the underlying View */
|
|
11
|
+
ref?: Ref<View>;
|
|
12
|
+
/** Callback fired when the selected value changes */
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
/** Whether every radio in the group is disabled */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Whether radios in the group should render in an error state */
|
|
17
|
+
hasError?: boolean;
|
|
18
|
+
/** Disable motion and transition effects for radios in the group */
|
|
19
|
+
reduceMotion?: boolean;
|
|
20
|
+
/** Shared radio size. Child Radio props can override this. */
|
|
21
|
+
size?: RadioSize;
|
|
22
|
+
/** Shared radio variant. Child Radio props can override this. */
|
|
23
|
+
variant?: RadioVariant;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* **⚙️ A radio group component**
|
|
27
|
+
*
|
|
28
|
+
* @description
|
|
29
|
+
* A radio group coordinates multiple Radio components so one option can be selected at a time.
|
|
30
|
+
*
|
|
31
|
+
* @category Form
|
|
32
|
+
* @platform mobile
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
37
|
+
* import { RadioGroup } from '@yahoo/uds-mobile/RadioGroup';
|
|
38
|
+
*
|
|
39
|
+
* <RadioGroup value={value} onChange={setValue}>
|
|
40
|
+
* <Radio value="email" label="Email" />
|
|
41
|
+
* <Radio value="sms" label="SMS" />
|
|
42
|
+
* </RadioGroup>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @accessibility
|
|
46
|
+
* - Sets `accessibilityRole="radiogroup"` automatically
|
|
47
|
+
* - Child Radio components keep `accessibilityRole="radio"` and checked state
|
|
48
|
+
*/
|
|
49
|
+
declare const RadioGroup: _$react.NamedExoticComponent<RadioGroupProps>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { RadioGroup, type RadioGroupProps };
|
|
52
|
+
//# sourceMappingURL=RadioGroup.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.cts","names":[],"sources":["../../../src/components/Radio/RadioGroup.tsx"],"mappings":";;;;;;;;UASU,eAAA,SAEN,IAAA,CAAK,QAAA,uBACL,IAAA,CAAK,wBAAA;;EAEP,GAAA,GAAM,GAAA,CAAI,IAAA;EALF;EAOR,QAAA,IAAY,KAAA;;EAEZ,QAAA;EANO;EAQP,QAAA;EANM;EAQN,YAAA;EAIU;EAFV,IAAA,GAAO,SAAA;EAZL;EAcF,OAAA,GAAU,YAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAY;;;;;;cA2BlB,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioSize, RadioVariant, UniversalRadioGroupProps } from "../../types/dist/index.js";
|
|
3
|
+
import { BoxProps } from "../Box.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { Ref } from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
|
|
8
|
+
//#region src/components/Radio/RadioGroup.d.ts
|
|
9
|
+
interface RadioGroupProps extends Omit<BoxProps, 'ref' | 'onChange'>, Omit<UniversalRadioGroupProps, 'asChild' | 'onChange'> {
|
|
10
|
+
/** Ref to the underlying View */
|
|
11
|
+
ref?: Ref<View>;
|
|
12
|
+
/** Callback fired when the selected value changes */
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
/** Whether every radio in the group is disabled */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Whether radios in the group should render in an error state */
|
|
17
|
+
hasError?: boolean;
|
|
18
|
+
/** Disable motion and transition effects for radios in the group */
|
|
19
|
+
reduceMotion?: boolean;
|
|
20
|
+
/** Shared radio size. Child Radio props can override this. */
|
|
21
|
+
size?: RadioSize;
|
|
22
|
+
/** Shared radio variant. Child Radio props can override this. */
|
|
23
|
+
variant?: RadioVariant;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* **⚙️ A radio group component**
|
|
27
|
+
*
|
|
28
|
+
* @description
|
|
29
|
+
* A radio group coordinates multiple Radio components so one option can be selected at a time.
|
|
30
|
+
*
|
|
31
|
+
* @category Form
|
|
32
|
+
* @platform mobile
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
37
|
+
* import { RadioGroup } from '@yahoo/uds-mobile/RadioGroup';
|
|
38
|
+
*
|
|
39
|
+
* <RadioGroup value={value} onChange={setValue}>
|
|
40
|
+
* <Radio value="email" label="Email" />
|
|
41
|
+
* <Radio value="sms" label="SMS" />
|
|
42
|
+
* </RadioGroup>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @accessibility
|
|
46
|
+
* - Sets `accessibilityRole="radiogroup"` automatically
|
|
47
|
+
* - Child Radio components keep `accessibilityRole="radio"` and checked state
|
|
48
|
+
*/
|
|
49
|
+
declare const RadioGroup: _$react.NamedExoticComponent<RadioGroupProps>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { RadioGroup, type RadioGroupProps };
|
|
52
|
+
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","names":[],"sources":["../../../src/components/Radio/RadioGroup.tsx"],"mappings":";;;;;;;;UASU,eAAA,SAEN,IAAA,CAAK,QAAA,uBACL,IAAA,CAAK,wBAAA;;EAEP,GAAA,GAAM,GAAA,CAAI,IAAA;EALF;EAOR,QAAA,IAAY,KAAA;;EAEZ,QAAA;EANO;EAQP,QAAA;EANM;EAQN,YAAA;EAIU;EAFV,IAAA,GAAO,SAAA;EAZL;EAcF,OAAA,GAAU,YAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAY;;;;;;cA2BlB,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Box } from "../Box.js";
|
|
3
|
+
import { RadioGroupContext } from "./RadioGroupContext.js";
|
|
4
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Radio/RadioGroup.tsx
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️ A radio group component**
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* A radio group coordinates multiple Radio components so one option can be selected at a time.
|
|
12
|
+
*
|
|
13
|
+
* @category Form
|
|
14
|
+
* @platform mobile
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
19
|
+
* import { RadioGroup } from '@yahoo/uds-mobile/RadioGroup';
|
|
20
|
+
*
|
|
21
|
+
* <RadioGroup value={value} onChange={setValue}>
|
|
22
|
+
* <Radio value="email" label="Email" />
|
|
23
|
+
* <Radio value="sms" label="SMS" />
|
|
24
|
+
* </RadioGroup>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @accessibility
|
|
28
|
+
* - Sets `accessibilityRole="radiogroup"` automatically
|
|
29
|
+
* - Child Radio components keep `accessibilityRole="radio"` and checked state
|
|
30
|
+
*/
|
|
31
|
+
const RadioGroup = memo(function RadioGroup({ name, value: valueProp, defaultValue, onChange, disabled, hasError, reduceMotion, size, variant, nativeID, flexDirection = "column", accessibilityState, children, ref, ...boxProps }) {
|
|
32
|
+
const isControlled = valueProp !== void 0;
|
|
33
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
34
|
+
const value = isControlled ? valueProp : internalValue;
|
|
35
|
+
const setValue = useCallback((nextValue) => {
|
|
36
|
+
if (nextValue === value) return;
|
|
37
|
+
if (!isControlled) setInternalValue(nextValue);
|
|
38
|
+
onChange?.(nextValue);
|
|
39
|
+
}, [
|
|
40
|
+
isControlled,
|
|
41
|
+
onChange,
|
|
42
|
+
value
|
|
43
|
+
]);
|
|
44
|
+
const contextValue = useMemo(() => ({
|
|
45
|
+
name,
|
|
46
|
+
value,
|
|
47
|
+
disabled,
|
|
48
|
+
hasError,
|
|
49
|
+
reduceMotion,
|
|
50
|
+
size,
|
|
51
|
+
variant,
|
|
52
|
+
setValue
|
|
53
|
+
}), [
|
|
54
|
+
name,
|
|
55
|
+
value,
|
|
56
|
+
disabled,
|
|
57
|
+
hasError,
|
|
58
|
+
reduceMotion,
|
|
59
|
+
size,
|
|
60
|
+
variant,
|
|
61
|
+
setValue
|
|
62
|
+
]);
|
|
63
|
+
const groupAccessibilityState = useMemo(() => ({
|
|
64
|
+
...accessibilityState,
|
|
65
|
+
disabled: accessibilityState?.disabled ?? disabled
|
|
66
|
+
}), [accessibilityState, disabled]);
|
|
67
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
|
|
68
|
+
value: contextValue,
|
|
69
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
70
|
+
ref,
|
|
71
|
+
nativeID: nativeID ?? name,
|
|
72
|
+
accessibilityRole: "radiogroup",
|
|
73
|
+
accessibilityState: groupAccessibilityState,
|
|
74
|
+
flexDirection,
|
|
75
|
+
...boxProps,
|
|
76
|
+
children
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
RadioGroup.displayName = "RadioGroup";
|
|
81
|
+
//#endregion
|
|
82
|
+
export { RadioGroup };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":[],"sources":["../../../src/components/Radio/RadioGroup.tsx"],"sourcesContent":["import type { RadioSize, RadioVariant, UniversalRadioGroupProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\n\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport { RadioGroupContext } from './RadioGroupContext';\n\ninterface RadioGroupProps\n extends\n Omit<BoxProps, 'ref' | 'onChange'>,\n Omit<UniversalRadioGroupProps, 'asChild' | 'onChange'> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Callback fired when the selected value changes */\n onChange?: (value: string) => void;\n /** Whether every radio in the group is disabled */\n disabled?: boolean;\n /** Whether radios in the group should render in an error state */\n hasError?: boolean;\n /** Disable motion and transition effects for radios in the group */\n reduceMotion?: boolean;\n /** Shared radio size. Child Radio props can override this. */\n size?: RadioSize;\n /** Shared radio variant. Child Radio props can override this. */\n variant?: RadioVariant;\n}\n\n/**\n * **⚙️ A radio group component**\n *\n * @description\n * A radio group coordinates multiple Radio components so one option can be selected at a time.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Radio } from '@yahoo/uds-mobile/Radio';\n * import { RadioGroup } from '@yahoo/uds-mobile/RadioGroup';\n *\n * <RadioGroup value={value} onChange={setValue}>\n * <Radio value=\"email\" label=\"Email\" />\n * <Radio value=\"sms\" label=\"SMS\" />\n * </RadioGroup>\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"radiogroup\"` automatically\n * - Child Radio components keep `accessibilityRole=\"radio\"` and checked state\n */\nconst RadioGroup = memo(function RadioGroup({\n name,\n value: valueProp,\n defaultValue,\n onChange,\n disabled,\n hasError,\n reduceMotion,\n size,\n variant,\n nativeID,\n flexDirection = 'column',\n accessibilityState,\n children,\n ref,\n ...boxProps\n}: RadioGroupProps) {\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<string | undefined>(defaultValue);\n const value = isControlled ? valueProp : internalValue;\n\n const setValue = useCallback(\n (nextValue: string) => {\n if (nextValue === value) {\n return;\n }\n\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n\n onChange?.(nextValue);\n },\n [isControlled, onChange, value],\n );\n\n const contextValue = useMemo(\n () => ({\n name,\n value,\n disabled,\n hasError,\n reduceMotion,\n size,\n variant,\n setValue,\n }),\n [name, value, disabled, hasError, reduceMotion, size, variant, setValue],\n );\n\n const groupAccessibilityState = useMemo(\n () => ({\n ...accessibilityState,\n disabled: accessibilityState?.disabled ?? disabled,\n }),\n [accessibilityState, disabled],\n );\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <Box\n ref={ref}\n nativeID={nativeID ?? name}\n accessibilityRole=\"radiogroup\"\n accessibilityState={groupAccessibilityState}\n flexDirection={flexDirection}\n {...boxProps}\n >\n {children}\n </Box>\n </RadioGroupContext.Provider>\n );\n});\n\nRadioGroup.displayName = 'RadioGroup';\n\nexport { RadioGroup, type RadioGroupProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,aAAa,KAAK,SAAS,WAAW,EAC1C,MACA,OAAO,WACP,cACA,UACA,UACA,UACA,cACA,MACA,SACA,UACA,gBAAgB,UAChB,oBACA,UACA,KACA,GAAG,YACe;CAClB,MAAM,eAAe,cAAc,KAAA;CACnC,MAAM,CAAC,eAAe,oBAAoB,SAA6B,aAAa;CACpF,MAAM,QAAQ,eAAe,YAAY;CAEzC,MAAM,WAAW,aACd,cAAsB;EACrB,IAAI,cAAc,OAChB;EAGF,IAAI,CAAC,cACH,iBAAiB,UAAU;EAG7B,WAAW,UAAU;IAEvB;EAAC;EAAc;EAAU;EAAM,CAChC;CAED,MAAM,eAAe,eACZ;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EAAC;EAAM;EAAO;EAAU;EAAU;EAAc;EAAM;EAAS;EAAS,CACzE;CAED,MAAM,0BAA0B,eACvB;EACL,GAAG;EACH,UAAU,oBAAoB,YAAY;EAC3C,GACD,CAAC,oBAAoB,SAAS,CAC/B;CAED,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;YACjC,oBAAC,KAAD;GACO;GACL,UAAU,YAAY;GACtB,mBAAkB;GAClB,oBAAoB;GACL;GACf,GAAI;GAEH;GACG,CAAA;EACqB,CAAA;EAE/B;AAEF,WAAW,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
//#region src/components/Radio/RadioGroupContext.ts
|
|
6
|
+
const RadioGroupContext = (0, react.createContext)(void 0);
|
|
7
|
+
function useRadioGroupContext() {
|
|
8
|
+
return (0, react.useContext)(RadioGroupContext);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.RadioGroupContext = RadioGroupContext;
|
|
12
|
+
exports.useRadioGroupContext = useRadioGroupContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioSize, RadioVariant } from "../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Radio/RadioGroupContext.d.ts
|
|
6
|
+
interface RadioGroupContextValue {
|
|
7
|
+
name?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hasError?: boolean;
|
|
11
|
+
reduceMotion?: boolean;
|
|
12
|
+
size?: RadioSize;
|
|
13
|
+
variant?: RadioVariant;
|
|
14
|
+
setValue: (value: string) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const RadioGroupContext: _$react.Context<RadioGroupContextValue | undefined>;
|
|
17
|
+
declare function useRadioGroupContext(): RadioGroupContextValue | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { RadioGroupContext, type RadioGroupContextValue, useRadioGroupContext };
|
|
20
|
+
//# sourceMappingURL=RadioGroupContext.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroupContext.d.cts","names":[],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"mappings":";;;;;UAGU,sBAAA;EACR,IAAA;EACA,KAAA;EACA,QAAA;EACA,QAAA;EACA,YAAA;EACA,IAAA,GAAO,SAAA;EACP,OAAA,GAAU,YAAA;EACV,QAAA,GAAW,KAAA;AAAA;AAAA,cAGP,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,iBAEd,oBAAA,CAAA,GAAoB,sBAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioSize, RadioVariant } from "../../types/dist/index.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Radio/RadioGroupContext.d.ts
|
|
6
|
+
interface RadioGroupContextValue {
|
|
7
|
+
name?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hasError?: boolean;
|
|
11
|
+
reduceMotion?: boolean;
|
|
12
|
+
size?: RadioSize;
|
|
13
|
+
variant?: RadioVariant;
|
|
14
|
+
setValue: (value: string) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const RadioGroupContext: _$react.Context<RadioGroupContextValue | undefined>;
|
|
17
|
+
declare function useRadioGroupContext(): RadioGroupContextValue | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { RadioGroupContext, type RadioGroupContextValue, useRadioGroupContext };
|
|
20
|
+
//# sourceMappingURL=RadioGroupContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroupContext.d.ts","names":[],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"mappings":";;;;;UAGU,sBAAA;EACR,IAAA;EACA,KAAA;EACA,QAAA;EACA,QAAA;EACA,YAAA;EACA,IAAA,GAAO,SAAA;EACP,OAAA,GAAU,YAAA;EACV,QAAA,GAAW,KAAA;AAAA;AAAA,cAGP,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,iBAEd,oBAAA,CAAA,GAAoB,sBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
//#region src/components/Radio/RadioGroupContext.ts
|
|
4
|
+
const RadioGroupContext = createContext(void 0);
|
|
5
|
+
function useRadioGroupContext() {
|
|
6
|
+
return useContext(RadioGroupContext);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { RadioGroupContext, useRadioGroupContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=RadioGroupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroupContext.js","names":[],"sources":["../../../src/components/Radio/RadioGroupContext.ts"],"sourcesContent":["import type { RadioSize, RadioVariant } from '@yahoo/uds-types';\nimport { createContext, useContext } from 'react';\n\ninterface RadioGroupContextValue {\n name?: string;\n value?: string;\n disabled?: boolean;\n hasError?: boolean;\n reduceMotion?: boolean;\n size?: RadioSize;\n variant?: RadioVariant;\n setValue: (value: string) => void;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | undefined>(undefined);\n\nfunction useRadioGroupContext() {\n return useContext(RadioGroupContext);\n}\n\nexport { RadioGroupContext, type RadioGroupContextValue, useRadioGroupContext };\n"],"mappings":";;;AAcA,MAAM,oBAAoB,cAAkD,KAAA,EAAU;AAEtF,SAAS,uBAAuB;CAC9B,OAAO,WAAW,kBAAkB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_components_Radio_Radio = require("./Radio.cjs");
|
|
4
|
+
const require_components_Radio_RadioGroup = require("./RadioGroup.cjs");
|
|
5
|
+
exports.Radio = require_components_Radio_Radio.Radio;
|
|
6
|
+
exports.RadioGroup = require_components_Radio_RadioGroup.RadioGroup;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
5
|
-
const
|
|
6
|
-
const require_components_HStack = require("./HStack.cjs");
|
|
5
|
+
const require_components_FormLabel = require("./FormLabel.cjs");
|
|
7
6
|
let react = require("react");
|
|
8
7
|
let react_native = require("react-native");
|
|
9
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -104,17 +103,13 @@ const Switch = (0, react.memo)(function Switch({ isOn: isOnProp, defaultIsOn = f
|
|
|
104
103
|
], [generated_styles.switchStyles.handle, animatedHandleStyle]);
|
|
105
104
|
const accessibilityLabel = typeof label === "string" ? label : void 0;
|
|
106
105
|
const resolvedAccessibilityHint = accessibilityHint ?? "Double tap to toggle";
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}), required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
115
|
-
color: "alert",
|
|
116
|
-
children: "*"
|
|
117
|
-
})]
|
|
106
|
+
const labelContent = label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
|
|
107
|
+
color: "inherit",
|
|
108
|
+
variant: "inherit",
|
|
109
|
+
label,
|
|
110
|
+
required,
|
|
111
|
+
showRequiredAsterisk: required,
|
|
112
|
+
style: generated_styles.switchStyles.text
|
|
118
113
|
});
|
|
119
114
|
const a11yValue = (0, react.useMemo)(() => ({ text: isOn ? "On" : "Off" }), [isOn]);
|
|
120
115
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Pressable, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.cts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"Switch.d.cts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;UAcU,WAAA,SAAoB,IAAA,CAAK,SAAA,YAAqB,oBAAA,CAAqB,YAAA;;EAE3E,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,QAAA,IAAY,KAAA;;EAEZ,QAAA;EAN2E;EAQ3E,QAAA;EANM;EAQN,iBAAA,GAAoB,kBAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAkB;;;;;;;;;;;;;;;cA2ClC,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","names":[],"sources":["../../src/components/Switch.tsx"],"mappings":";;;;;;;;UAcU,WAAA,SAAoB,IAAA,CAAK,SAAA,YAAqB,oBAAA,CAAqB,YAAA;;EAE3E,GAAA,GAAM,GAAA,CAAI,IAAA;EAFF;EAIR,QAAA,IAAY,KAAA;;EAEZ,QAAA;EAN2E;EAQ3E,QAAA;EANM;EAQN,iBAAA,GAAoB,kBAAA;AAAA;;;;;;;;;;;;;;;;;;;AAAkB;;;;;;;;;;;;;;;cA2ClC,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { IconSlot } from "./IconSlot.js";
|
|
3
|
-
import {
|
|
4
|
-
import { HStack } from "./HStack.js";
|
|
3
|
+
import { FormLabel } from "./FormLabel.js";
|
|
5
4
|
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
6
5
|
import { AccessibilityInfo, Pressable } from "react-native";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -101,17 +100,13 @@ const Switch = memo(function Switch({ isOn: isOnProp, defaultIsOn = false, onCha
|
|
|
101
100
|
], [switchStyles.handle, animatedHandleStyle]);
|
|
102
101
|
const accessibilityLabel = typeof label === "string" ? label : void 0;
|
|
103
102
|
const resolvedAccessibilityHint = accessibilityHint ?? "Double tap to toggle";
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}), required && /* @__PURE__ */ jsx(Text$1, {
|
|
112
|
-
color: "alert",
|
|
113
|
-
children: "*"
|
|
114
|
-
})]
|
|
103
|
+
const labelContent = label && /* @__PURE__ */ jsx(FormLabel, {
|
|
104
|
+
color: "inherit",
|
|
105
|
+
variant: "inherit",
|
|
106
|
+
label,
|
|
107
|
+
required,
|
|
108
|
+
showRequiredAsterisk: required,
|
|
109
|
+
style: switchStyles.text
|
|
115
110
|
});
|
|
116
111
|
const a11yValue = useMemo(() => ({ text: isOn ? "On" : "Off" }), [isOn]);
|
|
117
112
|
return /* @__PURE__ */ jsxs(Pressable, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","names":["Text","StyleSheet"],"sources":["../../src/components/Switch.tsx"],"sourcesContent":["import type { SwitchSize, UniversalSwitchProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { AccessibilityProps, StyleProp, View, ViewProps, ViewStyle } from 'react-native';\nimport { AccessibilityInfo, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';\nimport { StyleSheet } from 'react-native-unistyles';\nimport { useAnimatedVariantColor } from 'react-native-unistyles/reanimated';\n\nimport { switchStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\ninterface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<IconSlotType> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Callback when the switch value changes */\n onChange?: (value: boolean) => void;\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Whether the switch is required (shows asterisk with label) */\n required?: boolean;\n /** Accessibility hint describing what happens when activated */\n accessibilityHint?: AccessibilityProps['accessibilityHint'];\n}\n\nconst HANDLE_TRAVEL: Record<SwitchSize, number> = {\n md: 20,\n sm: 12,\n};\n\nconst ANIMATION_DURATION = 120;\n\n/**\n * **Switch component for toggling options**\n *\n * @description\n * A switch (also called a toggle) is a binary on/off input control.\n * It allows users to pick between two clearly opposite choices.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Switch } from '@yahoo/uds-mobile/Switch';\n *\n * <Switch label=\"Notifications\" />\n * <Switch isOn={enabled} onChange={setEnabled} label=\"Dark mode\" />\n * <Switch onIcon=\"Check\" offIcon=\"Cross\" label=\"Sync\" />\n * ```\n *\n * @usage\n * - Settings: For toggling preferences on/off\n * - Feature flags: For enabling/disabling features\n * - Immediate effect toggles (no submit button needed)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"switch\"` automatically\n * - Announces on/off state to screen readers\n * - Respects system reduce motion preference\n * - Supports `reduceMotion` prop to disable animations\n *\n * @see {@link Checkbox} for forms with submit actions\n * @see {@link Radio} for single-select options\n */\nconst Switch = memo(function Switch({\n isOn: isOnProp,\n defaultIsOn = false,\n onChange,\n label,\n labelPosition = 'start',\n size = 'md',\n onIcon,\n offIcon,\n disabled = false,\n required,\n accessibilityHint,\n reduceMotion = false,\n ref,\n ...viewProps\n}: SwitchProps) {\n const isControlled = isOnProp !== undefined;\n const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n const isOn = isControlled ? isOnProp : internalIsOn;\n\n // Check system reduced motion preference\n useEffect(() => {\n const checkReducedMotion = async () => {\n const isReduceMotionEnabled = await AccessibilityInfo.isReduceMotionEnabled();\n setPrefersReducedMotion(isReduceMotionEnabled);\n };\n checkReducedMotion();\n\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setPrefersReducedMotion,\n );\n return () => subscription.remove();\n }, []);\n\n const shouldReduceMotion = reduceMotion || prefersReducedMotion;\n const animationDuration = shouldReduceMotion ? 0 : ANIMATION_DURATION;\n\n const progress = useDerivedValue(\n () => withTiming(isOn ? 1 : 0, { duration: animationDuration }),\n [isOn, animationDuration],\n );\n\n const travelDistance = HANDLE_TRAVEL[size];\n\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newValue = !isOn;\n\n if (!isControlled) {\n setInternalIsOn(newValue);\n }\n\n onChange?.(newValue);\n }, [disabled, isOn, isControlled, onChange]);\n\n switchStyles.useVariants({\n size,\n variant: isOn ? 'on' : 'off',\n });\n\n // Get animated track color from design tokens (changes when variant changes)\n const trackBackgroundColor = useAnimatedVariantColor(switchStyles.switch, 'backgroundColor');\n\n const animatedTrackStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n backgroundColor: withTiming(trackBackgroundColor.value, { duration: animationDuration }),\n };\n });\n\n const animatedHandleStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n transform: [{ translateX: progress.value * travelDistance }],\n };\n });\n\n const rootStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.root, switchStaticStyles.root({ disabled })],\n [switchStyles.root, disabled],\n );\n\n const trackStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.switch, switchStaticStyles.track, animatedTrackStyle],\n [switchStyles.switch, animatedTrackStyle],\n );\n\n const handleStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.handle, switchStaticStyles.handle, animatedHandleStyle],\n [switchStyles.handle, animatedHandleStyle],\n );\n\n const accessibilityLabel = typeof label === 'string' ? label : undefined;\n const resolvedAccessibilityHint = accessibilityHint ?? 'Double tap to toggle';\n\n const resolvedLabel = typeof label === 'function' ? label() : label;\n const labelContent = resolvedLabel && (\n <HStack gap=\"2\" alignItems=\"center\">\n <Text style={switchStyles.text}>{resolvedLabel}</Text>\n {required && <Text color=\"alert\">*</Text>}\n </HStack>\n );\n\n const a11yValue = useMemo(() => ({ text: isOn ? 'On' : 'Off' }), [isOn]);\n\n return (\n <Pressable\n ref={ref}\n onPress={handlePress}\n disabled={disabled}\n accessible\n accessibilityRole=\"switch\"\n accessibilityState={{ checked: isOn, disabled }}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={resolvedAccessibilityHint}\n accessibilityValue={a11yValue}\n {...viewProps}\n style={rootStyle}\n >\n {labelPosition === 'start' && labelContent}\n\n <Animated.View style={trackStyle} importantForAccessibility=\"no-hide-descendants\">\n <Animated.View style={handleStyle}>\n {onIcon && isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={onIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n {offIcon && !isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={offIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n </Animated.View>\n </Animated.View>\n\n {labelPosition === 'end' && labelContent}\n </Pressable>\n );\n});\n\nSwitch.displayName = 'Switch';\n\nconst switchStaticStyles = StyleSheet.create((theme) => ({\n handle: {\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n },\n iconContainer: {\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n },\n track: {\n justifyContent: 'center',\n borderRadius: theme.borderRadius.full,\n },\n root: ({ disabled }: { disabled: boolean }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'flex-start',\n opacity: disabled ? 0.5 : 1,\n }),\n}));\n\nexport { Switch, type SwitchProps };\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,gBAA4C;CAChD,IAAI;CACJ,IAAI;CACL;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmC3B,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,MAAM,UACN,cAAc,OACd,UACA,OACA,gBAAgB,SAChB,OAAO,MACP,QACA,SACA,WAAW,OACX,UACA,mBACA,eAAe,OACf,KACA,GAAG,aACW;CAC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ACvD,QAAQ;EACN,cAAc,MAAM,aAAa;EACjC,YAAY;EACZ,gBAAgB;EACjB;CACD,eAAe;EACb,UAAU;EACV,YAAY;EACZ,gBAAgB;EACjB;CACD,OAAO;EACL,gBAAgB;EAChB,cAAc,MAAM,aAAa;EAClC;CACD,OAAO,EAAE,gBAAuC;EAC9C,eAAe;EACf,YAAY;EACZ,WAAW;EACX,SAAS,WAAW,KAAM;EAC3B;CACF,EAAE"}
|
|
1
|
+
{"version":3,"file":"Switch.js","names":["StyleSheet"],"sources":["../../src/components/Switch.tsx"],"sourcesContent":["import type { SwitchSize, UniversalSwitchProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { AccessibilityProps, StyleProp, View, ViewProps, ViewStyle } from 'react-native';\nimport { AccessibilityInfo, Pressable } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';\nimport { StyleSheet } from 'react-native-unistyles';\nimport { useAnimatedVariantColor } from 'react-native-unistyles/reanimated';\n\nimport { switchStyles } from '../../generated/styles';\nimport { FormLabel } from './FormLabel';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\n\ninterface SwitchProps extends Omit<ViewProps, 'style'>, UniversalSwitchProps<IconSlotType> {\n /** Ref to the underlying View */\n ref?: Ref<View>;\n /** Callback when the switch value changes */\n onChange?: (value: boolean) => void;\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Whether the switch is required (shows asterisk with label) */\n required?: boolean;\n /** Accessibility hint describing what happens when activated */\n accessibilityHint?: AccessibilityProps['accessibilityHint'];\n}\n\nconst HANDLE_TRAVEL: Record<SwitchSize, number> = {\n md: 20,\n sm: 12,\n};\n\nconst ANIMATION_DURATION = 120;\n\n/**\n * **Switch component for toggling options**\n *\n * @description\n * A switch (also called a toggle) is a binary on/off input control.\n * It allows users to pick between two clearly opposite choices.\n *\n * @category Form\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Switch } from '@yahoo/uds-mobile/Switch';\n *\n * <Switch label=\"Notifications\" />\n * <Switch isOn={enabled} onChange={setEnabled} label=\"Dark mode\" />\n * <Switch onIcon=\"Check\" offIcon=\"Cross\" label=\"Sync\" />\n * ```\n *\n * @usage\n * - Settings: For toggling preferences on/off\n * - Feature flags: For enabling/disabling features\n * - Immediate effect toggles (no submit button needed)\n *\n * @accessibility\n * - Sets `accessibilityRole=\"switch\"` automatically\n * - Announces on/off state to screen readers\n * - Respects system reduce motion preference\n * - Supports `reduceMotion` prop to disable animations\n *\n * @see {@link Checkbox} for forms with submit actions\n * @see {@link Radio} for single-select options\n */\nconst Switch = memo(function Switch({\n isOn: isOnProp,\n defaultIsOn = false,\n onChange,\n label,\n labelPosition = 'start',\n size = 'md',\n onIcon,\n offIcon,\n disabled = false,\n required,\n accessibilityHint,\n reduceMotion = false,\n ref,\n ...viewProps\n}: SwitchProps) {\n const isControlled = isOnProp !== undefined;\n const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n const isOn = isControlled ? isOnProp : internalIsOn;\n\n // Check system reduced motion preference\n useEffect(() => {\n const checkReducedMotion = async () => {\n const isReduceMotionEnabled = await AccessibilityInfo.isReduceMotionEnabled();\n setPrefersReducedMotion(isReduceMotionEnabled);\n };\n checkReducedMotion();\n\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setPrefersReducedMotion,\n );\n return () => subscription.remove();\n }, []);\n\n const shouldReduceMotion = reduceMotion || prefersReducedMotion;\n const animationDuration = shouldReduceMotion ? 0 : ANIMATION_DURATION;\n\n const progress = useDerivedValue(\n () => withTiming(isOn ? 1 : 0, { duration: animationDuration }),\n [isOn, animationDuration],\n );\n\n const travelDistance = HANDLE_TRAVEL[size];\n\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n const newValue = !isOn;\n\n if (!isControlled) {\n setInternalIsOn(newValue);\n }\n\n onChange?.(newValue);\n }, [disabled, isOn, isControlled, onChange]);\n\n switchStyles.useVariants({\n size,\n variant: isOn ? 'on' : 'off',\n });\n\n // Get animated track color from design tokens (changes when variant changes)\n const trackBackgroundColor = useAnimatedVariantColor(switchStyles.switch, 'backgroundColor');\n\n const animatedTrackStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n backgroundColor: withTiming(trackBackgroundColor.value, { duration: animationDuration }),\n };\n });\n\n const animatedHandleStyle = useAnimatedStyle(() => {\n 'worklet';\n return {\n transform: [{ translateX: progress.value * travelDistance }],\n };\n });\n\n const rootStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.root, switchStaticStyles.root({ disabled })],\n [switchStyles.root, disabled],\n );\n\n const trackStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.switch, switchStaticStyles.track, animatedTrackStyle],\n [switchStyles.switch, animatedTrackStyle],\n );\n\n const handleStyle: StyleProp<ViewStyle> = useMemo(\n () => [switchStyles.handle, switchStaticStyles.handle, animatedHandleStyle],\n [switchStyles.handle, animatedHandleStyle],\n );\n\n const accessibilityLabel = typeof label === 'string' ? label : undefined;\n const resolvedAccessibilityHint = accessibilityHint ?? 'Double tap to toggle';\n\n const labelContent = label && (\n <FormLabel\n color=\"inherit\"\n variant=\"inherit\"\n label={label}\n required={required}\n showRequiredAsterisk={required}\n style={switchStyles.text}\n />\n );\n\n const a11yValue = useMemo(() => ({ text: isOn ? 'On' : 'Off' }), [isOn]);\n\n return (\n <Pressable\n ref={ref}\n onPress={handlePress}\n disabled={disabled}\n accessible\n accessibilityRole=\"switch\"\n accessibilityState={{ checked: isOn, disabled }}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={resolvedAccessibilityHint}\n accessibilityValue={a11yValue}\n {...viewProps}\n style={rootStyle}\n >\n {labelPosition === 'start' && labelContent}\n\n <Animated.View style={trackStyle} importantForAccessibility=\"no-hide-descendants\">\n <Animated.View style={handleStyle}>\n {onIcon && isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={onIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n {offIcon && !isOn && (\n <Animated.View style={switchStaticStyles.iconContainer}>\n <IconSlot icon={offIcon} variant=\"fill\" style={switchStyles.handleIcon} />\n </Animated.View>\n )}\n </Animated.View>\n </Animated.View>\n\n {labelPosition === 'end' && labelContent}\n </Pressable>\n );\n});\n\nSwitch.displayName = 'Switch';\n\nconst switchStaticStyles = StyleSheet.create((theme) => ({\n handle: {\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n },\n iconContainer: {\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n },\n track: {\n justifyContent: 'center',\n borderRadius: theme.borderRadius.full,\n },\n root: ({ disabled }: { disabled: boolean }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'flex-start',\n opacity: disabled ? 0.5 : 1,\n }),\n}));\n\nexport { Switch, type SwitchProps };\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,gBAA4C;CAChD,IAAI;CACJ,IAAI;CACL;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmC3B,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,MAAM,UACN,cAAc,OACd,UACA,OACA,gBAAgB,SAChB,OAAO,MACP,QACA,SACA,WAAW,OACX,UACA,mBACA,eAAe,OACf,KACA,GAAG,aACW;CACd,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,CAAC,cAAc,mBAAmB,SAAS,YAAY;CAC7D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,MAAM;CACvE,MAAM,OAAO,eAAe,WAAW;CAGvC,gBAAgB;EACd,MAAM,qBAAqB,YAAY;GAErC,wBAAwB,MADY,kBAAkB,uBAAuB,CAC/B;;EAEhD,oBAAoB;EAEpB,MAAM,eAAe,kBAAkB,iBACrC,uBACA,wBACD;EACD,aAAa,aAAa,QAAQ;IACjC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,MAAM,YAAY,eAAe,EAAE,MAAM,OAAO,OAAO,OAAO,GAAG,CAAC,KAAK,CAAC;CAExE,OACE,qBAAC,WAAD;EACO;EACL,SAAS;EACC;EACV,YAAA;EACA,mBAAkB;EAClB,oBAAoB;GAAE,SAAS;GAAM;GAAU;EAC3B;EACpB,mBAAmB;EACnB,oBAAoB;EACpB,GAAI;EACJ,OAAO;YAXT;GAaG,kBAAkB,WAAW;GAE9B,oBAAC,SAAS,MAAV;IAAe,OAAO;IAAY,2BAA0B;cAC1D,qBAAC,SAAS,MAAV;KAAe,OAAO;eAAtB,CACG,UAAU,QACT,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAQ,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC3D,CAAA,EAEjB,WAAW,CAAC,QACX,oBAAC,SAAS,MAAV;MAAe,OAAO,mBAAmB;gBACvC,oBAAC,UAAD;OAAU,MAAM;OAAS,SAAQ;OAAO,OAAO,aAAa;OAAc,CAAA;MAC5D,CAAA,CAEJ;;IACF,CAAA;GAEf,kBAAkB,SAAS;GAClB;;EAEd;AAEF,OAAO,cAAc;AAErB,MAAM,qBAAqBA,aAAW,QAAQ,WAAW;CACvD,QAAQ;EACN,cAAc,MAAM,aAAa;EACjC,YAAY;EACZ,gBAAgB;EACjB;CACD,eAAe;EACb,UAAU;EACV,YAAY;EACZ,gBAAgB;EACjB;CACD,OAAO;EACL,gBAAgB;EAChB,cAAc,MAAM,aAAa;EAClC;CACD,OAAO,EAAE,gBAAuC;EAC9C,eAAe;EACf,YAAY;EACZ,WAAW;EACX,SAAS,WAAW,KAAM;EAC3B;CACF,EAAE"}
|
package/dist/components/Text.cjs
CHANGED
|
@@ -36,14 +36,20 @@ let generated_styles = require("../../generated/styles");
|
|
|
36
36
|
*
|
|
37
37
|
* @see {@link Link} for interactive text links
|
|
38
38
|
*/
|
|
39
|
-
const Text = (0, react.memo)(function Text({ color = "primary", variant = "body1", fontFamily
|
|
39
|
+
const Text = (0, react.memo)(function Text({ color = "primary", variant = "body1", fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, textAlign, textTransform, textDecorationLine, style, backgroundColor, borderRadius, borderTopStartRadius, borderTopEndRadius, borderBottomStartRadius, borderBottomEndRadius, borderColor, borderStartColor, borderEndColor, borderTopColor, borderBottomColor, borderWidth, borderVerticalWidth, borderHorizontalWidth, borderStartWidth, borderEndWidth, borderTopWidth, borderBottomWidth, spacing, spacingHorizontal, spacingVertical, spacingBottom, spacingEnd, spacingStart, spacingTop, offset, offsetVertical, offsetHorizontal, offsetBottom, offsetEnd, offsetStart, offsetTop, flexShrink, verticalAlign, height, minHeight, maxHeight, width, minWidth, maxWidth, dangerouslySetColor, ref, ...props }) {
|
|
40
|
+
const resolvedColor = color === "inherit" ? void 0 : color;
|
|
41
|
+
const resolvedVariant = variant === "inherit" ? void 0 : variant;
|
|
42
|
+
const resolvedFontFamily = fontFamily ?? resolvedVariant;
|
|
43
|
+
const resolvedFontSize = fontSize ?? resolvedVariant;
|
|
44
|
+
const resolvedLineHeight = lineHeight ?? resolvedVariant;
|
|
45
|
+
const resolvedLetterSpacing = letterSpacing ?? resolvedVariant;
|
|
40
46
|
generated_styles.styles.useVariants({
|
|
41
|
-
color,
|
|
42
|
-
fontFamily,
|
|
43
|
-
fontSize,
|
|
47
|
+
color: resolvedColor,
|
|
48
|
+
fontFamily: resolvedFontFamily,
|
|
49
|
+
fontSize: resolvedFontSize,
|
|
44
50
|
fontWeight,
|
|
45
|
-
lineHeight,
|
|
46
|
-
letterSpacing,
|
|
51
|
+
lineHeight: resolvedLineHeight,
|
|
52
|
+
letterSpacing: resolvedLetterSpacing,
|
|
47
53
|
textAlign,
|
|
48
54
|
textTransform,
|
|
49
55
|
backgroundColor,
|
|
@@ -6,14 +6,15 @@ import { StyleProps } from "../../generated/styles";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/Text.d.ts
|
|
8
8
|
type TextVariant = Exclude<StyleProps['fontFamily'], 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono' | 'icons'>;
|
|
9
|
+
type TextVariantProp = TextVariant | 'inherit';
|
|
9
10
|
type TextDecorationLine = 'none' | 'underline' | 'line-through' | 'underline line-through';
|
|
10
11
|
interface TextProps extends TextProps$1 {
|
|
11
12
|
/** Ref to the underlying Text element */
|
|
12
13
|
ref?: Ref<Text$1>;
|
|
13
14
|
/** Text color from the theme palette */
|
|
14
|
-
color?: StyleProps['color'];
|
|
15
|
+
color?: StyleProps['color'] | 'inherit';
|
|
15
16
|
/** Typography variant - sets fontSize, lineHeight, letterSpacing, and fontFamily together */
|
|
16
|
-
variant?:
|
|
17
|
+
variant?: TextVariantProp;
|
|
17
18
|
/** Override the fontFamily independently */
|
|
18
19
|
fontFamily?: StyleProps['fontFamily'];
|
|
19
20
|
/** Override the fontSize independently */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.cts","names":[],"sources":["../../src/components/Text.tsx"],"mappings":";;;;;;;KASK,WAAA,GAAc,OAAA,CACjB,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Text.d.cts","names":[],"sources":["../../src/components/Text.tsx"],"mappings":";;;;;;;KASK,WAAA,GAAc,OAAA,CACjB,UAAA;AAAA,KAGG,eAAA,GAAkB,WAAA;AAAA,KAIlB,kBAAA;AAAA,UAEK,SAAA,SAAkB,WAAA;;EAE1B,GAAA,GAAM,GAAA,CAAI,MAAA;EAXA;EAaV,KAAA,GAAQ,UAAA;EAVU;EAYlB,OAAA,GAAU,eAAA;EAZW;EAcrB,UAAA,GAAa,UAAA;EAVV;EAYH,QAAA,GAAW,UAAA;;EAEX,UAAA,GAAa,UAAA;EAdQ;EAgBrB,UAAA,GAAa,UAAA;EAdK;EAgBlB,aAAA,GAAgB,UAAA;EAdN;EAgBV,SAAA,GAAY,UAAA;EAdJ;EAgBR,aAAA,GAAgB,UAAA;EAZH;EAcb,kBAAA,GAAqB,kBAAA;EAErB,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,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,UAAA,GAAa,UAAA;EAEb,aAAA,GAAgB,SAAA;EAEhB,MAAA;EACA,KAAA;EACA,SAAA;EACA,SAAA;EACA,QAAA;EACA,QAAA;EAEA,mBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCI,IAAA,EAAI,OAAA,CAAA,oBAAA,CAAA,SAAA"}
|
|
@@ -6,14 +6,15 @@ import { StyleProps } from "../../generated/styles";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/Text.d.ts
|
|
8
8
|
type TextVariant = Exclude<StyleProps['fontFamily'], 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono' | 'icons'>;
|
|
9
|
+
type TextVariantProp = TextVariant | 'inherit';
|
|
9
10
|
type TextDecorationLine = 'none' | 'underline' | 'line-through' | 'underline line-through';
|
|
10
11
|
interface TextProps extends TextProps$1 {
|
|
11
12
|
/** Ref to the underlying Text element */
|
|
12
13
|
ref?: Ref<Text$1>;
|
|
13
14
|
/** Text color from the theme palette */
|
|
14
|
-
color?: StyleProps['color'];
|
|
15
|
+
color?: StyleProps['color'] | 'inherit';
|
|
15
16
|
/** Typography variant - sets fontSize, lineHeight, letterSpacing, and fontFamily together */
|
|
16
|
-
variant?:
|
|
17
|
+
variant?: TextVariantProp;
|
|
17
18
|
/** Override the fontFamily independently */
|
|
18
19
|
fontFamily?: StyleProps['fontFamily'];
|
|
19
20
|
/** Override the fontSize independently */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","names":[],"sources":["../../src/components/Text.tsx"],"mappings":";;;;;;;KASK,WAAA,GAAc,OAAA,CACjB,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","names":[],"sources":["../../src/components/Text.tsx"],"mappings":";;;;;;;KASK,WAAA,GAAc,OAAA,CACjB,UAAA;AAAA,KAGG,eAAA,GAAkB,WAAA;AAAA,KAIlB,kBAAA;AAAA,UAEK,SAAA,SAAkB,WAAA;;EAE1B,GAAA,GAAM,GAAA,CAAI,MAAA;EAXA;EAaV,KAAA,GAAQ,UAAA;EAVU;EAYlB,OAAA,GAAU,eAAA;EAZW;EAcrB,UAAA,GAAa,UAAA;EAVV;EAYH,QAAA,GAAW,UAAA;;EAEX,UAAA,GAAa,UAAA;EAdQ;EAgBrB,UAAA,GAAa,UAAA;EAdK;EAgBlB,aAAA,GAAgB,UAAA;EAdN;EAgBV,SAAA,GAAY,UAAA;EAdJ;EAgBR,aAAA,GAAgB,UAAA;EAZH;EAcb,kBAAA,GAAqB,kBAAA;EAErB,eAAA,GAAkB,UAAA;EAElB,YAAA,GAAe,UAAA;EACf,oBAAA,GAAuB,UAAA;EACvB,kBAA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