@jamsrui/checkbox 0.0.7 → 0.0.9

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.
Files changed (41) hide show
  1. package/dist/checkbox-config.d.mts +13 -12
  2. package/dist/checkbox.d.mts +22 -13
  3. package/dist/checkbox.mjs +1 -1
  4. package/dist/index.d.mts +11 -11
  5. package/dist/primitive/checkbox-config.d.mts +27 -0
  6. package/dist/primitive/checkbox-config.mjs +1 -0
  7. package/dist/{checkbox-context.d.mts → primitive/checkbox-context.d.mts} +3 -5
  8. package/dist/primitive/checkbox-icon.d.mts +5 -0
  9. package/dist/primitive/checkbox-icon.mjs +1 -0
  10. package/dist/{checkbox-label.d.mts → primitive/checkbox-label.d.mts} +1 -1
  11. package/dist/primitive/checkbox-label.mjs +1 -0
  12. package/dist/primitive/checkbox-root.d.mts +10 -0
  13. package/dist/primitive/checkbox-root.mjs +1 -0
  14. package/dist/primitive/checkbox.d.mts +21 -0
  15. package/dist/primitive/checkbox.mjs +1 -0
  16. package/dist/primitive/index.d.mts +18 -0
  17. package/dist/primitive/index.mjs +1 -0
  18. package/dist/{styles.d.mts → primitive/styles.d.mts} +37 -29
  19. package/dist/primitive/styles.mjs +1 -0
  20. package/dist/{checkbox-jaXFm_b0.d.mts → primitive/use-checkbox.d.mts} +10 -21
  21. package/dist/primitive/use-checkbox.mjs +1 -0
  22. package/package.json +11 -9
  23. package/dist/checkbox-helper-text.d.mts +0 -10
  24. package/dist/checkbox-helper-text.mjs +0 -1
  25. package/dist/checkbox-label.mjs +0 -1
  26. package/dist/styles.mjs +0 -1
  27. package/dist/use-checkbox.d.mts +0 -14
  28. package/dist/use-checkbox.mjs +0 -1
  29. /package/dist/{checkbox-content.d.mts → primitive/checkbox-content.d.mts} +0 -0
  30. /package/dist/{checkbox-content.mjs → primitive/checkbox-content.mjs} +0 -0
  31. /package/dist/{checkbox-context.mjs → primitive/checkbox-context.mjs} +0 -0
  32. /package/dist/{checkbox-description.d.mts → primitive/checkbox-description.d.mts} +0 -0
  33. /package/dist/{checkbox-description.mjs → primitive/checkbox-description.mjs} +0 -0
  34. /package/dist/{checkbox-errror-message.d.mts → primitive/checkbox-error-message.d.mts} +0 -0
  35. /package/dist/{checkbox-errror-message.mjs → primitive/checkbox-error-message.mjs} +0 -0
  36. /package/dist/{checkbox-input.d.mts → primitive/checkbox-input.d.mts} +0 -0
  37. /package/dist/{checkbox-input.mjs → primitive/checkbox-input.mjs} +0 -0
  38. /package/dist/{checkbox-trigger.d.mts → primitive/checkbox-trigger.d.mts} +0 -0
  39. /package/dist/{checkbox-trigger.mjs → primitive/checkbox-trigger.mjs} +0 -0
  40. /package/dist/{checkbox-wrapper.d.mts → primitive/checkbox-wrapper.d.mts} +0 -0
  41. /package/dist/{checkbox-wrapper.mjs → primitive/checkbox-wrapper.mjs} +0 -0
@@ -1,22 +1,23 @@
1
- import { C as Checkbox } from './checkbox-jaXFm_b0.mjs';
1
+ import { Checkbox } from './checkbox.mjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { GlobalConfigProps } from '@jamsrui/core';
4
+ import './primitive/use-checkbox.mjs';
4
5
  import 'react';
5
6
  import '@jamsrui/utils';
6
- import './checkbox-content.mjs';
7
- import './checkbox-description.mjs';
8
- import './checkbox-helper-text.mjs';
9
- import './checkbox-input.mjs';
10
- import './checkbox-label.mjs';
11
- import './checkbox-trigger.mjs';
12
- import './checkbox-wrapper.mjs';
13
- import './styles.mjs';
14
- import 'tailwind-variants';
15
- import './checkbox-errror-message.mjs';
7
+ import './primitive/checkbox-content.mjs';
8
+ import './primitive/checkbox-description.mjs';
9
+ import './primitive/checkbox-error-message.mjs';
10
+ import './primitive/checkbox-input.mjs';
11
+ import './primitive/checkbox-label.mjs';
12
+ import './primitive/checkbox-root.mjs';
13
+ import './primitive/checkbox-trigger.mjs';
14
+ import './primitive/checkbox-wrapper.mjs';
15
+ import './primitive/styles.mjs';
16
16
 
