@cocso-ui/react 0.0.1-beta.40 → 0.0.1-beta.41

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.
@@ -2,14 +2,16 @@ import * as React from 'react';
2
2
  export type PaginationProps = {
3
3
  asChild?: boolean;
4
4
  page: number;
5
- count: number;
5
+ totalPages: number;
6
+ maxVisible?: number;
6
7
  onChange: (pageNumber: number) => void;
7
- } & React.ComponentPropsWithoutRef<'div'>;
8
+ } & Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'>;
8
9
  export declare const Pagination: React.ForwardRefExoticComponent<{
9
10
  asChild?: boolean;
10
11
  page: number;
11
- count: number;
12
+ totalPages: number;
13
+ maxVisible?: number;
12
14
  onChange: (pageNumber: number) => void;
13
- } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>> & {
15
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onChange"> & React.RefAttributes<HTMLDivElement>> & {
14
16
  displayName: string;
15
17
  };
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Oo=Object.create;var I=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var Ao=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty;var Io=(o,e)=>{for(var t in e)I(o,t,{get:e[t],enumerable:!0})},so=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Bo(e))!Ho.call(o,n)&&n!==t&&I(o,n,{get:()=>e[n],enumerable:!(r=Eo(e,n))||r.enumerable});return o};var h=(o,e,t)=>(t=o!=null?Oo(Ao(o)):{},so(e||!o||!o.__esModule?I(t,"default",{value:o,enumerable:!0}):t,o)),zo=o=>so(I({},"__esModule",{value:!0}),o);var be={};Io(be,{Accordion:()=>Go,Body:()=>B,Button:()=>Jo,Checkbox:()=>ue,Display:()=>Yo,FileUpload:()=>te,Heading:()=>Y,Label:()=>L,Link:()=>ie,Modal:()=>me,OneTimePasswordField:()=>de,Pagination:()=>he,Spinner:()=>J,Switch:()=>ve,Toaster:()=>Pe,toast:()=>G.toast});module.exports=zo(be);var T=h(require("@radix-ui/react-accordion"),1),z=require("react");var jo=(...o)=>o.filter(Boolean).join(" ").trim(),m=(o,e,t=[],...r)=>{let n=Object.entries(e).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,a])=>`${o}--${c}_${a}`).join(" "),s=t.filter(c=>Object.entries(c).every(([a,d])=>e[a]===d)).map(c=>{let a=Object.entries(c).map(([d,l])=>`${d}_${l}`).join("-");return`${o}--${a}`}).join(" ");return jo(o,n,s,...r)};var ao=require("@radix-ui/react-slot"),W=require("react/jsx-runtime"),$o=(0,z.forwardRef)(({className:o,...e},t)=>{let r=m("cocso-accordion-item",{},[],o);return(0,W.jsx)(T.Item,{ref:t,className:r,...e})}),_o=(0,z.forwardRef)(({className:o,children:e,chevron:t=!0,...r},n)=>{let s=m("cocso-accordion-trigger",{},[],o);return(0,W.jsx)(T.Trigger,{ref:n,className:s,...r,children:(0,W.jsxs)(ao.Slottable,{children:[e,t&&(0,W.jsx)("div",{className:"cocso-accordion-chevron",children:(0,W.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,W.jsx)("path",{d:"m6 9 6 6 6-6"})})})]})})}),Uo=(0,z.forwardRef)(({className:o,...e},t)=>{let r=m("cocso-accordion-content",{},[],o);return(0,W.jsx)(T.Content,{ref:t,className:r,...e})}),Go=Object.assign(T.Root,{Item:$o,Header:T.Header,Trigger:_o,Content:Uo});var mo=h(require("react"),1),lo=require("@radix-ui/react-slot");function y(o){if(o)return o.includes(".")?`var(--color-${o.replace(/\./g,"-")})`:o}var co={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function R(o){if(o)return o in co?co[o]:o}var po=require("react/jsx-runtime"),Vo=mo.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="normal",className:n,style:s,...c},a)=>{let l=m("cocso-body",{size:e},[],n);return(0,po.jsx)(o?lo.Slot:"p",{ref:a,className:l,style:{"--cocso-body-color":y(t),"--cocso-body-weight":R(r),...s},...c})}),B=Object.assign(Vo,{displayName:"Body"});var A=h(require("react"),1),ho=require("@radix-ui/react-slot");var fo=h(require("react"),1);var O=require("react/jsx-runtime"),Ko=["div"],Zo=fo.forwardRef(({as:o=Ko[0],size:e="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:s,...c},a)=>{let d=o,p=m("cocso-spinner",{size:e},[],n);return(0,O.jsx)(d,{ref:a,className:p,style:{"--cocso-spinner-bg":y(r),"--cocso-spinner-color":y(t),...s},...c,children:(0,O.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,O.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,O.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"})]})})}),J=Object.assign(Zo,{displayName:"Spinner"});var Q=require("react/jsx-runtime"),Xo=o=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[o],qo=A.forwardRef(({asChild:o=!1,variant:e="primary",size:t="md",disabled:r=!1,loading:n=!1,color:s,weight:c="normal",className:a,style:d,children:l,onClick:p,onKeyDown:v,...D},E)=>{let b=r||n,x=A.useCallback(N=>{if(b){N.preventDefault();return}p?.(N)},[b,p]),V=A.useCallback(N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),b||N.currentTarget.click()),v?.(N)},[b,v]),K={variant:e,size:t,loading:n,disabled:b},Z=[...r?[{variant:e,disabled:r}]:[],...n?[{variant:e,loading:n}]:[]],X=m("cocso-button",K,Z,a),q={"--cocso-button-color":y(s),"--cocso-button-weight":R(c),...d};return(0,Q.jsx)(o?ho.Slot:"button",{ref:E,className:X,onClick:x,onKeyDown:V,role:"button",disabled:b,"aria-disabled":b,"aria-busy":n,style:q,...D,children:n?(0,Q.jsx)(J,{className:"cocso-button-spinner",size:Xo(t),color:"currentColor"}):l})}),Jo=Object.assign(qo,{displayName:"Button"});var go=h(require("react"),1),uo=require("@radix-ui/react-slot");var Co=require("react/jsx-runtime"),Qo=go.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="bold",className:n,style:s,...c},a)=>{let l=m("cocso-display",{size:e},[],n);return(0,Co.jsx)(o?uo.Slot:"h1",{ref:a,className:l,style:{"--cocso-display-color":y(t),"--cocso-display-weight":R(r),...s},...c})}),Yo=Object.assign(Qo,{displayName:"Display"});var yo=h(require("react"),1),g=require("react");var vo=h(require("react"),1),Po=require("@radix-ui/react-slot");var bo=require("react/jsx-runtime"),oe=vo.forwardRef(({asChild:o=!1,size:e="md",color:t="text.basic",weight:r="normal",className:n,style:s,...c},a)=>{let l=m("cocso-label",{size:e},[],n);return(0,bo.jsx)(o?Po.Slot:"label",{ref:a,className:l,style:{"--cocso-label-color":y(t),"--cocso-label-weight":R(r),...s},...c})}),L=Object.assign(oe,{displayName:"Label"});var f=require("react/jsx-runtime"),ee=yo.forwardRef(({maxFiles:o=2,files:e,onFilesChange:t,onRemove:r,multiple:n=!0,accept:s,...c},a)=>{let[d,l]=(0,g.useState)(!1),p=(0,g.useRef)(null),v=(0,g.useRef)(null),D=3*1024*1024,E=(0,g.useCallback)(i=>s?s.split(",").map(w=>w.trim()).some(w=>{if(w.endsWith("/*")){let H=w.slice(0,-2);return i.type.startsWith(H)}return i.type===w||i.name.toLowerCase().endsWith(w)}):!0,[s]),b=(0,g.useCallback)(i=>i.size>D?(alert(`${i.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),x=(0,g.useCallback)(i=>{let w=Array.from(i).filter(M=>E(M)?b(M):(alert(`${M.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(w.length===0)return;let H=o-e.length;if(H<=0){alert(`\uCD5C\uB300 ${o}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let Do=w.slice(0,H).map(M=>({file:M,name:M.name,size:M.size}));t([...e,...Do])},[e,o,t,E,b]),V=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!0)},[]),K=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),v.current&&!v.current.contains(i.relatedTarget)&&l(!1)},[]),Z=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation()},[]),X=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!1);let{files:S}=i.dataTransfer;S&&x(S)},[x]),q=(0,g.useCallback)(i=>{let{files:S}=i.target;S&&x(S)},[x]),no=(0,g.useCallback)(i=>{let S=e.filter(w=>w.name!==i);t(S),r?.(i)},[e,t,r]),N=(0,g.useCallback)(()=>{p.current?.click()},[]),io=e.length>=o||!n&&e.length>=1;return(0,f.jsxs)("div",{className:"cocso-file-upload-wrapper",children:[!io&&(0,f.jsxs)("div",{ref:v,onDragEnter:V,onDragOver:Z,onDragLeave:K,onDrop:X,onClick:N,className:"cocso-file-upload","data-drag-active":d,children:[(0,f.jsx)("input",{ref:i=>{p.current=i,typeof a=="function"?a(i):a&&(a.current=i)},type:"file",onChange:q,multiple:n,accept:s,style:{display:"none"},...c}),(0,f.jsxs)(L,{size:"xs",color:"palette.gray-600",children:["\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB04C\uC5B4\uB2E4 \uB193\uAC70\uB098, \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694",(0,f.jsx)("br",{}),"(\uCD5C\uB300 3MB)"]}),(0,f.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,f.jsx)("path",{d:"M5 12h14"}),(0,f.jsx)("path",{d:"M12 5v14"})]})]}),e.length>0&&(0,f.jsx)("div",{className:"cocso-file-upload-list",children:e.map(i=>(0,f.jsxs)("div",{className:"cocso-file-upload-item",children:[(0,f.jsx)(B,{size:"xs",children:i.name}),(0,f.jsx)("button",{type:"button",onClick:()=>no(i.name),className:"cocso-file-upload-remove",children:(0,f.jsxs)("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:"M18 6 6 18"}),(0,f.jsx)("path",{d:"m6 6 12 12"})]})})]},i.name))})]})}),te=Object.assign(ee,{displayName:"FileUpload"});var Ro=h(require("react"),1),xo=require("@radix-ui/react-slot");var wo=require("react/jsx-runtime"),re=Ro.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="bold",className:n,style:s,...c},a)=>{let l=m("cocso-heading",{size:e},[],n);return(0,wo.jsx)(o?xo.Slot:"h2",{ref:a,className:l,style:{"--cocso-heading-color":y(t),"--cocso-heading-weight":R(r),...s},...c})}),Y=Object.assign(re,{displayName:"Heading"});var ko=h(require("react"),1),No=require("@radix-ui/react-slot");var To=require("react/jsx-runtime"),ne=ko.forwardRef(({asChild:o=!1,size:e="md",weight:t="normal",indicator:r=!0,className:n,style:s,...c},a)=>{let l=m("cocso-link",{size:e,indicator:r},[],n);return(0,To.jsx)(o?No.Slot:"a",{ref:a,className:l,style:{"--cocso-link-weight":R(t),...s},...c})}),ie=Object.assign(ne,{displayName:"Link"});var u=h(require("@radix-ui/react-dialog"),1),j=require("react");var P=require("react/jsx-runtime"),se=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=m("cocso-modal-content",{},[],o);return(0,P.jsxs)(u.Portal,{children:[(0,P.jsx)(u.Overlay,{className:"cocso-modal-overlay"}),(0,P.jsxs)(u.Content,{ref:r,className:n,...t,children:[(0,P.jsx)("div",{className:"cocso-modal-close-wrapper",children:(0,P.jsx)(u.Close,{className:"cocso-modal-close",children:(0,P.jsxs)("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,P.jsx)("path",{d:"M18 6 6 18"}),(0,P.jsx)("path",{d:"m6 6 12 12"})]})})}),e]})]})}),ae=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=m("cocso-modal-title",{},[],o);return(0,P.jsx)(u.Title,{ref:r,className:n,asChild:!0,...t,children:(0,P.jsx)(Y,{color:"text.basic",children:e})})}),ce=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=m("cocso-modal-description",{},[],o);return(0,P.jsx)(u.Description,{ref:r,className:n,asChild:!0,...t,children:(0,P.jsx)(B,{size:"sm",color:"text.subtle",children:e})})}),me=Object.assign(u.Root,{Trigger:u.Trigger,Content:se,Title:ae,Description:ce});var $=h(require("@radix-ui/react-one-time-password-field"),1),oo=require("react");var eo=require("react/jsx-runtime"),le=(0,oo.forwardRef)(({className:o,...e},t)=>{let r=m("cocso-otp",{},[],o);return(0,eo.jsx)($.Root,{ref:t,className:r,...e})}),pe=(0,oo.forwardRef)(({className:o,...e},t)=>{let r=m("cocso-otp-input",{},[],o);return(0,eo.jsx)($.Input,{ref:t,className:r,...e})}),de=Object.assign(le,{Input:pe});var So=h(require("react"),1),Wo=require("@radix-ui/react-slot"),C=require("react/jsx-runtime"),ro=5,to=Math.ceil(ro/2),fe=So.forwardRef(({asChild:o=!1,page:e,count:t,onChange:r,className:n,...s},c)=>{let a=l=>(0,C.jsx)("button",{className:"cocso-pagination-item",onClick:()=>r(l),"data-active":e===l,children:l},l);return(0,C.jsxs)(o?Wo.Slot:"div",{ref:c,className:`cocso-pagination ${n||""}`,...s,children:[t>1&&(0,C.jsx)("button",{className:"cocso-pagination-arrow",disabled:e===1,onClick:()=>e>1&&r(e-1),children:(0,C.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,C.jsx)("path",{d:"m15 18-6-6 6-6"})})}),t<=ro+2?Array(t).fill(0).map((l,p)=>a(p+1)):(0,C.jsxs)(C.Fragment,{children:[a(1),e>1+to&&(0,C.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),Array(ro).fill(0).map((l,p)=>{let v=e-to+p+1;return v>1&&v<t?a(v):""}),e<t-to&&(0,C.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),a(t)]}),t>1&&(0,C.jsx)("button",{className:"cocso-pagination-arrow",disabled:e===t,onClick:()=>e<t&&r(e+1),children:(0,C.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,C.jsx)("path",{d:"m9 18 6-6-6-6"})})})]})}),he=Object.assign(fe,{displayName:"Pagination"});var Lo=h(require("react"),1),_=h(require("@radix-ui/react-checkbox"),1);var k=require("react/jsx-runtime"),ge=Lo.forwardRef(({id:o,size:e="md",status:t,onChange:r,label:n,disabled:s=!1,className:c,...a},d)=>{let l={size:e,disabled:s,status:t},p=[...s?[{status:t,disabled:s}]:[]],v=m("cocso-checkbox",l,p,c),D=b=>{if(!s){let x;b===!0?x="on":b==="indeterminate"?x="intermediate":x="off",r(x)}};return(0,k.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,k.jsxs)(_.Root,{ref:d,id:o,className:v,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:D,disabled:s,...a,children:[(0,k.jsx)(_.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,k.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,k.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,k.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,k.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,k.jsx)("path",{d:"M5 12h14"})})})]}),n&&(0,k.jsx)(L,{className:m("cocso-checkbox-label",{disabled:s}),size:e,htmlFor:o,children:n})]})}),ue=Object.assign(ge,{displayName:"Checkbox"});var Mo=h(require("react"),1),Fo=require("@radix-ui/react-slot"),U=h(require("@radix-ui/react-switch"),1);var F=require("react/jsx-runtime"),Ce=Mo.forwardRef(({asChild:o=!1,id:e,size:t="md",disabled:r=!1,label:n,position:s="right",className:c,children:a,...d},l)=>{let p=m("cocso-switch",{size:t,disabled:r},[],c),v=m("cocso-switch-thumb",{size:t});return(0,F.jsxs)(o?Fo.Slot:"div",{className:"cocso-switch-wrapper",children:[s==="left"&&(0,F.jsx)(L,{size:t,htmlFor:e,children:n}),(0,F.jsx)(U.Root,{ref:l,className:p,...d,children:(0,F.jsx)(U.Thumb,{className:v})}),s==="right"&&(0,F.jsx)(L,{size:t,htmlFor:e,children:n})]})}),ve=Object.assign(Ce,{displayName:"Switch"});var G=require("sonner"),Pe=Object.assign(G.Toaster,{displayName:"Toast"});
1
+ "use strict";var Fo=Object.create;var I=Object.defineProperty;var Do=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var Eo=Object.getPrototypeOf,Bo=Object.prototype.hasOwnProperty;var Ao=(o,e)=>{for(var t in e)I(o,t,{get:e[t],enumerable:!0})},no=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oo(e))!Bo.call(o,n)&&n!==t&&I(o,n,{get:()=>e[n],enumerable:!(r=Do(e,n))||r.enumerable});return o};var g=(o,e,t)=>(t=o!=null?Fo(Eo(o)):{},no(e||!o||!o.__esModule?I(t,"default",{value:o,enumerable:!0}):t,o)),Ho=o=>no(I({},"__esModule",{value:!0}),o);var ve={};Ao(ve,{Accordion:()=>_o,Body:()=>B,Button:()=>qo,Checkbox:()=>he,Display:()=>Qo,FileUpload:()=>oe,Heading:()=>Y,Label:()=>F,Link:()=>re,Modal:()=>ae,OneTimePasswordField:()=>le,Pagination:()=>de,Spinner:()=>Q,Switch:()=>ue,Toaster:()=>Ce,toast:()=>V.toast});module.exports=Ho(ve);var S=g(require("@radix-ui/react-accordion"),1),z=require("react");var Io=(...o)=>o.filter(Boolean).join(" ").trim(),c=(o,e,t=[],...r)=>{let n=Object.entries(e).filter(([,a])=>a!==!1&&a!==null&&a!==void 0).map(([a,m])=>`${o}--${a}_${m}`).join(" "),s=t.filter(a=>Object.entries(a).every(([m,p])=>e[m]===p)).map(a=>{let m=Object.entries(a).map(([p,l])=>`${p}_${l}`).join("-");return`${o}--${m}`}).join(" ");return Io(o,n,s,...r)};var io=require("@radix-ui/react-slot"),M=require("react/jsx-runtime"),zo=(0,z.forwardRef)(({className:o,...e},t)=>{let r=c("cocso-accordion-item",{},[],o);return(0,M.jsx)(S.Item,{ref:t,className:r,...e})}),jo=(0,z.forwardRef)(({className:o,children:e,chevron:t=!0,...r},n)=>{let s=c("cocso-accordion-trigger",{},[],o);return(0,M.jsx)(S.Trigger,{ref:n,className:s,...r,children:(0,M.jsxs)(io.Slottable,{children:[e,t&&(0,M.jsx)("div",{className:"cocso-accordion-chevron",children:(0,M.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,M.jsx)("path",{d:"m6 9 6 6 6-6"})})})]})})}),$o=(0,z.forwardRef)(({className:o,...e},t)=>{let r=c("cocso-accordion-content",{},[],o);return(0,M.jsx)(S.Content,{ref:t,className:r,...e})}),_o=Object.assign(S.Root,{Item:zo,Header:S.Header,Trigger:jo,Content:$o});var ao=g(require("react"),1),co=require("@radix-ui/react-slot");function y(o){if(o)return o.includes(".")?`var(--color-${o.replace(/\./g,"-")})`:o}var so={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function R(o){if(o)return o in so?so[o]:o}var mo=require("react/jsx-runtime"),Uo=ao.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="normal",className:n,style:s,...a},m)=>{let l=c("cocso-body",{size:e},[],n);return(0,mo.jsx)(o?co.Slot:"p",{ref:m,className:l,style:{"--cocso-body-color":y(t),"--cocso-body-weight":R(r),...s},...a})}),B=Object.assign(Uo,{displayName:"Body"});var A=g(require("react"),1),po=require("@radix-ui/react-slot");var lo=g(require("react"),1);var E=require("react/jsx-runtime"),Vo=["div"],Go=lo.forwardRef(({as:o=Vo[0],size:e="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:s,...a},m)=>{let p=o,d=c("cocso-spinner",{size:e},[],n);return(0,E.jsx)(p,{ref:m,className:d,style:{"--cocso-spinner-bg":y(r),"--cocso-spinner-color":y(t),...s},...a,children:(0,E.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,E.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"})]})})}),Q=Object.assign(Go,{displayName:"Spinner"});var X=require("react/jsx-runtime"),Ko=o=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[o],Zo=A.forwardRef(({asChild:o=!1,variant:e="primary",size:t="md",disabled:r=!1,loading:n=!1,color:s,weight:a="normal",className:m,style:p,children:l,onClick:d,onKeyDown:f,...N},W)=>{let P=r||n,x=A.useCallback(T=>{if(P){T.preventDefault();return}d?.(T)},[P,d]),G=A.useCallback(T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),P||T.currentTarget.click()),f?.(T)},[P,f]),K={variant:e,size:t,loading:n,disabled:P},Z=[...r?[{variant:e,disabled:r}]:[],...n?[{variant:e,loading:n}]:[]],q=c("cocso-button",K,Z,m),J={"--cocso-button-color":y(s),"--cocso-button-weight":R(a),...p};return(0,X.jsx)(o?po.Slot:"button",{ref:W,className:q,onClick:x,onKeyDown:G,role:"button",disabled:P,"aria-disabled":P,"aria-busy":n,style:J,...N,children:n?(0,X.jsx)(Q,{className:"cocso-button-spinner",size:Ko(t),color:"currentColor"}):l})}),qo=Object.assign(Zo,{displayName:"Button"});var fo=g(require("react"),1),ho=require("@radix-ui/react-slot");var go=require("react/jsx-runtime"),Jo=fo.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="bold",className:n,style:s,...a},m)=>{let l=c("cocso-display",{size:e},[],n);return(0,go.jsx)(o?ho.Slot:"h1",{ref:m,className:l,style:{"--cocso-display-color":y(t),"--cocso-display-weight":R(r),...s},...a})}),Qo=Object.assign(Jo,{displayName:"Display"});var bo=g(require("react"),1),u=require("react");var uo=g(require("react"),1),Co=require("@radix-ui/react-slot");var vo=require("react/jsx-runtime"),Xo=uo.forwardRef(({asChild:o=!1,size:e="md",color:t="text.basic",weight:r="normal",className:n,style:s,...a},m)=>{let l=c("cocso-label",{size:e},[],n);return(0,vo.jsx)(o?Co.Slot:"label",{ref:m,className:l,style:{"--cocso-label-color":y(t),"--cocso-label-weight":R(r),...s},...a})}),F=Object.assign(Xo,{displayName:"Label"});var h=require("react/jsx-runtime"),Yo=bo.forwardRef(({maxFiles:o=2,files:e,onFilesChange:t,onRemove:r,multiple:n=!0,accept:s,...a},m)=>{let[p,l]=(0,u.useState)(!1),d=(0,u.useRef)(null),f=(0,u.useRef)(null),N=3*1024*1024,W=(0,u.useCallback)(i=>s?s.split(",").map(w=>w.trim()).some(w=>{if(w.endsWith("/*")){let H=w.slice(0,-2);return i.type.startsWith(H)}return i.type===w||i.name.toLowerCase().endsWith(w)}):!0,[s]),P=(0,u.useCallback)(i=>i.size>N?(alert(`${i.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),x=(0,u.useCallback)(i=>{let w=Array.from(i).filter(D=>W(D)?P(D):(alert(`${D.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(w.length===0)return;let H=o-e.length;if(H<=0){alert(`\uCD5C\uB300 ${o}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let Mo=w.slice(0,H).map(D=>({file:D,name:D.name,size:D.size}));t([...e,...Mo])},[e,o,t,W,P]),G=(0,u.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!0)},[]),K=(0,u.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),f.current&&!f.current.contains(i.relatedTarget)&&l(!1)},[]),Z=(0,u.useCallback)(i=>{i.preventDefault(),i.stopPropagation()},[]),q=(0,u.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!1);let{files:L}=i.dataTransfer;L&&x(L)},[x]),J=(0,u.useCallback)(i=>{let{files:L}=i.target;L&&x(L)},[x]),to=(0,u.useCallback)(i=>{let L=e.filter(w=>w.name!==i);t(L),r?.(i)},[e,t,r]),T=(0,u.useCallback)(()=>{d.current?.click()},[]),ro=e.length>=o||!n&&e.length>=1;return(0,h.jsxs)("div",{className:"cocso-file-upload-wrapper",children:[!ro&&(0,h.jsxs)("div",{ref:f,onDragEnter:G,onDragOver:Z,onDragLeave:K,onDrop:q,onClick:T,className:"cocso-file-upload","data-drag-active":p,children:[(0,h.jsx)("input",{ref:i=>{d.current=i,typeof m=="function"?m(i):m&&(m.current=i)},type:"file",onChange:J,multiple:n,accept:s,style:{display:"none"},...a}),(0,h.jsxs)(F,{size:"xs",color:"palette.gray-600",children:["\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB04C\uC5B4\uB2E4 \uB193\uAC70\uB098, \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694",(0,h.jsx)("br",{}),"(\uCD5C\uB300 3MB)"]}),(0,h.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,h.jsx)("path",{d:"M5 12h14"}),(0,h.jsx)("path",{d:"M12 5v14"})]})]}),e.length>0&&(0,h.jsx)("div",{className:"cocso-file-upload-list",children:e.map(i=>(0,h.jsxs)("div",{className:"cocso-file-upload-item",children:[(0,h.jsx)(B,{size:"xs",children:i.name}),(0,h.jsx)("button",{type:"button",onClick:()=>to(i.name),className:"cocso-file-upload-remove",children:(0,h.jsxs)("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,h.jsx)("path",{d:"M18 6 6 18"}),(0,h.jsx)("path",{d:"m6 6 12 12"})]})})]},i.name))})]})}),oe=Object.assign(Yo,{displayName:"FileUpload"});var Po=g(require("react"),1),yo=require("@radix-ui/react-slot");var Ro=require("react/jsx-runtime"),ee=Po.forwardRef(({asChild:o=!1,size:e="md",color:t,weight:r="bold",className:n,style:s,...a},m)=>{let l=c("cocso-heading",{size:e},[],n);return(0,Ro.jsx)(o?yo.Slot:"h2",{ref:m,className:l,style:{"--cocso-heading-color":y(t),"--cocso-heading-weight":R(r),...s},...a})}),Y=Object.assign(ee,{displayName:"Heading"});var xo=g(require("react"),1),wo=require("@radix-ui/react-slot");var ko=require("react/jsx-runtime"),te=xo.forwardRef(({asChild:o=!1,size:e="md",weight:t="normal",indicator:r=!0,className:n,style:s,...a},m)=>{let l=c("cocso-link",{size:e,indicator:r},[],n);return(0,ko.jsx)(o?wo.Slot:"a",{ref:m,className:l,style:{"--cocso-link-weight":R(t),...s},...a})}),re=Object.assign(te,{displayName:"Link"});var C=g(require("@radix-ui/react-dialog"),1),j=require("react");var b=require("react/jsx-runtime"),ne=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=c("cocso-modal-content",{},[],o);return(0,b.jsxs)(C.Portal,{children:[(0,b.jsx)(C.Overlay,{className:"cocso-modal-overlay"}),(0,b.jsxs)(C.Content,{ref:r,className:n,...t,children:[(0,b.jsx)("div",{className:"cocso-modal-close-wrapper",children:(0,b.jsx)(C.Close,{className:"cocso-modal-close",children:(0,b.jsxs)("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,b.jsx)("path",{d:"M18 6 6 18"}),(0,b.jsx)("path",{d:"m6 6 12 12"})]})})}),e]})]})}),ie=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=c("cocso-modal-title",{},[],o);return(0,b.jsx)(C.Title,{ref:r,className:n,asChild:!0,...t,children:(0,b.jsx)(Y,{color:"text.basic",children:e})})}),se=(0,j.forwardRef)(({className:o,children:e,...t},r)=>{let n=c("cocso-modal-description",{},[],o);return(0,b.jsx)(C.Description,{ref:r,className:n,asChild:!0,...t,children:(0,b.jsx)(B,{size:"sm",color:"text.subtle",children:e})})}),ae=Object.assign(C.Root,{Trigger:C.Trigger,Content:ne,Title:ie,Description:se});var $=g(require("@radix-ui/react-one-time-password-field"),1),oo=require("react");var eo=require("react/jsx-runtime"),ce=(0,oo.forwardRef)(({className:o,...e},t)=>{let r=c("cocso-otp",{},[],o);return(0,eo.jsx)($.Root,{ref:t,className:r,...e})}),me=(0,oo.forwardRef)(({className:o,...e},t)=>{let r=c("cocso-otp-input",{},[],o);return(0,eo.jsx)($.Input,{ref:t,className:r,...e})}),le=Object.assign(ce,{Input:me});var No=g(require("react"),1),To=require("@radix-ui/react-slot"),v=require("react/jsx-runtime"),pe=No.forwardRef(({asChild:o=!1,page:e,totalPages:t,maxVisible:r=5,onChange:n,className:s,...a},m)=>{let p=Math.ceil(r/2),l=f=>(0,v.jsx)("button",{className:"cocso-pagination-item",onClick:()=>n(f),"data-active":e===f,children:f},f);return(0,v.jsxs)(o?To.Slot:"div",{ref:m,className:`cocso-pagination ${s||""}`,...a,children:[t>1&&(0,v.jsx)("button",{className:"cocso-pagination-arrow",disabled:e===1,onClick:()=>e>1&&n(e-1),children:(0,v.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,v.jsx)("path",{d:"m15 18-6-6 6-6"})})}),t<=r+2?Array(t).fill(0).map((f,N)=>l(N+1)):(0,v.jsxs)(v.Fragment,{children:[l(1),e>1+p&&(0,v.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),Array(r).fill(0).map((f,N)=>{let W=e-p+N+1;return W>1&&W<t?l(W):""}),e<t-p&&(0,v.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),l(t)]}),t>1&&(0,v.jsx)("button",{className:"cocso-pagination-arrow",disabled:e===t,onClick:()=>e<t&&n(e+1),children:(0,v.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,v.jsx)("path",{d:"m9 18 6-6-6-6"})})})]})}),de=Object.assign(pe,{displayName:"Pagination"});var So=g(require("react"),1),_=g(require("@radix-ui/react-checkbox"),1);var k=require("react/jsx-runtime"),fe=So.forwardRef(({id:o,size:e="md",status:t,onChange:r,label:n,disabled:s=!1,className:a,...m},p)=>{let l={size:e,disabled:s,status:t},d=[...s?[{status:t,disabled:s}]:[]],f=c("cocso-checkbox",l,d,a),N=P=>{if(!s){let x;P===!0?x="on":P==="indeterminate"?x="intermediate":x="off",r(x)}};return(0,k.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,k.jsxs)(_.Root,{ref:p,id:o,className:f,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:N,disabled:s,...m,children:[(0,k.jsx)(_.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,k.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,k.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,k.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,k.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,k.jsx)("path",{d:"M5 12h14"})})})]}),n&&(0,k.jsx)(F,{className:c("cocso-checkbox-label",{disabled:s}),size:e,htmlFor:o,children:n})]})}),he=Object.assign(fe,{displayName:"Checkbox"});var Wo=g(require("react"),1),Lo=require("@radix-ui/react-slot"),U=g(require("@radix-ui/react-switch"),1);var O=require("react/jsx-runtime"),ge=Wo.forwardRef(({asChild:o=!1,id:e,size:t="md",disabled:r=!1,label:n,position:s="right",className:a,children:m,...p},l)=>{let d=c("cocso-switch",{size:t,disabled:r},[],a),f=c("cocso-switch-thumb",{size:t});return(0,O.jsxs)(o?Lo.Slot:"div",{className:"cocso-switch-wrapper",children:[s==="left"&&(0,O.jsx)(F,{size:t,htmlFor:e,children:n}),(0,O.jsx)(U.Root,{ref:l,className:d,...p,children:(0,O.jsx)(U.Thumb,{className:f})}),s==="right"&&(0,O.jsx)(F,{size:t,htmlFor:e,children:n})]})}),ue=Object.assign(ge,{displayName:"Switch"});var V=require("sonner"),Ce=Object.assign(V.Toaster,{displayName:"Toast"});
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import*as y from"@radix-ui/react-accordion";import{forwardRef as V}from"react";var yo=(...e)=>e.filter(Boolean).join(" ").trim(),m=(e,o,t=[],...r)=>{let n=Object.entries(o).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,a])=>`${e}--${c}_${a}`).join(" "),s=t.filter(c=>Object.entries(c).every(([a,d])=>o[a]===d)).map(c=>{let a=Object.entries(c).map(([d,l])=>`${d}_${l}`).join("-");return`${e}--${a}`}).join(" ");return yo(e,n,s,...r)};import{Slottable as Ro}from"@radix-ui/react-slot";import{jsx as M,jsxs as No}from"react/jsx-runtime";var xo=V(({className:e,...o},t)=>{let r=m("cocso-accordion-item",{},[],e);return M(y.Item,{ref:t,className:r,...o})}),wo=V(({className:e,children:o,chevron:t=!0,...r},n)=>{let s=m("cocso-accordion-trigger",{},[],e);return M(y.Trigger,{ref:n,className:s,...r,children:No(Ro,{children:[o,t&&M("div",{className:"cocso-accordion-chevron",children:M("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:M("path",{d:"m6 9 6 6 6-6"})})})]})})}),ko=V(({className:e,...o},t)=>{let r=m("cocso-accordion-content",{},[],e);return M(y.Content,{ref:t,className:r,...o})}),ge=Object.assign(y.Root,{Item:xo,Header:y.Header,Trigger:wo,Content:ko});import*as eo from"react";import{Slot as To}from"@radix-ui/react-slot";function u(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var oo={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 oo?oo[e]:e}import{jsx as Wo}from"react/jsx-runtime";var So=eo.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:s,...c},a)=>{let l=m("cocso-body",{size:o},[],n);return Wo(e?To:"p",{ref:a,className:l,style:{"--cocso-body-color":u(t),"--cocso-body-weight":C(r),...s},...c})}),B=Object.assign(So,{displayName:"Body"});import*as O from"react";import{Slot as Do}from"@radix-ui/react-slot";import*as to from"react";import{jsx as K,jsxs as Fo}from"react/jsx-runtime";var Lo=["div"],Mo=to.forwardRef(({as:e=Lo[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:s,...c},a)=>{let d=e,p=m("cocso-spinner",{size:o},[],n);return K(d,{ref:a,className:p,style:{"--cocso-spinner-bg":u(r),"--cocso-spinner-color":u(t),...s},...c,children:Fo("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[K("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),K("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"})]})})}),ro=Object.assign(Mo,{displayName:"Spinner"});import{jsx as no}from"react/jsx-runtime";var Oo=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Eo=O.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:n=!1,color:s,weight:c="normal",className:a,style:d,children:l,onClick:p,onKeyDown:h,...L},D)=>{let g=r||n,v=O.useCallback(b=>{if(g){b.preventDefault();return}p?.(b)},[g,p]),j=O.useCallback(b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g||b.currentTarget.click()),h?.(b)},[g,h]),$={variant:o,size:t,loading:n,disabled:g},_=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],U=m("cocso-button",$,_,a),G={"--cocso-button-color":u(s),"--cocso-button-weight":C(c),...d};return no(e?Do:"button",{ref:D,className:U,onClick:v,onKeyDown:j,role:"button",disabled:g,"aria-disabled":g,"aria-busy":n,style:G,...L,children:n?no(ro,{className:"cocso-button-spinner",size:Oo(t),color:"currentColor"}):l})}),He=Object.assign(Eo,{displayName:"Button"});import*as io from"react";import{Slot as Bo}from"@radix-ui/react-slot";import{jsx as Ho}from"react/jsx-runtime";var Ao=io.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...c},a)=>{let l=m("cocso-display",{size:o},[],n);return Ho(e?Bo:"h1",{ref:a,className:l,style:{"--cocso-display-color":u(t),"--cocso-display-weight":C(r),...s},...c})}),Ve=Object.assign(Ao,{displayName:"Display"});import*as co from"react";import{useRef as ao,useState as $o,useCallback as R}from"react";import*as so from"react";import{Slot as Io}from"@radix-ui/react-slot";import{jsx as jo}from"react/jsx-runtime";var zo=so.forwardRef(({asChild:e=!1,size:o="md",color:t="text.basic",weight:r="normal",className:n,style:s,...c},a)=>{let l=m("cocso-label",{size:o},[],n);return jo(e?Io:"label",{ref:a,className:l,style:{"--cocso-label-color":u(t),"--cocso-label-weight":C(r),...s},...c})}),S=Object.assign(zo,{displayName:"Label"});import{jsx as w,jsxs as F}from"react/jsx-runtime";var _o=co.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:n=!0,accept:s,...c},a)=>{let[d,l]=$o(!1),p=ao(null),h=ao(null),L=3*1024*1024,D=R(i=>s?s.split(",").map(P=>P.trim()).some(P=>{if(P.endsWith("/*")){let E=P.slice(0,-2);return i.type.startsWith(E)}return i.type===P||i.name.toLowerCase().endsWith(P)}):!0,[s]),g=R(i=>i.size>L?(alert(`${i.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),v=R(i=>{let P=Array.from(i).filter(T=>D(T)?g(T):(alert(`${T.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(P.length===0)return;let E=e-o.length;if(E<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let bo=P.slice(0,E).map(T=>({file:T,name:T.name,size:T.size}));t([...o,...bo])},[o,e,t,D,g]),j=R(i=>{i.preventDefault(),i.stopPropagation(),l(!0)},[]),$=R(i=>{i.preventDefault(),i.stopPropagation(),h.current&&!h.current.contains(i.relatedTarget)&&l(!1)},[]),_=R(i=>{i.preventDefault(),i.stopPropagation()},[]),U=R(i=>{i.preventDefault(),i.stopPropagation(),l(!1);let{files:x}=i.dataTransfer;x&&v(x)},[v]),G=R(i=>{let{files:x}=i.target;x&&v(x)},[v]),Q=R(i=>{let x=o.filter(P=>P.name!==i);t(x),r?.(i)},[o,t,r]),b=R(()=>{p.current?.click()},[]),Y=o.length>=e||!n&&o.length>=1;return F("div",{className:"cocso-file-upload-wrapper",children:[!Y&&F("div",{ref:h,onDragEnter:j,onDragOver:_,onDragLeave:$,onDrop:U,onClick:b,className:"cocso-file-upload","data-drag-active":d,children:[w("input",{ref:i=>{p.current=i,typeof a=="function"?a(i):a&&(a.current=i)},type:"file",onChange:G,multiple:n,accept:s,style:{display:"none"},...c}),F(S,{size:"xs",color:"palette.gray-600",children:["\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB04C\uC5B4\uB2E4 \uB193\uAC70\uB098, \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694",w("br",{}),"(\uCD5C\uB300 3MB)"]}),F("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w("path",{d:"M5 12h14"}),w("path",{d:"M12 5v14"})]})]}),o.length>0&&w("div",{className:"cocso-file-upload-list",children:o.map(i=>F("div",{className:"cocso-file-upload-item",children:[w(B,{size:"xs",children:i.name}),w("button",{type:"button",onClick:()=>Q(i.name),className:"cocso-file-upload-remove",children:F("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:[w("path",{d:"M18 6 6 18"}),w("path",{d:"m6 6 12 12"})]})})]},i.name))})]})}),at=Object.assign(_o,{displayName:"FileUpload"});import*as mo from"react";import{Slot as Uo}from"@radix-ui/react-slot";import{jsx as Vo}from"react/jsx-runtime";var Go=mo.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...c},a)=>{let l=m("cocso-heading",{size:o},[],n);return Vo(e?Uo:"h2",{ref:a,className:l,style:{"--cocso-heading-color":u(t),"--cocso-heading-weight":C(r),...s},...c})}),lo=Object.assign(Go,{displayName:"Heading"});import*as po from"react";import{Slot as Ko}from"@radix-ui/react-slot";import{jsx as Xo}from"react/jsx-runtime";var Zo=po.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:n,style:s,...c},a)=>{let l=m("cocso-link",{size:o,indicator:r},[],n);return Xo(e?Ko:"a",{ref:a,className:l,style:{"--cocso-link-weight":C(t),...s},...c})}),Rt=Object.assign(Zo,{displayName:"Link"});import*as f from"@radix-ui/react-dialog";import{forwardRef as X}from"react";import{jsx as k,jsxs as Z}from"react/jsx-runtime";var qo=X(({className:e,children:o,...t},r)=>{let n=m("cocso-modal-content",{},[],e);return Z(f.Portal,{children:[k(f.Overlay,{className:"cocso-modal-overlay"}),Z(f.Content,{ref:r,className:n,...t,children:[k("div",{className:"cocso-modal-close-wrapper",children:k(f.Close,{className:"cocso-modal-close",children:Z("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:[k("path",{d:"M18 6 6 18"}),k("path",{d:"m6 6 12 12"})]})})}),o]})]})}),Jo=X(({className:e,children:o,...t},r)=>{let n=m("cocso-modal-title",{},[],e);return k(f.Title,{ref:r,className:n,asChild:!0,...t,children:k(lo,{color:"text.basic",children:o})})}),Qo=X(({className:e,children:o,...t},r)=>{let n=m("cocso-modal-description",{},[],e);return k(f.Description,{ref:r,className:n,asChild:!0,...t,children:k(B,{size:"sm",color:"text.subtle",children:o})})}),Dt=Object.assign(f.Root,{Trigger:f.Trigger,Content:qo,Title:Jo,Description:Qo});import*as A from"@radix-ui/react-one-time-password-field";import{forwardRef as fo}from"react";import{jsx as ho}from"react/jsx-runtime";var Yo=fo(({className:e,...o},t)=>{let r=m("cocso-otp",{},[],e);return ho(A.Root,{ref:t,className:r,...o})}),oe=fo(({className:e,...o},t)=>{let r=m("cocso-otp-input",{},[],e);return ho(A.Input,{ref:t,className:r,...o})}),$t=Object.assign(Yo,{Input:oe});import*as uo from"react";import{Slot as ee}from"@radix-ui/react-slot";import{Fragment as re,jsx as N,jsxs as go}from"react/jsx-runtime";var J=5,q=Math.ceil(J/2),te=uo.forwardRef(({asChild:e=!1,page:o,count:t,onChange:r,className:n,...s},c)=>{let a=l=>N("button",{className:"cocso-pagination-item",onClick:()=>r(l),"data-active":o===l,children:l},l);return go(e?ee:"div",{ref:c,className:`cocso-pagination ${n||""}`,...s,children:[t>1&&N("button",{className:"cocso-pagination-arrow",disabled:o===1,onClick:()=>o>1&&r(o-1),children:N("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:N("path",{d:"m15 18-6-6 6-6"})})}),t<=J+2?Array(t).fill(0).map((l,p)=>a(p+1)):go(re,{children:[a(1),o>1+q&&N("span",{className:"cocso-pagination-trunc",children:"..."}),Array(J).fill(0).map((l,p)=>{let h=o-q+p+1;return h>1&&h<t?a(h):""}),o<t-q&&N("span",{className:"cocso-pagination-trunc",children:"..."}),a(t)]}),t>1&&N("button",{className:"cocso-pagination-arrow",disabled:o===t,onClick:()=>o<t&&r(o+1),children:N("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:N("path",{d:"m9 18 6-6-6-6"})})})]})}),Zt=Object.assign(te,{displayName:"Pagination"});import*as vo from"react";import*as H from"@radix-ui/react-checkbox";import{jsx as W,jsxs as Co}from"react/jsx-runtime";var ne=vo.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:n,disabled:s=!1,className:c,...a},d)=>{let l={size:o,disabled:s,status:t},p=[...s?[{status:t,disabled:s}]:[]],h=m("cocso-checkbox",l,p,c),L=g=>{if(!s){let v;g===!0?v="on":g==="indeterminate"?v="intermediate":v="off",r(v)}};return Co("div",{className:"cocso-checkbox-wrapper",children:[Co(H.Root,{ref:d,id:e,className:h,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:L,disabled:s,...a,children:[W(H.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:W("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:W("path",{d:"M20 6 9 17l-5-5"})})}),W("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:W("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:W("path",{d:"M5 12h14"})})})]}),n&&W(S,{className:m("cocso-checkbox-label",{disabled:s}),size:o,htmlFor:e,children:n})]})}),er=Object.assign(ne,{displayName:"Checkbox"});import*as Po from"react";import{Slot as ie}from"@radix-ui/react-slot";import*as z from"@radix-ui/react-switch";import{jsx as I,jsxs as ae}from"react/jsx-runtime";var se=Po.forwardRef(({asChild:e=!1,id:o,size:t="md",disabled:r=!1,label:n,position:s="right",className:c,children:a,...d},l)=>{let p=m("cocso-switch",{size:t,disabled:r},[],c),h=m("cocso-switch-thumb",{size:t});return ae(e?ie:"div",{className:"cocso-switch-wrapper",children:[s==="left"&&I(S,{size:t,htmlFor:o,children:n}),I(z.Root,{ref:l,className:p,...d,children:I(z.Thumb,{className:h})}),s==="right"&&I(S,{size:t,htmlFor:o,children:n})]})}),mr=Object.assign(se,{displayName:"Switch"});import{Toaster as ce,toast as gr}from"sonner";var ur=Object.assign(ce,{displayName:"Toast"});export{ge as Accordion,B as Body,He as Button,er as Checkbox,Ve as Display,at as FileUpload,lo as Heading,S as Label,Rt as Link,Dt as Modal,$t as OneTimePasswordField,Zt as Pagination,ro as Spinner,mr as Switch,ur as Toaster,gr as toast};
1
+ import*as R from"@radix-ui/react-accordion";import{forwardRef as G}from"react";var bo=(...e)=>e.filter(Boolean).join(" ").trim(),c=(e,o,t=[],...r)=>{let n=Object.entries(o).filter(([,a])=>a!==!1&&a!==null&&a!==void 0).map(([a,m])=>`${e}--${a}_${m}`).join(" "),s=t.filter(a=>Object.entries(a).every(([m,p])=>o[m]===p)).map(a=>{let m=Object.entries(a).map(([p,l])=>`${p}_${l}`).join("-");return`${e}--${m}`}).join(" ");return bo(e,n,s,...r)};import{Slottable as Po}from"@radix-ui/react-slot";import{jsx as F,jsxs as wo}from"react/jsx-runtime";var yo=G(({className:e,...o},t)=>{let r=c("cocso-accordion-item",{},[],e);return F(R.Item,{ref:t,className:r,...o})}),Ro=G(({className:e,children:o,chevron:t=!0,...r},n)=>{let s=c("cocso-accordion-trigger",{},[],e);return F(R.Trigger,{ref:n,className:s,...r,children:wo(Po,{children:[o,t&&F("div",{className:"cocso-accordion-chevron",children:F("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:F("path",{d:"m6 9 6 6 6-6"})})})]})})}),xo=G(({className:e,...o},t)=>{let r=c("cocso-accordion-content",{},[],e);return F(R.Content,{ref:t,className:r,...o})}),fe=Object.assign(R.Root,{Item:yo,Header:R.Header,Trigger:Ro,Content:xo});import*as Y from"react";import{Slot as ko}from"@radix-ui/react-slot";function u(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var X={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 X?X[e]:e}import{jsx as To}from"react/jsx-runtime";var No=Y.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:s,...a},m)=>{let l=c("cocso-body",{size:o},[],n);return To(e?ko:"p",{ref:m,className:l,style:{"--cocso-body-color":u(t),"--cocso-body-weight":C(r),...s},...a})}),B=Object.assign(No,{displayName:"Body"});import*as O from"react";import{Slot as Mo}from"@radix-ui/react-slot";import*as oo from"react";import{jsx as K,jsxs as Lo}from"react/jsx-runtime";var So=["div"],Wo=oo.forwardRef(({as:e=So[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:s,...a},m)=>{let p=e,d=c("cocso-spinner",{size:o},[],n);return K(p,{ref:m,className:d,style:{"--cocso-spinner-bg":u(r),"--cocso-spinner-color":u(t),...s},...a,children:Lo("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[K("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),K("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"})]})})}),eo=Object.assign(Wo,{displayName:"Spinner"});import{jsx as to}from"react/jsx-runtime";var Fo=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Do=O.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:n=!1,color:s,weight:a="normal",className:m,style:p,children:l,onClick:d,onKeyDown:f,...P},w)=>{let g=r||n,v=O.useCallback(y=>{if(g){y.preventDefault();return}d?.(y)},[g,d]),j=O.useCallback(y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),g||y.currentTarget.click()),f?.(y)},[g,f]),$={variant:o,size:t,loading:n,disabled:g},_=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],U=c("cocso-button",$,_,m),V={"--cocso-button-color":u(s),"--cocso-button-weight":C(a),...p};return to(e?Mo:"button",{ref:w,className:U,onClick:v,onKeyDown:j,role:"button",disabled:g,"aria-disabled":g,"aria-busy":n,style:V,...P,children:n?to(eo,{className:"cocso-button-spinner",size:Fo(t),color:"currentColor"}):l})}),Be=Object.assign(Do,{displayName:"Button"});import*as ro from"react";import{Slot as Oo}from"@radix-ui/react-slot";import{jsx as Bo}from"react/jsx-runtime";var Eo=ro.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...a},m)=>{let l=c("cocso-display",{size:o},[],n);return Bo(e?Oo:"h1",{ref:m,className:l,style:{"--cocso-display-color":u(t),"--cocso-display-weight":C(r),...s},...a})}),Ue=Object.assign(Eo,{displayName:"Display"});import*as so from"react";import{useRef as io,useState as zo,useCallback as x}from"react";import*as no from"react";import{Slot as Ao}from"@radix-ui/react-slot";import{jsx as Io}from"react/jsx-runtime";var Ho=no.forwardRef(({asChild:e=!1,size:o="md",color:t="text.basic",weight:r="normal",className:n,style:s,...a},m)=>{let l=c("cocso-label",{size:o},[],n);return Io(e?Ao:"label",{ref:m,className:l,style:{"--cocso-label-color":u(t),"--cocso-label-weight":C(r),...s},...a})}),L=Object.assign(Ho,{displayName:"Label"});import{jsx as N,jsxs as D}from"react/jsx-runtime";var jo=so.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:n=!0,accept:s,...a},m)=>{let[p,l]=zo(!1),d=io(null),f=io(null),P=3*1024*1024,w=x(i=>s?s.split(",").map(b=>b.trim()).some(b=>{if(b.endsWith("/*")){let E=b.slice(0,-2);return i.type.startsWith(E)}return i.type===b||i.name.toLowerCase().endsWith(b)}):!0,[s]),g=x(i=>i.size>P?(alert(`${i.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),v=x(i=>{let b=Array.from(i).filter(W=>w(W)?g(W):(alert(`${W.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(b.length===0)return;let E=e-o.length;if(E<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let vo=b.slice(0,E).map(W=>({file:W,name:W.name,size:W.size}));t([...o,...vo])},[o,e,t,w,g]),j=x(i=>{i.preventDefault(),i.stopPropagation(),l(!0)},[]),$=x(i=>{i.preventDefault(),i.stopPropagation(),f.current&&!f.current.contains(i.relatedTarget)&&l(!1)},[]),_=x(i=>{i.preventDefault(),i.stopPropagation()},[]),U=x(i=>{i.preventDefault(),i.stopPropagation(),l(!1);let{files:k}=i.dataTransfer;k&&v(k)},[v]),V=x(i=>{let{files:k}=i.target;k&&v(k)},[v]),J=x(i=>{let k=o.filter(b=>b.name!==i);t(k),r?.(i)},[o,t,r]),y=x(()=>{d.current?.click()},[]),Q=o.length>=e||!n&&o.length>=1;return D("div",{className:"cocso-file-upload-wrapper",children:[!Q&&D("div",{ref:f,onDragEnter:j,onDragOver:_,onDragLeave:$,onDrop:U,onClick:y,className:"cocso-file-upload","data-drag-active":p,children:[N("input",{ref:i=>{d.current=i,typeof m=="function"?m(i):m&&(m.current=i)},type:"file",onChange:V,multiple:n,accept:s,style:{display:"none"},...a}),D(L,{size:"xs",color:"palette.gray-600",children:["\uD30C\uC77C\uC744 \uC5EC\uAE30\uC5D0 \uB04C\uC5B4\uB2E4 \uB193\uAC70\uB098, \uD074\uB9AD\uD558\uC5EC \uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694",N("br",{}),"(\uCD5C\uB300 3MB)"]}),D("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[N("path",{d:"M5 12h14"}),N("path",{d:"M12 5v14"})]})]}),o.length>0&&N("div",{className:"cocso-file-upload-list",children:o.map(i=>D("div",{className:"cocso-file-upload-item",children:[N(B,{size:"xs",children:i.name}),N("button",{type:"button",onClick:()=>J(i.name),className:"cocso-file-upload-remove",children:D("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:[N("path",{d:"M18 6 6 18"}),N("path",{d:"m6 6 12 12"})]})})]},i.name))})]})}),it=Object.assign(jo,{displayName:"FileUpload"});import*as ao from"react";import{Slot as $o}from"@radix-ui/react-slot";import{jsx as Uo}from"react/jsx-runtime";var _o=ao.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...a},m)=>{let l=c("cocso-heading",{size:o},[],n);return Uo(e?$o:"h2",{ref:m,className:l,style:{"--cocso-heading-color":u(t),"--cocso-heading-weight":C(r),...s},...a})}),co=Object.assign(_o,{displayName:"Heading"});import*as mo from"react";import{Slot as Vo}from"@radix-ui/react-slot";import{jsx as Ko}from"react/jsx-runtime";var Go=mo.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:n,style:s,...a},m)=>{let l=c("cocso-link",{size:o,indicator:r},[],n);return Ko(e?Vo:"a",{ref:m,className:l,style:{"--cocso-link-weight":C(t),...s},...a})}),Pt=Object.assign(Go,{displayName:"Link"});import*as h from"@radix-ui/react-dialog";import{forwardRef as q}from"react";import{jsx as T,jsxs as Z}from"react/jsx-runtime";var Zo=q(({className:e,children:o,...t},r)=>{let n=c("cocso-modal-content",{},[],e);return Z(h.Portal,{children:[T(h.Overlay,{className:"cocso-modal-overlay"}),Z(h.Content,{ref:r,className:n,...t,children:[T("div",{className:"cocso-modal-close-wrapper",children:T(h.Close,{className:"cocso-modal-close",children:Z("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:[T("path",{d:"M18 6 6 18"}),T("path",{d:"m6 6 12 12"})]})})}),o]})]})}),qo=q(({className:e,children:o,...t},r)=>{let n=c("cocso-modal-title",{},[],e);return T(h.Title,{ref:r,className:n,asChild:!0,...t,children:T(co,{color:"text.basic",children:o})})}),Jo=q(({className:e,children:o,...t},r)=>{let n=c("cocso-modal-description",{},[],e);return T(h.Description,{ref:r,className:n,asChild:!0,...t,children:T(B,{size:"sm",color:"text.subtle",children:o})})}),Mt=Object.assign(h.Root,{Trigger:h.Trigger,Content:Zo,Title:qo,Description:Jo});import*as A from"@radix-ui/react-one-time-password-field";import{forwardRef as lo}from"react";import{jsx as po}from"react/jsx-runtime";var Qo=lo(({className:e,...o},t)=>{let r=c("cocso-otp",{},[],e);return po(A.Root,{ref:t,className:r,...o})}),Xo=lo(({className:e,...o},t)=>{let r=c("cocso-otp-input",{},[],e);return po(A.Input,{ref:t,className:r,...o})}),zt=Object.assign(Qo,{Input:Xo});import*as ho from"react";import{Slot as Yo}from"@radix-ui/react-slot";import{Fragment as ee,jsx as S,jsxs as fo}from"react/jsx-runtime";var oe=ho.forwardRef(({asChild:e=!1,page:o,totalPages:t,maxVisible:r=5,onChange:n,className:s,...a},m)=>{let p=Math.ceil(r/2),l=f=>S("button",{className:"cocso-pagination-item",onClick:()=>n(f),"data-active":o===f,children:f},f);return fo(e?Yo:"div",{ref:m,className:`cocso-pagination ${s||""}`,...a,children:[t>1&&S("button",{className:"cocso-pagination-arrow",disabled:o===1,onClick:()=>o>1&&n(o-1),children:S("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:S("path",{d:"m15 18-6-6 6-6"})})}),t<=r+2?Array(t).fill(0).map((f,P)=>l(P+1)):fo(ee,{children:[l(1),o>1+p&&S("span",{className:"cocso-pagination-trunc",children:"..."}),Array(r).fill(0).map((f,P)=>{let w=o-p+P+1;return w>1&&w<t?l(w):""}),o<t-p&&S("span",{className:"cocso-pagination-trunc",children:"..."}),l(t)]}),t>1&&S("button",{className:"cocso-pagination-arrow",disabled:o===t,onClick:()=>o<t&&n(o+1),children:S("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:S("path",{d:"m9 18 6-6-6-6"})})})]})}),Gt=Object.assign(oe,{displayName:"Pagination"});import*as uo from"react";import*as H from"@radix-ui/react-checkbox";import{jsx as M,jsxs as go}from"react/jsx-runtime";var te=uo.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:n,disabled:s=!1,className:a,...m},p)=>{let l={size:o,disabled:s,status:t},d=[...s?[{status:t,disabled:s}]:[]],f=c("cocso-checkbox",l,d,a),P=g=>{if(!s){let v;g===!0?v="on":g==="indeterminate"?v="intermediate":v="off",r(v)}};return go("div",{className:"cocso-checkbox-wrapper",children:[go(H.Root,{ref:p,id:e,className:f,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:P,disabled:s,...m,children:[M(H.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:M("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:M("path",{d:"M20 6 9 17l-5-5"})})}),M("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:M("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:M("path",{d:"M5 12h14"})})})]}),n&&M(L,{className:c("cocso-checkbox-label",{disabled:s}),size:o,htmlFor:e,children:n})]})}),Yt=Object.assign(te,{displayName:"Checkbox"});import*as Co from"react";import{Slot as re}from"@radix-ui/react-slot";import*as z from"@radix-ui/react-switch";import{jsx as I,jsxs as ie}from"react/jsx-runtime";var ne=Co.forwardRef(({asChild:e=!1,id:o,size:t="md",disabled:r=!1,label:n,position:s="right",className:a,children:m,...p},l)=>{let d=c("cocso-switch",{size:t,disabled:r},[],a),f=c("cocso-switch-thumb",{size:t});return ie(e?re:"div",{className:"cocso-switch-wrapper",children:[s==="left"&&I(L,{size:t,htmlFor:o,children:n}),I(z.Root,{ref:l,className:d,...p,children:I(z.Thumb,{className:f})}),s==="right"&&I(L,{size:t,htmlFor:o,children:n})]})}),ar=Object.assign(ne,{displayName:"Switch"});import{Toaster as se,toast as fr}from"sonner";var hr=Object.assign(se,{displayName:"Toast"});export{fe as Accordion,B as Body,Be as Button,Yt as Checkbox,Ue as Display,it as FileUpload,co as Heading,L as Label,Pt as Link,Mt as Modal,zt as OneTimePasswordField,Gt as Pagination,eo as Spinner,ar as Switch,hr as Toaster,fr as toast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocso-ui/react",
3
- "version": "0.0.1-beta.40",
3
+ "version": "0.0.1-beta.41",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cocso/cocso-ui.git",