@cocso-ui/react 0.0.1-beta.18 → 0.0.1-beta.19

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var ee=Object.create;var P=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)P(e,t,{get:o[t],enumerable:!0})},B=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of te(o))!ne.call(e,r)&&r!==t&&P(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)):{},B(o||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>B(P({},"__esModule",{value:!0}),e);var Ne={};se(Ne,{Accordion:()=>pe,Body:()=>de,Button:()=>ue,Checkbox:()=>ve,Display:()=>be,Heading:()=>Re,Label:()=>E,Spinner:()=>S});module.exports=ie(Ne);var h=u(require("@radix-ui/react-accordion"),1),w=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,p])=>o[a]===p)).map(s=>{let a=Object.entries(s).map(([p,m])=>`${p}_${m}`).join("-");return`${e}--${a}`}).join(" ");return ae(e,r,i,...n)};var T=require("react/jsx-runtime"),ce=(0,w.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,w.forwardRef)(({className:e,...o},t)=>{let n=c("cocso-accordion-trigger",{},[],e);return(0,T.jsx)(h.Trigger,{ref:t,className:n,...o})}),pe=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 l(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var L={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 L?L[e]:e}var M=require("react/jsx-runtime"),le=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,M.jsx)(e?O.Slot:"p",{ref:a,className:m,style:{"--cocso-body-color":l(t),"--cocso-body-weight":C(n),...i},...s})}),de=Object.assign(le,{displayName:"Body"});var R=u(require("react"),1),z=require("@radix-ui/react-slot");var A=u(require("react"),1);var y=require("react/jsx-runtime"),fe=["div"],ge=A.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 p=e,f=c("cocso-spinner",{size:o},[],r);return(0,y.jsx)(p,{ref:a,className:f,style:{"--cocso-spinner-bg":l(n),"--cocso-spinner-color":l(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:p,children:m,onClick:f,onKeyDown:k,...N},F)=>{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":l(i),"--cocso-button-weight":C(s),...p};return(0,W.jsx)(e?z.Slot:"button",{ref:F,className:Y,onClick:b,onKeyDown:Q,role:"button",disabled:g,"aria-disabled":g,"aria-busy":r,style:Z,...N,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":l(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":l(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":l(t),"--cocso-label-weight":C(n),...i},...s})}),E=Object.assign(ke,{displayName:"Label"});var J=u(require("react"),1),v=u(require("@radix-ui/react-checkbox"),1);var d=require("react/jsx-runtime"),Pe=J.forwardRef(({id:e,size:o="md",status:t,onChange:n,label:r,disabled:i=!1,className:s,...a},p)=>{let m={size:o,disabled:i,status:t},f=[...i?[{status:t,disabled:i}]:[]],k=c("cocso-checkbox",m,f,s),N=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)(v.Root,{ref:p,id:e,className:k,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:N,disabled:i,...a,children:[(0,d.jsx)(v.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)(E,{className:c("cocso-checkbox-label",m),size:o,htmlFor:e,children:r})]})}),ve=Object.assign(Pe,{displayName:"Checkbox"});
1
+ "use strict";var ee=Object.create;var k=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)k(e,t,{get:o[t],enumerable:!0})},B=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of te(o))!ne.call(e,r)&&r!==t&&k(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)):{},B(o||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e)),ie=e=>B(k({},"__esModule",{value:!0}),e);var Ne={};se(Ne,{Accordion:()=>pe,Body:()=>de,Button:()=>ue,Checkbox:()=>ve,Display:()=>be,Heading:()=>Re,Label:()=>E,Spinner:()=>S});module.exports=ie(Ne);var d=u(require("@radix-ui/react-accordion"),1),v=require("react");var ce=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...n)=>{let r=Object.entries(o).filter(([,s])=>s!==!1&&s!==null&&s!==void 0).map(([s,c])=>`${e}--${s}_${c}`).join(" "),i=t.filter(s=>Object.entries(s).every(([c,p])=>o[c]===p)).map(s=>{let c=Object.entries(s).map(([p,m])=>`${p}_${m}`).join("-");return`${e}--${c}`}).join(" ");return ce(e,r,i,...n)};var N=require("react/jsx-runtime"),Le=(0,v.forwardRef)(({className:e,...o},t)=>{let n=a("cocso-accordion-item",{},[],e);return(0,N.jsx)(d.Item,{ref:t,className:n,...o})}),ae=(0,v.forwardRef)(({className:e,...o},t)=>{let n=a("cocso-accordion-trigger",{},[],e);return(0,N.jsx)(d.Trigger,{ref:t,className:n,...o})}),me=(0,v.forwardRef)(({className:e,...o},t)=>{let n=a("cocso-accordion-content",{},[],e);return(0,N.jsx)(d.Content,{ref:t,className:n,...o})}),pe=Object.assign(d.Root,{Item:d.Item,Header:d.Header,Trigger:ae,Content:me});var A=u(require("react"),1),H=require("@radix-ui/react-slot");function l(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var L={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 L?L[e]:e}var O=require("react/jsx-runtime"),le=A.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="normal",className:r,style:i,...s},c)=>{let m=a("cocso-body",{size:o},[],r);return(0,O.jsx)(e?H.Slot:"p",{ref:c,className:m,style:{"--cocso-body-color":l(t),"--cocso-body-weight":C(n),...i},...s})}),de=Object.assign(le,{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},c)=>{let p=e,g=a("cocso-spinner",{size:o},[],r);return(0,y.jsx)(p,{ref:c,className:g,style:{"--cocso-spinner-bg":l(n),"--cocso-spinner-color":l(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:c,style:p,children:m,onClick:g,onKeyDown:P,...T},F)=>{let h=n||r,b=R.useCallback(x=>{if(h){x.preventDefault();return}g?.(x)},[h,g]),Q=R.useCallback(x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),h||x.currentTarget.click()),P?.(x)},[h,P]),U={variant:o,size:t,loading:r,disabled:h},X=[...n?[{variant:o,disabled:n}]:[],...r?[{variant:o,loading:r}]:[]],Y=a("cocso-button",U,X,c),Z={"--cocso-button-color":l(i),"--cocso-button-weight":C(s),...p};return(0,W.jsx)(e?z.Slot:"button",{ref:F,className:Y,onClick:b,onKeyDown:Q,role:"button",disabled:h,"aria-disabled":h,"aria-busy":r,style:Z,...T,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),I=require("@radix-ui/react-slot");var j=require("react/jsx-runtime"),xe=D.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:r,style:i,...s},c)=>{let m=a("cocso-display",{size:o},[],r);return(0,j.jsx)(e?I.Slot:"h1",{ref:c,className:m,style:{"--cocso-display-color":l(t),"--cocso-display-weight":C(n),...i},...s})}),be=Object.assign(xe,{displayName:"Display"});var $=u(require("react"),1),_=require("@radix-ui/react-slot");var V=require("react/jsx-runtime"),ye=$.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:r,style:i,...s},c)=>{let m=a("cocso-heading",{size:o},[],r);return(0,V.jsx)(e?_.Slot:"h2",{ref:c,className:m,style:{"--cocso-heading-color":l(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"),Pe=G.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="normal",className:r,style:i,...s},c)=>{let m=a("cocso-label",{size:o},[],r);return(0,q.jsx)(e?K.Slot:"label",{ref:c,className:m,style:{"--cocso-label-color":l(t),"--cocso-label-weight":C(n),...i},...s})}),E=Object.assign(Pe,{displayName:"Label"});var J=u(require("react"),1),w=u(require("@radix-ui/react-checkbox"),1);var f=require("react/jsx-runtime"),ke=J.forwardRef(({id:e,size:o="md",status:t,onChange:n,label:r,disabled:i=!1,className:s,...c},p)=>{let m={size:o,disabled:i,status:t},g=[...i?[{status:t,disabled:i}]:[]],P=a("cocso-checkbox",m,g,s),T=h=>{if(!i){let b;h===!0?b="on":h==="indeterminate"?b="intermediate":b="off",n(b)}};return(0,f.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,f.jsxs)(w.Root,{ref:p,id:e,className:P,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:T,disabled:i,...c,children:[(0,f.jsx)(w.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,f.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,f.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,f.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,f.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,f.jsx)("path",{d:"M5 12h14"})})})]}),r&&(0,f.jsx)(E,{className:a("cocso-checkbox-label",m),size:o,htmlFor:e,children:r})]})}),ve=Object.assign(ke,{displayName:"Checkbox"});
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import*as g from"@radix-ui/react-accordion";import{forwardRef as N}from"react";var _=(...e)=>e.filter(Boolean).join(" ").trim(),c=(e,o,t=[],...n)=>{let s=Object.entries(o).filter(([,r])=>r!==!1&&r!==null&&r!==void 0).map(([r,a])=>`${e}--${r}_${a}`).join(" "),i=t.filter(r=>Object.entries(r).every(([a,p])=>o[a]===p)).map(r=>{let a=Object.entries(r).map(([p,m])=>`${p}_${m}`).join("-");return`${e}--${a}`}).join(" ");return _(e,s,i,...n)};import{jsx as w}from"react/jsx-runtime";var V=N(({className:e,...o},t)=>{let n=c("cocso-accordion-content",{},[],e);return w(g.Content,{ref:t,className:n,...o})}),G=N(({className:e,...o},t)=>{let n=c("cocso-accordion-trigger",{},[],e);return w(g.Trigger,{ref:t,className:n,...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 l(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:o="md",color:t,weight:n="normal",className:s,style:i,...r},a)=>{let m=c("cocso-body",{size:o},[],s);return J(e?K:"p",{ref:a,className:m,style:{"--cocso-body-color":l(t),"--cocso-body-weight":h(n),...i},...r})}),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 P,jsxs as X}from"react/jsx-runtime";var Q=["div"],U=W.forwardRef(({as:e=Q[0],size:o="md",color:t="palette.primary-500",bg:n="palette.gray-200",className:s,style:i,...r},a)=>{let p=e,d=c("cocso-spinner",{size:o},[],s);return P(p,{ref:a,className:d,style:{"--cocso-spinner-bg":l(n),"--cocso-spinner-color":l(t),...i},...r,children:X("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[P("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),P("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"})]})})}),E=Object.assign(U,{displayName:"Spinner"});import{jsx as F}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:o="primary",size:t="md",disabled:n=!1,loading:s=!1,color:i,weight:r="normal",className:a,style:p,children:m,onClick:d,onKeyDown:y,...k},v)=>{let f=n||s,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:o,size:t,loading:s,disabled:f},j=[...n?[{variant:o,disabled:n}]:[],...s?[{variant:o,loading:s}]:[]],$=c("cocso-button",D,j,a),I={"--cocso-button-color":l(i),"--cocso-button-weight":h(r),...p};return F(e?Y:"button",{ref:v,className:$,onClick:x,onKeyDown:z,role:"button",disabled:f,"aria-disabled":f,"aria-busy":s,style:I,...k,children:s?F(E,{className:"cocso-button-spinner",size:Z(t),color:"currentColor"}):m})}),Ie=Object.assign(ee,{displayName:"Button"});import*as B from"react";import{Slot as oe}from"@radix-ui/react-slot";import{jsx as re}from"react/jsx-runtime";var te=B.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:s,style:i,...r},a)=>{let m=c("cocso-display",{size:o},[],s);return re(e?oe:"h1",{ref:a,className:m,style:{"--cocso-display-color":l(t),"--cocso-display-weight":h(n),...i},...r})}),Ue=Object.assign(te,{displayName:"Display"});import*as L from"react";import{Slot as ne}from"@radix-ui/react-slot";import{jsx as ie}from"react/jsx-runtime";var se=L.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:n="bold",className:s,style:i,...r},a)=>{let m=c("cocso-heading",{size:o},[],s);return ie(e?ne:"h2",{ref:a,className:m,style:{"--cocso-heading-color":l(t),"--cocso-heading-weight":h(n),...i},...r})}),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:o="md",color:t,weight:n="normal",className:s,style:i,...r},a)=>{let m=c("cocso-label",{size:o},[],s);return me(e?ae:"label",{ref:a,className:m,style:{"--cocso-label-color":l(t),"--cocso-label-weight":h(n),...i},...r})}),O=Object.assign(ce,{displayName:"Label"});import*as A from"react";import*as R from"@radix-ui/react-checkbox";import{jsx as u,jsxs as M}from"react/jsx-runtime";var pe=A.forwardRef(({id:e,size:o="md",status:t,onChange:n,label:s,disabled:i=!1,className:r,...a},p)=>{let m={size:o,disabled:i,status:t},d=[...i?[{status:t,disabled:i}]:[]],y=c("cocso-checkbox",m,d,r),k=f=>{if(!i){let x;f===!0?x="on":f==="indeterminate"?x="intermediate":x="off",n(x)}};return M("div",{className:"cocso-checkbox-wrapper",children:[M(R.Root,{ref:p,id:e,className:y,checked:(()=>{switch(t){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:t==="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:t==="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"})})})]}),s&&u(O,{className:c("cocso-checkbox-label",m),size:o,htmlFor:e,children:s})]})}),bo=Object.assign(pe,{displayName:"Checkbox"});export{xe as Accordion,Te as Body,Ie as Button,bo as Checkbox,Ue as Display,no as Heading,O as Label,E as Spinner};
1
+ import*as d from"@radix-ui/react-accordion";import{forwardRef as k}from"react";var _=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...r)=>{let s=Object.entries(o).filter(([,n])=>n!==!1&&n!==null&&n!==void 0).map(([n,c])=>`${e}--${n}_${c}`).join(" "),i=t.filter(n=>Object.entries(n).every(([c,p])=>o[c]===p)).map(n=>{let c=Object.entries(n).map(([p,m])=>`${p}_${m}`).join("-");return`${e}--${c}`}).join(" ");return _(e,s,i,...r)};import{jsx as v}from"react/jsx-runtime";var xe=k(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return v(d.Item,{ref:t,className:r,...o})}),V=k(({className:e,...o},t)=>{let r=a("cocso-accordion-trigger",{},[],e);return v(d.Trigger,{ref:t,className:r,...o})}),G=k(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return v(d.Content,{ref:t,className:r,...o})}),be=Object.assign(d.Root,{Item:d.Item,Header:d.Header,Trigger:V,Content:G});import*as S from"react";import{Slot as K}from"@radix-ui/react-slot";function l(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:o="md",color:t,weight:r="normal",className:s,style:i,...n},c)=>{let m=a("cocso-body",{size:o},[],s);return J(e?K:"p",{ref:c,className:m,style:{"--cocso-body-color":l(t),"--cocso-body-weight":h(r),...i},...n})}),Se=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 N,jsxs as X}from"react/jsx-runtime";var Q=["div"],U=W.forwardRef(({as:e=Q[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:s,style:i,...n},c)=>{let p=e,f=a("cocso-spinner",{size:o},[],s);return N(p,{ref:c,className:f,style:{"--cocso-spinner-bg":l(r),"--cocso-spinner-color":l(t),...i},...n,children:X("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[N("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),N("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"})]})})}),E=Object.assign(U,{displayName:"Spinner"});import{jsx as F}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:o="primary",size:t="md",disabled:r=!1,loading:s=!1,color:i,weight:n="normal",className:c,style:p,children:m,onClick:f,onKeyDown:y,...P},w)=>{let g=r||s,x=b.useCallback(C=>{if(g){C.preventDefault();return}f?.(C)},[g,f]),z=b.useCallback(C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),g||C.currentTarget.click()),y?.(C)},[g,y]),D={variant:o,size:t,loading:s,disabled:g},I=[...r?[{variant:o,disabled:r}]:[],...s?[{variant:o,loading:s}]:[]],j=a("cocso-button",D,I,c),$={"--cocso-button-color":l(i),"--cocso-button-weight":h(n),...p};return F(e?Y:"button",{ref:w,className:j,onClick:x,onKeyDown:z,role:"button",disabled:g,"aria-disabled":g,"aria-busy":s,style:$,...P,children:s?F(E,{className:"cocso-button-spinner",size:Z(t),color:"currentColor"}):m})}),_e=Object.assign(ee,{displayName:"Button"});import*as B from"react";import{Slot as oe}from"@radix-ui/react-slot";import{jsx as re}from"react/jsx-runtime";var te=B.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...n},c)=>{let m=a("cocso-display",{size:o},[],s);return re(e?oe:"h1",{ref:c,className:m,style:{"--cocso-display-color":l(t),"--cocso-display-weight":h(r),...i},...n})}),Xe=Object.assign(te,{displayName:"Display"});import*as L from"react";import{Slot as ne}from"@radix-ui/react-slot";import{jsx as ie}from"react/jsx-runtime";var se=L.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...n},c)=>{let m=a("cocso-heading",{size:o},[],s);return ie(e?ne:"h2",{ref:c,className:m,style:{"--cocso-heading-color":l(t),"--cocso-heading-weight":h(r),...i},...n})}),so=Object.assign(se,{displayName:"Heading"});import*as A from"react";import{Slot as ce}from"@radix-ui/react-slot";import{jsx as me}from"react/jsx-runtime";var ae=A.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:s,style:i,...n},c)=>{let m=a("cocso-label",{size:o},[],s);return me(e?ce:"label",{ref:c,className:m,style:{"--cocso-label-color":l(t),"--cocso-label-weight":h(r),...i},...n})}),H=Object.assign(ae,{displayName:"Label"});import*as M from"react";import*as R from"@radix-ui/react-checkbox";import{jsx as u,jsxs as O}from"react/jsx-runtime";var pe=M.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:s,disabled:i=!1,className:n,...c},p)=>{let m={size:o,disabled:i,status:t},f=[...i?[{status:t,disabled:i}]:[]],y=a("cocso-checkbox",m,f,n),P=g=>{if(!i){let x;g===!0?x="on":g==="indeterminate"?x="intermediate":x="off",r(x)}};return O("div",{className:"cocso-checkbox-wrapper",children:[O(R.Root,{ref:p,id:e,className:y,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:P,disabled:i,...c,children:[u(R.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="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:t==="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"})})})]}),s&&u(H,{className:a("cocso-checkbox-label",m),size:o,htmlFor:e,children:s})]})}),yo=Object.assign(pe,{displayName:"Checkbox"});export{be as Accordion,Se as Body,_e as Button,yo as Checkbox,Xe as Display,so as Heading,H as Label,E as Spinner};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocso-ui/react",
3
- "version": "0.0.1-beta.18",
3
+ "version": "0.0.1-beta.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cocso/cocso-ui.git",