raft-ui 0.0.8 → 0.0.9

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/dist/index.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  import { cn } from "./cn.mjs";
2
- import { a as tv, i as ThemeStateContext, n as useThemeFamily, r as ThemeContext, t as useTheme } from "./use-theme-Y_h1DKll.mjs";
2
+ import { a as useThemeFamily, c as tv, i as useTheme, n as buttonVariants, o as ThemeContext, r as Spinner, s as ThemeStateContext, t as Button } from "./button-jUlaK4eN.mjs";
3
3
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
4
4
  import { AlertTriangle, Check, CheckCircle2, ChevronDown, Copy, Info, Minus, X } from "lucide-react";
5
5
  import { createContext, use, useCallback, useContext, useEffect, useId, useMemo, useState, useSyncExternalStore } from "react";
6
- import { Button as Button$1 } from "@base-ui/react/button";
7
6
  import { mergeProps } from "@base-ui/react/merge-props";
8
7
  import { useRender } from "@base-ui/react/use-render";
9
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
10
9
  import { useClipboard } from "foxact/use-clipboard";
11
10
  import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
12
11
  import { Avatar as Avatar$1, ContextMenu as ContextMenu$1 } from "@base-ui/react";
@@ -24,612 +23,19 @@ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
24
23
  import { DndContext, PointerSensor, TouchSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
25
24
  import { SortableContext, arrayMove, horizontalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
26
25
  import { Separator as Separator$1 } from "@base-ui/react/separator";
27
- //#region src/components/spinner/spinner.tsx
28
- const SPINNER_STYLE = `
29
- @keyframes raft-braille-spinner {
30
- 0%,
31
- 9.99% {
32
- content: "⠋";
33
- }
34
- 10%,
35
- 19.99% {
36
- content: "⠙";
37
- }
38
- 20%,
39
- 29.99% {
40
- content: "⠹";
41
- }
42
- 30%,
43
- 39.99% {
44
- content: "⠸";
45
- }
46
- 40%,
47
- 49.99% {
48
- content: "⠼";
49
- }
50
- 50%,
51
- 59.99% {
52
- content: "⠴";
53
- }
54
- 60%,
55
- 69.99% {
56
- content: "⠦";
57
- }
58
- 70%,
59
- 79.99% {
60
- content: "⠧";
61
- }
62
- 80%,
63
- 89.99% {
64
- content: "⠇";
65
- }
66
- 90%,
67
- 100% {
68
- content: "⠏";
69
- }
70
- }
71
-
72
- [data-slot="spinner"] [data-spinner-glyph]::before {
73
- content: "⠋";
74
- animation: raft-braille-spinner 800ms steps(1, end) infinite;
75
- }
76
-
77
- @media (prefers-reduced-motion: reduce) {
78
- [data-slot="spinner"] [data-spinner-glyph]::before {
79
- animation-duration: 1600ms;
80
- }
81
- }
82
-
83
- @keyframes raft-elegant-spinner-spin {
84
- to {
85
- transform: rotate(360deg);
86
- }
87
- }
88
-
89
- @keyframes raft-elegant-spinner-dash {
90
- 0% {
91
- stroke-dasharray: 1 150;
92
- stroke-dashoffset: 0;
93
- }
94
- 50% {
95
- stroke-dasharray: 90 150;
96
- stroke-dashoffset: -35;
97
- }
98
- 100% {
99
- stroke-dasharray: 90 150;
100
- stroke-dashoffset: -124;
101
- }
102
- }
103
-
104
- [data-slot="spinner"] [data-spinner-ring] {
105
- animation: raft-elegant-spinner-spin 1600ms linear infinite;
106
- transform-box: fill-box;
107
- transform-origin: center;
108
- will-change: transform;
109
- }
110
-
111
- [data-slot="spinner"] [data-spinner-arc] {
112
- animation: raft-elegant-spinner-dash 1400ms cubic-bezier(0.42, 0, 0.58, 1) infinite;
113
- stroke-dasharray: 1 150;
114
- stroke-dashoffset: 0;
115
- }
116
-
117
- @media (prefers-reduced-motion: reduce) {
118
- [data-slot="spinner"] [data-spinner-ring] {
119
- animation-duration: 2400ms;
120
- will-change: auto;
121
- }
122
-
123
- [data-slot="spinner"] [data-spinner-arc] {
124
- animation: none;
125
- stroke-dasharray: 72 150;
126
- stroke-dashoffset: -30;
127
- }
128
- }
129
- `;
130
- const spinner = tv({
131
- slots: {
132
- root: ["relative inline-flex shrink-0 items-center justify-center", "leading-none text-current"],
133
- glyph: "inline-block min-w-[1ch] font-mono tabular-nums",
134
- ring: "block size-full shrink-0"
135
- },
136
- variants: {
137
- theme: {
138
- brutal: {},
139
- elegant: {}
140
- },
141
- size: {
142
- sm: {},
143
- lg: {}
144
- }
145
- },
146
- defaultVariants: { size: "sm" },
147
- compoundVariants: [
148
- {
149
- theme: "brutal",
150
- size: "sm",
151
- class: { root: "h-4 text-base" }
152
- },
153
- {
154
- theme: "brutal",
155
- size: "lg",
156
- class: { root: "h-6 text-xl" }
157
- },
158
- {
159
- theme: "elegant",
160
- size: "sm",
161
- class: { root: "size-3.5" }
162
- },
163
- {
164
- theme: "elegant",
165
- size: "lg",
166
- class: { root: "size-[18px]" }
167
- }
168
- ]
169
- });
170
- const spinnerStyle = /* @__PURE__ */ jsx("style", {
171
- href: "raft-ui-spinner",
172
- precedence: "default",
173
- children: SPINNER_STYLE
174
- });
175
- function Spinner({ size = "sm", className, render, ...props }) {
176
- const theme = useThemeFamily();
177
- const { root, glyph, ring } = spinner({
178
- theme,
179
- size
180
- });
181
- const children = theme === "elegant" ? /* @__PURE__ */ jsxs(Fragment, { children: [spinnerStyle, /* @__PURE__ */ jsxs("svg", {
182
- "data-spinner-ring": "",
183
- "aria-hidden": "true",
184
- className: ring(),
185
- xmlns: "http://www.w3.org/2000/svg",
186
- fill: "none",
187
- viewBox: "0 0 24 24",
188
- children: [/* @__PURE__ */ jsx("circle", {
189
- className: "opacity-20",
190
- cx: "12",
191
- cy: "12",
192
- r: "10",
193
- stroke: "currentColor",
194
- strokeWidth: "2.5"
195
- }), /* @__PURE__ */ jsx("circle", {
196
- "data-spinner-arc": "",
197
- className: "opacity-80",
198
- cx: "12",
199
- cy: "12",
200
- r: "10",
201
- fill: "none",
202
- pathLength: "150",
203
- stroke: "currentColor",
204
- strokeLinecap: "round",
205
- strokeWidth: "2.5"
206
- })]
207
- })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [spinnerStyle, /* @__PURE__ */ jsx("span", {
208
- "data-spinner-glyph": "",
209
- "aria-hidden": "true",
210
- className: glyph()
211
- })] });
212
- return useRender({
213
- defaultTagName: "span",
214
- render,
215
- props: mergeProps({
216
- role: "status",
217
- "aria-label": "Loading",
218
- className: root({ className }),
219
- children
220
- }, props),
221
- state: {
222
- slot: "spinner",
223
- size
224
- }
225
- });
226
- }
227
- //#endregion
228
- //#region src/components/button/button.tsx
229
- const buttonVariants = tv({
230
- slots: {
231
- root: [
232
- "relative inline-flex shrink-0 items-center justify-center",
233
- "font-heading leading-none whitespace-nowrap select-none",
234
- "border-line rounded-none",
235
- "shadow-sm transition-all duration-100",
236
- "outline outline-[1px] outline-offset-2 outline-transparent",
237
- "data-[loading=true]:cursor-wait",
238
- "disabled:pointer-events-none disabled:opacity-40 data-[loading=true]:opacity-100",
239
- "disabled:transform-none",
240
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
241
- ],
242
- content: "relative z-10 inline-flex items-center justify-center gap-[inherit] data-[loading=true]:invisible",
243
- loadingIndicator: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center"
244
- },
245
- variants: {
246
- theme: {
247
- brutal: { root: ["border-2 font-bold focus-visible:outline-transparent"] },
248
- elegant: { root: [
249
- "overflow-clip border-0 font-sans font-medium antialiased",
250
- "focus-visible:outline-[var(--button-focus-outline,transparent)]",
251
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
252
- "before:pointer-events-none before:absolute before:inset-0 before:z-0 before:rounded-[inherit]",
253
- "active:not-aria-[haspopup]:scale-[0.985]"
254
- ] }
255
- },
256
- variant: {
257
- primary: { root: ["border-line-strong bg-primary-400 text-primary-950", "hover:bg-primary-500"] },
258
- default: { root: ["border-line-strong bg-layer-panel text-foreground-strong", "hover:bg-layer-panel"] },
259
- information: { root: ["border-line-strong bg-info-base text-foreground-inverse", "hover:bg-info-base"] },
260
- muted: { root: ["border-line-strong bg-secondary-400 text-secondary-950", "hover:border-line-strong hover:bg-secondary-400"] },
261
- accent: { root: ["border-line-strong bg-accent-400 text-accent-950", "hover:bg-accent-500"] },
262
- warning: { root: ["border-line-strong bg-warning-base text-foreground-inverse", "hover:bg-warning-base"] },
263
- outline: { root: [
264
- "border-line-strong bg-transparent text-foreground-strong",
265
- "hover:bg-layer-muted",
266
- "shadow-none"
267
- ] },
268
- ghost: { root: ["border-transparent bg-transparent text-foreground shadow-none", "hover:border-line-strong hover:bg-layer-muted"] },
269
- link: { root: ["border-transparent bg-transparent text-foreground-strong shadow-none underline-offset-4", "hover:underline"] },
270
- "danger-secondary": { root: ["border-line-strong bg-danger-lighter text-danger-base", "hover:bg-danger-lighter"] },
271
- danger: { root: ["border-line-strong bg-danger-base text-foreground-inverse", "hover:border-[oklch(0.595_0.241_26.758)] hover:bg-[oklch(0.595_0.241_26.758)]"] },
272
- "danger-outline": { root: [
273
- "border-line-strong bg-transparent text-danger-base",
274
- "hover:bg-layer-muted",
275
- "shadow-none"
276
- ] }
277
- },
278
- size: {
279
- xs: { root: [
280
- "gap-1 px-2 py-[5px] text-[11px]",
281
- "has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5",
282
- "[&_svg:not([class*='size-'])]:size-3"
283
- ] },
284
- sm: { root: [
285
- "gap-1.5 px-2.5 py-[6px] text-xs",
286
- "has-data-[icon=inline-start]:pl-2 has-data-[icon=inline-end]:pr-2",
287
- "[&_svg:not([class*='size-'])]:size-3.5"
288
- ] },
289
- md: { root: ["gap-2 px-3 py-[7px] text-sm", "has-data-[icon=inline-start]:pl-2.5 has-data-[icon=inline-end]:pr-2.5"] },
290
- lg: { root: [
291
- "gap-2 px-3.5 py-2 text-base",
292
- "has-data-[icon=inline-start]:pl-3 has-data-[icon=inline-end]:pr-3",
293
- "[&_svg:not([class*='size-'])]:size-4"
294
- ] },
295
- "icon-xs": { root: ["p-[5px] text-[11px]", "[&_svg:not([class*='size-'])]:size-3"] },
296
- "icon-sm": { root: ["p-[6px] text-xs", "[&_svg:not([class*='size-'])]:size-3.5"] },
297
- "icon-md": { root: ["p-2 text-sm", "[&_svg:not([class*='size-'])]:size-4"] },
298
- "icon-lg": { root: ["p-3 text-sm", "[&_svg:not([class*='size-'])]:size-4"] }
299
- }
300
- },
301
- defaultVariants: {
302
- variant: "default",
303
- size: "md"
304
- },
305
- compoundVariants: [
306
- {
307
- theme: "elegant",
308
- size: ["xs", "icon-xs"],
309
- class: { root: "rounded-sm" }
310
- },
311
- {
312
- theme: "elegant",
313
- size: ["sm", "icon-sm"],
314
- class: { root: "rounded" }
315
- },
316
- {
317
- theme: "elegant",
318
- size: ["md", "icon-md"],
319
- class: { root: "rounded-md" }
320
- },
321
- {
322
- theme: "elegant",
323
- size: "md",
324
- class: { root: "py-1.5" }
325
- },
326
- {
327
- theme: "elegant",
328
- size: ["lg", "icon-lg"],
329
- class: { root: "rounded-md" }
330
- },
331
- {
332
- theme: "elegant",
333
- size: "lg",
334
- class: { root: "py-[7px]" }
335
- },
336
- {
337
- theme: "brutal",
338
- variant: "primary",
339
- class: { root: "bg-brutal-yellow text-black hover:bg-brutal-yellow" }
340
- },
341
- {
342
- theme: "brutal",
343
- variant: "default",
344
- class: { root: "bg-white text-black hover:bg-white" }
345
- },
346
- {
347
- theme: "brutal",
348
- variant: "outline",
349
- class: { root: "bg-white text-black shadow-sm hover:bg-white" }
350
- },
351
- {
352
- theme: "brutal",
353
- variant: "information",
354
- class: { root: "bg-brutal-cyan text-black hover:bg-brutal-cyan" }
355
- },
356
- {
357
- theme: "brutal",
358
- variant: "muted",
359
- class: { root: "bg-brutal-stone text-black hover:bg-brutal-stone" }
360
- },
361
- {
362
- theme: "brutal",
363
- variant: "accent",
364
- class: { root: "bg-brutal-pink text-black hover:bg-brutal-pink" }
365
- },
366
- {
367
- theme: "brutal",
368
- variant: "danger",
369
- class: { root: "bg-brutal-red text-black hover:bg-brutal-red" }
370
- },
371
- {
372
- theme: "brutal",
373
- variant: "warning",
374
- class: { root: "bg-[oklch(0.785_0.123_50.11)] text-black hover:bg-[oklch(0.785_0.123_50.11)]" }
375
- },
376
- {
377
- theme: "brutal",
378
- size: "xs",
379
- class: { root: "h-6 px-2 py-0 text-[11px]" }
380
- },
381
- {
382
- theme: "brutal",
383
- size: "sm",
384
- class: { root: "h-7 px-2.5 py-0 text-xs" }
385
- },
386
- {
387
- theme: "brutal",
388
- size: "md",
389
- class: { root: "h-8 px-3 py-0 text-sm" }
390
- },
391
- {
392
- theme: "brutal",
393
- size: "lg",
394
- class: { root: "h-10 px-4 py-0 text-sm" }
395
- },
396
- {
397
- theme: "brutal",
398
- size: "icon-xs",
399
- class: { root: "size-6 p-0 text-[11px]" }
400
- },
401
- {
402
- theme: "brutal",
403
- size: "icon-sm",
404
- class: { root: "size-7 p-0 text-xs" }
405
- },
406
- {
407
- theme: "brutal",
408
- size: "icon-md",
409
- class: { root: "size-8 p-0 text-sm" }
410
- },
411
- {
412
- theme: "brutal",
413
- size: "icon-lg",
414
- class: { root: "size-10 p-0 text-sm" }
415
- },
416
- {
417
- theme: "elegant",
418
- variant: "default",
419
- class: { root: [
420
- "bg-foreground-strong text-foreground-inverse",
421
- "[--button-focus-outline:var(--foreground-strong)]",
422
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--foreground-strong)]",
423
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
424
- "hover:bg-[oklch(0.31_0.006_285)]"
425
- ] }
426
- },
427
- {
428
- theme: "elegant",
429
- variant: "primary",
430
- class: { root: [
431
- "bg-primary-400 text-primary-950",
432
- "[--button-focus-outline:var(--primary-400)]",
433
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.15),0_0_0_1px_oklch(0.83_0.14_91.89_/_0.83)]",
434
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_11%)_0%,oklab(100%_0_0_/_0%)_0%,oklab(0%_0_0_/_0%)_100%)]",
435
- "hover:bg-[oklch(0.86_0.15_91.89)]"
436
- ] }
437
- },
438
- {
439
- theme: "elegant",
440
- variant: "outline",
441
- class: { root: [
442
- "bg-layer-panel text-foreground-strong",
443
- "[--button-focus-outline:var(--layer-panel)]",
444
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
445
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(0%_0_0_/_0%)_30%,oklab(0%_0_0_/_1%)_100%)]",
446
- "hover:bg-layer-muted"
447
- ] }
448
- },
449
- {
450
- theme: "elegant",
451
- variant: "ghost",
452
- class: { root: [
453
- "bg-transparent text-foreground-muted shadow-none",
454
- "[--button-focus-outline:var(--line-muted)]",
455
- "before:bg-transparent hover:bg-line-muted"
456
- ] }
457
- },
458
- {
459
- theme: "elegant",
460
- variant: "danger-secondary",
461
- class: { root: [
462
- "bg-danger-lighter text-danger-base",
463
- "[--button-focus-outline:var(--state-danger-lighter)]",
464
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.18),0_0_0_1px_var(--state-danger-light)]",
465
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_9%)_0%,oklab(0%_0_0_/_1%)_100%)]",
466
- "hover:bg-danger-light"
467
- ] }
468
- },
469
- {
470
- theme: "elegant",
471
- variant: "danger",
472
- class: { root: [
473
- "bg-danger-base text-foreground-inverse",
474
- "[--button-focus-outline:var(--state-danger-base)]",
475
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--state-danger-base)]",
476
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_10%)_0%,oklab(0%_0_0_/_0%)_100%)]",
477
- "hover:bg-[oklch(0.56_0.23_26.758)]"
478
- ] }
479
- },
480
- {
481
- theme: "brutal",
482
- variant: "danger",
483
- class: { root: [
484
- "border-line-strong bg-brutal-red text-black",
485
- "shadow-sm",
486
- "hover:border-line-strong hover:bg-brutal-red",
487
- "hover:-translate-y-px hover:shadow-md",
488
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
489
- "active:shadow-xs"
490
- ] }
491
- },
492
- {
493
- theme: "brutal",
494
- variant: "danger-secondary",
495
- class: { root: [
496
- "border-line-strong bg-danger-lighter text-[color-mix(in_oklab,var(--state-danger-base)_72%,transparent)]",
497
- "shadow-sm",
498
- "hover:border-line-strong hover:bg-danger-lighter",
499
- "hover:-translate-y-px hover:shadow-md",
500
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
501
- "active:shadow-xs"
502
- ] }
503
- },
504
- {
505
- theme: "elegant",
506
- variant: "danger-outline",
507
- class: { root: [
508
- "bg-layer-panel text-danger-base",
509
- "[--button-focus-outline:var(--layer-panel)]",
510
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--state-danger-light)]",
511
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(0%_0_0_/_0%)_30%,oklab(0%_0_0_/_1%)_100%)]",
512
- "hover:bg-danger-lighter"
513
- ] }
514
- },
515
- {
516
- theme: "elegant",
517
- variant: "accent",
518
- class: { root: [
519
- "bg-accent-400 text-white",
520
- "[--button-focus-outline:var(--accent-400)]",
521
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--accent-400)]",
522
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
523
- "hover:bg-[oklch(0.72_0.15_0.71)]"
524
- ] }
525
- },
526
- {
527
- theme: "elegant",
528
- variant: "warning",
529
- class: { root: [
530
- "bg-warning-base text-foreground-inverse",
531
- "[--button-focus-outline:var(--state-warning-base)]",
532
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.14),0_0_0_1px_var(--state-warning-base)]",
533
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_10%)_0%,oklab(0%_0_0_/_0%)_100%)]",
534
- "hover:bg-[oklch(0.65_0.19_44.441)]"
535
- ] }
536
- },
537
- {
538
- theme: "elegant",
539
- variant: "link",
540
- class: { root: [
541
- "bg-transparent text-foreground-muted shadow-none",
542
- "[--button-focus-outline:transparent]",
543
- "before:bg-transparent hover:bg-transparent hover:text-foreground-muted"
544
- ] }
545
- },
546
- {
547
- theme: "elegant",
548
- variant: "information",
549
- class: { root: [
550
- "bg-info-base text-foreground-inverse",
551
- "[--button-focus-outline:var(--state-info-base)]",
552
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--state-info-base)]",
553
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
554
- "hover:bg-[oklch(0.74_0.13_219.2)]"
555
- ] }
556
- },
557
- {
558
- theme: "elegant",
559
- variant: "muted",
560
- class: { root: [
561
- "bg-layer-muted text-foreground-placeholder",
562
- "[--button-focus-outline:var(--layer-muted)]",
563
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
564
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_5%)_0%,oklab(0%_0_0_/_1%)_100%)]",
565
- "hover:bg-line-subtle"
566
- ] }
567
- },
568
- {
569
- theme: "brutal",
570
- variant: [
571
- "primary",
572
- "default",
573
- "information",
574
- "muted",
575
- "accent",
576
- "warning",
577
- "outline"
578
- ],
579
- class: { root: [
580
- "hover:-translate-y-px hover:shadow-md",
581
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
582
- "active:shadow-xs"
583
- ] }
584
- }
585
- ]
586
- });
587
- function defaultNativeButton(render) {
588
- if (!render || typeof render !== "object" || !("type" in render)) return;
589
- const element = render;
590
- if (typeof element.type === "string") return element.type === "button";
591
- }
592
- function Button({ variant, size, loading = false, loadingLabel = "Loading", disabled, className, children, render, nativeButton, ...props }) {
593
- const { root, content, loadingIndicator } = buttonVariants({
594
- theme: useThemeFamily(),
595
- variant,
596
- size
597
- });
598
- return /* @__PURE__ */ jsxs(Button$1, {
599
- ...props,
600
- render,
601
- nativeButton: nativeButton ?? defaultNativeButton(render),
602
- "data-slot": "button",
603
- className: root({ className }),
604
- "data-loading": loading ? "true" : void 0,
605
- disabled: disabled || loading,
606
- "aria-disabled": loading || void 0,
607
- children: [loading ? /* @__PURE__ */ jsx("span", {
608
- "data-slot": "button-loading-indicator",
609
- className: loadingIndicator(),
610
- children: /* @__PURE__ */ jsx(Spinner, { "aria-label": loadingLabel })
611
- }) : null, /* @__PURE__ */ jsx("span", {
612
- "data-slot": "button-content",
613
- "data-loading": loading ? "true" : void 0,
614
- className: content(),
615
- children
616
- })]
617
- });
618
- }
619
- //#endregion
620
26
  //#region src/components/alert-dialog/alert-dialog.tsx
