@kopexa/checkbox 1.0.5 → 1.0.7

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.
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+ import { CheckboxIconProps } from './use-checkbox.mjs';
4
+ import '@kopexa/react-utils';
5
+ import '@kopexa/theme';
6
+ import '@radix-ui/react-checkbox';
7
+
8
+ type IconProps = ComponentProps<"svg"> & CheckboxIconProps;
9
+ /**
10
+ * CheckboxIcon is used to visually indicate the checked or indeterminate
11
+ * state of a checkbox.
12
+ */
13
+ declare function CheckboxIcon(props: IconProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { CheckboxIcon };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+ import { CheckboxIconProps } from './use-checkbox.js';
4
+ import '@kopexa/react-utils';
5
+ import '@kopexa/theme';
6
+ import '@radix-ui/react-checkbox';
7
+
8
+ type IconProps = ComponentProps<"svg"> & CheckboxIconProps;
9
+ /**
10
+ * CheckboxIcon is used to visually indicate the checked or indeterminate
11
+ * state of a checkbox.
12
+ */
13
+ declare function CheckboxIcon(props: IconProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { CheckboxIcon };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/checkbox-icon.tsx
22
+ var checkbox_icon_exports = {};
23
+ __export(checkbox_icon_exports, {
24
+ CheckboxIcon: () => CheckboxIcon
25
+ });
26
+ module.exports = __toCommonJS(checkbox_icon_exports);
27
+ var import_icons = require("@kopexa/icons");
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ function CheckboxIcon(props) {
30
+ const { isIndeterminate, ...otherProps } = props;
31
+ const BaseIcon = isIndeterminate ? import_icons.MinusIcon : import_icons.CheckIcon;
32
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseIcon, { ...otherProps });
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ CheckboxIcon
37
+ });
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ CheckboxIcon
4
+ } from "./chunk-STJ7PQ25.mjs";
5
+ export {
6
+ CheckboxIcon
7
+ };
@@ -1,11 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
- import { ComponentProps } from 'react';
3
+ import { UseCheckboxProps } from './use-checkbox.mjs';
4
+ import '@kopexa/react-utils';
5
+ import '@kopexa/theme';
6
+ import 'react';
4
7
 
5
8
  type CheckboxCheckedState = CheckboxPrimitive.CheckedState;
6
- type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root> & {
7
- checked?: CheckboxCheckedState | undefined;
8
- };
9
+ type CheckboxProps = UseCheckboxProps;
9
10
  declare const Checkbox: (props: CheckboxProps) => react_jsx_runtime.JSX.Element;
10
11
 
11
12
  export { Checkbox, type CheckboxCheckedState, type CheckboxProps };
@@ -1,11 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
- import { ComponentProps } from 'react';
3
+ import { UseCheckboxProps } from './use-checkbox.js';
4
+ import '@kopexa/react-utils';
5
+ import '@kopexa/theme';
6
+ import 'react';
4
7
 
5
8
  type CheckboxCheckedState = CheckboxPrimitive.CheckedState;
6
- type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root> & {
7
- checked?: CheckboxCheckedState | undefined;
8
- };
9
+ type CheckboxProps = UseCheckboxProps;
9
10
  declare const Checkbox: (props: CheckboxProps) => react_jsx_runtime.JSX.Element;
10
11
 
11
12
  export { Checkbox, type CheckboxCheckedState, type CheckboxProps };
package/dist/checkbox.js CHANGED
@@ -34,30 +34,81 @@ __export(checkbox_exports, {
34
34
  Checkbox: () => Checkbox
35
35
  });
36
36
  module.exports = __toCommonJS(checkbox_exports);
37
- var import_icons = require("@kopexa/icons");
38
- var import_theme = require("@kopexa/theme");
39
37
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
38
+
39
+ // src/checkbox-icon.tsx
40
+ var import_icons = require("@kopexa/icons");
40
41
  var import_jsx_runtime = require("react/jsx-runtime");
