@xonic0506/sonic-ui 0.4.1 → 0.4.2

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.
package/DESIGN.md CHANGED
@@ -320,6 +320,8 @@ Figma Core 페이지의 컴포넌트 속성 이름 = React props 이름이에요
320
320
  | ghost | 없음 | `text/default` | 없음 | `bg/subtle` |
321
321
  | danger | `bg/danger` | `text/on-danger` | 없음 | 없음 (v0.1에는 danger hover 토큰이 없음) |
322
322
 
323
+ **페이지 이동은 버튼 모양이어도 링크예요.** `<Button render={<a />}>`는 `<a>`에 `role="button"`이 붙어 화면 낭독기가 버튼으로 읽어요. 링크 요소에 `buttonVariants({ variant, size })` 클래스만 입혀요: `<NextLink href="/" className={buttonVariants({ variant: 'secondary' })}>홈으로 가기</NextLink>`.
324
+
323
325
  공통: radius `radius/md`, 아이콘과 글자 사이 `space/2`, disabled는 `opacity/disabled`(45%), focus는 2px `border/focus` + offset 2px, 색 전환은 `duration/fast`.
324
326
 
325
327
  ### Input
@@ -481,7 +483,7 @@ const retryRef = useRef<HTMLButtonElement>(null);
481
483
  ```tsx
482
484
  // Next.js app/not-found.tsx
483
485
  export default function NotFound() {
484
- return <ErrorPage status={404} action={<Button render={<NextLink href="/" />}>홈으로 가기</Button>} />;
486
+ return <ErrorPage status={404} action={<NextLink href="/" className={buttonVariants()}>홈으로 가기</NextLink>} />;
485
487
  }
486
488
  ```
487
489
 
@@ -829,7 +831,7 @@ Sonic 팀은 Figma Pro 요금제라 Code Connect(Organization 이상)를 쓸 수
829
831
 
830
832
  | Figma 컴포넌트 (Core 페이지) | node id | 코드 | 파일 |
831
833
  |---|---|---|---|
832
- | Button | `5:52` | `<Button variant size disabled>` | `src/components/button.tsx` |
834
+ | Button | `5:52` | `<Button variant size disabled>` (페이지 이동은 링크에 `buttonVariants({ variant, size })`) | `src/components/button.tsx` |
833
835
  | Button Icon | `23:2294` | `<Button size="icon-*" variant disabled aria-label>` + 아이콘 자식 | `src/components/button.tsx` |
834
836
  | Input | `5:61` | `<Input invalid disabled placeholder>` | `src/components/input.tsx` |
835
837
  | Text | `5:110` | `<Text variant tone as>` | `src/components/text.tsx` |
@@ -1,8 +1,13 @@
1
1
  import * as React from 'react';
2
+ /** 링크를 버튼 모양으로 그릴 때: <NextLink className={buttonVariants({ variant: 'secondary' })} /> */
3
+ export declare const buttonVariants: (props?: ({
4
+ variant?: "danger" | "ghost" | "primary" | "secondary" | null | undefined;
5
+ size?: "icon-lg" | "icon-md" | "icon-sm" | "lg" | "md" | "sm" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
2
7
  interface ButtonBaseProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className'> {
3
8
  variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
4
9
  className?: string;
5
- /** 다른 요소로 렌더링할 때 (예: render={<a href="/" />}) */
10
+ /** 다른 요소로 렌더링할 때. 링크는 role="button"이 붙으니 buttonVariants를 쓰세요 */
6
11
  render?: React.ReactElement;
7
12
  /** 진행 중: 스피너 표시, 클릭 막기, 포커스 유지, aria-busy */
8
13
  loading?: boolean;
@@ -46,4 +46,4 @@ var c = r("sn:box-border sn:inline-flex sn:items-center sn:justify-center sn:gap
46
46
  });
47
47
  });
48
48
  //#endregion
49
- export { l as Button };
49
+ export { l as Button, c as buttonVariants };
Binary file
Binary file
Binary file
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Button, type ButtonProps } from './components/button';
1
+ export { Button, buttonVariants, type ButtonProps } from './components/button';
2
2
  export { Input, type InputProps } from './components/input';
3
3
  export { Textarea, type TextareaProps } from './components/textarea';
