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

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.
Files changed (35) hide show
  1. package/README.md +23 -0
  2. package/lib/components/Accordion/Accordion.d.ts +9 -0
  3. package/lib/components/Accordion/index.d.ts +1 -0
  4. package/lib/components/Body/Body.d.ts +12 -9
  5. package/lib/components/Button/Button.d.ts +22 -0
  6. package/lib/components/Button/index.d.ts +1 -0
  7. package/lib/components/Checkbox/Checkbox.d.ts +21 -0
  8. package/lib/components/Checkbox/index.d.ts +1 -0
  9. package/lib/components/Display/Display.d.ts +10 -7
  10. package/lib/components/FileUpload/FileUpload.d.ts +14 -0
  11. package/lib/components/FileUpload/index.d.ts +1 -0
  12. package/lib/components/Heading/Heading.d.ts +10 -7
  13. package/lib/components/Label/Label.d.ts +16 -0
  14. package/lib/components/Label/index.d.ts +1 -0
  15. package/lib/components/Link/Link.d.ts +16 -0
  16. package/lib/components/Link/index.d.ts +1 -0
  17. package/lib/components/Modal/Modal.d.ts +7 -0
  18. package/lib/components/Modal/index.d.ts +1 -0
  19. package/lib/components/OneTimePasswordField/OneTimePasswordField.d.ts +4 -0
  20. package/lib/components/OneTimePasswordField/index.d.ts +1 -0
  21. package/lib/components/Pagination/Pagination.d.ts +15 -0
  22. package/lib/components/Pagination/index.d.ts +1 -0
  23. package/lib/components/Spinner/Spinner.d.ts +19 -0
  24. package/lib/components/Spinner/index.d.ts +1 -0
  25. package/lib/components/Switch/Switch.d.ts +20 -0
  26. package/lib/components/Switch/index.d.ts +1 -0
  27. package/lib/components/Toast/Toast.d.ts +5 -0
  28. package/lib/components/Toast/index.d.ts +1 -0
  29. package/lib/index.cjs +1 -1
  30. package/lib/index.d.ts +12 -1
  31. package/lib/index.js +1 -1
  32. package/lib/utils/cn.d.ts +2 -0
  33. package/lib/utils/token.d.ts +15 -0
  34. package/package.json +14 -8
  35. package/lib/primitive/index.d.ts +0 -44
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ ## `@cocso-ui/react`
2
+
3
+ 이 Package는 리액트 기반 컴포넌트를 제공해요.
4
+
5
+ `radix-ui`의 헤드리스 컴포넌트를 사용하여 접근성과 커스터마이징을 고려한 컴포넌트를 구현하고 있어요.
6
+
7
+ ### Installation
8
+
9
+ ```bash
10
+ pnpm install @cocso-ui/react
11
+ ```
12
+
13
+ ### Usage
14
+
15
+ 컴포넌트를 아래와 같은 형태로 import 할 수 있어요.
16
+
17
+ ```javascript
18
+ import {Button} from '@cocso-ui/react';
19
+ ```
20
+
21
+ ### Dependencies
22
+
23
+ - [@cocso-ui/css](../css)
@@ -0,0 +1,9 @@
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ export declare const Accordion: import("react").ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & import("react").RefAttributes<HTMLDivElement>> & {
3
+ Item: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
4
+ Header: import("react").ForwardRefExoticComponent<AccordionPrimitive.AccordionHeaderProps & import("react").RefAttributes<HTMLHeadingElement>>;
5
+ Trigger: import("react").ForwardRefExoticComponent<{
6
+ chevron?: boolean;
7
+ } & Omit<AccordionPrimitive.AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
8
+ Content: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
+ };
@@ -0,0 +1 @@
1
+ export * from './Accordion';
@@ -1,13 +1,16 @@
1
1
  import * as React from 'react';