41
- var Checkbox = (props) => {
42
- const { className, checked, ...rest } = props;
43
- const styles = (0, import_theme.checkbox)();
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
- CheckboxPrimitive.Root,
46
- {
42
+ function CheckboxIcon(props) {
43
+ const { isIndeterminate, ...otherProps } = props;
44
+ const BaseIcon = isIndeterminate ? import_icons.MinusIcon : import_icons.CheckIcon;
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseIcon, { ...otherProps });
46
+ }
47
+
48
+ // src/use-checkbox.ts
49
+ var import_shared_utils = require("@kopexa/shared-utils");
50
+ var import_theme = require("@kopexa/theme");
51
+ var import_react = require("react");
52
+ function useCheckbox({
53
+ disabled,
54
+ checked,
55
+ className,
56
+ color,
57
+ size,
58
+ ...restProps
59
+ }) {
60
+ const slots = (0, import_react.useMemo)(() => (0, import_theme.checkbox)({ color, size }), [color, size]);
61
+ const getRootProps = (0, import_react.useCallback)(
62
+ () => ({
63
+ className: slots.base({ className }),
47
64
  "data-slot": "checkbox",
48
- className: styles.base({ className }),
65
+ "data-disabled": (0, import_shared_utils.dataAttr)(disabled),
66
+ "data-selected": (0, import_shared_utils.dataAttr)(
67
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
68
+ ),
69
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate"),
70
+ disabled,
49
71
  checked,
50
- ...rest,
51
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
- CheckboxPrimitive.Indicator,
53
- {
54
- "data-slot": "checkbox-indicator",
55
- className: styles.indicator(),
56
- children: checked === "indeterminate" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MinusIcon, { className: styles.icon() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckIcon, { className: styles.icon() })
57
- }
72
+ ...restProps
73
+ }),
74
+ // biome-ignore lint/correctness/useExhaustiveDependencies: eslint does not understand the dependencies
75
+ [slots, disabled, checked, restProps, className]
76
+ );
77
+ const getIndicatorProps = (0, import_react.useCallback)(
78
+ () => ({
79
+ className: slots.indicator(),
80
+ "data-slot": "checkbox-indicator",
81
+ "data-selected": (0, import_shared_utils.dataAttr)(
82
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
83
+ ),
84
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate")
85
+ }),
86
+ [slots, checked]
87
+ );
88
+ const getIconProps = (0, import_react.useCallback)(
89
+ () => ({
90
+ className: slots.icon(),
91
+ isSelected: typeof checked === "boolean" ? checked : false,
92
+ isIndeterminate: checked === "indeterminate",
93
+ "data-checked": (0, import_shared_utils.dataAttr)(
94
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
58
95
  )
59
- }
96
+ }),
97
+ [slots, checked]
60
98
  );
99
+ return {
100
+ checked,
101
+ getRootProps,
102
+ getIndicatorProps,
103
+ getIconProps
104
+ };
105
+ }
106
+
107
+ // src/checkbox.tsx
108
+ var import_jsx_runtime2 = require("react/jsx-runtime");
109
+ var Checkbox = (props) => {
110
+ const { getRootProps, getIndicatorProps, getIconProps } = useCheckbox(props);
111
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxPrimitive.Root, { ...getRootProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxPrimitive.Indicator, { ...getIndicatorProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxIcon, { ...getIconProps() }) }) });
61
112
  };
62
113
  // Annotate the CommonJS export names for ESM import in node:
63
114
  0 && (module.exports = {
package/dist/checkbox.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Checkbox
4
- } from "./chunk-IZSKR7ZE.mjs";
4
+ } from "./chunk-KKH6XBT3.mjs";
5
+ import "./chunk-STJ7PQ25.mjs";
6
+ import "./chunk-6JWVKZ3G.mjs";
5
7
  export {
6
8
  Checkbox
7
9
  };
