@yamada-ui/radio 1.2.10-dev-20241005220629 → 1.2.10-dev-20241006000212
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-YWRIETVW.mjs → chunk-6FMV6NX2.mjs} +3 -3
- package/dist/chunk-6FMV6NX2.mjs.map +1 -0
- package/dist/{chunk-7YYLBUPI.mjs → chunk-HK742PKK.mjs} +58 -58
- package/dist/chunk-HK742PKK.mjs.map +1 -0
- package/dist/{chunk-VFISCGJO.mjs → chunk-SEIJP3FH.mjs} +32 -29
- package/dist/chunk-SEIJP3FH.mjs.map +1 -0
- package/dist/index.js +77 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/radio-context.d.mts +2 -2
- package/dist/radio-context.d.ts +2 -2
- package/dist/radio-context.js +2 -2
- package/dist/radio-context.js.map +1 -1
- package/dist/radio-context.mjs +1 -1
- package/dist/radio-group.d.mts +21 -21
- package/dist/radio-group.d.ts +21 -21
- package/dist/radio-group.js +77 -74
- package/dist/radio-group.js.map +1 -1
- package/dist/radio-group.mjs +3 -3
- package/dist/radio.d.mts +22 -22
- package/dist/radio.d.ts +22 -22
- package/dist/radio.js +52 -52
- package/dist/radio.js.map +1 -1
- package/dist/radio.mjs +2 -2
- package/package.json +7 -7
- package/dist/chunk-7YYLBUPI.mjs.map +0 -1
- package/dist/chunk-VFISCGJO.mjs.map +0 -1
- package/dist/chunk-YWRIETVW.mjs.map +0 -1
package/dist/radio-group.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { RadioProps } from './radio.js';
|
2
2
|
import * as react from 'react';
|
3
|
-
import { ChangeEvent, RefAttributes } from 'react';
|
3
|
+
import { ChangeEvent, RefAttributes, ReactElement } from 'react';
|
4
4
|
import { PropGetter, ThemeProps, ComponentArgs } from '@yamada-ui/core';
|
5
5
|
import { FormControlOptions } from '@yamada-ui/form-control';
|
6
6
|
import { FlexProps } from '@yamada-ui/layouts';
|
7
7
|
import { Dict } from '@yamada-ui/utils';
|
8
8
|
|
9
|
-
type RadioItem<Y extends
|
9
|
+
type RadioItem<Y extends number | string = string> = {
|
10
10
|
label?: string;
|
11
|
-
}
|
12
|
-
interface UseRadioGroupProps<Y extends
|
11
|
+
} & RadioProps<Y>;
|
12
|
+
interface UseRadioGroupProps<Y extends number | string = string> {
|
13
13
|
/**
|
14
14
|
* The top-level id string that will be applied to the radios.
|
15
15
|
* The index of the radio will be appended to this top-level id.
|
@@ -19,18 +19,10 @@ interface UseRadioGroupProps<Y extends string | number = string> {
|
|
19
19
|
* The HTML `name` attribute used for forms.
|
20
20
|
*/
|
21
21
|
name?: string;
|
22
|
-
/**
|
23
|
-
* The value of the radio group.
|
24
|
-
*/
|
25
|
-
value?: Y;
|
26
22
|
/**
|
27
23
|
* The initial value of the radio group.
|
28
24
|
*/
|
29
25
|
defaultValue?: Y;
|
30
|
-
/**
|
31
|
-
* The callback fired when any children radio is checked or unchecked.
|
32
|
-
*/
|
33
|
-
onChange?: (value: Y) => void;
|
34
26
|
/**
|
35
27
|
* If `true`, input elements will receive `checked` attribute instead of `isChecked`.
|
36
28
|
*
|
@@ -39,26 +31,34 @@ interface UseRadioGroupProps<Y extends string | number = string> {
|
|
39
31
|
* @default false
|
40
32
|
*/
|
41
33
|
isNative?: boolean;
|
34
|
+
/**
|
35
|
+
* The value of the radio group.
|
36
|
+
*/
|
37
|
+
value?: Y;
|
38
|
+
/**
|
39
|
+
* The callback fired when any children radio is checked or unchecked.
|
40
|
+
*/
|
41
|
+
onChange?: (value: Y) => void;
|
42
42
|
}
|
43
|
-
declare const useRadioGroup: <Y extends
|
44
|
-
props: Omit<UseRadioGroupProps<Y> & M, "value" | "name" | "defaultValue" | "id" | "onChange" | "isNative">;
|
43
|
+
declare const useRadioGroup: <Y extends number | string, M extends Dict = Dict<any>>({ id, name, defaultValue, isNative, value: valueProp, onChange: onChangeProp, ...props }: M & UseRadioGroupProps<Y>) => {
|
45
44
|
id: string;
|
46
45
|
name: string;
|
47
|
-
|
46
|
+
props: Omit<M & UseRadioGroupProps<Y>, "value" | "defaultValue" | "name" | "id" | "onChange" | "isNative">;
|
48
47
|
setValue: react.Dispatch<react.SetStateAction<Y>>;
|
49
|
-
|
50
|
-
onFocus: () => void;
|
48
|
+
value: Y;
|
51
49
|
getContainerProps: PropGetter<"div", undefined>;
|
52
50
|
getRadioProps: PropGetter<{
|
53
51
|
value?: Y;
|
54
52
|
}, {
|
55
|
-
value?: Y;
|
56
53
|
checked?: boolean;
|
57
54
|
isChecked?: boolean;
|
55
|
+
value?: Y;
|
58
56
|
}>;
|
57
|
+
onChange: (evOrValue: ChangeEvent<HTMLInputElement> | Y) => void;
|
58
|
+
onFocus: () => void;
|
59
59
|
};
|
60
|
-
type UseRadioGroupReturn<Y extends
|
61
|
-
interface RadioGroupProps<Y extends
|
60
|
+
type UseRadioGroupReturn<Y extends number | string = string> = ReturnType<typeof useRadioGroup<Y>>;
|
61
|
+
interface RadioGroupProps<Y extends number | string = string> extends ThemeProps<"Radio">, Omit<FlexProps, "defaultValue" | "onChange">, UseRadioGroupProps<Y>, FormControlOptions {
|
62
62
|
/**
|
63
63
|
* If provided, generate radios based on items.
|
64
64
|
*
|
@@ -67,7 +67,7 @@ interface RadioGroupProps<Y extends string | number = string> extends ThemeProps
|
|
67
67
|
items?: RadioItem<Y>[];
|
68
68
|
}
|
69
69
|
declare const RadioGroup: {
|
70
|
-
<Y extends
|
70
|
+
<Y extends number | string = string>(props: RadioGroupProps<Y> & RefAttributes<HTMLDivElement>): ReactElement;
|
71
71
|
} & ComponentArgs;
|
72
72
|
|
73
73
|
export { RadioGroup, type RadioGroupProps, type RadioItem, type UseRadioGroupProps, type UseRadioGroupReturn, useRadioGroup };
|
package/dist/radio-group.js
CHANGED
@@ -41,8 +41,8 @@ var import_react = require("react");
|
|
41
41
|
// src/radio-context.ts
|
42
42
|
var import_utils = require("@yamada-ui/utils");
|
43
43
|
var [RadioGroupProvider, useRadioGroupContext] = (0, import_utils.createContext)({
|
44
|
-
|
45
|
-
|
44
|
+
name: "RadioGroupContext",
|
45
|
+
strict: false
|
46
46
|
});
|
47
47
|
|
48
48
|
// src/radio.tsx
|
@@ -56,20 +56,20 @@ var useRadio = ({
|
|
56
56
|
const {
|
57
57
|
id: _id,
|
58
58
|
name,
|
59
|
-
value,
|
60
|
-
isChecked: isCheckedProp,
|
61
59
|
defaultIsChecked,
|
60
|
+
isChecked: isCheckedProp,
|
61
|
+
value,
|
62
62
|
onChange: onChangeProp,
|
63
63
|
...computedProps
|
64
64
|
} = (0, import_form_control.useFormControlProps)({ id, ...props });
|
65
65
|
const [
|
66
66
|
{
|
67
|
-
"aria-readonly": _ariaReadonly,
|
68
|
-
required,
|
69
67
|
disabled,
|
70
68
|
readOnly,
|
71
|
-
|
69
|
+
required,
|
70
|
+
"aria-readonly": _ariaReadonly,
|
72
71
|
onBlur: onBlurProp,
|
72
|
+
onFocus: onFocusProp,
|
73
73
|
...formControlProps
|
74
74
|
},
|
75
75
|
rest
|
@@ -123,16 +123,16 @@ var useRadio = ({
|
|
123
123
|
...formControlProps,
|
124
124
|
...props2,
|
125
125
|
ref,
|
126
|
+
"aria-hidden": true,
|
126
127
|
"data-active": (0, import_utils2.dataAttr)(isActive),
|
127
|
-
"data-hover": (0, import_utils2.dataAttr)(isHovered),
|
128
128
|
"data-checked": (0, import_utils2.dataAttr)(checked),
|
129
129
|
"data-focus": (0, import_utils2.dataAttr)(isFocused),
|
130
130
|
"data-focus-visible": (0, import_utils2.dataAttr)(isFocused && isFocusVisible),
|
131
|
-
"
|
132
|
-
onMouseDown: (0, import_utils2.handlerAll)(props2
|
133
|
-
|
134
|
-
|
135
|
-
|
131
|
+
"data-hover": (0, import_utils2.dataAttr)(isHovered),
|
132
|
+
onMouseDown: (0, import_utils2.handlerAll)(props2.onMouseDown, () => setActive(true)),
|
133
|
+
onMouseEnter: (0, import_utils2.handlerAll)(props2.onMouseEnter, () => setHovered(true)),
|
134
|
+
onMouseLeave: (0, import_utils2.handlerAll)(props2.onMouseLeave, () => setHovered(false)),
|
135
|
+
onMouseUp: (0, import_utils2.handlerAll)(props2.onMouseUp, () => setActive(false))
|
136
136
|
}),
|
137
137
|
[checked, isActive, isFocused, isFocusVisible, isHovered, formControlProps]
|
138
138
|
);
|
@@ -140,32 +140,32 @@ var useRadio = ({
|
|
140
140
|
(props2 = {}, ref = null) => ({
|
141
141
|
...formControlProps,
|
142
142
|
...props2,
|
143
|
-
ref,
|
144
143
|
id,
|
144
|
+
ref,
|
145
145
|
type: "radio",
|
146
146
|
name,
|
147
|
-
value,
|
148
|
-
required,
|
149
|
-
disabled,
|
150
|
-
readOnly,
|
151
|
-
checked,
|
152
|
-
"aria-checked": checked,
|
153
147
|
style: {
|
154
148
|
border: "0px",
|
155
149
|
clip: "rect(0px, 0px, 0px, 0px)",
|
156
150
|
height: "1px",
|
157
|
-
width: "1px",
|
158
151
|
margin: "-1px",
|
159
|
-
padding: "0px",
|
160
152
|
overflow: "hidden",
|
153
|
+
padding: "0px",
|
154
|
+
position: "absolute",
|
161
155
|
whiteSpace: "nowrap",
|
162
|
-
|
156
|
+
width: "1px"
|
163
157
|
},
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
158
|
+
checked,
|
159
|
+
disabled,
|
160
|
+
readOnly,
|
161
|
+
required,
|
162
|
+
value,
|
163
|
+
"aria-checked": checked,
|
164
|
+
onBlur: (0, import_utils2.handlerAll)(props2.onBlur, onBlur, () => setFocused(false)),
|
165
|
+
onChange: (0, import_utils2.handlerAll)(props2.onChange, onChange),
|
166
|
+
onFocus: (0, import_utils2.handlerAll)(props2.onFocus, onFocus, () => setFocused(true)),
|
167
|
+
onKeyDown: (0, import_utils2.handlerAll)(props2.onKeyDown, onKeyDown),
|
168
|
+
onKeyUp: (0, import_utils2.handlerAll)(props2.onKeyUp, onKeyUp)
|
169
169
|
}),
|
170
170
|
[
|
171
171
|
formControlProps,
|
@@ -188,28 +188,28 @@ var useRadio = ({
|
|
188
188
|
...formControlProps,
|
189
189
|
...props2,
|
190
190
|
ref,
|
191
|
-
|
191
|
+
"data-checked": (0, import_utils2.dataAttr)(checked),
|
192
|
+
onMouseDown: (0, import_utils2.handlerAll)(props2.onMouseDown, (ev) => {
|
192
193
|
ev.preventDefault();
|
193
194
|
ev.stopPropagation();
|
194
195
|
}),
|
195
|
-
onTouchStart: (0, import_utils2.handlerAll)(props2
|
196
|
+
onTouchStart: (0, import_utils2.handlerAll)(props2.onTouchStart, (ev) => {
|
196
197
|
ev.preventDefault();
|
197
198
|
ev.stopPropagation();
|
198
|
-
})
|
199
|
-
"data-checked": (0, import_utils2.dataAttr)(checked)
|
199
|
+
})
|
200
200
|
}),
|
201
201
|
[checked, formControlProps]
|
202
202
|
);
|
203
203
|
return {
|
204
|
-
props: rest,
|
205
|
-
isFocusVisible,
|
206
|
-
isFocused,
|
207
|
-
isHovered,
|
208
204
|
isActive,
|
209
205
|
isChecked: checked,
|
206
|
+
isFocused,
|
207
|
+
isFocusVisible,
|
208
|
+
isHovered,
|
209
|
+
props: rest,
|
210
210
|
getContainerProps,
|
211
|
-
getInputProps,
|
212
211
|
getIconProps,
|
212
|
+
getInputProps,
|
213
213
|
getLabelProps
|
214
214
|
};
|
215
215
|
};
|
@@ -225,33 +225,33 @@ var Radio = (0, import_react.forwardRef)(
|
|
225
225
|
});
|
226
226
|
const {
|
227
227
|
className,
|
228
|
+
children,
|
228
229
|
gap = "0.5rem",
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
230
|
+
isDisabled = (_a = groupProps.isDisabled) != null ? _a : control.isDisabled,
|
231
|
+
isInvalid = (_b = groupProps.isInvalid) != null ? _b : control.isInvalid,
|
232
|
+
isReadOnly = (_c = groupProps.isReadOnly) != null ? _c : control.isReadOnly,
|
233
|
+
isRequired = (_d = groupProps.isRequired) != null ? _d : control.isRequired,
|
233
234
|
iconProps,
|
234
235
|
inputProps,
|
235
236
|
labelProps,
|
236
|
-
children,
|
237
237
|
...computedProps
|
238
238
|
} = (0, import_core.omitThemeProps)(mergedProps);
|
239
239
|
const isCheckedProp = groupValue && computedProps.value ? groupValue === computedProps.value : computedProps.isChecked;
|
240
240
|
const onChange = groupProps.onChange && computedProps.value ? (0, import_utils2.funcAll)(groupProps.onChange, computedProps.onChange) : computedProps.onChange;
|
241
241
|
const {
|
242
242
|
isChecked,
|
243
|
+
props: rest,
|
243
244
|
getContainerProps,
|
244
|
-
getInputProps,
|
245
245
|
getIconProps,
|
246
|
-
|
247
|
-
|
246
|
+
getInputProps,
|
247
|
+
getLabelProps
|
248
248
|
} = useRadio({
|
249
249
|
...computedProps,
|
250
|
-
|
251
|
-
isReadOnly,
|
250
|
+
isChecked: isCheckedProp,
|
252
251
|
isDisabled,
|
253
252
|
isInvalid,
|
254
|
-
|
253
|
+
isReadOnly,
|
254
|
+
isRequired,
|
255
255
|
onChange
|
256
256
|
});
|
257
257
|
const tabIndex = !groupValue ? 0 : isChecked ? 0 : -1;
|
@@ -261,12 +261,12 @@ var Radio = (0, import_react.forwardRef)(
|
|
261
261
|
className: (0, import_utils2.cx)("ui-radio", className),
|
262
262
|
...getContainerProps(rest),
|
263
263
|
__css: {
|
264
|
+
alignItems: "center",
|
264
265
|
cursor: "pointer",
|
265
|
-
position: "relative",
|
266
266
|
display: "inline-flex",
|
267
|
-
alignItems: "center",
|
268
|
-
verticalAlign: "top",
|
269
267
|
gap,
|
268
|
+
position: "relative",
|
269
|
+
verticalAlign: "top",
|
270
270
|
...styles.container
|
271
271
|
},
|
272
272
|
children: [
|
@@ -289,8 +289,8 @@ var Radio = (0, import_react.forwardRef)(
|
|
289
289
|
className: "ui-radio__icon",
|
290
290
|
...getIconProps(iconProps),
|
291
291
|
__css: {
|
292
|
-
position: "relative",
|
293
292
|
display: "inline-block",
|
293
|
+
position: "relative",
|
294
294
|
userSelect: "none",
|
295
295
|
...styles.icon
|
296
296
|
}
|
@@ -319,9 +319,9 @@ var isEvent = (value) => value && (0, import_utils3.isObject)(value) && (0, impo
|
|
319
319
|
var useRadioGroup = ({
|
320
320
|
id,
|
321
321
|
name,
|
322
|
+
defaultValue,
|
322
323
|
isNative,
|
323
324
|
value: valueProp,
|
324
|
-
defaultValue,
|
325
325
|
onChange: onChangeProp,
|
326
326
|
...props
|
327
327
|
}) => {
|
@@ -330,8 +330,8 @@ var useRadioGroup = ({
|
|
330
330
|
name != null ? name : name = `radio-${id}`;
|
331
331
|
const onChangeRef = (0, import_utils3.useCallbackRef)(onChangeProp);
|
332
332
|
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
333
|
-
value: valueProp,
|
334
333
|
defaultValue,
|
334
|
+
value: valueProp,
|
335
335
|
onChange: onChangeRef
|
336
336
|
});
|
337
337
|
const containerRef = (0, import_react2.useRef)(null);
|
@@ -370,7 +370,10 @@ var useRadioGroup = ({
|
|
370
370
|
...props2,
|
371
371
|
ref,
|
372
372
|
name,
|
373
|
-
[isNative ? "checked" : "isChecked"]:
|
373
|
+
[isNative ? "checked" : "isChecked"]: (
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
375
|
+
value != null ? isChecked : void 0
|
376
|
+
),
|
374
377
|
"aria-checked": isChecked,
|
375
378
|
onChange
|
376
379
|
};
|
@@ -378,36 +381,36 @@ var useRadioGroup = ({
|
|
378
381
|
[name, value, onChange, isNative]
|
379
382
|
);
|
380
383
|
return {
|
381
|
-
props,
|
382
384
|
id,
|
383
385
|
name,
|
384
|
-
|
386
|
+
props,
|
385
387
|
setValue,
|
386
|
-
|
387
|
-
onFocus,
|
388
|
+
value,
|
388
389
|
getContainerProps,
|
389
|
-
getRadioProps
|
390
|
+
getRadioProps,
|
391
|
+
onChange,
|
392
|
+
onFocus
|
390
393
|
};
|
391
394
|
};
|
392
395
|
var RadioGroup = (0, import_react2.forwardRef)(
|
393
396
|
({
|
394
397
|
id: idProp,
|
395
398
|
className,
|
396
|
-
size,
|
397
|
-
variant,
|
398
|
-
colorScheme,
|
399
399
|
children,
|
400
|
-
|
400
|
+
colorScheme,
|
401
401
|
direction = "column",
|
402
402
|
gap,
|
403
|
+
items = [],
|
404
|
+
size,
|
405
|
+
variant,
|
403
406
|
...props
|
404
407
|
}, ref) => {
|
405
408
|
const {
|
406
|
-
labelId,
|
407
|
-
isRequired,
|
408
|
-
isReadOnly,
|
409
409
|
isDisabled,
|
410
410
|
isInvalid,
|
411
|
+
isReadOnly,
|
412
|
+
isRequired,
|
413
|
+
labelId,
|
411
414
|
...computedProps
|
412
415
|
} = (0, import_form_control2.useFormControl)({
|
413
416
|
id: idProp,
|
@@ -416,10 +419,10 @@ var RadioGroup = (0, import_react2.forwardRef)(
|
|
416
419
|
const {
|
417
420
|
id,
|
418
421
|
name,
|
422
|
+
props: rest,
|
419
423
|
value,
|
420
|
-
onChange,
|
421
424
|
getContainerProps,
|
422
|
-
|
425
|
+
onChange
|
423
426
|
} = useRadioGroup(computedProps);
|
424
427
|
const validChildren = (0, import_utils3.getValidChildren)(children);
|
425
428
|
let computedChildren = [];
|
@@ -430,15 +433,15 @@ var RadioGroup = (0, import_react2.forwardRef)(
|
|
430
433
|
RadioGroupProvider,
|
431
434
|
{
|
432
435
|
value: {
|
433
|
-
|
434
|
-
variant,
|
436
|
+
name,
|
435
437
|
colorScheme,
|
436
|
-
isRequired,
|
437
|
-
isReadOnly,
|
438
438
|
isDisabled,
|
439
439
|
isInvalid,
|
440
|
-
|
440
|
+
isReadOnly,
|
441
|
+
isRequired,
|
442
|
+
size,
|
441
443
|
value,
|
444
|
+
variant,
|
442
445
|
onChange
|
443
446
|
},
|
444
447
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
package/dist/radio-group.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/radio-group.tsx","../src/radio.tsx","../src/radio-context.ts"],"sourcesContent":["import type { ComponentArgs, ThemeProps, PropGetter } from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControl } from \"@yamada-ui/form-control\"\nimport type { FlexProps } from \"@yamada-ui/layouts\"\nimport { Flex } from \"@yamada-ui/layouts\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport {\n cx,\n isObject,\n useCallbackRef,\n getValidChildren,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type {\n ChangeEvent,\n ForwardedRef,\n ReactElement,\n RefAttributes,\n} from \"react\"\nimport { useCallback, useId, useRef, forwardRef } from \"react\"\nimport type { RadioProps } from \"./radio\"\nimport { Radio } from \"./radio\"\nimport type { RadioGroupContext } from \"./radio-context\"\nimport { RadioGroupProvider } from \"./radio-context\"\n\nexport type RadioItem<Y extends string | number = string> = RadioProps<Y> & {\n label?: string\n}\n\nconst isEvent = (value: any): value is { target: HTMLInputElement } =>\n value && isObject(value) && isObject(value.target)\n\nexport interface UseRadioGroupProps<Y extends string | number = string> {\n /**\n * The top-level id string that will be applied to the radios.\n * The index of the radio will be appended to this top-level id.\n */\n id?: string\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * The value of the radio group.\n */\n value?: Y\n /**\n * The initial value of the radio group.\n */\n defaultValue?: Y\n /**\n * The callback fired when any children radio is checked or unchecked.\n */\n onChange?: (value: Y) => void\n /**\n * If `true`, input elements will receive `checked` attribute instead of `isChecked`.\n *\n * This assumes, you're using native radio inputs.\n *\n * @default false\n */\n isNative?: boolean\n}\n\nexport const useRadioGroup = <\n Y extends string | number,\n M extends Dict = Dict,\n>({\n id,\n name,\n isNative,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n ...props\n}: UseRadioGroupProps<Y> & M) => {\n const uuid = useId()\n\n id ??= uuid\n name ??= `radio-${id}`\n\n const onChangeRef = useCallbackRef(onChangeProp)\n\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue,\n onChange: onChangeRef,\n })\n\n const containerRef = useRef<any>(null)\n\n const onFocus = useCallback(() => {\n const container = containerRef.current\n\n if (!container) return\n\n let query = `input:not(:disabled):checked`\n\n let firstInput = container.querySelector(query) as HTMLElement | undefined\n\n if (firstInput) {\n firstInput.focus()\n } else {\n query = `input:not(:disabled)`\n firstInput = container.querySelector(query) as HTMLElement | undefined\n\n firstInput?.focus()\n }\n }, [])\n\n const onChange = useCallback(\n (evOrValue: ChangeEvent<HTMLInputElement> | Y) => {\n const nextValue = (\n isEvent(evOrValue) ? evOrValue.target.value : evOrValue\n ) as Y\n\n setValue(nextValue)\n },\n [setValue],\n )\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n role: \"radiogroup\",\n ...props,\n ref: mergeRefs(ref, containerRef),\n }),\n [],\n )\n\n const getRadioProps: PropGetter<\n { value?: Y },\n { value?: Y; checked?: boolean; isChecked?: boolean }\n > = useCallback(\n (props = {}, ref = null) => {\n const isChecked = props.value === value\n\n return {\n ...props,\n ref,\n name,\n [isNative ? \"checked\" : \"isChecked\"]:\n value != null ? isChecked : undefined,\n \"aria-checked\": isChecked,\n onChange,\n }\n },\n [name, value, onChange, isNative],\n )\n\n return {\n props,\n id,\n name,\n value,\n setValue,\n onChange,\n onFocus,\n getContainerProps,\n getRadioProps,\n }\n}\n\nexport type UseRadioGroupReturn<Y extends string | number = string> =\n ReturnType<typeof useRadioGroup<Y>>\n\nexport interface RadioGroupProps<Y extends string | number = string>\n extends ThemeProps<\"Radio\">,\n Omit<FlexProps, \"defaultValue\" | \"onChange\">,\n UseRadioGroupProps<Y>,\n FormControlOptions {\n /**\n * If provided, generate radios based on items.\n *\n * @default '[]'\n */\n items?: RadioItem<Y>[]\n}\n\nexport const RadioGroup = forwardRef(\n <Y extends string | number = string>(\n {\n id: idProp,\n className,\n size,\n variant,\n colorScheme,\n children,\n items = [],\n direction = \"column\",\n gap,\n ...props\n }: RadioGroupProps<Y>,\n ref: ForwardedRef<HTMLDivElement>,\n ) => {\n const {\n labelId,\n isRequired,\n isReadOnly,\n isDisabled,\n isInvalid,\n ...computedProps\n } = useFormControl({\n id: idProp,\n ...props,\n })\n const {\n id,\n name,\n value,\n onChange,\n getContainerProps,\n props: rest,\n } = useRadioGroup(computedProps)\n\n const validChildren = getValidChildren(children)\n let computedChildren: ReactElement[] = []\n\n if (!validChildren.length && items.length) {\n computedChildren = items.map(({ label, value, ...props }, i) => (\n <Radio key={i} value={value} {...props}>\n {label}\n </Radio>\n ))\n }\n\n return (\n <RadioGroupProvider\n value={\n {\n size,\n variant,\n colorScheme,\n isRequired,\n isReadOnly,\n isDisabled,\n isInvalid,\n name,\n value,\n onChange,\n } as RadioGroupContext\n }\n >\n <Flex\n ref={ref}\n className={cx(\"ui-radio-group\", className)}\n gap={gap ?? (direction === \"row\" ? \"1rem\" : undefined)}\n {...getContainerProps({\n id,\n \"aria-labelledby\": labelId,\n ...rest,\n })}\n direction={direction}\n >\n {children ?? computedChildren}\n </Flex>\n </RadioGroupProvider>\n )\n },\n) as {\n <Y extends string | number = string>(\n props: RadioGroupProps<Y> & RefAttributes<HTMLDivElement>,\n ): JSX.Element\n} & ComponentArgs\n\nRadioGroup.displayName = \"RadioGroup\"\nRadioGroup.__ui__ = \"RadioGroup\"\n","import type {\n HTMLUIProps,\n ThemeProps,\n ComponentArgs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport { ui, useComponentMultiStyle, omitThemeProps } from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport {\n useFormControl,\n useFormControlProps,\n formControlProperties,\n} from \"@yamada-ui/form-control\"\nimport { trackFocusVisible } from \"@yamada-ui/use-focus-visible\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport {\n cx,\n useCallbackRef,\n funcAll,\n handlerAll,\n dataAttr,\n splitObject,\n} from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n ChangeEvent,\n ChangeEventHandler,\n InputHTMLAttributes,\n KeyboardEvent,\n SyntheticEvent,\n RefAttributes,\n} from \"react\"\nimport { forwardRef, useCallback, useEffect, useId, useState } from \"react\"\nimport { useRadioGroupContext } from \"./radio-context\"\n\nexport interface UseRadioProps<Y extends string | number = string>\n extends FormControlOptions {\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * The name of the input field in a radio.\n */\n name?: string\n /**\n * The value to be used in the radio button.\n */\n value?: Y\n /**\n * If `true`, the radio will be initially checked.\n *\n * @default false\n */\n defaultIsChecked?: boolean\n /**\n * If `true`, the radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n}\n\nexport const useRadio = <\n Y extends string | number = string,\n M extends Dict = Dict,\n>({\n id,\n ...props\n}: UseRadioProps<Y> & M) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n id: _id,\n name,\n value,\n isChecked: isCheckedProp,\n defaultIsChecked,\n onChange: onChangeProp,\n ...computedProps\n } = useFormControlProps({ id, ...props })\n const [\n {\n \"aria-readonly\": _ariaReadonly,\n required,\n disabled,\n readOnly,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n ...formControlProps\n },\n rest,\n ] = splitObject(computedProps, formControlProperties)\n\n const [isFocusVisible, setIsFocusVisible] = useState<boolean>(false)\n const [isFocused, setFocused] = useState<boolean>(false)\n const [isHovered, setHovered] = useState<boolean>(false)\n const [isActive, setActive] = useState<boolean>(false)\n\n const [isChecked, setIsChecked] = useState<boolean>(!!defaultIsChecked)\n\n const isControlled = isCheckedProp !== undefined\n const checked = isControlled ? (isCheckedProp as boolean) : isChecked\n\n useEffect(() => {\n return trackFocusVisible(setIsFocusVisible)\n }, [])\n\n const onChange = useCallbackRef(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (readOnly || disabled) {\n ev.preventDefault()\n\n return\n }\n\n if (!isControlled) setIsChecked(ev.target.checked)\n\n onChangeProp?.(ev)\n },\n [readOnly, disabled, isControlled],\n )\n const onFocus = useCallbackRef(onFocusProp)\n const onBlur = useCallbackRef(onBlurProp)\n\n const onKeyDown = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === \" \") setActive(true)\n },\n [setActive],\n )\n\n const onKeyUp = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === \" \") setActive(false)\n },\n [setActive],\n )\n\n const getContainerProps: PropGetter<\"label\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n \"data-checked\": dataAttr(checked),\n }),\n [checked, formControlProps],\n )\n\n const getIconProps: PropGetter<\"span\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n \"data-hover\": dataAttr(isHovered),\n \"data-checked\": dataAttr(checked),\n \"data-focus\": dataAttr(isFocused),\n \"data-focus-visible\": dataAttr(isFocused && isFocusVisible),\n \"aria-hidden\": true,\n onMouseDown: handlerAll(props?.onMouseDown, () => setActive(true)),\n onMouseUp: handlerAll(props?.onMouseUp, () => setActive(false)),\n onMouseEnter: handlerAll(props?.onMouseEnter, () => setHovered(true)),\n onMouseLeave: handlerAll(props?.onMouseLeave, () => setHovered(false)),\n }),\n [checked, isActive, isFocused, isFocusVisible, isHovered, formControlProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n id,\n type: \"radio\",\n name,\n value,\n required,\n disabled,\n readOnly,\n checked,\n \"aria-checked\": checked,\n style: {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n width: \"1px\",\n margin: \"-1px\",\n padding: \"0px\",\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n position: \"absolute\",\n },\n onChange: handlerAll(props?.onChange, onChange),\n onBlur: handlerAll(props?.onBlur, onBlur, () => setFocused(false)),\n onFocus: handlerAll(props?.onFocus, onFocus, () => setFocused(true)),\n onKeyDown: handlerAll(props?.onKeyDown, onKeyDown),\n onKeyUp: handlerAll(props?.onKeyUp, onKeyUp),\n }),\n [\n formControlProps,\n id,\n name,\n value,\n required,\n disabled,\n readOnly,\n checked,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n ],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n onMouseDown: handlerAll(props?.onMouseDown, (ev: SyntheticEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n }),\n onTouchStart: handlerAll(props?.onTouchStart, (ev: SyntheticEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n }),\n \"data-checked\": dataAttr(checked),\n }),\n [checked, formControlProps],\n )\n\n return {\n props: rest,\n isFocusVisible,\n isFocused,\n isHovered,\n isActive,\n isChecked: checked,\n getContainerProps,\n getInputProps,\n getIconProps,\n getLabelProps,\n }\n}\n\nexport type UseRadioReturn = ReturnType<typeof useRadio>\n\ninterface RadioOptions {\n iconProps?: HTMLUIProps<\"span\">\n inputProps?: InputHTMLAttributes<HTMLInputElement>\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport interface RadioProps<Y extends string | number = string>\n extends Omit<HTMLUIProps<\"label\">, keyof UseRadioProps>,\n ThemeProps<\"Radio\">,\n UseRadioProps<Y>,\n RadioOptions {}\n\n/**\n * `Radio` is a component used for allowing users to select one option from multiple choices.\n *\n * @see Docs https://yamada-ui.com/components/forms/radio\n */\nexport const Radio = forwardRef(\n <Y extends string | number = string>(\n props: RadioProps<Y>,\n ref: ForwardedRef<HTMLInputElement>,\n ) => {\n const group = useRadioGroupContext()\n const { value: groupValue, ...groupProps } = { ...group }\n const control = useFormControl(props)\n const [styles, mergedProps] = useComponentMultiStyle(\"Radio\", {\n ...groupProps,\n ...props,\n })\n const {\n className,\n gap = \"0.5rem\",\n isRequired = groupProps.isRequired ?? control.isRequired,\n isReadOnly = groupProps.isReadOnly ?? control.isReadOnly,\n isDisabled = groupProps.isDisabled ?? control.isDisabled,\n isInvalid = groupProps.isInvalid ?? control.isInvalid,\n iconProps,\n inputProps,\n labelProps,\n children,\n ...computedProps\n } = omitThemeProps(mergedProps)\n\n const isCheckedProp =\n groupValue && computedProps.value\n ? groupValue === computedProps.value\n : computedProps.isChecked\n\n const onChange =\n groupProps.onChange && computedProps.value\n ? funcAll(groupProps.onChange, computedProps.onChange)\n : computedProps.onChange\n\n const {\n isChecked,\n getContainerProps,\n getInputProps,\n getIconProps,\n getLabelProps,\n props: rest,\n } = useRadio({\n ...computedProps,\n isRequired,\n isReadOnly,\n isDisabled,\n isInvalid,\n isChecked: isCheckedProp,\n onChange,\n })\n\n const tabIndex = !groupValue ? 0 : isChecked ? 0 : -1\n\n return (\n <ui.label\n className={cx(\"ui-radio\", className)}\n {...getContainerProps(rest)}\n __css={{\n cursor: \"pointer\",\n position: \"relative\",\n display: \"inline-flex\",\n alignItems: \"center\",\n verticalAlign: \"top\",\n gap,\n ...styles.container,\n }}\n >\n <ui.input\n className=\"ui-radio__input\"\n {...getInputProps(\n {\n ...inputProps,\n tabIndex,\n },\n ref,\n )}\n />\n\n <ui.span\n className=\"ui-radio__icon\"\n {...getIconProps(iconProps)}\n __css={{\n position: \"relative\",\n display: \"inline-block\",\n userSelect: \"none\",\n ...styles.icon,\n }}\n />\n\n <ui.span\n className=\"ui-radio__label\"\n {...getLabelProps(labelProps)}\n __css={{ ...styles.label }}\n >\n {children}\n </ui.span>\n </ui.label>\n )\n },\n) as {\n <Y extends string | number = string>(\n props: RadioProps<Y> & RefAttributes<HTMLInputElement>,\n ): JSX.Element\n} & ComponentArgs\n\nRadio.displayName = \"Radio\"\nRadio.__ui__ = \"Radio\"\n","import type { ThemeProps } from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type { ChangeEvent } from \"react\"\n\nexport interface RadioGroupContext\n extends ThemeProps<\"Radio\">,\n FormControlOptions {\n name: string\n value: string | number\n onChange: (evOrValue: ChangeEvent<HTMLInputElement> | string | number) => void\n}\n\nexport const [RadioGroupProvider, useRadioGroupContext] = createContext<\n RadioGroupContext | undef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AAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAW,kBAAG,kBAAkB,SAAS;AAAA,YACzC,KAAK,oBAAQ,cAAc,QAAQ,SAAS;AAAA,YAC3C,GAAG,kBAAkB;AAAA,cACpB;AAAA,cACA,mBAAmB;AAAA,cACnB,GAAG;AAAA,YACL,CAAC;AAAA,YACD;AAAA,YAEC,wCAAY;AAAA;AAAA,QACf;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAMA,WAAW,cAAc;AACzB,WAAW,SAAS;","names":["import_form_control","import_utils","import_react","import_utils","props","import_jsx_runtime","props","value"]}
|
1
|
+
{"version":3,"sources":["../src/radio-group.tsx","../src/radio.tsx","../src/radio-context.ts"],"sourcesContent":["import type { ComponentArgs, PropGetter, ThemeProps } from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { FlexProps } from \"@yamada-ui/layouts\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type {\n ChangeEvent,\n ForwardedRef,\n ReactElement,\n RefAttributes,\n} from \"react\"\nimport type { RadioProps } from \"./radio\"\nimport type { RadioGroupContext } from \"./radio-context\"\nimport { useFormControl } from \"@yamada-ui/form-control\"\nimport { Flex } from \"@yamada-ui/layouts\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport {\n cx,\n getValidChildren,\n isObject,\n mergeRefs,\n useCallbackRef,\n} from \"@yamada-ui/utils\"\nimport { forwardRef, useCallback, useId, useRef } from \"react\"\nimport { Radio } from \"./radio\"\nimport { RadioGroupProvider } from \"./radio-context\"\n\nexport type RadioItem<Y extends number | string = string> = {\n label?: string\n} & RadioProps<Y>\n\nconst isEvent = (value: any): value is { target: HTMLInputElement } =>\n value && isObject(value) && isObject(value.target)\n\nexport interface UseRadioGroupProps<Y extends number | string = string> {\n /**\n * The top-level id string that will be applied to the radios.\n * The index of the radio will be appended to this top-level id.\n */\n id?: string\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * The initial value of the radio group.\n */\n defaultValue?: Y\n /**\n * If `true`, input elements will receive `checked` attribute instead of `isChecked`.\n *\n * This assumes, you're using native radio inputs.\n *\n * @default false\n */\n isNative?: boolean\n /**\n * The value of the radio group.\n */\n value?: Y\n /**\n * The callback fired when any children radio is checked or unchecked.\n */\n onChange?: (value: Y) => void\n}\n\nexport const useRadioGroup = <\n Y extends number | string,\n M extends Dict = Dict,\n>({\n id,\n name,\n defaultValue,\n isNative,\n value: valueProp,\n onChange: onChangeProp,\n ...props\n}: M & UseRadioGroupProps<Y>) => {\n const uuid = useId()\n\n id ??= uuid\n name ??= `radio-${id}`\n\n const onChangeRef = useCallbackRef(onChangeProp)\n\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeRef,\n })\n\n const containerRef = useRef<any>(null)\n\n const onFocus = useCallback(() => {\n const container = containerRef.current\n\n if (!container) return\n\n let query = `input:not(:disabled):checked`\n\n let firstInput = container.querySelector(query) as HTMLElement | undefined\n\n if (firstInput) {\n firstInput.focus()\n } else {\n query = `input:not(:disabled)`\n firstInput = container.querySelector(query) as HTMLElement | undefined\n\n firstInput?.focus()\n }\n }, [])\n\n const onChange = useCallback(\n (evOrValue: ChangeEvent<HTMLInputElement> | Y) => {\n const nextValue = (\n isEvent(evOrValue) ? evOrValue.target.value : evOrValue\n ) as Y\n\n setValue(nextValue)\n },\n [setValue],\n )\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n role: \"radiogroup\",\n ...props,\n ref: mergeRefs(ref, containerRef),\n }),\n [],\n )\n\n const getRadioProps: PropGetter<\n { value?: Y },\n { checked?: boolean; isChecked?: boolean; value?: Y }\n > = useCallback(\n (props = {}, ref = null) => {\n const isChecked = props.value === value\n\n return {\n ...props,\n ref,\n name,\n [isNative ? \"checked\" : \"isChecked\"]:\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n value != null ? isChecked : undefined,\n \"aria-checked\": isChecked,\n onChange,\n }\n },\n [name, value, onChange, isNative],\n )\n\n return {\n id,\n name,\n props,\n setValue,\n value,\n getContainerProps,\n getRadioProps,\n onChange,\n onFocus,\n }\n}\n\nexport type UseRadioGroupReturn<Y extends number | string = string> =\n ReturnType<typeof useRadioGroup<Y>>\n\nexport interface RadioGroupProps<Y extends number | string = string>\n extends ThemeProps<\"Radio\">,\n Omit<FlexProps, \"defaultValue\" | \"onChange\">,\n UseRadioGroupProps<Y>,\n FormControlOptions {\n /**\n * If provided, generate radios based on items.\n *\n * @default '[]'\n */\n items?: RadioItem<Y>[]\n}\n\nexport const RadioGroup = forwardRef(\n <Y extends number | string = string>(\n {\n id: idProp,\n className,\n children,\n colorScheme,\n direction = \"column\",\n gap,\n items = [],\n size,\n variant,\n ...props\n }: RadioGroupProps<Y>,\n ref: ForwardedRef<HTMLDivElement>,\n ) => {\n const {\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n labelId,\n ...computedProps\n } = useFormControl({\n id: idProp,\n ...props,\n })\n const {\n id,\n name,\n props: rest,\n value,\n getContainerProps,\n onChange,\n } = useRadioGroup(computedProps)\n\n const validChildren = getValidChildren(children)\n let computedChildren: ReactElement[] = []\n\n if (!validChildren.length && items.length) {\n computedChildren = items.map(({ label, value, ...props }, i) => (\n <Radio key={i} value={value} {...props}>\n {label}\n </Radio>\n ))\n }\n\n return (\n <RadioGroupProvider\n value={\n {\n name,\n colorScheme,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n size,\n value,\n variant,\n onChange,\n } as RadioGroupContext\n }\n >\n <Flex\n ref={ref}\n className={cx(\"ui-radio-group\", className)}\n gap={gap ?? (direction === \"row\" ? \"1rem\" : undefined)}\n {...getContainerProps({\n id,\n \"aria-labelledby\": labelId,\n ...rest,\n })}\n direction={direction}\n >\n {children ?? computedChildren}\n </Flex>\n </RadioGroupProvider>\n )\n },\n) as {\n <Y extends number | string = string>(\n props: RadioGroupProps<Y> & RefAttributes<HTMLDivElement>,\n ): ReactElement\n} & ComponentArgs\n\nRadioGroup.displayName = \"RadioGroup\"\nRadioGroup.__ui__ = \"RadioGroup\"\n","import type {\n ComponentArgs,\n HTMLUIProps,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type {\n ChangeEvent,\n ChangeEventHandler,\n ForwardedRef,\n InputHTMLAttributes,\n KeyboardEvent,\n ReactElement,\n RefAttributes,\n SyntheticEvent,\n} from \"react\"\nimport { omitThemeProps, ui, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport {\n formControlProperties,\n useFormControl,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { trackFocusVisible } from \"@yamada-ui/use-focus-visible\"\nimport {\n cx,\n dataAttr,\n funcAll,\n handlerAll,\n splitObject,\n useCallbackRef,\n} from \"@yamada-ui/utils\"\nimport { forwardRef, useCallback, useEffect, useId, useState } from \"react\"\nimport { useRadioGroupContext } from \"./radio-context\"\n\nexport interface UseRadioProps<Y extends number | string = string>\n extends FormControlOptions {\n /**\n * id assigned to input.\n */\n id?: string\n /**\n * The name of the input field in a radio.\n */\n name?: string\n /**\n * If `true`, the radio will be initially checked.\n *\n * @default false\n */\n defaultIsChecked?: boolean\n /**\n * If `true`, the radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The value to be used in the radio button.\n */\n value?: Y\n /**\n * The callback invoked when the checked state changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n}\n\nexport const useRadio = <\n Y extends number | string = string,\n M extends Dict = Dict,\n>({\n id,\n ...props\n}: M & UseRadioProps<Y>) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n id: _id,\n name,\n defaultIsChecked,\n isChecked: isCheckedProp,\n value,\n onChange: onChangeProp,\n ...computedProps\n } = useFormControlProps({ id, ...props })\n const [\n {\n disabled,\n readOnly,\n required,\n \"aria-readonly\": _ariaReadonly,\n onBlur: onBlurProp,\n onFocus: onFocusProp,\n ...formControlProps\n },\n rest,\n ] = splitObject(computedProps, formControlProperties)\n\n const [isFocusVisible, setIsFocusVisible] = useState<boolean>(false)\n const [isFocused, setFocused] = useState<boolean>(false)\n const [isHovered, setHovered] = useState<boolean>(false)\n const [isActive, setActive] = useState<boolean>(false)\n\n const [isChecked, setIsChecked] = useState<boolean>(!!defaultIsChecked)\n\n const isControlled = isCheckedProp !== undefined\n const checked = isControlled ? (isCheckedProp as boolean) : isChecked\n\n useEffect(() => {\n return trackFocusVisible(setIsFocusVisible)\n }, [])\n\n const onChange = useCallbackRef(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (readOnly || disabled) {\n ev.preventDefault()\n\n return\n }\n\n if (!isControlled) setIsChecked(ev.target.checked)\n\n onChangeProp?.(ev)\n },\n [readOnly, disabled, isControlled],\n )\n const onFocus = useCallbackRef(onFocusProp)\n const onBlur = useCallbackRef(onBlurProp)\n\n const onKeyDown = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === \" \") setActive(true)\n },\n [setActive],\n )\n\n const onKeyUp = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === \" \") setActive(false)\n },\n [setActive],\n )\n\n const getContainerProps: PropGetter<\"label\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n \"data-checked\": dataAttr(checked),\n }),\n [checked, formControlProps],\n )\n\n const getIconProps: PropGetter<\"span\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n \"aria-hidden\": true,\n \"data-active\": dataAttr(isActive),\n \"data-checked\": dataAttr(checked),\n \"data-focus\": dataAttr(isFocused),\n \"data-focus-visible\": dataAttr(isFocused && isFocusVisible),\n \"data-hover\": dataAttr(isHovered),\n onMouseDown: handlerAll(props.onMouseDown, () => setActive(true)),\n onMouseEnter: handlerAll(props.onMouseEnter, () => setHovered(true)),\n onMouseLeave: handlerAll(props.onMouseLeave, () => setHovered(false)),\n onMouseUp: handlerAll(props.onMouseUp, () => setActive(false)),\n }),\n [checked, isActive, isFocused, isFocusVisible, isHovered, formControlProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n id,\n ref,\n type: \"radio\",\n name,\n style: {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n },\n checked,\n disabled,\n readOnly,\n required,\n value,\n \"aria-checked\": checked,\n onBlur: handlerAll(props.onBlur, onBlur, () => setFocused(false)),\n onChange: handlerAll(props.onChange, onChange),\n onFocus: handlerAll(props.onFocus, onFocus, () => setFocused(true)),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onKeyUp: handlerAll(props.onKeyUp, onKeyUp),\n }),\n [\n formControlProps,\n id,\n name,\n value,\n required,\n disabled,\n readOnly,\n checked,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n ],\n )\n\n const getLabelProps: PropGetter<\"span\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n ...props,\n ref,\n \"data-checked\": dataAttr(checked),\n onMouseDown: handlerAll(props.onMouseDown, (ev: SyntheticEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n }),\n onTouchStart: handlerAll(props.onTouchStart, (ev: SyntheticEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n }),\n }),\n [checked, formControlProps],\n )\n\n return {\n isActive,\n isChecked: checked,\n isFocused,\n isFocusVisible,\n isHovered,\n props: rest,\n getContainerProps,\n getIconProps,\n getInputProps,\n getLabelProps,\n }\n}\n\nexport type UseRadioReturn = ReturnType<typeof useRadio>\n\ninterface RadioOptions {\n iconProps?: HTMLUIProps<\"span\">\n inputProps?: InputHTMLAttributes<HTMLInputElement>\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport interface RadioProps<Y extends number | string = string>\n extends Omit<HTMLUIProps<\"label\">, keyof UseRadioProps>,\n ThemeProps<\"Radio\">,\n UseRadioProps<Y>,\n RadioOptions {}\n\n/**\n * `Radio` is a component used for allowing users to select one option from multiple choices.\n *\n * @see Docs https://yamada-ui.com/components/forms/radio\n */\nexport const Radio = forwardRef(\n <Y extends number | string = string>(\n props: RadioProps<Y>,\n ref: ForwardedRef<HTMLInputElement>,\n ) => {\n const group = useRadioGroupContext()\n const { value: groupValue, ...groupProps } = { ...group }\n const control = useFormControl(props)\n const [styles, mergedProps] = useComponentMultiStyle(\"Radio\", {\n ...groupProps,\n ...props,\n })\n const {\n className,\n children,\n gap = \"0.5rem\",\n isDisabled = groupProps.isDisabled ?? control.isDisabled,\n isInvalid = groupProps.isInvalid ?? control.isInvalid,\n isReadOnly = groupProps.isReadOnly ?? control.isReadOnly,\n isRequired = groupProps.isRequired ?? control.isRequired,\n iconProps,\n inputProps,\n labelProps,\n ...computedProps\n } = omitThemeProps(mergedProps)\n\n const isCheckedProp =\n groupValue && computedProps.value\n ? groupValue === computedProps.value\n : computedProps.isChecked\n\n const onChange =\n groupProps.onChange && computedProps.value\n ? funcAll(groupProps.onChange, computedProps.onChange)\n : computedProps.onChange\n\n const {\n isChecked,\n props: rest,\n getContainerProps,\n getIconProps,\n getInputProps,\n getLabelProps,\n } = useRadio({\n ...computedProps,\n isChecked: isCheckedProp,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n onChange,\n })\n\n const tabIndex = !groupValue ? 0 : isChecked ? 0 : -1\n\n return (\n <ui.label\n className={cx(\"ui-radio\", className)}\n {...getContainerProps(rest)}\n __css={{\n alignItems: \"center\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n gap,\n position: \"relative\",\n verticalAlign: \"top\",\n ...styles.container,\n }}\n >\n <ui.input\n className=\"ui-radio__input\"\n {...getInputProps(\n {\n ...inputProps,\n tabIndex,\n },\n ref,\n )}\n />\n\n <ui.span\n className=\"ui-radio__icon\"\n {...getIconProps(iconProps)}\n __css={{\n display: \"inline-block\",\n position: \"relative\",\n userSelect: \"none\",\n ...styles.icon,\n }}\n />\n\n <ui.span\n className=\"ui-radio__label\"\n {...getLabelProps(labelProps)}\n __css={{ ...styles.label }}\n >\n {children}\n </ui.span>\n </ui.label>\n )\n },\n) as {\n <Y extends number | string = string>(\n props: RadioProps<Y> & RefAttributes<HTMLInputElement>,\n ): ReactElement\n} & ComponentArgs\n\nRadio.displayName = \"Radio\"\nRadio.__ui__ = \"Radio\"\n","import type { ThemeProps } from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { ChangeEvent } from \"react\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport interface RadioGroupContext\n extends ThemeProps<\"Radio\">,\n FormControlOptions {\n name: string\n value: number | string\n onChange: (evOrValue: ChangeEvent<HTMLInputElement> | number | string) => void\n}\n\nexport const [RadioGroupProvider, useRadioGroupContext] = createContext<\n RadioGroupContext | undefined\n>({\n name: \"RadioGroupContext\",\n strict: false,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,IAAAA,uBAA+B;AAC/B,qBAAqB;AACrB,oCAAqC;AACrC,IAAAC,gBAMO;AACP,IAAAC,gBAAuD;;;ACJvD,kBAA2D;AAC3D,0BAIO;AACP,+BAAkC;AAClC,IAAAC,gBAOO;AACP,mBAAoE;;;AC9BpE,mBAA8B;AAUvB,IAAM,CAAC,oBAAoB,oBAAoB,QAAI,4BAExD;AAAA,EACA,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;;;ADwTK;AAtQC,IAAM,WAAW,CAGtB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA4B;AAC1B,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM;AAAA,IACJ,IAAI;AAAA,IACJ;AAAA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ACjB,IAAI;AAAA,MACJ,GAAG;AAAA,IACL,CAAC;AACD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI,cAAc,aAAa;AAE/B,UAAM,oBAAgB,gCAAiB,QAAQ;AAC/C,QAAI,mBAAmC,CAAC;AAExC,QAAI,CAAC,cAAc,UAAU,MAAM,QAAQ;AACzC,yBAAmB,MAAM,IAAI,CAAC,EAAE,OAAO,OAAAC,QAAO,GAAGD,OAAM,GAAG,MACxD,6CAAC,SAAc,OAAOC,QAAQ,GAAGD,QAC9B,mBADS,CAEZ,CACD;AAAA,IACH;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OACE;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAW,kBAAG,kBAAkB,SAAS;AAAA,YACzC,KAAK,oBAAQ,cAAc,QAAQ,SAAS;AAAA,YAC3C,GAAG,kBAAkB;AAAA,cACpB;AAAA,cACA,mBAAmB;AAAA,cACnB,GAAG;AAAA,YACL,CAAC;AAAA,YACD;AAAA,YAEC,wCAAY;AAAA;AAAA,QACf;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAMA,WAAW,cAAc;AACzB,WAAW,SAAS;","names":["import_form_control","import_utils","import_react","import_utils","props","import_jsx_runtime","props","value"]}
|
package/dist/radio-group.mjs
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
import {
|
3
3
|
RadioGroup,
|
4
4
|
useRadioGroup
|
5
|
-
} from "./chunk-
|
6
|
-
import "./chunk-
|
7
|
-
import "./chunk-
|
5
|
+
} from "./chunk-SEIJP3FH.mjs";
|
6
|
+
import "./chunk-HK742PKK.mjs";
|
7
|
+
import "./chunk-6FMV6NX2.mjs";
|
8
8
|
export {
|
9
9
|
RadioGroup,
|
10
10
|
useRadioGroup
|
package/dist/radio.d.mts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as _yamada_ui_form_control from '@yamada-ui/form-control';
|
2
2
|
import { FormControlOptions } from '@yamada-ui/form-control';
|
3
3
|
import * as react from 'react';
|
4
|
-
import { ChangeEventHandler, RefAttributes, InputHTMLAttributes } from 'react';
|
4
|
+
import { ChangeEventHandler, RefAttributes, ReactElement, InputHTMLAttributes } from 'react';
|
5
5
|
import { PropGetter, HTMLUIProps, ThemeProps, ComponentArgs } from '@yamada-ui/core';
|
6
6
|
import { Dict } from '@yamada-ui/utils';
|
7
7
|
|
8
|
-
interface UseRadioProps<Y extends
|
8
|
+
interface UseRadioProps<Y extends number | string = string> extends FormControlOptions {
|
9
9
|
/**
|
10
10
|
* id assigned to input.
|
11
11
|
*/
|
@@ -14,10 +14,6 @@ interface UseRadioProps<Y extends string | number = string> extends FormControlO
|
|
14
14
|
* The name of the input field in a radio.
|
15
15
|
*/
|
16
16
|
name?: string;
|
17
|
-
/**
|
18
|
-
* The value to be used in the radio button.
|
19
|
-
*/
|
20
|
-
value?: Y;
|
21
17
|
/**
|
22
18
|
* If `true`, the radio will be initially checked.
|
23
19
|
*
|
@@ -30,40 +26,44 @@ interface UseRadioProps<Y extends string | number = string> extends FormControlO
|
|
30
26
|
* @default false
|
31
27
|
*/
|
32
28
|
isChecked?: boolean;
|
29
|
+
/**
|
30
|
+
* The value to be used in the radio button.
|
31
|
+
*/
|
32
|
+
value?: Y;
|
33
33
|
/**
|
34
34
|
* The callback invoked when the checked state changes.
|
35
35
|
*/
|
36
36
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
37
37
|
}
|
38
|
-
declare const useRadio: <Y extends
|
38
|
+
declare const useRadio: <Y extends number | string = string, M extends Dict = Dict<any>>({ id, ...props }: M & UseRadioProps<Y>) => {
|
39
|
+
isActive: boolean;
|
40
|
+
isChecked: boolean;
|
41
|
+
isFocused: boolean;
|
42
|
+
isFocusVisible: boolean;
|
43
|
+
isHovered: boolean;
|
39
44
|
props: Omit<Omit<{
|
40
|
-
_hover?: {} | undefined;
|
41
45
|
_active?: {} | undefined;
|
42
46
|
_focus?: {} | undefined;
|
43
|
-
_invalid?: {} | undefined;
|
44
47
|
_focusVisible?: {} | undefined;
|
48
|
+
_hover?: {} | undefined;
|
49
|
+
_invalid?: {} | undefined;
|
45
50
|
id: string | undefined;
|
46
51
|
disabled: boolean | undefined;
|
47
|
-
required: boolean | undefined;
|
48
52
|
readOnly: boolean | undefined;
|
53
|
+
required: boolean | undefined;
|
49
54
|
"aria-disabled": boolean | undefined;
|
55
|
+
"aria-invalid": boolean | undefined;
|
50
56
|
"aria-readonly": boolean | undefined;
|
51
57
|
"aria-required": boolean | undefined;
|
52
|
-
"aria-invalid": boolean | undefined;
|
53
58
|
"data-readonly": boolean | "false" | "true";
|
54
|
-
onFocus: (event: react.FocusEvent<HTMLElement, Element>) => void;
|
55
59
|
onBlur: (event: react.FocusEvent<HTMLElement, Element>) => void;
|
56
|
-
|
60
|
+
onFocus: (event: react.FocusEvent<HTMLElement, Element>) => void;
|
61
|
+
} & Omit<{
|
57
62
|
id: string;
|
58
|
-
} & Omit<UseRadioProps<Y> &
|
59
|
-
isFocusVisible: boolean;
|
60
|
-
isFocused: boolean;
|
61
|
-
isHovered: boolean;
|
62
|
-
isActive: boolean;
|
63
|
-
isChecked: boolean;
|
63
|
+
} & Omit<M & UseRadioProps<Y>, "id"> & _yamada_ui_form_control.UseFormControlProps<HTMLElement>, "disabled" | "isDisabled" | "id" | "onFocus" | "onBlur" | "readOnly" | "required" | "isInvalid" | "isReadOnly" | "isRequired">, "value" | "name" | "id" | "onChange" | "defaultIsChecked" | "isChecked">, "disabled" | "aria-disabled" | "_active" | "_focus" | "_focusVisible" | "_hover" | "_invalid" | "aria-invalid" | "aria-readonly" | "aria-required" | "onFocus" | "onBlur" | "readOnly" | "required" | "data-readonly">;
|
64
64
|
getContainerProps: PropGetter<"label", undefined>;
|
65
|
-
getInputProps: PropGetter<"input", undefined>;
|
66
65
|
getIconProps: PropGetter<"span", undefined>;
|
66
|
+
getInputProps: PropGetter<"input", undefined>;
|
67
67
|
getLabelProps: PropGetter<"span", undefined>;
|
68
68
|
};
|
69
69
|
type UseRadioReturn = ReturnType<typeof useRadio>;
|
@@ -72,7 +72,7 @@ interface RadioOptions {
|
|
72
72
|
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
73
73
|
labelProps?: HTMLUIProps<"span">;
|
74
74
|
}
|
75
|
-
interface RadioProps<Y extends
|
75
|
+
interface RadioProps<Y extends number | string = string> extends Omit<HTMLUIProps<"label">, keyof UseRadioProps>, ThemeProps<"Radio">, UseRadioProps<Y>, RadioOptions {
|
76
76
|
}
|
77
77
|
/**
|
78
78
|
* `Radio` is a component used for allowing users to select one option from multiple choices.
|
@@ -80,7 +80,7 @@ interface RadioProps<Y extends string | number = string> extends Omit<HTMLUIProp
|
|
80
80
|
* @see Docs https://yamada-ui.com/components/forms/radio
|
81
81
|
*/
|
82
82
|
declare const Radio: {
|
83
|
-
<Y extends
|
83
|
+
<Y extends number | string = string>(props: RadioProps<Y> & RefAttributes<HTMLInputElement>): ReactElement;
|
84
84
|
} & ComponentArgs;
|
85
85
|
|
86
86
|
export { Radio, type RadioProps, type UseRadioProps, type UseRadioReturn, useRadio };
|