17
17
  declare const useCheckboxConfig: () => CheckboxConfig.Props;
18
- declare const CheckboxConfig: (props: CheckboxConfig.Props & {
18
+ declare const CheckboxConfig: (props: Omit<Partial<CheckboxConfig.Props>, "children"> & {
19
19
  merge?: boolean;
20
+ children: React.ReactNode;
20
21
  }) => react_jsx_runtime.JSX.Element;
21
22
  declare namespace CheckboxConfig {
22
23
  interface Props extends Checkbox.Props, GlobalConfigProps<Checkbox.Props> {
@@ -1,14 +1,23 @@
1
- import 'react/jsx-runtime';
2
- export { C as Checkbox } from './checkbox-jaXFm_b0.mjs';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { useCheckbox } from './primitive/use-checkbox.mjs';
3
+ import { SlotsToReactNode } from '@jamsrui/utils';
4
+ import { CheckboxSlots } from './primitive/styles.mjs';
3
5
  import 'react';
4
- import '@jamsrui/utils';
5
- import './checkbox-content.mjs';
6
- import './checkbox-description.mjs';
7
- import './checkbox-helper-text.mjs';
8
- import './checkbox-input.mjs';
9
- import './checkbox-label.mjs';
10
- import './checkbox-trigger.mjs';
11
- import './checkbox-wrapper.mjs';
12
- import './styles.mjs';
13
- import 'tailwind-variants';
14
- import './checkbox-errror-message.mjs';
6
+ import './primitive/checkbox-content.mjs';
7
+ import './primitive/checkbox-description.mjs';
8
+ import './primitive/checkbox-error-message.mjs';
9
+ import './primitive/checkbox-input.mjs';
10
+ import './primitive/checkbox-label.mjs';
11
+ import './primitive/checkbox-root.mjs';
12
+ import './primitive/checkbox-trigger.mjs';
13
+ import './primitive/checkbox-wrapper.mjs';
14
+
15
+ declare const Checkbox: (props: Checkbox.Props) => react_jsx_runtime.JSX.Element;
16
+ declare namespace Checkbox {
17
+ interface Props extends useCheckbox.Props {
18
+ label?: React.ReactNode;
19
+ slots?: SlotsToReactNode<CheckboxSlots>;
20
+ }
21
+ }
22
+
23
+ export { Checkbox };
package/dist/checkbox.mjs CHANGED
@@ -1 +1 @@
1
- import{Fragment as E,jsx as o,jsxs as P}from"react/jsx-runtime";import{useRenderElement as x}from"@jamsrui/hooks";import{mergeConfigProps as C}from"@jamsrui/utils";import{useCheckboxConfig as i}from"./checkbox-config";import{CheckboxContent as s}from"./checkbox-content";import{CheckboxContext as h}from"./checkbox-context";import{CheckboxDescription as b}from"./checkbox-description";import{CheckboxErrorMessage as k}from"./checkbox-errror-message";import{CheckboxHelperText as f}from"./checkbox-helper-text";import{CheckboxInput as g}from"./checkbox-input";import{CheckboxLabel as d}from"./checkbox-label";import{CheckboxTrigger as a}from"./checkbox-trigger";import{CheckboxWrapper as l}from"./checkbox-wrapper";import{useCheckbox as u}from"./use-checkbox";const A=t=>{const e=i(),p=C(e,e,t),r=u(p),{getRootProps:c}=r,m=o(E,{children:P(l,{children:[o(d,{}),o(f,{}),o(s,{}),o(b,{}),o(k,{}),o(g,{}),o(a,{})]})}),n=x("div",{props:[c({}),{children:m}]});return o(h,{value:r,children:n})};export{A as Checkbox};
1
+ import{jsx as o,jsxs as r}from"react/jsx-runtime";import{Slot as t}from"@jamsrui/slot";import{mergeConfigProps as h}from"@jamsrui/utils";import{useCheckboxConfig as i}from"./checkbox-config";import{CheckboxContent as k,CheckboxContext as a,CheckboxDescription as m,CheckboxErrorMessage as g,CheckboxIcon as S,CheckboxInput as f,CheckboxLabel as u,CheckboxRoot as d,CheckboxTrigger as P,CheckboxWrapper as R,useCheckbox as T}from"./primitive";const I=C=>{const l=i(),x=h(l,l,C),{label:c,children:s,slots:e,...b}=x,n=T(b),p=!!c||!!s;return o(a,{value:n,children:o(t,{slot:e?.root,children:r(d,{children:[o(t,{slot:e?.wrapper,children:r(R,{children:[o(t,{slot:e?.trigger,children:r(P,{children:[o(S,{}),o(t,{slot:e?.input,children:o(f,{})})]})}),p?o(t,{slot:e?.content,children:r(k,{children:[!!c&&o(t,{slot:e?.label,children:o(u,{children:c})}),!!s&&o(t,{slot:e?.description,children:o(m,{children:s})})]})}):null]})}),o(g,{})]})})})};export{I as Checkbox};
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
- export { C as Checkbox } from './checkbox-jaXFm_b0.mjs';
1
+ export { Checkbox } from './checkbox.mjs';
2
2
  export { CheckboxConfig, useCheckboxConfig } from './checkbox-config.mjs';
3
3
  import 'react/jsx-runtime';
4
+ import './primitive/use-checkbox.mjs';
4
5
  import 'react';
5
6
  import '@jamsrui/utils';
6
- import './checkbox-content.mjs';
7
- import './checkbox-description.mjs';
8
- import './checkbox-helper-text.mjs';
9
- import './checkbox-input.mjs';
10
- import './checkbox-label.mjs';
11
- import './checkbox-trigger.mjs';
12
- import './checkbox-wrapper.mjs';
13
- import './styles.mjs';
14
- import 'tailwind-variants';
15
- import './checkbox-errror-message.mjs';
7
+ import './primitive/checkbox-content.mjs';
8
+ import './primitive/checkbox-description.mjs';
9
+ import './primitive/checkbox-error-message.mjs';
10
+ import './primitive/checkbox-input.mjs';
11
+ import './primitive/checkbox-label.mjs';
12
+ import './primitive/checkbox-root.mjs';
13
+ import './primitive/checkbox-trigger.mjs';
14
+ import './primitive/checkbox-wrapper.mjs';
15
+ import './primitive/styles.mjs';
16
16
  import '@jamsrui/core';
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { GlobalConfigProps } from '@jamsrui/core';
3
+ import { Checkbox } from './checkbox.mjs';
4
+ import './use-checkbox.mjs';
5
+ import 'react';
6
+ import '@jamsrui/utils';
7
+ import './checkbox-content.mjs';
8
+ import './checkbox-description.mjs';
9
+ import './checkbox-error-message.mjs';
10
+ import './checkbox-input.mjs';
11
+ import './checkbox-label.mjs';
12
+ import './checkbox-root.mjs';
13
+ import './checkbox-trigger.mjs';
14
+ import './checkbox-wrapper.mjs';
15
+ import './styles.mjs';
16
+
17
+ declare const useCheckboxConfig: () => CheckboxConfig.Props;
18
+ declare const CheckboxConfig: (props: Omit<Partial<CheckboxConfig.Props>, "children"> & {
19
+ merge?: boolean;
20
+ children: React.ReactNode;
21
+ }) => react_jsx_runtime.JSX.Element;
22
+ declare namespace CheckboxConfig {
23
+ interface Props extends Checkbox.Props, GlobalConfigProps<Checkbox.Props> {
24
+ }
25
+ }
26
+
27
+ export { CheckboxConfig, useCheckboxConfig };
@@ -0,0 +1 @@
1
+ import{createConfigContext as o}from"@jamsrui/utils";const[r,C]=o({displayName:"CheckboxConfig"});export{r as CheckboxConfig,C as useCheckboxConfig};
@@ -1,17 +1,15 @@
1
1
  import * as react from 'react';
2
- import { u as useCheckbox } from './checkbox-jaXFm_b0.mjs';
3
- import 'react/jsx-runtime';
2
+ import { useCheckbox } from './use-checkbox.mjs';
4
3
  import '@jamsrui/utils';
5
4
  import './checkbox-content.mjs';
6
5
  import './checkbox-description.mjs';
7
- import './checkbox-helper-text.mjs';
6
+ import './checkbox-error-message.mjs';
8
7
  import './checkbox-input.mjs';
9
8
  import './checkbox-label.mjs';
9
+ import './checkbox-root.mjs';
10
10
  import './checkbox-trigger.mjs';
11
11
  import './checkbox-wrapper.mjs';
12
12
  import './styles.mjs';
13
- import 'tailwind-variants';
14
- import './checkbox-errror-message.mjs';
15
13
 
16
14
  declare const useCheckboxContext: () => CheckboxContext.Props;
17
15
  declare const CheckboxContext: react.Context<CheckboxContext.Props | null>;
@@ -0,0 +1,5 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const CheckboxIcon: () => react_jsx_runtime.JSX.Element;
4
+
5
+ export { CheckboxIcon };
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{motion as o}from"motion/react";import{useCheckboxContext as i}from"./checkbox-context";const a={pressed:{pathLength:.5},checked:{pathLength:1,opacity:1,transition:{duration:.2}},unchecked:{pathLength:0,opacity:0,transition:{duration:.2}}},c=()=>{const{isChecked:n,isIntermediate:e}=i();return t("div",{className:"pointer-events-none absolute left-1/2 top-1/2 z-10 -translate-x-1/2 -translate-y-1/2 text-primary-foreground","data-slot":"icon",children:t(o.svg,{animate:n||e?"checked":"unchecked",className:"size-3.5",fill:"none",initial:!1,stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:t(o.path,{d:e?"M5 12h14":"M4.5 12.75l6 6 9-13.5",strokeLinecap:"round",strokeLinejoin:"round",variants:a})})})};export{c as CheckboxIcon};
@@ -3,7 +3,7 @@ import { UIProps } from '@jamsrui/utils';
3
3
 
4
4
  declare const CheckboxLabel: (props: CheckboxLabel.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
5
  declare namespace CheckboxLabel {
6
- interface Props extends UIProps<"div"> {
6
+ interface Props extends UIProps<"label"> {
7
7
  }
8
8
  }
9
9
 
@@ -0,0 +1 @@
1
+ import{useRenderElement as o}from"@jamsrui/hooks";import{useCheckboxContext as t}from"./checkbox-context";const l=e=>{const{getLabelProps:r}=t();return o("label",{props:[r(e)]})};export{l as CheckboxLabel};
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { UIProps } from '@jamsrui/utils';
3
+
4
+ declare const CheckboxRoot: (prop: CheckboxRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
+ declare namespace CheckboxRoot {
6
+ interface Props extends UIProps<"input"> {
7
+ }
8
+ }
9
+
10
+ export { CheckboxRoot };
@@ -0,0 +1 @@
1
+ import{useRenderElement as t}from"@jamsrui/hooks";import{useCheckboxContext as r}from"./checkbox-context";const m=e=>{const{getRootProps:o}=r();return t("div",{props:[o(e)]})};export{m as CheckboxRoot};
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { useCheckbox } from './use-checkbox.mjs';
3
+ import 'react';
4
+ import '@jamsrui/utils';
5
+ import './checkbox-content.mjs';
6
+ import './checkbox-description.mjs';
7
+ import './checkbox-error-message.mjs';
8
+ import './checkbox-input.mjs';
9
+ import './checkbox-label.mjs';
10
+ import './checkbox-root.mjs';
11
+ import './checkbox-trigger.mjs';
12
+ import './checkbox-wrapper.mjs';
13
+ import './styles.mjs';
14
+
15
+ declare const Checkbox: (props: Checkbox.Props) => react_jsx_runtime.JSX.Element;
16
+ declare namespace Checkbox {
17
+ interface Props extends useCheckbox.Props {
18
+ }
19
+ }
20
+
21
+ export { Checkbox };
@@ -0,0 +1 @@
1
+ import{jsx as C}from"react/jsx-runtime";import{mergeConfigProps as c}from"@jamsrui/utils";import{useCheckboxConfig as x}from"./checkbox-config";import{CheckboxContext as n}from"./checkbox-context";import{useCheckbox as s}from"./use-checkbox";const f=o=>{const e=x(),r=c(e,e,o),t=s(r);return C(n,{value:t,children:o.children})};export{f as Checkbox};
@@ -0,0 +1,18 @@
1
+ export { Checkbox } from './checkbox.mjs';
2
+ export { CheckboxConfig, useCheckboxConfig } from './checkbox-config.mjs';
3
+ export { CheckboxContent } from './checkbox-content.mjs';
4
+ export { CheckboxContext, useCheckboxContext } from './checkbox-context.mjs';
5
+ export { CheckboxDescription } from './checkbox-description.mjs';
6
+ export { CheckboxErrorMessage } from './checkbox-error-message.mjs';
7
+ export { CheckboxIcon } from './checkbox-icon.mjs';
8
+ export { CheckboxInput } from './checkbox-input.mjs';
9
+ export { CheckboxLabel } from './checkbox-label.mjs';
10
+ export { CheckboxRoot } from './checkbox-root.mjs';
11
+ export { CheckboxTrigger } from './checkbox-trigger.mjs';
12
+ export { CheckboxWrapper } from './checkbox-wrapper.mjs';
13
+ export { useCheckbox } from './use-checkbox.mjs';
14
+ import 'react/jsx-runtime';
15
+ import '@jamsrui/core';
16
+ import 'react';
17
+ import '@jamsrui/utils';
18
+ import './styles.mjs';
@@ -0,0 +1 @@
1
+ "use client";import{Checkbox as r}from"./checkbox";import{CheckboxConfig as t,useCheckboxConfig as C}from"./checkbox-config";import{CheckboxContent as p}from"./checkbox-content";import{CheckboxContext as f,useCheckboxContext as h}from"./checkbox-context";import{CheckboxDescription as m}from"./checkbox-description";import{CheckboxErrorMessage as s}from"./checkbox-error-message";import{CheckboxIcon as g}from"./checkbox-icon";import{CheckboxInput as a}from"./checkbox-input";import{CheckboxLabel as I}from"./checkbox-label";import{CheckboxRoot as E}from"./checkbox-root";import{CheckboxTrigger as M}from"./checkbox-trigger";import{CheckboxWrapper as T}from"./checkbox-wrapper";import{useCheckbox as d}from"./use-checkbox";export{r as Checkbox,t as CheckboxConfig,p as CheckboxContent,f as CheckboxContext,m as CheckboxDescription,s as CheckboxErrorMessage,g as CheckboxIcon,a as CheckboxInput,I as CheckboxLabel,E as CheckboxRoot,M as CheckboxTrigger,T as CheckboxWrapper,d as useCheckbox,C as useCheckboxConfig,h as useCheckboxContext};
@@ -1,13 +1,16 @@
1
- import * as tailwind_variants from 'tailwind-variants';
1
+ import * as _jamsrui_utils from '@jamsrui/utils';
2
2
  import { VariantProps } from '@jamsrui/utils';
3
3
 
4
- declare const test = "";
5
- declare const checkboxVariants: tailwind_variants.TVReturnType<{
6
- isInvalid: {
7
- true: {
8
- label: string;
9
- helperText: string;
10
- checkbox: string;
4
+ declare const checkboxVariants: _jamsrui_utils.TVReturnType<{
5
+ size: {
6
+ sm: {
7
+ trigger: string;
8
+ };
9
+ md: {
10
+ trigger: string;
11
+ };
12
+ lg: {
13
+ trigger: string;
11
14
  };
12
15
  };
13
16
  radius: {
@@ -23,19 +26,22 @@ declare const checkboxVariants: tailwind_variants.TVReturnType<{
23
26
  }, {
24
27
  root: string[];
25
28
  wrapper: string;
26
- label: string;
27
- helperText: string;
28
- input: string[];
29
+ label: string[];
29
30
  trigger: string[];
31
+ input: string;
30
32
  description: string;
31
33
  content: string;
32
34
  errorMessage: string;
33
35
  }, undefined, {
34
- isInvalid: {
35
- true: {
36
- label: string;
37
- helperText: string;
38
- checkbox: string;
36
+ size: {
37
+ sm: {
38
+ trigger: string;
39
+ };
40
+ md: {
41
+ trigger: string;
42
+ };
43
+ lg: {
44
+ trigger: string;
39
45
  };
40
46
  };
41
47
  radius: {
@@ -51,19 +57,22 @@ declare const checkboxVariants: tailwind_variants.TVReturnType<{
51
57
  }, {
52
58
  root: string[];
53
59
  wrapper: string;
54
- label: string;
55
- helperText: string;
56
- input: string[];
60
+ label: string[];
57
61
  trigger: string[];
62
+ input: string;
58
63
  description: string;
59
64
  content: string;
60
65
  errorMessage: string;
61
- }, tailwind_variants.TVReturnType<{
62
- isInvalid: {
63
- true: {
64
- label: string;
65
- helperText: string;
66
- checkbox: string;
66
+ }, _jamsrui_utils.TVReturnType<{
67
+ size: {
68
+ sm: {
69
+ trigger: string;
70
+ };
71
+ md: {
72
+ trigger: string;
73
+ };
74
+ lg: {
75
+ trigger: string;
67
76
  };
68
77
  };
69
78
  radius: {
@@ -79,10 +88,9 @@ declare const checkboxVariants: tailwind_variants.TVReturnType<{
79
88
  }, {
80
89
  root: string[];
81
90
  wrapper: string;
82
- label: string;
83
- helperText: string;
84
- input: string[];
91
+ label: string[];
85
92
  trigger: string[];
93
+ input: string;
86
94
  description: string;
87
95
  content: string;
88
96
  errorMessage: string;
@@ -90,4 +98,4 @@ declare const checkboxVariants: tailwind_variants.TVReturnType<{
90
98
  type CheckboxVariantProps = VariantProps<typeof checkboxVariants>;
91
99
  type CheckboxSlots = keyof ReturnType<typeof checkboxVariants>;
92
100
 
93
- export { type CheckboxSlots, type CheckboxVariantProps, checkboxVariants, test };
101
+ export { type CheckboxSlots, type CheckboxVariantProps, checkboxVariants };
@@ -0,0 +1 @@
1
+ import{groupDataFocusVisibleClasses as e,radiusVariant as r,tv as o}from"@jamsrui/utils";const i=o({slots:{root:["group flex flex-col gap-2","ui-disabled:opacity-60","ui-disabled:cursor-not-allowed"],wrapper:"flex gap-2",label:["shrink-0 text-sm font-normal leading-none text-foreground uig-interactive:cursor-pointer uig-disabled:cursor-not-allowed","select-none"],trigger:[...e,"border-default uig-hover:border-default-hover","relative size-5 appearance-none border uig-checked:border-primary uig-checked:bg-primary uig-interactive:cursor-pointer","uig-disabled:cursor-not-allowed uig-pressed:scale-90 transition-all duration-300"],input:"absolute opacity-[0.0001] cursor-pointer disabled:cursor-not-allowed inset-0 z-1",description:"text-xs text-foreground-secondary",content:"flex flex-col justify-center gap-1",errorMessage:""},variants:{size:{sm:{trigger:"size-4"},md:{trigger:"size-4.5"},lg:{trigger:"size-5.5"}},radius:r("trigger")},defaultVariants:{radius:"md",size:"md"}});export{i as checkboxVariants};
@@ -1,50 +1,39 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
3
2
  import { PropGetter, UIProps, SlotsToClassNames } from '@jamsrui/utils';
4
3
  import { CheckboxContent } from './checkbox-content.mjs';
5
4
  import { CheckboxDescription } from './checkbox-description.mjs';
6
- import { CheckboxHelperText } from './checkbox-helper-text.mjs';
5
+ import { CheckboxErrorMessage } from './checkbox-error-message.mjs';
7
6
  import { CheckboxInput } from './checkbox-input.mjs';
8
7
  import { CheckboxLabel } from './checkbox-label.mjs';
8
+ import { CheckboxRoot } from './checkbox-root.mjs';
9
9
  import { CheckboxTrigger } from './checkbox-trigger.mjs';
10
10
  import { CheckboxWrapper } from './checkbox-wrapper.mjs';
11
11
  import { CheckboxVariantProps, CheckboxSlots } from './styles.mjs';
12
- import { CheckboxErrorMessage } from './checkbox-errror-message.mjs';
13
12
 
14
13
  declare const useCheckbox: (props: useCheckbox.Props) => {
15
- getRootProps: PropGetter<Checkbox.Props>;
14
+ getRootProps: PropGetter<CheckboxRoot.Props>;
16
15
  getWrapperProps: PropGetter<CheckboxWrapper.Props>;
17
16
  getLabelProps: PropGetter<CheckboxLabel.Props>;
18
17
  getInputProps: PropGetter<CheckboxInput.Props>;
19
18
  getTriggerProps: PropGetter<CheckboxTrigger.Props>;
20
19
  getDescriptionProps: PropGetter<CheckboxDescription.Props>;
21
- getHelperTextProps: PropGetter<CheckboxHelperText.Props>;
22
20
  getContentProps: PropGetter<CheckboxContent.Props>;
23
21
  onCheckedChange: ((checked: boolean) => void) | undefined;
24
- defaultChecked: boolean | undefined;
25
- label: react.ReactNode;
26
- description: react.ReactNode;
27
- helperText: string | undefined;
28
22
  getErrorMessageProps: PropGetter<CheckboxErrorMessage.Props>;
23
+ defaultChecked: boolean | undefined;
24
+ isChecked: boolean;
25
+ children: react.ReactNode;
26
+ isIntermediate: boolean | undefined;
29
27
  };
30
28
  declare namespace useCheckbox {
31
- interface Props extends UIProps<"div">, CheckboxVariantProps {
32
- label?: React.ReactNode;
33
- description?: React.ReactNode;
29
+ interface Props extends UIProps<"input">, CheckboxVariantProps {
34
30
  defaultChecked?: boolean;
35
31
  isChecked?: boolean;
36
32
  onCheckedChange?: (checked: boolean) => void;
37
- helperText?: string;
38
33
  classNames?: SlotsToClassNames<CheckboxSlots>;
39
- isReadonly?: boolean;
40
34
  isDisabled?: boolean;
35
+ isIntermediate?: boolean;
41
36
  }
42
37
  }
43
38
 
44
- declare const Checkbox: (props: Checkbox.Props) => react_jsx_runtime.JSX.Element;
45
- declare namespace Checkbox {
46
- interface Props extends useCheckbox.Props {
47
- }
48
- }
49
-
50
- export { Checkbox as C, useCheckbox as u };
39
+ export { useCheckbox };
@@ -0,0 +1 @@
1
+ import{useCallback as r,useId as H,useMemo as W}from"react";import{useControlledState as A,useFocusVisible as U,useHover as j,useMergeRefs as K,usePress as O}from"@jamsrui/hooks";import{cn as c,dataAttr as p,dataAttrDev as a,mapPropsVariants as $,mergeProps as q}from"@jamsrui/utils";import{checkboxVariants as V}from"./styles";const X=D=>{const[T,w]=$(D,V.variantKeys),o=V(w),{isChecked:E,onCheckedChange:m,defaultChecked:d,classNames:s,isDisabled:t=!1,children:h,isIntermediate:n,...b}=T,[i=!1,k]=A({defaultProp:d,prop:E,onChange:m}),l=H(),{isFocusVisible:C,ref:S}=U({isDisabled:t}),{isPressed:g,ref:L}=O({isDisabled:t}),{isHovered:P,ref:F}=j({isDisabled:t}),x=K([S,L,F]),u=r(e=>{k(e.target.checked)},[k]),f=r(e=>({...e,className:o.root({className:c(s?.root)}),"data-slot":a("root"),"data-component":a("checkbox"),"data-checked":p(i||n),"data-focus-visible":p(C),"data-pressed":p(g),"data-hovered":p(P),"data-disabled":p(t),"aria-disabled":p(t)}),[s?.root,i,t,C,P,n,g,o]),N=r(e=>({...q(b,e,{onChange:u}),disabled:t,"aria-disabled":p(t),id:l,ref:x,type:"checkbox","data-slot":a("input"),className:o.input({className:c(s?.input,b.className,e.className)})}),[b,u,t,l,x,o,s?.input]),y=r(e=>({...e,"data-slot":a("wrapper"),className:o.wrapper({className:c(s?.wrapper,e.className)})}),[s?.wrapper,o]),I=r(e=>({...e,htmlFor:l,"data-slot":a("label"),className:o.label({className:c(s?.label,e.className)})}),[s?.label,l,o]),v=r(e=>({...e,"data-slot":a("trigger"),className:o.trigger({className:c(s?.trigger,e.className)})}),[s?.trigger,o]),M=r(e=>({...e,"data-slot":a("description"),className:o.description({className:c(s?.description,e.className)})}),[s?.description,o]),G=r(e=>({...e,"data-slot":a("content"),className:o.content({className:c(s?.content,e.className)})}),[s?.content,o]),R=r(e=>({...e,"data-slot":a("errorMessage"),className:o.errorMessage({className:c(s?.errorMessage,e.className)})}),[s?.errorMessage,o]);return W(()=>({getRootProps:f,getWrapperProps:y,getLabelProps:I,getInputProps:N,getTriggerProps:v,getDescriptionProps:M,getContentProps:G,onCheckedChange:m,getErrorMessageProps:R,defaultChecked:d,isChecked:i,children:h,isIntermediate:n}),[h,d,G,M,R,N,I,f,v,y,i,n,m])};export{X as useCheckbox};
package/package.json CHANGED
@@ -1,14 +1,6 @@
1
1
  {
2
2
  "name": "@jamsrui/checkbox",
3
- "version": "0.0.7",
4
- "peerDependencies": {
5
- "react": ">=19"
6
- },
7
- "dependencies": {
8
- "@jamsrui/hooks": "^0.0.7",
9
- "@jamsrui/core": "^0.0.7",
10
- "@jamsrui/utils": "^0.0.7"
11
- },
3
+ "version": "0.0.9",
12
4
  "exports": {
13
5
  ".": {
14
6
  "types": "./dist/index.d.ts",
@@ -16,6 +8,16 @@
16
8
  "require": "./dist/index.js"
17
9
  }
18
10
  },
11
+ "peerDependencies": {
12
+ "motion": ">=12",
13
+ "react": ">=19"
14
+ },
15
+ "dependencies": {
16
+ "@jamsrui/core": "^0.0.8",
17
+ "@jamsrui/hooks": "^0.0.9",
18
+ "@jamsrui/slot": "^0.0.9",
19
+ "@jamsrui/utils": "^0.0.9"
20
+ },
19
21
  "description": "A modern and beautiful Next.js UI components library.",
20
22
  "keywords": [
21
23
  "react",
@@ -1,10 +0,0 @@
1
- import * as react from 'react';
2
- import { UIProps } from '@jamsrui/utils';
3
-
4
- declare const CheckboxHelperText: (props: CheckboxHelperText.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
- declare namespace CheckboxHelperText {
6
- interface Props extends UIProps<"div"> {
7
- }
8
- }
9
-
10
- export { CheckboxHelperText };
@@ -1 +0,0 @@
1
- import{useRenderElement as t}from"@jamsrui/hooks";import{useCheckboxContext as o}from"./checkbox-context";const x=e=>{const{getHelperTextProps:r}=o();return t("div",{props:[r(e)]})};export{x as CheckboxHelperText};
@@ -1 +0,0 @@
1
- import{useRenderElement as o}from"@jamsrui/hooks";import{useCheckboxContext as t}from"./checkbox-context";const m=e=>{const{getLabelProps:r}=t();return o("div",{props:[r(e)]})};export{m as CheckboxLabel};
package/dist/styles.mjs DELETED
@@ -1 +0,0 @@
1
- import{focusVisibleClasses as e,radiusVariant as r,tv as t}from"@jamsrui/utils";const a="",i=t({slots:{root:["group flex flex-col gap-2","ui-disabled:opacity-60","ui-disabled:cursor-not-allowed"],wrapper:"flex gap-2",label:"shrink-0 text-sm font-normal leading-none text-foreground uig-interactive:cursor-pointer uig-disabled:cursor-not-allowed",helperText:"text-xs text-foreground-600",input:[...e,"border-default-200 uig-hover:border-default-400","relative size-5 appearance-none border-2 uig-checked:border-primary uig-checked:bg-primary uig-interactive:cursor-pointer","uig-disabled:cursor-not-allowed"],trigger:["relative flex size-max items-center","disabled:cursor-not-allowed"],description:"text-xs text-foreground-500",content:"flex flex-col justify-center gap-1",errorMessage:""},variants:{isInvalid:{true:{label:"text-danger",helperText:"text-danger",checkbox:"border-danger"}},radius:r("checkbox")},defaultVariants:{radius:"md"}});export{i as checkboxVariants,a as test};
@@ -1,14 +0,0 @@
1
- import 'react';
2
- import '@jamsrui/utils';
3
- export { u as useCheckbox } from './checkbox-jaXFm_b0.mjs';
4
- import './checkbox-content.mjs';
5
- import './checkbox-description.mjs';
6
- import './checkbox-helper-text.mjs';
7
- import './checkbox-input.mjs';
8
- import './checkbox-label.mjs';
9
- import './checkbox-trigger.mjs';
10
- import './checkbox-wrapper.mjs';
11
- import './styles.mjs';
12
- import './checkbox-errror-message.mjs';
13
- import 'react/jsx-runtime';
14
- import 'tailwind-variants';
@@ -1 +0,0 @@
1
- import{useCallback as r,useMemo as M}from"react";import{useControlledState as D}from"@jamsrui/hooks";import{cn as a,dataAttrDev as s,mapPropsVariants as R}from"@jamsrui/utils";import{checkboxVariants as f}from"./styles";const j=u=>{const[y,T]=R(u,f.variantKeys),o=f(T),{isChecked:G,onCheckedChange:c,defaultChecked:p,label:n,description:i,helperText:m,isReadonly:I,classNames:t,isDisabled:v,...l}=y,[w=!1,S]=D({defaultProp:p,prop:G,onChange:c}),h=r(()=>({...l,"data-slot":s("root"),"data-component":s("checkbox"),className:o.root({className:a(t?.root,l.className)})}),[t?.root,l,o]),b=r(e=>({...e,"data-slot":s("wrapper"),className:o.wrapper({className:a(t?.wrapper,e.className)})}),[t?.wrapper,o]),x=r(e=>({...e,"data-slot":s("label"),className:o.label({className:a(t?.label,e.className)})}),[t?.label,o]),k=r(e=>({...e,"data-slot":s("input"),className:o.input({className:a(t?.input,e.className)})}),[t?.input,o]),C=r(e=>({...e,"data-slot":s("trigger"),className:o.trigger({className:a(t?.trigger,e.className)})}),[t?.trigger,o]),d=r(e=>({...e,"data-slot":s("description"),className:o.description({className:a(t?.description,e.className)})}),[t?.description,o]),P=r(e=>({...e,"data-slot":s("helperText"),className:o.helperText({className:a(t?.helperText,e.className)})}),[t?.helperText,o]),g=r(e=>({...e,"data-slot":s("content"),className:o.content({className:a(t?.content,e.className)})}),[t?.content,o]),N=r(e=>({...e,"data-slot":s("errorMessage"),className:o.errorMessage({className:a(t?.errorMessage,e.className)})}),[t?.errorMessage,o]);return M(()=>({getRootProps:h,getWrapperProps:b,getLabelProps:x,getInputProps:k,getTriggerProps:C,getDescriptionProps:d,getHelperTextProps:P,getContentProps:g,onCheckedChange:c,defaultChecked:p,label:n,description:i,helperText:m,getErrorMessageProps:N}),[p,i,g,d,N,P,k,x,h,C,b,m,n,c])};export{j as useCheckbox};