@radix-ui/react-radio-group 1.1.4-rc.8 → 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.mjs CHANGED
@@ -1,277 +1,284 @@
1
- import $8Wolv$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
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
+ // 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
- * Radio
35
- * -----------------------------------------------------------------------------------------------*/ const $ce77a8961b41be9e$var$RADIO_NAME = 'Radio';
36
- const [$ce77a8961b41be9e$var$createRadioContext, $ce77a8961b41be9e$export$67d2296460f1b002] = $8Wolv$createContextScope($ce77a8961b41be9e$var$RADIO_NAME);
37
- const [$ce77a8961b41be9e$var$RadioProvider, $ce77a8961b41be9e$var$useRadioContext] = $ce77a8961b41be9e$var$createRadioContext($ce77a8961b41be9e$var$RADIO_NAME);
38
- const $ce77a8961b41be9e$export$d7b12c4107be0d61 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
39
- const { __scopeRadio: __scopeRadio , name: name , checked: checked = false , required: required , disabled: disabled , value: value = 'on' , onCheck: onCheck , ...radioProps } = props;
40
- const [button, setButton] = $8Wolv$useState(null);
41
- const composedRefs = $8Wolv$useComposedRefs(forwardedRef, (node)=>setButton(node)
42
- );
43
- const hasConsumerStoppedPropagationRef = $8Wolv$useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
44
- const isFormControl = button ? Boolean(button.closest('form')) : true;
45
- return /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$var$RadioProvider, {
46
- scope: __scopeRadio,
47
- checked: checked,
48
- disabled: disabled
49
- }, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.button, $8Wolv$babelruntimehelpersesmextends({
50
- type: "button",
51
- role: "radio",
52
- "aria-checked": checked,
53
- "data-state": $ce77a8961b41be9e$var$getState(checked),
54
- "data-disabled": disabled ? '' : undefined,
55
- disabled: disabled,
56
- value: value
57
- }, radioProps, {
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
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); // if radio is in a form, stop propagation from the button so that we only propagate
64
- // one click event (from the input). We propagate changes from an input so that native
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
- prevChecked,
123
- checked,
124
- bubbles
125
- ]);
126
- return /*#__PURE__*/ $8Wolv$createElement("input", $8Wolv$babelruntimehelpersesmextends({
127
- type: "radio",
128
- "aria-hidden": true,
129
- defaultChecked: checked
130
- }, inputProps, {
131
- tabIndex: -1,
132
- ref: ref,
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 $ce77a8961b41be9e$var$getState(checked) {
144
- return checked ? 'checked' : 'unchecked';
133
+ function getState(checked) {
134
+ return checked ? "checked" : "unchecked";
145
135
  }
146
136
 
147
-
148
- const $f99a8c78507165f7$var$ARROW_KEYS = [
149
- 'ArrowUp',
150
- 'ArrowDown',
151
- 'ArrowLeft',
152
- 'ArrowRight'
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
- const $f99a8c78507165f7$var$useRovingFocusGroupScope = $8Wolv$createRovingFocusGroupScope();
162
- const $f99a8c78507165f7$var$useRadioScope = $ce77a8961b41be9e$export$67d2296460f1b002();
163
- const [$f99a8c78507165f7$var$RadioGroupProvider, $f99a8c78507165f7$var$useRadioGroupContext] = $f99a8c78507165f7$var$createRadioGroupContext($f99a8c78507165f7$var$RADIO_GROUP_NAME);
164
- const $f99a8c78507165f7$export$a98f0dcb43a68a25 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
165
- const { __scopeRadioGroup: __scopeRadioGroup , name: name , defaultValue: defaultValue , value: valueProp , required: required = false , disabled: disabled = false , orientation: orientation , dir: dir , loop: loop = true , onValueChange: onValueChange , ...groupProps } = props;
166
- const rovingFocusGroupScope = $f99a8c78507165f7$var$useRovingFocusGroupScope(__scopeRadioGroup);
167
- const direction = $8Wolv$useDirection(dir);
168
- const [value, setValue] = $8Wolv$useControllableState({
169
- prop: valueProp,
170
- defaultProp: defaultValue,
171
- onChange: onValueChange
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 /*#__PURE__*/ $8Wolv$createElement($f99a8c78507165f7$var$RadioGroupProvider, {
170
+ return /* @__PURE__ */ jsx2(
171
+ RadioGroupProvider,
172
+ {
174
173
  scope: __scopeRadioGroup,
175
- name: name,
176
- required: required,
177
- disabled: disabled,
178
- value: value,
179
- onValueChange: setValue
180
- }, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Root, $8Wolv$babelruntimehelpersesmextends({
181
- asChild: true
182
- }, rovingFocusGroupScope, {
183
- orientation: orientation,
184
- dir: direction,
185
- loop: loop
186
- }), /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.div, $8Wolv$babelruntimehelpersesmextends({
187
- role: "radiogroup",
188
- "aria-required": required,
189
- "aria-orientation": orientation,
190
- "data-disabled": disabled ? '' : undefined,
191
- dir: direction
192
- }, groupProps, {
193
- ref: forwardedRef
194
- }))));
195
- });
196
- /*#__PURE__*/ Object.assign($f99a8c78507165f7$export$a98f0dcb43a68a25, {
197
- displayName: $f99a8c78507165f7$var$RADIO_GROUP_NAME
198
- });
199
- /* -------------------------------------------------------------------------------------------------
200
- * RadioGroupItem
201
- * -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$ITEM_NAME = 'RadioGroupItem';
202
- const $f99a8c78507165f7$export$9f866c100ef519e4 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
203
- const { __scopeRadioGroup: __scopeRadioGroup , disabled: disabled , ...itemProps } = props;
204
- const context = $f99a8c78507165f7$var$useRadioGroupContext($f99a8c78507165f7$var$ITEM_NAME, __scopeRadioGroup);
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 = $f99a8c78507165f7$var$useRovingFocusGroupScope(__scopeRadioGroup);
207
- const radioScope = $f99a8c78507165f7$var$useRadioScope(__scopeRadioGroup);
208
- const ref = $8Wolv$useRef(null);
209
- const composedRefs = $8Wolv$useComposedRefs(forwardedRef, ref);
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 = $8Wolv$useRef(false);
212
- $8Wolv$useEffect(()=>{
213
- const handleKeyDown = (event)=>{
214
- if ($f99a8c78507165f7$var$ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
215
- };
216
- const handleKeyUp = ()=>isArrowKeyPressedRef.current = false
217
- ;
218
- document.addEventListener('keydown', handleKeyDown);
219
- document.addEventListener('keyup', handleKeyUp);
220
- return ()=>{
221
- document.removeEventListener('keydown', handleKeyDown);
222
- document.removeEventListener('keyup', handleKeyUp);
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 /*#__PURE__*/ $8Wolv$createElement($8Wolv$Item, $8Wolv$babelruntimehelpersesmextends({
226
- asChild: true
227
- }, rovingFocusGroupScope, {
232
+ return /* @__PURE__ */ jsx2(
233
+ RovingFocusGroup.Item,
234
+ {
235
+ asChild: true,
236
+ ...rovingFocusGroupScope,
228
237
  focusable: !isDisabled,
229
- active: checked
230
- }), /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$export$d7b12c4107be0d61, $8Wolv$babelruntimehelpersesmextends({
231
- disabled: isDisabled,
232
- required: context.required,
233
- checked: checked
234
- }, radioScope, itemProps, {
235
- name: context.name,
236
- ref: composedRefs,
237
- onCheck: ()=>context.onValueChange(itemProps.value)
238
- ,
239
- onKeyDown: $8Wolv$composeEventHandlers((event)=>{
240
- // According to WAI ARIA, radio groups don't activate items on enter keypress
241
- if (event.key === 'Enter') event.preventDefault();
242
- }),
243
- onFocus: $8Wolv$composeEventHandlers(itemProps.onFocus, ()=>{
244
- var _ref$current;
245
- /**
246
- * Our `RovingFocusGroup` will focus the radio when navigating with arrow keys
247
- * and we need to "check" it in that case. We click it to "check" it (instead
248
- * of updating `context.value`) so that the radio change event fires.
249
- */ if (isArrowKeyPressedRef.current) (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.click();
250
- })
251
- })));
252
- });
253
- /*#__PURE__*/ Object.assign($f99a8c78507165f7$export$9f866c100ef519e4, {
254
- displayName: $f99a8c78507165f7$var$ITEM_NAME
255
- });
256
- /* -------------------------------------------------------------------------------------------------
257
- * RadioGroupIndicator
258
- * -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$INDICATOR_NAME = 'RadioGroupIndicator';
259
- const $f99a8c78507165f7$export$5fb54c671a65c88 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
260
- const { __scopeRadioGroup: __scopeRadioGroup , ...indicatorProps } = props;
261
- const radioScope = $f99a8c78507165f7$var$useRadioScope(__scopeRadioGroup);
262
- return /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$export$d35a9ffa9a04f9e7, $8Wolv$babelruntimehelpersesmextends({}, radioScope, indicatorProps, {
263
- ref: forwardedRef
264
- }));
265
- });
266
- /*#__PURE__*/ Object.assign($f99a8c78507165f7$export$5fb54c671a65c88, {
267
- displayName: $f99a8c78507165f7$var$INDICATOR_NAME
268
- });
269
- /* ---------------------------------------------------------------------------------------------- */ const $f99a8c78507165f7$export$be92b6f5f03c0fe9 = $f99a8c78507165f7$export$a98f0dcb43a68a25;
270
- const $f99a8c78507165f7$export$6d08773d2e66f8f2 = $f99a8c78507165f7$export$9f866c100ef519e4;
271
- const $f99a8c78507165f7$export$adb584737d712b70 = $f99a8c78507165f7$export$5fb54c671a65c88;
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