2
- type BodyElement = 'p' | 'a' | 'span' | 'div' | 'label' | 'li' | 'td' | 'th' | 'figcaption' | 'blockquote' | 'cite';
3
- export type BodyProps<T extends BodyElement = 'p'> = {
4
- as?: T;
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type BodyProps = {
4
+ asChild?: boolean;
5
5
  size?: 'lg' | 'md' | 'sm' | 'xs';
6
6
  color?: string;
7
- fontWeight?: 'normal' | 'bold';
8
- } & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color' | 'fontWeight'>;
9
- type BodyComponent = <T extends BodyElement = 'p'>(props: BodyProps<T> & React.RefAttributes<React.ComponentRef<T>>) => React.ReactElement;
10
- export declare const Body: BodyComponent & {
11
- displayName?: string;
7
+ weight?: FontWeightToken;
8
+ } & React.ComponentPropsWithoutRef<'p'>;
9
+ export declare const Body: React.ForwardRefExoticComponent<{
10
+ asChild?: boolean;
11
+ size?: "lg" | "md" | "sm" | "xs";
12
+ color?: string;
13
+ weight?: FontWeightToken;
14
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>> & {
15
+ displayName: string;
12
16
  };
13
- export {};
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type ButtonProps = {
4
+ asChild?: boolean;
5
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'success' | 'text';
6
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
7
+ disabled?: boolean;
8
+ loading?: boolean;
9
+ color?: string;
10
+ weight?: FontWeightToken;
11
+ } & React.ComponentPropsWithoutRef<'button'>;
12
+ export declare const Button: React.ForwardRefExoticComponent<{
13
+ asChild?: boolean;
14
+ variant?: "primary" | "secondary" | "tertiary" | "danger" | "success" | "text";
15
+ size?: "xl" | "lg" | "md" | "sm" | "xs" | "2xs";
16
+ disabled?: boolean;
17
+ loading?: boolean;
18
+ color?: string;
19
+ weight?: FontWeightToken;
20
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>> & {
21
+ displayName: string;
22
+ };
@@ -0,0 +1 @@
1
+ export * from './Button';
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ export type CheckboxStatus = 'on' | 'off' | 'intermediate';
4
+ export type CheckboxProps = {
5
+ id?: string;
6
+ size?: 'lg' | 'md' | 'sm';
7
+ status: CheckboxStatus;
8
+ onChange: (next: CheckboxStatus) => void;
9
+ label?: string;
10
+ disabled?: boolean;
11
+ } & Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'checked' | 'onCheckedChange'>;
12
+ export declare const Checkbox: React.ForwardRefExoticComponent<{
13
+ id?: string;
14
+ size?: "lg" | "md" | "sm";
15
+ status: CheckboxStatus;
16
+ onChange: (next: CheckboxStatus) => void;
17
+ label?: string;
18
+ disabled?: boolean;
19
+ } & Omit<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref">, "checked" | "onCheckedChange"> & React.RefAttributes<HTMLButtonElement>> & {
20
+ displayName: string;
21
+ };
@@ -0,0 +1 @@
1
+ export * from './Checkbox';
@@ -1,13 +1,16 @@
1
1
  import * as React from 'react';
2
- type DisplayElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
- export type DisplayProps<T extends DisplayElement = 'h1'> = {
4
- as?: T;
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type DisplayProps = {
4
+ asChild?: boolean;
5
5
  size?: 'lg' | 'md' | 'sm';
6
6
  color?: string;
7
- } & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color'>;
7
+ weight?: FontWeightToken;
8
+ } & React.ComponentPropsWithoutRef<'h1'>;
8
9
  export declare const Display: React.ForwardRefExoticComponent<{
9
- as?: DisplayElement | undefined;
10
+ asChild?: boolean;
10
11
  size?: "lg" | "md" | "sm";
11
12
  color?: string;
12
- } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "size" | "color"> & React.RefAttributes<HTMLHeadingElement>>;
13
- export {};
13
+ weight?: FontWeightToken;
14
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>> & {
15
+ displayName: string;
16
+ };
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ export interface FileItem {
3
+ file: File;
4
+ name: string;
5
+ size: number;
6
+ }
7
+ export declare const FileUpload: React.ForwardRefExoticComponent<{
8
+ maxFiles?: number;
9
+ files: FileItem[];
10
+ onFilesChange: (files: FileItem[]) => void;
11
+ onRemove?: (fileName: string) => void;
12
+ } & Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>> & {
13
+ displayName: string;
14
+ };
@@ -0,0 +1 @@
1
+ export * from './FileUpload';
@@ -1,13 +1,16 @@
1
1
  import * as React from 'react';
2
- type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
- export type HeadingProps<T extends HeadingElement = 'h2'> = {
4
- as?: T;
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type HeadingProps = {
4
+ asChild?: boolean;
5
5
  size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
6
6
  color?: string;
7
- } & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color'>;
7
+ weight?: FontWeightToken;
8
+ } & React.ComponentPropsWithoutRef<'h2'>;
8
9
  export declare const Heading: React.ForwardRefExoticComponent<{
9
- as?: HeadingElement | undefined;
10
+ asChild?: boolean;
10
11
  size?: "xl" | "lg" | "md" | "sm" | "xs" | "2xs";
11
12
  color?: string;
12
- } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "size" | "color"> & React.RefAttributes<HTMLHeadingElement>>;
13
- export {};
13
+ weight?: FontWeightToken;
14
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>> & {
15
+ displayName: string;
16
+ };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type LabelProps = {
4
+ asChild?: boolean;
5
+ size?: 'lg' | 'md' | 'sm' | 'xs';
6
+ color?: string;
7
+ weight?: FontWeightToken;
8
+ } & React.ComponentPropsWithoutRef<'label'>;
9
+ export declare const Label: React.ForwardRefExoticComponent<{
10
+ asChild?: boolean;
11
+ size?: "lg" | "md" | "sm" | "xs";
12
+ color?: string;
13
+ weight?: FontWeightToken;
14
+ } & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>> & {
15
+ displayName: string;
16
+ };
@@ -0,0 +1 @@
1
+ export * from './Label';
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { type FontWeightToken } from '../../utils/token';
3
+ export type LinkProps = {
4
+ asChild?: boolean;
5
+ size?: 'lg' | 'md' | 'sm' | 'xs';
6
+ weight?: FontWeightToken;
7
+ indicator?: boolean;
8
+ } & React.ComponentPropsWithoutRef<'a'>;
9
+ export declare const Link: React.ForwardRefExoticComponent<{
10
+ asChild?: boolean;
11
+ size?: "lg" | "md" | "sm" | "xs";
12
+ weight?: FontWeightToken;
13
+ indicator?: boolean;
14
+ } & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>> & {
15
+ displayName: string;
16
+ };
@@ -0,0 +1 @@
1
+ export * from './Link';
@@ -0,0 +1,7 @@
1
+ import * as ModalPrimitive from '@radix-ui/react-dialog';
2
+ export declare const Modal: import("react").FC<ModalPrimitive.DialogProps> & {
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<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
+ };
@@ -0,0 +1 @@
1
+ export * from './Modal';
@@ -0,0 +1,4 @@
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<HTMLDivElement>> & {
3
+ Input: import("react").ForwardRefExoticComponent<Omit<Omit<OneTimePasswordFieldPrimitive.OneTimePasswordFieldInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
4
+ };
@@ -0,0 +1 @@
1
+ export * from './OneTimePasswordField';
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export type PaginationProps = {
3
+ asChild?: boolean;
4
+ page: number;
5
+ count: number;
6
+ onChange: (pageNumber: number) => void;
7
+ } & React.ComponentPropsWithoutRef<'div'>;
8
+ export declare const Pagination: React.ForwardRefExoticComponent<{
9
+ asChild?: boolean;
10
+ page: number;
11
+ count: number;
12
+ onChange: (pageNumber: number) => void;
13
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>> & {
14
+ displayName: string;
15
+ };
@@ -0,0 +1 @@
1
+ export * from './Pagination';
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ declare const tags: readonly ["div"];
3
+ type Element = (typeof tags)[number];
4
+ type Default = (typeof tags)[0];
5
+ export type SpinnerProps<T extends Element = Default> = {
6
+ as?: T;
7
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
8
+ color?: string;
9
+ bg?: string;
10
+ } & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color'>;
11
+ export declare const Spinner: React.ForwardRefExoticComponent<{
12
+ as?: "div" | undefined;
13
+ size?: "xl" | "lg" | "md" | "sm" | "xs";
14
+ color?: string;
15
+ bg?: string;
16
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "size"> & React.RefAttributes<HTMLDivElement>> & {
17
+ displayName: string;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Spinner';
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
3
+ export type SwitchProps = {
4
+ asChild?: boolean;
5
+ id: string;
6
+ size?: 'lg' | 'md';
7
+ disabled?: boolean;
8
+ label?: string;
9
+ position?: 'left' | 'right';
10
+ } & React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>;
11
+ export declare const Switch: React.ForwardRefExoticComponent<{
12
+ asChild?: boolean;
13
+ id: string;
14
+ size?: "lg" | "md";
15
+ disabled?: boolean;
16
+ label?: string;
17
+ position?: "left" | "right";
18
+ } & Omit<SwitchPrimitive.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>> & {
19
+ displayName: string;
20
+ };
@@ -0,0 +1 @@
1
+ export * from './Switch';
@@ -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 B=Object.create;var m=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var H=(t,o)=>{for(var r in o)m(t,r,{get:o[r],enumerable:!0})},c=(t,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of W(o))!D.call(t,n)&&n!==r&&m(t,n,{get:()=>o[n],enumerable:!(a=N(o,n))||a.enumerable});return t};var d=(t,o,r)=>(r=t!=null?B($(t)):{},c(o||!t||!t.__esModule?m(r,"default",{value:t,enumerable:!0}):r,t)),w=t=>c(m({},"__esModule",{value:!0}),t);var q={};H(q,{Body:()=>x,Display:()=>g,Heading:()=>T,Primitive:()=>S,createPrimitive:()=>e});module.exports=w(q);var f=require("@radix-ui/react-slot"),h=d(require("react"),1),R=require("react/jsx-runtime");function e(t){let o=h.forwardRef((r,a)=>{let{asChild:n,...s}=r;return(0,R.jsx)(n?f.Slot:t,{...s,ref:a})});return o.displayName=`Primitive.${t}`,o}var S={div:e("div"),span:e("span"),button:e("button"),input:e("input"),form:e("form"),label:e("label"),p:e("p"),h1:e("h1"),h2:e("h2"),h3:e("h3"),h4:e("h4"),h5:e("h5"),h6:e("h6"),section:e("section"),article:e("article"),header:e("header"),footer:e("footer"),main:e("main"),nav:e("nav"),aside:e("aside"),ul:e("ul"),ol:e("ol"),li:e("li"),img:e("img"),a:e("a"),strong:e("strong"),em:e("em"),small:e("small"),table:e("table"),thead:e("thead"),tbody:e("tbody"),tr:e("tr"),td:e("td"),th:e("th")};var y=d(require("react"),1),C=require("react/jsx-runtime");function z(t){if(t)return`var(--color-${t.replace(".","-")})`}var F=({as:t="p",size:o="md",color:r="",fontWeight:a="normal",style:n,className:s,...i},p)=>{let l=t,v=`text-body text-body-${o}${a==="bold"?"-bold":""} ${s}`;return(0,C.jsx)(l,{ref:p,className:v,style:{"--text-color":z(r),...n},...i})},x=y.forwardRef(F);x.displayName="Body";var u=d(require("react"),1),E=require("react/jsx-runtime");function O(t){if(t)return`var(--color-${t.replace(".","-")})`}var g=u.forwardRef(({as:t="h1",size:o="md",color:r="",style:a,className:n,...s},i)=>{let p=t,l=`text-display text-display-${o} ${n}`;return(0,E.jsx)(p,{ref:i,className:l,style:{"--text-color":O(r),...a},...s})});g.displayName="Display";var P=d(require("react"),1),b=require("react/jsx-runtime");function k(t){if(t)return`var(--color-${t.replace(".","-")})`}var T=P.forwardRef(({as:t="h2",size:o="md",color:r="",style:a,className:n,...s},i)=>{let p=t,l=`text-heading text-heading-${o} ${n}`;return(0,b.jsx)(p,{ref:i,className:l,style:{"--text-color":k(r),...a},...s})});T.displayName="Heading";
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"});
package/lib/index.d.ts CHANGED
@@ -1,4 +1,15 @@
1
- export * from './primitive';
1
+ export * from './components/Accordion';
2
2
  export * from './components/Body';
3
+ export * from './components/Button';
3
4
  export * from './components/Display';
5
+ export * from './components/FileUpload';
4
6
  export * from './components/Heading';
7
+ export * from './components/Label';
8
+ export * from './components/Link';
9
+ export * from './components/Modal';
10
+ export * from './components/OneTimePasswordField';
11
+ export * from './components/Pagination';
12
+ export * from './components/Checkbox';
13
+ export * from './components/Spinner';
14
+ export * from './components/Switch';
15
+ export * from './components/Toast';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{Slot as R}from"@radix-ui/react-slot";import*as m from"react";import{jsx as y}from"react/jsx-runtime";function e(t){let o=m.forwardRef((r,n)=>{let{asChild:a,...s}=r;return y(a?R:t,{...s,ref:n})});return o.displayName=`Primitive.${t}`,o}var W={div:e("div"),span:e("span"),button:e("button"),input:e("input"),form:e("form"),label:e("label"),p:e("p"),h1:e("h1"),h2:e("h2"),h3:e("h3"),h4:e("h4"),h5:e("h5"),h6:e("h6"),section:e("section"),article:e("article"),header:e("header"),footer:e("footer"),main:e("main"),nav:e("nav"),aside:e("aside"),ul:e("ul"),ol:e("ol"),li:e("li"),img:e("img"),a:e("a"),strong:e("strong"),em:e("em"),small:e("small"),table:e("table"),thead:e("thead"),tbody:e("tbody"),tr:e("tr"),td:e("td"),th:e("th")};import*as d from"react";import{jsx as g}from"react/jsx-runtime";function x(t){if(t)return`var(--color-${t.replace(".","-")})`}var C=({as:t="p",size:o="md",color:r="",fontWeight:n="normal",style:a,className:s,...i},p)=>{let l=t,h=`text-body text-body-${o}${n==="bold"?"-bold":""} ${s}`;return g(l,{ref:p,className:h,style:{"--text-color":x(r),...a},...i})},u=d.forwardRef(C);u.displayName="Body";import*as c from"react";import{jsx as T}from"react/jsx-runtime";function E(t){if(t)return`var(--color-${t.replace(".","-")})`}var P=c.forwardRef(({as:t="h1",size:o="md",color:r="",style:n,className:a,...s},i)=>{let p=t,l=`text-display text-display-${o} ${a}`;return T(p,{ref:i,className:l,style:{"--text-color":E(r),...n},...s})});P.displayName="Display";import*as f from"react";import{jsx as B}from"react/jsx-runtime";function b(t){if(t)return`var(--color-${t.replace(".","-")})`}var v=f.forwardRef(({as:t="h2",size:o="md",color:r="",style:n,className:a,...s},i)=>{let p=t,l=`text-heading text-heading-${o} ${a}`;return B(p,{ref:i,className:l,style:{"--text-color":b(r),...n},...s})});v.displayName="Heading";export{u as Body,P as Display,v as Heading,W as Primitive,e as createPrimitive};
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};
@@ -0,0 +1,2 @@
1
+ export declare const cn: (...classes: (string | undefined | null | false)[]) => string;
2
+ export declare const createClassName: (baseClass: string, variants: Record<string, any>, compoundVariants?: Record<string, any>[], ...additionalClasses: (string | undefined | null | false)[]) => string;
@@ -0,0 +1,15 @@
1
+ export declare function createColor(token: string | undefined): string | undefined;
2
+ declare const FONT_WEIGHT_MAP: {
3
+ readonly thin: "100";
4
+ readonly extralight: "200";
5
+ readonly light: "300";
6
+ readonly normal: "400";
7
+ readonly medium: "500";
8
+ readonly semibold: "600";
9
+ readonly bold: "700";
10
+ readonly extrabold: "800";
11
+ readonly black: "900";
12
+ };
13
+ export type FontWeightToken = keyof typeof FONT_WEIGHT_MAP;
14
+ export declare function createFontWeight(token: string | undefined): string | undefined;
15
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocso-ui/react",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.40",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cocso/cocso-ui.git",
@@ -25,17 +25,23 @@
25
25
  "lib"
26
26
  ],
27
27
  "dependencies": {
28
- "@radix-ui/react-slot": "^1.2.3"
28
+ "@radix-ui/react-accordion": "^1.2.11",
29
+ "@radix-ui/react-checkbox": "^1.3.2",
30
+ "@radix-ui/react-dialog": "^1.1.14",
31
+ "@radix-ui/react-one-time-password-field": "^0.1.7",
32
+ "@radix-ui/react-slot": "^1.2.3",
33
+ "@radix-ui/react-switch": "^1.2.5",
34
+ "sonner": "^2.0.6"
29
35
  },
30
36
  "peerDependencies": {
31
- "react": "^18 || ^19",
32
- "react-dom": "^18 || ^19"
37
+ "react": "^19.1.0",
38
+ "react-dom": "^19.1.0"
33
39
  },
34
40
  "devDependencies": {
35
- "@types/react": "^19",
36
- "@types/react-dom": "^19",
37
- "esbuild": "^0.24.0",
38
- "typescript": "^5.0.0"
41
+ "@types/react": "^19.1.8",
42
+ "@types/react-dom": "^19.1.6",
43
+ "esbuild": "^0.25.6",
44
+ "typescript": "^5.8.3"
39
45
  },
40
46
  "publishConfig": {
41
47
  "access": "public"
@@ -1,44 +0,0 @@
1
- import * as React from 'react';
2
- export interface PrimitiveProps {
3
- asChild?: boolean;
4
- }
5
- type PropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & PrimitiveProps;
6
- declare function createPrimitive<E extends React.ElementType>(element: E): React.ForwardRefExoticComponent<PropsWithRef<E>>;
7
- declare const Primitive: {
8
- div: React.ForwardRefExoticComponent<PropsWithRef<"div">>;
9
- span: React.ForwardRefExoticComponent<PropsWithRef<"span">>;
10
- button: React.ForwardRefExoticComponent<PropsWithRef<"button">>;
11
- input: React.ForwardRefExoticComponent<PropsWithRef<"input">>;
12
- form: React.ForwardRefExoticComponent<PropsWithRef<"form">>;
13
- label: React.ForwardRefExoticComponent<PropsWithRef<"label">>;
14
- p: React.ForwardRefExoticComponent<PropsWithRef<"p">>;
15
- h1: React.ForwardRefExoticComponent<PropsWithRef<"h1">>;
16
- h2: React.ForwardRefExoticComponent<PropsWithRef<"h2">>;
17
- h3: React.ForwardRefExoticComponent<PropsWithRef<"h3">>;
18
- h4: React.ForwardRefExoticComponent<PropsWithRef<"h4">>;
19
- h5: React.ForwardRefExoticComponent<PropsWithRef<"h5">>;
20
- h6: React.ForwardRefExoticComponent<PropsWithRef<"h6">>;
21
- section: React.ForwardRefExoticComponent<PropsWithRef<"section">>;
22
- article: React.ForwardRefExoticComponent<PropsWithRef<"article">>;
23
- header: React.ForwardRefExoticComponent<PropsWithRef<"header">>;
24
- footer: React.ForwardRefExoticComponent<PropsWithRef<"footer">>;
25
- main: React.ForwardRefExoticComponent<PropsWithRef<"main">>;
26
- nav: React.ForwardRefExoticComponent<PropsWithRef<"nav">>;
27
- aside: React.ForwardRefExoticComponent<PropsWithRef<"aside">>;
28
- ul: React.ForwardRefExoticComponent<PropsWithRef<"ul">>;
29
- ol: React.ForwardRefExoticComponent<PropsWithRef<"ol">>;
30
- li: React.ForwardRefExoticComponent<PropsWithRef<"li">>;
31
- img: React.ForwardRefExoticComponent<PropsWithRef<"img">>;
32
- a: React.ForwardRefExoticComponent<PropsWithRef<"a">>;
33
- strong: React.ForwardRefExoticComponent<PropsWithRef<"strong">>;
34
- em: React.ForwardRefExoticComponent<PropsWithRef<"em">>;
35
- small: React.ForwardRefExoticComponent<PropsWithRef<"small">>;
36
- table: React.ForwardRefExoticComponent<PropsWithRef<"table">>;
37
- thead: React.ForwardRefExoticComponent<PropsWithRef<"thead">>;
38
- tbody: React.ForwardRefExoticComponent<PropsWithRef<"tbody">>;
39
- tr: React.ForwardRefExoticComponent<PropsWithRef<"tr">>;
40
- td: React.ForwardRefExoticComponent<PropsWithRef<"td">>;
41
- th: React.ForwardRefExoticComponent<PropsWithRef<"th">>;
42
- };
43
- export { createPrimitive, Primitive };
44
- export type { PropsWithRef };