@jamsrui/checkbox 0.0.21 → 0.1.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.
package/README.md CHANGED
@@ -2,12 +2,11 @@
2
2
 
3
3
  **A comprehensive React UI component library designed for developers, with Tailwind CSS integration for seamless styling.**
4
4
 
5
-
6
5
  ## 📖 **Overview**
7
6
 
8
7
  [JamsrUI](https://jamsr-ui.jamsrworld.com) is designed to help developers build modern, fast and visually appealing web applications with ease.
9
8
 
10
- ## 🚀 Getting Started
9
+ ## 🚀 Getting Started
11
10
 
12
11
  Boost & Build your websites using [JamsrUI](https://jamsr-ui.jamsrworld.com).
13
12
 
@@ -37,4 +36,3 @@ We welcome contributions from developers of all skill levels!
37
36
  ## ⭐ Support the Project
38
37
 
39
38
  If you find **JamsrUI** helpful, consider giving it a ⭐ on [GitHub](https://github.com/jamsrworld/jamsr-ui).
40
-
@@ -7,7 +7,6 @@ import './checkbox-indicator.mjs';
7
7
  import 'react/jsx-runtime';
8
8
  import './checkbox-input.mjs';
9
9
  import './checkbox-root.mjs';
10
- import './styles.mjs';
11
10
 
12
11
  declare const useCheckboxContext: () => CheckboxContext.Props;
13
12
  declare const CheckboxContext: react.Context<CheckboxContext.Props | null>;
@@ -1 +1 @@
1
- "use client";import{Fragment as m,jsx as e,jsxs as i}from"react/jsx-runtime";import{useRenderElement as n}from"@jamsrui/hooks";import{useCheckboxContext as p}from"./checkbox-context.mjs";import{CheckboxIndicator as c}from"./checkbox-indicator.mjs";import{CheckboxInput as s}from"./checkbox-input.mjs";const b=o=>{const{getControlProps:r}=p(),{children:t=e(c,{})}=o;return n("div",{props:[r(o),{children:i(m,{children:[e(s,{}),t]})}]})};export{b as CheckboxControl};
1
+ "use client";import{useRenderElement as r}from"@jamsrui/hooks";import{useCheckboxContext as t}from"./checkbox-context.mjs";const m=e=>{const{getControlProps:o}=t();return r("div",{props:[o(e)]})};export{m as CheckboxControl};
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{motion as o}from"motion/react";import{useCheckboxContext as i}from"./checkbox-context.mjs";const r={pressed:{pathLength:.5},checked:{pathLength:1,opacity:1,transition:{duration:.2}},unchecked:{pathLength:0,opacity:0,transition:{duration:.2}}},c=()=>{const{isChecked:n,isIntermediate:t}=i();return e(o.svg,{animate:n||t?"checked":"unchecked",fill:"none",initial:!1,stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e(o.path,{d:t?"M5 12h14":"M4.5 12.75l6 6 9-13.5",strokeLinecap:"round",strokeLinejoin:"round",variants:r})})};export{c as CheckboxIcon};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{motion as o}from"motion/react";import{useCheckboxContext as i}from"./checkbox-context.mjs";const r={pressed:{pathLength:.5},checked:{pathLength:1,opacity:1,transition:{duration:.2}},unchecked:{pathLength:0,opacity:0,transition:{duration:.2}}},c=()=>{const{isChecked:n,isIntermediate:t}=i();return e(o.svg,{animate:n||t?"checked":"unchecked",fill:"none",initial:!1,stroke:"currentColor",strokeWidth:"4",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e(o.path,{d:t?"M5 12h14":"M4.5 12.75l6 6 9-13.5",strokeLinecap:"round",strokeLinejoin:"round",variants:r})})};export{c as CheckboxIcon};
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{useCheckboxContext as n}from"./checkbox-context.mjs";import{CheckboxIcon as s}from"./checkbox-icon.mjs";const p=t=>{const{getIndicatorProps:c,isChecked:r}=n(),{children:o=e(s,{})}=t,i=typeof o=="function"?o({isChecked:r}):o;return e("div",{...c({}),children:i})};export{p as CheckboxIndicator};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{useCheckboxContext as s}from"./checkbox-context.mjs";import{CheckboxIcon as d}from"./checkbox-icon.mjs";const h=t=>{const{getIndicatorProps:c,isChecked:r}=s(),{children:o=e(d,{}),...i}=t,n=typeof o=="function"?o({isChecked:r}):o;return e("div",{...c(i),children:n})};export{h as CheckboxIndicator};
@@ -7,7 +7,6 @@ import './checkbox-control.mjs';
7
7
  import './checkbox-indicator.mjs';
8
8
  import './checkbox-input.mjs';
9
9
  import './checkbox-root.mjs';
10
- import './styles.mjs';
11
10
 
12
11
  declare const Checkbox: (props: Checkbox.Props) => react_jsx_runtime.JSX.Element;
13
12
  declare namespace Checkbox {
package/dist/checkbox.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{FieldA11yContext as n,useFieldA11y as i}from"@jamsrui/context";import{mergeConfigProps as s}from"@jamsrui/utils";import{useCheckboxConfig as C}from"./checkbox-config.mjs";import{CheckboxContext as m}from"./checkbox-context.mjs";import{CheckboxRoot as p}from"./checkbox-root.mjs";import{checkboxVariants as f}from"./styles.mjs";import{useCheckbox as h}from"./use-checkbox.mjs";const P=e=>{const t=C(),r=s(f.defaultVariants,t,e),c=h(r),x=i();return o(m,{value:c,children:o(n,{value:x,children:o(p,{children:e.children})})})};export{P as Checkbox};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{FieldA11yContext as c,useFieldA11y as r}from"@jamsrui/context";import{CheckboxContext as C}from"./checkbox-context.mjs";import{CheckboxRoot as n}from"./checkbox-root.mjs";import{useCheckbox as h}from"./use-checkbox.mjs";const k=o=>{const t=h(o),x=r();return e(C,{value:t,children:e(c,{value:x,children:e(n,{children:o.children})})})};export{k as Checkbox};
package/dist/index.d.mts CHANGED
@@ -1,35 +1,32 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { Checkbox as Checkbox$1 } from './checkbox.mjs';
4
- import { CheckboxConfig } from './checkbox-config.mjs';
5
- export { useCheckboxConfig } from './checkbox-config.mjs';
6
4
  import { CheckboxContent } from './checkbox-content.mjs';
7
5
  import { CheckboxControl } from './checkbox-control.mjs';
8
6
  import { CheckboxIndicator } from './checkbox-indicator.mjs';
7
+ import { CheckboxInput } from './checkbox-input.mjs';
9
8
  export { useCheckbox } from './use-checkbox.mjs';
10
- import '@jamsrui/core';
11
9
  import '@jamsrui/utils';
12
- import './checkbox-input.mjs';
13
10
  import './checkbox-root.mjs';
14
- import './styles.mjs';
15
11
 
16
12
  declare const Checkbox: ((props: Checkbox$1.Props) => react_jsx_runtime.JSX.Element) & {
17
13
  Root: (props: Checkbox$1.Props) => react_jsx_runtime.JSX.Element;
18
14
  Control: (props: CheckboxControl.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
19
15
  Indicator: (props: CheckboxIndicator.Props) => react_jsx_runtime.JSX.Element;
20
16
  Content: (props: CheckboxContent.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
17
+ Input: (props: CheckboxInput.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
21
18
  };
22
19
  declare namespace Checkbox {
23
20
  interface Props extends Checkbox$1.Props {
24
21
  }
25
- interface Config extends CheckboxConfig.Props {
26
- }
27
22
  interface Control extends CheckboxControl.Props {
28
23
  }
29
24
  interface Indicator extends CheckboxIndicator.Props {
30
25
  }
31
26
  interface Content extends CheckboxContent.Props {
32
27
  }
28
+ interface Input extends CheckboxInput.Props {
29
+ }
33
30
  }
34
31
 
35
- export { Checkbox, CheckboxConfig, CheckboxContent, CheckboxControl, CheckboxIndicator };
32
+ export { Checkbox };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{Checkbox as o}from"./checkbox.mjs";import{CheckboxConfig as n,useCheckboxConfig as x}from"./checkbox-config.mjs";import{CheckboxContent as e}from"./checkbox-content.mjs";import{CheckboxControl as t}from"./checkbox-control.mjs";import{CheckboxIndicator as r}from"./checkbox-indicator.mjs";import{useCheckbox as c}from"./use-checkbox.mjs";const h=Object.assign(o,{Root:o,Control:t,Indicator:r,Content:e});export{h as Checkbox,n as CheckboxConfig,e as CheckboxContent,t as CheckboxControl,r as CheckboxIndicator,c as useCheckbox,x as useCheckboxConfig};
1
+ import{Checkbox as o}from"./checkbox.mjs";import{CheckboxContent as e}from"./checkbox-content.mjs";import{CheckboxControl as t}from"./checkbox-control.mjs";import{CheckboxIndicator as r}from"./checkbox-indicator.mjs";import{CheckboxInput as n}from"./checkbox-input.mjs";import{useCheckbox as x}from"./use-checkbox.mjs";const h=Object.assign(o,{Root:o,Control:t,Indicator:r,Content:e,Input:n});export{h as Checkbox,x as useCheckbox};
@@ -4,7 +4,6 @@ import { CheckboxControl } from './checkbox-control.mjs';
4
4
  import { CheckboxIndicator } from './checkbox-indicator.mjs';
5
5
  import { CheckboxInput } from './checkbox-input.mjs';
6
6
  import { CheckboxRoot } from './checkbox-root.mjs';
7
- import { CheckboxVariantProps } from './styles.mjs';
8
7
  import 'react';
9
8
  import 'react/jsx-runtime';
10
9
 
@@ -20,12 +19,13 @@ declare const useCheckbox: (props: useCheckbox.Props) => {
20
19
  isIntermediate: boolean | undefined;
21
20
  };
22
21
  declare namespace useCheckbox {
23
- interface Props extends CheckboxRoot.Props, CheckboxVariantProps {
22
+ interface Props extends CheckboxRoot.Props {
24
23
  defaultChecked?: boolean;
25
24
  checked?: boolean;
26
25
  onCheckedChange?: (checked: boolean) => void;
27
26
  isIntermediate?: boolean;
28
27
  disabled?: boolean;
28
+ isInvalid?: boolean;
29
29
  inputProps?: UIProps<"input">;
30
30
  name?: string;
31
31
  form?: string;
@@ -1 +1 @@
1
- "use client";import{useCallback as a,useMemo as E}from"react";import{useControlledState as F,useFocusVisible as U,useHover as j,useMergeRefs as K,usePress as L}from"@jamsrui/hooks";import{dataAttr as s,dataAttrDev as r,mapPropsVariants as O,mergeProps as S}from"@jamsrui/utils";import{checkboxVariants as v}from"./styles.mjs";const J=y=>{const[R,m]=O(y,v.variantKeys),{isInvalid:h}=m,o=v(m),{checked:V,onCheckedChange:i,defaultChecked:p,isIntermediate:c,disabled:G=!1,inputProps:H,...l}=R,t=G,[n=!1,b]=F({defaultProp:p,prop:V,onChange:i}),{isFocusVisible:C,ref:M}=U({isDisabled:t}),{isPressed:k,ref:A}=L({isDisabled:t}),{isHovered:u,ref:D}=j({isDisabled:t}),P=K([M,A,D]),d=a(e=>{b(e.target.checked)},[b]),f=a(()=>({...l,className:o.root({className:l.className}),"data-slot":r("root"),"data-component":r("checkbox"),"data-checked":s(n||c),"data-focus-visible":s(C),"data-pressed":s(k),"data-hovered":s(u),"data-disabled":s(t),"aria-disabled":s(t),"data-invalid":s(h)}),[l,n,t,C,u,c,k,h,o]),x=a(e=>({onChange:d,...S(e,H,{onChange:d}),disabled:t,"aria-disabled":s(t),ref:P,type:"checkbox","data-slot":r("input"),className:o.input({className:e.className})}),[d,t,P,o]),g=a(e=>({...e,"data-slot":r("content"),className:o.content({className:e.className})}),[o]),N=a(e=>({...e,"data-slot":r("control"),className:o.control({className:e.className})}),[o]),I=a(e=>({...e,"data-slot":r("indicator"),className:o.indicator({className:e.className})}),[o]);return E(()=>({getRootProps:f,getInputProps:x,getContentProps:g,getControlProps:N,getIndicatorProps:I,onCheckedChange:i,defaultChecked:p,isChecked:n,isIntermediate:c}),[p,g,x,f,N,I,n,c,i])};export{J as useCheckbox};
1
+ "use client";import{useCallback as s,useMemo as G}from"react";import{useControlledState as L,useFocusVisible as T,useHover as V,useMergeRefs as F,usePress as U}from"@jamsrui/hooks";import{dataAttr as t,mergeProps as j}from"@jamsrui/utils";const q=v=>{const{checked:R,onCheckedChange:a,defaultChecked:c,isIntermediate:r,disabled:y=!1,isInvalid:i,inputProps:d,className:l,...h}=v,e=y,[n=!1,b]=L({defaultProp:c,prop:R,onChange:a}),{isFocusVisible:C,ref:H}=T({isDisabled:e}),{isPressed:u,ref:M}=U({isDisabled:e}),{isHovered:k,ref:E}=V({isDisabled:e}),m=F([H,M,E]),p=s(o=>{b(o.target.checked)},[b]),P=s(()=>({...h,className:l,"data-slot":"root","data-component":"checkbox","data-checked":t(n||r),"data-focus-visible":t(C),"data-pressed":t(u),"data-hovered":t(k),"data-disabled":t(e),"aria-disabled":t(e),"data-invalid":t(i)}),[h,l,n,e,C,k,r,u,i]),f=s(o=>({onChange:p,...j(o,d,{onChange:p}),disabled:e,"aria-disabled":t(e),ref:m,type:"checkbox","data-slot":"input"}),[p,e,m,d]),x=s(o=>({...o,"data-slot":"content"}),[]),I=s(o=>({...o,"data-slot":"control"}),[]),g=s(o=>({...o,"data-slot":"indicator"}),[]);return G(()=>({getRootProps:P,getInputProps:f,getContentProps:x,getControlProps:I,getIndicatorProps:g,onCheckedChange:a,defaultChecked:c,isChecked:n,isIntermediate:r}),[c,x,f,P,I,g,n,r,a])};export{q as useCheckbox};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamsrui/checkbox",
3
- "version": "0.0.21",
3
+ "version": "0.1.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -16,11 +16,10 @@
16
16
  "react": ">=19"
17
17
  },
18
18
  "dependencies": {
19
- "@jamsrui/core": "^0.0.16",
20
- "@jamsrui/hooks": "^0.0.20",
21
- "@jamsrui/slot": "^0.0.17",
22
- "@jamsrui/utils": "^0.0.20",
23
- "@jamsrui/context": "^0.0.9"
19
+ "@jamsrui/context": "^0.1.0",
20
+ "@jamsrui/core": "^0.1.0",
21
+ "@jamsrui/utils": "^0.1.0",
22
+ "@jamsrui/hooks": "^0.1.0"
24
23
  },
25
24
  "description": "A modern and beautiful Next.js UI components library.",
26
25
  "keywords": [
@@ -1,24 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { WithGlobalConfig } from '@jamsrui/core';
3
- import { Checkbox } from './checkbox.mjs';
4
- import './use-checkbox.mjs';
5
- import '@jamsrui/utils';
6
- import './checkbox-content.mjs';
7
- import 'react';
8
- import './checkbox-control.mjs';
9
- import './checkbox-indicator.mjs';
10
- import './checkbox-input.mjs';
11
- import './checkbox-root.mjs';
12
- import './styles.mjs';
13
-
14
- declare const useCheckboxConfig: () => CheckboxConfig.Props;
15
- declare const CheckboxConfig: (props: Omit<Partial<CheckboxConfig.Props>, "children"> & {
16
- merge?: boolean;
17
- children: React.ReactNode;
18
- }) => react_jsx_runtime.JSX.Element;
19
- declare namespace CheckboxConfig {
20
- interface Props extends WithGlobalConfig<Checkbox.Props> {
21
- }
22
- }
23
-
24
- export { CheckboxConfig, useCheckboxConfig };
@@ -1 +0,0 @@
1
- "use client";import{createConfigContext as o}from"@jamsrui/utils";const[i,t]=o({displayName:"CheckboxConfig"});export{i as CheckboxConfig,t as useCheckboxConfig};
package/dist/styles.d.mts DELETED
@@ -1,116 +0,0 @@
1
- import * as _jamsrui_utils from '@jamsrui/utils';
2
- import { VariantProps } from '@jamsrui/utils';
3
-
4
- declare const checkboxVariants: _jamsrui_utils.TVReturnType<{
5
- size: {
6
- sm: {
7
- root: string;
8
- control: string;
9
- };
10
- md: {
11
- root: string;
12
- control: string;
13
- };
14
- lg: {
15
- root: string;
16
- control: string;
17
- };
18
- };
19
- isInvalid: {
20
- true: {
21
- control: string;
22
- };
23
- };
24
- radius: {
25
- sm: {};
26
- md: {};
27
- lg: {};
28
- xl: {};
29
- "2xl": {};
30
- "3xl": {};
31
- full: {};
32
- none: {};
33
- };
34
- }, {
35
- root: string[];
36
- control: string[];
37
- input: string;
38
- content: string;
39
- indicator: string;
40
- }, undefined, {
41
- size: {
42
- sm: {
43
- root: string;
44
- control: string;
45
- };
46
- md: {
47
- root: string;
48
- control: string;
49
- };
50
- lg: {
51
- root: string;
52
- control: string;
53
- };
54
- };
55
- isInvalid: {
56
- true: {
57
- control: string;
58
- };
59
- };
60
- radius: {
61
- sm: {};
62
- md: {};
63
- lg: {};
64
- xl: {};
65
- "2xl": {};
66
- "3xl": {};
67
- full: {};
68
- none: {};
69
- };
70
- }, {
71
- root: string[];
72
- control: string[];
73
- input: string;
74
- content: string;
75
- indicator: string;
76
- }, _jamsrui_utils.TVReturnType<{
77
- size: {
78
- sm: {
79
- root: string;
80
- control: string;
81
- };
82
- md: {
83
- root: string;
84
- control: string;
85
- };
86
- lg: {
87
- root: string;
88
- control: string;
89
- };
90
- };
91
- isInvalid: {
92
- true: {
93
- control: string;
94
- };
95
- };
96
- radius: {
97
- sm: {};
98
- md: {};
99
- lg: {};
100
- xl: {};
101
- "2xl": {};
102
- "3xl": {};
103
- full: {};
104
- none: {};
105
- };
106
- }, {
107
- root: string[];
108
- control: string[];
109
- input: string;
110
- content: string;
111
- indicator: string;
112
- }, undefined, unknown, unknown, undefined>>;
113
- type CheckboxVariantProps = VariantProps<typeof checkboxVariants>;
114
- type CheckboxSlots = keyof ReturnType<typeof checkboxVariants>;
115
-
116
- export { type CheckboxSlots, type CheckboxVariantProps, checkboxVariants };
package/dist/styles.mjs DELETED
@@ -1 +0,0 @@
1
- import{groupDataFocusVisibleClasses as e,radiusVariant as o,tv as r}from"@jamsrui/utils";const a=r({slots:{root:["checkbox group flex gap-2 items-start","data-disabled:status-disabled"],control:["checkbox__control flex justify-center items-center",...e,"shrink-0 border-default uig-hover:border-default-hover","relative appearance-none border uig-checked:border-primary uig-checked:bg-primary uig-checked:text-primary-foreground","uig-disabled:status-disabled uig-pressed:scale-90 transition-all duration-300"],input:"checkbox__input absolute opacity-[0.0001] cursor-default disabled:cursor-not-allowed inset-0 z-1",content:"checkbox__content flex flex-col justify-center gap-1",indicator:"checkbox__indicator size-3"},variants:{size:{sm:{root:"checkbox--sm",control:"size-4"},md:{root:"checkbox--md",control:"size-4.5"},lg:{root:"checkbox--lg",control:"size-5"}},isInvalid:{true:{control:"border-danger! uig-checked:bg-danger"}},radius:o("control")},defaultVariants:{radius:"md",size:"md"}});export{a as checkboxVariants};