@cocso-ui/react 0.0.1-beta.40 → 0.0.1-beta.42
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
|
-
|
|
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
|
-
|
|
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
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
3
|
export type SwitchProps = {
|
|
4
|
-
asChild?: boolean;
|
|
5
4
|
id: string;
|
|
6
5
|
size?: 'lg' | 'md';
|
|
7
6
|
disabled?: boolean;
|
|
@@ -9,7 +8,6 @@ export type SwitchProps = {
|
|
|
9
8
|
position?: 'left' | 'right';
|
|
10
9
|
} & React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>;
|
|
11
10
|
export declare const Switch: React.ForwardRefExoticComponent<{
|
|
12
|
-
asChild?: boolean;
|
|
13
11
|
id: string;
|
|
14
12
|
size?: "lg" | "md";
|
|
15
13
|
disabled?: boolean;
|
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 Mo=Object.create;var I=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Do=Object.getOwnPropertyNames;var Oo=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var Bo=(e,o)=>{for(var t in o)I(e,t,{get:o[t],enumerable:!0})},no=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Do(o))!Eo.call(e,n)&&n!==t&&I(e,n,{get:()=>o[n],enumerable:!(r=Fo(o,n))||r.enumerable});return e};var h=(e,o,t)=>(t=e!=null?Mo(Oo(e)):{},no(o||!e||!e.__esModule?I(t,"default",{value:e,enumerable:!0}):t,e)),Ao=e=>no(I({},"__esModule",{value:!0}),e);var Ce={};Bo(Ce,{Accordion:()=>$o,Body:()=>B,Button:()=>Zo,Checkbox:()=>fe,Display:()=>Jo,FileUpload:()=>Yo,Heading:()=>Y,Label:()=>F,Link:()=>te,Modal:()=>se,OneTimePasswordField:()=>me,Pagination:()=>pe,Spinner:()=>Q,Switch:()=>ge,Toaster:()=>ue,toast:()=>V.toast});module.exports=Ao(Ce);var T=h(require("@radix-ui/react-accordion"),1),z=require("react");var Ho=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...r)=>{let n=Object.entries(o).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,m])=>`${e}--${c}_${m}`).join(" "),s=t.filter(c=>Object.entries(c).every(([m,p])=>o[m]===p)).map(c=>{let m=Object.entries(c).map(([p,l])=>`${p}_${l}`).join("-");return`${e}--${m}`}).join(" ");return Ho(e,n,s,...r)};var io=require("@radix-ui/react-slot"),M=require("react/jsx-runtime"),Io=(0,z.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return(0,M.jsx)(T.Item,{ref:t,className:r,...o})}),zo=(0,z.forwardRef)(({className:e,children:o,chevron:t=!0,...r},n)=>{let s=a("cocso-accordion-trigger",{},[],e);return(0,M.jsx)(T.Trigger,{ref:n,className:s,...r,children:(0,M.jsxs)(io.Slottable,{children:[o,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"})})})]})})}),jo=(0,z.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return(0,M.jsx)(T.Content,{ref:t,className:r,...o})}),$o=Object.assign(T.Root,{Item:Io,Header:T.Header,Trigger:zo,Content:jo});var ao=h(require("react"),1),co=require("@radix-ui/react-slot");function y(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var so={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function R(e){if(e)return e in so?so[e]:e}var mo=require("react/jsx-runtime"),_o=ao.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:s,...c},m)=>{let l=a("cocso-body",{size:o},[],n);return(0,mo.jsx)(e?co.Slot:"p",{ref:m,className:l,style:{"--cocso-body-color":y(t),"--cocso-body-weight":R(r),...s},...c})}),B=Object.assign(_o,{displayName:"Body"});var A=h(require("react"),1),po=require("@radix-ui/react-slot");var lo=h(require("react"),1);var E=require("react/jsx-runtime"),Uo=["div"],Vo=lo.forwardRef(({as:e=Uo[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:s,...c},m)=>{let p=e,d=a("cocso-spinner",{size:o},[],n);return(0,E.jsx)(p,{ref:m,className:d,style:{"--cocso-spinner-bg":y(r),"--cocso-spinner-color":y(t),...s},...c,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(Vo,{displayName:"Spinner"});var X=require("react/jsx-runtime"),Go=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Ko=A.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:n=!1,color:s,weight:c="normal",className:m,style:p,children:l,onClick:d,onKeyDown:C,...S},W)=>{let P=r||n,x=A.useCallback(N=>{if(P){N.preventDefault();return}d?.(N)},[P,d]),G=A.useCallback(N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),P||N.currentTarget.click()),C?.(N)},[P,C]),K={variant:o,size:t,loading:n,disabled:P},Z=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],q=a("cocso-button",K,Z,m),J={"--cocso-button-color":y(s),"--cocso-button-weight":R(c),...p};return(0,X.jsx)(e?po.Slot:"button",{ref:W,className:q,onClick:x,onKeyDown:G,role:"button",disabled:P,"aria-disabled":P,"aria-busy":n,style:J,...S,children:n?(0,X.jsx)(Q,{className:"cocso-button-spinner",size:Go(t),color:"currentColor"}):l})}),Zo=Object.assign(Ko,{displayName:"Button"});var fo=h(require("react"),1),ho=require("@radix-ui/react-slot");var go=require("react/jsx-runtime"),qo=fo.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...c},m)=>{let l=a("cocso-display",{size:o},[],n);return(0,go.jsx)(e?ho.Slot:"h1",{ref:m,className:l,style:{"--cocso-display-color":y(t),"--cocso-display-weight":R(r),...s},...c})}),Jo=Object.assign(qo,{displayName:"Display"});var bo=h(require("react"),1),g=require("react");var uo=h(require("react"),1),Co=require("@radix-ui/react-slot");var vo=require("react/jsx-runtime"),Qo=uo.forwardRef(({asChild:e=!1,size:o="md",color:t="text.basic",weight:r="normal",className:n,style:s,...c},m)=>{let l=a("cocso-label",{size:o},[],n);return(0,vo.jsx)(e?Co.Slot:"label",{ref:m,className:l,style:{"--cocso-label-color":y(t),"--cocso-label-weight":R(r),...s},...c})}),F=Object.assign(Qo,{displayName:"Label"});var f=require("react/jsx-runtime"),Xo=bo.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:n=!0,accept:s,...c},m)=>{let[p,l]=(0,g.useState)(!1),d=(0,g.useRef)(null),C=(0,g.useRef)(null),S=3*1024*1024,W=(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]),P=(0,g.useCallback)(i=>i.size>S?(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(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=e-o.length;if(H<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let Lo=w.slice(0,H).map(D=>({file:D,name:D.name,size:D.size}));t([...o,...Lo])},[o,e,t,W,P]),G=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!0)},[]),K=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),C.current&&!C.current.contains(i.relatedTarget)&&l(!1)},[]),Z=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation()},[]),q=(0,g.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),l(!1);let{files:L}=i.dataTransfer;L&&x(L)},[x]),J=(0,g.useCallback)(i=>{let{files:L}=i.target;L&&x(L)},[x]),to=(0,g.useCallback)(i=>{let L=o.filter(w=>w.name!==i);t(L),r?.(i)},[o,t,r]),N=(0,g.useCallback)(()=>{d.current?.click()},[]),ro=o.length>=e||!n&&o.length>=1;return(0,f.jsxs)("div",{className:"cocso-file-upload-wrapper",children:[!ro&&(0,f.jsxs)("div",{ref:C,onDragEnter:G,onDragOver:Z,onDragLeave:K,onDrop:q,onClick:N,className:"cocso-file-upload","data-drag-active":p,children:[(0,f.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"},...c}),(0,f.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,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"})]})]}),o.length>0&&(0,f.jsx)("div",{className:"cocso-file-upload-list",children:o.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:()=>to(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))})]})}),Yo=Object.assign(Xo,{displayName:"FileUpload"});var Po=h(require("react"),1),yo=require("@radix-ui/react-slot");var Ro=require("react/jsx-runtime"),oe=Po.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:s,...c},m)=>{let l=a("cocso-heading",{size:o},[],n);return(0,Ro.jsx)(e?yo.Slot:"h2",{ref:m,className:l,style:{"--cocso-heading-color":y(t),"--cocso-heading-weight":R(r),...s},...c})}),Y=Object.assign(oe,{displayName:"Heading"});var xo=h(require("react"),1),wo=require("@radix-ui/react-slot");var ko=require("react/jsx-runtime"),ee=xo.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:n,style:s,...c},m)=>{let l=a("cocso-link",{size:o,indicator:r},[],n);return(0,ko.jsx)(e?wo.Slot:"a",{ref:m,className:l,style:{"--cocso-link-weight":R(t),...s},...c})}),te=Object.assign(ee,{displayName:"Link"});var u=h(require("@radix-ui/react-dialog"),1),j=require("react");var b=require("react/jsx-runtime"),re=(0,j.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-content",{},[],e);return(0,b.jsxs)(u.Portal,{children:[(0,b.jsx)(u.Overlay,{className:"cocso-modal-overlay"}),(0,b.jsxs)(u.Content,{ref:r,className:n,...t,children:[(0,b.jsx)("div",{className:"cocso-modal-close-wrapper",children:(0,b.jsx)(u.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"})]})})}),o]})]})}),ne=(0,j.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-title",{},[],e);return(0,b.jsx)(u.Title,{ref:r,className:n,asChild:!0,...t,children:(0,b.jsx)(Y,{color:"text.basic",children:o})})}),ie=(0,j.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-description",{},[],e);return(0,b.jsx)(u.Description,{ref:r,className:n,asChild:!0,...t,children:(0,b.jsx)(B,{size:"sm",color:"text.subtle",children:o})})}),se=Object.assign(u.Root,{Trigger:u.Trigger,Content:re,Title:ne,Description:ie});var $=h(require("@radix-ui/react-one-time-password-field"),1),oo=require("react");var eo=require("react/jsx-runtime"),ae=(0,oo.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp",{},[],e);return(0,eo.jsx)($.Root,{ref:t,className:r,...o})}),ce=(0,oo.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return(0,eo.jsx)($.Input,{ref:t,className:r,...o})}),me=Object.assign(ae,{Input:ce});var No=h(require("react"),1),To=require("@radix-ui/react-slot"),v=require("react/jsx-runtime"),le=No.forwardRef(({asChild:e=!1,page:o,totalPages:t,maxVisible:r=5,onChange:n,className:s,...c},m)=>{let p=Math.ceil(r/2),l=C=>(0,v.jsx)("button",{className:"cocso-pagination-item",onClick:()=>n(C),"data-active":o===C,children:C},C);return(0,v.jsxs)(e?To.Slot:"div",{ref:m,className:`cocso-pagination ${s||""}`,...c,children:[t>1&&(0,v.jsx)("button",{className:"cocso-pagination-arrow",disabled:o===1,onClick:()=>o>1&&n(o-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((C,S)=>l(S+1)):(0,v.jsxs)(v.Fragment,{children:[l(1),o>1+p&&(0,v.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),Array(r).fill(0).map((C,S)=>{let W=o-p+S+1;return W>1&&W<t?l(W):""}),o<t-p&&(0,v.jsx)("span",{className:"cocso-pagination-trunc",children:"..."}),l(t)]}),t>1&&(0,v.jsx)("button",{className:"cocso-pagination-arrow",disabled:o===t,onClick:()=>o<t&&n(o+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"})})})]})}),pe=Object.assign(le,{displayName:"Pagination"});var So=h(require("react"),1),_=h(require("@radix-ui/react-checkbox"),1);var k=require("react/jsx-runtime"),de=So.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:n,disabled:s=!1,className:c,...m},p)=>{let l={size:o,disabled:s,status:t},d=[...s?[{status:t,disabled:s}]:[]],C=a("cocso-checkbox",l,d,c),S=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:e,className:C,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:S,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:a("cocso-checkbox-label",{disabled:s}),size:o,htmlFor:e,children:n})]})}),fe=Object.assign(de,{displayName:"Checkbox"});var Wo=h(require("react"),1),U=h(require("@radix-ui/react-switch"),1);var O=require("react/jsx-runtime"),he=Wo.forwardRef(({id:e,size:o="md",disabled:t=!1,label:r,position:n="right",className:s,children:c,...m},p)=>{let l=a("cocso-switch",{size:o,disabled:t},[],s),d=a("cocso-switch-thumb",{size:o});return(0,O.jsxs)("div",{className:"cocso-switch-wrapper",children:[n==="left"&&(0,O.jsx)(F,{size:o,htmlFor:e,children:r}),(0,O.jsx)(U.Root,{ref:p,className:l,...m,children:(0,O.jsx)(U.Thumb,{className:d})}),n==="right"&&(0,O.jsx)(F,{size:o,htmlFor:e,children:r})]})}),ge=Object.assign(he,{displayName:"Switch"});var V=require("sonner"),ue=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 y from"@radix-ui/react-accordion";import{forwardRef as G}from"react";var bo=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...r)=>{let n=Object.entries(o).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,m])=>`${e}--${c}_${m}`).join(" "),s=t.filter(c=>Object.entries(c).every(([m,p])=>o[m]===p)).map(c=>{let m=Object.entries(c).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=a("cocso-accordion-item",{},[],e);return F(y.Item,{ref:t,className:r,...o})}),Ro=G(({className:e,children:o,chevron:t=!0,...r},n)=>{let s=a("cocso-accordion-trigger",{},[],e);return F(y.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=a("cocso-accordion-content",{},[],e);return F(y.Content,{ref:t,className:r,...o})}),de=Object.assign(y.Root,{Item:yo,Header:y.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,...c},m)=>{let l=a("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},...c})}),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,...c},m)=>{let p=e,d=a("cocso-spinner",{size:o},[],n);return K(p,{ref:m,className:d,style:{"--cocso-spinner-bg":u(r),"--cocso-spinner-color":u(t),...s},...c,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:c="normal",className:m,style:p,children:l,onClick:d,onKeyDown:h,...x},w)=>{let g=r||n,v=O.useCallback(P=>{if(g){P.preventDefault();return}d?.(P)},[g,d]),j=O.useCallback(P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),g||P.currentTarget.click()),h?.(P)},[g,h]),$={variant:o,size:t,loading:n,disabled:g},_=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],U=a("cocso-button",$,_,m),V={"--cocso-button-color":u(s),"--cocso-button-weight":C(c),...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,...x,children:n?to(eo,{className:"cocso-button-spinner",size:Fo(t),color:"currentColor"}):l})}),Ee=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,...c},m)=>{let l=a("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},...c})}),_e=Object.assign(Eo,{displayName:"Display"});import*as so from"react";import{useRef as io,useState as zo,useCallback as R}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,...c},m)=>{let l=a("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},...c})}),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,...c},m)=>{let[p,l]=zo(!1),d=io(null),h=io(null),x=3*1024*1024,w=R(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=R(i=>i.size>x?(alert(`${i.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),v=R(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=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:k}=i.dataTransfer;k&&v(k)},[v]),V=R(i=>{let{files:k}=i.target;k&&v(k)},[v]),J=R(i=>{let k=o.filter(b=>b.name!==i);t(k),r?.(i)},[o,t,r]),P=R(()=>{d.current?.click()},[]),Q=o.length>=e||!n&&o.length>=1;return D("div",{className:"cocso-file-upload-wrapper",children:[!Q&&D("div",{ref:h,onDragEnter:j,onDragOver:_,onDragLeave:$,onDrop:U,onClick:P,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"},...c}),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))})]})}),nt=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,...c},m)=>{let l=a("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},...c})}),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,...c},m)=>{let l=a("cocso-link",{size:o,indicator:r},[],n);return Ko(e?Vo:"a",{ref:m,className:l,style:{"--cocso-link-weight":C(t),...s},...c})}),bt=Object.assign(Go,{displayName:"Link"});import*as f 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=a("cocso-modal-content",{},[],e);return Z(f.Portal,{children:[T(f.Overlay,{className:"cocso-modal-overlay"}),Z(f.Content,{ref:r,className:n,...t,children:[T("div",{className:"cocso-modal-close-wrapper",children:T(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:[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=a("cocso-modal-title",{},[],e);return T(f.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=a("cocso-modal-description",{},[],e);return T(f.Description,{ref:r,className:n,asChild:!0,...t,children:T(B,{size:"sm",color:"text.subtle",children:o})})}),Lt=Object.assign(f.Root,{Trigger:f.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=a("cocso-otp",{},[],e);return po(A.Root,{ref:t,className:r,...o})}),Xo=lo(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return po(A.Input,{ref:t,className:r,...o})}),It=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,...c},m)=>{let p=Math.ceil(r/2),l=h=>S("button",{className:"cocso-pagination-item",onClick:()=>n(h),"data-active":o===h,children:h},h);return fo(e?Yo:"div",{ref:m,className:`cocso-pagination ${s||""}`,...c,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((h,x)=>l(x+1)):fo(ee,{children:[l(1),o>1+p&&S("span",{className:"cocso-pagination-trunc",children:"..."}),Array(r).fill(0).map((h,x)=>{let w=o-p+x+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"})})})]})}),Vt=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:c,...m},p)=>{let l={size:o,disabled:s,status:t},d=[...s?[{status:t,disabled:s}]:[]],h=a("cocso-checkbox",l,d,c),x=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:h,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:x,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:a("cocso-checkbox-label",{disabled:s}),size:o,htmlFor:e,children:n})]})}),Xt=Object.assign(te,{displayName:"Checkbox"});import*as Co from"react";import*as z from"@radix-ui/react-switch";import{jsx as I,jsxs as ne}from"react/jsx-runtime";var re=Co.forwardRef(({id:e,size:o="md",disabled:t=!1,label:r,position:n="right",className:s,children:c,...m},p)=>{let l=a("cocso-switch",{size:o,disabled:t},[],s),d=a("cocso-switch-thumb",{size:o});return ne("div",{className:"cocso-switch-wrapper",children:[n==="left"&&I(L,{size:o,htmlFor:e,children:r}),I(z.Root,{ref:p,className:l,...m,children:I(z.Thumb,{className:d})}),n==="right"&&I(L,{size:o,htmlFor:e,children:r})]})}),ir=Object.assign(re,{displayName:"Switch"});import{Toaster as ie,toast as pr}from"sonner";var dr=Object.assign(ie,{displayName:"Toast"});export{de as Accordion,B as Body,Ee as Button,Xt as Checkbox,_e as Display,nt as FileUpload,co as Heading,L as Label,bt as Link,Lt as Modal,It as OneTimePasswordField,Vt as Pagination,eo as Spinner,ir as Switch,dr as Toaster,pr as toast};
|