@huin-core/react-radio-group 1.0.5 → 1.0.6
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.js +80 -87
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +80 -87
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,7 +59,6 @@ var import_react_use_size = require("@huin-core/react-use-size");
|
|
|
59
59
|
var import_react_use_previous = require("@huin-core/react-use-previous");
|
|
60
60
|
var import_react_presence = require("@huin-core/react-presence");
|
|
61
61
|
var import_react_primitive = require("@huin-core/react-primitive");
|
|
62
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
63
62
|
var RADIO_NAME = "Radio";
|
|
64
63
|
var [createRadioContext, createRadioScope] = (0, import_react_context.createContextScope)(RADIO_NAME);
|
|
65
64
|
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
@@ -79,42 +78,39 @@ var Radio = React.forwardRef(
|
|
|
79
78
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node));
|
|
80
79
|
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
81
80
|
const isFormControl = button ? Boolean(button.closest("form")) : true;
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
] });
|
|
81
|
+
return /* @__PURE__ */ React.createElement(RadioProvider, { scope: __scopeRadio, checked, disabled }, /* @__PURE__ */ React.createElement(
|
|
82
|
+
import_react_primitive.Primitive.button,
|
|
83
|
+
{
|
|
84
|
+
type: "button",
|
|
85
|
+
role: "radio",
|
|
86
|
+
"aria-checked": checked,
|
|
87
|
+
"data-state": getState(checked),
|
|
88
|
+
"data-disabled": disabled ? "" : void 0,
|
|
89
|
+
disabled,
|
|
90
|
+
value,
|
|
91
|
+
...radioProps,
|
|
92
|
+
ref: composedRefs,
|
|
93
|
+
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
|
|
94
|
+
if (!checked) onCheck?.();
|
|
95
|
+
if (isFormControl) {
|
|
96
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
97
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
), isFormControl && /* @__PURE__ */ React.createElement(
|
|
102
|
+
BubbleInput,
|
|
103
|
+
{
|
|
104
|
+
control: button,
|
|
105
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
106
|
+
name,
|
|
107
|
+
value,
|
|
108
|
+
checked,
|
|
109
|
+
required,
|
|
110
|
+
disabled,
|
|
111
|
+
style: { transform: "translateX(-100%)" }
|
|
112
|
+
}
|
|
113
|
+
));
|
|
118
114
|
}
|
|
119
115
|
);
|
|
120
116
|
Radio.displayName = RADIO_NAME;
|
|
@@ -123,7 +119,7 @@ var RadioIndicator = React.forwardRef(
|
|
|
123
119
|
(props, forwardedRef) => {
|
|
124
120
|
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
125
121
|
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
126
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ React.createElement(import_react_presence.Presence, { present: forceMount || context.checked }, /* @__PURE__ */ React.createElement(
|
|
127
123
|
import_react_primitive.Primitive.span,
|
|
128
124
|
{
|
|
129
125
|
"data-state": getState(context.checked),
|
|
@@ -131,7 +127,7 @@ var RadioIndicator = React.forwardRef(
|
|
|
131
127
|
...indicatorProps,
|
|
132
128
|
ref: forwardedRef
|
|
133
129
|
}
|
|
134
|
-
)
|
|
130
|
+
));
|
|
135
131
|
}
|
|
136
132
|
);
|
|
137
133
|
RadioIndicator.displayName = INDICATOR_NAME;
|
|
@@ -151,7 +147,7 @@ var BubbleInput = (props) => {
|
|
|
151
147
|
input.dispatchEvent(event);
|
|
152
148
|
}
|
|
153
149
|
}, [prevChecked, checked, bubbles]);
|
|
154
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ React.createElement(
|
|
155
151
|
"input",
|
|
156
152
|
{
|
|
157
153
|
type: "radio",
|
|
@@ -176,7 +172,6 @@ function getState(checked) {
|
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
// packages/react/radio-group/src/RadioGroup.tsx
|
|
179
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
180
175
|
var RADIO_GROUP_NAME = "RadioGroup";
|
|
181
176
|
var [createRadioGroupContext, createRadioGroupScope] = (0, import_react_context2.createContextScope)(
|
|
182
177
|
RADIO_GROUP_NAME,
|
|
@@ -206,7 +201,7 @@ var RadioGroup = React2.forwardRef(
|
|
|
206
201
|
defaultProp: defaultValue,
|
|
207
202
|
onChange: onValueChange
|
|
208
203
|
});
|
|
209
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ React2.createElement(
|
|
210
205
|
RadioGroupProvider,
|
|
211
206
|
{
|
|
212
207
|
scope: __scopeRadioGroup,
|
|
@@ -214,30 +209,30 @@ var RadioGroup = React2.forwardRef(
|
|
|
214
209
|
required,
|
|
215
210
|
disabled,
|
|
216
211
|
value,
|
|
217
|
-
onValueChange: setValue
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
onValueChange: setValue
|
|
213
|
+
},
|
|
214
|
+
/* @__PURE__ */ React2.createElement(
|
|
215
|
+
RovingFocusGroup.Root,
|
|
216
|
+
{
|
|
217
|
+
asChild: true,
|
|
218
|
+
...rovingFocusGroupScope,
|
|
219
|
+
orientation,
|
|
220
|
+
dir: direction,
|
|
221
|
+
loop
|
|
222
|
+
},
|
|
223
|
+
/* @__PURE__ */ React2.createElement(
|
|
224
|
+
import_react_primitive2.Primitive.div,
|
|
220
225
|
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
orientation,
|
|
226
|
+
role: "radiogroup",
|
|
227
|
+
"aria-required": required,
|
|
228
|
+
"aria-orientation": orientation,
|
|
229
|
+
"data-disabled": disabled ? "" : void 0,
|
|
224
230
|
dir: direction,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
import_react_primitive2.Primitive.div,
|
|
228
|
-
{
|
|
229
|
-
role: "radiogroup",
|
|
230
|
-
"aria-required": required,
|
|
231
|
-
"aria-orientation": orientation,
|
|
232
|
-
"data-disabled": disabled ? "" : void 0,
|
|
233
|
-
dir: direction,
|
|
234
|
-
...groupProps,
|
|
235
|
-
ref: forwardedRef
|
|
236
|
-
}
|
|
237
|
-
)
|
|
231
|
+
...groupProps,
|
|
232
|
+
ref: forwardedRef
|
|
238
233
|
}
|
|
239
234
|
)
|
|
240
|
-
|
|
235
|
+
)
|
|
241
236
|
);
|
|
242
237
|
}
|
|
243
238
|
);
|
|
@@ -249,13 +244,12 @@ var import_react2 = __toESM(require("react"));
|
|
|
249
244
|
|
|
250
245
|
// packages/react/radio-group/src/RadioGroupIndicator.tsx
|
|
251
246
|
var import_react = __toESM(require("react"));
|
|
252
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
253
247
|
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
254
248
|
var useRadioScope = createRadioScope();
|
|
255
249
|
var RadioGroupIndicator = import_react.default.forwardRef((props, forwardedRef) => {
|
|
256
250
|
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
257
251
|
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
258
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ import_react.default.createElement(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
259
253
|
});
|
|
260
254
|
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
261
255
|
|
|
@@ -263,7 +257,6 @@ RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
|
263
257
|
var import_react_compose_refs2 = require("@huin-core/react-compose-refs");
|
|
264
258
|
var RovingFocusGroup2 = __toESM(require("@huin-core/react-roving-focus"));
|
|
265
259
|
var import_primitive2 = require("@huin-core/primitive");
|
|
266
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
267
260
|
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
268
261
|
var ITEM_NAME = "RadioGroupItem";
|
|
269
262
|
var RadioGroupItem = import_react2.default.forwardRef((props, forwardedRef) => {
|
|
@@ -290,33 +283,33 @@ var RadioGroupItem = import_react2.default.forwardRef((props, forwardedRef) => {
|
|
|
290
283
|
document.removeEventListener("keyup", handleKeyUp);
|
|
291
284
|
};
|
|
292
285
|
}, []);
|
|
293
|
-
return /* @__PURE__ */
|
|
286
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
294
287
|
RovingFocusGroup2.Item,
|
|
295
288
|
{
|
|
296
289
|
asChild: true,
|
|
297
290
|
...rovingFocusGroupScope,
|
|
298
291
|
focusable: !isDisabled,
|
|
299
|
-
active: checked
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
292
|
+
active: checked
|
|
293
|
+
},
|
|
294
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
295
|
+
Radio,
|
|
296
|
+
{
|
|
297
|
+
disabled: isDisabled,
|
|
298
|
+
required: context.required,
|
|
299
|
+
checked,
|
|
300
|
+
...radioScope,
|
|
301
|
+
...itemProps,
|
|
302
|
+
name: context.name,
|
|
303
|
+
ref: composedRefs,
|
|
304
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
305
|
+
onKeyDown: (0, import_primitive2.composeEventHandlers)((event) => {
|
|
306
|
+
if (event.key === "Enter") event.preventDefault();
|
|
307
|
+
}),
|
|
308
|
+
onFocus: (0, import_primitive2.composeEventHandlers)(itemProps.onFocus, () => {
|
|
309
|
+
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
)
|
|
320
313
|
);
|
|
321
314
|
});
|
|
322
315
|
RadioGroupItem.displayName = ITEM_NAME;
|
package/dist/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/RadioGroup.tsx", "../src/Radio.tsx", "../src/RadioGroupItem.tsx", "../src/RadioGroupIndicator.tsx"],
|
|
4
4
|
"sourcesContent": ["\"use client\";\nexport { createRadioGroupScope, RadioGroup, Root } from \"./RadioGroup\";\nexport { RadioGroupItem } from \"./RadioGroupItem\";\nexport { RadioGroupIndicator } from \"./RadioGroupIndicator\";\nexport { Radio, RadioIndicator } from \"./Radio\";\n\nexport type { RadioGroupProps } from \"./RadioGroup\";\nexport type { RadioGroupItemProps } from \"./RadioGroupItem\";\nexport type { RadioGroupIndicatorProps } from \"./RadioGroupIndicator\";\nexport type { RadioProps, RadioIndicatorProps } from \"./Radio\";\n", "import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as RovingFocusGroup from \"@huin-core/react-roving-focus\";\nimport { createRovingFocusGroupScope } from \"@huin-core/react-roving-focus\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { useDirection } from \"@huin-core/react-direction\";\nimport { Radio, createRadioScope } from \"./Radio\";\nimport type { Scope } from \"@huin-core/react-context\";\n\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroup\n * -----------------------------------------------------------------------------------------------*/\nconst RADIO_GROUP_NAME = \"RadioGroup\";\n\nexport type ScopedProps<P> = P & { __scopeRadioGroup?: Scope };\nconst [createRadioGroupContext, createRadioGroupScope] = createContextScope(\n RADIO_GROUP_NAME,\n [createRovingFocusGroupScope, createRadioScope]\n);\nexport const useRovingFocusGroupScope = createRovingFocusGroupScope();\n\ntype RadioGroupContextValue = {\n name?: string;\n required: boolean;\n disabled: boolean;\n value?: string;\n onValueChange(value: string): void;\n};\n\nexport const [RadioGroupProvider, useRadioGroupContext] =\n createRadioGroupContext<RadioGroupContextValue>(RADIO_GROUP_NAME);\n\ntype RadioGroupElement = React.ElementRef<typeof Primitive.div>;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef<\n typeof RovingFocusGroup.Root\n>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface RadioGroupProps extends PrimitiveDivProps {\n name?: RadioGroupContextValue[\"name\"];\n required?: React.ComponentPropsWithoutRef<typeof Radio>[\"required\"];\n disabled?: React.ComponentPropsWithoutRef<typeof Radio>[\"disabled\"];\n dir?: RovingFocusGroupProps[\"dir\"];\n orientation?: RovingFocusGroupProps[\"orientation\"];\n loop?: RovingFocusGroupProps[\"loop\"];\n defaultValue?: string;\n value?: RadioGroupContextValue[\"value\"];\n onValueChange?: RadioGroupContextValue[\"onValueChange\"];\n}\n\nconst RadioGroup = React.forwardRef<RadioGroupElement, RadioGroupProps>(\n (props: ScopedProps<RadioGroupProps>, forwardedRef) => {\n const {\n __scopeRadioGroup,\n name,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...groupProps\n } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n return (\n <RadioGroupProvider\n scope={__scopeRadioGroup}\n name={name}\n required={required}\n disabled={disabled}\n value={value}\n onValueChange={setValue}\n >\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"radiogroup\"\n aria-required={required}\n aria-orientation={orientation}\n data-disabled={disabled ? '' : undefined}\n dir={direction}\n {...groupProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </RadioGroupProvider>\n );\n }\n);\n\nRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = RadioGroup;\n\nexport { createRadioGroupScope, RadioGroup, Root };\nexport type { RadioGroupProps };\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@huin-core/primitive';\nimport { useComposedRefs } from '@huin-core/react-compose-refs';\nimport { createContextScope } from '@huin-core/react-context';\nimport { useSize } from '@huin-core/react-use-size';\nimport { usePrevious } from '@huin-core/react-use-previous';\nimport { Presence } from '@huin-core/react-presence';\nimport { Primitive } from '@huin-core/react-primitive';\n\nimport type { Scope } from '@huin-core/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Radio\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_NAME = 'Radio';\n\ntype ScopedProps<P> = P & { __scopeRadio?: Scope };\nconst [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);\n\ntype RadioContextValue = { checked: boolean; disabled?: boolean };\nconst [RadioProvider, useRadioContext] = createRadioContext<RadioContextValue>(RADIO_NAME);\n\ntype RadioElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface RadioProps extends PrimitiveButtonProps {\n checked?: boolean;\n required?: boolean;\n onCheck?(): void;\n}\n\nconst Radio = React.forwardRef<RadioElement, RadioProps>(\n (props: ScopedProps<RadioProps>, forwardedRef) => {\n const {\n __scopeRadio,\n name,\n checked = false,\n required,\n disabled,\n value = 'on',\n onCheck,\n ...radioProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n\n return (\n <RadioProvider scope={__scopeRadio} checked={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...radioProps}\n ref={composedRefs}\n onClick={composeEventHandlers(props.onClick, (event) => {\n // radios cannot be unchecked so we only communicate a checked state\n if (!checked) onCheck?.();\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </RadioProvider>\n );\n }\n);\n\nRadio.displayName = RADIO_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * RadioIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'RadioIndicator';\n\ntype RadioIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\nexport interface RadioIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst RadioIndicator = React.forwardRef<RadioIndicatorElement, RadioIndicatorProps>(\n (props: ScopedProps<RadioIndicatorProps>, forwardedRef) => {\n const { __scopeRadio, forceMount, ...indicatorProps } = props;\n const context = useRadioContext(INDICATOR_NAME, __scopeRadio);\n return (\n <Presence present={forceMount || context.checked}>\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nRadioIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = React.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: boolean;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"radio\"\n aria-hidden\n defaultChecked={checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createRadioScope,\n //\n Radio,\n RadioIndicator,\n};\nexport type { RadioProps };\n", "import React from \"react\";\nimport { Radio } from \"./Radio\";\nimport {\n ScopedProps,\n useRadioGroupContext,\n useRovingFocusGroupScope,\n} from \"./RadioGroup\";\nimport { useRadioScope } from \"./RadioGroupIndicator\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport * as RovingFocusGroup from \"@huin-core/react-roving-focus\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst ARROW_KEYS = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\nconst ITEM_NAME = \"RadioGroupItem\";\n\ntype RadioGroupItemElement = React.ElementRef<typeof Radio>;\ntype RadioProps = React.ComponentPropsWithoutRef<typeof Radio>;\ninterface RadioGroupItemProps extends Omit<RadioProps, \"onCheck\" | \"name\"> {\n value: string;\n}\n\nconst RadioGroupItem = React.forwardRef<\n RadioGroupItemElement,\n RadioGroupItemProps\n>((props: ScopedProps<RadioGroupItemProps>, forwardedRef) => {\n const { __scopeRadioGroup, disabled, ...itemProps } = props;\n const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);\n const isDisabled = context.disabled || disabled;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const ref = React.useRef<React.ElementRef<typeof Radio>>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const checked = context.value === itemProps.value;\n const isArrowKeyPressedRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (ARROW_KEYS.includes(event.key)) {\n isArrowKeyPressedRef.current = true;\n }\n };\n const handleKeyUp = () => (isArrowKeyPressedRef.current = false);\n document.addEventListener(\"keydown\", handleKeyDown);\n document.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n document.removeEventListener(\"keyup\", handleKeyUp);\n };\n }, []);\n\n return (\n <RovingFocusGroup.Item\n asChild\n {...rovingFocusGroupScope}\n focusable={!isDisabled}\n active={checked}\n >\n <Radio\n disabled={isDisabled}\n required={context.required}\n checked={checked}\n {...radioScope}\n {...itemProps}\n name={context.name}\n ref={composedRefs}\n onCheck={() => context.onValueChange(itemProps.value)}\n onKeyDown={composeEventHandlers((event) => {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === \"Enter\") event.preventDefault();\n })}\n onFocus={composeEventHandlers(itemProps.onFocus, () => {\n /**\n * Our `RovingFocusGroup` will focus the radio when navigating with arrow keys\n * and we need to \"check\" it in that case. We click it to \"check\" it (instead\n * of updating `context.value`) so that the radio change event fires.\n */\n if (isArrowKeyPressedRef.current) ref.current?.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n});\n\nRadioGroupItem.displayName = ITEM_NAME;\n\nexport { RadioGroupItem };\nexport type { RadioGroupItemProps };\n", "import React from \"react\";\nimport { ScopedProps } from \"./RadioGroup\";\nimport { createRadioScope, RadioIndicator } from \"./Radio\";\n\nconst INDICATOR_NAME = \"RadioGroupIndicator\";\n\ntype RadioGroupIndicatorElement = React.ElementRef<typeof RadioIndicator>;\ntype RadioIndicatorProps = React.ComponentPropsWithoutRef<\n typeof RadioIndicator\n>;\ninterface RadioGroupIndicatorProps extends RadioIndicatorProps {}\nexport const useRadioScope = createRadioScope();\n\nconst RadioGroupIndicator = React.forwardRef<\n RadioGroupIndicatorElement,\n RadioGroupIndicatorProps\n>((props: ScopedProps<RadioGroupIndicatorProps>, forwardedRef) => {\n const { __scopeRadioGroup, ...indicatorProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return (\n <RadioIndicator {...radioScope} {...indicatorProps} ref={forwardedRef} />\n );\n});\n\nRadioGroupIndicator.displayName = INDICATOR_NAME;\n\nexport { RadioGroupIndicator };\nexport type { RadioGroupIndicatorProps };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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QAAQ,QAAS,OAAM,eAAe;AAAA,QAClD,CAAC;AAAA,QACD,aAAS,wCAAqB,UAAU,SAAS,MAAM;AAMrD,cAAI,qBAAqB,QAAS,KAAI,SAAS,MAAM;AAAA,QACvD,CAAC;AAAA;AAAA,IACH;AAAA,EACF;AAEJ,CAAC;AAED,eAAe,cAAc;",
|
|
6
|
+
"names": ["Root", "React", "import_react_context", "import_react_primitive", "Root", "import_react", "INDICATOR_NAME", "React", "import_react_compose_refs", "RovingFocusGroup", "import_primitive", "React"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,6 @@ import { useSize } from "@huin-core/react-use-size";
|
|
|
18
18
|
import { usePrevious } from "@huin-core/react-use-previous";
|
|
19
19
|
import { Presence } from "@huin-core/react-presence";
|
|
20
20
|
import { Primitive } from "@huin-core/react-primitive";
|
|
21
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
21
|
var RADIO_NAME = "Radio";
|
|
23
22
|
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
24
23
|
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
@@ -38,42 +37,39 @@ var Radio = React.forwardRef(
|
|
|
38
37
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
39
38
|
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
40
39
|
const isFormControl = button ? Boolean(button.closest("form")) : true;
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
] });
|
|
40
|
+
return /* @__PURE__ */ React.createElement(RadioProvider, { scope: __scopeRadio, checked, disabled }, /* @__PURE__ */ React.createElement(
|
|
41
|
+
Primitive.button,
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
role: "radio",
|
|
45
|
+
"aria-checked": checked,
|
|
46
|
+
"data-state": getState(checked),
|
|
47
|
+
"data-disabled": disabled ? "" : void 0,
|
|
48
|
+
disabled,
|
|
49
|
+
value,
|
|
50
|
+
...radioProps,
|
|
51
|
+
ref: composedRefs,
|
|
52
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
53
|
+
if (!checked) onCheck?.();
|
|
54
|
+
if (isFormControl) {
|
|
55
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
56
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
), isFormControl && /* @__PURE__ */ React.createElement(
|
|
61
|
+
BubbleInput,
|
|
62
|
+
{
|
|
63
|
+
control: button,
|
|
64
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
65
|
+
name,
|
|
66
|
+
value,
|
|
67
|
+
checked,
|
|
68
|
+
required,
|
|
69
|
+
disabled,
|
|
70
|
+
style: { transform: "translateX(-100%)" }
|
|
71
|
+
}
|
|
72
|
+
));
|
|
77
73
|
}
|
|
78
74
|
);
|
|
79
75
|
Radio.displayName = RADIO_NAME;
|
|
@@ -82,7 +78,7 @@ var RadioIndicator = React.forwardRef(
|
|
|
82
78
|
(props, forwardedRef) => {
|
|
83
79
|
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
84
80
|
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
85
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ React.createElement(Presence, { present: forceMount || context.checked }, /* @__PURE__ */ React.createElement(
|
|
86
82
|
Primitive.span,
|
|
87
83
|
{
|
|
88
84
|
"data-state": getState(context.checked),
|
|
@@ -90,7 +86,7 @@ var RadioIndicator = React.forwardRef(
|
|
|
90
86
|
...indicatorProps,
|
|
91
87
|
ref: forwardedRef
|
|
92
88
|
}
|
|
93
|
-
)
|
|
89
|
+
));
|
|
94
90
|
}
|
|
95
91
|
);
|
|
96
92
|
RadioIndicator.displayName = INDICATOR_NAME;
|
|
@@ -110,7 +106,7 @@ var BubbleInput = (props) => {
|
|
|
110
106
|
input.dispatchEvent(event);
|
|
111
107
|
}
|
|
112
108
|
}, [prevChecked, checked, bubbles]);
|
|
113
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ React.createElement(
|
|
114
110
|
"input",
|
|
115
111
|
{
|
|
116
112
|
type: "radio",
|
|
@@ -135,7 +131,6 @@ function getState(checked) {
|
|
|
135
131
|
}
|
|
136
132
|
|
|
137
133
|
// packages/react/radio-group/src/RadioGroup.tsx
|
|
138
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
139
134
|
var RADIO_GROUP_NAME = "RadioGroup";
|
|
140
135
|
var [createRadioGroupContext, createRadioGroupScope] = createContextScope2(
|
|
141
136
|
RADIO_GROUP_NAME,
|
|
@@ -165,7 +160,7 @@ var RadioGroup = React2.forwardRef(
|
|
|
165
160
|
defaultProp: defaultValue,
|
|
166
161
|
onChange: onValueChange
|
|
167
162
|
});
|
|
168
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ React2.createElement(
|
|
169
164
|
RadioGroupProvider,
|
|
170
165
|
{
|
|
171
166
|
scope: __scopeRadioGroup,
|
|
@@ -173,30 +168,30 @@ var RadioGroup = React2.forwardRef(
|
|
|
173
168
|
required,
|
|
174
169
|
disabled,
|
|
175
170
|
value,
|
|
176
|
-
onValueChange: setValue
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
onValueChange: setValue
|
|
172
|
+
},
|
|
173
|
+
/* @__PURE__ */ React2.createElement(
|
|
174
|
+
RovingFocusGroup.Root,
|
|
175
|
+
{
|
|
176
|
+
asChild: true,
|
|
177
|
+
...rovingFocusGroupScope,
|
|
178
|
+
orientation,
|
|
179
|
+
dir: direction,
|
|
180
|
+
loop
|
|
181
|
+
},
|
|
182
|
+
/* @__PURE__ */ React2.createElement(
|
|
183
|
+
Primitive2.div,
|
|
179
184
|
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
orientation,
|
|
185
|
+
role: "radiogroup",
|
|
186
|
+
"aria-required": required,
|
|
187
|
+
"aria-orientation": orientation,
|
|
188
|
+
"data-disabled": disabled ? "" : void 0,
|
|
183
189
|
dir: direction,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Primitive2.div,
|
|
187
|
-
{
|
|
188
|
-
role: "radiogroup",
|
|
189
|
-
"aria-required": required,
|
|
190
|
-
"aria-orientation": orientation,
|
|
191
|
-
"data-disabled": disabled ? "" : void 0,
|
|
192
|
-
dir: direction,
|
|
193
|
-
...groupProps,
|
|
194
|
-
ref: forwardedRef
|
|
195
|
-
}
|
|
196
|
-
)
|
|
190
|
+
...groupProps,
|
|
191
|
+
ref: forwardedRef
|
|
197
192
|
}
|
|
198
193
|
)
|
|
199
|
-
|
|
194
|
+
)
|
|
200
195
|
);
|
|
201
196
|
}
|
|
202
197
|
);
|
|
@@ -208,13 +203,12 @@ import React4 from "react";
|
|
|
208
203
|
|
|
209
204
|
// packages/react/radio-group/src/RadioGroupIndicator.tsx
|
|
210
205
|
import React3 from "react";
|
|
211
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
212
206
|
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
213
207
|
var useRadioScope = createRadioScope();
|
|
214
208
|
var RadioGroupIndicator = React3.forwardRef((props, forwardedRef) => {
|
|
215
209
|
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
216
210
|
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
217
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ React3.createElement(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
218
212
|
});
|
|
219
213
|
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
220
214
|
|
|
@@ -222,7 +216,6 @@ RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
|
222
216
|
import { useComposedRefs as useComposedRefs2 } from "@huin-core/react-compose-refs";
|
|
223
217
|
import * as RovingFocusGroup2 from "@huin-core/react-roving-focus";
|
|
224
218
|
import { composeEventHandlers as composeEventHandlers2 } from "@huin-core/primitive";
|
|
225
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
226
219
|
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
227
220
|
var ITEM_NAME = "RadioGroupItem";
|
|
228
221
|
var RadioGroupItem = React4.forwardRef((props, forwardedRef) => {
|
|
@@ -249,33 +242,33 @@ var RadioGroupItem = React4.forwardRef((props, forwardedRef) => {
|
|
|
249
242
|
document.removeEventListener("keyup", handleKeyUp);
|
|
250
243
|
};
|
|
251
244
|
}, []);
|
|
252
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ React4.createElement(
|
|
253
246
|
RovingFocusGroup2.Item,
|
|
254
247
|
{
|
|
255
248
|
asChild: true,
|
|
256
249
|
...rovingFocusGroupScope,
|
|
257
250
|
focusable: !isDisabled,
|
|
258
|
-
active: checked
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
251
|
+
active: checked
|
|
252
|
+
},
|
|
253
|
+
/* @__PURE__ */ React4.createElement(
|
|
254
|
+
Radio,
|
|
255
|
+
{
|
|
256
|
+
disabled: isDisabled,
|
|
257
|
+
required: context.required,
|
|
258
|
+
checked,
|
|
259
|
+
...radioScope,
|
|
260
|
+
...itemProps,
|
|
261
|
+
name: context.name,
|
|
262
|
+
ref: composedRefs,
|
|
263
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
264
|
+
onKeyDown: composeEventHandlers2((event) => {
|
|
265
|
+
if (event.key === "Enter") event.preventDefault();
|
|
266
|
+
}),
|
|
267
|
+
onFocus: composeEventHandlers2(itemProps.onFocus, () => {
|
|
268
|
+
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
)
|
|
279
272
|
);
|
|
280
273
|
});
|
|
281
274
|
RadioGroupItem.displayName = ITEM_NAME;
|
package/dist/index.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/RadioGroup.tsx", "../src/Radio.tsx", "../src/RadioGroupItem.tsx", "../src/RadioGroupIndicator.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport * as RovingFocusGroup from \"@huin-core/react-roving-focus\";\nimport { createRovingFocusGroupScope } from \"@huin-core/react-roving-focus\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { useDirection } from \"@huin-core/react-direction\";\nimport { Radio, createRadioScope } from \"./Radio\";\nimport type { Scope } from \"@huin-core/react-context\";\n\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroup\n * -----------------------------------------------------------------------------------------------*/\nconst RADIO_GROUP_NAME = \"RadioGroup\";\n\nexport type ScopedProps<P> = P & { __scopeRadioGroup?: Scope };\nconst [createRadioGroupContext, createRadioGroupScope] = createContextScope(\n RADIO_GROUP_NAME,\n [createRovingFocusGroupScope, createRadioScope]\n);\nexport const useRovingFocusGroupScope = createRovingFocusGroupScope();\n\ntype RadioGroupContextValue = {\n name?: string;\n required: boolean;\n disabled: boolean;\n value?: string;\n onValueChange(value: string): void;\n};\n\nexport const [RadioGroupProvider, useRadioGroupContext] =\n createRadioGroupContext<RadioGroupContextValue>(RADIO_GROUP_NAME);\n\ntype RadioGroupElement = React.ElementRef<typeof Primitive.div>;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef<\n typeof RovingFocusGroup.Root\n>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface RadioGroupProps extends PrimitiveDivProps {\n name?: RadioGroupContextValue[\"name\"];\n required?: React.ComponentPropsWithoutRef<typeof Radio>[\"required\"];\n disabled?: React.ComponentPropsWithoutRef<typeof Radio>[\"disabled\"];\n dir?: RovingFocusGroupProps[\"dir\"];\n orientation?: RovingFocusGroupProps[\"orientation\"];\n loop?: RovingFocusGroupProps[\"loop\"];\n defaultValue?: string;\n value?: RadioGroupContextValue[\"value\"];\n onValueChange?: RadioGroupContextValue[\"onValueChange\"];\n}\n\nconst RadioGroup = React.forwardRef<RadioGroupElement, RadioGroupProps>(\n (props: ScopedProps<RadioGroupProps>, forwardedRef) => {\n const {\n __scopeRadioGroup,\n name,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation,\n dir,\n loop = true,\n onValueChange,\n ...groupProps\n } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n return (\n <RadioGroupProvider\n scope={__scopeRadioGroup}\n name={name}\n required={required}\n disabled={disabled}\n value={value}\n onValueChange={setValue}\n >\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"radiogroup\"\n aria-required={required}\n aria-orientation={orientation}\n data-disabled={disabled ? '' : undefined}\n dir={direction}\n {...groupProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </RadioGroupProvider>\n );\n }\n);\n\nRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = RadioGroup;\n\nexport { createRadioGroupScope, RadioGroup, Root };\nexport type { RadioGroupProps };\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@huin-core/primitive';\nimport { useComposedRefs } from '@huin-core/react-compose-refs';\nimport { createContextScope } from '@huin-core/react-context';\nimport { useSize } from '@huin-core/react-use-size';\nimport { usePrevious } from '@huin-core/react-use-previous';\nimport { Presence } from '@huin-core/react-presence';\nimport { Primitive } from '@huin-core/react-primitive';\n\nimport type { Scope } from '@huin-core/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Radio\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_NAME = 'Radio';\n\ntype ScopedProps<P> = P & { __scopeRadio?: Scope };\nconst [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);\n\ntype RadioContextValue = { checked: boolean; disabled?: boolean };\nconst [RadioProvider, useRadioContext] = createRadioContext<RadioContextValue>(RADIO_NAME);\n\ntype RadioElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface RadioProps extends PrimitiveButtonProps {\n checked?: boolean;\n required?: boolean;\n onCheck?(): void;\n}\n\nconst Radio = React.forwardRef<RadioElement, RadioProps>(\n (props: ScopedProps<RadioProps>, forwardedRef) => {\n const {\n __scopeRadio,\n name,\n checked = false,\n required,\n disabled,\n value = 'on',\n onCheck,\n ...radioProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n\n return (\n <RadioProvider scope={__scopeRadio} checked={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...radioProps}\n ref={composedRefs}\n onClick={composeEventHandlers(props.onClick, (event) => {\n // radios cannot be unchecked so we only communicate a checked state\n if (!checked) onCheck?.();\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </RadioProvider>\n );\n }\n);\n\nRadio.displayName = RADIO_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * RadioIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'RadioIndicator';\n\ntype RadioIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\nexport interface RadioIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst RadioIndicator = React.forwardRef<RadioIndicatorElement, RadioIndicatorProps>(\n (props: ScopedProps<RadioIndicatorProps>, forwardedRef) => {\n const { __scopeRadio, forceMount, ...indicatorProps } = props;\n const context = useRadioContext(INDICATOR_NAME, __scopeRadio);\n return (\n <Presence present={forceMount || context.checked}>\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nRadioIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = React.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: boolean;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"radio\"\n aria-hidden\n defaultChecked={checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createRadioScope,\n //\n Radio,\n RadioIndicator,\n};\nexport type { RadioProps };\n", "import React from \"react\";\nimport { Radio } from \"./Radio\";\nimport {\n ScopedProps,\n useRadioGroupContext,\n useRovingFocusGroupScope,\n} from \"./RadioGroup\";\nimport { useRadioScope } from \"./RadioGroupIndicator\";\nimport { useComposedRefs } from \"@huin-core/react-compose-refs\";\nimport * as RovingFocusGroup from \"@huin-core/react-roving-focus\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst ARROW_KEYS = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\nconst ITEM_NAME = \"RadioGroupItem\";\n\ntype RadioGroupItemElement = React.ElementRef<typeof Radio>;\ntype RadioProps = React.ComponentPropsWithoutRef<typeof Radio>;\ninterface RadioGroupItemProps extends Omit<RadioProps, \"onCheck\" | \"name\"> {\n value: string;\n}\n\nconst RadioGroupItem = React.forwardRef<\n RadioGroupItemElement,\n RadioGroupItemProps\n>((props: ScopedProps<RadioGroupItemProps>, forwardedRef) => {\n const { __scopeRadioGroup, disabled, ...itemProps } = props;\n const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);\n const isDisabled = context.disabled || disabled;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n const radioScope = useRadioScope(__scopeRadioGroup);\n const ref = React.useRef<React.ElementRef<typeof Radio>>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const checked = context.value === itemProps.value;\n const isArrowKeyPressedRef = React.useRef(false);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (ARROW_KEYS.includes(event.key)) {\n isArrowKeyPressedRef.current = true;\n }\n };\n const handleKeyUp = () => (isArrowKeyPressedRef.current = false);\n document.addEventListener(\"keydown\", handleKeyDown);\n document.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n document.removeEventListener(\"keyup\", handleKeyUp);\n };\n }, []);\n\n return (\n <RovingFocusGroup.Item\n asChild\n {...rovingFocusGroupScope}\n focusable={!isDisabled}\n active={checked}\n >\n <Radio\n disabled={isDisabled}\n required={context.required}\n checked={checked}\n {...radioScope}\n {...itemProps}\n name={context.name}\n ref={composedRefs}\n onCheck={() => context.onValueChange(itemProps.value)}\n onKeyDown={composeEventHandlers((event) => {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === \"Enter\") event.preventDefault();\n })}\n onFocus={composeEventHandlers(itemProps.onFocus, () => {\n /**\n * Our `RovingFocusGroup` will focus the radio when navigating with arrow keys\n * and we need to \"check\" it in that case. We click it to \"check\" it (instead\n * of updating `context.value`) so that the radio change event fires.\n */\n if (isArrowKeyPressedRef.current) ref.current?.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n});\n\nRadioGroupItem.displayName = ITEM_NAME;\n\nexport { RadioGroupItem };\nexport type { RadioGroupItemProps };\n", "import React from \"react\";\nimport { ScopedProps } from \"./RadioGroup\";\nimport { createRadioScope, RadioIndicator } from \"./Radio\";\n\nconst INDICATOR_NAME = \"RadioGroupIndicator\";\n\ntype RadioGroupIndicatorElement = React.ElementRef<typeof RadioIndicator>;\ntype RadioIndicatorProps = React.ComponentPropsWithoutRef<\n typeof RadioIndicator\n>;\ninterface RadioGroupIndicatorProps extends RadioIndicatorProps {}\nexport const useRadioScope = createRadioScope();\n\nconst RadioGroupIndicator = React.forwardRef<\n RadioGroupIndicatorElement,\n RadioGroupIndicatorProps\n>((props: ScopedProps<RadioGroupIndicatorProps>, forwardedRef) => {\n const { __scopeRadioGroup, ...indicatorProps } = props;\n const radioScope = useRadioScope(__scopeRadioGroup);\n return (\n <RadioIndicator {...radioScope} {...indicatorProps} ref={forwardedRef} />\n );\n});\n\nRadioGroupIndicator.displayName = INDICATOR_NAME;\n\nexport { RadioGroupIndicator };\nexport type { RadioGroupIndicatorProps };\n"],
|
|
5
|
-
"mappings": ";;;AAAA,YAAYA,YAAW;AACvB,SAAS,sBAAAC,2BAA0B;AACnC,SAAS,aAAAC,kBAAiB;AAC1B,YAAY,sBAAsB;AAClC,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;;;ACN7B,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;
|
|
6
|
-
"names": ["React", "createContextScope", "Primitive", "
|
|
5
|
+
"mappings": ";;;AAAA,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AAM,UAAU,MAAM;AACpB,UAAM,gBAAgB,CAAC,UAAyB;AAC9C,UAAI,WAAW,SAAS,MAAM,GAAG,GAAG;AAClC,6BAAqB,UAAU;AAAA,MACjC;AAAA,IACF;AACA,UAAM,cAAc,MAAO,qBAAqB,UAAU;AAC1D,aAAS,iBAAiB,WAAW,aAAa;AAClD,aAAS,iBAAiB,SAAS,WAAW;AAC9C,WAAO,MAAM;AACX,eAAS,oBAAoB,WAAW,aAAa;AACrD,eAAS,oBAAoB,SAAS,WAAW;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE,gBAAAA,OAAA;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACC,SAAO;AAAA,MACN,GAAG;AAAA,MACJ,WAAW,CAAC;AAAA,MACZ,QAAQ;AAAA;AAAA,IAER,gBAAAA,OAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,UAAU,QAAQ;AAAA,QAClB;AAAA,QACC,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,MAAM,QAAQ;AAAA,QACd,KAAK;AAAA,QACL,SAAS,MAAM,QAAQ,cAAc,UAAU,KAAK;AAAA,QACpD,WAAWD,sBAAqB,CAAC,UAAU;AAEzC,cAAI,MAAM,QAAQ,QAAS,OAAM,eAAe;AAAA,QAClD,CAAC;AAAA,QACD,SAASA,sBAAqB,UAAU,SAAS,MAAM;AAMrD,cAAI,qBAAqB,QAAS,KAAI,SAAS,MAAM;AAAA,QACvD,CAAC;AAAA;AAAA,IACH;AAAA,EACF;AAEJ,CAAC;AAED,eAAe,cAAc;",
|
|
6
|
+
"names": ["React", "createContextScope", "Primitive", "createContextScope", "Primitive", "Root", "React", "React", "INDICATOR_NAME", "React", "useComposedRefs", "RovingFocusGroup", "composeEventHandlers", "React"]
|
|
7
7
|
}
|