@@ -0,0 +1,64 @@
1
+ "use client";
2
+
3
+ // src/use-checkbox.ts
4
+ import { dataAttr } from "@kopexa/shared-utils";
5
+ import { checkbox } from "@kopexa/theme";
6
+ import { useCallback, useMemo } from "react";
7
+ function useCheckbox({
8
+ disabled,
9
+ checked,
10
+ className,
11
+ color,
12
+ size,
13
+ ...restProps
14
+ }) {
15
+ const slots = useMemo(() => checkbox({ color, size }), [color, size]);
16
+ const getRootProps = useCallback(
17
+ () => ({
18
+ className: slots.base({ className }),
19
+ "data-slot": "checkbox",
20
+ "data-disabled": dataAttr(disabled),
21
+ "data-selected": dataAttr(
22
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
23
+ ),
24
+ "data-indeterminate": dataAttr(checked === "indeterminate"),
25
+ disabled,
26
+ checked,
27
+ ...restProps
28
+ }),
29
+ // biome-ignore lint/correctness/useExhaustiveDependencies: eslint does not understand the dependencies
30
+ [slots, disabled, checked, restProps, className]
31
+ );
32
+ const getIndicatorProps = useCallback(
33
+ () => ({
34
+ className: slots.indicator(),
35
+ "data-slot": "checkbox-indicator",
36
+ "data-selected": dataAttr(
37
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
38
+ ),
39
+ "data-indeterminate": dataAttr(checked === "indeterminate")
40
+ }),
41
+ [slots, checked]
42
+ );
43
+ const getIconProps = useCallback(
44
+ () => ({
45
+ className: slots.icon(),
46
+ isSelected: typeof checked === "boolean" ? checked : false,
47
+ isIndeterminate: checked === "indeterminate",
48
+ "data-checked": dataAttr(
49
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
50
+ )
51
+ }),
52
+ [slots, checked]
53
+ );
54
+ return {
55
+ checked,
56
+ getRootProps,
57
+ getIndicatorProps,
58
+ getIconProps
59
+ };
60
+ }
61
+
62
+ export {
63
+ useCheckbox
64
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import {
3
+ CheckboxIcon
4
+ } from "./chunk-STJ7PQ25.mjs";
5
+ import {
6
+ useCheckbox
7
+ } from "./chunk-6JWVKZ3G.mjs";
8
+
9
+ // src/checkbox.tsx
10
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
11
+ import { jsx } from "react/jsx-runtime";
12
+ var Checkbox = (props) => {
13
+ const { getRootProps, getIndicatorProps, getIconProps } = useCheckbox(props);
14
+ return /* @__PURE__ */ jsx(CheckboxPrimitive.Root, { ...getRootProps(), children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { ...getIndicatorProps(), children: /* @__PURE__ */ jsx(CheckboxIcon, { ...getIconProps() }) }) });
15
+ };
16
+
17
+ export {
18
+ Checkbox
19
+ };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ // src/checkbox-icon.tsx
4
+ import { CheckIcon, MinusIcon } from "@kopexa/icons";
5
+ import { jsx } from "react/jsx-runtime";
6
+ function CheckboxIcon(props) {
7
+ const { isIndeterminate, ...otherProps } = props;
8
+ const BaseIcon = isIndeterminate ? MinusIcon : CheckIcon;
9
+ return /* @__PURE__ */ jsx(BaseIcon, { ...otherProps });
10
+ }
11
+
12
+ export {
13
+ CheckboxIcon
14
+ };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,7 @@
1
1
  export { Checkbox, CheckboxCheckedState, CheckboxProps } from './checkbox.mjs';
2
+ export { CheckboxIconProps } from './use-checkbox.mjs';
2
3
  import 'react/jsx-runtime';
3
4
  import '@radix-ui/react-checkbox';
5
+ import '@kopexa/react-utils';
6
+ import '@kopexa/theme';
4
7
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export { Checkbox, CheckboxCheckedState, CheckboxProps } from './checkbox.js';
2
+ export { CheckboxIconProps } from './use-checkbox.js';
2
3
  import 'react/jsx-runtime';
