raft-ui 0.0.10 → 0.0.12

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.
@@ -1,722 +0,0 @@
1
- import { cn } from "cnfast";
2
- import { tv } from "tailwind-variants/lite";
3
- import { createContext, use } from "react";
4
- import { Button } from "@base-ui/react/button";
5
- import { mergeProps } from "@base-ui/react/merge-props";
6
- import { useRender } from "@base-ui/react/use-render";
7
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
- //#region src/lib/tv.ts
9
- const tv$1 = ((options) => {
10
- const recipe = tv(options);
11
- const wrappedRecipe = ((props) => {
12
- const result = recipe(props);
13
- if (typeof result === "string") return cn(result);
14
- return Object.fromEntries(Object.entries(result).map(([slotName, slot]) => [slotName, (slotProps) => cn(slot(slotProps))]));
15
- });
16
- return Object.assign(wrappedRecipe, recipe);
17
- });
18
- //#endregion
19
- //#region src/lib/theme/theme-context.ts
20
- const ThemeContext = createContext("brutal");
21
- const ThemeStateContext = createContext({
22
- theme: "brutal",
23
- setTheme: () => void 0,
24
- mode: "light",
25
- resolvedMode: "light"
26
- });
27
- //#endregion
28
- //#region src/lib/theme/use-theme.ts
29
- /** Read the active style family for theme-aware component recipes. */
30
- function useThemeFamily() {
31
- return use(ThemeContext);
32
- }
33
- /** Read and update the application-level RUI theme selection. */
34
- function useTheme() {
35
- return use(ThemeStateContext);
36
- }
37
- //#endregion
38
- //#region src/components/spinner/spinner.tsx
39
- const SPINNER_STYLE = `
40
- @keyframes raft-braille-spinner {
41
- 0%,
42
- 9.99% {
43
- content: "⠋";
44
- }
45
- 10%,
46
- 19.99% {
47
- content: "⠙";
48
- }
49
- 20%,
50
- 29.99% {
51
- content: "⠹";
52
- }
53
- 30%,
54
- 39.99% {
55
- content: "⠸";
56
- }
57
- 40%,
58
- 49.99% {
59
- content: "⠼";
60
- }
61
- 50%,
62
- 59.99% {
63
- content: "⠴";
64
- }
65
- 60%,
66
- 69.99% {
67
- content: "⠦";
68
- }
69
- 70%,
70
- 79.99% {
71
- content: "⠧";
72
- }
73
- 80%,
74
- 89.99% {
75
- content: "⠇";
76
- }
77
- 90%,
78
- 100% {
79
- content: "⠏";
80
- }
81
- }
82
-
83
- [data-slot="spinner"] [data-spinner-glyph]::before {
84
- content: "⠋";
85
- animation: raft-braille-spinner 800ms steps(1, end) infinite;
86
- }
87
-
88
- @media (prefers-reduced-motion: reduce) {
89
- [data-slot="spinner"] [data-spinner-glyph]::before {
90
- animation-duration: 1600ms;
91
- }
92
- }
93
-
94
- @keyframes raft-elegant-spinner-spin {
95
- to {
96
- transform: rotate(360deg);
97
- }
98
- }
99
-
100
- @keyframes raft-elegant-spinner-dash {
101
- 0% {
102
- stroke-dasharray: 1 150;
103
- stroke-dashoffset: 0;
104
- }
105
- 50% {
106
- stroke-dasharray: 90 150;
107
- stroke-dashoffset: -35;
108
- }
109
- 100% {
110
- stroke-dasharray: 90 150;
111
- stroke-dashoffset: -124;
112
- }
113
- }
114
-
115
- [data-slot="spinner"] [data-spinner-ring] {
116
- animation: raft-elegant-spinner-spin 1600ms linear infinite;
117
- transform-box: fill-box;
118
- transform-origin: center;
119
- will-change: transform;
120
- }
121
-
122
- [data-slot="spinner"] [data-spinner-arc] {
123
- animation: raft-elegant-spinner-dash 1400ms cubic-bezier(0.42, 0, 0.58, 1) infinite;
124
- stroke-dasharray: 1 150;
125
- stroke-dashoffset: 0;
126
- }
127
-
128
- @media (prefers-reduced-motion: reduce) {
129
- [data-slot="spinner"] [data-spinner-ring] {
130
- animation-duration: 2400ms;
131
- will-change: auto;
132
- }
133
-
134
- [data-slot="spinner"] [data-spinner-arc] {
135
- animation: none;
136
- stroke-dasharray: 72 150;
137
- stroke-dashoffset: -30;
138
- }
139
- }
140
- `;
141
- const spinner = tv$1({
142
- slots: {
143
- root: ["relative inline-flex shrink-0 items-center justify-center", "leading-none text-current"],
144
- glyph: "inline-block min-w-[1ch] font-mono tabular-nums",
145
- ring: "block size-full shrink-0"
146
- },
147
- variants: {
148
- theme: {
149
- brutal: {},
150
- elegant: {}
151
- },
152
- size: {
153
- sm: {},
154
- lg: {}
155
- }
156
- },
157
- defaultVariants: { size: "sm" },
158
- compoundVariants: [
159
- {
160
- theme: "brutal",
161
- size: "sm",
162
- class: { root: "h-4 text-base" }
163
- },
164
- {
165
- theme: "brutal",
166
- size: "lg",
167
- class: { root: "h-6 text-xl" }
168
- },
169
- {
170
- theme: "elegant",
171
- size: "sm",
172
- class: { root: "size-3.5" }
173
- },
174
- {
175
- theme: "elegant",
176
- size: "lg",
177
- class: { root: "size-[18px]" }
178
- }
179
- ]
180
- });
181
- const spinnerStyle = /* @__PURE__ */ jsx("style", {
182
- href: "raft-ui-spinner",
183
- precedence: "default",
184
- children: SPINNER_STYLE
185
- });
186
- function Spinner({ size = "sm", className, render, ...props }) {
187
- const theme = useThemeFamily();
188
- const { root, glyph, ring } = spinner({
189
- theme,
190
- size
191
- });
192
- const children = theme === "elegant" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [spinnerStyle, /* @__PURE__ */ jsxs("svg", {
193
- "data-spinner-ring": "",
194
- "aria-hidden": "true",
195
- className: ring(),
196
- xmlns: "http://www.w3.org/2000/svg",
197
- fill: "none",
198
- viewBox: "0 0 24 24",
199
- children: [/* @__PURE__ */ jsx("circle", {
200
- className: "opacity-20",
201
- cx: "12",
202
- cy: "12",
203
- r: "10",
204
- stroke: "currentColor",
205
- strokeWidth: "2.5"
206
- }), /* @__PURE__ */ jsx("circle", {
207
- "data-spinner-arc": "",
208
- className: "opacity-80",
209
- cx: "12",
210
- cy: "12",
211
- r: "10",
212
- fill: "none",
213
- pathLength: "150",
214
- stroke: "currentColor",
215
- strokeLinecap: "round",
216
- strokeWidth: "2.5"
217
- })]
218
- })] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [spinnerStyle, /* @__PURE__ */ jsx("span", {
219
- "data-spinner-glyph": "",
220
- "aria-hidden": "true",
221
- className: glyph()
222
- })] });
223
- return useRender({
224
- defaultTagName: "span",
225
- render,
226
- props: mergeProps({
227
- role: "status",
228
- "aria-label": "Loading",
229
- className: root({ className }),
230
- children
231
- }, props),
232
- state: {
233
- slot: "spinner",
234
- size
235
- }
236
- });
237
- }
238
- //#endregion
239
- //#region src/components/button/button.tsx
240
- const buttonVariants = tv$1({
241
- slots: {
242
- root: [
243
- "relative inline-flex shrink-0 items-center justify-center",
244
- "font-heading leading-none whitespace-nowrap select-none",
245
- "border-line rounded-none",
246
- "shadow-sm transition-all duration-100",
247
- "outline outline-[1px] outline-offset-2 outline-transparent",
248
- "data-[loading=true]:cursor-wait",
249
- "disabled:pointer-events-none disabled:opacity-40 data-[loading=true]:opacity-100",
250
- "disabled:transform-none",
251
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
252
- ],
253
- content: "relative z-10 inline-flex items-center justify-center gap-[inherit] data-[loading=true]:invisible",
254
- loadingIndicator: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center"
255
- },
256
- variants: {
257
- theme: {
258
- brutal: { root: ["border-2 font-bold focus-visible:outline-transparent"] },
259
- elegant: { root: [
260
- "overflow-clip border-0 font-sans font-medium antialiased",
261
- "focus-visible:outline-[var(--button-focus-outline,transparent)]",
262
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
263
- "before:pointer-events-none before:absolute before:inset-0 before:z-0 before:rounded-[inherit]",
264
- "active:not-aria-[haspopup]:scale-[0.985]"
265
- ] }
266
- },
267
- variant: {
268
- primary: { root: ["border-line-strong bg-primary-400 text-primary-950", "hover:bg-primary-500"] },
269
- default: { root: ["border-line-strong bg-layer-panel text-foreground-strong", "hover:bg-layer-panel"] },
270
- information: { root: ["border-line-strong bg-info-base text-foreground-inverse", "hover:bg-info-base"] },
271
- muted: { root: ["border-line-strong bg-secondary-400 text-secondary-950", "hover:border-line-strong hover:bg-secondary-400"] },
272
- accent: { root: ["border-line-strong bg-accent-400 text-accent-950", "hover:bg-accent-500"] },
273
- warning: { root: ["border-line-strong bg-warning-base text-foreground-inverse", "hover:bg-warning-base"] },
274
- outline: { root: [
275
- "border-line-strong bg-transparent text-foreground-strong",
276
- "hover:bg-layer-muted",
277
- "shadow-none"
278
- ] },
279
- ghost: { root: ["border-transparent bg-transparent text-foreground shadow-none", "hover:border-line-strong hover:bg-layer-muted"] },
280
- link: { root: ["border-transparent bg-transparent text-foreground-strong shadow-none underline-offset-4", "hover:underline"] },
281
- "danger-secondary": { root: ["border-line-strong bg-danger-lighter text-danger-base", "hover:bg-danger-lighter"] },
282
- 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)]"] },
283
- "danger-outline": { root: [
284
- "border-line-strong bg-transparent text-danger-base",
285
- "hover:bg-layer-muted",
286
- "shadow-none"
287
- ] }
288
- },
289
- size: {
290
- xs: { root: [
291
- "gap-1 px-2 py-[5px] text-[11px]",
292
- "has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5",
293
- "[&_[data-icon]]:size-[1em]",
294
- "[&_svg:not([class*='size-'])]:size-3"
295
- ] },
296
- sm: { root: [
297
- "gap-[5px] px-2.5 py-[6px] text-xs",
298
- "has-data-[icon=inline-start]:pl-2 has-data-[icon=inline-end]:pr-2",
299
- "[&_[data-icon]]:size-[1em]",
300
- "[&_svg:not([class*='size-'])]:size-3.5"
301
- ] },
302
- md: { root: [
303
- "gap-[5.5px] px-3 py-[7px] text-sm",
304
- "has-data-[icon=inline-start]:pl-2.5 has-data-[icon=inline-end]:pr-2.5",
305
- "[&_[data-icon]]:size-[1em]"
306
- ] },
307
- lg: { root: [
308
- "gap-[6px] px-3.5 py-2 text-base",
309
- "has-data-[icon=inline-start]:pl-3 has-data-[icon=inline-end]:pr-3",
310
- "[&_[data-icon]]:size-[1em]",
311
- "[&_svg:not([class*='size-'])]:size-4"
312
- ] },
313
- "icon-xs": { root: ["p-[5px] text-[11px]", "[&_svg:not([class*='size-'])]:size-3"] },
314
- "icon-sm": { root: ["p-[6px] text-xs", "[&_svg:not([class*='size-'])]:size-3.5"] },
315
- "icon-md": { root: ["p-2 text-sm", "[&_svg:not([class*='size-'])]:size-4"] },
316
- "icon-lg": { root: ["p-3 text-sm", "[&_svg:not([class*='size-'])]:size-4"] }
317
- }
318
- },
319
- defaultVariants: {
320
- variant: "default",
321
- size: "md"
322
- },
323
- compoundVariants: [
324
- {
325
- theme: "elegant",
326
- size: ["xs", "icon-xs"],
327
- class: { root: "rounded-sm" }
328
- },
329
- {
330
- theme: "elegant",
331
- size: ["sm", "icon-sm"],
332
- class: { root: "rounded" }
333
- },
334
- {
335
- theme: "elegant",
336
- size: ["md", "icon-md"],
337
- class: { root: "rounded-md" }
338
- },
339
- {
340
- theme: "elegant",
341
- size: "md",
342
- class: { root: "py-1.5" }
343
- },
344
- {
345
- theme: "elegant",
346
- size: ["lg", "icon-lg"],
347
- class: { root: "rounded-md" }
348
- },
349
- {
350
- theme: "elegant",
351
- size: "lg",
352
- class: { root: "py-[7px]" }
353
- },
354
- {
355
- theme: "elegant",
356
- variant: ["outline", "danger-outline"],
357
- size: "xs",
358
- class: { root: "py-[6px]" }
359
- },
360
- {
361
- theme: "elegant",
362
- variant: ["outline", "danger-outline"],
363
- size: "sm",
364
- class: { root: "py-[6.75px]" }
365
- },
366
- {
367
- theme: "elegant",
368
- variant: ["outline", "danger-outline"],
369
- size: "md",
370
- class: { root: "py-[7.25px]" }
371
- },
372
- {
373
- theme: "elegant",
374
- variant: ["outline", "danger-outline"],
375
- size: "lg",
376
- class: { root: "py-[7.75px]" }
377
- },
378
- {
379
- theme: "elegant",
380
- variant: [
381
- "primary",
382
- "default",
383
- "information",
384
- "muted",
385
- "accent",
386
- "warning",
387
- "danger-secondary",
388
- "danger"
389
- ],
390
- size: "xs",
391
- class: { root: "py-[5.75px]" }
392
- },
393
- {
394
- theme: "elegant",
395
- variant: [
396
- "primary",
397
- "default",
398
- "information",
399
- "muted",
400
- "accent",
401
- "warning",
402
- "danger-secondary",
403
- "danger"
404
- ],
405
- size: "sm",
406
- class: { root: "py-[6.75px]" }
407
- },
408
- {
409
- theme: "elegant",
410
- variant: [
411
- "primary",
412
- "default",
413
- "information",
414
- "muted",
415
- "accent",
416
- "warning",
417
- "danger-secondary",
418
- "danger"
419
- ],
420
- size: "md",
421
- class: { root: "py-[6.75px]" }
422
- },
423
- {
424
- theme: "elegant",
425
- variant: [
426
- "primary",
427
- "default",
428
- "information",
429
- "muted",
430
- "accent",
431
- "warning",
432
- "danger-secondary",
433
- "danger"
434
- ],
435
- size: "lg",
436
- class: { root: "py-[7.75px]" }
437
- },
438
- {
439
- theme: "brutal",
440
- variant: "primary",
441
- class: { root: "bg-brutal-yellow text-black hover:bg-brutal-yellow" }
442
- },
443
- {
444
- theme: "brutal",
445
- variant: "default",
446
- class: { root: "bg-white text-black hover:bg-white" }
447
- },
448
- {
449
- theme: "brutal",
450
- variant: "outline",
451
- class: { root: "bg-white text-black shadow-sm hover:bg-white" }
452
- },
453
- {
454
- theme: "brutal",
455
- variant: "information",
456
- class: { root: "bg-brutal-cyan text-black hover:bg-brutal-cyan" }
457
- },
458
- {
459
- theme: "brutal",
460
- variant: "muted",
461
- class: { root: "bg-brutal-stone text-black hover:bg-brutal-stone" }
462
- },
463
- {
464
- theme: "brutal",
465
- variant: "accent",
466
- class: { root: "bg-brutal-pink text-black hover:bg-brutal-pink" }
467
- },
468
- {
469
- theme: "brutal",
470
- variant: "danger",
471
- class: { root: "bg-brutal-red text-black hover:bg-brutal-red" }
472
- },
473
- {
474
- theme: "brutal",
475
- variant: "warning",
476
- class: { root: "bg-[oklch(0.785_0.123_50.11)] text-black hover:bg-[oklch(0.785_0.123_50.11)]" }
477
- },
478
- {
479
- theme: "brutal",
480
- size: "xs",
481
- class: { root: ["h-6 px-2 py-0 text-[11px]", "has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5"] }
482
- },
483
- {
484
- theme: "brutal",
485
- size: "sm",
486
- class: { root: ["h-7 px-2.5 py-0 text-xs", "has-data-[icon=inline-start]:pl-2 has-data-[icon=inline-end]:pr-2"] }
487
- },
488
- {
489
- theme: "brutal",
490
- size: "md",
491
- class: { root: ["h-8 px-3 py-0 text-sm", "has-data-[icon=inline-start]:pl-2.5 has-data-[icon=inline-end]:pr-2.5"] }
492
- },
493
- {
494
- theme: "brutal",
495
- size: "lg",
496
- class: { root: ["h-10 px-4 py-0 text-sm", "has-data-[icon=inline-start]:pl-3.5 has-data-[icon=inline-end]:pr-3.5"] }
497
- },
498
- {
499
- theme: "brutal",
500
- size: "icon-xs",
501
- class: { root: "size-6 p-0 text-[11px]" }
502
- },
503
- {
504
- theme: "brutal",
505
- size: "icon-sm",
506
- class: { root: "size-7 p-0 text-xs" }
507
- },
508
- {
509
- theme: "brutal",
510
- size: "icon-md",
511
- class: { root: "size-8 p-0 text-sm" }
512
- },
513
- {
514
- theme: "brutal",
515
- size: "icon-lg",
516
- class: { root: "size-10 p-0 text-sm" }
517
- },
518
- {
519
- theme: "elegant",
520
- variant: "default",
521
- class: { root: [
522
- "bg-foreground-strong text-foreground-inverse",
523
- "[--button-focus-outline:var(--foreground-strong)]",
524
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--foreground-strong)]",
525
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
526
- "hover:bg-[oklch(0.31_0.006_285)]"
527
- ] }
528
- },
529
- {
530
- theme: "elegant",
531
- variant: "primary",
532
- class: { root: [
533
- "bg-primary-400 text-primary-950",
534
- "[--button-focus-outline:var(--primary-400)]",
535
- "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)]",
536
- "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%)]",
537
- "hover:bg-[oklch(0.86_0.15_91.89)]"
538
- ] }
539
- },
540
- {
541
- theme: "elegant",
542
- variant: "outline",
543
- class: { root: [
544
- "bg-layer-panel text-foreground-strong",
545
- "[--button-focus-outline:var(--layer-panel)]",
546
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
547
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(0%_0_0_/_0%)_30%,oklab(0%_0_0_/_1%)_100%)]",
548
- "hover:bg-layer-muted"
549
- ] }
550
- },
551
- {
552
- theme: "elegant",
553
- variant: "ghost",
554
- class: { root: [
555
- "bg-transparent text-foreground-muted shadow-none",
556
- "[--button-focus-outline:var(--line-muted)]",
557
- "before:bg-transparent hover:bg-line-muted"
558
- ] }
559
- },
560
- {
561
- theme: "elegant",
562
- variant: "danger-secondary",
563
- class: { root: [
564
- "bg-danger-lighter text-danger-base",
565
- "[--button-focus-outline:var(--state-danger-lighter)]",
566
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.18),0_0_0_1px_var(--state-danger-light)]",
567
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_9%)_0%,oklab(0%_0_0_/_1%)_100%)]",
568
- "hover:bg-danger-light"
569
- ] }
570
- },
571
- {
572
- theme: "elegant",
573
- variant: "danger",
574
- class: { root: [
575
- "bg-danger-base text-foreground-inverse",
576
- "[--button-focus-outline:var(--state-danger-base)]",
577
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--state-danger-base)]",
578
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_10%)_0%,oklab(0%_0_0_/_0%)_100%)]",
579
- "hover:bg-[oklch(0.56_0.23_26.758)]"
580
- ] }
581
- },
582
- {
583
- theme: "brutal",
584
- variant: "danger",
585
- class: { root: [
586
- "border-line-strong bg-brutal-red text-black",
587
- "shadow-sm",
588
- "hover:border-line-strong hover:bg-brutal-red",
589
- "hover:-translate-y-px hover:shadow-md",
590
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
591
- "active:shadow-xs"
592
- ] }
593
- },
594
- {
595
- theme: "brutal",
596
- variant: "danger-secondary",
597
- class: { root: [
598
- "border-line-strong bg-danger-lighter text-[color-mix(in_oklab,var(--state-danger-base)_72%,transparent)]",
599
- "shadow-sm",
600
- "hover:border-line-strong hover:bg-danger-lighter",
601
- "hover:-translate-y-px hover:shadow-md",
602
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
603
- "active:shadow-xs"
604
- ] }
605
- },
606
- {
607
- theme: "elegant",
608
- variant: "danger-outline",
609
- class: { root: [
610
- "bg-layer-panel text-danger-base",
611
- "[--button-focus-outline:var(--layer-panel)]",
612
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--state-danger-light)]",
613
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(0%_0_0_/_0%)_30%,oklab(0%_0_0_/_1%)_100%)]",
614
- "hover:bg-danger-lighter"
615
- ] }
616
- },
617
- {
618
- theme: "elegant",
619
- variant: "accent",
620
- class: { root: [
621
- "bg-accent-400 text-white",
622
- "[--button-focus-outline:var(--accent-400)]",
623
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--accent-400)]",
624
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
625
- "hover:bg-[oklch(0.72_0.15_0.71)]"
626
- ] }
627
- },
628
- {
629
- theme: "elegant",
630
- variant: "warning",
631
- class: { root: [
632
- "bg-warning-base text-foreground-inverse",
633
- "[--button-focus-outline:var(--state-warning-base)]",
634
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.14),0_0_0_1px_var(--state-warning-base)]",
635
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_10%)_0%,oklab(0%_0_0_/_0%)_100%)]",
636
- "hover:bg-[oklch(0.65_0.19_44.441)]"
637
- ] }
638
- },
639
- {
640
- theme: "elegant",
641
- variant: "link",
642
- class: { root: [
643
- "bg-transparent text-foreground-muted shadow-none",
644
- "[--button-focus-outline:transparent]",
645
- "before:bg-transparent hover:bg-transparent hover:text-foreground-muted"
646
- ] }
647
- },
648
- {
649
- theme: "elegant",
650
- variant: "information",
651
- class: { root: [
652
- "bg-info-base text-foreground-inverse",
653
- "[--button-focus-outline:var(--state-info-base)]",
654
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.12),0_0_0_1px_var(--state-info-base)]",
655
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_8%)_0%,oklab(0%_0_0_/_0%)_100%)]",
656
- "hover:bg-[oklch(0.74_0.13_219.2)]"
657
- ] }
658
- },
659
- {
660
- theme: "elegant",
661
- variant: "muted",
662
- class: { root: [
663
- "bg-layer-muted text-foreground-placeholder",
664
- "[--button-focus-outline:var(--layer-muted)]",
665
- "shadow-[inset_0_1px_0.5px_oklch(1_0_0_/_0.05),0_0_0_1px_var(--line-subtle)]",
666
- "before:bg-[linear-gradient(in_oklab_180deg,oklab(100%_0_0_/_5%)_0%,oklab(0%_0_0_/_1%)_100%)]",
667
- "hover:bg-line-subtle"
668
- ] }
669
- },
670
- {
671
- theme: "brutal",
672
- variant: [
673
- "primary",
674
- "default",
675
- "information",
676
- "muted",
677
- "accent",
678
- "warning",
679
- "outline"
680
- ],
681
- class: { root: [
682
- "hover:-translate-y-px hover:shadow-md",
683
- "active:not-aria-[haspopup]:translate-x-px active:not-aria-[haspopup]:translate-y-px",
684
- "active:shadow-xs"
685
- ] }
686
- }
687
- ]
688
- });
689
- function defaultNativeButton(render) {
690
- if (!render || typeof render !== "object" || !("type" in render)) return;
691
- const element = render;
692
- if (typeof element.type === "string") return element.type === "button";
693
- }
694
- function Button$1({ variant, size, loading = false, loadingLabel = "Loading", disabled, className, children, render, nativeButton, ...props }) {
695
- const { root, content, loadingIndicator } = buttonVariants({
696
- theme: useThemeFamily(),
697
- variant,
698
- size
699
- });
700
- return /* @__PURE__ */ jsxs(Button, {
701
- ...props,
702
- render,
703
- nativeButton: nativeButton ?? defaultNativeButton(render),
704
- "data-slot": "button",
705
- className: root({ className }),
706
- "data-loading": loading ? "true" : void 0,
707
- disabled: disabled || loading,
708
- "aria-disabled": loading || void 0,
709
- children: [loading ? /* @__PURE__ */ jsx("span", {
710
- "data-slot": "button-loading-indicator",
711
- className: loadingIndicator(),
712
- children: /* @__PURE__ */ jsx(Spinner, { "aria-label": loadingLabel })
713
- }) : null, /* @__PURE__ */ jsx("span", {
714
- "data-slot": "button-content",
715
- "data-loading": loading ? "true" : void 0,
716
- className: content(),
717
- children
718
- })]
719
- });
720
- }
721
- //#endregion
722
- export { useThemeFamily as a, tv$1 as c, useTheme as i, buttonVariants as n, ThemeContext as o, Spinner as r, ThemeStateContext as s, Button$1 as t };