@yahoo/uds-mobile 2.13.0 → 2.15.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/components/Avatar/Avatar.cjs +45 -0
- package/dist/components/Avatar/Avatar.d.cts +19 -0
- package/dist/components/Avatar/Avatar.d.cts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +19 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +45 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/AvatarIcon.cjs +47 -0
- package/dist/components/Avatar/AvatarIcon.d.cts +9 -0
- package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarIcon.d.ts +9 -0
- package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarIcon.js +47 -0
- package/dist/components/Avatar/AvatarIcon.js.map +1 -0
- package/dist/components/Avatar/AvatarImage.cjs +81 -0
- package/dist/components/Avatar/AvatarImage.d.cts +9 -0
- package/dist/components/Avatar/AvatarImage.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarImage.d.ts +9 -0
- package/dist/components/Avatar/AvatarImage.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarImage.js +81 -0
- package/dist/components/Avatar/AvatarImage.js.map +1 -0
- package/dist/components/Avatar/AvatarText.cjs +49 -0
- package/dist/components/Avatar/AvatarText.d.cts +9 -0
- package/dist/components/Avatar/AvatarText.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarText.d.ts +9 -0
- package/dist/components/Avatar/AvatarText.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarText.js +49 -0
- package/dist/components/Avatar/AvatarText.js.map +1 -0
- package/dist/components/Avatar/index.cjs +10 -0
- package/dist/components/Avatar/index.d.cts +7 -0
- package/dist/components/Avatar/index.d.ts +7 -0
- package/dist/components/Avatar/index.js +6 -0
- package/dist/components/Avatar/types.cjs +1 -0
- package/dist/components/Avatar/types.d.cts +28 -0
- package/dist/components/Avatar/types.d.cts.map +1 -0
- package/dist/components/Avatar/types.d.ts +28 -0
- package/dist/components/Avatar/types.d.ts.map +1 -0
- package/dist/components/Avatar/types.js +1 -0
- package/dist/components/Avatar/utils.cjs +38 -0
- package/dist/components/Avatar/utils.d.cts +14 -0
- package/dist/components/Avatar/utils.d.cts.map +1 -0
- package/dist/components/Avatar/utils.d.ts +14 -0
- package/dist/components/Avatar/utils.d.ts.map +1 -0
- package/dist/components/Avatar/utils.js +35 -0
- package/dist/components/Avatar/utils.js.map +1 -0
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/Chip/Chip.cjs +54 -0
- package/dist/components/Chip/Chip.d.cts +19 -0
- package/dist/components/Chip/Chip.d.cts.map +1 -0
- package/dist/components/Chip/Chip.d.ts +19 -0
- package/dist/components/Chip/Chip.d.ts.map +1 -0
- package/dist/components/Chip/Chip.js +54 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/ChipBase.cjs +119 -0
- package/dist/components/Chip/ChipBase.d.cts +13 -0
- package/dist/components/Chip/ChipBase.d.cts.map +1 -0
- package/dist/components/Chip/ChipBase.d.ts +13 -0
- package/dist/components/Chip/ChipBase.d.ts.map +1 -0
- package/dist/components/Chip/ChipBase.js +116 -0
- package/dist/components/Chip/ChipBase.js.map +1 -0
- package/dist/components/Chip/ChipButton.cjs +18 -0
- package/dist/components/Chip/ChipButton.d.cts +9 -0
- package/dist/components/Chip/ChipButton.d.cts.map +1 -0
- package/dist/components/Chip/ChipButton.d.ts +9 -0
- package/dist/components/Chip/ChipButton.d.ts.map +1 -0
- package/dist/components/Chip/ChipButton.js +18 -0
- package/dist/components/Chip/ChipButton.js.map +1 -0
- package/dist/components/Chip/ChipDismissible.cjs +49 -0
- package/dist/components/Chip/ChipDismissible.d.cts +9 -0
- package/dist/components/Chip/ChipDismissible.d.cts.map +1 -0
- package/dist/components/Chip/ChipDismissible.d.ts +9 -0
- package/dist/components/Chip/ChipDismissible.d.ts.map +1 -0
- package/dist/components/Chip/ChipDismissible.js +49 -0
- package/dist/components/Chip/ChipDismissible.js.map +1 -0
- package/dist/components/Chip/ChipToggle.cjs +32 -0
- package/dist/components/Chip/ChipToggle.d.cts +9 -0
- package/dist/components/Chip/ChipToggle.d.cts.map +1 -0
- package/dist/components/Chip/ChipToggle.d.ts +9 -0
- package/dist/components/Chip/ChipToggle.d.ts.map +1 -0
- package/dist/components/Chip/ChipToggle.js +32 -0
- package/dist/components/Chip/ChipToggle.js.map +1 -0
- package/dist/components/Chip/chipTheme.cjs +23 -0
- package/dist/components/Chip/chipTheme.d.cts +14 -0
- package/dist/components/Chip/chipTheme.d.cts.map +1 -0
- package/dist/components/Chip/chipTheme.d.ts +14 -0
- package/dist/components/Chip/chipTheme.d.ts.map +1 -0
- package/dist/components/Chip/chipTheme.js +24 -0
- package/dist/components/Chip/chipTheme.js.map +1 -0
- package/dist/components/Chip/index.cjs +10 -0
- package/dist/components/Chip/index.d.cts +7 -0
- package/dist/components/Chip/index.d.ts +7 -0
- package/dist/components/Chip/index.js +6 -0
- package/dist/components/Chip/types.cjs +1 -0
- package/dist/components/Chip/types.d.cts +76 -0
- package/dist/components/Chip/types.d.cts.map +1 -0
- package/dist/components/Chip/types.d.ts +76 -0
- package/dist/components/Chip/types.d.ts.map +1 -0
- package/dist/components/Chip/types.js +1 -0
- package/dist/components/Input.cjs +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/{Radio.cjs → Radio/Radio.cjs} +32 -10
- 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} +32 -10
- 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/types/dist/index.d.cts +49 -2
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +49 -2
- package/dist/types/dist/index.d.ts.map +1 -1
- package/package.json +23 -13
- package/dist/components/Avatar.cjs +0 -116
- package/dist/components/Avatar.d.cts +0 -68
- package/dist/components/Avatar.d.cts.map +0 -1
- package/dist/components/Avatar.d.ts +0 -68
- package/dist/components/Avatar.d.ts.map +0 -1
- package/dist/components/Avatar.js +0 -116
- package/dist/components/Avatar.js.map +0 -1
- package/dist/components/Chip.cjs +0 -139
- package/dist/components/Chip.d.cts +0 -82
- package/dist/components/Chip.d.cts.map +0 -1
- package/dist/components/Chip.d.ts +0 -82
- package/dist/components/Chip.d.ts.map +0 -1
- package/dist/components/Chip.js +0 -139
- package/dist/components/Chip.js.map +0 -1
- 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,76 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipSize, ChipVariant } from "../../types/dist/index.cjs";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.cjs";
|
|
4
|
+
import { ReactNode, Ref } from "react";
|
|
5
|
+
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Chip/types.d.ts
|
|
8
|
+
type ChipInteractionState = 'rest' | 'pressed';
|
|
9
|
+
type ChipKind = 'dismissible' | 'link' | 'toggle';
|
|
10
|
+
type ChipToggleState = 'off' | 'on';
|
|
11
|
+
interface ChipSharedProps extends Omit<ViewProps, 'children' | 'style'> {
|
|
12
|
+
/** Ref to the underlying View. */
|
|
13
|
+
ref?: Ref<View>;
|
|
14
|
+
/** The visual style variant. @default 'primary' */
|
|
15
|
+
variant?: ChipVariant;
|
|
16
|
+
/** The size of the chip. @default 'md' */
|
|
17
|
+
size?: ChipSize;
|
|
18
|
+
/** Minimum width of the chip in pixels. */
|
|
19
|
+
minWidth?: number;
|
|
20
|
+
/** Maximum width of the chip in pixels. @default 200 */
|
|
21
|
+
maxWidth?: number;
|
|
22
|
+
/** Icon displayed at the start of the chip. */
|
|
23
|
+
startIcon?: IconSlotType;
|
|
24
|
+
/** Icon displayed at the end of the chip. */
|
|
25
|
+
endIcon?: IconSlotType;
|
|
26
|
+
/** Whether the chip is disabled. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Chip label content. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
/** Style override for the chip root. */
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
}
|
|
33
|
+
interface ChipButtonProps extends ChipSharedProps {
|
|
34
|
+
/** Called when the chip is pressed. */
|
|
35
|
+
onPress?: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface ChipDismissibleProps extends Omit<ChipSharedProps, 'endIcon'> {
|
|
38
|
+
/** Called when the dismiss button is pressed. */
|
|
39
|
+
onDismiss?: () => void;
|
|
40
|
+
/** Accessibility label for the dismiss button. */
|
|
41
|
+
dismissButtonAriaLabel?: string;
|
|
42
|
+
/** Custom icon for the dismiss button. */
|
|
43
|
+
dismissIcon?: IconSlotType;
|
|
44
|
+
}
|
|
45
|
+
interface ChipToggleProps extends ChipSharedProps {
|
|
46
|
+
/** Whether the chip is toggled/selected. */
|
|
47
|
+
isToggled?: boolean;
|
|
48
|
+
/** Called when the chip toggle state changes. */
|
|
49
|
+
onToggle?: (isToggled: boolean) => void;
|
|
50
|
+
}
|
|
51
|
+
interface ChipProps extends ChipSharedProps {
|
|
52
|
+
/** Called when the chip is pressed. Makes the chip interactive. */
|
|
53
|
+
onPress?: () => void;
|
|
54
|
+
/** Whether the chip is toggled/selected. */
|
|
55
|
+
isToggled?: boolean;
|
|
56
|
+
/** Called when the chip toggle state changes. */
|
|
57
|
+
onToggle?: (isToggled: boolean) => void;
|
|
58
|
+
/** Called when the dismiss button is pressed. Shows a dismiss icon. */
|
|
59
|
+
onDismiss?: () => void;
|
|
60
|
+
/** Accessibility label for the dismiss button. */
|
|
61
|
+
dismissButtonAriaLabel?: string;
|
|
62
|
+
/** Custom icon for the dismiss button. */
|
|
63
|
+
dismissIcon?: IconSlotType;
|
|
64
|
+
}
|
|
65
|
+
interface ChipBaseProps extends ChipSharedProps {
|
|
66
|
+
kind: ChipKind;
|
|
67
|
+
toggleState?: ChipToggleState;
|
|
68
|
+
interactionState?: ChipInteractionState;
|
|
69
|
+
pressable?: boolean;
|
|
70
|
+
accessibilityRole?: ViewProps['accessibilityRole'];
|
|
71
|
+
onPress?: () => void;
|
|
72
|
+
endContent?: ReactNode;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { type ChipBaseProps, type ChipButtonProps, type ChipDismissibleProps, type ChipInteractionState, type ChipKind, type ChipProps, type ChipSharedProps, type ChipSize, type ChipToggleProps, type ChipToggleState, type ChipVariant };
|
|
76
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Chip/types.ts"],"mappings":";;;;;;;KAMK,oBAAA;AAAA,KACA,QAAA;AAAA,KACA,eAAA;AAAA,UAEK,eAAA,SAAwB,IAAA,CAAK,SAAA;;EAErC,GAAA,GAAM,GAAA,CAAI,IAAA;EANa;EAQvB,OAAA,GAAU,WAAA;EAPC;EASX,IAAA,GAAO,QAAA;EATI;EAWX,QAAA;EAVG;EAYH,QAAA;;EAEA,SAAA,GAAY,YAAA;EAdM;EAgBlB,OAAA,GAAU,YAAA;EAdc;EAgBxB,QAAA;EAhBqC;EAkBrC,QAAA,GAAW,SAAA;EAhBL;EAkBN,KAAA,GAAQ,SAAA,CAAU,SAAA;AAAA;AAAA,UAGV,eAAA,SAAwB,eAAA;EATtB;EAWV,OAAA;AAAA;AAAA,UAGQ,oBAAA,SAA6B,IAAA,CAAK,eAAA;EA5BV;EA8BhC,SAAA;EA9BoC;EAgCpC,sBAAA;EAhCqC;EAkCrC,WAAA,GAAc,YAAA;AAAA;AAAA,UAGN,eAAA,SAAwB,eAAA;EAjChC;EAmCA,SAAA;EAjCA;EAmCA,QAAA,IAAY,SAAA;AAAA;AAAA,UAGJ,SAAA,SAAkB,eAAA;EAhC1B;EAkCA,OAAA;EAhCA;EAkCA,SAAA;EAhCA;EAkCA,QAAA,IAAY,SAAA;EAhCD;EAkCX,SAAA;EAhCQ;EAkCR,sBAAA;EAlC2B;EAoC3B,WAAA,GAAc,YAAA;AAAA;AAAA,UAGN,aAAA,SAAsB,eAAA;EAC9B,IAAA,EAAM,QAAA;EACN,WAAA,GAAc,eAAA;EACd,gBAAA,GAAmB,oBAAA;EACnB,SAAA;EACA,iBAAA,GAAoB,SAAA;EACpB,OAAA;EACA,UAAA,GAAa,SAAA;AAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipSize, ChipVariant } from "../../types/dist/index.js";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.js";
|
|
4
|
+
import { ReactNode, Ref } from "react";
|
|
5
|
+
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Chip/types.d.ts
|
|
8
|
+
type ChipInteractionState = 'rest' | 'pressed';
|
|
9
|
+
type ChipKind = 'dismissible' | 'link' | 'toggle';
|
|
10
|
+
type ChipToggleState = 'off' | 'on';
|
|
11
|
+
interface ChipSharedProps extends Omit<ViewProps, 'children' | 'style'> {
|
|
12
|
+
/** Ref to the underlying View. */
|
|
13
|
+
ref?: Ref<View>;
|
|
14
|
+
/** The visual style variant. @default 'primary' */
|
|
15
|
+
variant?: ChipVariant;
|
|
16
|
+
/** The size of the chip. @default 'md' */
|
|
17
|
+
size?: ChipSize;
|
|
18
|
+
/** Minimum width of the chip in pixels. */
|
|
19
|
+
minWidth?: number;
|
|
20
|
+
/** Maximum width of the chip in pixels. @default 200 */
|
|
21
|
+
maxWidth?: number;
|
|
22
|
+
/** Icon displayed at the start of the chip. */
|
|
23
|
+
startIcon?: IconSlotType;
|
|
24
|
+
/** Icon displayed at the end of the chip. */
|
|
25
|
+
endIcon?: IconSlotType;
|
|
26
|
+
/** Whether the chip is disabled. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Chip label content. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
/** Style override for the chip root. */
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
}
|
|
33
|
+
interface ChipButtonProps extends ChipSharedProps {
|
|
34
|
+
/** Called when the chip is pressed. */
|
|
35
|
+
onPress?: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface ChipDismissibleProps extends Omit<ChipSharedProps, 'endIcon'> {
|
|
38
|
+
/** Called when the dismiss button is pressed. */
|
|
39
|
+
onDismiss?: () => void;
|
|
40
|
+
/** Accessibility label for the dismiss button. */
|
|
41
|
+
dismissButtonAriaLabel?: string;
|
|
42
|
+
/** Custom icon for the dismiss button. */
|
|
43
|
+
dismissIcon?: IconSlotType;
|
|
44
|
+
}
|
|
45
|
+
interface ChipToggleProps extends ChipSharedProps {
|
|
46
|
+
/** Whether the chip is toggled/selected. */
|
|
47
|
+
isToggled?: boolean;
|
|
48
|
+
/** Called when the chip toggle state changes. */
|
|
49
|
+
onToggle?: (isToggled: boolean) => void;
|
|
50
|
+
}
|
|
51
|
+
interface ChipProps extends ChipSharedProps {
|
|
52
|
+
/** Called when the chip is pressed. Makes the chip interactive. */
|
|
53
|
+
onPress?: () => void;
|
|
54
|
+
/** Whether the chip is toggled/selected. */
|
|
55
|
+
isToggled?: boolean;
|
|
56
|
+
/** Called when the chip toggle state changes. */
|
|
57
|
+
onToggle?: (isToggled: boolean) => void;
|
|
58
|
+
/** Called when the dismiss button is pressed. Shows a dismiss icon. */
|
|
59
|
+
onDismiss?: () => void;
|
|
60
|
+
/** Accessibility label for the dismiss button. */
|
|
61
|
+
dismissButtonAriaLabel?: string;
|
|
62
|
+
/** Custom icon for the dismiss button. */
|
|
63
|
+
dismissIcon?: IconSlotType;
|
|
64
|
+
}
|
|
65
|
+
interface ChipBaseProps extends ChipSharedProps {
|
|
66
|
+
kind: ChipKind;
|
|
67
|
+
toggleState?: ChipToggleState;
|
|
68
|
+
interactionState?: ChipInteractionState;
|
|
69
|
+
pressable?: boolean;
|
|
70
|
+
accessibilityRole?: ViewProps['accessibilityRole'];
|
|
71
|
+
onPress?: () => void;
|
|
72
|
+
endContent?: ReactNode;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { type ChipBaseProps, type ChipButtonProps, type ChipDismissibleProps, type ChipInteractionState, type ChipKind, type ChipProps, type ChipSharedProps, type ChipSize, type ChipToggleProps, type ChipToggleState, type ChipVariant };
|
|
76
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Chip/types.ts"],"mappings":";;;;;;;KAMK,oBAAA;AAAA,KACA,QAA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
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_HStack = require("./HStack.cjs");
|
|
4
5
|
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
5
6
|
const require_components_Text = require("./Text.cjs");
|
|
6
|
-
const require_components_HStack = require("./HStack.cjs");
|
|
7
7
|
const require_components_VStack = require("./VStack.cjs");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_native = require("react-native");
|
package/dist/components/Input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { HStack } from "./HStack.js";
|
|
2
3
|
import { IconSlot } from "./IconSlot.js";
|
|
3
4
|
import { Text as Text$1 } from "./Text.js";
|
|
4
|
-
import { HStack } from "./HStack.js";
|
|
5
5
|
import { VStack } from "./VStack.js";
|
|
6
6
|
import { memo, useCallback, useId, useMemo, useState } from "react";
|
|
7
7
|
import { TextInput, View } from "react-native";
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_runtime = require("
|
|
4
|
-
const require_index = require("
|
|
5
|
-
const require_motion = require("
|
|
6
|
-
const require_components_Pressable = require("
|
|
7
|
-
const require_components_FormLabel = require("
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_index = require("../../motion-tokens/dist/index.cjs");
|
|
5
|
+
const require_motion = require("../../motion.cjs");
|
|
6
|
+
const require_components_Pressable = require("../Pressable.cjs");
|
|
7
|
+
const require_components_FormLabel = require("../FormLabel.cjs");
|
|
8
|
+
const require_components_Radio_RadioGroupContext = require("./RadioGroupContext.cjs");
|
|
8
9
|
let react = require("react");
|
|
9
10
|
let react_native = require("react-native");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
-
let generated_styles = require("
|
|
12
|
+
let generated_styles = require("../../../generated/styles");
|
|
12
13
|
let react_native_reanimated = require("react-native-reanimated");
|
|
13
14
|
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
14
|
-
//#region src/components/Radio.tsx
|
|
15
|
+
//#region src/components/Radio/Radio.tsx
|
|
15
16
|
const VARIANT_ERROR_MAP = {
|
|
16
17
|
primary: "alert",
|
|
17
18
|
secondary: "alert-secondary"
|
|
@@ -48,12 +49,24 @@ const VARIANT_ERROR_MAP = {
|
|
|
48
49
|
* @see {@link Checkbox} for multi-select options
|
|
49
50
|
* @see {@link Switch} for binary toggles
|
|
50
51
|
*/
|
|
51
|
-
const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", variant:
|
|
52
|
+
const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, onChange, ref, ...viewProps }) {
|
|
52
53
|
const uid = `uds-radio-${(0, react.useId)()}`;
|
|
54
|
+
const radioGroup = require_components_Radio_RadioGroupContext.useRadioGroupContext();
|
|
55
|
+
const disabled = Boolean(disabledProp || radioGroup?.disabled);
|
|
56
|
+
const hasError = hasErrorProp ?? radioGroup?.hasError;
|
|
57
|
+
const reduceMotion = reduceMotionProp ?? radioGroup?.reduceMotion;
|
|
58
|
+
const size = sizeInput ?? radioGroup?.size ?? "md";
|
|
59
|
+
const variantProp = variantInput ?? radioGroup?.variant ?? "primary";
|
|
60
|
+
const value = valueProp ?? "";
|
|
61
|
+
const isInRadioGroup = radioGroup !== void 0;
|
|
53
62
|
const isControlled = checkedProp !== void 0;
|
|
54
63
|
const [internalChecked, setInternalChecked] = (0, react.useState)(isControlled ? checkedProp : defaultChecked ?? false);
|
|
55
64
|
const [pressed, setPressed] = (0, react.useState)(false);
|
|
56
|
-
const checked = isControlled ? checkedProp : internalChecked;
|
|
65
|
+
const checked = isInRadioGroup ? radioGroup.value === value : isControlled ? checkedProp : internalChecked;
|
|
66
|
+
(0, react.useEffect)(() => {
|
|
67
|
+
if (!__DEV__ || !isInRadioGroup || valueProp) return;
|
|
68
|
+
console.warn("[UDS Mobile] Radio: A Radio rendered inside RadioGroup requires a unique, non-empty value prop.");
|
|
69
|
+
}, [isInRadioGroup, valueProp]);
|
|
57
70
|
const valueState = (0, react.useMemo)(() => {
|
|
58
71
|
return checked ? "checked" : "unchecked";
|
|
59
72
|
}, [checked]);
|
|
@@ -62,14 +75,23 @@ const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", v
|
|
|
62
75
|
const radioAnimatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ scale: scaleProgress.value }] }));
|
|
63
76
|
const handlePress = (0, react.useCallback)(() => {
|
|
64
77
|
if (disabled) return;
|
|
78
|
+
if (isInRadioGroup) {
|
|
79
|
+
if (radioGroup.value === value) return;
|
|
80
|
+
radioGroup.setValue(value);
|
|
81
|
+
onChange?.(true);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
65
84
|
const newChecked = !checked;
|
|
66
85
|
if (!isControlled) setInternalChecked(newChecked);
|
|
67
86
|
onChange?.(newChecked);
|
|
68
87
|
}, [
|
|
69
88
|
disabled,
|
|
89
|
+
isInRadioGroup,
|
|
70
90
|
checked,
|
|
71
91
|
isControlled,
|
|
72
|
-
onChange
|
|
92
|
+
onChange,
|
|
93
|
+
radioGroup,
|
|
94
|
+
value
|
|
73
95
|
]);
|
|
74
96
|
const handlePressIn = (0, react.useCallback)(() => {
|
|
75
97
|
setPressed(true);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalRadioProps } from "
|
|
2
|
+
import { UniversalRadioProps } from "../../types/dist/index.cjs";
|
|
3
3
|
import * as _$react from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
|
-
//#region src/components/Radio.d.ts
|
|
7
|
+
//#region src/components/Radio/Radio.d.ts
|
|
8
8
|
interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
9
9
|
/** Ref to the underlying View */
|
|
10
10
|
ref?: Ref<View>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.cts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;UAoBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFS;EAInB,cAAA;EAJgC;EAMhC,QAAA;EAJM;EAMN,QAAA;EARqD;EAUrD,QAAA,IAAY,OAAA;AAAA;;;;;;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalRadioProps } from "
|
|
2
|
+
import { UniversalRadioProps } from "../../types/dist/index.js";
|
|
3
3
|
import * as _$react from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
|
-
//#region src/components/Radio.d.ts
|
|
7
|
+
//#region src/components/Radio/Radio.d.ts
|
|
8
8
|
interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
9
9
|
/** Ref to the underlying View */
|
|
10
10
|
ref?: Ref<View>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;UAoBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFS;EAInB,cAAA;EAJgC;EAMhC,QAAA;EAJM;EAMN,QAAA;EARqD;EAUrD,QAAA,IAAY,OAAA;AAAA;;;;;;;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
-
import { SCALE_EFFECTS } from "
|
|
3
|
-
import { BUTTON_SPRING_CONFIG } from "
|
|
4
|
-
import { Pressable as Pressable$1 } from "
|
|
5
|
-
import { FormLabel } from "
|
|
6
|
-
import {
|
|
2
|
+
import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
|
|
3
|
+
import { BUTTON_SPRING_CONFIG } from "../../motion.js";
|
|
4
|
+
import { Pressable as Pressable$1 } from "../Pressable.js";
|
|
5
|
+
import { FormLabel } from "../FormLabel.js";
|
|
6
|
+
import { useRadioGroupContext } from "./RadioGroupContext.js";
|
|
7
|
+
import { memo, useCallback, useEffect, useId, useMemo, useState } from "react";
|
|
7
8
|
import { View } from "react-native";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { radioStyles } from "
|
|
10
|
+
import { radioStyles } from "../../../generated/styles";
|
|
10
11
|
import Animated, { useAnimatedStyle, useDerivedValue, withSpring } from "react-native-reanimated";
|
|
11
|
-
//#region src/components/Radio.tsx
|
|
12
|
+
//#region src/components/Radio/Radio.tsx
|
|
12
13
|
const VARIANT_ERROR_MAP = {
|
|
13
14
|
primary: "alert",
|
|
14
15
|
secondary: "alert-secondary"
|
|
@@ -45,12 +46,24 @@ const VARIANT_ERROR_MAP = {
|
|
|
45
46
|
* @see {@link Checkbox} for multi-select options
|
|
46
47
|
* @see {@link Switch} for binary toggles
|
|
47
48
|
*/
|
|
48
|
-
const Radio = memo(function Radio({ label, labelPosition = "start", variant:
|
|
49
|
+
const Radio = memo(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, onChange, ref, ...viewProps }) {
|
|
49
50
|
const uid = `uds-radio-${useId()}`;
|
|
51
|
+
const radioGroup = useRadioGroupContext();
|
|
52
|
+
const disabled = Boolean(disabledProp || radioGroup?.disabled);
|
|
53
|
+
const hasError = hasErrorProp ?? radioGroup?.hasError;
|
|
54
|
+
const reduceMotion = reduceMotionProp ?? radioGroup?.reduceMotion;
|
|
55
|
+
const size = sizeInput ?? radioGroup?.size ?? "md";
|
|
56
|
+
const variantProp = variantInput ?? radioGroup?.variant ?? "primary";
|
|
57
|
+
const value = valueProp ?? "";
|
|
58
|
+
const isInRadioGroup = radioGroup !== void 0;
|
|
50
59
|
const isControlled = checkedProp !== void 0;
|
|
51
60
|
const [internalChecked, setInternalChecked] = useState(isControlled ? checkedProp : defaultChecked ?? false);
|
|
52
61
|
const [pressed, setPressed] = useState(false);
|
|
53
|
-
const checked = isControlled ? checkedProp : internalChecked;
|
|
62
|
+
const checked = isInRadioGroup ? radioGroup.value === value : isControlled ? checkedProp : internalChecked;
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!__DEV__ || !isInRadioGroup || valueProp) return;
|
|
65
|
+
console.warn("[UDS Mobile] Radio: A Radio rendered inside RadioGroup requires a unique, non-empty value prop.");
|
|
66
|
+
}, [isInRadioGroup, valueProp]);
|
|
54
67
|
const valueState = useMemo(() => {
|
|
55
68
|
return checked ? "checked" : "unchecked";
|
|
56
69
|
}, [checked]);
|
|
@@ -59,14 +72,23 @@ const Radio = memo(function Radio({ label, labelPosition = "start", variant: var
|
|
|
59
72
|
const radioAnimatedStyle = useAnimatedStyle(() => ({ transform: [{ scale: scaleProgress.value }] }));
|
|
60
73
|
const handlePress = useCallback(() => {
|
|
61
74
|
if (disabled) return;
|
|
75
|
+
if (isInRadioGroup) {
|
|
76
|
+
if (radioGroup.value === value) return;
|
|
77
|
+
radioGroup.setValue(value);
|
|
78
|
+
onChange?.(true);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
62
81
|
const newChecked = !checked;
|
|
63
82
|
if (!isControlled) setInternalChecked(newChecked);
|
|
64
83
|
onChange?.(newChecked);
|
|
65
84
|
}, [
|
|
66
85
|
disabled,
|
|
86
|
+
isInRadioGroup,
|
|
67
87
|
checked,
|
|
68
88
|
isControlled,
|
|
69
|
-
onChange
|
|
89
|
+
onChange,
|
|
90
|
+
radioGroup,
|
|
91
|
+
value
|
|
70
92
|
]);
|
|
71
93
|
const handlePressIn = useCallback(() => {
|
|
72
94
|
setPressed(true);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.js","names":["Pressable"],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import type { RadioVariant, UniversalRadioProps } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useCallback, useEffect, useId, useMemo, useState } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { View } from 'react-native';\nimport Animated, { useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated';\n\nimport { radioStyles } from '../../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../../motion';\nimport { FormLabel } from '../FormLabel';\nimport { Pressable } from '../Pressable';\nimport { useRadioGroupContext } from './RadioGroupContext';\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/Radio';\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: variantInput,\n size: sizeInput,\n value: valueProp,\n checked: checkedProp,\n hasError: hasErrorProp,\n reduceMotion: reduceMotionProp,\n // Native props\n defaultChecked,\n disabled: disabledProp,\n required,\n onChange,\n ref,\n ...viewProps\n}: RadioProps) {\n const generatedId = useId();\n const uid = `uds-radio-${generatedId}`;\n const radioGroup = useRadioGroupContext();\n\n const disabled = Boolean(disabledProp || radioGroup?.disabled);\n const hasError = hasErrorProp ?? radioGroup?.hasError;\n const reduceMotion = reduceMotionProp ?? radioGroup?.reduceMotion;\n const size = sizeInput ?? radioGroup?.size ?? 'md';\n const variantProp = variantInput ?? radioGroup?.variant ?? 'primary';\n const value = valueProp ?? '';\n\n /* --------------------------------- State ---------------------------------- */\n const isInRadioGroup = radioGroup !== undefined;\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 = isInRadioGroup\n ? radioGroup.value === value\n : isControlled\n ? checkedProp\n : internalChecked;\n\n useEffect(() => {\n if (!__DEV__ || !isInRadioGroup || valueProp) {\n return;\n }\n\n console.warn(\n '[UDS Mobile] Radio: A Radio rendered inside RadioGroup requires a unique, non-empty value prop.',\n );\n }, [isInRadioGroup, valueProp]);\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 const radioAnimatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scaleProgress.value }],\n }));\n\n /* -------------------------------- Handlers -------------------------------- */\n const handlePress = useCallback(() => {\n if (disabled) {\n return;\n }\n\n if (isInRadioGroup) {\n if (radioGroup.value === value) {\n return;\n }\n\n radioGroup.setValue(value);\n onChange?.(true);\n return;\n }\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n\n onChange?.(newChecked);\n }, [disabled, isInRadioGroup, checked, isControlled, onChange, radioGroup, value]);\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 ],\n [radioStyles.radioCircle],\n );\n\n /* ---------------------------- Render Helpers ------------------------------ */\n const labelContent = useMemo(() => {\n if (!label) {\n return null;\n }\n\n return (\n <FormLabel\n color=\"inherit\"\n variant=\"inherit\"\n label={label}\n required={required}\n showRequiredAsterisk={required}\n hasError={hasError}\n style={radioStyles.text}\n />\n );\n }, [label, required, hasError, 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}>{checked && <View style={circleStyle} />}</Animated.View>\n\n {labelContent}\n </Pressable>\n );\n});\n\nRadio.displayName = 'Radio';\n\nexport { Radio, type RadioProps };\n"],"mappings":";;;;;;;;;;;;AAwCA,MAAM,oBAA6D;CACjE,SAAS;CACT,WAA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,mBAAkB;EAClB,oBAAoB;EACpB,oBAAoB,OAAO,UAAU,WAAW,QAAQ,KAAA;EACxD,GAAI;EACJ,OAAO;YAdT,CAgBE,oBAAC,SAAS,MAAV;GAAe,OAAO;aAAgB,WAAW,oBAAC,MAAD,EAAM,OAAO,aAAe,CAAA;GAAiB,CAAA,EAE7F,aACS;;EAEd;AAEF,MAAM,cAAc"}
|
|
@@ -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"}
|