621
27
  const alertDialog = tv({
622
28
  slots: {
623
29
  overlay: [
624
30
  "fixed inset-0 z-50",
625
- "transition-opacity duration-100",
31
+ "transition-opacity duration-150 ease-out",
626
32
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"
627
33
  ],
628
34
  content: [
629
35
  "fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-[408px] -translate-x-1/2 -translate-y-1/2",
630
- "outline-none transition-[opacity,transform] duration-100",
631
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
632
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0"
36
+ "origin-center transform-gpu outline-none transition-[opacity,transform] duration-150 ease-out",
37
+ "data-[starting-style]:scale-[.98] data-[starting-style]:opacity-0",
38
+ "data-[ending-style]:opacity-0"
633
39
  ],
634
40
  header: ["grid grid-cols-[minmax(0,1fr)_max-content] items-center gap-3 min-w-0"],
635
41
  body: ["min-w-0"],
@@ -639,18 +45,18 @@ const alertDialog = tv({
639
45
  },
640
46
  variants: { theme: {
641
47
  brutal: {
642
- overlay: ["bg-black/60"],
48
+ overlay: ["bg-layer-backdrop"],
643
49
  content: ["gap-4 border-2 border-line-strong bg-layer-panel px-6 py-4 shadow-xl"],
644
50
  body: ["py-2 font-medium"],
645
51
  title: ["font-heading text-lg leading-none font-bold uppercase"],
646
52
  description: ["font-sans text-sm leading-5 text-foreground/60"]
647
53
  },
648
54
  elegant: {
649
- overlay: ["bg-black/20"],
55
+ overlay: ["bg-layer-backdrop backdrop-blur-[2px]"],
650
56
  content: ["overflow-clip rounded-lg bg-layer-popover shadow-xl"],
651
- header: ["border-b border-line-subtle bg-black/[0.02] px-6 py-2"],
57
+ header: ["border-b border-line-subtle bg-black/[0.02] px-5 py-3"],
652
58
  body: ["px-6 py-5"],
653
- footer: ["border-t border-line-subtle bg-black/[0.015] px-6 py-3"],
59
+ footer: ["border-t border-line-subtle bg-black/[0.015] px-5 py-3"],
654
60
  title: ["font-sans text-sm leading-5 font-medium tracking-[-0.005em]"],
655
61
  description: ["font-sans text-sm leading-5 text-[oklch(0.48_0_0)] dark:text-[oklch(0.76_0_0)]"]
656
62
  }
@@ -682,27 +88,32 @@ function AlertDialogClose({ className, variant, size, children, ...props }) {
682
88
  variant: variant ?? (isBrutal ? "outline" : "ghost"),
683
89
  size: size ?? (isBrutal ? "icon-md" : "icon-sm"),
684
90
  "aria-label": "Close",
685
- className: isBrutal ? className : cn("text-foreground-placeholder hover:text-foreground", className)
91
+ className: isBrutal ? className : cn("p-0 text-foreground-placeholder hover:border-transparent hover:bg-transparent hover:text-foreground", className)
686
92
  }),
687
93
  ...props,
688
94
  children: children ?? /* @__PURE__ */ jsx(X, { className: isBrutal ? "size-5" : "size-4" })
689
95
  });
690
96
  }
691
97
  function AlertDialogOverlay({ className, ...props }) {
692
- const { overlay } = alertDialog({ theme: useThemeFamily() });
98
+ const theme = useThemeFamily();
99
+ const { overlay } = alertDialog({ theme });
693
100
  return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
694
101
  "data-slot": "alert-dialog-overlay",
102
+ "data-theme": theme,
695
103
  className: overlay({ className }),
696
104
  ...props
697
105
  });
698
106
  }
