@cocso-ui/react 0.0.1-beta.35 → 0.0.1-beta.36

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.
@@ -16,6 +16,6 @@ export declare const Checkbox: React.ForwardRefExoticComponent<{
16
16
  onChange: (next: CheckboxStatus) => void;
17
17
  label?: string;
18
18
  disabled?: boolean;
19
- } & Omit<Omit<CheckboxPrimitive.CheckboxProps & import("react").RefAttributes<HTMLButtonElement>, "ref">, "checked" | "onCheckedChange"> & React.RefAttributes<never>> & {
19
+ } & Omit<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref">, "checked" | "onCheckedChange"> & React.RefAttributes<HTMLButtonElement>> & {
20
20
  displayName: string;
21
21
  };
@@ -1,7 +1,7 @@
1
1
  import * as ModalPrimitive from '@radix-ui/react-dialog';
2
2
  export declare const Modal: import("react").FC<ModalPrimitive.DialogProps> & {
3
3
  Trigger: import("react").ForwardRefExoticComponent<ModalPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
4
- Content: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<never>>;
5
- Title: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<never>>;
6
- Description: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<never>>;
4
+ Content: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
5
+ Title: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
6
+ Description: import("react").ForwardRefExoticComponent<Omit<ModalPrimitive.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
7
7
  };
@@ -1,4 +1,4 @@
1
1
  import * as OneTimePasswordFieldPrimitive from '@radix-ui/react-one-time-password-field';
2
- export declare const OneTimePasswordField: import("react").ForwardRefExoticComponent<Omit<Omit<OneTimePasswordFieldPrimitive.OneTimePasswordFieldProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<never>> & {
3
- Input: import("react").ForwardRefExoticComponent<Omit<Omit<OneTimePasswordFieldPrimitive.OneTimePasswordFieldInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<never>>;
2
+ export declare const OneTimePasswordField: import("react").ForwardRefExoticComponent<Omit<Omit<OneTimePasswordFieldPrimitive.OneTimePasswordFieldProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
3
+ Input: import("react").ForwardRefExoticComponent<Omit<Omit<OneTimePasswordFieldPrimitive.OneTimePasswordFieldInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
4
4
  };