3
4
  import '@radix-ui/react-checkbox';
5
+ import '@kopexa/react-utils';
6
+ import '@kopexa/theme';
4
7
  import 'react';
package/dist/index.js CHANGED
@@ -36,30 +36,81 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/checkbox.tsx
39
- var import_icons = require("@kopexa/icons");
40
- var import_theme = require("@kopexa/theme");
41
39
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
40
+
41
+ // src/checkbox-icon.tsx
42
+ var import_icons = require("@kopexa/icons");
42
43
  var import_jsx_runtime = require("react/jsx-runtime");
43
- var Checkbox = (props) => {
44
- const { className, checked, ...rest } = props;
45
- const styles = (0, import_theme.checkbox)();
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
- CheckboxPrimitive.Root,
48
- {
44
+ function CheckboxIcon(props) {
45
+ const { isIndeterminate, ...otherProps } = props;
46
+ const BaseIcon = isIndeterminate ? import_icons.MinusIcon : import_icons.CheckIcon;
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseIcon, { ...otherProps });
48
+ }
49
+
50
+ // src/use-checkbox.ts
51
+ var import_shared_utils = require("@kopexa/shared-utils");
52
+ var import_theme = require("@kopexa/theme");
53
+ var import_react = require("react");
54
+ function useCheckbox({
55
+ disabled,
56
+ checked,
57
+ className,
58
+ color,
59
+ size,
60
+ ...restProps
61
+ }) {
62
+ const slots = (0, import_react.useMemo)(() => (0, import_theme.checkbox)({ color, size }), [color, size]);
63
+ const getRootProps = (0, import_react.useCallback)(
64
+ () => ({
65
+ className: slots.base({ className }),
49
66
  "data-slot": "checkbox",
50
- className: styles.base({ className }),
67
+ "data-disabled": (0, import_shared_utils.dataAttr)(disabled),
68
+ "data-selected": (0, import_shared_utils.dataAttr)(
69
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
70
+ ),
71
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate"),
72
+ disabled,
51
73
  checked,
52
- ...rest,
53
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
- CheckboxPrimitive.Indicator,
55
- {
56
- "data-slot": "checkbox-indicator",
57
- className: styles.indicator(),
58
- children: checked === "indeterminate" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MinusIcon, { className: styles.icon() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckIcon, { className: styles.icon() })
59
- }
74
+ ...restProps
75
+ }),
76
+ // biome-ignore lint/correctness/useExhaustiveDependencies: eslint does not understand the dependencies
77
+ [slots, disabled, checked, restProps, className]
78
+ );
79
+ const getIndicatorProps = (0, import_react.useCallback)(
80
+ () => ({
81
+ className: slots.indicator(),
82
+ "data-slot": "checkbox-indicator",
83
+ "data-selected": (0, import_shared_utils.dataAttr)(
84
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
85
+ ),
86
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate")
87
+ }),
88
+ [slots, checked]
89
+ );
90
+ const getIconProps = (0, import_react.useCallback)(
91
+ () => ({
92
+ className: slots.icon(),
93
+ isSelected: typeof checked === "boolean" ? checked : false,
94
+ isIndeterminate: checked === "indeterminate",
95
+ "data-checked": (0, import_shared_utils.dataAttr)(
96
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
60
97
  )
61
- }
98
+ }),
99
+ [slots, checked]
62
100
  );
101
+ return {
102
+ checked,
103
+ getRootProps,
104
+ getIndicatorProps,
105
+ getIconProps
106
+ };
107
+ }
108
+
109
+ // src/checkbox.tsx
110
+ var import_jsx_runtime2 = require("react/jsx-runtime");
111
+ var Checkbox = (props) => {
112
+ const { getRootProps, getIndicatorProps, getIconProps } = useCheckbox(props);
113
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxPrimitive.Root, { ...getRootProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxPrimitive.Indicator, { ...getIndicatorProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxIcon, { ...getIconProps() }) }) });
63
114
  };
