@cocso-ui/react 0.0.1-beta.15 → 0.0.1-beta.17
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/lib/components/Accordion/Accordion.d.ts +2 -2
- package/lib/components/Body/Body.d.ts +9 -8
- package/lib/components/Button/Button.d.ts +4 -8
- package/lib/components/Checkbox/Checkbox.d.ts +5 -4
- package/lib/components/Display/Display.d.ts +4 -8
- package/lib/components/Heading/Heading.d.ts +4 -8
- package/lib/components/Label/Label.d.ts +9 -8
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/package.json +4 -2
|
@@ -2,6 +2,6 @@ import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
|
2
2
|
export declare const Accordion: import("react").ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & import("react").RefAttributes<HTMLDivElement>> & {
|
|
3
3
|
Item: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
Header: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionHeaderProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
5
|
-
Trigger: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
-
Content: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
Trigger: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
Content: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
7
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/token';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Default = (typeof tags)[0];
|
|
6
|
-
export type BodyProps<T extends Element = Default> = {
|
|
7
|
-
as?: T;
|
|
3
|
+
export type BodyProps = {
|
|
4
|
+
asChild?: boolean;
|
|
8
5
|
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
9
6
|
color?: string;
|
|
10
7
|
weight?: FontWeightToken;
|
|
11
|
-
} & React.ComponentPropsWithoutRef<
|
|
12
|
-
export declare const Body: React.ForwardRefExoticComponent<
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'p'>;
|
|
9
|
+
export declare const Body: React.ForwardRefExoticComponent<{
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
size?: "lg" | "md" | "sm" | "xs";
|
|
12
|
+
color?: string;
|
|
13
|
+
weight?: FontWeightToken;
|
|
14
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>> & {
|
|
13
15
|
displayName: string;
|
|
14
16
|
};
|
|
15
|
-
export {};
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/token';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Default = (typeof tags)[0];
|
|
6
|
-
export type ButtonProps<T extends Element = Default> = {
|
|
7
|
-
as?: T;
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
asChild?: boolean;
|
|
8
5
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'success' | 'text';
|
|
9
6
|
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
|
|
10
7
|
disabled?: boolean;
|
|
11
8
|
loading?: boolean;
|
|
12
9
|
color?: string;
|
|
13
10
|
weight?: FontWeightToken;
|
|
14
|
-
} & React.ComponentPropsWithoutRef<
|
|
11
|
+
} & React.ComponentPropsWithoutRef<'button'>;
|
|
15
12
|
export declare const Button: React.ForwardRefExoticComponent<{
|
|
16
|
-
|
|
13
|
+
asChild?: boolean;
|
|
17
14
|
variant?: "primary" | "secondary" | "tertiary" | "danger" | "success" | "text";
|
|
18
15
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "2xs";
|
|
19
16
|
disabled?: boolean;
|
|
@@ -23,4 +20,3 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
23
20
|
} & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>> & {
|
|
24
21
|
displayName: string;
|
|
25
22
|
};
|
|
26
|
-
export {};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
3
|
export type CheckboxStatus = 'on' | 'off' | 'intermediate';
|
|
3
4
|
export type CheckboxProps = {
|
|
4
|
-
id
|
|
5
|
+
id?: string;
|
|
5
6
|
size?: 'lg' | 'md' | 'sm';
|
|
6
7
|
status: CheckboxStatus;
|
|
7
8
|
onChange: (next: CheckboxStatus) => void;
|
|
8
9
|
label?: string;
|
|
9
10
|
disabled?: boolean;
|
|
10
|
-
} & Omit<React.ComponentPropsWithoutRef<'
|
|
11
|
+
} & Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'checked' | 'onCheckedChange'>;
|
|
11
12
|
export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
12
|
-
id
|
|
13
|
+
id?: string;
|
|
13
14
|
size?: "lg" | "md" | "sm";
|
|
14
15
|
status: CheckboxStatus;
|
|
15
16
|
onChange: (next: CheckboxStatus) => void;
|
|
16
17
|
label?: string;
|
|
17
18
|
disabled?: boolean;
|
|
18
|
-
} & Omit<Omit<
|
|
19
|
+
} & Omit<Omit<CheckboxPrimitive.CheckboxProps & import("react").RefAttributes<HTMLButtonElement>, "ref">, "checked" | "onCheckedChange"> & React.RefAttributes<never>> & {
|
|
19
20
|
displayName: string;
|
|
20
21
|
};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/token';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Default = (typeof tags)[0];
|
|
6
|
-
export type DisplayProps<T extends Element = Default> = {
|
|
7
|
-
as?: T;
|
|
3
|
+
export type DisplayProps = {
|
|
4
|
+
asChild?: boolean;
|
|
8
5
|
size?: 'lg' | 'md' | 'sm';
|
|
9
6
|
color?: string;
|
|
10
7
|
weight?: FontWeightToken;
|
|
11
|
-
} & React.ComponentPropsWithoutRef<
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'h1'>;
|
|
12
9
|
export declare const Display: React.ForwardRefExoticComponent<{
|
|
13
|
-
|
|
10
|
+
asChild?: boolean;
|
|
14
11
|
size?: "lg" | "md" | "sm";
|
|
15
12
|
color?: string;
|
|
16
13
|
weight?: FontWeightToken;
|
|
17
14
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>> & {
|
|
18
15
|
displayName: string;
|
|
19
16
|
};
|
|
20
|
-
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/token';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Default = (typeof tags)[1];
|
|
6
|
-
export type HeadingProps<T extends Element = Default> = {
|
|
7
|
-
as?: T;
|
|
3
|
+
export type HeadingProps = {
|
|
4
|
+
asChild?: boolean;
|
|
8
5
|
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
|
|
9
6
|
color?: string;
|
|
10
7
|
weight?: FontWeightToken;
|
|
11
|
-
} & React.ComponentPropsWithoutRef<
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'h2'>;
|
|
12
9
|
export declare const Heading: React.ForwardRefExoticComponent<{
|
|
13
|
-
|
|
10
|
+
asChild?: boolean;
|
|
14
11
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "2xs";
|
|
15
12
|
color?: string;
|
|
16
13
|
weight?: FontWeightToken;
|
|
17
14
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>> & {
|
|
18
15
|
displayName: string;
|
|
19
16
|
};
|
|
20
|
-
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/token';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Default = (typeof tags)[0];
|
|
6
|
-
export type LabelProps<T extends Element = Default> = {
|
|
7
|
-
as?: T;
|
|
3
|
+
export type LabelProps = {
|
|
4
|
+
asChild?: boolean;
|
|
8
5
|
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
9
6
|
color?: string;
|
|
10
7
|
weight?: FontWeightToken;
|
|
11
|
-
} & React.ComponentPropsWithoutRef<
|
|
12
|
-
export declare const Label: React.ForwardRefExoticComponent<
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'label'>;
|
|
9
|
+
export declare const Label: React.ForwardRefExoticComponent<{
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
size?: "lg" | "md" | "sm" | "xs";
|
|
12
|
+
color?: string;
|
|
13
|
+
weight?: FontWeightToken;
|
|
14
|
+
} & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>> & {
|
|
13
15
|
displayName: string;
|
|
14
16
|
};
|
|
15
|
-
export {};
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ee=Object.create;var v=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var se=(e,o)=>{for(var t in o)v(e,t,{get:o[t],enumerable:!0})},E=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of te(o))!ne.call(e,r)&&r!==t&&v(e,r,{get:()=>o[r],enumerable:!(n=oe(o,r))||n.enumerable});return e};var u=(e,o,t)=>(t=e!=null?ee(re(e)):{},E(o||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>E(v({},"__esModule",{value:!0}),e);var we={};se(we,{Accordion:()=>le,Body:()=>de,Button:()=>ue,Checkbox:()=>Pe,Display:()=>be,Heading:()=>Re,Label:()=>L,Spinner:()=>S});module.exports=ie(we);var h=u(require("@radix-ui/react-accordion"),1),N=require("react");var ae=(...e)=>e.filter(Boolean).join(" ").trim(),c=(e,o,t=[],...n)=>{let r=Object.entries(o).filter(([,s])=>s!==!1&&s!==null&&s!==void 0).map(([s,a])=>`${e}--${s}_${a}`).join(" "),i=t.filter(s=>Object.entries(s).every(([a,l])=>o[a]===l)).map(s=>{let a=Object.entries(s).map(([l,m])=>`${l}_${m}`).join("-");return`${e}--${a}`}).join(" ");return ae(e,r,i,...n)};var T=require("react/jsx-runtime");var ce=(0,N.forwardRef)(({className:e,...o},t)=>{let n=c("cocso-accordion-content",{},[],e);return(0,T.jsx)(h.Content,{ref:t,className:n,...o})}),me=(0,N.forwardRef)(({className:e,children:o,...t},n)=>{let r=c("cocso-accordion-trigger",{},[],e);return(0,T.jsx)(h.Trigger,{ref:n,className:r,...t})}),le=Object.assign(h.Root,{Item:h.Item,Header:h.Header,Trigger:me,Content:ce});var H=u(require("react"),1),O=require("@radix-ui/react-slot");function p(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var F={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function C(e){if(e)return e in F?F[e]:e}var A=require("react/jsx-runtime"),pe=H.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="normal",className:r,style:i,...s},a)=>{let m=c("cocso-body",{size:o},[],r);return(0,A.jsx)(e?O.Slot:"p",{ref:a,className:m,style:{"--cocso-body-color":p(t),"--cocso-body-weight":C(n),...i},...s})}),de=Object.assign(pe,{displayName:"Body"});var R=u(require("react"),1),z=require("@radix-ui/react-slot");var M=u(require("react"),1);var y=require("react/jsx-runtime"),fe=["div"],ge=M.forwardRef(({as:e=fe[0],size:o="md",color:t="palette.primary-500",bg:n="palette.gray-200",className:r,style:i,...s},a)=>{let l=e,f=c("cocso-spinner",{size:o},[],r);return(0,y.jsx)(l,{ref:a,className:f,style:{"--cocso-spinner-bg":p(n),"--cocso-spinner-color":p(t),...i},...s,children:(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,y.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,y.jsx)("path",{className:"opacity-75",fill:"var(--cocso-spinner-color, currentColor)",d:"M12 2a10 10 0 0110 10 10 10 0 01-5 8.66l-1-1.73a8 8 0 004-6.93 8 8 0 00-8-8V2z"})]})})}),S=Object.assign(ge,{displayName:"Spinner"});var W=require("react/jsx-runtime"),he=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Ce=R.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:n=!1,loading:r=!1,color:i,weight:s="normal",className:a,style:l,children:m,onClick:f,onKeyDown:k,...w},B)=>{let g=n||r,b=R.useCallback(x=>{if(g){x.preventDefault();return}f?.(x)},[g,f]),Q=R.useCallback(x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),g||x.currentTarget.click()),k?.(x)},[g,k]),U={variant:o,size:t,loading:r,disabled:g},X=[...n?[{variant:o,disabled:n}]:[],...r?[{variant:o,loading:r}]:[]],Y=c("cocso-button",U,X,a),Z={"--cocso-button-color":p(i),"--cocso-button-weight":C(s),...l};return(0,W.jsx)(e?z.Slot:"button",{ref:B,className:Y,onClick:b,onKeyDown:Q,role:"button",disabled:g,"aria-disabled":g,"aria-busy":r,style:Z,...w,children:r?(0,W.jsx)(S,{className:"cocso-button-spinner",size:he(t),color:"currentColor"}):m})}),ue=Object.assign(Ce,{displayName:"Button"});var D=u(require("react"),1),j=require("@radix-ui/react-slot");var $=require("react/jsx-runtime"),xe=D.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:r,style:i,...s},a)=>{let m=c("cocso-display",{size:o},[],r);return(0,$.jsx)(e?j.Slot:"h1",{ref:a,className:m,style:{"--cocso-display-color":p(t),"--cocso-display-weight":C(n),...i},...s})}),be=Object.assign(xe,{displayName:"Display"});var I=u(require("react"),1),_=require("@radix-ui/react-slot");var V=require("react/jsx-runtime"),ye=I.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:r,style:i,...s},a)=>{let m=c("cocso-heading",{size:o},[],r);return(0,V.jsx)(e?_.Slot:"h2",{ref:a,className:m,style:{"--cocso-heading-color":p(t),"--cocso-heading-weight":C(n),...i},...s})}),Re=Object.assign(ye,{displayName:"Heading"});var G=u(require("react"),1),K=require("@radix-ui/react-slot");var q=require("react/jsx-runtime"),ke=G.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="normal",className:r,style:i,...s},a)=>{let m=c("cocso-label",{size:o},[],r);return(0,q.jsx)(e?K.Slot:"label",{ref:a,className:m,style:{"--cocso-label-color":p(t),"--cocso-label-weight":C(n),...i},...s})}),L=Object.assign(ke,{displayName:"Label"});var J=u(require("react"),1),P=u(require("@radix-ui/react-checkbox"),1);var d=require("react/jsx-runtime"),ve=J.forwardRef(({id:e,size:o="md",status:t,onChange:n,label:r,disabled:i=!1,className:s,...a},l)=>{let m={size:o,disabled:i,status:t},f=[...i?[{status:t,disabled:i}]:[]],k=c("cocso-checkbox",m,f,s),w=g=>{if(!i){let b;g===!0?b="on":g==="indeterminate"?b="intermediate":b="off",n(b)}};return(0,d.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,d.jsxs)(P.Root,{ref:l,id:e,className:k,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:w,disabled:i,...a,children:[(0,d.jsx)(P.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,d.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M5 12h14"})})})]}),r&&(0,d.jsx)(L,{className:c("cocso-checkbox-label",m),size:o,htmlFor:e,children:r})]})}),Pe=Object.assign(ve,{displayName:"Checkbox"});
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as g from"@radix-ui/react-accordion";import{forwardRef as w}from"react";var _=(...e)=>e.filter(Boolean).join(" ").trim(),c=(e,t,o=[],...s)=>{let r=Object.entries(t).filter(([,n])=>n!==!1&&n!==null&&n!==void 0).map(([n,a])=>`${e}--${n}_${a}`).join(" "),i=o.filter(n=>Object.entries(n).every(([a,l])=>t[a]===l)).map(n=>{let a=Object.entries(n).map(([l,m])=>`${l}_${m}`).join("-");return`${e}--${a}`}).join(" ");return _(e,r,i,...s)};import{jsx as N}from"react/jsx-runtime";var V=w(({className:e,...t},o)=>{let s=c("cocso-accordion-content",{},[],e);return N(g.Content,{ref:o,className:s,...t})}),G=w(({className:e,children:t,...o},s)=>{let r=c("cocso-accordion-trigger",{},[],e);return N(g.Trigger,{ref:s,className:r,...o})}),xe=Object.assign(g.Root,{Item:g.Item,Header:g.Header,Trigger:G,Content:V});import*as S from"react";import{Slot as K}from"@radix-ui/react-slot";function p(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var T={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function h(e){if(e)return e in T?T[e]:e}import{jsx as J}from"react/jsx-runtime";var q=S.forwardRef(({asChild:e=!1,size:t="md",color:o,weight:s="normal",className:r,style:i,...n},a)=>{let m=c("cocso-body",{size:t},[],r);return J(e?K:"p",{ref:a,className:m,style:{"--cocso-body-color":p(o),"--cocso-body-weight":h(s),...i},...n})}),Te=Object.assign(q,{displayName:"Body"});import*as b from"react";import{Slot as Y}from"@radix-ui/react-slot";import*as W from"react";import{jsx as v,jsxs as X}from"react/jsx-runtime";var Q=["div"],U=W.forwardRef(({as:e=Q[0],size:t="md",color:o="palette.primary-500",bg:s="palette.gray-200",className:r,style:i,...n},a)=>{let l=e,d=c("cocso-spinner",{size:t},[],r);return v(l,{ref:a,className:d,style:{"--cocso-spinner-bg":p(s),"--cocso-spinner-color":p(o),...i},...n,children:X("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),v("path",{className:"opacity-75",fill:"var(--cocso-spinner-color, currentColor)",d:"M12 2a10 10 0 0110 10 10 10 0 01-5 8.66l-1-1.73a8 8 0 004-6.93 8 8 0 00-8-8V2z"})]})})}),L=Object.assign(U,{displayName:"Spinner"});import{jsx as B}from"react/jsx-runtime";var Z=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],ee=b.forwardRef(({asChild:e=!1,variant:t="primary",size:o="md",disabled:s=!1,loading:r=!1,color:i,weight:n="normal",className:a,style:l,children:m,onClick:d,onKeyDown:y,...k},P)=>{let f=s||r,x=b.useCallback(C=>{if(f){C.preventDefault();return}d?.(C)},[f,d]),z=b.useCallback(C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),f||C.currentTarget.click()),y?.(C)},[f,y]),D={variant:t,size:o,loading:r,disabled:f},j=[...s?[{variant:t,disabled:s}]:[],...r?[{variant:t,loading:r}]:[]],$=c("cocso-button",D,j,a),I={"--cocso-button-color":p(i),"--cocso-button-weight":h(n),...l};return B(e?Y:"button",{ref:P,className:$,onClick:x,onKeyDown:z,role:"button",disabled:f,"aria-disabled":f,"aria-busy":r,style:I,...k,children:r?B(L,{className:"cocso-button-spinner",size:Z(o),color:"currentColor"}):m})}),Ie=Object.assign(ee,{displayName:"Button"});import*as E from"react";import{Slot as oe}from"@radix-ui/react-slot";import{jsx as re}from"react/jsx-runtime";var te=E.forwardRef(({asChild:e=!1,size:t="md",color:o,weight:s="bold",className:r,style:i,...n},a)=>{let m=c("cocso-display",{size:t},[],r);return re(e?oe:"h1",{ref:a,className:m,style:{"--cocso-display-color":p(o),"--cocso-display-weight":h(s),...i},...n})}),Ue=Object.assign(te,{displayName:"Display"});import*as F from"react";import{Slot as ne}from"@radix-ui/react-slot";import{jsx as ie}from"react/jsx-runtime";var se=F.forwardRef(({asChild:e=!1,size:t="md",color:o,weight:s="bold",className:r,style:i,...n},a)=>{let m=c("cocso-heading",{size:t},[],r);return ie(e?ne:"h2",{ref:a,className:m,style:{"--cocso-heading-color":p(o),"--cocso-heading-weight":h(s),...i},...n})}),no=Object.assign(se,{displayName:"Heading"});import*as H from"react";import{Slot as ae}from"@radix-ui/react-slot";import{jsx as me}from"react/jsx-runtime";var ce=H.forwardRef(({asChild:e=!1,size:t="md",color:o,weight:s="normal",className:r,style:i,...n},a)=>{let m=c("cocso-label",{size:t},[],r);return me(e?ae:"label",{ref:a,className:m,style:{"--cocso-label-color":p(o),"--cocso-label-weight":h(s),...i},...n})}),O=Object.assign(ce,{displayName:"Label"});import*as M from"react";import*as R from"@radix-ui/react-checkbox";import{jsx as u,jsxs as A}from"react/jsx-runtime";var le=M.forwardRef(({id:e,size:t="md",status:o,onChange:s,label:r,disabled:i=!1,className:n,...a},l)=>{let m={size:t,disabled:i,status:o},d=[...i?[{status:o,disabled:i}]:[]],y=c("cocso-checkbox",m,d,n),k=f=>{if(!i){let x;f===!0?x="on":f==="indeterminate"?x="intermediate":x="off",s(x)}};return A("div",{className:"cocso-checkbox-wrapper",children:[A(R.Root,{ref:l,id:e,className:y,checked:(()=>{switch(o){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:k,disabled:i,...a,children:[u(R.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:o==="on"?1:0},children:u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M20 6 9 17l-5-5"})})}),u("div",{className:"cocso-checkbox-indicator",style:{opacity:o==="intermediate"?1:0},children:u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M5 12h14"})})})]}),r&&u(O,{className:c("cocso-checkbox-label",m),size:t,htmlFor:e,children:r})]})}),bo=Object.assign(le,{displayName:"Checkbox"});export{xe as Accordion,Te as Body,Ie as Button,bo as Checkbox,Ue as Display,no as Heading,O as Label,L as Spinner};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocso-ui/react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.17",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cocso/cocso-ui.git",
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"lib"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@radix-ui/react-accordion": "^1.2.11"
|
|
28
|
+
"@radix-ui/react-accordion": "^1.2.11",
|
|
29
|
+
"@radix-ui/react-checkbox": "^1.3.2",
|
|
30
|
+
"@radix-ui/react-slot": "^1.2.3"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"react": "^19.1.0",
|