699
107
  function AlertDialogContent({ className, children, portalProps, overlay, ...props }) {
700
- const { content } = alertDialog({ theme: useThemeFamily() });
108
+ const theme = useThemeFamily();
109
+ const { resolvedMode } = useTheme();
110
+ const { content } = alertDialog({ theme });
701
111
  return /* @__PURE__ */ jsxs(AlertDialogPortal, {
702
112
  ...portalProps,
703
113
  children: [overlay === false ? null : /* @__PURE__ */ jsx(AlertDialogOverlay, { ...overlay }), /* @__PURE__ */ jsx(Dialog$1.Popup, {
704
114
  "data-slot": "alert-dialog-content",
705
- className: content({ className }),
115
+ "data-theme": theme,
116
+ className: cn(content({ className }), resolvedMode === "dark" && "dark"),
706
117
  ...props,
707
118
  role: "alertdialog",
708
119
  children
@@ -772,14 +183,14 @@ const dialog = tv({
772
183
  slots: {
773
184
  overlay: [
774
185
  "fixed inset-0 z-50",
775
- "transition-opacity duration-100",
186
+ "transition-opacity duration-150 ease-out",
776
187
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"
777
188
  ],
778
189
  content: [
779
190
  "fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2",
780
- "outline-none transition-[opacity,transform] duration-100",
781
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
782
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0"
191
+ "origin-center transform-gpu outline-none transition-[opacity,transform] duration-150 ease-out",
192
+ "data-[starting-style]:scale-[.98] data-[starting-style]:opacity-0",
193
+ "data-[ending-style]:opacity-0"
783
194
  ],
784
195
  header: ["grid grid-cols-[minmax(0,1fr)_max-content] items-center gap-3 min-w-0"],
785
196
  body: ["min-w-0"],
@@ -789,16 +200,16 @@ const dialog = tv({
789
200
  },
790
201
  variants: { theme: {
791
202
  brutal: {
792
- overlay: ["bg-black/60"],
203
+ overlay: ["bg-layer-backdrop"],
793
204
  content: ["gap-4 border-2 border-line-strong bg-layer-panel px-6 py-4 shadow-xl"],
794
205
  body: ["py-2 font-medium"],
795
206
  title: ["font-heading text-lg leading-none font-bold uppercase"],
796
207
  description: ["font-sans text-sm leading-5 text-foreground/60"]
797
208
  },
798
209
  elegant: {
799
- overlay: ["bg-black/20"],
210
+ overlay: ["bg-layer-backdrop backdrop-blur-[2px]"],
800
211
  content: ["overflow-clip rounded-lg bg-layer-popover shadow-xl"],
801
- header: ["border-b border-line-subtle bg-black/[0.02] px-6 py-2"],
212
+ header: ["border-b border-line-subtle bg-black/[0.02] px-6 py-3"],
802
213
  body: ["px-6 py-5"],
803
214
  footer: ["border-t border-line-subtle bg-black/[0.015] px-6 py-3"],
804
215
  title: ["font-sans text-sm leading-5 font-medium tracking-[-0.005em]"],
@@ -825,20 +236,25 @@ function DialogPortal(props) {
825
236
  });
826
237
  }
827
238
  function DialogOverlay({ className, ...props }) {
828
- const { overlay } = dialog({ theme: useThemeFamily() });
239
+ const theme = useThemeFamily();
240
+ const { overlay } = dialog({ theme });
829
241
  return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
830
242
  "data-slot": "dialog-overlay",
243
+ "data-theme": theme,
831
244
  className: overlay({ className }),
832
245
  ...props
833
246
  });
834
247
  }
835
248
  function DialogContent({ className, children, portalProps, overlay, ...props }) {
836
- const { content } = dialog({ theme: useThemeFamily() });
249
+ const theme = useThemeFamily();
250
+ const { resolvedMode } = useTheme();
251
+ const { content } = dialog({ theme });
837
252
  return /* @__PURE__ */ jsxs(DialogPortal, {
838
253
  ...portalProps,
839
254
  children: [overlay === false ? null : /* @__PURE__ */ jsx(DialogOverlay, { ...overlay }), /* @__PURE__ */ jsx(Dialog$1.Popup, {
840
255
  "data-slot": "dialog-content",
841
- className: content({ className }),
256
+ "data-theme": theme,
257
+ className: cn(content({ className }), resolvedMode === "dark" && "dark"),
842
258
  ...props,
843
259
  children
844
260
  })]
@@ -858,7 +274,7 @@ function DialogClose({ className, variant, size, children, render, ...props }) {
858
274
  variant: variant ?? (isBrutal ? "outline" : "ghost"),
859
275
  size: size ?? (isBrutal ? "icon-md" : "icon-sm"),
860
276
  "aria-label": "Close",
861
- className: isBrutal ? className : cn("text-foreground-placeholder hover:text-foreground", className)
277
+ className: isBrutal ? className : cn("p-0 text-foreground-placeholder hover:border-transparent hover:bg-transparent hover:text-foreground", className)
862
278
  }),
863
279
  ...props,
864
280
  children: children ?? /* @__PURE__ */ jsx(X, { className: isBrutal ? "size-5" : "size-4" })
@@ -2553,7 +1969,7 @@ const popover = tv({
2553
1969
  description: ["text-xs leading-5 text-foreground-muted"],
2554
1970
  close: ["text-[11px] font-medium tracking-[-0.005em]", "text-foreground-muted transition-colors duration-150 hover:text-foreground-strong"],
2555
1971
  arrow: ["border-l border-t border-line-muted bg-layer-popover"],
2556
- backdrop: ["bg-black/20"]
1972
+ backdrop: ["bg-layer-backdrop backdrop-blur-[2px]"]
2557
1973
  }
2558
1974
  } }
2559
1975
  });
@@ -2670,9 +2086,11 @@ function PopoverArrow({ className, ...props }) {
2670
2086
  });
2671
2087
  }
2672
2088
  function PopoverBackdrop({ className, ...props }) {
2673
- const { backdrop } = popover({ theme: useThemeFamily() });
2089
+ const theme = useThemeFamily();
2090
+ const { backdrop } = popover({ theme });
2674
2091
  return /* @__PURE__ */ jsx(Popover$1.Backdrop, {
2675
2092
  "data-slot": "popover-backdrop",
2093
+ "data-theme": theme,
2676
2094
  className: backdrop({ className }),
2677
2095
  ...props
2678
2096
  });