@spark-ui/components 13.0.1 → 13.0.3-beta.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 (48) hide show
  1. package/dist/DialogTrigger-8oDlAJjU.d.mts +142 -0
  2. package/dist/DialogTrigger-8oDlAJjU.d.ts +142 -0
  3. package/dist/DialogTrigger-woU7vsJi.d.mts +142 -0
  4. package/dist/DialogTrigger-woU7vsJi.d.ts +142 -0
  5. package/dist/avatar/index.mjs +2 -2
  6. package/dist/carousel/index.mjs +2 -2
  7. package/dist/chunk-2BSBKLHG.mjs +358 -0
  8. package/dist/chunk-2BSBKLHG.mjs.map +1 -0
  9. package/dist/chunk-D7YBYT5H.mjs +308 -0
  10. package/dist/chunk-D7YBYT5H.mjs.map +1 -0
  11. package/dist/chunk-HEKSVWYW.mjs +800 -0
  12. package/dist/chunk-HEKSVWYW.mjs.map +1 -0
  13. package/dist/chunk-TKAU6SMC.mjs +197 -0
  14. package/dist/chunk-TKAU6SMC.mjs.map +1 -0
  15. package/dist/chunk-WA56YHV3.mjs +358 -0
  16. package/dist/chunk-WA56YHV3.mjs.map +1 -0
  17. package/dist/chunk-WLI4EPS6.mjs +358 -0
  18. package/dist/chunk-WLI4EPS6.mjs.map +1 -0
  19. package/dist/chunk-XYK6V3JF.mjs +53 -0
  20. package/dist/chunk-XYK6V3JF.mjs.map +1 -0
  21. package/dist/combobox/index.mjs +3 -3
  22. package/dist/dialog/index.mjs +2 -2
  23. package/dist/docgen.json +3036 -2846
  24. package/dist/drawer/index.d.mts +37 -29
  25. package/dist/drawer/index.d.ts +37 -29
  26. package/dist/drawer/index.js +125 -89
  27. package/dist/drawer/index.js.map +1 -1
  28. package/dist/drawer/index.mjs +127 -89
  29. package/dist/drawer/index.mjs.map +1 -1
  30. package/dist/dropdown/index.mjs +2 -2
  31. package/dist/file-upload/index.mjs +3 -3
  32. package/dist/index-BRKaV3lI.d.mts +93 -0
  33. package/dist/index-BRKaV3lI.d.ts +93 -0
  34. package/dist/index-Cw_DIfiq.d.mts +93 -0
  35. package/dist/index-Cw_DIfiq.d.ts +93 -0
  36. package/dist/pagination/index.mjs +3 -3
  37. package/dist/popover/index.mjs +1 -1
  38. package/dist/scrolling-list/index.mjs +3 -3
  39. package/dist/snackbar/index.mjs +3 -3
  40. package/dist/spinner/index.d.mts +1 -1
  41. package/dist/spinner/index.d.ts +1 -1
  42. package/dist/stepper/index.mjs +2 -2
  43. package/dist/tabs/index.mjs +3 -3
  44. package/dist/toast/index.js +2 -2
  45. package/dist/toast/index.js.map +1 -1
  46. package/dist/toast/index.mjs +5 -5
  47. package/dist/toast/index.mjs.map +1 -1
  48. package/package.json +5 -5
