@radix-ui/react-radio-group 1.1.4-rc.9 → 1.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +39 -26
- package/dist/index.d.ts +39 -26
- package/dist/index.js +291 -274
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +268 -261
- package/dist/index.mjs.map +7 -1
- package/package.json +11 -12
- package/dist/index.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,277 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {composeEventHandlers as
|
|
4
|
-
import {useComposedRefs as
|
|
5
|
-
import {createContextScope as
|
|
6
|
-
import {Primitive as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {usePrevious as $8Wolv$usePrevious} from "@radix-ui/react-use-previous";
|
|
12
|
-
import {Presence as $8Wolv$Presence} from "@radix-ui/react-presence";
|
|
1
|
+
// packages/react/radio-group/src/RadioGroup.tsx
|
|
2
|
+
import * as React2 from "react";
|
|
3
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
4
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
5
|
+
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
6
|
+
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
|
7
|
+
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
|
|
8
|
+
import { createRovingFocusGroupScope } from "@radix-ui/react-roving-focus";
|
|
9
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
10
|
+
import { useDirection } from "@radix-ui/react-direction";
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ref: composedRefs,
|
|
59
|
-
onClick: $8Wolv$composeEventHandlers(props.onClick, (event)=>{
|
|
60
|
-
// radios cannot be unchecked so we only communicate a checked state
|
|
61
|
-
if (!checked) onCheck === null || onCheck === void 0 || onCheck();
|
|
12
|
+
// packages/react/radio-group/src/Radio.tsx
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
15
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
16
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
17
|
+
import { useSize } from "@radix-ui/react-use-size";
|
|
18
|
+
import { usePrevious } from "@radix-ui/react-use-previous";
|
|
19
|
+
import { Presence } from "@radix-ui/react-presence";
|
|
20
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var RADIO_NAME = "Radio";
|
|
23
|
+
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
24
|
+
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
25
|
+
var Radio = React.forwardRef(
|
|
26
|
+
(props, forwardedRef) => {
|
|
27
|
+
const {
|
|
28
|
+
__scopeRadio,
|
|
29
|
+
name,
|
|
30
|
+
checked = false,
|
|
31
|
+
required,
|
|
32
|
+
disabled,
|
|
33
|
+
value = "on",
|
|
34
|
+
onCheck,
|
|
35
|
+
...radioProps
|
|
36
|
+
} = props;
|
|
37
|
+
const [button, setButton] = React.useState(null);
|
|
38
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
39
|
+
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
40
|
+
const isFormControl = button ? Boolean(button.closest("form")) : true;
|
|
41
|
+
return /* @__PURE__ */ jsxs(RadioProvider, { scope: __scopeRadio, checked, disabled, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Primitive.button,
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
role: "radio",
|
|
47
|
+
"aria-checked": checked,
|
|
48
|
+
"data-state": getState(checked),
|
|
49
|
+
"data-disabled": disabled ? "" : void 0,
|
|
50
|
+
disabled,
|
|
51
|
+
value,
|
|
52
|
+
...radioProps,
|
|
53
|
+
ref: composedRefs,
|
|
54
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
55
|
+
if (!checked) onCheck?.();
|
|
62
56
|
if (isFormControl) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// form validation works and form events reflect radio updates.
|
|
66
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
57
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
58
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
67
59
|
}
|
|
68
|
-
|
|
69
|
-
})), isFormControl && /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$var$BubbleInput, {
|
|
70
|
-
control: button,
|
|
71
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
72
|
-
name: name,
|
|
73
|
-
value: value,
|
|
74
|
-
checked: checked,
|
|
75
|
-
required: required,
|
|
76
|
-
disabled: disabled // We transform because the input is absolutely positioned but we have
|
|
77
|
-
,
|
|
78
|
-
style: {
|
|
79
|
-
transform: 'translateX(-100%)'
|
|
80
|
-
}
|
|
81
|
-
}));
|
|
82
|
-
});
|
|
83
|
-
/*#__PURE__*/ Object.assign($ce77a8961b41be9e$export$d7b12c4107be0d61, {
|
|
84
|
-
displayName: $ce77a8961b41be9e$var$RADIO_NAME
|
|
85
|
-
});
|
|
86
|
-
/* -------------------------------------------------------------------------------------------------
|
|
87
|
-
* RadioIndicator
|
|
88
|
-
* -----------------------------------------------------------------------------------------------*/ const $ce77a8961b41be9e$var$INDICATOR_NAME = 'RadioIndicator';
|
|
89
|
-
const $ce77a8961b41be9e$export$d35a9ffa9a04f9e7 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
|
|
90
|
-
const { __scopeRadio: __scopeRadio , forceMount: forceMount , ...indicatorProps } = props;
|
|
91
|
-
const context = $ce77a8961b41be9e$var$useRadioContext($ce77a8961b41be9e$var$INDICATOR_NAME, __scopeRadio);
|
|
92
|
-
return /*#__PURE__*/ $8Wolv$createElement($8Wolv$Presence, {
|
|
93
|
-
present: forceMount || context.checked
|
|
94
|
-
}, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.span, $8Wolv$babelruntimehelpersesmextends({
|
|
95
|
-
"data-state": $ce77a8961b41be9e$var$getState(context.checked),
|
|
96
|
-
"data-disabled": context.disabled ? '' : undefined
|
|
97
|
-
}, indicatorProps, {
|
|
98
|
-
ref: forwardedRef
|
|
99
|
-
})));
|
|
100
|
-
});
|
|
101
|
-
/*#__PURE__*/ Object.assign($ce77a8961b41be9e$export$d35a9ffa9a04f9e7, {
|
|
102
|
-
displayName: $ce77a8961b41be9e$var$INDICATOR_NAME
|
|
103
|
-
});
|
|
104
|
-
/* ---------------------------------------------------------------------------------------------- */ const $ce77a8961b41be9e$var$BubbleInput = (props)=>{
|
|
105
|
-
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
|
|
106
|
-
const ref = $8Wolv$useRef(null);
|
|
107
|
-
const prevChecked = $8Wolv$usePrevious(checked);
|
|
108
|
-
const controlSize = $8Wolv$useSize(control); // Bubble checked change to parents (e.g form change event)
|
|
109
|
-
$8Wolv$useEffect(()=>{
|
|
110
|
-
const input = ref.current;
|
|
111
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
112
|
-
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
|
|
113
|
-
const setChecked = descriptor.set;
|
|
114
|
-
if (prevChecked !== checked && setChecked) {
|
|
115
|
-
const event = new Event('click', {
|
|
116
|
-
bubbles: bubbles
|
|
117
|
-
});
|
|
118
|
-
setChecked.call(input, checked);
|
|
119
|
-
input.dispatchEvent(event);
|
|
60
|
+
})
|
|
120
61
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
style: {
|
|
134
|
-
...props.style,
|
|
135
|
-
...controlSize,
|
|
136
|
-
position: 'absolute',
|
|
137
|
-
pointerEvents: 'none',
|
|
138
|
-
opacity: 0,
|
|
139
|
-
margin: 0
|
|
62
|
+
),
|
|
63
|
+
isFormControl && /* @__PURE__ */ jsx(
|
|
64
|
+
BubbleInput,
|
|
65
|
+
{
|
|
66
|
+
control: button,
|
|
67
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
68
|
+
name,
|
|
69
|
+
value,
|
|
70
|
+
checked,
|
|
71
|
+
required,
|
|
72
|
+
disabled,
|
|
73
|
+
style: { transform: "translateX(-100%)" }
|
|
140
74
|
}
|
|
141
|
-
|
|
75
|
+
)
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
Radio.displayName = RADIO_NAME;
|
|
80
|
+
var INDICATOR_NAME = "RadioIndicator";
|
|
81
|
+
var RadioIndicator = React.forwardRef(
|
|
82
|
+
(props, forwardedRef) => {
|
|
83
|
+
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
84
|
+
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
85
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx(
|
|
86
|
+
Primitive.span,
|
|
87
|
+
{
|
|
88
|
+
"data-state": getState(context.checked),
|
|
89
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
90
|
+
...indicatorProps,
|
|
91
|
+
ref: forwardedRef
|
|
92
|
+
}
|
|
93
|
+
) });
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
RadioIndicator.displayName = INDICATOR_NAME;
|
|
97
|
+
var BubbleInput = (props) => {
|
|
98
|
+
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
99
|
+
const ref = React.useRef(null);
|
|
100
|
+
const prevChecked = usePrevious(checked);
|
|
101
|
+
const controlSize = useSize(control);
|
|
102
|
+
React.useEffect(() => {
|
|
103
|
+
const input = ref.current;
|
|
104
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
105
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
106
|
+
const setChecked = descriptor.set;
|
|
107
|
+
if (prevChecked !== checked && setChecked) {
|
|
108
|
+
const event = new Event("click", { bubbles });
|
|
109
|
+
setChecked.call(input, checked);
|
|
110
|
+
input.dispatchEvent(event);
|
|
111
|
+
}
|
|
112
|
+
}, [prevChecked, checked, bubbles]);
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
"input",
|
|
115
|
+
{
|
|
116
|
+
type: "radio",
|
|
117
|
+
"aria-hidden": true,
|
|
118
|
+
defaultChecked: checked,
|
|
119
|
+
...inputProps,
|
|
120
|
+
tabIndex: -1,
|
|
121
|
+
ref,
|
|
122
|
+
style: {
|
|
123
|
+
...props.style,
|
|
124
|
+
...controlSize,
|
|
125
|
+
position: "absolute",
|
|
126
|
+
pointerEvents: "none",
|
|
127
|
+
opacity: 0,
|
|
128
|
+
margin: 0
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
);
|
|
142
132
|
};
|
|
143
|
-
function
|
|
144
|
-
|
|
133
|
+
function getState(checked) {
|
|
134
|
+
return checked ? "checked" : "unchecked";
|
|
145
135
|
}
|
|
146
136
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/* -------------------------------------------------------------------------------------------------
|
|
155
|
-
* RadioGroup
|
|
156
|
-
* -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$RADIO_GROUP_NAME = 'RadioGroup';
|
|
157
|
-
const [$f99a8c78507165f7$var$createRadioGroupContext, $f99a8c78507165f7$export$c547093f11b76da2] = $8Wolv$createContextScope($f99a8c78507165f7$var$RADIO_GROUP_NAME, [
|
|
158
|
-
$8Wolv$createRovingFocusGroupScope,
|
|
159
|
-
$ce77a8961b41be9e$export$67d2296460f1b002
|
|
137
|
+
// packages/react/radio-group/src/RadioGroup.tsx
|
|
138
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
139
|
+
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
140
|
+
var RADIO_GROUP_NAME = "RadioGroup";
|
|
141
|
+
var [createRadioGroupContext, createRadioGroupScope] = createContextScope2(RADIO_GROUP_NAME, [
|
|
142
|
+
createRovingFocusGroupScope,
|
|
143
|
+
createRadioScope
|
|
160
144
|
]);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
146
|
+
var useRadioScope = createRadioScope();
|
|
147
|
+
var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
148
|
+
var RadioGroup = React2.forwardRef(
|
|
149
|
+
(props, forwardedRef) => {
|
|
150
|
+
const {
|
|
151
|
+
__scopeRadioGroup,
|
|
152
|
+
name,
|
|
153
|
+
defaultValue,
|
|
154
|
+
value: valueProp,
|
|
155
|
+
required = false,
|
|
156
|
+
disabled = false,
|
|
157
|
+
orientation,
|
|
158
|
+
dir,
|
|
159
|
+
loop = true,
|
|
160
|
+
onValueChange,
|
|
161
|
+
...groupProps
|
|
162
|
+
} = props;
|
|
163
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
164
|
+
const direction = useDirection(dir);
|
|
165
|
+
const [value, setValue] = useControllableState({
|
|
166
|
+
prop: valueProp,
|
|
167
|
+
defaultProp: defaultValue,
|
|
168
|
+
onChange: onValueChange
|
|
172
169
|
});
|
|
173
|
-
return
|
|
170
|
+
return /* @__PURE__ */ jsx2(
|
|
171
|
+
RadioGroupProvider,
|
|
172
|
+
{
|
|
174
173
|
scope: __scopeRadioGroup,
|
|
175
|
-
name
|
|
176
|
-
required
|
|
177
|
-
disabled
|
|
178
|
-
value
|
|
179
|
-
onValueChange: setValue
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
174
|
+
name,
|
|
175
|
+
required,
|
|
176
|
+
disabled,
|
|
177
|
+
value,
|
|
178
|
+
onValueChange: setValue,
|
|
179
|
+
children: /* @__PURE__ */ jsx2(
|
|
180
|
+
RovingFocusGroup.Root,
|
|
181
|
+
{
|
|
182
|
+
asChild: true,
|
|
183
|
+
...rovingFocusGroupScope,
|
|
184
|
+
orientation,
|
|
185
|
+
dir: direction,
|
|
186
|
+
loop,
|
|
187
|
+
children: /* @__PURE__ */ jsx2(
|
|
188
|
+
Primitive2.div,
|
|
189
|
+
{
|
|
190
|
+
role: "radiogroup",
|
|
191
|
+
"aria-required": required,
|
|
192
|
+
"aria-orientation": orientation,
|
|
193
|
+
"data-disabled": disabled ? "" : void 0,
|
|
194
|
+
dir: direction,
|
|
195
|
+
...groupProps,
|
|
196
|
+
ref: forwardedRef
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
RadioGroup.displayName = RADIO_GROUP_NAME;
|
|
206
|
+
var ITEM_NAME = "RadioGroupItem";
|
|
207
|
+
var RadioGroupItem = React2.forwardRef(
|
|
208
|
+
(props, forwardedRef) => {
|
|
209
|
+
const { __scopeRadioGroup, disabled, ...itemProps } = props;
|
|
210
|
+
const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
|
|
205
211
|
const isDisabled = context.disabled || disabled;
|
|
206
|
-
const rovingFocusGroupScope =
|
|
207
|
-
const radioScope =
|
|
208
|
-
const ref =
|
|
209
|
-
const composedRefs =
|
|
212
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
213
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
214
|
+
const ref = React2.useRef(null);
|
|
215
|
+
const composedRefs = useComposedRefs2(forwardedRef, ref);
|
|
210
216
|
const checked = context.value === itemProps.value;
|
|
211
|
-
const isArrowKeyPressedRef =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
const isArrowKeyPressedRef = React2.useRef(false);
|
|
218
|
+
React2.useEffect(() => {
|
|
219
|
+
const handleKeyDown = (event) => {
|
|
220
|
+
if (ARROW_KEYS.includes(event.key)) {
|
|
221
|
+
isArrowKeyPressedRef.current = true;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
225
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
226
|
+
document.addEventListener("keyup", handleKeyUp);
|
|
227
|
+
return () => {
|
|
228
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
229
|
+
document.removeEventListener("keyup", handleKeyUp);
|
|
230
|
+
};
|
|
224
231
|
}, []);
|
|
225
|
-
return
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
return /* @__PURE__ */ jsx2(
|
|
233
|
+
RovingFocusGroup.Item,
|
|
234
|
+
{
|
|
235
|
+
asChild: true,
|
|
236
|
+
...rovingFocusGroupScope,
|
|
228
237
|
focusable: !isDisabled,
|
|
229
|
-
active: checked
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
export {$f99a8c78507165f7$export$c547093f11b76da2 as createRadioGroupScope, $f99a8c78507165f7$export$a98f0dcb43a68a25 as RadioGroup, $f99a8c78507165f7$export$9f866c100ef519e4 as RadioGroupItem, $f99a8c78507165f7$export$5fb54c671a65c88 as RadioGroupIndicator, $f99a8c78507165f7$export$be92b6f5f03c0fe9 as Root, $f99a8c78507165f7$export$6d08773d2e66f8f2 as Item, $f99a8c78507165f7$export$adb584737d712b70 as Indicator};
|
|
238
|
+
active: checked,
|
|
239
|
+
children: /* @__PURE__ */ jsx2(
|
|
240
|
+
Radio,
|
|
241
|
+
{
|
|
242
|
+
disabled: isDisabled,
|
|
243
|
+
required: context.required,
|
|
244
|
+
checked,
|
|
245
|
+
...radioScope,
|
|
246
|
+
...itemProps,
|
|
247
|
+
name: context.name,
|
|
248
|
+
ref: composedRefs,
|
|
249
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
250
|
+
onKeyDown: composeEventHandlers2((event) => {
|
|
251
|
+
if (event.key === "Enter") event.preventDefault();
|
|
252
|
+
}),
|
|
253
|
+
onFocus: composeEventHandlers2(itemProps.onFocus, () => {
|
|
254
|
+
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
RadioGroupItem.displayName = ITEM_NAME;
|
|
263
|
+
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
264
|
+
var RadioGroupIndicator = React2.forwardRef(
|
|
265
|
+
(props, forwardedRef) => {
|
|
266
|
+
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
267
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
268
|
+
return /* @__PURE__ */ jsx2(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
272
|
+
var Root2 = RadioGroup;
|
|
273
|
+
var Item2 = RadioGroupItem;
|
|
274
|
+
var Indicator = RadioGroupIndicator;
|
|
275
|
+
export {
|
|
276
|
+
Indicator,
|
|
277
|
+
Item2 as Item,
|
|
278
|
+
RadioGroup,
|
|
279
|
+
RadioGroupIndicator,
|
|
280
|
+
RadioGroupItem,
|
|
281
|
+
Root2 as Root,
|
|
282
|
+
createRadioGroupScope
|
|
283
|
+
};
|
|
277
284
|
//# sourceMappingURL=index.mjs.map
|