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