@@ -0,0 +1,5 @@
1
+ import { toast } from 'sonner';
2
+ export declare const Toaster: import("react").ForwardRefExoticComponent<import("sonner").ToasterProps & import("react").RefAttributes<HTMLElement>> & {
3
+ displayName: string;
4
+ };
5
+ export { toast };
@@ -0,0 +1 @@
1
+ export * from './Toast';
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var xe=Object.create;var A=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var We=(e,o)=>{for(var t in o)A(e,t,{get:o[t],enumerable:!0})},ee=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of we(o))!Te.call(e,n)&&n!==t&&A(e,n,{get:()=>o[n],enumerable:!(r=ke(o,n))||r.enumerable});return e};var v=(e,o,t)=>(t=e!=null?xe(Ne(e)):{},ee(o||!e||!e.__esModule?A(t,"default",{value:e,enumerable:!0}):t,e)),Me=e=>ee(A({},"__esModule",{value:!0}),e);var no={};We(no,{Accordion:()=>Ee,Body:()=>D,Button:()=>ze,Checkbox:()=>ro,Display:()=>$e,FileUpload:()=>Ve,Heading:()=>q,Label:()=>O,Link:()=>Ze,Modal:()=>Xe,OneTimePasswordField:()=>oo,Spinner:()=>K});module.exports=Me(no);var w=v(require("@radix-ui/react-accordion"),1),H=require("react");var Fe=(...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,l])=>`${e}--${c}_${l}`).join(" "),i=t.filter(c=>Object.entries(c).every(([l,d])=>o[l]===d)).map(c=>{let l=Object.entries(c).map(([d,m])=>`${d}_${m}`).join("-");return`${e}--${l}`}).join(" ");return Fe(e,n,i,...r)};var oe=require("@radix-ui/react-slot"),T=require("react/jsx-runtime"),Le=(0,H.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return(0,T.jsx)(w.Item,{ref:t,className:r,...o})}),Se=(0,H.forwardRef)(({className:e,children:o,chevron:t=!0,...r},n)=>{let i=a("cocso-accordion-trigger",{},[],e);return(0,T.jsx)(w.Trigger,{ref:n,className:i,...r,children:(0,T.jsxs)(oe.Slottable,{children:[o,t&&(0,T.jsx)("div",{className:"cocso-accordion-chevron",children:(0,T.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,T.jsx)("path",{d:"m6 9 6 6 6-6"})})})]})})}),De=(0,H.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return(0,T.jsx)(w.Content,{ref:t,className:r,...o})}),Ee=Object.assign(w.Root,{Item:Le,Header:w.Header,Trigger:Se,Content:De});var re=v(require("react"),1),ne=require("@radix-ui/react-slot");function P(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var te={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function y(e){if(e)return e in te?te[e]:e}var se=require("react/jsx-runtime"),Oe=re.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:i,...c},l)=>{let m=a("cocso-body",{size:o},[],n);return(0,se.jsx)(e?ne.Slot:"p",{ref:l,className:m,style:{"--cocso-body-color":P(t),"--cocso-body-weight":y(r),...i},...c})}),D=Object.assign(Oe,{displayName:"Body"});var E=v(require("react"),1),ae=require("@radix-ui/react-slot");var ie=v(require("react"),1);var F=require("react/jsx-runtime"),Be=["div"],Ae=ie.forwardRef(({as:e=Be[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:i,...c},l)=>{let d=e,h=a("cocso-spinner",{size:o},[],n);return(0,F.jsx)(d,{ref:l,className:h,style:{"--cocso-spinner-bg":P(r),"--cocso-spinner-color":P(t),...i},...c,children:(0,F.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,F.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,F.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"})]})})}),K=Object.assign(Ae,{displayName:"Spinner"});var Z=require("react/jsx-runtime"),He=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Ie=E.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:n=!1,color:i,weight:c="normal",className:l,style:d,children:m,onClick:h,onKeyDown:W,...L},S)=>{let C=r||n,R=E.useCallback(k=>{if(C){k.preventDefault();return}h?.(k)},[C,h]),$=E.useCallback(k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),C||k.currentTarget.click()),W?.(k)},[C,W]),_={variant:o,size:t,loading:n,disabled:C},U=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],V=a("cocso-button",_,U,l),G={"--cocso-button-color":P(i),"--cocso-button-weight":y(c),...d};return(0,Z.jsx)(e?ae.Slot:"button",{ref:S,className:V,onClick:R,onKeyDown:$,role:"button",disabled:C,"aria-disabled":C,"aria-busy":n,style:G,...L,children:n?(0,Z.jsx)(K,{className:"cocso-button-spinner",size:He(t),color:"currentColor"}):m})}),ze=Object.assign(Ie,{displayName:"Button"});var ce=v(require("react"),1),le=require("@radix-ui/react-slot");var me=require("react/jsx-runtime"),je=ce.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:i,...c},l)=>{let m=a("cocso-display",{size:o},[],n);return(0,me.jsx)(e?le.Slot:"h1",{ref:l,className:m,style:{"--cocso-display-color":P(t),"--cocso-display-weight":y(r),...i},...c})}),$e=Object.assign(je,{displayName:"Display"});var ge=v(require("react"),1),f=require("react");var pe=v(require("react"),1),de=require("@radix-ui/react-slot");var fe=require("react/jsx-runtime"),_e=pe.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:i,...c},l)=>{let m=a("cocso-label",{size:o},[],n);return(0,fe.jsx)(e?de.Slot:"label",{ref:l,className:m,style:{"--cocso-label-color":P(t),"--cocso-label-weight":y(r),...i},...c})}),O=Object.assign(_e,{displayName:"Label"});var p=require("react/jsx-runtime"),Ue=ge.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:n=!0,accept:i,...c},l)=>{let[d,m]=(0,f.useState)(!1),h=(0,f.useRef)(null),W=(0,f.useRef)(null),L=3*1024*1024,S=(0,f.useCallback)(s=>i?i.split(",").map(b=>b.trim()).some(b=>{if(b.endsWith("/*")){let B=b.slice(0,-2);return s.type.startsWith(B)}return s.type===b||s.name.toLowerCase().endsWith(b)}):!0,[i]),C=(0,f.useCallback)(s=>s.size>L?(alert(`${s.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),R=(0,f.useCallback)(s=>{let b=Array.from(s).filter(M=>S(M)?C(M):(alert(`${M.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(b.length===0)return;let B=e-o.length;if(B<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let be=b.slice(0,B).map(M=>({file:M,name:M.name,size:M.size}));t([...o,...be])},[o,e,t,S,C]),$=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),m(!0)},[]),_=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),W.current&&!W.current.contains(s.relatedTarget)&&m(!1)},[]),U=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation()},[]),V=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),m(!1);let{files:N}=s.dataTransfer;N&&R(N)},[R]),G=(0,f.useCallback)(s=>{let{files:N}=s.target;N&&R(N)},[R]),X=(0,f.useCallback)(s=>{let N=o.filter(b=>b.name!==s);t(N),r?.(s)},[o,t,r]),k=(0,f.useCallback)(()=>{h.current?.click()},[]),Y=o.length>=e||!n&&o.length>=1;return(0,p.jsxs)("div",{className:"cocso-file-upload-wrapper",children:[!Y&&(0,p.jsxs)("div",{ref:W,onDragEnter:$,onDragOver:U,onDragLeave:_,onDrop:V,onClick:k,className:"cocso-file-upload","data-drag-active":d,children:[(0,p.jsx)("input",{ref:s=>{h.current=s,typeof l=="function"?l(s):l&&(l.current=s)},type:"file",onChange:G,multiple:n,accept:i,style:{display:"none"},...c}),(0,p.jsxs)(O,{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,p.jsx)("br",{}),"(\uCD5C\uB300 3MB)"]}),(0,p.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,p.jsx)("path",{d:"M5 12h14"}),(0,p.jsx)("path",{d:"M12 5v14"})]})]}),o.length>0&&(0,p.jsx)("div",{className:"cocso-file-upload-list",children:o.map(s=>(0,p.jsxs)("div",{className:"cocso-file-upload-item",children:[(0,p.jsx)(D,{size:"xs",children:s.name}),(0,p.jsx)("button",{type:"button",onClick:()=>X(s.name),className:"cocso-file-upload-remove",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"})]})})]},s.name))})]})}),Ve=Object.assign(Ue,{displayName:"FileUpload"});var he=v(require("react"),1),ue=require("@radix-ui/react-slot");var Ce=require("react/jsx-runtime"),Ge=he.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:i,...c},l)=>{let m=a("cocso-heading",{size:o},[],n);return(0,Ce.jsx)(e?ue.Slot:"h2",{ref:l,className:m,style:{"--cocso-heading-color":P(t),"--cocso-heading-weight":y(r),...i},...c})}),q=Object.assign(Ge,{displayName:"Heading"});var ve=v(require("react"),1),Pe=require("@radix-ui/react-slot");var ye=require("react/jsx-runtime"),Ke=ve.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:n,style:i,...c},l)=>{let m=a("cocso-link",{size:o,indicator:r},[],n);return(0,ye.jsx)(e?Pe.Slot:"a",{ref:l,className:m,style:{"--cocso-link-weight":y(t),...i},...c})}),Ze=Object.assign(Ke,{displayName:"Link"});var g=v(require("@radix-ui/react-dialog"),1),I=require("react");var u=require("react/jsx-runtime"),qe=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-content",{},[],e);return(0,u.jsxs)(g.Portal,{children:[(0,u.jsx)(g.Overlay,{className:"cocso-modal-overlay"}),(0,u.jsxs)(g.Content,{ref:r,className:n,...t,children:[(0,u.jsx)("div",{className:"cocso-modal-close-wrapper",children:(0,u.jsx)(g.Close,{className:"cocso-modal-close",children:(0,u.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,u.jsx)("path",{d:"M18 6 6 18"}),(0,u.jsx)("path",{d:"m6 6 12 12"})]})})}),o]})]})}),Je=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-title",{},[],e);return(0,u.jsx)(g.Title,{ref:r,className:n,asChild:!0,...t,children:(0,u.jsx)(q,{color:"text.basic",children:o})})}),Qe=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-description",{},[],e);return(0,u.jsx)(g.Description,{ref:r,className:n,asChild:!0,...t,children:(0,u.jsx)(D,{size:"sm",color:"text.subtle",children:o})})}),Xe=Object.assign(g.Root,{Trigger:g.Trigger,Content:qe,Title:Je,Description:Qe});var z=v(require("@radix-ui/react-one-time-password-field"),1),J=require("react");var Q=require("react/jsx-runtime"),Ye=(0,J.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp",{},[],e);return(0,Q.jsx)(z.Root,{ref:t,className:r,...o})}),eo=(0,J.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return(0,Q.jsx)(z.Input,{ref:t,className:r,...o})}),oo=Object.assign(Ye,{Input:eo});var Re=v(require("react"),1),j=v(require("@radix-ui/react-checkbox"),1);var x=require("react/jsx-runtime"),to=Re.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:n,disabled:i=!1,className:c,...l},d)=>{let m={size:o,disabled:i,status:t},h=[...i?[{status:t,disabled:i}]:[]],W=a("cocso-checkbox",m,h,c),L=C=>{if(!i){let R;C===!0?R="on":C==="indeterminate"?R="intermediate":R="off",r(R)}};return(0,x.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,x.jsxs)(j.Root,{ref:d,id:e,className:W,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:L,disabled:i,...l,children:[(0,x.jsx)(j.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,x.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,x.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,x.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,x.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,x.jsx)("path",{d:"M5 12h14"})})})]}),n&&(0,x.jsx)(O,{className:a("cocso-checkbox-label",{disabled:i}),size:o,htmlFor:e,children:n})]})}),ro=Object.assign(to,{displayName:"Checkbox"});
1
+ "use strict";var ke=Object.create;var A=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Me=(e,o)=>{for(var t in o)A(e,t,{get:o[t],enumerable:!0})},oe=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Te(o))!We.call(e,n)&&n!==t&&A(e,n,{get:()=>o[n],enumerable:!(r=we(o,n))||r.enumerable});return e};var v=(e,o,t)=>(t=e!=null?ke(Ne(e)):{},oe(o||!e||!e.__esModule?A(t,"default",{value:e,enumerable:!0}):t,e)),Fe=e=>oe(A({},"__esModule",{value:!0}),e);var io={};Me(io,{Accordion:()=>Oe,Body:()=>D,Button:()=>je,Checkbox:()=>no,Display:()=>_e,FileUpload:()=>Ge,Heading:()=>J,Label:()=>O,Link:()=>qe,Modal:()=>Ye,OneTimePasswordField:()=>to,Spinner:()=>Z,Toaster:()=>so,toast:()=>$.toast});module.exports=Fe(io);var w=v(require("@radix-ui/react-accordion"),1),H=require("react");var Le=(...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(" "),i=t.filter(c=>Object.entries(c).every(([m,d])=>o[m]===d)).map(c=>{let m=Object.entries(c).map(([d,l])=>`${d}_${l}`).join("-");return`${e}--${m}`}).join(" ");return Le(e,n,i,...r)};var te=require("@radix-ui/react-slot"),N=require("react/jsx-runtime"),Se=(0,H.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return(0,N.jsx)(w.Item,{ref:t,className:r,...o})}),De=(0,H.forwardRef)(({className:e,children:o,chevron:t=!0,...r},n)=>{let i=a("cocso-accordion-trigger",{},[],e);return(0,N.jsx)(w.Trigger,{ref:n,className:i,...r,children:(0,N.jsxs)(te.Slottable,{children:[o,t&&(0,N.jsx)("div",{className:"cocso-accordion-chevron",children:(0,N.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,N.jsx)("path",{d:"m6 9 6 6 6-6"})})})]})})}),Ee=(0,H.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return(0,N.jsx)(w.Content,{ref:t,className:r,...o})}),Oe=Object.assign(w.Root,{Item:Se,Header:w.Header,Trigger:De,Content:Ee});var ne=v(require("react"),1),se=require("@radix-ui/react-slot");function y(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var re={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function P(e){if(e)return e in re?re[e]:e}var ie=require("react/jsx-runtime"),Be=ne.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:i,...c},m)=>{let l=a("cocso-body",{size:o},[],n);return(0,ie.jsx)(e?se.Slot:"p",{ref:m,className:l,style:{"--cocso-body-color":y(t),"--cocso-body-weight":P(r),...i},...c})}),D=Object.assign(Be,{displayName:"Body"});var E=v(require("react"),1),ce=require("@radix-ui/react-slot");var ae=v(require("react"),1);var F=require("react/jsx-runtime"),Ae=["div"],He=ae.forwardRef(({as:e=Ae[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:n,style:i,...c},m)=>{let d=e,h=a("cocso-spinner",{size:o},[],n);return(0,F.jsx)(d,{ref:m,className:h,style:{"--cocso-spinner-bg":y(r),"--cocso-spinner-color":y(t),...i},...c,children:(0,F.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,F.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),(0,F.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"})]})})}),Z=Object.assign(He,{displayName:"Spinner"});var q=require("react/jsx-runtime"),Ie=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],ze=E.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:n=!1,color:i,weight:c="normal",className:m,style:d,children:l,onClick:h,onKeyDown:W,...L},S)=>{let C=r||n,x=E.useCallback(k=>{if(C){k.preventDefault();return}h?.(k)},[C,h]),_=E.useCallback(k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),C||k.currentTarget.click()),W?.(k)},[C,W]),U={variant:o,size:t,loading:n,disabled:C},V=[...r?[{variant:o,disabled:r}]:[],...n?[{variant:o,loading:n}]:[]],G=a("cocso-button",U,V,m),K={"--cocso-button-color":y(i),"--cocso-button-weight":P(c),...d};return(0,q.jsx)(e?ce.Slot:"button",{ref:S,className:G,onClick:x,onKeyDown:_,role:"button",disabled:C,"aria-disabled":C,"aria-busy":n,style:K,...L,children:n?(0,q.jsx)(Z,{className:"cocso-button-spinner",size:Ie(t),color:"currentColor"}):l})}),je=Object.assign(ze,{displayName:"Button"});var me=v(require("react"),1),le=require("@radix-ui/react-slot");var pe=require("react/jsx-runtime"),$e=me.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:i,...c},m)=>{let l=a("cocso-display",{size:o},[],n);return(0,pe.jsx)(e?le.Slot:"h1",{ref:m,className:l,style:{"--cocso-display-color":y(t),"--cocso-display-weight":P(r),...i},...c})}),_e=Object.assign($e,{displayName:"Display"});var he=v(require("react"),1),f=require("react");var de=v(require("react"),1),fe=require("@radix-ui/react-slot");var ge=require("react/jsx-runtime"),Ue=de.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:n,style:i,...c},m)=>{let l=a("cocso-label",{size:o},[],n);return(0,ge.jsx)(e?fe.Slot:"label",{ref:m,className:l,style:{"--cocso-label-color":y(t),"--cocso-label-weight":P(r),...i},...c})}),O=Object.assign(Ue,{displayName:"Label"});var p=require("react/jsx-runtime"),Ve=he.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:n=!0,accept:i,...c},m)=>{let[d,l]=(0,f.useState)(!1),h=(0,f.useRef)(null),W=(0,f.useRef)(null),L=3*1024*1024,S=(0,f.useCallback)(s=>i?i.split(",").map(R=>R.trim()).some(R=>{if(R.endsWith("/*")){let B=R.slice(0,-2);return s.type.startsWith(B)}return s.type===R||s.name.toLowerCase().endsWith(R)}):!0,[i]),C=(0,f.useCallback)(s=>s.size>L?(alert(`${s.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),x=(0,f.useCallback)(s=>{let R=Array.from(s).filter(M=>S(M)?C(M):(alert(`${M.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(R.length===0)return;let B=e-o.length;if(B<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let be=R.slice(0,B).map(M=>({file:M,name:M.name,size:M.size}));t([...o,...be])},[o,e,t,S,C]),_=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),l(!0)},[]),U=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),W.current&&!W.current.contains(s.relatedTarget)&&l(!1)},[]),V=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation()},[]),G=(0,f.useCallback)(s=>{s.preventDefault(),s.stopPropagation(),l(!1);let{files:T}=s.dataTransfer;T&&x(T)},[x]),K=(0,f.useCallback)(s=>{let{files:T}=s.target;T&&x(T)},[x]),Y=(0,f.useCallback)(s=>{let T=o.filter(R=>R.name!==s);t(T),r?.(s)},[o,t,r]),k=(0,f.useCallback)(()=>{h.current?.click()},[]),ee=o.length>=e||!n&&o.length>=1;return(0,p.jsxs)("div",{className:"cocso-file-upload-wrapper",children:[!ee&&(0,p.jsxs)("div",{ref:W,onDragEnter:_,onDragOver:V,onDragLeave:U,onDrop:G,onClick:k,className:"cocso-file-upload","data-drag-active":d,children:[(0,p.jsx)("input",{ref:s=>{h.current=s,typeof m=="function"?m(s):m&&(m.current=s)},type:"file",onChange:K,multiple:n,accept:i,style:{display:"none"},...c}),(0,p.jsxs)(O,{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,p.jsx)("br",{}),"(\uCD5C\uB300 3MB)"]}),(0,p.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,p.jsx)("path",{d:"M5 12h14"}),(0,p.jsx)("path",{d:"M12 5v14"})]})]}),o.length>0&&(0,p.jsx)("div",{className:"cocso-file-upload-list",children:o.map(s=>(0,p.jsxs)("div",{className:"cocso-file-upload-item",children:[(0,p.jsx)(D,{size:"xs",children:s.name}),(0,p.jsx)("button",{type:"button",onClick:()=>Y(s.name),className:"cocso-file-upload-remove",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"})]})})]},s.name))})]})}),Ge=Object.assign(Ve,{displayName:"FileUpload"});var ue=v(require("react"),1),Ce=require("@radix-ui/react-slot");var ve=require("react/jsx-runtime"),Ke=ue.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:n,style:i,...c},m)=>{let l=a("cocso-heading",{size:o},[],n);return(0,ve.jsx)(e?Ce.Slot:"h2",{ref:m,className:l,style:{"--cocso-heading-color":y(t),"--cocso-heading-weight":P(r),...i},...c})}),J=Object.assign(Ke,{displayName:"Heading"});var ye=v(require("react"),1),Pe=require("@radix-ui/react-slot");var xe=require("react/jsx-runtime"),Ze=ye.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:n,style:i,...c},m)=>{let l=a("cocso-link",{size:o,indicator:r},[],n);return(0,xe.jsx)(e?Pe.Slot:"a",{ref:m,className:l,style:{"--cocso-link-weight":P(t),...i},...c})}),qe=Object.assign(Ze,{displayName:"Link"});var g=v(require("@radix-ui/react-dialog"),1),I=require("react");var u=require("react/jsx-runtime"),Je=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-content",{},[],e);return(0,u.jsxs)(g.Portal,{children:[(0,u.jsx)(g.Overlay,{className:"cocso-modal-overlay"}),(0,u.jsxs)(g.Content,{ref:r,className:n,...t,children:[(0,u.jsx)("div",{className:"cocso-modal-close-wrapper",children:(0,u.jsx)(g.Close,{className:"cocso-modal-close",children:(0,u.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,u.jsx)("path",{d:"M18 6 6 18"}),(0,u.jsx)("path",{d:"m6 6 12 12"})]})})}),o]})]})}),Qe=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-title",{},[],e);return(0,u.jsx)(g.Title,{ref:r,className:n,asChild:!0,...t,children:(0,u.jsx)(J,{color:"text.basic",children:o})})}),Xe=(0,I.forwardRef)(({className:e,children:o,...t},r)=>{let n=a("cocso-modal-description",{},[],e);return(0,u.jsx)(g.Description,{ref:r,className:n,asChild:!0,...t,children:(0,u.jsx)(D,{size:"sm",color:"text.subtle",children:o})})}),Ye=Object.assign(g.Root,{Trigger:g.Trigger,Content:Je,Title:Qe,Description:Xe});var z=v(require("@radix-ui/react-one-time-password-field"),1),Q=require("react");var X=require("react/jsx-runtime"),eo=(0,Q.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp",{},[],e);return(0,X.jsx)(z.Root,{ref:t,className:r,...o})}),oo=(0,Q.forwardRef)(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return(0,X.jsx)(z.Input,{ref:t,className:r,...o})}),to=Object.assign(eo,{Input:oo});var Re=v(require("react"),1),j=v(require("@radix-ui/react-checkbox"),1);var b=require("react/jsx-runtime"),ro=Re.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:n,disabled:i=!1,className:c,...m},d)=>{let l={size:o,disabled:i,status:t},h=[...i?[{status:t,disabled:i}]:[]],W=a("cocso-checkbox",l,h,c),L=C=>{if(!i){let x;C===!0?x="on":C==="indeterminate"?x="intermediate":x="off",r(x)}};return(0,b.jsxs)("div",{className:"cocso-checkbox-wrapper",children:[(0,b.jsxs)(j.Root,{ref:d,id:e,className:W,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:L,disabled:i,...m,children:[(0,b.jsx)(j.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:(0,b.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,b.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),(0,b.jsx)("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:(0,b.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,b.jsx)("path",{d:"M5 12h14"})})})]}),n&&(0,b.jsx)(O,{className:a("cocso-checkbox-label",{disabled:i}),size:o,htmlFor:e,children:n})]})}),no=Object.assign(ro,{displayName:"Checkbox"});var $=require("sonner"),so=Object.assign($.Toaster,{displayName:"Toast"});
package/lib/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './components/Modal';
10
10
  export * from './components/OneTimePasswordField';
11
11
  export * from './components/Checkbox';
12
12
  export * from './components/Spinner';
13
+ export * from './components/Toast';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import*as y from"@radix-ui/react-accordion";import{forwardRef as _}from"react";var de=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...r)=>{let s=Object.entries(o).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,l])=>`${e}--${c}_${l}`).join(" "),i=t.filter(c=>Object.entries(c).every(([l,p])=>o[l]===p)).map(c=>{let l=Object.entries(c).map(([p,m])=>`${p}_${m}`).join("-");return`${e}--${l}`}).join(" ");return de(e,s,i,...r)};import{Slottable as fe}from"@radix-ui/react-slot";import{jsx as W,jsxs as Ce}from"react/jsx-runtime";var ge=_(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return W(y.Item,{ref:t,className:r,...o})}),he=_(({className:e,children:o,chevron:t=!0,...r},s)=>{let i=a("cocso-accordion-trigger",{},[],e);return W(y.Trigger,{ref:s,className:i,...r,children:Ce(fe,{children:[o,t&&W("div",{className:"cocso-accordion-chevron",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:"m6 9 6 6 6-6"})})})]})})}),ue=_(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return W(y.Content,{ref:t,className:r,...o})}),Ye=Object.assign(y.Root,{Item:ge,Header:y.Header,Trigger:he,Content:ue});import*as J from"react";import{Slot as ve}from"@radix-ui/react-slot";function h(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var q={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function u(e){if(e)return e in q?q[e]:e}import{jsx as ye}from"react/jsx-runtime";var Pe=J.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:s,style:i,...c},l)=>{let m=a("cocso-body",{size:o},[],s);return ye(e?ve:"p",{ref:l,className:m,style:{"--cocso-body-color":h(t),"--cocso-body-weight":u(r),...i},...c})}),E=Object.assign(Pe,{displayName:"Body"});import*as S from"react";import{Slot as ke}from"@radix-ui/react-slot";import*as Q from"react";import{jsx as U,jsxs as xe}from"react/jsx-runtime";var Re=["div"],be=Q.forwardRef(({as:e=Re[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:s,style:i,...c},l)=>{let p=e,f=a("cocso-spinner",{size:o},[],s);return U(p,{ref:l,className:f,style:{"--cocso-spinner-bg":h(r),"--cocso-spinner-color":h(t),...i},...c,children:xe("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),U("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"})]})})}),X=Object.assign(be,{displayName:"Spinner"});import{jsx as Y}from"react/jsx-runtime";var we=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Ne=S.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:s=!1,color:i,weight:c="normal",className:l,style:p,children:m,onClick:f,onKeyDown:w,...F},L)=>{let g=r||s,C=S.useCallback(P=>{if(g){P.preventDefault();return}f?.(P)},[g,f]),H=S.useCallback(P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),g||P.currentTarget.click()),w?.(P)},[g,w]),I={variant:o,size:t,loading:s,disabled:g},z=[...r?[{variant:o,disabled:r}]:[],...s?[{variant:o,loading:s}]:[]],j=a("cocso-button",I,z,l),$={"--cocso-button-color":h(i),"--cocso-button-weight":u(c),...p};return Y(e?ke:"button",{ref:L,className:j,onClick:C,onKeyDown:H,role:"button",disabled:g,"aria-disabled":g,"aria-busy":s,style:$,...F,children:s?Y(X,{className:"cocso-button-spinner",size:we(t),color:"currentColor"}):m})}),xo=Object.assign(Ne,{displayName:"Button"});import*as ee from"react";import{Slot as Te}from"@radix-ui/react-slot";import{jsx as Me}from"react/jsx-runtime";var We=ee.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...c},l)=>{let m=a("cocso-display",{size:o},[],s);return Me(e?Te:"h1",{ref:l,className:m,style:{"--cocso-display-color":h(t),"--cocso-display-weight":u(r),...i},...c})}),Lo=Object.assign(We,{displayName:"Display"});import*as re from"react";import{useRef as te,useState as De,useCallback as R}from"react";import*as oe from"react";import{Slot as Fe}from"@radix-ui/react-slot";import{jsx as Se}from"react/jsx-runtime";var Le=oe.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:s,style:i,...c},l)=>{let m=a("cocso-label",{size:o},[],s);return Se(e?Fe:"label",{ref:l,className:m,style:{"--cocso-label-color":h(t),"--cocso-label-weight":u(r),...i},...c})}),O=Object.assign(Le,{displayName:"Label"});import{jsx as x,jsxs as M}from"react/jsx-runtime";var Ee=re.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:s=!0,accept:i,...c},l)=>{let[p,m]=De(!1),f=te(null),w=te(null),F=3*1024*1024,L=R(n=>i?i.split(",").map(v=>v.trim()).some(v=>{if(v.endsWith("/*")){let D=v.slice(0,-2);return n.type.startsWith(D)}return n.type===v||n.name.toLowerCase().endsWith(v)}):!0,[i]),g=R(n=>n.size>F?(alert(`${n.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),C=R(n=>{let v=Array.from(n).filter(N=>L(N)?g(N):(alert(`${N.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(v.length===0)return;let D=e-o.length;if(D<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let pe=v.slice(0,D).map(N=>({file:N,name:N.name,size:N.size}));t([...o,...pe])},[o,e,t,L,g]),H=R(n=>{n.preventDefault(),n.stopPropagation(),m(!0)},[]),I=R(n=>{n.preventDefault(),n.stopPropagation(),w.current&&!w.current.contains(n.relatedTarget)&&m(!1)},[]),z=R(n=>{n.preventDefault(),n.stopPropagation()},[]),j=R(n=>{n.preventDefault(),n.stopPropagation(),m(!1);let{files:b}=n.dataTransfer;b&&C(b)},[C]),$=R(n=>{let{files:b}=n.target;b&&C(b)},[C]),K=R(n=>{let b=o.filter(v=>v.name!==n);t(b),r?.(n)},[o,t,r]),P=R(()=>{f.current?.click()},[]),Z=o.length>=e||!s&&o.length>=1;return M("div",{className:"cocso-file-upload-wrapper",children:[!Z&&M("div",{ref:w,onDragEnter:H,onDragOver:z,onDragLeave:I,onDrop:j,onClick:P,className:"cocso-file-upload","data-drag-active":p,children:[x("input",{ref:n=>{f.current=n,typeof l=="function"?l(n):l&&(l.current=n)},type:"file",onChange:$,multiple:s,accept:i,style:{display:"none"},...c}),M(O,{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",x("br",{}),"(\uCD5C\uB300 3MB)"]}),M("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:[x("path",{d:"M5 12h14"}),x("path",{d:"M12 5v14"})]})]}),o.length>0&&x("div",{className:"cocso-file-upload-list",children:o.map(n=>M("div",{className:"cocso-file-upload-item",children:[x(E,{size:"xs",children:n.name}),x("button",{type:"button",onClick:()=>K(n.name),className:"cocso-file-upload-remove",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:[x("path",{d:"M18 6 6 18"}),x("path",{d:"m6 6 12 12"})]})})]},n.name))})]})}),Go=Object.assign(Ee,{displayName:"FileUpload"});import*as ne from"react";import{Slot as Oe}from"@radix-ui/react-slot";import{jsx as Ae}from"react/jsx-runtime";var Be=ne.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...c},l)=>{let m=a("cocso-heading",{size:o},[],s);return Ae(e?Oe:"h2",{ref:l,className:m,style:{"--cocso-heading-color":h(t),"--cocso-heading-weight":u(r),...i},...c})}),se=Object.assign(Be,{displayName:"Heading"});import*as ie from"react";import{Slot as He}from"@radix-ui/react-slot";import{jsx as ze}from"react/jsx-runtime";var Ie=ie.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:s,style:i,...c},l)=>{let m=a("cocso-link",{size:o,indicator:r},[],s);return ze(e?He:"a",{ref:l,className:m,style:{"--cocso-link-weight":u(t),...i},...c})}),at=Object.assign(Ie,{displayName:"Link"});import*as d from"@radix-ui/react-dialog";import{forwardRef as G}from"react";import{jsx as k,jsxs as V}from"react/jsx-runtime";var je=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-content",{},[],e);return V(d.Portal,{children:[k(d.Overlay,{className:"cocso-modal-overlay"}),V(d.Content,{ref:r,className:s,...t,children:[k("div",{className:"cocso-modal-close-wrapper",children:k(d.Close,{className:"cocso-modal-close",children:V("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]})]})}),$e=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-title",{},[],e);return k(d.Title,{ref:r,className:s,asChild:!0,...t,children:k(se,{color:"text.basic",children:o})})}),_e=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-description",{},[],e);return k(d.Description,{ref:r,className:s,asChild:!0,...t,children:k(E,{size:"sm",color:"text.subtle",children:o})})}),vt=Object.assign(d.Root,{Trigger:d.Trigger,Content:je,Title:$e,Description:_e});import*as B from"@radix-ui/react-one-time-password-field";import{forwardRef as ae}from"react";import{jsx as ce}from"react/jsx-runtime";var Ue=ae(({className:e,...o},t)=>{let r=a("cocso-otp",{},[],e);return ce(B.Root,{ref:t,className:r,...o})}),Ve=ae(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return ce(B.Input,{ref:t,className:r,...o})}),Tt=Object.assign(Ue,{Input:Ve});import*as me from"react";import*as A from"@radix-ui/react-checkbox";import{jsx as T,jsxs as le}from"react/jsx-runtime";var Ge=me.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:s,disabled:i=!1,className:c,...l},p)=>{let m={size:o,disabled:i,status:t},f=[...i?[{status:t,disabled:i}]:[]],w=a("cocso-checkbox",m,f,c),F=g=>{if(!i){let C;g===!0?C="on":g==="indeterminate"?C="intermediate":C="off",r(C)}};return le("div",{className:"cocso-checkbox-wrapper",children:[le(A.Root,{ref:p,id:e,className:w,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:F,disabled:i,...l,children:[T(A.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},children:T("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:"M20 6 9 17l-5-5"})})}),T("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:T("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:T("path",{d:"M5 12h14"})})})]}),s&&T(O,{className:a("cocso-checkbox-label",{disabled:i}),size:o,htmlFor:e,children:s})]})}),Et=Object.assign(Ge,{displayName:"Checkbox"});export{Ye as Accordion,E as Body,xo as Button,Et as Checkbox,Lo as Display,Go as FileUpload,se as Heading,O as Label,at as Link,vt as Modal,Tt as OneTimePasswordField,X as Spinner};
1
+ import*as P from"@radix-ui/react-accordion";import{forwardRef as _}from"react";var de=(...e)=>e.filter(Boolean).join(" ").trim(),a=(e,o,t=[],...r)=>{let s=Object.entries(o).filter(([,c])=>c!==!1&&c!==null&&c!==void 0).map(([c,m])=>`${e}--${c}_${m}`).join(" "),i=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 de(e,s,i,...r)};import{Slottable as fe}from"@radix-ui/react-slot";import{jsx as W,jsxs as Ce}from"react/jsx-runtime";var ge=_(({className:e,...o},t)=>{let r=a("cocso-accordion-item",{},[],e);return W(P.Item,{ref:t,className:r,...o})}),he=_(({className:e,children:o,chevron:t=!0,...r},s)=>{let i=a("cocso-accordion-trigger",{},[],e);return W(P.Trigger,{ref:s,className:i,...r,children:Ce(fe,{children:[o,t&&W("div",{className:"cocso-accordion-chevron",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:"m6 9 6 6 6-6"})})})]})})}),ue=_(({className:e,...o},t)=>{let r=a("cocso-accordion-content",{},[],e);return W(P.Content,{ref:t,className:r,...o})}),eo=Object.assign(P.Root,{Item:ge,Header:P.Header,Trigger:he,Content:ue});import*as J from"react";import{Slot as ve}from"@radix-ui/react-slot";function h(e){if(e)return e.includes(".")?`var(--color-${e.replace(/\./g,"-")})`:e}var q={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};function u(e){if(e)return e in q?q[e]:e}import{jsx as Pe}from"react/jsx-runtime";var ye=J.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:s,style:i,...c},m)=>{let l=a("cocso-body",{size:o},[],s);return Pe(e?ve:"p",{ref:m,className:l,style:{"--cocso-body-color":h(t),"--cocso-body-weight":u(r),...i},...c})}),E=Object.assign(ye,{displayName:"Body"});import*as S from"react";import{Slot as ke}from"@radix-ui/react-slot";import*as Q from"react";import{jsx as U,jsxs as be}from"react/jsx-runtime";var xe=["div"],Re=Q.forwardRef(({as:e=xe[0],size:o="md",color:t="palette.primary-500",bg:r="palette.gray-200",className:s,style:i,...c},m)=>{let p=e,f=a("cocso-spinner",{size:o},[],s);return U(p,{ref:m,className:f,style:{"--cocso-spinner-bg":h(r),"--cocso-spinner-color":h(t),...i},...c,children:be("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("circle",{className:"opacity-25",cx:"12",cy:"12",r:"9",stroke:"var(--cocso-spinner-bg, currentColor)",strokeWidth:"3"}),U("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"})]})})}),X=Object.assign(Re,{displayName:"Spinner"});import{jsx as Y}from"react/jsx-runtime";var we=e=>({"2xs":"xs",xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"})[e],Te=S.forwardRef(({asChild:e=!1,variant:o="primary",size:t="md",disabled:r=!1,loading:s=!1,color:i,weight:c="normal",className:m,style:p,children:l,onClick:f,onKeyDown:w,...F},L)=>{let g=r||s,C=S.useCallback(y=>{if(g){y.preventDefault();return}f?.(y)},[g,f]),H=S.useCallback(y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),g||y.currentTarget.click()),w?.(y)},[g,w]),I={variant:o,size:t,loading:s,disabled:g},z=[...r?[{variant:o,disabled:r}]:[],...s?[{variant:o,loading:s}]:[]],j=a("cocso-button",I,z,m),$={"--cocso-button-color":h(i),"--cocso-button-weight":u(c),...p};return Y(e?ke:"button",{ref:L,className:j,onClick:C,onKeyDown:H,role:"button",disabled:g,"aria-disabled":g,"aria-busy":s,style:$,...F,children:s?Y(X,{className:"cocso-button-spinner",size:we(t),color:"currentColor"}):l})}),ko=Object.assign(Te,{displayName:"Button"});import*as ee from"react";import{Slot as Ne}from"@radix-ui/react-slot";import{jsx as Me}from"react/jsx-runtime";var We=ee.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...c},m)=>{let l=a("cocso-display",{size:o},[],s);return Me(e?Ne:"h1",{ref:m,className:l,style:{"--cocso-display-color":h(t),"--cocso-display-weight":u(r),...i},...c})}),So=Object.assign(We,{displayName:"Display"});import*as re from"react";import{useRef as te,useState as De,useCallback as x}from"react";import*as oe from"react";import{Slot as Fe}from"@radix-ui/react-slot";import{jsx as Se}from"react/jsx-runtime";var Le=oe.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="normal",className:s,style:i,...c},m)=>{let l=a("cocso-label",{size:o},[],s);return Se(e?Fe:"label",{ref:m,className:l,style:{"--cocso-label-color":h(t),"--cocso-label-weight":u(r),...i},...c})}),O=Object.assign(Le,{displayName:"Label"});import{jsx as b,jsxs as M}from"react/jsx-runtime";var Ee=re.forwardRef(({maxFiles:e=2,files:o,onFilesChange:t,onRemove:r,multiple:s=!0,accept:i,...c},m)=>{let[p,l]=De(!1),f=te(null),w=te(null),F=3*1024*1024,L=x(n=>i?i.split(",").map(v=>v.trim()).some(v=>{if(v.endsWith("/*")){let D=v.slice(0,-2);return n.type.startsWith(D)}return n.type===v||n.name.toLowerCase().endsWith(v)}):!0,[i]),g=x(n=>n.size>F?(alert(`${n.name}\uC740(\uB294) 3MB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4.`),!1):!0,[]),C=x(n=>{let v=Array.from(n).filter(T=>L(T)?g(T):(alert(`${T.name}\uC740(\uB294) \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD0C0\uC785\uC785\uB2C8\uB2E4.`),!1));if(v.length===0)return;let D=e-o.length;if(D<=0){alert(`\uCD5C\uB300 ${e}\uAC1C\uC758 \uD30C\uC77C\uB9CC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);return}let pe=v.slice(0,D).map(T=>({file:T,name:T.name,size:T.size}));t([...o,...pe])},[o,e,t,L,g]),H=x(n=>{n.preventDefault(),n.stopPropagation(),l(!0)},[]),I=x(n=>{n.preventDefault(),n.stopPropagation(),w.current&&!w.current.contains(n.relatedTarget)&&l(!1)},[]),z=x(n=>{n.preventDefault(),n.stopPropagation()},[]),j=x(n=>{n.preventDefault(),n.stopPropagation(),l(!1);let{files:R}=n.dataTransfer;R&&C(R)},[C]),$=x(n=>{let{files:R}=n.target;R&&C(R)},[C]),K=x(n=>{let R=o.filter(v=>v.name!==n);t(R),r?.(n)},[o,t,r]),y=x(()=>{f.current?.click()},[]),Z=o.length>=e||!s&&o.length>=1;return M("div",{className:"cocso-file-upload-wrapper",children:[!Z&&M("div",{ref:w,onDragEnter:H,onDragOver:z,onDragLeave:I,onDrop:j,onClick:y,className:"cocso-file-upload","data-drag-active":p,children:[b("input",{ref:n=>{f.current=n,typeof m=="function"?m(n):m&&(m.current=n)},type:"file",onChange:$,multiple:s,accept:i,style:{display:"none"},...c}),M(O,{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",b("br",{}),"(\uCD5C\uB300 3MB)"]}),M("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:[b("path",{d:"M5 12h14"}),b("path",{d:"M12 5v14"})]})]}),o.length>0&&b("div",{className:"cocso-file-upload-list",children:o.map(n=>M("div",{className:"cocso-file-upload-item",children:[b(E,{size:"xs",children:n.name}),b("button",{type:"button",onClick:()=>K(n.name),className:"cocso-file-upload-remove",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:[b("path",{d:"M18 6 6 18"}),b("path",{d:"m6 6 12 12"})]})})]},n.name))})]})}),Ko=Object.assign(Ee,{displayName:"FileUpload"});import*as ne from"react";import{Slot as Oe}from"@radix-ui/react-slot";import{jsx as Ae}from"react/jsx-runtime";var Be=ne.forwardRef(({asChild:e=!1,size:o="md",color:t,weight:r="bold",className:s,style:i,...c},m)=>{let l=a("cocso-heading",{size:o},[],s);return Ae(e?Oe:"h2",{ref:m,className:l,style:{"--cocso-heading-color":h(t),"--cocso-heading-weight":u(r),...i},...c})}),se=Object.assign(Be,{displayName:"Heading"});import*as ie from"react";import{Slot as He}from"@radix-ui/react-slot";import{jsx as ze}from"react/jsx-runtime";var Ie=ie.forwardRef(({asChild:e=!1,size:o="md",weight:t="normal",indicator:r=!0,className:s,style:i,...c},m)=>{let l=a("cocso-link",{size:o,indicator:r},[],s);return ze(e?He:"a",{ref:m,className:l,style:{"--cocso-link-weight":u(t),...i},...c})}),ct=Object.assign(Ie,{displayName:"Link"});import*as d from"@radix-ui/react-dialog";import{forwardRef as G}from"react";import{jsx as k,jsxs as V}from"react/jsx-runtime";var je=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-content",{},[],e);return V(d.Portal,{children:[k(d.Overlay,{className:"cocso-modal-overlay"}),V(d.Content,{ref:r,className:s,...t,children:[k("div",{className:"cocso-modal-close-wrapper",children:k(d.Close,{className:"cocso-modal-close",children:V("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]})]})}),$e=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-title",{},[],e);return k(d.Title,{ref:r,className:s,asChild:!0,...t,children:k(se,{color:"text.basic",children:o})})}),_e=G(({className:e,children:o,...t},r)=>{let s=a("cocso-modal-description",{},[],e);return k(d.Description,{ref:r,className:s,asChild:!0,...t,children:k(E,{size:"sm",color:"text.subtle",children:o})})}),yt=Object.assign(d.Root,{Trigger:d.Trigger,Content:je,Title:$e,Description:_e});import*as B from"@radix-ui/react-one-time-password-field";import{forwardRef as ae}from"react";import{jsx as ce}from"react/jsx-runtime";var Ue=ae(({className:e,...o},t)=>{let r=a("cocso-otp",{},[],e);return ce(B.Root,{ref:t,className:r,...o})}),Ve=ae(({className:e,...o},t)=>{let r=a("cocso-otp-input",{},[],e);return ce(B.Input,{ref:t,className:r,...o})}),Wt=Object.assign(Ue,{Input:Ve});import*as le from"react";import*as A from"@radix-ui/react-checkbox";import{jsx as N,jsxs as me}from"react/jsx-runtime";var Ge=le.forwardRef(({id:e,size:o="md",status:t,onChange:r,label:s,disabled:i=!1,className:c,...m},p)=>{let l={size:o,disabled:i,status:t},f=[...i?[{status:t,disabled:i}]:[]],w=a("cocso-checkbox",l,f,c),F=g=>{if(!i){let C;g===!0?C="on":g==="indeterminate"?C="intermediate":C="off",r(C)}};return me("div",{className:"cocso-checkbox-wrapper",children:[me(A.Root,{ref:p,id:e,className:w,checked:(()=>{switch(t){case"on":return!0;case"intermediate":return"indeterminate";case"off":default:return!1}})(),onCheckedChange:F,disabled:i,...m,children:[N(A.Indicator,{className:"cocso-checkbox-indicator",style:{opacity:t==="on"?1:0},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:"M20 6 9 17l-5-5"})})}),N("div",{className:"cocso-checkbox-indicator",style:{opacity:t==="intermediate"?1:0},children:N("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:N("path",{d:"M5 12h14"})})})]}),s&&N(O,{className:a("cocso-checkbox-label",{disabled:i}),size:o,htmlFor:e,children:s})]})}),Ot=Object.assign(Ge,{displayName:"Checkbox"});import{Toaster as Ke,toast as jt}from"sonner";var $t=Object.assign(Ke,{displayName:"Toast"});export{eo as Accordion,E as Body,ko as Button,Ot as Checkbox,So as Display,Ko as FileUpload,se as Heading,O as Label,ct as Link,yt as Modal,Wt as OneTimePasswordField,X as Spinner,$t as Toaster,jt as toast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocso-ui/react",
3
- "version": "0.0.1-beta.35",
3
+ "version": "0.0.1-beta.36",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cocso/cocso-ui.git",
@@ -29,7 +29,8 @@
29
29
  "@radix-ui/react-checkbox": "^1.3.2",
30
30
  "@radix-ui/react-dialog": "^1.1.14",
31
31
  "@radix-ui/react-one-time-password-field": "^0.1.7",
32
- "@radix-ui/react-slot": "^1.2.3"
32
+ "@radix-ui/react-slot": "^1.2.3",
33
+ "sonner": "^2.0.6"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "react": "^19.1.0",