64
115
  // Annotate the CommonJS export names for ESM import in node:
65
116
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Checkbox
4
- } from "./chunk-IZSKR7ZE.mjs";
4
+ } from "./chunk-KKH6XBT3.mjs";
5
+ import "./chunk-STJ7PQ25.mjs";
6
+ import "./chunk-6JWVKZ3G.mjs";
5
7
  export {
6
8
  Checkbox
7
9
  };
@@ -0,0 +1,24 @@
1
+ import { PropGetter } from '@kopexa/react-utils';
2
+ import { CheckboxVariantProps } from '@kopexa/theme';
3
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
+ import { ComponentProps } from 'react';
5
+
6
+ type CheckboxCheckedState = CheckboxPrimitive.CheckedState;
7
+ type CheckboxIconProps = {
8
+ "data-checked": string;
9
+ isSelected: boolean;
10
+ isIndeterminate: boolean;
11
+ className: string;
12
+ };
13
+ interface Props extends Omit<ComponentProps<typeof CheckboxPrimitive.Root>, keyof CheckboxVariantProps> {
14
+ checked?: CheckboxCheckedState | undefined;
15
+ }
16
+ type UseCheckboxProps = Props & CheckboxVariantProps;
17
+ declare function useCheckbox({ disabled, checked, className, color, size, ...restProps }: UseCheckboxProps): {
18
+ checked: CheckboxPrimitive.CheckedState | undefined;
19
+ getRootProps: PropGetter;
20
+ getIndicatorProps: PropGetter;
21
+ getIconProps: () => CheckboxIconProps;
22
+ };
23
+
24
+ export { type CheckboxCheckedState, type CheckboxIconProps, type UseCheckboxProps, useCheckbox };
@@ -0,0 +1,24 @@
1
+ import { PropGetter } from '@kopexa/react-utils';
2
+ import { CheckboxVariantProps } from '@kopexa/theme';
3
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
+ import { ComponentProps } from 'react';
5
+
6
+ type CheckboxCheckedState = CheckboxPrimitive.CheckedState;
7
+ type CheckboxIconProps = {
8
+ "data-checked": string;
9
+ isSelected: boolean;
10
+ isIndeterminate: boolean;
11
+ className: string;
12
+ };
13
+ interface Props extends Omit<ComponentProps<typeof CheckboxPrimitive.Root>, keyof CheckboxVariantProps> {
14
+ checked?: CheckboxCheckedState | undefined;
15
+ }
16
+ type UseCheckboxProps = Props & CheckboxVariantProps;
17
+ declare function useCheckbox({ disabled, checked, className, color, size, ...restProps }: UseCheckboxProps): {
18
+ checked: CheckboxPrimitive.CheckedState | undefined;
19
+ getRootProps: PropGetter;
20
+ getIndicatorProps: PropGetter;
21
+ getIconProps: () => CheckboxIconProps;
22
+ };
23
+
24
+ export { type CheckboxCheckedState, type CheckboxIconProps, type UseCheckboxProps, useCheckbox };
@@ -0,0 +1,87 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/use-checkbox.ts
22
+ var use_checkbox_exports = {};
23
+ __export(use_checkbox_exports, {
24
+ useCheckbox: () => useCheckbox
25
+ });
26
+ module.exports = __toCommonJS(use_checkbox_exports);
27
+ var import_shared_utils = require("@kopexa/shared-utils");
28
+ var import_theme = require("@kopexa/theme");
29
+ var import_react = require("react");
30
+ function useCheckbox({
31
+ disabled,
32
+ checked,
33
+ className,
34
+ color,
35
+ size,
36
+ ...restProps
37
+ }) {
38
+ const slots = (0, import_react.useMemo)(() => (0, import_theme.checkbox)({ color, size }), [color, size]);
39
+ const getRootProps = (0, import_react.useCallback)(
40
+ () => ({
41
+ className: slots.base({ className }),
42
+ "data-slot": "checkbox",
43
+ "data-disabled": (0, import_shared_utils.dataAttr)(disabled),
44
+ "data-selected": (0, import_shared_utils.dataAttr)(
45
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
46
+ ),
47
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate"),
48
+ disabled,
49
+ checked,
50
+ ...restProps
51
+ }),
52
+ // biome-ignore lint/correctness/useExhaustiveDependencies: eslint does not understand the dependencies
53
+ [slots, disabled, checked, restProps, className]
54
+ );
55
+ const getIndicatorProps = (0, import_react.useCallback)(
56
+ () => ({
57
+ className: slots.indicator(),
58
+ "data-slot": "checkbox-indicator",
59
+ "data-selected": (0, import_shared_utils.dataAttr)(
60
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
61
+ ),
62
+ "data-indeterminate": (0, import_shared_utils.dataAttr)(checked === "indeterminate")
63
+ }),
64
+ [slots, checked]
65
+ );
66
+ const getIconProps = (0, import_react.useCallback)(
67
+ () => ({
68
+ className: slots.icon(),
69
+ isSelected: typeof checked === "boolean" ? checked : false,
70
+ isIndeterminate: checked === "indeterminate",
71
+ "data-checked": (0, import_shared_utils.dataAttr)(
72
+ typeof checked === "boolean" ? checked : checked === "indeterminate"
73
+ )
74
+ }),
75
+ [slots, checked]
76
+ );
77
+ return {
78
+ checked,
79
+ getRootProps,
80
+ getIndicatorProps,
81
+ getIconProps
82
+ };
83
+ }
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ useCheckbox
87
+ });
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ useCheckbox
4
+ } from "./chunk-6JWVKZ3G.mjs";
5
+ export {
6
+ useCheckbox
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/checkbox",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "checkbox"
@@ -28,13 +28,13 @@
28
28
  "motion": ">=12.23.6",
29
29
  "react": ">=19.0.0-rc.0",
30
30
  "react-dom": ">=19.0.0-rc.0",
31
- "@kopexa/theme": "1.6.5"
31
+ "@kopexa/theme": "1.6.7"
32
32
  },