@@ -0,0 +1,800 @@
1
+ import {
2
+ Spinner
3
+ } from "./chunk-GAK4SC2F.mjs";
4
+ import {
5
+ Slot,
6
+ wrapPolymorphicSlot
7
+ } from "./chunk-6QCEPQ3U.mjs";
8
+
9
+ // src/button/Button.tsx
10
+ import { cx } from "class-variance-authority";
11
+ import { useMemo } from "react";
12
+
13
+ // src/button/Button.styles.tsx
14
+ import { makeVariants } from "@spark-ui/internal-utils";
15
+ import { cva } from "class-variance-authority";
16
+
17
+ // src/button/variants/filled.ts
18
+ import { tw } from "@spark-ui/internal-utils";
19
+ var filledVariants = [
20
+ // Main
21
+ {
22
+ intent: "main",
23
+ design: "filled",
24
+ class: tw([
25
+ "bg-main",
26
+ "text-on-main",
27
+ "hover:bg-main-hovered",
28
+ "enabled:active:bg-main-hovered",
29
+ "focus-visible:bg-main-hovered"
30
+ ])
31
+ },
32
+ // Support
33
+ {
34
+ intent: "support",
35
+ design: "filled",
36
+ class: tw([
37
+ "bg-support",
38
+ "text-on-support",
39
+ "hover:bg-support-hovered",
40
+ "enabled:active:bg-support-hovered",
41
+ "focus-visible:bg-support-hovered"
42
+ ])
43
+ },
44
+ // Accent
45
+ {
46
+ intent: "accent",
47
+ design: "filled",
48
+ class: tw([
49
+ "bg-accent",
50
+ "text-on-accent",
51
+ "hover:bg-accent-hovered",
52
+ "enabled:active:bg-accent-hovered",
53
+ "focus-visible:bg-accent-hovered"
54
+ ])
55
+ },
56
+ // Basic
57
+ {
58
+ intent: "basic",
59
+ design: "filled",
60
+ class: tw([
61
+ "bg-basic",
62
+ "text-on-basic",
63
+ "hover:bg-basic-hovered",
64
+ "enabled:active:bg-basic-hovered",
65
+ "focus-visible:bg-basic-hovered"
66
+ ])
67
+ },
68
+ // Success
69
+ {
70
+ intent: "success",
71
+ design: "filled",
72
+ class: tw([
73
+ "bg-success",
74
+ "text-on-success",
75
+ "hover:bg-success-hovered",
76
+ "enabled:active:bg-success-hovered",
77
+ "focus-visible:bg-success-hovered"
78
+ ])
79
+ },
80
+ // Alert
81
+ {
82
+ intent: "alert",
83
+ design: "filled",
84
+ class: tw([
85
+ "bg-alert",
86
+ "text-on-alert",
87
+ "hover:bg-alert-hovered",
88
+ "enabled:active:bg-alert-hovered",
89
+ "focus-visible:bg-alert-hovered"
90
+ ])
91
+ },
92
+ // Danger
93
+ {
94
+ intent: "danger",
95
+ design: "filled",
96
+ class: tw([
97
+ "text-on-error bg-error",
98
+ "hover:bg-error-hovered enabled:active:bg-error-hovered",
99
+ "focus-visible:bg-error-hovered"
100
+ ])
101
+ },
102
+ // Info
103
+ {
104
+ intent: "info",
105
+ design: "filled",
106
+ class: tw([
107
+ "text-on-error bg-info",
108
+ "hover:bg-info-hovered enabled:active:bg-info-hovered",
109
+ "focus-visible:bg-info-hovered"
110
+ ])
111
+ },
112
+ // Neutral
113
+ {
114
+ intent: "neutral",
115
+ design: "filled",
116
+ class: tw([
117
+ "bg-neutral",
118
+ "text-on-neutral",
119
+ "hover:bg-neutral-hovered",
120
+ "enabled:active:bg-neutral-hovered",
121
+ "focus-visible:bg-neutral-hovered"
122
+ ])
123
+ },
124
+ // Surface
125
+ {
126
+ intent: "surface",
127
+ design: "filled",
128
+ class: tw([
129
+ "bg-surface",
130
+ "text-on-surface",
131
+ "hover:bg-surface-hovered",
132
+ "enabled:active:bg-surface-hovered",
133
+ "focus-visible:bg-surface-hovered"
134
+ ])
135
+ },
136
+ {
137
+ intent: "surfaceInverse",
138
+ design: "filled",
139
+ class: tw([
140
+ "bg-surface-inverse",
141
+ "text-on-surface-inverse",
142
+ "hover:bg-surface-inverse-hovered",
143
+ "enabled:active:bg-surface-inverse-hovered",
144
+ "focus-visible:bg-surface-inverse-hovered"
145
+ ])
146
+ }
147
+ ];
148
+
149
+ // src/button/variants/ghost.ts
150
+ import { tw as tw2 } from "@spark-ui/internal-utils";
151
+ var ghostVariants = [
152
+ {
153
+ intent: "main",
154
+ design: "ghost",
155
+ class: tw2([
156
+ "text-on-main-container",
157
+ "hover:bg-main/dim-5",
158
+ "enabled:active:bg-main/dim-5",
159
+ "focus-visible:bg-main/dim-5"
160
+ ])
161
+ },
162
+ {
163
+ intent: "support",
164
+ design: "ghost",
165
+ class: tw2([
166
+ "text-on-support-container",
167
+ "hover:bg-support/dim-5",
168
+ "enabled:active:bg-support/dim-5",
169
+ "focus-visible:bg-support/dim-5"
170
+ ])
171
+ },
172
+ {
173
+ intent: "accent",
174
+ design: "ghost",
175
+ class: tw2([
176
+ "text-on-accent-container",
177
+ "hover:bg-accent/dim-5",
178
+ "enabled:active:bg-accent/dim-5",
179
+ "focus-visible:bg-accent/dim-5"
180
+ ])
181
+ },
182
+ {
183
+ intent: "basic",
184
+ design: "ghost",
185
+ class: tw2([
186
+ "text-on-basic-container",
187
+ "hover:bg-basic/dim-5",
188
+ "enabled:active:bg-basic/dim-5",
189
+ "focus-visible:bg-basic/dim-5"
190
+ ])
191
+ },
192
+ {
193
+ intent: "success",
194
+ design: "ghost",
195
+ class: tw2([
196
+ "text-on-success-container",
197
+ "hover:bg-success/dim-5",
198
+ "enabled:active:bg-success/dim-5",
199
+ "focus-visible:bg-success/dim-5"
200
+ ])
201
+ },
202
+ {
203
+ intent: "alert",
204
+ design: "ghost",
205
+ class: tw2([
206
+ "text-on-alert-container",
207
+ "hover:bg-alert/dim-5",
208
+ "enabled:active:bg-alert/dim-5",
209
+ "focus-visible:bg-alert/dim-5"
210
+ ])
211
+ },
212
+ {
213
+ intent: "danger",
214
+ design: "ghost",
215
+ class: tw2([
216
+ "text-on-error-container",
217
+ "hover:bg-error/dim-5",
218
+ "enabled:active:bg-error/dim-5",
219
+ "focus-visible:bg-error/dim-5"
220
+ ])
221
+ },
222
+ {
223
+ intent: "info",
224
+ design: "ghost",
225
+ class: tw2([
226
+ "text-on-info-container",
227
+ "hover:bg-info/dim-5",
228
+ "enabled:active:bg-info/dim-5",
229
+ "focus-visible:bg-info/dim-5"
230
+ ])
231
+ },
232
+ {
233
+ intent: "neutral",
234
+ design: "ghost",
235
+ class: tw2([
236
+ "text-on-neutral-container",
237
+ "hover:bg-neutral/dim-5",
238
+ "enabled:active:bg-neutral/dim-5",
239
+ "focus-visible:bg-neutral/dim-5"
240
+ ])
241
+ },
242
+ {
243
+ intent: "surface",
244
+ design: "ghost",
245
+ class: tw2([
246
+ "text-surface",
247
+ "hover:bg-surface/dim-5",
248
+ "enabled:active:bg-surface/dim-5",
249
+ "focus-visible:bg-surface/dim-5"
250
+ ])
251
+ },
252
+ {
253
+ intent: "surfaceInverse",
254
+ design: "ghost",
255
+ class: tw2([
256
+ "text-surface-inverse",
257
+ "hover:bg-surface-inverse/dim-5",
258
+ "enabled:active:bg-surface-inverse/dim-5",
259
+ "focus-visible:bg-surface-inverse/dim-5"
260
+ ])
261
+ }
262
+ ];
263
+
264
+ // src/button/variants/outlined.ts
265
+ import { tw as tw3 } from "@spark-ui/internal-utils";
266
+ var outlinedVariants = [
267
+ {
268
+ intent: "main",
269
+ design: "outlined",
270
+ class: tw3([
271
+ "hover:bg-main/dim-5",
272
+ "enabled:active:bg-main/dim-5",
273
+ "focus-visible:bg-main/dim-5",
274
+ "text-main"
275
+ ])
276
+ },
277
+ {
278
+ intent: "support",
279
+ design: "outlined",
280
+ class: tw3([
281
+ "hover:bg-support/dim-5",
282
+ "enabled:active:bg-support/dim-5",
283
+ "focus-visible:bg-support/dim-5",
284
+ "text-support"
285
+ ])
286
+ },
287
+ {
288
+ intent: "accent",
289
+ design: "outlined",
290
+ class: tw3([
291
+ "hover:bg-accent/dim-5",
292
+ "enabled:active:bg-accent/dim-5",
293
+ "focus-visible:bg-accent/dim-5",
294
+ "text-accent"
295
+ ])
296
+ },
297
+ {
298
+ intent: "basic",
299
+ design: "outlined",
300
+ class: tw3([
301
+ "hover:bg-basic/dim-5",
302
+ "enabled:active:bg-basic/dim-5",
303
+ "focus-visible:bg-basic/dim-5",
304
+ "text-basic"
305
+ ])
306
+ },
307
+ {
308
+ intent: "success",
309
+ design: "outlined",
310
+ class: tw3([
311
+ "hover:bg-success/dim-5",
312
+ "enabled:active:bg-success/dim-5",
313
+ "focus-visible:bg-success/dim-5",
314
+ "text-success"
315
+ ])
316
+ },
317
+ {
318
+ intent: "alert",
319
+ design: "outlined",
320
+ class: tw3([
321
+ "hover:bg-alert/dim-5",
322
+ "enabled:active:bg-alert/dim-5",
323
+ "focus-visible:bg-alert/dim-5",
324
+ "text-alert"
325
+ ])
326
+ },
327
+ {
328
+ intent: "danger",
329
+ design: "outlined",
330
+ class: tw3([
331
+ "hover:bg-error/dim-5",
332
+ "enabled:active:bg-error/dim-5",
333
+ "focus-visible:bg-error/dim-5",
334
+ "text-error"
335
+ ])
336
+ },
337
+ {
338
+ intent: "info",
339
+ design: "outlined",
340
+ class: tw3([
341
+ "hover:bg-info/dim-5",
342
+ "enabled:active:bg-info/dim-5",
343
+ "focus-visible:bg-info/dim-5",
344
+ "text-info"
345
+ ])
346
+ },
347
+ {
348
+ intent: "neutral",
349
+ design: "outlined",
350
+ class: tw3([
351
+ "hover:bg-neutral/dim-5",
352
+ "enabled:active:bg-neutral/dim-5",
353
+ "focus-visible:bg-neutral/dim-5",
354
+ "text-neutral"
355
+ ])
356
+ },
357
+ {
358
+ intent: "surface",
359
+ design: "outlined",
360
+ class: tw3([
361
+ "hover:bg-surface/dim-5",
362
+ "enabled:active:bg-surface/dim-5",
363
+ "focus-visible:bg-surface/dim-5",
364
+ "text-surface"
365
+ ])
366
+ },
367
+ {
368
+ intent: "surfaceInverse",
369
+ design: "outlined",
370
+ class: tw3([
371
+ "hover:bg-surface-inverse/dim-5",
372
+ "enabled:active:bg-surface-inverse/dim-5",
373
+ "focus-visible:bg-surface-inverse/dim-5",
374
+ "text-surface-inverse"
375
+ ])
376
+ }
377
+ ];
378
+
379
+ // src/button/variants/tinted.ts
380
+ import { tw as tw4 } from "@spark-ui/internal-utils";
381
+ var tintedVariants = [
382
+ {
383
+ intent: "main",
384
+ design: "tinted",
385
+ class: tw4([
386
+ "bg-main-container",
387
+ "text-on-main-container",
388
+ "hover:bg-main-container-hovered",
389
+ "enabled:active:bg-main-container-hovered",
390
+ "focus-visible:bg-main-container-hovered"
391
+ ])
392
+ },
393
+ {
394
+ intent: "support",
395
+ design: "tinted",
396
+ class: tw4([
397
+ "bg-support-container",
398
+ "text-on-support-container",
399
+ "hover:bg-support-container-hovered",
400
+ "enabled:active:bg-support-container-hovered",
401
+ "focus-visible:bg-support-container-hovered"
402
+ ])
403
+ },
404
+ {
405
+ intent: "accent",
406
+ design: "tinted",
407
+ class: tw4([
408
+ "bg-accent-container",
409
+ "text-on-accent-container",
410
+ "hover:bg-accent-container-hovered",
411
+ "enabled:active:bg-accent-container-hovered",
412
+ "focus-visible:bg-accent-container-hovered"
413
+ ])
414
+ },
415
+ {
416
+ intent: "basic",
417
+ design: "tinted",
418
+ class: tw4([
419
+ "bg-basic-container",
420
+ "text-on-basic-container",
421
+ "hover:bg-basic-container-hovered",
422
+ "enabled:active:bg-basic-container-hovered",
423
+ "focus-visible:bg-basic-container-hovered"
424
+ ])
425
+ },
426
+ {
427
+ intent: "success",
428
+ design: "tinted",
429
+ class: tw4([
430
+ "bg-success-container",
431
+ "text-on-success-container",
432
+ "hover:bg-success-container-hovered",
433
+ "enabled:active:bg-success-container-hovered",
434
+ "focus-visible:bg-success-container-hovered"
435
+ ])
436
+ },
437
+ {
438
+ intent: "alert",
439
+ design: "tinted",
440
+ class: tw4([
441
+ "bg-alert-container",
442
+ "text-on-alert-container",
443
+ "hover:bg-alert-container-hovered",
444
+ "enabled:active:bg-alert-container-hovered",
445
+ "focus-visible:bg-alert-container-hovered"
446
+ ])
447
+ },
448
+ {
449
+ intent: "danger",
450
+ design: "tinted",
451
+ class: tw4([
452
+ "bg-error-container",
453
+ "text-on-error-container",
454
+ "hover:bg-error-container-hovered",
455
+ "enabled:active:bg-error-container-hovered",
456
+ "focus-visible:bg-error-container-hovered"
457
+ ])
458
+ },
459
+ {
460
+ intent: "info",
461
+ design: "tinted",
462
+ class: tw4([
463
+ "bg-info-container",
464
+ "text-on-info-container",
465
+ "hover:bg-info-container-hovered",
466
+ "enabled:active:bg-info-container-hovered",
467
+ "focus-visible:bg-info-container-hovered"
468
+ ])
469
+ },
470
+ {
471
+ intent: "neutral",
472
+ design: "tinted",
473
+ class: tw4([
474
+ "bg-neutral-container",
475
+ "text-on-neutral-container",
476
+ "hover:bg-neutral-container-hovered",
477
+ "enabled:active:bg-neutral-container-hovered",
478
+ "focus-visible:bg-neutral-container-hovered"
479
+ ])
480
+ },
481
+ {
482
+ intent: "surface",
483
+ design: "tinted",
484
+ class: tw4([
485
+ "bg-surface",
486
+ "text-on-surface",
487
+ "hover:bg-surface-hovered",
488
+ "enabled:active:bg-surface-hovered",
489
+ "focus-visible:bg-surface-hovered"
490
+ ])
491
+ },
492
+ {
493
+ intent: "surfaceInverse",
494
+ design: "tinted",
495
+ class: tw4([
496
+ "bg-surface-inverse",
497
+ "text-on-surface-inverse",
498
+ "hover:bg-surface-inverse-hovered",
499
+ "enabled:active:bg-surface-inverse-hovered",
500
+ "focus-visible:bg-surface-inverse-hovered"
501
+ ])
502
+ }
503
+ ];
504
+
505
+ // src/button/variants/contrast.ts
506
+ import { tw as tw5 } from "@spark-ui/internal-utils";
507
+ var contrastVariants = [
508
+ {
509
+ intent: "main",
510
+ design: "contrast",
511
+ class: tw5([
512
+ "text-on-main-contaier bg-surface",
513
+ "hover:bg-main-container-hovered",
514
+ "enabled:active:bg-main-container-hovered",
515
+ "focus-visible:bg-main-container-hovered"
516
+ ])
517
+ },
518
+ {
519
+ intent: "support",
520
+ design: "contrast",
521
+ class: tw5([
522
+ "text-on-support-container bg-surface",
523
+ "hover:bg-support-container-hovered",
524
+ "enabled:active:bg-support-container-hovered",
525
+ "focus-visible:bg-support-container-hovered"
526
+ ])
527
+ },
528
+ {
529
+ intent: "accent",
530
+ design: "contrast",
531
+ class: tw5([
532
+ "text-on-accent-container bg-surface",
533
+ "hover:bg-accent-container-hovered",
534
+ "enabled:active:bg-accent-container-hovered",
535
+ "focus-visible:bg-accent-container-hovered"
536
+ ])
537
+ },
538
+ {
539
+ intent: "basic",
540
+ design: "contrast",
541
+ class: tw5([
542
+ "text-on-basic-container bg-surface",
543
+ "hover:bg-basic-container-hovered",
544
+ "enabled:active:bg-basic-container-hovered",
545
+ "focus-visible:bg-basic-container-hovered"
546
+ ])
547
+ },
548
+ {
549
+ intent: "success",
550
+ design: "contrast",
551
+ class: tw5([
552
+ "text-on-success-container bg-surface",
553
+ "hover:bg-success-container-hovered",
554
+ "enabled:active:bg-success-container-hovered",
555
+ "focus-visible:bg-success-container-hovered"
556
+ ])
557
+ },
558
+ {
559
+ intent: "alert",
560
+ design: "contrast",
561
+ class: tw5([
562
+ "text-on-alert-container bg-surface",
563
+ "hover:bg-alert-container-hovered",
564
+ "enabled:active:bg-alert-container-hovered",
565
+ "focus-visible:bg-alert-container-hovered"
566
+ ])
567
+ },
568
+ {
569
+ intent: "danger",
570
+ design: "contrast",
571
+ class: tw5([
572
+ "text-on-error-container bg-surface",
573
+ "hover:bg-error-container-hovered",
574
+ "enabled:active:bg-error-container-hovered",
575
+ "focus-visible:bg-error-container-hovered"
576
+ ])
577
+ },
578
+ {
579
+ intent: "info",
580
+ design: "contrast",
581
+ class: tw5([
582
+ "text-on-info-container bg-surface",
583
+ "hover:bg-info-container-hovered",
584
+ "enabled:active:bg-info-container-hovered",
585
+ "focus-visible:bg-info-container-hovered"
586
+ ])
587
+ },
588
+ {
589
+ intent: "neutral",
590
+ design: "contrast",
591
+ class: tw5([
592
+ "text-on-neutral-container bg-surface",
593
+ "hover:bg-neutral-container-hovered",
594
+ "enabled:active:bg-neutral-container-hovered",
595
+ "focus-visible:bg-neutral-container-hovered"
596
+ ])
597
+ },
598
+ {
599
+ intent: "surface",
600
+ design: "contrast",
601
+ class: tw5([
602
+ "text-on-surface bg-surface",
603
+ "hover:bg-surface-hovered",
604
+ "enabled:active:bg-surface-hovered",
605
+ "focus-visible:bg-surface-hovered"
606
+ ])
607
+ },
608
+ {
609
+ intent: "surfaceInverse",
610
+ design: "contrast",
611
+ class: tw5([
612
+ "text-on-surface-inverse bg-surface-inverse",
613
+ "hover:bg-surface-inverse-hovered",
614
+ "enabled:active:bg-surface-inverse-hovered",
615
+ "focus-visible:bg-surface-inverse-hovered"
616
+ ])
617
+ }
618
+ ];
619
+
620
+ // src/button/Button.styles.tsx
621
+ var buttonStyles = cva(
622
+ [
623
+ "u-shadow-border-transition",
624
+ "box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
625
+ "default:px-lg",
626
+ "text-body-1 font-bold",
627
+ "focus-visible:u-outline"
628
+ ],
629
+ {
630
+ variants: {
631
+ /**
632
+ * Main style of the button.
633
+ *
634
+ * - `filled`: Button will be plain.
635
+ *
636
+ * - `outlined`: Button will be transparent with an outline.
637
+ *
638
+ * - `tinted`: Button will be filled but using a lighter color scheme.
639
+ *
640
+ * - `ghost`: Button will look like a link. No borders, plain text.
641
+ *
642
+ * - `contrast`: Button will be surface filled. No borders, plain text.
643
+ *
644
+ */
645
+ design: makeVariants({
646
+ filled: [],
647
+ outlined: ["bg-transparent", "border-sm", "border-current"],
648
+ tinted: [],
649
+ ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
650
+ contrast: []
651
+ }),
652
+ underline: {
653
+ true: ["underline"]
654
+ },
655
+ /**
656
+ * Color scheme of the button.
657
+ */
658
+ intent: makeVariants({
659
+ main: [],
660
+ support: [],
661
+ accent: [],
662
+ basic: [],
663
+ success: [],
664
+ alert: [],
665
+ danger: [],
666
+ info: [],
667
+ neutral: [],
668
+ surface: [],
669
+ surfaceInverse: []
670
+ }),
671
+ /**
672
+ * Size of the button.
673
+ */
674
+ size: makeVariants({
675
+ sm: ["min-w-sz-32", "h-sz-32"],
676
+ md: ["min-w-sz-44", "h-sz-44"],
677
+ lg: ["min-w-sz-56", "h-sz-56"]
678
+ }),
679
+ /**
680
+ * Shape of the button.
681
+ */
682
+ shape: makeVariants({
683
+ rounded: ["rounded-lg"],
684
+ square: ["rounded-0"],
685
+ pill: ["rounded-full"]
686
+ }),
687
+ /**
688
+ * Disable the button, preventing user interaction and adding opacity.
689
+ */
690
+ disabled: {
691
+ true: ["cursor-not-allowed", "opacity-dim-3"],
692
+ false: ["cursor-pointer"]
693
+ }
694
+ },
695
+ compoundVariants: [
696
+ ...filledVariants,
697
+ ...outlinedVariants,
698
+ ...tintedVariants,
699
+ ...ghostVariants,
700
+ ...contrastVariants
701
+ ],
702
+ defaultVariants: {
703
+ design: "filled",
704
+ intent: "main",
705
+ size: "md",
706
+ shape: "rounded"
707
+ }
708
+ }
709
+ );
710
+
711
+ // src/button/Button.tsx
712
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
713
+ var blockedEventHandlers = [
714
+ "onClick",
715
+ "onMouseDown",
716
+ "onMouseUp",
717
+ "onMouseEnter",
718
+ "onMouseLeave",
719
+ "onMouseOver",
720
+ "onMouseOut",
721
+ "onKeyDown",
722
+ "onKeyPress",
723
+ "onKeyUp",
724
+ "onSubmit"
725
+ ];
726
+ var Button = ({
727
+ children,
728
+ design = "filled",
729
+ disabled = false,
730
+ intent = "main",
731
+ isLoading = false,
732
+ loadingLabel,
733
+ loadingText,
734
+ shape = "rounded",
735
+ size = "md",
736
+ asChild,
737
+ className,
738
+ underline = false,
739
+ ref,
740
+ ...others
741
+ }) => {
742
+ const Component = asChild ? Slot : "button";
743
+ const shouldNotInteract = !!disabled || isLoading;
744
+ const disabledEventHandlers = useMemo(() => {
745
+ const result = {};
746
+ if (shouldNotInteract) {
747
+ blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
748
+ }
749
+ return result;
750
+ }, [shouldNotInteract]);
751
+ const spinnerProps = {
752
+ size: "current",
753
+ className: loadingText ? "inline-block" : "absolute",
754
+ ...loadingLabel && { "aria-label": loadingLabel }
755
+ };
756
+ return /* @__PURE__ */ jsx(
757
+ Component,
758
+ {
759
+ "data-spark-component": "button",
760
+ ...Component === "button" && { type: "button" },
761
+ ref,
762
+ className: buttonStyles({
763
+ className,
764
+ design,
765
+ disabled: shouldNotInteract,
766
+ intent,
767
+ shape,
768
+ size,
769
+ underline
770
+ }),
771
+ disabled: !!disabled,
772
+ "aria-busy": isLoading,
773
+ "aria-live": isLoading ? "assertive" : "off",
774
+ ...others,
775
+ ...disabledEventHandlers,
776
+ children: wrapPolymorphicSlot(
777
+ asChild,
778
+ children,
779
+ (slotted) => isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
780
+ /* @__PURE__ */ jsx(Spinner, { ...spinnerProps }),
781
+ loadingText && loadingText,
782
+ /* @__PURE__ */ jsx(
783
+ "div",
784
+ {
785
+ "aria-hidden": true,
786
+ className: cx("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
787
+ children: slotted
788
+ }
789
+ )
790
+ ] }) : slotted
791
+ )
792
+ }
793
+ );
794
+ };
795
+ Button.displayName = "Button";
796
+
797
+ export {
798
+ Button
799
+ };
800
+ //# sourceMappingURL=chunk-HEKSVWYW.mjs.map