@pantoia/ui 0.1.0 → 0.3.0

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 (68) hide show
  1. package/accordion/AGENTS.md +5 -5
  2. package/accordion/index.tsx +21 -11
  3. package/alert-dialog/AGENTS.md +7 -7
  4. package/alert-dialog/index.tsx +20 -10
  5. package/badge/AGENTS.md +5 -5
  6. package/badge/index.tsx +8 -8
  7. package/button/AGENTS.md +7 -7
  8. package/button/index.tsx +34 -34
  9. package/callout/AGENTS.md +4 -9
  10. package/callout/index.tsx +42 -22
  11. package/checkbox/AGENTS.md +5 -5
  12. package/checkbox/index.tsx +19 -16
  13. package/combobox/AGENTS.md +13 -13
  14. package/combobox/index.tsx +90 -42
  15. package/command-palette/AGENTS.md +3 -6
  16. package/command-palette/index.tsx +7 -3
  17. package/dialog/AGENTS.md +6 -6
  18. package/dialog/index.tsx +11 -5
  19. package/dist/index.js +200 -43
  20. package/drawer/AGENTS.md +5 -5
  21. package/drawer/index.tsx +8 -4
  22. package/dropdown-menu/AGENTS.md +12 -12
  23. package/dropdown-menu/index.tsx +27 -12
  24. package/field/AGENTS.md +8 -12
  25. package/field/index.tsx +39 -13
  26. package/input/AGENTS.md +4 -4
  27. package/input/index.tsx +5 -5
  28. package/kbd/AGENTS.md +1 -1
  29. package/kbd/index.tsx +6 -2
  30. package/label/AGENTS.md +1 -1
  31. package/label/index.tsx +3 -1
  32. package/number-field/AGENTS.md +6 -10
  33. package/number-field/index.tsx +26 -16
  34. package/package.json +13 -15
  35. package/palette.css +114 -0
  36. package/popover/AGENTS.md +4 -4
  37. package/popover/index.tsx +14 -4
  38. package/radio-group/AGENTS.md +8 -8
  39. package/radio-group/index.tsx +20 -16
  40. package/registry.json +9 -71
  41. package/select/AGENTS.md +10 -10
  42. package/select/index.tsx +46 -21
  43. package/switch/AGENTS.md +4 -4
  44. package/switch/index.tsx +13 -13
  45. package/table/AGENTS.md +9 -9
  46. package/table/index.tsx +16 -6
  47. package/tabs/AGENTS.md +5 -4
  48. package/tabs/index.module.css +2 -0
  49. package/tabs/index.tsx +22 -11
  50. package/tailwind.css +3 -0
  51. package/textarea/AGENTS.md +4 -4
  52. package/textarea/index.tsx +5 -5
  53. package/toast/AGENTS.md +5 -13
  54. package/toast/index.tsx +27 -33
  55. package/toggle/AGENTS.md +4 -4
  56. package/toggle/index.tsx +8 -7
  57. package/tokens.css +272 -0
  58. package/tooltip/AGENTS.md +2 -2
  59. package/tooltip/index.tsx +14 -4
  60. package/tv.ts +0 -1
  61. package/utilities.css +119 -0
  62. package/code-block/AGENTS.md +0 -60
  63. package/code-block/index.module.css +0 -46
  64. package/code-block/index.tsx +0 -127
  65. package/copy-button/AGENTS.md +0 -43
  66. package/copy-button/index.tsx +0 -119
  67. package/press.css +0 -37
  68. package/styles.css +0 -347
package/table/index.tsx CHANGED
@@ -20,6 +20,8 @@ export interface TableProps {
20
20
  children?: ReactNode
21
21
  }
22
22
 
23
+ const tableFrame = tv({ base: 'frame rounded-r12 overflow-hidden' })
24
+
23
25
  export function Table({ label, fixed = false, className, children }: TableProps) {
24
26
  const [box, setBox] = useState<HTMLDivElement | null>(null)
25
27
 
@@ -39,13 +41,13 @@ export function Table({ label, fixed = false, className, children }: TableProps)
39
41
 
40
42
  return (
41
43
  <FixedContext value={fixed}>
42
- <div className={tv({ base: 'rounded-panel border border-line overflow-hidden' })({ className })}>
44
+ <div className={tableFrame({ className })}>
43
45
  <div
44
46
  ref={setBox}
45
47
  tabIndex={overflows ? 0 : undefined}
46
48
  aria-label={overflows ? label : undefined}
47
49
  role={overflows ? 'region' : undefined}
48
- className="overflow-x-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
50
+ className="overflow-x-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-line-focus-ring"
49
51
  >
50
52
  <table className={table({ fixed })}>
51
53
  <caption className="sr-only">{label}</caption>
@@ -57,21 +59,25 @@ export function Table({ label, fixed = false, className, children }: TableProps)
57
59
  )
58
60
  }