33
33
  "dependencies": {
34
34
  "@radix-ui/react-checkbox": "^1.3.2",
35
35
  "@kopexa/react-utils": "2.0.6",
36
36
  "@kopexa/shared-utils": "1.1.5",
37
- "@kopexa/icons": "9.0.5"
37
+ "@kopexa/icons": "9.0.7"
38
38
  },
39
39
  "clean-package": "../../../clean-package.config.json",
40
40
  "module": "dist/index.mjs",
@@ -1,32 +0,0 @@
1
- "use client";
2
-
3
- // src/checkbox.tsx
4
- import { CheckIcon, MinusIcon } from "@kopexa/icons";
5
- import { checkbox } from "@kopexa/theme";
6
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
7
- import { jsx } from "react/jsx-runtime";
8
- var Checkbox = (props) => {
9
- const { className, checked, ...rest } = props;
10
- const styles = checkbox();
11
- return /* @__PURE__ */ jsx(
12
- CheckboxPrimitive.Root,
13
- {
14
- "data-slot": "checkbox",
15
- className: styles.base({ className }),
16
- checked,
17
- ...rest,
18
- children: /* @__PURE__ */ jsx(
19
- CheckboxPrimitive.Indicator,
20
- {
21
- "data-slot": "checkbox-indicator",
22
- className: styles.indicator(),
23
- children: checked === "indeterminate" ? /* @__PURE__ */ jsx(MinusIcon, { className: styles.icon() }) : /* @__PURE__ */ jsx(CheckIcon, { className: styles.icon() })
24
- }
25
- )
26
- }
27
- );
28
- };
29
-
30
- export {
31
- Checkbox
32
- };