@yamada-ui/radio 0.4.2 → 0.5.0

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.
@@ -13,19 +13,10 @@ import {
13
13
  omitObject as omitObject2,
14
14
  getValidChildren
15
15
  } from "@yamada-ui/utils";
16
- import {
17
- useCallback as useCallback2,
18
- useId,
19
- useRef,
20
- forwardRef as forwardRef2
21
- } from "react";
16
+ import { useCallback as useCallback2, useId, useRef, forwardRef as forwardRef2 } from "react";
22
17
 
23
18
  // src/radio.tsx
24
- import {
25
- ui,
26
- useMultiComponentStyle,
27
- omitThemeProps
28
- } from "@yamada-ui/core";
19
+ import { ui, useMultiComponentStyle, omitThemeProps } from "@yamada-ui/core";
29
20
  import {
30
21
  useFormControl,
31
22
  useFormControlProps,
@@ -41,12 +32,7 @@ import {
41
32
  dataAttr,
42
33
  pickObject
43
34
  } from "@yamada-ui/utils";
44
- import {
45
- forwardRef,
46
- useCallback,
47
- useEffect,
48
- useState
49
- } from "react";
35
+ import { forwardRef, useCallback, useEffect, useState } from "react";
50
36
  import { jsx, jsxs } from "react/jsx-runtime";
51
37
  var useRadio = (props) => {
52
38
  const { id, name, value, required, disabled, readOnly, ...rest } = useFormControlProps(props);
@@ -54,7 +40,7 @@ var useRadio = (props) => {
54
40
  const [isFocused, setFocused] = useState(false);
55
41
  const [isHovered, setHovered] = useState(false);
56
42
  const [isActive, setActive] = useState(false);
57
- const [isChecked, setIsChecked] = useState(!!props.defaultChecked);
43
+ const [isChecked, setIsChecked] = useState(!!props.defaultIsChecked);
58
44
  const isControlled = props.isChecked !== void 0;
59
45
  const checked = isControlled ? props.isChecked : isChecked;
60
46
  useEffect(() => {
@@ -232,7 +218,7 @@ var Radio = forwardRef(
232
218
  "name",
233
219
  "value",
234
220
  "defaultValue",
235
- "defaultChecked",
221
+ "defaultIsChecked",
236
222
  "isChecked",
237
223
  "onChange",
238
224
  "onBlur",
@@ -293,8 +279,8 @@ var useRadioGroup = ({
293
279
  isNative,
294
280
  ...props
295
281
  }) => {
296
- id = id != null ? id : useId();
297
- name = name != null ? name : `radio-${id}`;
282
+ id != null ? id : id = useId();
283
+ name != null ? name : name = `radio-${id}`;
298
284
  props.onChange = useCallbackRef2(props.onChange);
299
285
  const [value, setValue] = useControllableState({
300
286
  value: props.value,
package/dist/index.js CHANGED
@@ -49,8 +49,8 @@ var useRadioGroup = ({
49
49
  isNative,
50
50
  ...props
51
51
  }) => {
52
- id = id != null ? id : (0, import_react.useId)();
53
- name = name != null ? name : `radio-${id}`;
52
+ id != null ? id : id = (0, import_react.useId)();
53
+ name != null ? name : name = `radio-${id}`;
54
54
  props.onChange = (0, import_utils.useCallbackRef)(props.onChange);
55
55
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
56
56
  value: props.value,
@@ -178,7 +178,7 @@ var useRadio = (props) => {
178
178
  const [isFocused, setFocused] = (0, import_react2.useState)(false);
179
179
  const [isHovered, setHovered] = (0, import_react2.useState)(false);
180
180
  const [isActive, setActive] = (0, import_react2.useState)(false);
181
- const [isChecked, setIsChecked] = (0, import_react2.useState)(!!props.defaultChecked);
181
+ const [isChecked, setIsChecked] = (0, import_react2.useState)(!!props.defaultIsChecked);
182
182
  const isControlled = props.isChecked !== void 0;
183
183
  const checked = isControlled ? props.isChecked : isChecked;
184
184
  (0, import_react2.useEffect)(() => {
@@ -356,7 +356,7 @@ var Radio = (0, import_react2.forwardRef)(
356
356
  "name",
357
357
  "value",
358
358
  "defaultValue",
359
- "defaultChecked",
359
+ "defaultIsChecked",
360
360
  "isChecked",
361
361
  "onChange",
362
362
  "onBlur",
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  RadioGroup,
5
5
  useRadio,
6
6
  useRadioGroup
7
- } from "./chunk-UX7EGSYQ.mjs";
7
+ } from "./chunk-DYAHEFLQ.mjs";
8
8
  export {
9
9
  Radio,
10
10
  RadioGroup,
@@ -60,7 +60,7 @@ declare const useRadioGroup: <Y extends string | number = string>({ id, name, is
60
60
  onChange: (ev: ChangeEvent<HTMLInputElement> | Y) => void;
61
61
  }>;
62
62
  };
63
- type UseRadioGroupReturn = ReturnType<typeof useRadioGroup>;
63
+ type UseRadioGroupReturn<Y extends string | number = string> = ReturnType<typeof useRadioGroup<Y>>;
64
64
  type RadioGroupProps<Y extends string | number = string> = ThemeProps<"Radio"> & Omit<FlexProps, "onChange"> & UseRadioGroupProps<Y> & FormControlOptions & {
65
65
  /**
66
66
  * If provided, generate radios based on items.
@@ -60,7 +60,7 @@ declare const useRadioGroup: <Y extends string | number = string>({ id, name, is
60
60
  onChange: (ev: ChangeEvent<HTMLInputElement> | Y) => void;
61
61
  }>;
62
62
  };
63
- type UseRadioGroupReturn = ReturnType<typeof useRadioGroup>;
63
+ type UseRadioGroupReturn<Y extends string | number = string> = ReturnType<typeof useRadioGroup<Y>>;
64
64
  type RadioGroupProps<Y extends string | number = string> = ThemeProps<"Radio"> & Omit<FlexProps, "onChange"> & UseRadioGroupProps<Y> & FormControlOptions & {
65
65
  /**
66
66
  * If provided, generate radios based on items.
@@ -45,7 +45,7 @@ var useRadio = (props) => {
45
45
  const [isFocused, setFocused] = (0, import_react.useState)(false);
46
46
  const [isHovered, setHovered] = (0, import_react.useState)(false);
47
47
  const [isActive, setActive] = (0, import_react.useState)(false);
48
- const [isChecked, setIsChecked] = (0, import_react.useState)(!!props.defaultChecked);
48
+ const [isChecked, setIsChecked] = (0, import_react.useState)(!!props.defaultIsChecked);
49
49
  const isControlled = props.isChecked !== void 0;
50
50
  const checked = isControlled ? props.isChecked : isChecked;
51
51
  (0, import_react.useEffect)(() => {
@@ -223,7 +223,7 @@ var Radio = (0, import_react.forwardRef)(
223
223
  "name",
224
224
  "value",
225
225
  "defaultValue",
226
- "defaultChecked",
226
+ "defaultIsChecked",
227
227
  "isChecked",
228
228
  "onChange",
229
229
  "onBlur",
@@ -284,8 +284,8 @@ var useRadioGroup = ({
284
284
  isNative,
285
285
  ...props
286
286
  }) => {
287
- id = id != null ? id : (0, import_react2.useId)();
288
- name = name != null ? name : `radio-${id}`;
287
+ id != null ? id : id = (0, import_react2.useId)();
288
+ name != null ? name : name = `radio-${id}`;
289
289
  props.onChange = (0, import_utils2.useCallbackRef)(props.onChange);
290
290
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
291
291
  value: props.value,
@@ -3,7 +3,7 @@ import {
3
3
  RadioGroup,
4
4
  useRadioGroup,
5
5
  useRadioGroupContenxt
6
- } from "./chunk-UX7EGSYQ.mjs";
6
+ } from "./chunk-DYAHEFLQ.mjs";
7
7
  export {
8
8
  RadioGroup,
9
9
  useRadioGroup,
package/dist/radio.d.mts CHANGED
@@ -21,7 +21,7 @@ type UseRadioProps<Y extends string | number = string> = FormControlOptions & {
21
21
  *
22
22
  * @default false
23
23
  */
24
- defaultChecked?: boolean;
24
+ defaultIsChecked?: boolean;
25
25
  /**
26
26
  * If `true`, the radio will be checked.
27
27
  *
@@ -51,7 +51,7 @@ type RadioOptions = {
51
51
  labelProps?: HTMLUIProps<"span">;
52
52
  };
53
53
  type RadioProps<Y extends string | number = string> = Omit<HTMLUIProps<"label">, keyof UseRadioProps> & ThemeProps<"Radio"> & UseRadioProps<Y> & RadioOptions;
54
- declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "value" | "name" | "id" | "onChange" | "defaultChecked" | keyof FormControlOptions | "isChecked"> & ThemeProps<"Radio"> & FormControlOptions & {
54
+ declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "value" | "name" | "id" | "onChange" | keyof FormControlOptions | "defaultIsChecked" | "isChecked"> & ThemeProps<"Radio"> & FormControlOptions & {
55
55
  /**
56
56
  * id assigned to input.
57
57
  */
@@ -69,7 +69,7 @@ declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIPro
69
69
  *
70
70
  * @default false
71
71
  */
72
- defaultChecked?: boolean | undefined;
72
+ defaultIsChecked?: boolean | undefined;
73
73
  /**
74
74
  * If `true`, the radio will be checked.
75
75
  *
package/dist/radio.d.ts CHANGED
@@ -21,7 +21,7 @@ type UseRadioProps<Y extends string | number = string> = FormControlOptions & {
21
21
  *
22
22
  * @default false
23
23
  */
24
- defaultChecked?: boolean;
24
+ defaultIsChecked?: boolean;
25
25
  /**
26
26
  * If `true`, the radio will be checked.
27
27
  *
@@ -51,7 +51,7 @@ type RadioOptions = {
51
51
  labelProps?: HTMLUIProps<"span">;
52
52
  };
53
53
  type RadioProps<Y extends string | number = string> = Omit<HTMLUIProps<"label">, keyof UseRadioProps> & ThemeProps<"Radio"> & UseRadioProps<Y> & RadioOptions;
54
- declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "value" | "name" | "id" | "onChange" | "defaultChecked" | keyof FormControlOptions | "isChecked"> & ThemeProps<"Radio"> & FormControlOptions & {
54
+ declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "value" | "name" | "id" | "onChange" | keyof FormControlOptions | "defaultIsChecked" | "isChecked"> & ThemeProps<"Radio"> & FormControlOptions & {
55
55
  /**
56
56
  * id assigned to input.
57
57
  */
@@ -69,7 +69,7 @@ declare const Radio: (<Y extends string | number = string>(props: Omit<HTMLUIPro
69
69
  *
70
70
  * @default false
71
71
  */
72
- defaultChecked?: boolean | undefined;
72
+ defaultIsChecked?: boolean | undefined;
73
73
  /**
74
74
  * If `true`, the radio will be checked.
75
75
  *
package/dist/radio.js CHANGED
@@ -45,8 +45,8 @@ var useRadioGroup = ({
45
45
  isNative,
46
46
  ...props
47
47
  }) => {
48
- id = id != null ? id : (0, import_react.useId)();
49
- name = name != null ? name : `radio-${id}`;
48
+ id != null ? id : id = (0, import_react.useId)();
49
+ name != null ? name : name = `radio-${id}`;
50
50
  props.onChange = (0, import_utils.useCallbackRef)(props.onChange);
51
51
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
52
52
  value: props.value,
@@ -174,7 +174,7 @@ var useRadio = (props) => {
174
174
  const [isFocused, setFocused] = (0, import_react2.useState)(false);
175
175
  const [isHovered, setHovered] = (0, import_react2.useState)(false);
176
176
  const [isActive, setActive] = (0, import_react2.useState)(false);
177
- const [isChecked, setIsChecked] = (0, import_react2.useState)(!!props.defaultChecked);
177
+ const [isChecked, setIsChecked] = (0, import_react2.useState)(!!props.defaultIsChecked);
178
178
  const isControlled = props.isChecked !== void 0;
179
179
  const checked = isControlled ? props.isChecked : isChecked;
180
180
  (0, import_react2.useEffect)(() => {
@@ -352,7 +352,7 @@ var Radio = (0, import_react2.forwardRef)(
352
352
  "name",
353
353
  "value",
354
354
  "defaultValue",
355
- "defaultChecked",
355
+ "defaultIsChecked",
356
356
  "isChecked",
357
357
  "onChange",
358
358
  "onBlur",
package/dist/radio.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Radio,
4
4
  useRadio
5
- } from "./chunk-UX7EGSYQ.mjs";
5
+ } from "./chunk-DYAHEFLQ.mjs";
6
6
  export {
7
7
  Radio,
8
8
  useRadio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/radio",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Yamada UI radio component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -35,11 +35,11 @@
35
35
  "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@yamada-ui/core": "0.12.6",
38
+ "@yamada-ui/core": "0.12.7",
39
39
  "@yamada-ui/utils": "0.3.3",
40
- "@yamada-ui/form-control": "0.3.19",
41
- "@yamada-ui/layouts": "0.3.17",
42
- "@yamada-ui/use-controllable-state": "0.3.1",
40
+ "@yamada-ui/form-control": "0.3.20",
41
+ "@yamada-ui/layouts": "0.3.18",
42
+ "@yamada-ui/use-controllable-state": "0.3.2",
43
43
  "@yamada-ui/use-focus-visible": "0.2.5"
44
44
  },
45
45
  "devDependencies": {