59
61
 
62
+ const tableHeader = tv({ base: 'bg-bg-well border-b border-line' })
63
+
60
64
  export function TableHeader({ className, children }: { className?: string, children?: ReactNode }) {
61
65
  return (
62
66
  <thead>
63
- <tr className={tv({ base: 'bg-well border-b border-line' })({ className })}>
67
+ <tr className={tableHeader({ className })}>
64
68
  {children}
65
69
  </tr>
66
70
  </thead>
67
71
  )
68
72
  }
69
73
 
74
+ const tableHeadCell = tv({ base: 'text-caption text-fg-muted h-9 px-4 text-left whitespace-nowrap' })
75
+
70
76
  export function TableHeadCell({ className, children }: { className?: string, children?: ReactNode }) {
71
77
  return (
72
78
  <th
73
79
  scope="col"
74
- className={tv({ base: 'text-caption text-fg-muted h-9 px-4 text-left whitespace-nowrap' })({ className })}
80
+ className={tableHeadCell({ className })}
75
81
  >
76
82
  {children}
77
83
  </th>
@@ -82,11 +88,15 @@ export function TableBody({ className, children }: { className?: string, childre
82
88
  return <tbody className={className}>{children}</tbody>
83
89
  }
84
90
 
91
+ const tableRow = tv({
92
+ base: 'border-b border-line last:border-b-0 transition-state'
93
+ + ' hover:bg-bg-neutral-hover',
94
+ })
95
+
85
96
  export function TableRow({ className, children }: { className?: string, children?: ReactNode }) {
86
97
  return (
87
98
  <tr
88
- className={tv({ base: 'border-b border-line last:border-b-0 transition-state'
89
- + ' hover:bg-hover' })({ className })}
99
+ className={tableRow({ className })}
90
100
  >
91
101
  {children}
92
102
  </tr>
package/tabs/AGENTS.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ```
4
4
  받기 npx @pantoia/ui add tabs
5
5
  층 ui
6
- 파일 tabs/index.tsx · tabs/index.module.css · tabs/AGENTS.md
6
+ 파일 tabs/index.tsx, tabs/index.module.css, tabs/AGENTS.md
7
7
  ```
8
8
 
9
9
  ## 부위
@@ -11,9 +11,9 @@
11
11
  | 이름 | props |
12
12
  |---|---|
13
13
  | `Tabs` | `TabsProps` |
14
- | `TabsList` | — |
15
- | `TabsTrigger` | — |
16
- | `TabsContent` | — |
14
+ | `TabsList` | - |
15
+ | `TabsTrigger` | - |
16
+ | `TabsContent` | - |
17
17
 
18
18
  ### `TabsList`
19
19
 
@@ -36,6 +36,7 @@
36
36
  | 이름 | 타입 | 필수 |
37
37
  |---|---|---|
38
38
  | `value` | `string` | 예 |
39
+ | `forceMount` | `boolean` | |
39
40
  | `className` | `string` | |
40
41
  | `children` | `ReactNode` | |
41
42
 
@@ -9,6 +9,8 @@
9
9
  width var(--dur-state) var(--ease-state);
10
10
  }
11
11
 
12
+ .content[data-state="inactive"] { display: none; }
13
+
12
14
  @media (prefers-reduced-motion: reduce) {
13
15
  .underline { transition: none; }
14
16
  }
package/tabs/index.tsx CHANGED
@@ -17,19 +17,23 @@ export interface TabsProps {
17
17
  children?: ReactNode
18
18
  }
19
19
 
20
+ const tabs = tv({ base: 'flex flex-col gap-stack' })
21
+
20
22
  export function Tabs({ value, defaultValue, onValueChange, className, children }: TabsProps) {
21
23
  return (
22
24
  <TabsPrimitive.Root
23
25
  value={value}
24
26
  defaultValue={defaultValue}
25
27
  onValueChange={onValueChange}
26
- className={tv({ base: 'flex flex-col gap-stack' })({ className })}
28
+ className={tabs({ className })}
27
29
  >
28
30
  {children}
29
31
  </TabsPrimitive.Root>
30
32
  )
31
33
  }
32
34
 
35
+ const tabsList = tv({ base: 'border-line scrollbar-thin scrollbar-thumb-line-strong scrollbar-track-transparent overflow-x-auto border-b' })
36
+
33
37
  export function TabsList({ className, children }: { className?: string, children?: ReactNode }) {
34
38
  const list = useRef<HTMLDivElement>(null)
35
39
  const bar = useRef<HTMLSpanElement>(null)
@@ -58,7 +62,7 @@ export function TabsList({ className, children }: { className?: string, children
58
62
 
59
63
  return (
60
64
  <div
61
- className={tv({ base: 'border-line scroll-slim overflow-x-auto border-b' })({ className })}
65
+ className={tabsList({ className })}
62
66
  >
63
67
  <TabsPrimitive.List ref={list} className="relative flex w-max min-w-full">
64
68
  {children}
@@ -69,6 +73,16 @@ export function TabsList({ className, children }: { className?: string, children
69
73
  )
70
74
  }
71
75
 
76
+ const tabsTrigger = tv({
77
+ base: 'text-label text-fg-muted inline-flex h-9 items-center gap-tight px-3 transition-state'
78
+ + ' [&_svg]:size-4'
79
+ + ' press-shrink enabled:hover:text-fg'
80
+ + ' disabled:text-fg-disabled disabled:cursor-not-allowed'
81
+ + ' aria-selected:text-fg'
82
+ + ' focus-visible:outline-2 focus-visible:-outline-offset-2'
83
+ + ' focus-visible:outline-line-focus-ring',
84
+ })
85
+
72
86
  export function TabsTrigger({ value, disabled, className, children }: {
73
87
  value: string
74
88
  disabled?: boolean
@@ -79,26 +93,23 @@ export function TabsTrigger({ value, disabled, className, children }: {
79
93
  <TabsPrimitive.Trigger
80
94
  value={value}
81
95
  disabled={disabled}
82
- className={tv({ base: 'text-label text-fg-muted inline-flex h-9 items-center gap-tight px-3 transition-state'
83
- + ' [&_svg]:size-4'
84
- + ' press-shrink enabled:hover:text-fg'
85
- + ' disabled:text-fg-disabled disabled:cursor-not-allowed'
86
- + ' aria-selected:text-fg'
87
- + ' focus-visible:outline-2 focus-visible:-outline-offset-2'
88
- + ' focus-visible:outline-ring' })({ className })}
96
+ className={tabsTrigger({ className })}
89
97
  >
90
98
  {children}
91
99
  </TabsPrimitive.Trigger>
92
100
  )
93
101
  }
94
102
 
95
- export function TabsContent({ value, className, children }: {
103
+ const tabsContent = tv({ base: s.content })
104
+
105
+ export function TabsContent({ value, forceMount, className, children }: {
96
106
  value: string
107
+ forceMount?: boolean
97
108
  className?: string
98
109
  children?: ReactNode
99
110
  }) {
100
111
  return (
101
- <TabsPrimitive.Content value={value} className={className}>
112
+ <TabsPrimitive.Content value={value} forceMount={forceMount || undefined} className={tabsContent({ className })}>
102
113
  {children}
103
114
  </TabsPrimitive.Content>
104
115
  )
package/tailwind.css ADDED
@@ -0,0 +1,3 @@
1
+ @import "./palette.css";
2
+ @import "./tokens.css";
3
+ @import "./utilities.css";
@@ -3,7 +3,7 @@
3
3
  ```
4
4
  받기 npx @pantoia/ui add textarea
5
5
  층 ui
6
- 파일 textarea/index.tsx · textarea/AGENTS.md
6
+ 파일 textarea/index.tsx, textarea/AGENTS.md
7
7
  ```
8
8
 
9
9
  ## 부위
@@ -23,12 +23,12 @@
23
23
  | `surface` | `'bare' \| 'well'` | |
24
24
  | `size` | `'sm' \| 'md' \| 'lg'` | |
25
25
 
26
- ## 변형 — `textarea`
26
+ ## 변형 - `textarea`
27
27
 
28
28
  | 축 | 값 | 기본 |
29
29
  |---|---|---|
30
- | `surface` | `bare` · `well` | `bare` |
31
- | `size` | `sm` · `md` · `lg` | `md` |
30
+ | `surface` | `bare`, `well` | `bare` |
31
+ | `size` | `sm`, `md`, `lg` | `md` |
32
32
 
33
33
  ## 함께 받는 것
34
34
 
@@ -5,17 +5,17 @@ import { tv } from '../tv'
5
5
  export const textarea = tv({
6
6
  base: 'w-full rounded-r8 text-value text-fg'
7
7
  + ' placeholder:text-fg-placeholder'
8
- + ' invalid:ring-2 invalid:ring-danger'
8
+ + ' invalid:ring-2 invalid:ring-line-danger'
9
9
  + ' read-only:text-fg-muted'
10
10
  + ' resize-y'
11
11
  + ' transition-state'
12
- + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
13
- + ' disabled:bg-disabled disabled:text-fg-disabled disabled:cursor-not-allowed',
12
+ + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-line-focus-ring'
13
+ + ' disabled:bg-bg-neutral-disabled disabled:text-fg-disabled disabled:cursor-not-allowed',
14
14
 
15
15
  variants: {
16
16
  surface: {
17
- bare: 'bg-transparent ring-1 ring-inset ring-line-strong read-only:bg-well',
18
- well: 'bg-well',
17
+ bare: 'bg-transparent ring-1 ring-inset ring-line-strong read-only:bg-bg-well',
18
+ well: 'bg-bg-well',
19
19
  },
20
20
  size: {
21
21
  sm: 'p-2',
package/toast/AGENTS.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ```
4
4
  받기 npx @pantoia/ui add toast
5
5
  층 ui
6
- 파일 toast/index.tsx · toast/AGENTS.md
6
+ 파일 toast/index.tsx, toast/AGENTS.md
7
7
  ```
8
8
 
9
9
  ## 부위
@@ -14,18 +14,6 @@
14
14
 
15
15
  ## props
16
16
 
17
- ### `ToastTone`
18
-
19
- `'neutral' | 'success' | 'warning' | 'danger' | 'info'`
20
-
21
- ### `ToastOptions`
22
-
23
- | 이름 | 타입 | 필수 |
24
- |---|---|---|
25
- | `description` | `string` | |
26
- | `action` | `{ label: string, onClick: () => void }` | |
27
- | `toasterId` | `string` | |
28
-
29
17
  ### `ToastProps`
30
18
 
31
19
  `Omit<ComponentProps<typeof SonnerToaster>, 'id' | 'position' | 'duration' | 'expand'>` 를 확장한다.
@@ -37,6 +25,10 @@
37
25
  | `duration` | `number` | |
38
26
  | `expand` | `boolean` | |
39
27
 
28
+ ## 함께 받는 것
29
+
30
+ `tv`
31
+
40
32
  ## npm 의존
41
33
 
42
34
  `sonner`
package/toast/index.tsx CHANGED
@@ -1,31 +1,13 @@
1
1
  'use client'
2
2
 
3
3
  import type { ComponentProps } from 'react'
4
- import { toast as sonner, Toaster as SonnerToaster } from 'sonner'
4
+ import { Toaster as SonnerToaster } from 'sonner'
5
5
 
6
- export type ToastTone = 'neutral' | 'success' | 'warning' | 'danger' | 'info'
6
+ import { tv } from '../tv'
7
7
 
8
- export type ToastOptions = {
9
- description?: string
10
- action?: { label: string, onClick: () => void }
11
- toasterId?: string
12
- }
8
+ const toaster = tv({ base: 'z-toast' })
13
9
 
14
- const show = (tone: ToastTone, message: string, options?: ToastOptions) => {
15
- if (tone === 'neutral') return sonner(message, options)
16
- if (tone === 'danger') return sonner.error(message, options)
17
- return sonner[tone](message, options)
18
- }
19
-
20
- export const toast = {
21
- show,
22
- neutral: (m: string, o?: ToastOptions) => show('neutral', m, o),
23
- success: (m: string, o?: ToastOptions) => show('success', m, o),
24
- warning: (m: string, o?: ToastOptions) => show('warning', m, o),
25
- danger: (m: string, o?: ToastOptions) => show('danger', m, o),
26
- info: (m: string, o?: ToastOptions) => show('info', m, o),
27
- dismiss: (id?: string | number) => sonner.dismiss(id),
28
- }
10
+ export { toast } from 'sonner'
29
11
 
30
12
  export interface ToastProps
31
13
  extends Omit<ComponentProps<typeof SonnerToaster>, 'id' | 'position' | 'duration' | 'expand'> {
@@ -36,7 +18,17 @@ export interface ToastProps
36
18
  expand?: boolean
37
19
  }
38
20
 
39
- export function Toast({ toasterId, position = 'bottom-center', duration = 4000, expand = false, ...rest }: ToastProps) {
21
+ export function Toast({
22
+ toasterId,
23
+ position = 'bottom-center',
24
+ duration = 4000,
25
+ expand = false,
26
+ offset = 16,
27
+ gap = 8,
28
+ className,
29
+ toastOptions,
30
+ ...rest
31
+ }: ToastProps) {
40
32
  return (
41
33
  <SonnerToaster
42
34
  {...rest}
@@ -44,26 +36,28 @@ export function Toast({ toasterId, position = 'bottom-center', duration = 4000,
44
36
  position={position}
45
37
  duration={duration}
46
38
  expand={expand}
47
- offset={16}
48
- gap={8}
49
- className="z-toast"
39
+ offset={offset}
40
+ gap={gap}
41
+ className={toaster({ className })}
50
42
  toastOptions={{
51
43
  unstyled: true,
44
+ ...toastOptions,
52
45
  classNames: {
53
- toast: 'bg-float border border-line rounded-r8 shadow-s3'
46
+ toast: 'float rounded-r8'
54
47
  + ' flex w-full items-center gap-stack p-4',
55
48
  content: 'min-w-0 flex-1',
56
49
  title: 'text-label text-fg',
57
50
  description: 'text-caption text-fg-muted',
58
51
  icon: 'shrink-0',
59
52
  actionButton: 'text-label text-fg shrink-0 rounded-r8 px-3 h-8'
60
- + ' bg-well transition-state press press-shrink enabled:hover:bg-fg-muted/10'
61
- + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
53
+ + ' bg-bg-well transition-state press press-shrink enabled:hover:bg-bg-neutral-solid/10'
54
+ + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-line-focus-ring'
62
55
  + ' disabled:text-fg-disabled disabled:cursor-not-allowed',
63
- success: 'text-success',
64
- error: 'text-danger',
65
- warning: 'text-warning',
66
- info: 'text-info',
56
+ success: 'text-fg-success',
57
+ error: 'text-fg-danger',
58
+ warning: 'text-fg-warning',
59
+ info: 'text-fg-info',
60
+ ...toastOptions?.classNames,
67
61
  },
68
62
  }}
69
63
  />
package/toggle/AGENTS.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ```
4
4
  받기 npx @pantoia/ui add toggle
5
5
  층 ui
6
- 파일 toggle/index.tsx · toggle/AGENTS.md
6
+ 파일 toggle/index.tsx, toggle/AGENTS.md
7
7
  ```
8
8
 
9
9
  ## 부위
@@ -20,13 +20,13 @@
20
20
 
21
21
  | 이름 | 타입 | 필수 |
22
22
  |---|---|---|
23
- | `surface` | `'bare' \| 'canvas'` | |
23
+ | `surface` | `'bare' \| 'well' \| 'panel'` | |
24
24
 
25
- ## 변형 — `toggle`
25
+ ## 변형 - `toggle`
26
26
 
27
27
  | 축 | 값 | 기본 |
28
28
  |---|---|---|
29
- | `surface` | `bare` · `canvas` | `bare` |
29
+ | `surface` | `bare`, `well`, `panel` | `bare` |
30
30
 
31
31
  ## 함께 받는 것
32
32
 
package/toggle/index.tsx CHANGED
@@ -10,17 +10,18 @@ export const toggle = tv({
10
10
  + ' [&_svg]:size-4'
11
11
  + ' ring-1 ring-inset ring-line-strong transition-state press press-shrink'
12
12
  + ' text-fg-muted'
13
- + ' enabled:hover:bg-hover'
14
- + ' on:bg-control-on on:ring-control-on on:enabled:text-fg-on-control'
15
- + ' on:enabled:hover:bg-control-on-hover'
16
- + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
13
+ + ' enabled:hover:bg-bg-neutral-hover'
14
+ + ' on:bg-bg-neutral-solid on:ring-line-neutral-solid on:enabled:text-fg-neutral-solid-contrast'
15
+ + ' on:enabled:hover:bg-bg-neutral-solid-hover'
16
+ + ' focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-line-focus-ring'
17
17
  + ' disabled:text-fg-disabled disabled:ring-line disabled:cursor-not-allowed'
18
- + ' on:disabled:bg-control-on-disabled on:disabled:ring-control-on-disabled on:disabled:text-fg-on-control',
18
+ + ' on:disabled:bg-bg-neutral-solid-checked-disabled on:disabled:ring-transparent on:disabled:text-fg-neutral-solid-contrast',
19
19
 
20
20
  variants: {
21
21
  surface: {
22
22
  bare: '',
23
- canvas: 'bg-canvas',
23
+ well: 'bg-bg-well',
24
+ panel: 'bg-bg-panel',
24
25
  },
25
26
  },
26
27
 
@@ -28,7 +29,7 @@ export const toggle = tv({
28
29
  })
29
30
 
30
31
  export interface ToggleProps extends ComponentProps<typeof TogglePrimitive.Root> {
31
- surface?: 'bare' | 'canvas'
32
+ surface?: 'bare' | 'well' | 'panel'
32
33
  }
33
34
 
34
35
  export function Toggle({ surface, className, ...rest }: ToggleProps) {