@yamada-ui/checkbox 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.
@@ -49,7 +49,7 @@ declare const useCheckboxGroup: <Y extends string | number = string>({ isNative,
49
49
  onChange: (ev: Y | ChangeEvent<HTMLInputElement>) => void;
50
50
  }>;
51
51
  };
52
- type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
52
+ type UseCheckboxGroupReturn<Y extends string | number = string> = ReturnType<typeof useCheckboxGroup<Y>>;
53
53
  type CheckboxGroupProps<Y extends string | number = string> = ThemeProps<"Checkbox"> & Omit<FlexProps, "onChange"> & UseCheckboxGroupProps<Y> & FormControlOptions & {
54
54
  /**
55
55
  * If provided, generate checkboxes based on items.
@@ -49,7 +49,7 @@ declare const useCheckboxGroup: <Y extends string | number = string>({ isNative,
49
49
  onChange: (ev: Y | ChangeEvent<HTMLInputElement>) => void;
50
50
  }>;
51
51
  };
52
- type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
52
+ type UseCheckboxGroupReturn<Y extends string | number = string> = ReturnType<typeof useCheckboxGroup<Y>>;
53
53
  type CheckboxGroupProps<Y extends string | number = string> = ThemeProps<"Checkbox"> & Omit<FlexProps, "onChange"> & UseCheckboxGroupProps<Y> & FormControlOptions & {
54
54
  /**
55
55
  * If provided, generate checkboxes based on items.
@@ -45,7 +45,7 @@ var useCheckbox = (props) => {
45
45
  id,
46
46
  name,
47
47
  value,
48
- defaultChecked,
48
+ defaultIsChecked,
49
49
  tabIndex,
50
50
  required,
51
51
  disabled,
@@ -59,7 +59,7 @@ var useCheckbox = (props) => {
59
59
  const [isActive, setActive] = (0, import_react.useState)(false);
60
60
  const inputRef = (0, import_react.useRef)(null);
61
61
  const [isLabel, setIsLabel] = (0, import_react.useState)(true);
62
- const [isChecked, setIsChecked] = (0, import_react.useState)(!!defaultChecked);
62
+ const [isChecked, setIsChecked] = (0, import_react.useState)(!!defaultIsChecked);
63
63
  const isControlled = props.isChecked !== void 0;
64
64
  const checked = isControlled ? props.isChecked : isChecked;
65
65
  const onChange = (0, import_utils.useCallbackRef)(
@@ -106,7 +106,7 @@ var useCheckbox = (props) => {
106
106
  var _a;
107
107
  if (!((_a = inputRef.current) == null ? void 0 : _a.form))
108
108
  return;
109
- inputRef.current.form.onreset = () => setIsChecked(!!defaultChecked);
109
+ inputRef.current.form.onreset = () => setIsChecked(!!defaultIsChecked);
110
110
  }, []);
111
111
  (0, import_utils.useSafeLayoutEffect)(() => {
112
112
  if (!inputRef.current)
@@ -316,7 +316,7 @@ var Checkbox = (0, import_react.forwardRef)(
316
316
  "name",
317
317
  "value",
318
318
  "defaultValue",
319
- "defaultChecked",
319
+ "defaultIsChecked",
320
320
  "isChecked",
321
321
  "isIndeterminate",
322
322
  "onChange",
@@ -3,7 +3,7 @@ import {
3
3
  CheckboxGroup,
4
4
  useCheckboxGroup,
5
5
  useCheckboxGroupContext
6
- } from "./chunk-2TIBZ5OE.mjs";
6
+ } from "./chunk-WSHGRNGF.mjs";
7
7
  export {
8
8
  CheckboxGroup,
9
9
  useCheckboxGroup,
@@ -22,7 +22,7 @@ type UseCheckboxProps<Y extends string | number = string> = FormControlOptions &
22
22
  *
23
23
  * @default false
24
24
  */
25
- defaultChecked?: boolean;
25
+ defaultIsChecked?: boolean;
26
26
  /**
27
27
  * If `true`, the checkbox will be checked.
28
28
  *
@@ -82,7 +82,7 @@ type CheckboxOptions = {
82
82
  labelProps?: HTMLUIProps<"span">;
83
83
  };
84
84
  type CheckboxProps<Y extends string | number = string> = Omit<HTMLUIProps<"label">, keyof UseCheckboxProps | "checked"> & ThemeProps<"Checkbox"> & UseCheckboxProps<Y> & CheckboxOptions;
85
- declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "defaultChecked" | "id" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | keyof FormControlOptions | "name" | "value" | "isChecked" | "isIndeterminate" | "checked"> & ThemeProps<"Checkbox"> & FormControlOptions & {
85
+ declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "id" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | keyof FormControlOptions | "name" | "value" | "defaultIsChecked" | "isChecked" | "isIndeterminate" | "checked"> & ThemeProps<"Checkbox"> & FormControlOptions & {
86
86
  /**
87
87
  * id assigned to input.
88
88
  */
@@ -100,7 +100,7 @@ declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUI
100
100
  *
101
101
  * @default false
102
102
  */
103
- defaultChecked?: boolean | undefined;
103
+ defaultIsChecked?: boolean | undefined;
104
104
  /**
105
105
  * If `true`, the checkbox will be checked.
106
106
  *
@@ -22,7 +22,7 @@ type UseCheckboxProps<Y extends string | number = string> = FormControlOptions &
22
22
  *
23
23
  * @default false
24
24
  */
25
- defaultChecked?: boolean;
25
+ defaultIsChecked?: boolean;
26
26
  /**
27
27
  * If `true`, the checkbox will be checked.
28
28
  *
@@ -82,7 +82,7 @@ type CheckboxOptions = {
82
82
  labelProps?: HTMLUIProps<"span">;
83
83
  };
84
84
  type CheckboxProps<Y extends string | number = string> = Omit<HTMLUIProps<"label">, keyof UseCheckboxProps | "checked"> & ThemeProps<"Checkbox"> & UseCheckboxProps<Y> & CheckboxOptions;
85
- declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "defaultChecked" | "id" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | keyof FormControlOptions | "name" | "value" | "isChecked" | "isIndeterminate" | "checked"> & ThemeProps<"Checkbox"> & FormControlOptions & {
85
+ declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUIProps<"label">, "id" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | keyof FormControlOptions | "name" | "value" | "defaultIsChecked" | "isChecked" | "isIndeterminate" | "checked"> & ThemeProps<"Checkbox"> & FormControlOptions & {
86
86
  /**
87
87
  * id assigned to input.
88
88
  */
@@ -100,7 +100,7 @@ declare const Checkbox: (<Y extends string | number = string>(props: Omit<HTMLUI
100
100
  *
101
101
  * @default false
102
102
  */
103
- defaultChecked?: boolean | undefined;
103
+ defaultIsChecked?: boolean | undefined;
104
104
  /**
105
105
  * If `true`, the checkbox will be checked.
106
106
  *
package/dist/checkbox.js CHANGED
@@ -143,7 +143,7 @@ var useCheckbox = (props) => {
143
143
  id,
144
144
  name,
145
145
  value,
146
- defaultChecked,
146
+ defaultIsChecked,
147
147
  tabIndex,
148
148
  required,
149
149
  disabled,
@@ -157,7 +157,7 @@ var useCheckbox = (props) => {
157
157
  const [isActive, setActive] = (0, import_react2.useState)(false);
158
158
  const inputRef = (0, import_react2.useRef)(null);
159
159
  const [isLabel, setIsLabel] = (0, import_react2.useState)(true);
160
- const [isChecked, setIsChecked] = (0, import_react2.useState)(!!defaultChecked);
160
+ const [isChecked, setIsChecked] = (0, import_react2.useState)(!!defaultIsChecked);
161
161
  const isControlled = props.isChecked !== void 0;
162
162
  const checked = isControlled ? props.isChecked : isChecked;
163
163
  const onChange = (0, import_utils2.useCallbackRef)(
@@ -204,7 +204,7 @@ var useCheckbox = (props) => {
204
204
  var _a;
205
205
  if (!((_a = inputRef.current) == null ? void 0 : _a.form))
206
206
  return;
207
- inputRef.current.form.onreset = () => setIsChecked(!!defaultChecked);
207
+ inputRef.current.form.onreset = () => setIsChecked(!!defaultIsChecked);
208
208
  }, []);
209
209
  (0, import_utils2.useSafeLayoutEffect)(() => {
210
210
  if (!inputRef.current)
@@ -414,7 +414,7 @@ var Checkbox = (0, import_react2.forwardRef)(
414
414
  "name",
415
415
  "value",
416
416
  "defaultValue",
417
- "defaultChecked",
417
+ "defaultIsChecked",
418
418
  "isChecked",
419
419
  "isIndeterminate",
420
420
  "onChange",
package/dist/checkbox.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Checkbox,
4
4
  CheckboxIcon,
5
5
  useCheckbox
6
- } from "./chunk-2TIBZ5OE.mjs";
6
+ } from "./chunk-WSHGRNGF.mjs";
7
7
  export {
8
8
  Checkbox,
9
9
  CheckboxIcon,
@@ -1,11 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  // src/checkbox.tsx
4
- import {
5
- ui,
6
- useMultiComponentStyle,
7
- omitThemeProps
8
- } from "@yamada-ui/core";
4
+ import { ui, useMultiComponentStyle, omitThemeProps } from "@yamada-ui/core";
9
5
  import {
10
6
  useFormControl as useFormControl2,
11
7
  useFormControlProps,
@@ -46,10 +42,7 @@ import {
46
42
  useCallbackRef,
47
43
  getValidChildren
48
44
  } from "@yamada-ui/utils";
49
- import {
50
- forwardRef,
51
- useCallback
52
- } from "react";
45
+ import { forwardRef, useCallback } from "react";
53
46
  import { jsx } from "react/jsx-runtime";
54
47
  var isEvent = (value) => value && isObject(value) && isObject(value.target);
55
48
  var useCheckboxGroup = ({
@@ -154,7 +147,7 @@ var useCheckbox = (props) => {
154
147
  id,
155
148
  name,
156
149
  value,
157
- defaultChecked,
150
+ defaultIsChecked,
158
151
  tabIndex,
159
152
  required,
160
153
  disabled,
@@ -168,7 +161,7 @@ var useCheckbox = (props) => {
168
161
  const [isActive, setActive] = useState(false);
169
162
  const inputRef = useRef(null);
170
163
  const [isLabel, setIsLabel] = useState(true);
171
- const [isChecked, setIsChecked] = useState(!!defaultChecked);
164
+ const [isChecked, setIsChecked] = useState(!!defaultIsChecked);
172
165
  const isControlled = props.isChecked !== void 0;
173
166
  const checked = isControlled ? props.isChecked : isChecked;
174
167
  const onChange = useCallbackRef2(
@@ -215,7 +208,7 @@ var useCheckbox = (props) => {
215
208
  var _a;
216
209
  if (!((_a = inputRef.current) == null ? void 0 : _a.form))
217
210
  return;
218
- inputRef.current.form.onreset = () => setIsChecked(!!defaultChecked);
211
+ inputRef.current.form.onreset = () => setIsChecked(!!defaultIsChecked);
219
212
  }, []);
220
213
  useSafeLayoutEffect(() => {
221
214
  if (!inputRef.current)
@@ -425,7 +418,7 @@ var Checkbox = forwardRef2(
425
418
  "name",
426
419
  "value",
427
420
  "defaultValue",
428
- "defaultChecked",
421
+ "defaultIsChecked",
429
422
  "isChecked",
430
423
  "isIndeterminate",
431
424
  "onChange",
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Checkbox, CheckboxIcon, CheckboxIconProps, CheckboxProps, UseCheckboxProps, UseCheckboxReturn, useCheckbox } from './checkbox.mjs';
2
- export { CheckboxGroup, CheckboxGroupProps, CheckboxItem, UseCheckboxGroupProps, useCheckboxGroup } from './checkbox-group.mjs';
2
+ export { CheckboxGroup, CheckboxGroupProps, CheckboxItem, UseCheckboxGroupProps, UseCheckboxGroupReturn, useCheckboxGroup } from './checkbox-group.mjs';
3
3
  import '@yamada-ui/core';
4
4
  import '@yamada-ui/form-control';
5
5
  import '@yamada-ui/motion';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Checkbox, CheckboxIcon, CheckboxIconProps, CheckboxProps, UseCheckboxProps, UseCheckboxReturn, useCheckbox } from './checkbox.js';
2
- export { CheckboxGroup, CheckboxGroupProps, CheckboxItem, UseCheckboxGroupProps, useCheckboxGroup } from './checkbox-group.js';
2
+ export { CheckboxGroup, CheckboxGroupProps, CheckboxItem, UseCheckboxGroupProps, UseCheckboxGroupReturn, useCheckboxGroup } from './checkbox-group.js';
3
3
  import '@yamada-ui/core';
4
4
  import '@yamada-ui/form-control';
5
5
  import '@yamada-ui/motion';
package/dist/index.js CHANGED
@@ -147,7 +147,7 @@ var useCheckbox = (props) => {
147
147
  id,
148
148
  name,
149
149
  value,
150
- defaultChecked,
150
+ defaultIsChecked,
151
151
  tabIndex,
152
152
  required,
153
153
  disabled,
@@ -161,7 +161,7 @@ var useCheckbox = (props) => {
161
161
  const [isActive, setActive] = (0, import_react2.useState)(false);
162
162
  const inputRef = (0, import_react2.useRef)(null);
163
163
  const [isLabel, setIsLabel] = (0, import_react2.useState)(true);
164
- const [isChecked, setIsChecked] = (0, import_react2.useState)(!!defaultChecked);
164
+ const [isChecked, setIsChecked] = (0, import_react2.useState)(!!defaultIsChecked);
165
165
  const isControlled = props.isChecked !== void 0;
166
166
  const checked = isControlled ? props.isChecked : isChecked;
167
167
  const onChange = (0, import_utils2.useCallbackRef)(
@@ -208,7 +208,7 @@ var useCheckbox = (props) => {
208
208
  var _a;
209
209
  if (!((_a = inputRef.current) == null ? void 0 : _a.form))
210
210
  return;
211
- inputRef.current.form.onreset = () => setIsChecked(!!defaultChecked);
211
+ inputRef.current.form.onreset = () => setIsChecked(!!defaultIsChecked);
212
212
  }, []);
213
213
  (0, import_utils2.useSafeLayoutEffect)(() => {
214
214
  if (!inputRef.current)
@@ -418,7 +418,7 @@ var Checkbox = (0, import_react2.forwardRef)(
418
418
  "name",
419
419
  "value",
420
420
  "defaultValue",
421
- "defaultChecked",
421
+ "defaultIsChecked",
422
422
  "isChecked",
423
423
  "isIndeterminate",
424
424
  "onChange",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  CheckboxIcon,
6
6
  useCheckbox,
7
7
  useCheckboxGroup
8
- } from "./chunk-2TIBZ5OE.mjs";
8
+ } from "./chunk-WSHGRNGF.mjs";
9
9
  export {
10
10
  Checkbox,
11
11
  CheckboxGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/checkbox",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Yamada UI checkbox component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -35,13 +35,13 @@
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/layouts": "0.3.17",
41
- "@yamada-ui/form-control": "0.3.19",
42
- "@yamada-ui/motion": "0.4.16",
40
+ "@yamada-ui/layouts": "0.3.18",
41
+ "@yamada-ui/form-control": "0.3.20",
42
+ "@yamada-ui/motion": "0.4.17",
43
43
  "@yamada-ui/use-focus-visible": "0.2.5",
44
- "@yamada-ui/use-controllable-state": "0.3.1"
44
+ "@yamada-ui/use-controllable-state": "0.3.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "react": "^18.0.0",