@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/tokens.css ADDED
@@ -0,0 +1,272 @@
1
+ :root, .light {
2
+ --pds-bg: #ffffff;
3
+ --pds-bg-overlay: rgba(0,0,0,0.2);
4
+ --pds-bg-panel: #ffffff;
5
+ --pds-bg-well: #f2f4f6;
6
+
7
+ --pds-bg-brand-solid: var(--pds-brand-500);
8
+ --pds-bg-brand-solid-hover: var(--pds-brand-600);
9
+ --pds-bg-brand-weak: var(--pds-brand-50);
10
+ --pds-bg-danger-solid: var(--pds-red-500);
11
+ --pds-bg-danger-solid-hover: var(--pds-red-600);
12
+ --pds-bg-danger-weak: var(--pds-red-50);
13
+ --pds-bg-info-solid: var(--pds-blue-500);
14
+ --pds-bg-info-weak: var(--pds-blue-50);
15
+ --pds-bg-neutral-disabled: var(--pds-gray-200);
16
+ --pds-bg-neutral-hover: rgba(0,23,51,0.02);
17
+ --pds-bg-neutral-knob: #ffffff;
18
+ --pds-bg-neutral-selected: rgba(2,32,71,0.05);
19
+ --pds-bg-neutral-selected-hover: rgba(0,27,55,0.1);
20
+ --pds-bg-neutral-solid: var(--pds-gray-900);
21
+ --pds-bg-neutral-solid-checked-disabled: var(--pds-gray-600);
22
+ --pds-bg-neutral-solid-hover: var(--pds-gray-800);
23
+ --pds-bg-success-solid: var(--pds-green-500);
24
+ --pds-bg-success-weak: var(--pds-green-50);
25
+ --pds-bg-warning-solid: var(--pds-orange-500);
26
+ --pds-bg-warning-weak: var(--pds-orange-50);
27
+
28
+ --pds-fg-brand-contrast: var(--pds-brand-700);
29
+ --pds-fg-brand-solid-contrast: #ffffff;
30
+ --pds-fg-danger: var(--pds-red-500);
31
+ --pds-fg-danger-contrast: var(--pds-red-700);
32
+ --pds-fg-info: var(--pds-blue-500);
33
+ --pds-fg-info-contrast: var(--pds-blue-700);
34
+ --pds-fg-neutral-solid-contrast: var(--pds-gray-50);
35
+ --pds-fg-success: var(--pds-green-500);
36
+ --pds-fg-success-contrast: var(--pds-green-700);
37
+ --pds-fg-warning: var(--pds-orange-500);
38
+ --pds-fg-warning-contrast: var(--pds-orange-700);
39
+
40
+ --pds-line-brand-weak: var(--pds-brand-200);
41
+ --pds-line-danger: var(--pds-red-500);
42
+ --pds-line-danger-weak: var(--pds-red-200);
43
+ --pds-line-focus-ring: var(--pds-blue-500);
44
+ --pds-line-info: var(--pds-blue-500);
45
+ --pds-line-info-weak: var(--pds-blue-200);
46
+ --pds-line-neutral-solid: var(--pds-gray-900);
47
+ --pds-line-strong: var(--pds-gray-300);
48
+ --pds-line-success: var(--pds-green-500);
49
+ --pds-line-success-weak: var(--pds-green-200);
50
+ --pds-line-warning: var(--pds-orange-500);
51
+ --pds-line-warning-weak: var(--pds-orange-200);
52
+
53
+ --pds-black: #000000;
54
+ --pds-fg: var(--pds-gray-900);
55
+ --pds-fg-disabled: var(--pds-gray-600);
56
+ --pds-fg-muted: var(--pds-gray-700);
57
+ --pds-fg-placeholder: var(--pds-gray-400);
58
+ --pds-fg-subtle: var(--pds-gray-500);
59
+ --pds-line: var(--pds-gray-200);
60
+ --pds-white: #ffffff;
61
+ }
62
+
63
+ .dark {
64
+ --pds-bg: #17171c;
65
+ --pds-bg-overlay: rgba(0,0,0,0.56);
66
+ --pds-bg-panel: #202027;
67
+ --pds-bg-well: #101013;
68
+
69
+ --pds-bg-brand-solid: var(--pds-brand-500);
70
+ --pds-bg-brand-solid-hover: var(--pds-brand-600);
71
+ --pds-bg-brand-weak: var(--pds-brand-50);
72
+ --pds-bg-danger-solid: var(--pds-red-500);
73
+ --pds-bg-danger-solid-hover: var(--pds-red-600);
74
+ --pds-bg-danger-weak: var(--pds-red-50);
75
+ --pds-bg-info-solid: var(--pds-blue-500);
76
+ --pds-bg-info-weak: var(--pds-blue-50);
77
+ --pds-bg-neutral-disabled: var(--pds-gray-200);
78
+ --pds-bg-neutral-hover: rgba(209,209,253,0.05);
79
+ --pds-bg-neutral-knob: #2c2c35;
80
+ --pds-bg-neutral-selected: rgba(217,217,255,0.11);
81
+ --pds-bg-neutral-selected-hover: rgba(222,222,255,0.19);
82
+ --pds-bg-neutral-solid: var(--pds-gray-900);
83
+ --pds-bg-neutral-solid-checked-disabled: var(--pds-gray-600);
84
+ --pds-bg-neutral-solid-hover: var(--pds-gray-800);
85
+ --pds-bg-success-solid: var(--pds-green-500);
86
+ --pds-bg-success-weak: var(--pds-green-50);
87
+ --pds-bg-warning-solid: var(--pds-orange-500);
88
+ --pds-bg-warning-weak: var(--pds-orange-50);
89
+
90
+ --pds-fg-brand-contrast: var(--pds-brand-700);
91
+ --pds-fg-brand-solid-contrast: #ffffff;
92
+ --pds-fg-danger: var(--pds-red-500);
93
+ --pds-fg-danger-contrast: var(--pds-red-700);
94
+ --pds-fg-info: var(--pds-blue-500);
95
+ --pds-fg-info-contrast: var(--pds-blue-700);
96
+ --pds-fg-neutral-solid-contrast: var(--pds-gray-50);
97
+ --pds-fg-success: var(--pds-green-500);
98
+ --pds-fg-success-contrast: var(--pds-green-700);
99
+ --pds-fg-warning: var(--pds-orange-500);
100
+ --pds-fg-warning-contrast: var(--pds-orange-700);
101
+
102
+ --pds-line-brand-weak: var(--pds-brand-200);
103
+ --pds-line-danger: var(--pds-red-500);
104
+ --pds-line-danger-weak: var(--pds-red-200);
105
+ --pds-line-focus-ring: var(--pds-blue-500);
106
+ --pds-line-info: var(--pds-blue-500);
107
+ --pds-line-info-weak: var(--pds-blue-200);
108
+ --pds-line-neutral-solid: var(--pds-gray-900);
109
+ --pds-line-strong: var(--pds-gray-300);
110
+ --pds-line-success: var(--pds-green-500);
111
+ --pds-line-success-weak: var(--pds-green-200);
112
+ --pds-line-warning: var(--pds-orange-500);
113
+ --pds-line-warning-weak: var(--pds-orange-200);
114
+
115
+ --pds-black: #000000;
116
+ --pds-fg: var(--pds-gray-900);
117
+ --pds-fg-disabled: var(--pds-gray-600);
118
+ --pds-fg-muted: var(--pds-gray-700);
119
+ --pds-fg-placeholder: var(--pds-gray-400);
120
+ --pds-fg-subtle: var(--pds-gray-500);
121
+ --pds-line: var(--pds-gray-200);
122
+ --pds-white: #ffffff;
123
+ }
124
+
125
+ @theme inline {
126
+ --color-bg: var(--pds-bg);
127
+ --color-bg-overlay: var(--pds-bg-overlay);
128
+ --color-bg-panel: var(--pds-bg-panel);
129
+ --color-bg-well: var(--pds-bg-well);
130
+ --color-bg-brand-solid: var(--pds-bg-brand-solid);
131
+ --color-bg-brand-solid-hover: var(--pds-bg-brand-solid-hover);
132
+ --color-bg-brand-weak: var(--pds-bg-brand-weak);
133
+ --color-bg-danger-solid: var(--pds-bg-danger-solid);
134
+ --color-bg-danger-solid-hover: var(--pds-bg-danger-solid-hover);
135
+ --color-bg-danger-weak: var(--pds-bg-danger-weak);
136
+ --color-bg-info-solid: var(--pds-bg-info-solid);
137
+ --color-bg-info-weak: var(--pds-bg-info-weak);
138
+ --color-bg-neutral-disabled: var(--pds-bg-neutral-disabled);
139
+ --color-bg-neutral-hover: var(--pds-bg-neutral-hover);
140
+ --color-bg-neutral-knob: var(--pds-bg-neutral-knob);
141
+ --color-bg-neutral-selected: var(--pds-bg-neutral-selected);
142
+ --color-bg-neutral-selected-hover: var(--pds-bg-neutral-selected-hover);
143
+ --color-bg-neutral-solid: var(--pds-bg-neutral-solid);
144
+ --color-bg-neutral-solid-checked-disabled: var(--pds-bg-neutral-solid-checked-disabled);
145
+ --color-bg-neutral-solid-hover: var(--pds-bg-neutral-solid-hover);
146
+ --color-bg-success-solid: var(--pds-bg-success-solid);
147
+ --color-bg-success-weak: var(--pds-bg-success-weak);
148
+ --color-bg-warning-solid: var(--pds-bg-warning-solid);
149
+ --color-bg-warning-weak: var(--pds-bg-warning-weak);
150
+ --color-fg-brand-contrast: var(--pds-fg-brand-contrast);
151
+ --color-fg-brand-solid-contrast: var(--pds-fg-brand-solid-contrast);
152
+ --color-fg-danger: var(--pds-fg-danger);
153
+ --color-fg-danger-contrast: var(--pds-fg-danger-contrast);
154
+ --color-fg-info: var(--pds-fg-info);
155
+ --color-fg-info-contrast: var(--pds-fg-info-contrast);
156
+ --color-fg-neutral-solid-contrast: var(--pds-fg-neutral-solid-contrast);
157
+ --color-fg-success: var(--pds-fg-success);
158
+ --color-fg-success-contrast: var(--pds-fg-success-contrast);
159
+ --color-fg-warning: var(--pds-fg-warning);
160
+ --color-fg-warning-contrast: var(--pds-fg-warning-contrast);
161
+ --color-line-brand-weak: var(--pds-line-brand-weak);
162
+ --color-line-danger: var(--pds-line-danger);
163
+ --color-line-danger-weak: var(--pds-line-danger-weak);
164
+ --color-line-focus-ring: var(--pds-line-focus-ring);
165
+ --color-line-info: var(--pds-line-info);
166
+ --color-line-info-weak: var(--pds-line-info-weak);
167
+ --color-line-neutral-solid: var(--pds-line-neutral-solid);
168
+ --color-line-strong: var(--pds-line-strong);
169
+ --color-line-success: var(--pds-line-success);
170
+ --color-line-success-weak: var(--pds-line-success-weak);
171
+ --color-line-warning: var(--pds-line-warning);
172
+ --color-line-warning-weak: var(--pds-line-warning-weak);
173
+ --color-black: var(--pds-black);
174
+ --color-fg: var(--pds-fg);
175
+ --color-fg-disabled: var(--pds-fg-disabled);
176
+ --color-fg-muted: var(--pds-fg-muted);
177
+ --color-fg-placeholder: var(--pds-fg-placeholder);
178
+ --color-fg-subtle: var(--pds-fg-subtle);
179
+ --color-line: var(--pds-line);
180
+ --color-white: var(--pds-white);
181
+ }
182
+
183
+ @theme {
184
+ --font-weight-normal: 400;
185
+ --font-weight-medium: 500;
186
+ --font-weight-bold: 700;
187
+
188
+ --font-sans: "Pretendard Variable", "Pretendard", -apple-system, system-ui, sans-serif;
189
+ --font-mono: "JetBrains Mono", "Pretendard Variable", "Pretendard", ui-monospace, monospace;
190
+
191
+ --text-display: 28px; --text-display--line-height: 38px; --text-display--font-weight: 700;
192
+ --text-title: 24px; --text-title--line-height: 32px; --text-title--font-weight: 700;
193
+ --text-section: 20px; --text-section--line-height: 27px; --text-section--font-weight: 700;
194
+ --text-subsection: 16px; --text-subsection--line-height: 22px; --text-subsection--font-weight: 700;
195
+ --text-label: 14px; --text-label--line-height: 19px; --text-label--font-weight: 500;
196
+ --text-caption: 13px; --text-caption--line-height: 18px; --text-caption--font-weight: 400;
197
+ --text-micro: 11px; --text-micro--line-height: 15px; --text-micro--font-weight: 500;
198
+
199
+ --text-t10: 10px; --text-t10--line-height: 14px; --text-t10--font-weight: 400;
200
+ --text-t11: 11px; --text-t11--line-height: 15px; --text-t11--font-weight: 400;
201
+ --text-t12: 12px; --text-t12--line-height: 16px; --text-t12--font-weight: 400;
202
+ --text-t13: 13px; --text-t13--line-height: 18px; --text-t13--font-weight: 400;
203
+ --text-t14: 14px; --text-t14--line-height: 19px; --text-t14--font-weight: 400;
204
+ --text-t16: 16px; --text-t16--line-height: 22px; --text-t16--font-weight: 400;
205
+ --text-t18: 18px; --text-t18--line-height: 24px; --text-t18--font-weight: 400;
206
+ --text-t20: 20px; --text-t20--line-height: 27px; --text-t20--font-weight: 400;
207
+ --text-t24: 24px; --text-t24--line-height: 32px; --text-t24--font-weight: 400;
208
+ --text-t28: 28px; --text-t28--line-height: 38px; --text-t28--font-weight: 400;
209
+ --text-t32: 32px; --text-t32--line-height: 43px; --text-t32--font-weight: 400;
210
+ --text-t40: 40px; --text-t40--line-height: 54px; --text-t40--font-weight: 400;
211
+ --text-t48: 48px; --text-t48--line-height: 65px; --text-t48--font-weight: 400;
212
+ --text-t56: 56px; --text-t56--line-height: 76px; --text-t56--font-weight: 400;
213
+ --text-t64: 64px; --text-t64--line-height: 86px; --text-t64--font-weight: 400;
214
+ }
215
+
216
+ :root {
217
+ --pds-prose: 16px; --pds-prose-lh: 24px;
218
+ --pds-value: 16px; --pds-value-lh: 22px;
219
+
220
+ @variant sm { --pds-prose: 14px; --pds-prose-lh: 22px; }
221
+ @variant sm { --pds-value: 14px; --pds-value-lh: 19px; }
222
+ }
223
+
224
+ @theme {
225
+ --breakpoint-xs: 30rem;
226
+ }
227
+
228
+ @theme {
229
+ --spacing-tight: 4px;
230
+ --spacing-stack: 16px;
231
+ --spacing-block: 32px;
232
+ --spacing-section: 48px;
233
+ --spacing-gutter: 16px;
234
+ }
235
+
236
+ @theme {
237
+ --radius-r2: 2px; --radius-r4: 4px; --radius-r6: 6px;
238
+ --radius-r8: 8px; --radius-r10: 10px; --radius-r12: 12px;
239
+ --radius-r14: 14px; --radius-r16: 16px; --radius-r20: 20px;
240
+ --radius-r24: 24px;
241
+ }
242
+
243
+ @theme {
244
+ --ease-state: cubic-bezier(.35, 0, .65, 1);
245
+ --ease-enter: cubic-bezier(0, 0, .15, 1);
246
+ --ease-exit: cubic-bezier(.35, 0, 1, 1);
247
+ }
248
+
249
+ :root {
250
+ --dur-state: 150ms;
251
+ --dur-enter: 200ms;
252
+ --dur-exit: 150ms;
253
+ --enter-scale: 0.95;
254
+ --draw-len: 24;
255
+ --scale-press: 0.97;
256
+ }
257
+
258
+ @media (prefers-reduced-motion: reduce) {
259
+ :root:root { --enter-scale: 1; --scale-press: 1; }
260
+ }
261
+
262
+ @theme {
263
+ --shadow-s1: 0 1px 4px 0 var(--pds-shadow-1);
264
+ --shadow-s2: 0 2px 10px 0 var(--pds-shadow-2);
265
+ --shadow-s3: 0 4px 16px 0 var(--pds-shadow-3);
266
+ }
267
+
268
+ :root, .light { --pds-shadow-1:#00000014; --pds-shadow-2:#0000001a; --pds-shadow-3:#0000001f; }
269
+ .dark { --pds-shadow-1:#00000080; --pds-shadow-2:#000000ad; --pds-shadow-3:#000000cc; }
270
+
271
+ :root, .light { --pds-pressed-dim: rgba(0,23,51,0.12); }
272
+ .dark { --pds-pressed-dim: rgba(209,209,253,0.14); }
package/tooltip/AGENTS.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ```
4
4
  받기 npx @pantoia/ui add tooltip
5
5
  층 ui
6
- 파일 tooltip/index.tsx · tooltip/AGENTS.md
6
+ 파일 tooltip/index.tsx, tooltip/AGENTS.md
7
7
  ```
8
8
 
9
9
  ## 부위
@@ -11,7 +11,7 @@
11
11
  | 이름 | props |
12
12
  |---|---|
13
13
  | `Tooltip` | `TooltipProps` |
14
- | `TooltipTrigger` | — |
14
+ | `TooltipTrigger` | - |
15
15
  | `TooltipContent` | `TooltipContentProps` |
16
16
 
17
17
  ### `TooltipTrigger`
package/tooltip/index.tsx CHANGED
@@ -32,6 +32,12 @@ export interface TooltipContentProps extends Omit<ComponentProps<typeof TooltipP
32
32
  arrow?: boolean
33
33
  }
34
34
 
35
+ const tooltipContent = tv({
36
+ base: 'float text-fg rounded-r12 z-overlay'
37
+ + ' text-caption max-w-64 px-3 py-1'
38
+ + ' open:animate-enter closed:animate-exit',
39
+ })
40
+
35
41
  export function TooltipContent({
36
42
  side = 'top',
37
43
  arrow = true,
@@ -45,12 +51,16 @@ export function TooltipContent({
45
51
  {...rest}
46
52
  side={side}
47
53
  sideOffset={6}
48
- className={tv({ base: 'bg-float text-fg rounded-r12 shadow-s3 z-overlay'
49
- + ' text-caption max-w-64 px-3 py-1'
50
- + ' open:animate-enter closed:animate-exit' })({ className })}
54
+ className={tooltipContent({ className })}
51
55
  >
52
56
  {children}
53
- {arrow && <TooltipPrimitive.Arrow className="fill-float" width={10} height={5} />}
57
+ {arrow && (
58
+ <TooltipPrimitive.Arrow asChild width={10} height={5}>
59
+ <svg viewBox="0 0 12 6" preserveAspectRatio="none" className="fill-bg-panel -translate-y-px">
60
+ <path d="M0 0L4.58579 4.58579C5.36683 5.36683 6.63316 5.36684 7.41421 4.58579L12 0" className="stroke-line stroke-1" />
61
+ </svg>
62
+ </TooltipPrimitive.Arrow>
63
+ )}
54
64
  </TooltipPrimitive.Content>
55
65
  </TooltipPrimitive.Portal>
56
66
  )
package/tv.ts CHANGED
@@ -7,7 +7,6 @@ export const tv = createTV({
7
7
  theme: {
8
8
  spacing: ['tight', 'stack', 'block', 'section', 'gutter'],
9
9
  radius: [
10
- 'mark', 'well', 'panel', 'float',
11
10
  'r2', 'r4', 'r6', 'r8', 'r10', 'r12', 'r14', 'r16', 'r20', 'r24',
12
11
  ],
13
12
  text: [
package/utilities.css ADDED
@@ -0,0 +1,119 @@
1
+ @custom-variant dark (&:where(.dark, .dark *):not(:where(.light, .light *)));
2
+
3
+ @custom-variant current (&[aria-current="page"]);
4
+
5
+ @custom-variant invalid (&[aria-invalid="true"]);
6
+
7
+ @custom-variant invalid-within (&:has([aria-invalid="true"]));
8
+
9
+ @custom-variant in-invalid (&:where([aria-invalid="true"] *));
10
+
11
+ @custom-variant described (&:has([data-description]));
12
+
13
+ @custom-variant checked (&:where([data-state="checked"], [data-state="indeterminate"]));
14
+ @custom-variant open (&[data-state="open"]);
15
+ @custom-variant closed (&[data-state="closed"]);
16
+ @custom-variant on (&[data-state="on"]);
17
+ @custom-variant selected (&[data-selected]:not([data-selected="false"]));
18
+ @custom-variant unset (&[data-placeholder]);
19
+
20
+ @custom-variant menu-gutter (.menu:has(.menu-lead) &:not(:has(.menu-lead)));
21
+
22
+ @layer base {
23
+ :root { color-scheme: light; }
24
+ .dark { color-scheme: dark; }
25
+
26
+ body {
27
+ background-color: var(--color-bg);
28
+ color: var(--color-fg);
29
+ font-family: var(--font-sans);
30
+ }
31
+
32
+ code, pre, kbd, samp { font-family: var(--font-mono); }
33
+ }
34
+
35
+ @utility text-prose {
36
+ font-size: var(--pds-prose);
37
+ line-height: var(--tw-leading, var(--pds-prose-lh));
38
+ font-weight: var(--tw-font-weight, 400);
39
+ }
40
+
41
+ @utility text-value {
42
+ font-size: var(--pds-value);
43
+ line-height: var(--tw-leading, var(--pds-value-lh));
44
+ font-weight: var(--tw-font-weight, 400);
45
+ }
46
+
47
+ @utility transition-state {
48
+ transition-property: color, background-color, box-shadow, scale;
49
+ transition-duration: var(--dur-state);
50
+ transition-timing-function: var(--ease-state);
51
+ }
52
+
53
+ @keyframes enter { from { opacity: 0; scale: var(--enter-scale); } }
54
+ @keyframes exit { to { opacity: 0; scale: var(--enter-scale); } }
55
+
56
+ @utility animate-enter { animation: enter var(--dur-enter) var(--ease-enter); }
57
+ @utility animate-exit { animation: exit var(--dur-exit) var(--ease-exit); }
58
+
59
+ @keyframes draw { from { stroke-dashoffset: var(--draw-len); } }
60
+
61
+ @utility animate-draw {
62
+ stroke-dasharray: var(--draw-len);
63
+ animation: draw var(--dur-enter) var(--ease-enter);
64
+ }
65
+
66
+ @keyframes fade-in { from { opacity: 0; } }
67
+ @keyframes fade-out { to { opacity: 0; } }
68
+
69
+ @utility animate-fade-in { animation: fade-in var(--dur-enter) var(--ease-enter); }
70
+ @utility animate-fade-out { animation: fade-out var(--dur-exit) var(--ease-exit); }
71
+
72
+ @utility z-sticky { z-index: 10; }
73
+ @utility z-overlay { z-index: 50; }
74
+ @utility z-toast { z-index: 60; }
75
+
76
+ @utility frame {
77
+ @apply bg-bg-panel border border-line;
78
+ }
79
+
80
+ @utility card {
81
+ @apply bg-bg-panel shadow-s3;
82
+ }
83
+
84
+ @utility float {
85
+ @apply bg-bg-panel border border-line shadow-s3;
86
+ }
87
+
88
+ @utility sheet {
89
+ @apply bg-bg-panel;
90
+ }
91
+
92
+ @utility press {
93
+ position: relative;
94
+
95
+ &::after {
96
+ content: "";
97
+ position: absolute;
98
+ inset: 0;
99
+ border-radius: inherit;
100
+ background: var(--pds-pressed-dim);
101
+ opacity: 0;
102
+ pointer-events: none;
103
+ transition: opacity var(--dur-state) var(--ease-state);
104
+ }
105
+
106
+ &:active:not(:disabled):not([aria-disabled="true"])::after,
107
+ &[data-pressed]:not(:disabled):not([aria-disabled="true"])::after {
108
+ opacity: 1;
109
+ transition-duration: 0s;
110
+ }
111
+ }
112
+
113
+ @utility press-shrink {
114
+ &:active:not(:disabled):not([aria-disabled="true"]),
115
+ &[data-pressed]:not(:disabled):not([aria-disabled="true"]) {
116
+ scale: var(--scale-press);
117
+ transition-duration: 0s;
118
+ }
119
+ }
@@ -1,60 +0,0 @@
1
- # CodeBlock
2
-
3
- ```
4
- 받기 npx @pantoia/ui add code-block
5
- 층 ui
6
- 파일 code-block/index.tsx · code-block/index.module.css · code-block/AGENTS.md
7
- ```
8
-
9
- ## 부위
10
-
11
- | 이름 | props |
12
- |---|---|
13
- | `CodeBlock` | `CodeBlockProps` |
14
- | `CodeBlockHeader` | — |
15
-
16
- ### `CodeBlockHeader`
17
-
18
- | 이름 | 타입 | 필수 |
19
- |---|---|---|
20
- | `className` | `string` | |
21
- | `children` | `ReactNode` | |
22
-
23
- ## props
24
-
25
- ### `CodeBlockFold`
26
-
27
- | 이름 | 타입 | 필수 |
28
- |---|---|---|
29
- | `maxLines` | `number` | 예 |
30
- | `more` | `string` | 예 |
31
- | `moreCount` | `string` | 예 |
32
- | `less` | `string` | 예 |
33
-
34
- ### `CodeBlockProps`
35
-
36
- | 이름 | 타입 | 필수 |
37
- |---|---|---|
38
- | `code` | `string` | 예 |
39
- | `wrap` | `boolean` | |
40
- | `numbers` | `boolean` | |
41
- | `fold` | `CodeBlockFold` | |
42
- | `className` | `string` | |
43
- | `header` | `ReactNode` | |
44
- | `line` | `(line: string, index: number) => ReactNode` | |
45
-
46
- ## 변형 — `codeBlock`
47
-
48
- 슬롯 `root` · `viewport` · `pre` · `chevron`
49
-
50
- | 축 | 값 | 기본 |
51
- |---|---|---|
52
- | `folded` | `false` | — |
53
-
54
- ## 함께 받는 것
55
-
56
- `tv`
57
-
58
- ## npm 의존
59
-
60
- `lucide-react`
@@ -1,46 +0,0 @@
1
- .code {
2
- margin: 0;
3
- padding: 1rem;
4
- counter-reset: ln;
5
-
6
- --code-block-keyword: var(--purple-700);
7
- --code-block-name: var(--orange-800);
8
- --code-block-string: var(--green-800);
9
- --code-block-comment: var(--gray-500);
10
- --code-block-value: var(--blue-700);
11
- }
12
-
13
- .code-keyword { color: var(--code-block-keyword); }
14
- .code-name { color: var(--code-block-name); }
15
- .code-string { color: var(--code-block-string); }
16
- .code-comment { color: var(--code-block-comment); }
17
- .code-value { color: var(--code-block-value); }
18
- .line { display: block; white-space: pre; min-height: 1lh; }
19
- .wrap .line { white-space: pre-wrap; word-break: break-all; }
20
-
21
- .numbers { padding-left: 0; }
22
- .numbers .line::before {
23
- counter-increment: ln;
24
- content: counter(ln);
25
- display: inline-block;
26
- width: 3.4em;
27
- padding-right: 0.9em;
28
- text-align: right;
29
- color: var(--color-fg-subtle);
30
- user-select: none;
31
- pointer-events: none;
32
- }
33
-
34
- .numbers:not(.wrap) .line::before {
35
- position: sticky;
36
- left: 0;
37
- background: var(--color-well);
38
- }
39
-
40
- .numbers.wrap .line { padding-left: 3.4em; text-indent: -3.4em; }
41
-
42
- .clip {
43
- max-height: calc(var(--code-block-max-lines) * 1lh + 2rem);
44
- overflow-y: hidden;
45
- mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5rem), transparent);
46
- }
@@ -1,127 +0,0 @@
1
- 'use client'
2
-
3
- import { ChevronDown } from 'lucide-react'
4
- import { useCallback, useState, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react'
5
-
6
- import { tv } from '../tv'
7
-
8
- import s from './index.module.css'
9
-
10
- export const codeToken = {
11
- keyword: s['code-keyword'],
12
- name: s['code-name'],
13
- string: s['code-string'],
14
- comment: s['code-comment'],
15
- value: s['code-value'],
16
- none: '',
17
- } as const
18
-
19
- export interface CodeBlockFold {
20
- maxLines: number
21
- more: string
22
- moreCount: string
23
- less: string
24
- }
25
-
26
- export const codeBlock = tv({
27
- slots: {
28
- root: 'bg-well rounded-well text-value font-mono overflow-hidden',
29
- viewport: 'scroll-slim overflow-auto'
30
- + ' focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring',
31
- pre: '',
32
- chevron: 'size-4 transition-transform motion-reduce:transition-none',
33
- },
34
-
35
- variants: {
36
- folded: { false: { chevron: 'rotate-180' } },
37
- },
38
- })
39
-
40
- export interface CodeBlockProps {
41
- code: string
42
- wrap?: boolean
43
- numbers?: boolean
44
- fold?: CodeBlockFold
45
- className?: string
46
- header?: ReactNode
47
- line?: (line: string, index: number) => ReactNode
48
- }
49
-
50
- export function CodeBlock({
51
- code,
52
- wrap = false,
53
- numbers = false,
54
- fold,
55
- className,
56
- header,
57
- line,
58
- }: CodeBlockProps) {
59
- const [folded, setFolded] = useState(true)
60
- const [box, setBox] = useState<HTMLDivElement | null>(null)
61
-
62
- const subscribe = useCallback((onChange: () => void) => {
63
- if (!box) return () => {}
64
- const observer = new ResizeObserver(onChange)
65
- observer.observe(box)
66
- if (box.firstElementChild) observer.observe(box.firstElementChild)
67
- return () => observer.disconnect()
68
- }, [box])
69
-
70
- const overflows = useSyncExternalStore(
71
- subscribe,
72
- () => box !== null && (box.scrollWidth > box.clientWidth || box.scrollHeight > box.clientHeight),
73
- () => false,
74
- )
75
-
76
- const lines = code.split('\n')
77
- const foldable = !!fold && lines.length > fold.maxLines
78
- const rest = lines.length - (fold?.maxLines ?? 0)
79
-
80
- const ui = codeBlock({ folded })
81
-
82
- const pre = [s.code, wrap ? s.wrap : '', numbers ? s.numbers : '', ui.pre()]
83
- .filter(Boolean).join(' ')
84
-
85
- const viewport = [ui.viewport(), foldable && folded ? s.clip : '']
86
- .filter(Boolean).join(' ')
87
-
88
- return (
89
- <div className={ui.root({ className })}>
90
- {header}
91
-
92
- <div
93
- ref={setBox}
94
- tabIndex={overflows ? 0 : undefined}
95
- className={viewport}
96
- style={{ '--code-block-max-lines': fold?.maxLines } as CSSProperties}
97
- ><pre className={pre}>{lines.map((text, i) => (
98
- <span key={i} className={s.line}>{line ? line(text, i) : text}</span>
99
- ))}</pre></div>
100
-
101
- {foldable && (
102
- <button
103
- type="button"
104
- className="border-line text-caption text-fg-muted flex w-full items-center justify-center
105
- gap-tight border-t py-2 transition-state press
106
- enabled:hover:bg-hover
107
- focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
108
- onClick={() => setFolded(!folded)}
109
- >
110
- <ChevronDown className={ui.chevron()} />
111
- {folded ? (wrap ? fold.more : fold.moreCount.replace('{count}', String(rest))) : fold.less}
112
- </button>
113
- )}
114
- </div>
115
- )
116
- }
117
-
118
- export function CodeBlockHeader({ className, children }: { className?: string, children?: ReactNode }) {
119
- return (
120
- <div
121
- className={tv({ base: 'border-line text-caption text-fg-muted'
122
- + ' flex items-center gap-stack border-b px-4 py-2' })({ className })}
123
- >
124
- {children}
125
- </div>
126
- )
127
- }