4
4
  export { Checkbox, CheckboxGroup, type CheckboxProps, type CheckboxGroupProps } from './components/checkbox';
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  "use client";
2
- import { Button as e } from "./components/button.js";
3
- import { Input as t } from "./components/input.js";
4
- import { Textarea as n } from "./components/textarea.js";
5
- import { Checkbox as r, CheckboxGroup as i } from "./components/checkbox.js";
6
- import { Radio as a, RadioGroup as o } from "./components/radio-group.js";
7
- import { Switch as s } from "./components/switch.js";
8
- import { Select as c } from "./components/select.js";
9
- import { Text as l } from "./components/text.js";
10
- import { Card as u, CardBody as d, CardDescription as f, CardFooter as p, CardHeader as m, CardTitle as h } from "./components/card.js";
11
- import { Avatar as g } from "./components/avatar.js";
12
- import { Field as _ } from "./components/field.js";
13
- import { Skeleton as v } from "./components/skeleton.js";
14
- import { EmptyState as y } from "./components/empty-state.js";
15
- import { ErrorState as b } from "./components/error-state.js";
16
- import { ErrorPage as x } from "./components/error-page.js";
17
- import { Dialog as S, DialogClose as C, DialogDescription as w, DialogFooter as T, DialogPopup as E, DialogTitle as D, DialogTrigger as O } from "./components/dialog.js";
18
- import { AlertDialog as k, AlertDialogClose as A, AlertDialogDescription as j, AlertDialogFooter as M, AlertDialogPopup as N, AlertDialogTitle as P, AlertDialogTrigger as F } from "./components/alert-dialog.js";
19
- import { Menu as I, MenuItem as L, MenuPopup as R, MenuSeparator as z, MenuTrigger as B } from "./components/menu.js";
20
- import { Popover as V, PopoverClose as H, PopoverDescription as U, PopoverPopup as W, PopoverTitle as G, PopoverTrigger as K } from "./components/popover.js";
21
- import { Tooltip as q } from "./components/tooltip.js";
22
- import { Tab as J, Tabs as Y, TabsList as X, TabsPanel as Z } from "./components/tabs.js";
23
- import { Separator as Q } from "./components/separator.js";
24
- import { ToastProvider as $, useToast as ee } from "./components/toast.js";
25
- import { Badge as te } from "./components/badge.js";
26
- import { Progress as ne } from "./components/progress.js";
27
- import { Link as re } from "./components/link.js";
28
- import { Table as ie, TableBody as ae, TableCell as oe, TableHead as se, TableHeader as ce, TableRow as le } from "./components/table.js";
29
- import { ToggleGroup as ue, ToggleGroupItem as de } from "./components/toggle-group.js";
30
- import { Accordion as fe, AccordionItem as pe, AccordionPanel as me, AccordionTrigger as he } from "./components/accordion.js";
31
- import { FileDropzone as ge, FileList as _e, formatBytes as ve } from "./components/file-upload.js";
32
- export { fe as Accordion, pe as AccordionItem, me as AccordionPanel, he as AccordionTrigger, k as AlertDialog, A as AlertDialogClose, j as AlertDialogDescription, M as AlertDialogFooter, N as AlertDialogPopup, P as AlertDialogTitle, F as AlertDialogTrigger, g as Avatar, te as Badge, e as Button, u as Card, d as CardBody, f as CardDescription, p as CardFooter, m as CardHeader, h as CardTitle, r as Checkbox, i as CheckboxGroup, S as Dialog, C as DialogClose, w as DialogDescription, T as DialogFooter, E as DialogPopup, D as DialogTitle, O as DialogTrigger, y as EmptyState, x as ErrorPage, b as ErrorState, _ as Field, ge as FileDropzone, _e as FileList, t as Input, re as Link, I as Menu, L as MenuItem, R as MenuPopup, z as MenuSeparator, B as MenuTrigger, V as Popover, H as PopoverClose, U as PopoverDescription, W as PopoverPopup, G as PopoverTitle, K as PopoverTrigger, ne as Progress, a as Radio, o as RadioGroup, c as Select, Q as Separator, v as Skeleton, s as Switch, J as Tab, ie as Table, ae as TableBody, oe as TableCell, se as TableHead, ce as TableHeader, le as TableRow, Y as Tabs, X as TabsList, Z as TabsPanel, l as Text, n as Textarea, $ as ToastProvider, ue as ToggleGroup, de as ToggleGroupItem, q as Tooltip, ve as formatBytes, ee as useToast };
2
+ import { Button as e, buttonVariants as t } from "./components/button.js";
3
+ import { Input as n } from "./components/input.js";
4
+ import { Textarea as r } from "./components/textarea.js";
5
+ import { Checkbox as i, CheckboxGroup as a } from "./components/checkbox.js";
6
+ import { Radio as o, RadioGroup as s } from "./components/radio-group.js";
7
+ import { Switch as c } from "./components/switch.js";
8
+ import { Select as l } from "./components/select.js";
9
+ import { Text as u } from "./components/text.js";
10
+ import { Card as d, CardBody as f, CardDescription as p, CardFooter as m, CardHeader as h, CardTitle as g } from "./components/card.js";
11
+ import { Avatar as _ } from "./components/avatar.js";
12
+ import { Field as v } from "./components/field.js";
13
+ import { Skeleton as y } from "./components/skeleton.js";
14
+ import { EmptyState as b } from "./components/empty-state.js";
15
+ import { ErrorState as x } from "./components/error-state.js";
16
+ import { ErrorPage as S } from "./components/error-page.js";
17
+ import { Dialog as C, DialogClose as w, DialogDescription as T, DialogFooter as E, DialogPopup as D, DialogTitle as O, DialogTrigger as k } from "./components/dialog.js";
18
+ import { AlertDialog as A, AlertDialogClose as j, AlertDialogDescription as M, AlertDialogFooter as N, AlertDialogPopup as P, AlertDialogTitle as F, AlertDialogTrigger as I } from "./components/alert-dialog.js";
19
+ import { Menu as L, MenuItem as R, MenuPopup as z, MenuSeparator as B, MenuTrigger as V } from "./components/menu.js";
20
+ import { Popover as H, PopoverClose as U, PopoverDescription as W, PopoverPopup as G, PopoverTitle as K, PopoverTrigger as q } from "./components/popover.js";
21
+ import { Tooltip as J } from "./components/tooltip.js";
22
+ import { Tab as Y, Tabs as X, TabsList as Z, TabsPanel as Q } from "./components/tabs.js";
23
+ import { Separator as $ } from "./components/separator.js";
24
+ import { ToastProvider as ee, useToast as te } from "./components/toast.js";
25
+ import { Badge as ne } from "./components/badge.js";
26
+ import { Progress as re } from "./components/progress.js";
27
+ import { Link as ie } from "./components/link.js";
28
+ import { Table as ae, TableBody as oe, TableCell as se, TableHead as ce, TableHeader as le, TableRow as ue } from "./components/table.js";
29
+ import { ToggleGroup as de, ToggleGroupItem as fe } from "./components/toggle-group.js";
30
+ import { Accordion as pe, AccordionItem as me, AccordionPanel as he, AccordionTrigger as ge } from "./components/accordion.js";
31
+ import { FileDropzone as _e, FileList as ve, formatBytes as ye } from "./components/file-upload.js";
32
+ export { pe as Accordion, me as AccordionItem, he as AccordionPanel, ge as AccordionTrigger, A as AlertDialog, j as AlertDialogClose, M as AlertDialogDescription, N as AlertDialogFooter, P as AlertDialogPopup, F as AlertDialogTitle, I as AlertDialogTrigger, _ as Avatar, ne as Badge, e as Button, d as Card, f as CardBody, p as CardDescription, m as CardFooter, h as CardHeader, g as CardTitle, i as Checkbox, a as CheckboxGroup, C as Dialog, w as DialogClose, T as DialogDescription, E as DialogFooter, D as DialogPopup, O as DialogTitle, k as DialogTrigger, b as EmptyState, S as ErrorPage, x as ErrorState, v as Field, _e as FileDropzone, ve as FileList, n as Input, ie as Link, L as Menu, R as MenuItem, z as MenuPopup, B as MenuSeparator, V as MenuTrigger, H as Popover, U as PopoverClose, W as PopoverDescription, G as PopoverPopup, K as PopoverTitle, q as PopoverTrigger, re as Progress, o as Radio, s as RadioGroup, l as Select, $ as Separator, y as Skeleton, c as Switch, Y as Tab, ae as Table, oe as TableBody, se as TableCell, ce as TableHead, le as TableHeader, ue as TableRow, X as Tabs, Z as TabsList, Q as TabsPanel, u as Text, r as Textarea, ee as ToastProvider, de as ToggleGroup, fe as ToggleGroupItem, J as Tooltip, t as buttonVariants, ye as formatBytes, te as useToast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xonic0506/sonic-ui",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Figma-first personal design system (Base UI + Tailwind v4, prebuilt CSS)",
5
5
  "license": "MIT",
6
6
  "repository": {