@cocso-ui/react 0.0.1-beta.14 → 0.0.1-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & import("react").RefAttributes<HTMLDivElement>> & {
|
|
3
|
+
Item: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
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>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Accordion';
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var G=Object.create;var v=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(e,t)=>{for(var o in t)v(e,o,{get:t[o],enumerable:!0})},W=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Q(t))!X.call(e,n)&&n!==o&&v(e,n,{get:()=>t[n],enumerable:!(a=J(t,n))||a.enumerable});return e};var u=(e,t,o)=>(o=e!=null?G(U(e)):{},W(t||!e||!e.__esModule?v(o,"default",{value:e,enumerable:!0}):o,e)),Z=e=>W(v({},"__esModule",{value:!0}),e);var Te={};Y(Te,{Accordion:()=>ee,Body:()=>se,Button:()=>pe,Checkbox:()=>Ce,Display:()=>de,Heading:()=>ye,Label:()=>w,Spinner:()=>E});module.exports=Z(Te);var g=u(require("@radix-ui/react-accordion"),1),ee=Object.assign(g.Root,{Item:g.Item,Header:g.Header,Trigger:g.Trigger,Content:g.Content});var S=u(require("react"),1);function m(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var D={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 D?D[e]:e}var te=(...e)=>e.filter(Boolean).join(" ").trim(),l=(e,t,o=[],...a)=>{let n=Object.entries(t).filter(([,s])=>s!==!1&&s!==null&&s!==void 0).map(([s,c])=>`${e}--${s}_${c}`).join(" "),r=o.filter(s=>Object.entries(s).every(([c,i])=>t[c]===i)).map(s=>{let c=Object.entries(s).map(([i,d])=>`${i}_${d}`).join("-");return`${e}--${c}`}).join(" ");return te(e,n,r,...a)};var F=require("react/jsx-runtime"),oe=["p","a","span","div","label","li","td","th","figcaption","blockquote","cite"],ne=S.forwardRef(({as:e=oe[0],size:t="md",color:o,weight:a="normal",className:n,style:r,...s},c)=>{let i=e,p=l("cocso-body",{size:t},[],n);return(0,F.jsx)(i,{ref:c,className:p,style:{"--cocso-body-color":m(o),"--cocso-body-weight":h(a),...r},...s})}),se=Object.assign(ne,{displayName:"Body"});var R=u(require("react"),1);var B=u(require("react"),1);var C=require("react/jsx-runtime"),re=["div"],ae=B.forwardRef(({as:e=re[0],size:t="md",color:o="palette.primary-500",bg:a="palette.gray-200",className:n,style:r,...s},c)=>{let i=e,p=l("cocso-spinner",{size:t},[],n);return(0,C.jsx)(i,{ref:c,className:p,style:{"--cocso-spinner-bg":m(a),"--cocso-spinner-color":m(o),...r},...s,children:(0,C.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,C.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,C.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"})]})})}),E=Object.assign(ae,{displayName:"Spinner"});var P=require("react/jsx-runtime"),ce=["button"],ie=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],le=R.forwardRef(({as:e=ce[0],variant:t="primary",size:o="md",disabled:a=!1,loading:n=!1,color:r,weight:s="normal",className:c,style:i,children:d,onClick:p,onKeyDown:k,...T},N)=>{let b=e,x=a||n,$=R.useCallback(y=>{if(x){y.preventDefault();return}p?.(y)},[x,p]),K=R.useCallback(y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x||y.currentTarget.click()),k?.(y)},[x,k]),_={variant:t,size:o,loading:n,disabled:x},I=[...a?[{variant:t,disabled:a}]:[],...n?[{variant:t,loading:n}]:[]],V=l("cocso-button",_,I,c),q={"--cocso-button-color":m(r),"--cocso-button-weight":h(s),...i};return(0,P.jsx)(b,{ref:N,className:V,onClick:$,onKeyDown:K,role:"button",disabled:x,"aria-disabled":x,"aria-busy":n,style:q,...T,children:n?(0,P.jsx)(E,{className:"cocso-button-spinner",size:ie(o),color:"currentColor"}):d})}),pe=Object.assign(le,{displayName:"Button"});var O=u(require("react"),1);var L=require("react/jsx-runtime"),me=["h1","h2","h3","h4","h5","h6"],fe=O.forwardRef(({as:e=me[0],size:t="md",color:o,weight:a="bold",className:n,style:r,...s},c)=>{let i=e,p=l("cocso-display",{size:t},[],n);return(0,L.jsx)(i,{ref:c,className:p,style:{"--cocso-display-color":m(o),"--cocso-display-weight":h(a),...r},...s})}),de=Object.assign(fe,{displayName:"Display"});var z=u(require("react"),1);var H=require("react/jsx-runtime"),ge=["h1","h2","h3","h4","h5","h6"],he=z.forwardRef(({as:e=ge[1],size:t="md",color:o,weight:a="bold",className:n,style:r,...s},c)=>{let i=e,p=l("cocso-heading",{size:t},[],n);return(0,H.jsx)(i,{ref:c,className:p,style:{"--cocso-heading-color":m(o),"--cocso-heading-weight":h(a),...r},...s})}),ye=Object.assign(he,{displayName:"Heading"});var M=u(require("react"),1);var j=require("react/jsx-runtime"),ue=["label","p","a","span","div","li","td","th","figcaption","blockquote","cite"],xe=M.forwardRef(({as:e=ue[0],size:t="md",color:o,weight:a="normal",className:n,style:r,...s},c)=>{let i=e,p=l("cocso-label",{size:t},[],n);return(0,j.jsx)(i,{ref:c,className:p,style:{"--cocso-label-color":m(o),"--cocso-label-weight":h(a),...r},...s})}),w=Object.assign(xe,{displayName:"Label"});var A=u(require("react"),1);var f=require("react/jsx-runtime"),be=A.forwardRef(({id:e,size:t="md",status:o,onChange:a,label:n,disabled:r=!1,className:s,...c},i)=>{let d={size:t,disabled:r,status:o},p=[...r?[{status:o,disabled:r}]:[]],k=l("cocso-checkbox-inner",d,p,s),T=()=>{r||a(o==="on"?"off":"on")};return(0,f.jsxs)("div",{ref:i,className:"cocso-checkbox",tabIndex:r?-1:0,role:"checkbox","aria-checked":o==="on"?"true":o==="intermediate"?"mixed":"false","aria-disabled":r,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),T())},...c,children:[(0,f.jsxs)("div",{className:k,onClick:T,children:[(0,f.jsx)("div",{className:"cocso-checkbox-icon",style:{opacity:o==="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-icon",style:{opacity:o==="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"})})}),(0,f.jsx)("input",{type:"checkbox",id:e,checked:o==="on",onChange:T,disabled:r})]}),n&&(0,f.jsx)(w,{className:l("cocso-checkbox-label",d),htmlFor:e,size:t,children:n})]})}),Ce=Object.assign(be,{displayName:"Checkbox"});
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as E from"react";function m(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var
|
|
1
|
+
import*as d from"@radix-ui/react-accordion";var ie=Object.assign(d.Root,{Item:d.Item,Header:d.Header,Trigger:d.Trigger,Content:d.Content});import*as E from"react";function m(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var v={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function g(e){if(e)return e in v?v[e]:e}var $=(...e)=>e.filter(Boolean).join(" ").trim(),l=(e,r,t=[],...c)=>{let n=Object.entries(r).filter(([,o])=>o!==!1&&o!==null&&o!==void 0).map(([o,a])=>`${e}--${o}_${a}`).join(" "),s=t.filter(o=>Object.entries(o).every(([a,i])=>r[a]===i)).map(o=>{let a=Object.entries(o).map(([i,f])=>`${i}_${f}`).join("-");return`${e}--${a}`}).join(" ");return $(e,n,s,...c)};import{jsx as I}from"react/jsx-runtime";var K=["p","a","span","div","label","li","td","th","figcaption","blockquote","cite"],_=E.forwardRef(({as:e=K[0],size:r="md",color:t,weight:c="normal",className:n,style:s,...o},a)=>{let i=e,p=l("cocso-body",{size:r},[],n);return I(i,{ref:a,className:p,style:{"--cocso-body-color":m(t),"--cocso-body-weight":g(c),...s},...o})}),ye=Object.assign(_,{displayName:"Body"});import*as C from"react";import*as P from"react";import{jsx as R,jsxs as G}from"react/jsx-runtime";var V=["div"],q=P.forwardRef(({as:e=V[0],size:r="md",color:t="palette.primary-500",bg:c="palette.gray-200",className:n,style:s,...o},a)=>{let i=e,p=l("cocso-spinner",{size:r},[],n);return R(i,{ref:a,className:p,style:{"--cocso-spinner-bg":m(c),"--cocso-spinner-color":m(t),...s},...o,children:G("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[R("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),R("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"})]})})}),w=Object.assign(q,{displayName:"Spinner"});import{jsx as N}from"react/jsx-runtime";var J=["button"],Q=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],U=C.forwardRef(({as:e=J[0],variant:r="primary",size:t="md",disabled:c=!1,loading:n=!1,color:s,weight:o="normal",className:a,style:i,children:f,onClick:p,onKeyDown:T,...b},k)=>{let x=e,u=c||n,L=C.useCallback(h=>{if(u){h.preventDefault();return}p?.(h)},[u,p]),z=C.useCallback(h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u||h.currentTarget.click()),T?.(h)},[u,T]),H={variant:r,size:t,loading:n,disabled:u},M=[...c?[{variant:r,disabled:c}]:[],...n?[{variant:r,loading:n}]:[]],j=l("cocso-button",H,M,a),A={"--cocso-button-color":m(s),"--cocso-button-weight":g(o),...i};return N(x,{ref:k,className:j,onClick:L,onKeyDown:z,role:"button",disabled:u,"aria-disabled":u,"aria-busy":n,style:A,...b,children:n?N(w,{className:"cocso-button-spinner",size:Q(t),color:"currentColor"}):f})}),De=Object.assign(U,{displayName:"Button"});import*as W from"react";import{jsx as Z}from"react/jsx-runtime";var X=["h1","h2","h3","h4","h5","h6"],Y=W.forwardRef(({as:e=X[0],size:r="md",color:t,weight:c="bold",className:n,style:s,...o},a)=>{let i=e,p=l("cocso-display",{size:r},[],n);return Z(i,{ref:a,className:p,style:{"--cocso-display-color":m(t),"--cocso-display-weight":g(c),...s},...o})}),He=Object.assign(Y,{displayName:"Display"});import*as D from"react";import{jsx as oe}from"react/jsx-runtime";var ee=["h1","h2","h3","h4","h5","h6"],te=D.forwardRef(({as:e=ee[1],size:r="md",color:t,weight:c="bold",className:n,style:s,...o},a)=>{let i=e,p=l("cocso-heading",{size:r},[],n);return oe(i,{ref:a,className:p,style:{"--cocso-heading-color":m(t),"--cocso-heading-weight":g(c),...s},...o})}),Ie=Object.assign(te,{displayName:"Heading"});import*as S from"react";import{jsx as re}from"react/jsx-runtime";var ne=["label","p","a","span","div","li","td","th","figcaption","blockquote","cite"],se=S.forwardRef(({as:e=ne[0],size:r="md",color:t,weight:c="normal",className:n,style:s,...o},a)=>{let i=e,p=l("cocso-label",{size:r},[],n);return re(i,{ref:a,className:p,style:{"--cocso-label-color":m(t),"--cocso-label-weight":g(c),...s},...o})}),F=Object.assign(se,{displayName:"Label"});import*as O from"react";import{jsx as y,jsxs as B}from"react/jsx-runtime";var ae=O.forwardRef(({id:e,size:r="md",status:t,onChange:c,label:n,disabled:s=!1,className:o,...a},i)=>{let f={size:r,disabled:s,status:t},p=[...s?[{status:t,disabled:s}]:[]],T=l("cocso-checkbox-inner",f,p,o),b=()=>{s||c(t==="on"?"off":"on")};return B("div",{ref:i,className:"cocso-checkbox",tabIndex:s?-1:0,role:"checkbox","aria-checked":t==="on"?"true":t==="intermediate"?"mixed":"false","aria-disabled":s,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),b())},...a,children:[B("div",{className:T,onClick:b,children:[y("div",{className:"cocso-checkbox-icon",style:{opacity:t==="on"?1:0},children:y("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:y("path",{d:"M20 6 9 17l-5-5"})})}),y("div",{className:"cocso-checkbox-icon",style:{opacity:t==="intermediate"?1:0},children:y("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:y("path",{d:"M5 12h14"})})}),y("input",{type:"checkbox",id:e,checked:t==="on",onChange:b,disabled:s})]}),n&&y(F,{className:l("cocso-checkbox-label",f),htmlFor:e,size:r,children:n})]})}),nt=Object.assign(ae,{displayName:"Checkbox"});export{ie as Accordion,ye as Body,De as Button,nt as Checkbox,He as Display,Ie as Heading,F as Label,w 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.15",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cocso/cocso-ui.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"lib"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@radix-ui/react-
|
|
28
|
+
"@radix-ui/react-accordion": "^1.2.11"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^19.1.0",
|