@spark-ui/components 11.1.0 → 11.1.2

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 (146) hide show
  1. package/dist/DialogTrigger-woU7vsJi.d.ts +142 -0
  2. package/dist/Input-N8AWWSmt.d.ts +41 -0
  3. package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +20 -0
  4. package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +19 -0
  5. package/dist/accordion/index.d.ts +73 -0
  6. package/dist/accordion/index.js +325 -0
  7. package/dist/accordion/index.js.map +1 -0
  8. package/dist/alert-dialog/index.d.ts +119 -0
  9. package/dist/alert-dialog/index.js +1554 -0
  10. package/dist/alert-dialog/index.js.map +1 -0
  11. package/dist/avatar/index.d.ts +66 -0
  12. package/dist/avatar/index.js +1303 -0
  13. package/dist/avatar/index.js.map +1 -0
  14. package/dist/badge/index.d.ts +47 -0
  15. package/dist/badge/index.js +122 -0
  16. package/dist/badge/index.js.map +1 -0
  17. package/dist/breadcrumb/index.d.ts +64 -0
  18. package/dist/breadcrumb/index.js +327 -0
  19. package/dist/breadcrumb/index.js.map +1 -0
  20. package/dist/button/index.d.ts +41 -0
  21. package/dist/button/index.js +935 -0
  22. package/dist/button/index.js.map +1 -0
  23. package/dist/card/index.d.ts +61 -0
  24. package/dist/card/index.js +502 -0
  25. package/dist/card/index.js.map +1 -0
  26. package/dist/carousel/index.d.ts +261 -0
  27. package/dist/carousel/index.js +1801 -0
  28. package/dist/carousel/index.js.map +1 -0
  29. package/dist/checkbox/index.d.ts +120 -0
  30. package/dist/checkbox/index.js +511 -0
  31. package/dist/checkbox/index.js.map +1 -0
  32. package/dist/chip/index.d.ts +97 -0
  33. package/dist/chip/index.js +908 -0
  34. package/dist/chip/index.js.map +1 -0
  35. package/dist/collapsible/index.d.ts +43 -0
  36. package/dist/collapsible/index.js +109 -0
  37. package/dist/collapsible/index.js.map +1 -0
  38. package/dist/combobox/index.d.ts +287 -0
  39. package/dist/combobox/index.js +2588 -0
  40. package/dist/combobox/index.js.map +1 -0
  41. package/dist/dialog/index.d.ts +33 -0
  42. package/dist/dialog/index.js +1389 -0
  43. package/dist/dialog/index.js.map +1 -0
  44. package/dist/divider/index.d.ts +61 -0
  45. package/dist/divider/index.js +224 -0
  46. package/dist/divider/index.js.map +1 -0
  47. package/dist/drawer/index.d.ts +152 -0
  48. package/dist/drawer/index.js +1400 -0
  49. package/dist/drawer/index.js.map +1 -0
  50. package/dist/dropdown/index.d.ts +233 -0
  51. package/dist/dropdown/index.js +2051 -0
  52. package/dist/dropdown/index.js.map +1 -0
  53. package/dist/form-field/index.d.ts +186 -0
  54. package/dist/form-field/index.js +553 -0
  55. package/dist/form-field/index.js.map +1 -0
  56. package/dist/icon/index.d.ts +28 -0
  57. package/dist/icon/index.js +127 -0
  58. package/dist/icon/index.js.map +1 -0
  59. package/dist/icon-button/index.d.ts +16 -0
  60. package/dist/icon-button/index.js +980 -0
  61. package/dist/icon-button/index.js.map +1 -0
  62. package/dist/input/index.d.ts +78 -0
  63. package/dist/input/index.js +724 -0
  64. package/dist/input/index.js.map +1 -0
  65. package/dist/kbd/index.d.ts +9 -0
  66. package/dist/kbd/index.js +47 -0
  67. package/dist/kbd/index.js.map +1 -0
  68. package/dist/label/index.d.ts +11 -0
  69. package/dist/label/index.js +78 -0
  70. package/dist/label/index.js.map +1 -0
  71. package/dist/link-box/index.d.ts +34 -0
  72. package/dist/link-box/index.js +92 -0
  73. package/dist/link-box/index.js.map +1 -0
  74. package/dist/pagination/index.d.ts +143 -0
  75. package/dist/pagination/index.js +1353 -0
  76. package/dist/pagination/index.js.map +1 -0
  77. package/dist/popover/index.d.ts +93 -0
  78. package/dist/popover/index.js +1339 -0
  79. package/dist/popover/index.js.map +1 -0
  80. package/dist/portal/index.d.ts +13 -0
  81. package/dist/portal/index.js +37 -0
  82. package/dist/portal/index.js.map +1 -0
  83. package/dist/progress/index.d.ts +48 -0
  84. package/dist/progress/index.js +223 -0
  85. package/dist/progress/index.js.map +1 -0
  86. package/dist/progress-tracker/index.d.ts +80 -0
  87. package/dist/progress-tracker/index.js +571 -0
  88. package/dist/progress-tracker/index.js.map +1 -0
  89. package/dist/radio-group/index.d.ts +100 -0
  90. package/dist/radio-group/index.js +318 -0
  91. package/dist/radio-group/index.js.map +1 -0
  92. package/dist/rating/index.d.ts +78 -0
  93. package/dist/rating/index.js +363 -0
  94. package/dist/rating/index.js.map +1 -0
  95. package/dist/scrolling-list/index.d.ts +118 -0
  96. package/dist/scrolling-list/index.js +1426 -0
  97. package/dist/scrolling-list/index.js.map +1 -0
  98. package/dist/segmented-gauge/index.d.ts +100 -0
  99. package/dist/segmented-gauge/index.js +277 -0
  100. package/dist/segmented-gauge/index.js.map +1 -0
  101. package/dist/select/index.d.ts +167 -0
  102. package/dist/select/index.js +581 -0
  103. package/dist/select/index.js.map +1 -0
  104. package/dist/skeleton/index.d.ts +67 -0
  105. package/dist/skeleton/index.js +206 -0
  106. package/dist/skeleton/index.js.map +1 -0
  107. package/dist/slider/index.d.ts +97 -0
  108. package/dist/slider/index.js +220 -0
  109. package/dist/slider/index.js.map +1 -0
  110. package/dist/slot/index.d.ts +16 -0
  111. package/dist/slot/index.js +51 -0
  112. package/dist/slot/index.js.map +1 -0
  113. package/dist/snackbar/index.d.ts +158 -0
  114. package/dist/snackbar/index.js +1756 -0
  115. package/dist/snackbar/index.js.map +1 -0
  116. package/dist/spinner/index.d.mts +1 -1
  117. package/dist/spinner/index.d.ts +21 -0
  118. package/dist/spinner/index.js +139 -0
  119. package/dist/spinner/index.js.map +1 -0
  120. package/dist/stepper/index.d.ts +81 -0
  121. package/dist/stepper/index.js +1847 -0
  122. package/dist/stepper/index.js.map +1 -0
  123. package/dist/switch/index.d.ts +64 -0
  124. package/dist/switch/index.js +327 -0
  125. package/dist/switch/index.js.map +1 -0
  126. package/dist/tabs/index.d.ts +103 -0
  127. package/dist/tabs/index.js +1376 -0
  128. package/dist/tabs/index.js.map +1 -0
  129. package/dist/tag/index.d.ts +29 -0
  130. package/dist/tag/index.js +283 -0
  131. package/dist/tag/index.js.map +1 -0
  132. package/dist/text-link/index.d.ts +20 -0
  133. package/dist/text-link/index.js +100 -0
  134. package/dist/text-link/index.js.map +1 -0
  135. package/dist/textarea/index.d.ts +57 -0
  136. package/dist/textarea/index.js +797 -0
  137. package/dist/textarea/index.js.map +1 -0
  138. package/dist/toast/index.d.ts +56 -0
  139. package/dist/toast/index.js +1412 -0
  140. package/dist/toast/index.js.map +1 -0
  141. package/dist/toast/index.mjs +1 -1
  142. package/dist/toast/index.mjs.map +1 -1
  143. package/dist/visually-hidden/index.d.ts +16 -0
  144. package/dist/visually-hidden/index.js +67 -0
  145. package/dist/visually-hidden/index.js.map +1 -0
  146. package/package.json +5 -5
@@ -0,0 +1,1412 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/toast/index.tsx
31
+ var toast_exports = {};
32
+ __export(toast_exports, {
33
+ ToastProvider: () => ToastProvider,
34
+ ToastTrigger: () => ToastTrigger,
35
+ useToastManager: () => useToastManager
36
+ });
37
+ module.exports = __toCommonJS(toast_exports);
38
+ var import_toast3 = require("@base-ui-components/react/toast");
39
+
40
+ // src/slot/Slot.tsx
41
+ var import_radix_ui = require("radix-ui");
42
+ var import_react = require("react");
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var Slottable = import_radix_ui.Slot.Slottable;
45
+ var Slot = ({ ref, ...props }) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
47
+ };
48
+ var wrapPolymorphicSlot = (asChild, children, callback) => {
49
+ if (!asChild) return callback(children);
50
+ return (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(
51
+ children,
52
+ void 0,
53
+ callback(children.props.children)
54
+ ) : null;
55
+ };
56
+
57
+ // src/toast/index.tsx
58
+ var import_class_variance_authority8 = require("class-variance-authority");
59
+
60
+ // src/toast/Toast.tsx
61
+ var import_toast = require("@base-ui-components/react/toast");
62
+
63
+ // src/button/Button.tsx
64
+ var import_class_variance_authority3 = require("class-variance-authority");
65
+ var import_react2 = require("react");
66
+
67
+ // src/visually-hidden/VisuallyHidden.tsx
68
+ var import_jsx_runtime2 = require("react/jsx-runtime");
69
+ var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
70
+ const Component = asChild ? Slot : "span";
71
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
72
+ Component,
73
+ {
74
+ ...props,
75
+ ref,
76
+ style: {
77
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
78
+ position: "absolute",
79
+ border: 0,
80
+ width: 1,
81
+ height: 1,
82
+ padding: 0,
83
+ margin: -1,
84
+ overflow: "hidden",
85
+ clip: "rect(0, 0, 0, 0)",
86
+ whiteSpace: "nowrap",
87
+ wordWrap: "normal",
88
+ ...props.style
89
+ }
90
+ }
91
+ );
92
+ };
93
+ VisuallyHidden.displayName = "VisuallyHidden";
94
+
95
+ // src/spinner/Spinner.styles.tsx
96
+ var import_internal_utils = require("@spark-ui/internal-utils");
97
+ var import_class_variance_authority = require("class-variance-authority");
98
+ var defaultVariants = {
99
+ intent: "current",
100
+ size: "current",
101
+ isBackgroundVisible: false
102
+ };
103
+ var spinnerStyles = (0, import_class_variance_authority.cva)(
104
+ ["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
105
+ {
106
+ variants: {
107
+ /**
108
+ * Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.
109
+ */
110
+ size: {
111
+ current: ["u-current-font-size"],
112
+ sm: ["w-sz-20", "h-sz-20"],
113
+ md: ["w-sz-28", "h-sz-28"],
114
+ full: ["w-full", "h-full"]
115
+ },
116
+ /**
117
+ * Color scheme of the spinner.
118
+ */
119
+ intent: (0, import_internal_utils.makeVariants)({
120
+ current: ["border-current"],
121
+ main: ["border-main"],
122
+ support: ["border-support"],
123
+ accent: ["border-accent"],
124
+ basic: ["border-basic"],
125
+ success: ["border-success"],
126
+ alert: ["border-alert"],
127
+ error: ["border-error"],
128
+ info: ["border-info"],
129
+ neutral: ["border-neutral"]
130
+ }),
131
+ /**
132
+ * Size of the button.
133
+ */
134
+ isBackgroundVisible: {
135
+ true: ["border-b-neutral-container", "border-l-neutral-container"],
136
+ false: ["border-b-transparent", "border-l-transparent"]
137
+ }
138
+ },
139
+ defaultVariants
140
+ }
141
+ );
142
+
143
+ // src/spinner/Spinner.tsx
144
+ var import_jsx_runtime3 = require("react/jsx-runtime");
145
+ var Spinner = ({
146
+ className,
147
+ size = "current",
148
+ intent = "current",
149
+ label,
150
+ isBackgroundVisible,
151
+ ref,
152
+ ...others
153
+ }) => {
154
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
155
+ "span",
156
+ {
157
+ role: "status",
158
+ "data-spark-component": "spinner",
159
+ ref,
160
+ className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
161
+ ...others,
162
+ children: label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
163
+ }
164
+ );
165
+ };
166
+
167
+ // src/button/Button.styles.tsx
168
+ var import_internal_utils7 = require("@spark-ui/internal-utils");
169
+ var import_class_variance_authority2 = require("class-variance-authority");
170
+
171
+ // src/button/variants/filled.ts
172
+ var import_internal_utils2 = require("@spark-ui/internal-utils");
173
+ var filledVariants = [
174
+ // Main
175
+ {
176
+ intent: "main",
177
+ design: "filled",
178
+ class: (0, import_internal_utils2.tw)([
179
+ "bg-main",
180
+ "text-on-main",
181
+ "hover:bg-main-hovered",
182
+ "enabled:active:bg-main-hovered",
183
+ "focus-visible:bg-main-hovered"
184
+ ])
185
+ },
186
+ // Support
187
+ {
188
+ intent: "support",
189
+ design: "filled",
190
+ class: (0, import_internal_utils2.tw)([
191
+ "bg-support",
192
+ "text-on-support",
193
+ "hover:bg-support-hovered",
194
+ "enabled:active:bg-support-hovered",
195
+ "focus-visible:bg-support-hovered"
196
+ ])
197
+ },
198
+ // Accent
199
+ {
200
+ intent: "accent",
201
+ design: "filled",
202
+ class: (0, import_internal_utils2.tw)([
203
+ "bg-accent",
204
+ "text-on-accent",
205
+ "hover:bg-accent-hovered",
206
+ "enabled:active:bg-accent-hovered",
207
+ "focus-visible:bg-accent-hovered"
208
+ ])
209
+ },
210
+ // Basic
211
+ {
212
+ intent: "basic",
213
+ design: "filled",
214
+ class: (0, import_internal_utils2.tw)([
215
+ "bg-basic",
216
+ "text-on-basic",
217
+ "hover:bg-basic-hovered",
218
+ "enabled:active:bg-basic-hovered",
219
+ "focus-visible:bg-basic-hovered"
220
+ ])
221
+ },
222
+ // Success
223
+ {
224
+ intent: "success",
225
+ design: "filled",
226
+ class: (0, import_internal_utils2.tw)([
227
+ "bg-success",
228
+ "text-on-success",
229
+ "hover:bg-success-hovered",
230
+ "enabled:active:bg-success-hovered",
231
+ "focus-visible:bg-success-hovered"
232
+ ])
233
+ },
234
+ // Alert
235
+ {
236
+ intent: "alert",
237
+ design: "filled",
238
+ class: (0, import_internal_utils2.tw)([
239
+ "bg-alert",
240
+ "text-on-alert",
241
+ "hover:bg-alert-hovered",
242
+ "enabled:active:bg-alert-hovered",
243
+ "focus-visible:bg-alert-hovered"
244
+ ])
245
+ },
246
+ // Danger
247
+ {
248
+ intent: "danger",
249
+ design: "filled",
250
+ class: (0, import_internal_utils2.tw)([
251
+ "text-on-error bg-error",
252
+ "hover:bg-error-hovered enabled:active:bg-error-hovered",
253
+ "focus-visible:bg-error-hovered"
254
+ ])
255
+ },
256
+ // Info
257
+ {
258
+ intent: "info",
259
+ design: "filled",
260
+ class: (0, import_internal_utils2.tw)([
261
+ "text-on-error bg-info",
262
+ "hover:bg-info-hovered enabled:active:bg-info-hovered",
263
+ "focus-visible:bg-info-hovered"
264
+ ])
265
+ },
266
+ // Neutral
267
+ {
268
+ intent: "neutral",
269
+ design: "filled",
270
+ class: (0, import_internal_utils2.tw)([
271
+ "bg-neutral",
272
+ "text-on-neutral",
273
+ "hover:bg-neutral-hovered",
274
+ "enabled:active:bg-neutral-hovered",
275
+ "focus-visible:bg-neutral-hovered"
276
+ ])
277
+ },
278
+ // Surface
279
+ {
280
+ intent: "surface",
281
+ design: "filled",
282
+ class: (0, import_internal_utils2.tw)([
283
+ "bg-surface",
284
+ "text-on-surface",
285
+ "hover:bg-surface-hovered",
286
+ "enabled:active:bg-surface-hovered",
287
+ "focus-visible:bg-surface-hovered"
288
+ ])
289
+ },
290
+ {
291
+ intent: "surfaceInverse",
292
+ design: "filled",
293
+ class: (0, import_internal_utils2.tw)([
294
+ "bg-surface-inverse",
295
+ "text-on-surface-inverse",
296
+ "hover:bg-surface-inverse-hovered",
297
+ "enabled:active:bg-surface-inverse-hovered",
298
+ "focus-visible:bg-surface-inverse-hovered"
299
+ ])
300
+ }
301
+ ];
302
+
303
+ // src/button/variants/ghost.ts
304
+ var import_internal_utils3 = require("@spark-ui/internal-utils");
305
+ var ghostVariants = [
306
+ {
307
+ intent: "main",
308
+ design: "ghost",
309
+ class: (0, import_internal_utils3.tw)([
310
+ "text-on-main-container",
311
+ "hover:bg-main/dim-5",
312
+ "enabled:active:bg-main/dim-5",
313
+ "focus-visible:bg-main/dim-5"
314
+ ])
315
+ },
316
+ {
317
+ intent: "support",
318
+ design: "ghost",
319
+ class: (0, import_internal_utils3.tw)([
320
+ "text-on-support-container",
321
+ "hover:bg-support/dim-5",
322
+ "enabled:active:bg-support/dim-5",
323
+ "focus-visible:bg-support/dim-5"
324
+ ])
325
+ },
326
+ {
327
+ intent: "accent",
328
+ design: "ghost",
329
+ class: (0, import_internal_utils3.tw)([
330
+ "text-on-accent-container",
331
+ "hover:bg-accent/dim-5",
332
+ "enabled:active:bg-accent/dim-5",
333
+ "focus-visible:bg-accent/dim-5"
334
+ ])
335
+ },
336
+ {
337
+ intent: "basic",
338
+ design: "ghost",
339
+ class: (0, import_internal_utils3.tw)([
340
+ "text-on-basic-container",
341
+ "hover:bg-basic/dim-5",
342
+ "enabled:active:bg-basic/dim-5",
343
+ "focus-visible:bg-basic/dim-5"
344
+ ])
345
+ },
346
+ {
347
+ intent: "success",
348
+ design: "ghost",
349
+ class: (0, import_internal_utils3.tw)([
350
+ "text-on-success-container",
351
+ "hover:bg-success/dim-5",
352
+ "enabled:active:bg-success/dim-5",
353
+ "focus-visible:bg-success/dim-5"
354
+ ])
355
+ },
356
+ {
357
+ intent: "alert",
358
+ design: "ghost",
359
+ class: (0, import_internal_utils3.tw)([
360
+ "text-on-alert-container",
361
+ "hover:bg-alert/dim-5",
362
+ "enabled:active:bg-alert/dim-5",
363
+ "focus-visible:bg-alert/dim-5"
364
+ ])
365
+ },
366
+ {
367
+ intent: "danger",
368
+ design: "ghost",
369
+ class: (0, import_internal_utils3.tw)([
370
+ "text-on-error-container",
371
+ "hover:bg-error/dim-5",
372
+ "enabled:active:bg-error/dim-5",
373
+ "focus-visible:bg-error/dim-5"
374
+ ])
375
+ },
376
+ {
377
+ intent: "info",
378
+ design: "ghost",
379
+ class: (0, import_internal_utils3.tw)([
380
+ "text-on-info-container",
381
+ "hover:bg-info/dim-5",
382
+ "enabled:active:bg-info/dim-5",
383
+ "focus-visible:bg-info/dim-5"
384
+ ])
385
+ },
386
+ {
387
+ intent: "neutral",
388
+ design: "ghost",
389
+ class: (0, import_internal_utils3.tw)([
390
+ "text-on-neutral-container",
391
+ "hover:bg-neutral/dim-5",
392
+ "enabled:active:bg-neutral/dim-5",
393
+ "focus-visible:bg-neutral/dim-5"
394
+ ])
395
+ },
396
+ {
397
+ intent: "surface",
398
+ design: "ghost",
399
+ class: (0, import_internal_utils3.tw)([
400
+ "text-surface",
401
+ "hover:bg-surface/dim-5",
402
+ "enabled:active:bg-surface/dim-5",
403
+ "focus-visible:bg-surface/dim-5"
404
+ ])
405
+ },
406
+ {
407
+ intent: "surfaceInverse",
408
+ design: "ghost",
409
+ class: (0, import_internal_utils3.tw)([
410
+ "text-surface-inverse",
411
+ "hover:bg-surface-inverse/dim-5",
412
+ "enabled:active:bg-surface-inverse/dim-5",
413
+ "focus-visible:bg-surface-inverse/dim-5"
414
+ ])
415
+ }
416
+ ];
417
+
418
+ // src/button/variants/outlined.ts
419
+ var import_internal_utils4 = require("@spark-ui/internal-utils");
420
+ var outlinedVariants = [
421
+ {
422
+ intent: "main",
423
+ design: "outlined",
424
+ class: (0, import_internal_utils4.tw)([
425
+ "hover:bg-main/dim-5",
426
+ "enabled:active:bg-main/dim-5",
427
+ "focus-visible:bg-main/dim-5",
428
+ "text-main"
429
+ ])
430
+ },
431
+ {
432
+ intent: "support",
433
+ design: "outlined",
434
+ class: (0, import_internal_utils4.tw)([
435
+ "hover:bg-support/dim-5",
436
+ "enabled:active:bg-support/dim-5",
437
+ "focus-visible:bg-support/dim-5",
438
+ "text-support"
439
+ ])
440
+ },
441
+ {
442
+ intent: "accent",
443
+ design: "outlined",
444
+ class: (0, import_internal_utils4.tw)([
445
+ "hover:bg-accent/dim-5",
446
+ "enabled:active:bg-accent/dim-5",
447
+ "focus-visible:bg-accent/dim-5",
448
+ "text-accent"
449
+ ])
450
+ },
451
+ {
452
+ intent: "basic",
453
+ design: "outlined",
454
+ class: (0, import_internal_utils4.tw)([
455
+ "hover:bg-basic/dim-5",
456
+ "enabled:active:bg-basic/dim-5",
457
+ "focus-visible:bg-basic/dim-5",
458
+ "text-basic"
459
+ ])
460
+ },
461
+ {
462
+ intent: "success",
463
+ design: "outlined",
464
+ class: (0, import_internal_utils4.tw)([
465
+ "hover:bg-success/dim-5",
466
+ "enabled:active:bg-success/dim-5",
467
+ "focus-visible:bg-success/dim-5",
468
+ "text-success"
469
+ ])
470
+ },
471
+ {
472
+ intent: "alert",
473
+ design: "outlined",
474
+ class: (0, import_internal_utils4.tw)([
475
+ "hover:bg-alert/dim-5",
476
+ "enabled:active:bg-alert/dim-5",
477
+ "focus-visible:bg-alert/dim-5",
478
+ "text-alert"
479
+ ])
480
+ },
481
+ {
482
+ intent: "danger",
483
+ design: "outlined",
484
+ class: (0, import_internal_utils4.tw)([
485
+ "hover:bg-error/dim-5",
486
+ "enabled:active:bg-error/dim-5",
487
+ "focus-visible:bg-error/dim-5",
488
+ "text-error"
489
+ ])
490
+ },
491
+ {
492
+ intent: "info",
493
+ design: "outlined",
494
+ class: (0, import_internal_utils4.tw)([
495
+ "hover:bg-info/dim-5",
496
+ "enabled:active:bg-info/dim-5",
497
+ "focus-visible:bg-info/dim-5",
498
+ "text-info"
499
+ ])
500
+ },
501
+ {
502
+ intent: "neutral",
503
+ design: "outlined",
504
+ class: (0, import_internal_utils4.tw)([
505
+ "hover:bg-neutral/dim-5",
506
+ "enabled:active:bg-neutral/dim-5",
507
+ "focus-visible:bg-neutral/dim-5",
508
+ "text-neutral"
509
+ ])
510
+ },
511
+ {
512
+ intent: "surface",
513
+ design: "outlined",
514
+ class: (0, import_internal_utils4.tw)([
515
+ "hover:bg-surface/dim-5",
516
+ "enabled:active:bg-surface/dim-5",
517
+ "focus-visible:bg-surface/dim-5",
518
+ "text-surface"
519
+ ])
520
+ },
521
+ {
522
+ intent: "surfaceInverse",
523
+ design: "outlined",
524
+ class: (0, import_internal_utils4.tw)([
525
+ "hover:bg-surface-inverse/dim-5",
526
+ "enabled:active:bg-surface-inverse/dim-5",
527
+ "focus-visible:bg-surface-inverse/dim-5",
528
+ "text-surface-inverse"
529
+ ])
530
+ }
531
+ ];
532
+
533
+ // src/button/variants/tinted.ts
534
+ var import_internal_utils5 = require("@spark-ui/internal-utils");
535
+ var tintedVariants = [
536
+ {
537
+ intent: "main",
538
+ design: "tinted",
539
+ class: (0, import_internal_utils5.tw)([
540
+ "bg-main-container",
541
+ "text-on-main-container",
542
+ "hover:bg-main-container-hovered",
543
+ "enabled:active:bg-main-container-hovered",
544
+ "focus-visible:bg-main-container-hovered"
545
+ ])
546
+ },
547
+ {
548
+ intent: "support",
549
+ design: "tinted",
550
+ class: (0, import_internal_utils5.tw)([
551
+ "bg-support-container",
552
+ "text-on-support-container",
553
+ "hover:bg-support-container-hovered",
554
+ "enabled:active:bg-support-container-hovered",
555
+ "focus-visible:bg-support-container-hovered"
556
+ ])
557
+ },
558
+ {
559
+ intent: "accent",
560
+ design: "tinted",
561
+ class: (0, import_internal_utils5.tw)([
562
+ "bg-accent-container",
563
+ "text-on-accent-container",
564
+ "hover:bg-accent-container-hovered",
565
+ "enabled:active:bg-accent-container-hovered",
566
+ "focus-visible:bg-accent-container-hovered"
567
+ ])
568
+ },
569
+ {
570
+ intent: "basic",
571
+ design: "tinted",
572
+ class: (0, import_internal_utils5.tw)([
573
+ "bg-basic-container",
574
+ "text-on-basic-container",
575
+ "hover:bg-basic-container-hovered",
576
+ "enabled:active:bg-basic-container-hovered",
577
+ "focus-visible:bg-basic-container-hovered"
578
+ ])
579
+ },
580
+ {
581
+ intent: "success",
582
+ design: "tinted",
583
+ class: (0, import_internal_utils5.tw)([
584
+ "bg-success-container",
585
+ "text-on-success-container",
586
+ "hover:bg-success-container-hovered",
587
+ "enabled:active:bg-success-container-hovered",
588
+ "focus-visible:bg-success-container-hovered"
589
+ ])
590
+ },
591
+ {
592
+ intent: "alert",
593
+ design: "tinted",
594
+ class: (0, import_internal_utils5.tw)([
595
+ "bg-alert-container",
596
+ "text-on-alert-container",
597
+ "hover:bg-alert-container-hovered",
598
+ "enabled:active:bg-alert-container-hovered",
599
+ "focus-visible:bg-alert-container-hovered"
600
+ ])
601
+ },
602
+ {
603
+ intent: "danger",
604
+ design: "tinted",
605
+ class: (0, import_internal_utils5.tw)([
606
+ "bg-error-container",
607
+ "text-on-error-container",
608
+ "hover:bg-error-container-hovered",
609
+ "enabled:active:bg-error-container-hovered",
610
+ "focus-visible:bg-error-container-hovered"
611
+ ])
612
+ },
613
+ {
614
+ intent: "info",
615
+ design: "tinted",
616
+ class: (0, import_internal_utils5.tw)([
617
+ "bg-info-container",
618
+ "text-on-info-container",
619
+ "hover:bg-info-container-hovered",
620
+ "enabled:active:bg-info-container-hovered",
621
+ "focus-visible:bg-info-container-hovered"
622
+ ])
623
+ },
624
+ {
625
+ intent: "neutral",
626
+ design: "tinted",
627
+ class: (0, import_internal_utils5.tw)([
628
+ "bg-neutral-container",
629
+ "text-on-neutral-container",
630
+ "hover:bg-neutral-container-hovered",
631
+ "enabled:active:bg-neutral-container-hovered",
632
+ "focus-visible:bg-neutral-container-hovered"
633
+ ])
634
+ },
635
+ {
636
+ intent: "surface",
637
+ design: "tinted",
638
+ class: (0, import_internal_utils5.tw)([
639
+ "bg-surface",
640
+ "text-on-surface",
641
+ "hover:bg-surface-hovered",
642
+ "enabled:active:bg-surface-hovered",
643
+ "focus-visible:bg-surface-hovered"
644
+ ])
645
+ },
646
+ {
647
+ intent: "surfaceInverse",
648
+ design: "tinted",
649
+ class: (0, import_internal_utils5.tw)([
650
+ "bg-surface-inverse",
651
+ "text-on-surface-inverse",
652
+ "hover:bg-surface-inverse-hovered",
653
+ "enabled:active:bg-surface-inverse-hovered",
654
+ "focus-visible:bg-surface-inverse-hovered"
655
+ ])
656
+ }
657
+ ];
658
+
659
+ // src/button/variants/contrast.ts
660
+ var import_internal_utils6 = require("@spark-ui/internal-utils");
661
+ var contrastVariants = [
662
+ {
663
+ intent: "main",
664
+ design: "contrast",
665
+ class: (0, import_internal_utils6.tw)([
666
+ "text-on-main-contaier bg-surface",
667
+ "hover:bg-main-container-hovered",
668
+ "enabled:active:bg-main-container-hovered",
669
+ "focus-visible:bg-main-container-hovered"
670
+ ])
671
+ },
672
+ {
673
+ intent: "support",
674
+ design: "contrast",
675
+ class: (0, import_internal_utils6.tw)([
676
+ "text-on-support-container bg-surface",
677
+ "hover:bg-support-container-hovered",
678
+ "enabled:active:bg-support-container-hovered",
679
+ "focus-visible:bg-support-container-hovered"
680
+ ])
681
+ },
682
+ {
683
+ intent: "accent",
684
+ design: "contrast",
685
+ class: (0, import_internal_utils6.tw)([
686
+ "text-on-accent-container bg-surface",
687
+ "hover:bg-accent-container-hovered",
688
+ "enabled:active:bg-accent-container-hovered",
689
+ "focus-visible:bg-accent-container-hovered"
690
+ ])
691
+ },
692
+ {
693
+ intent: "basic",
694
+ design: "contrast",
695
+ class: (0, import_internal_utils6.tw)([
696
+ "text-on-basic-container bg-surface",
697
+ "hover:bg-basic-container-hovered",
698
+ "enabled:active:bg-basic-container-hovered",
699
+ "focus-visible:bg-basic-container-hovered"
700
+ ])
701
+ },
702
+ {
703
+ intent: "success",
704
+ design: "contrast",
705
+ class: (0, import_internal_utils6.tw)([
706
+ "text-on-success-container bg-surface",
707
+ "hover:bg-success-container-hovered",
708
+ "enabled:active:bg-success-container-hovered",
709
+ "focus-visible:bg-success-container-hovered"
710
+ ])
711
+ },
712
+ {
713
+ intent: "alert",
714
+ design: "contrast",
715
+ class: (0, import_internal_utils6.tw)([
716
+ "text-on-alert-container bg-surface",
717
+ "hover:bg-alert-container-hovered",
718
+ "enabled:active:bg-alert-container-hovered",
719
+ "focus-visible:bg-alert-container-hovered"
720
+ ])
721
+ },
722
+ {
723
+ intent: "danger",
724
+ design: "contrast",
725
+ class: (0, import_internal_utils6.tw)([
726
+ "text-on-error-container bg-surface",
727
+ "hover:bg-error-container-hovered",
728
+ "enabled:active:bg-error-container-hovered",
729
+ "focus-visible:bg-error-container-hovered"
730
+ ])
731
+ },
732
+ {
733
+ intent: "info",
734
+ design: "contrast",
735
+ class: (0, import_internal_utils6.tw)([
736
+ "text-on-info-container bg-surface",
737
+ "hover:bg-info-container-hovered",
738
+ "enabled:active:bg-info-container-hovered",
739
+ "focus-visible:bg-info-container-hovered"
740
+ ])
741
+ },
742
+ {
743
+ intent: "neutral",
744
+ design: "contrast",
745
+ class: (0, import_internal_utils6.tw)([
746
+ "text-on-neutral-container bg-surface",
747
+ "hover:bg-neutral-container-hovered",
748
+ "enabled:active:bg-neutral-container-hovered",
749
+ "focus-visible:bg-neutral-container-hovered"
750
+ ])
751
+ },
752
+ {
753
+ intent: "surface",
754
+ design: "contrast",
755
+ class: (0, import_internal_utils6.tw)([
756
+ "text-on-surface bg-surface",
757
+ "hover:bg-surface-hovered",
758
+ "enabled:active:bg-surface-hovered",
759
+ "focus-visible:bg-surface-hovered"
760
+ ])
761
+ },
762
+ {
763
+ intent: "surfaceInverse",
764
+ design: "contrast",
765
+ class: (0, import_internal_utils6.tw)([
766
+ "text-on-surface-inverse bg-surface-inverse",
767
+ "hover:bg-surface-inverse-hovered",
768
+ "enabled:active:bg-surface-inverse-hovered",
769
+ "focus-visible:bg-surface-inverse-hovered"
770
+ ])
771
+ }
772
+ ];
773
+
774
+ // src/button/Button.styles.tsx
775
+ var buttonStyles = (0, import_class_variance_authority2.cva)(
776
+ [
777
+ "u-shadow-border-transition",
778
+ "box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
779
+ "default:px-lg",
780
+ "text-body-1 font-bold",
781
+ "focus-visible:u-outline"
782
+ ],
783
+ {
784
+ variants: {
785
+ /**
786
+ * Main style of the button.
787
+ *
788
+ * - `filled`: Button will be plain.
789
+ *
790
+ * - `outlined`: Button will be transparent with an outline.
791
+ *
792
+ * - `tinted`: Button will be filled but using a lighter color scheme.
793
+ *
794
+ * - `ghost`: Button will look like a link. No borders, plain text.
795
+ *
796
+ * - `contrast`: Button will be surface filled. No borders, plain text.
797
+ *
798
+ */
799
+ design: (0, import_internal_utils7.makeVariants)({
800
+ filled: [],
801
+ outlined: ["bg-transparent", "border-sm", "border-current"],
802
+ tinted: [],
803
+ ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
804
+ contrast: []
805
+ }),
806
+ underline: {
807
+ true: ["underline"]
808
+ },
809
+ /**
810
+ * Color scheme of the button.
811
+ */
812
+ intent: (0, import_internal_utils7.makeVariants)({
813
+ main: [],
814
+ support: [],
815
+ accent: [],
816
+ basic: [],
817
+ success: [],
818
+ alert: [],
819
+ danger: [],
820
+ info: [],
821
+ neutral: [],
822
+ surface: [],
823
+ surfaceInverse: []
824
+ }),
825
+ /**
826
+ * Size of the button.
827
+ */
828
+ size: (0, import_internal_utils7.makeVariants)({
829
+ sm: ["min-w-sz-32", "h-sz-32"],
830
+ md: ["min-w-sz-44", "h-sz-44"],
831
+ lg: ["min-w-sz-56", "h-sz-56"]
832
+ }),
833
+ /**
834
+ * Shape of the button.
835
+ */
836
+ shape: (0, import_internal_utils7.makeVariants)({
837
+ rounded: ["rounded-lg"],
838
+ square: ["rounded-0"],
839
+ pill: ["rounded-full"]
840
+ }),
841
+ /**
842
+ * Disable the button, preventing user interaction and adding opacity.
843
+ */
844
+ disabled: {
845
+ true: ["cursor-not-allowed", "opacity-dim-3"],
846
+ false: ["cursor-pointer"]
847
+ }
848
+ },
849
+ compoundVariants: [
850
+ ...filledVariants,
851
+ ...outlinedVariants,
852
+ ...tintedVariants,
853
+ ...ghostVariants,
854
+ ...contrastVariants
855
+ ],
856
+ defaultVariants: {
857
+ design: "filled",
858
+ intent: "main",
859
+ size: "md",
860
+ shape: "rounded"
861
+ }
862
+ }
863
+ );
864
+
865
+ // src/button/Button.tsx
866
+ var import_jsx_runtime4 = require("react/jsx-runtime");
867
+ var blockedEventHandlers = [
868
+ "onClick",
869
+ "onMouseDown",
870
+ "onMouseUp",
871
+ "onMouseEnter",
872
+ "onMouseLeave",
873
+ "onMouseOver",
874
+ "onMouseOut",
875
+ "onKeyDown",
876
+ "onKeyPress",
877
+ "onKeyUp",
878
+ "onSubmit"
879
+ ];
880
+ var Button = ({
881
+ children,
882
+ design = "filled",
883
+ disabled = false,
884
+ intent = "main",
885
+ isLoading = false,
886
+ loadingLabel,
887
+ loadingText,
888
+ shape = "rounded",
889
+ size = "md",
890
+ asChild,
891
+ className,
892
+ underline = false,
893
+ ref,
894
+ ...others
895
+ }) => {
896
+ const Component = asChild ? Slot : "button";
897
+ const shouldNotInteract = !!disabled || isLoading;
898
+ const disabledEventHandlers = (0, import_react2.useMemo)(() => {
899
+ const result = {};
900
+ if (shouldNotInteract) {
901
+ blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
902
+ }
903
+ return result;
904
+ }, [shouldNotInteract]);
905
+ const spinnerProps = {
906
+ size: "current",
907
+ className: loadingText ? "inline-block" : "absolute",
908
+ ...loadingLabel && { "aria-label": loadingLabel }
909
+ };
910
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
911
+ Component,
912
+ {
913
+ "data-spark-component": "button",
914
+ ...Component === "button" && { type: "button" },
915
+ ref,
916
+ className: buttonStyles({
917
+ className,
918
+ design,
919
+ disabled: shouldNotInteract,
920
+ intent,
921
+ shape,
922
+ size,
923
+ underline
924
+ }),
925
+ disabled: !!disabled,
926
+ "aria-busy": isLoading,
927
+ "aria-live": isLoading ? "assertive" : "off",
928
+ ...others,
929
+ ...disabledEventHandlers,
930
+ children: wrapPolymorphicSlot(
931
+ asChild,
932
+ children,
933
+ (slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
934
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { ...spinnerProps }),
935
+ loadingText && loadingText,
936
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
937
+ "div",
938
+ {
939
+ "aria-hidden": true,
940
+ className: (0, import_class_variance_authority3.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
941
+ children: slotted
942
+ }
943
+ )
944
+ ] }) : slotted
945
+ )
946
+ }
947
+ );
948
+ };
949
+ Button.displayName = "Button";
950
+
951
+ // src/icon/Icon.tsx
952
+ var import_react3 = require("react");
953
+
954
+ // src/icon/Icon.styles.tsx
955
+ var import_internal_utils8 = require("@spark-ui/internal-utils");
956
+ var import_class_variance_authority4 = require("class-variance-authority");
957
+ var iconStyles = (0, import_class_variance_authority4.cva)(["fill-current shrink-0"], {
958
+ variants: {
959
+ /**
960
+ * Color scheme of the icon.
961
+ */
962
+ intent: (0, import_internal_utils8.makeVariants)({
963
+ current: ["text-current"],
964
+ main: ["text-main"],
965
+ support: ["text-support"],
966
+ accent: ["text-accent"],
967
+ basic: ["text-basic"],
968
+ success: ["text-success"],
969
+ alert: ["text-alert"],
970
+ error: ["text-error"],
971
+ info: ["text-info"],
972
+ neutral: ["text-neutral"]
973
+ }),
974
+ /**
975
+ * Sets the size of the icon.
976
+ */
977
+ size: (0, import_internal_utils8.makeVariants)({
978
+ current: ["u-current-font-size"],
979
+ sm: ["w-sz-16", "h-sz-16"],
980
+ md: ["w-sz-24", "h-sz-24"],
981
+ lg: ["w-sz-32", "h-sz-32"],
982
+ xl: ["w-sz-40", "h-sz-40"]
983
+ })
984
+ }
985
+ });
986
+
987
+ // src/icon/Icon.tsx
988
+ var import_jsx_runtime5 = require("react/jsx-runtime");
989
+ var Icon = ({
990
+ label,
991
+ className,
992
+ size = "current",
993
+ intent = "current",
994
+ children,
995
+ ...others
996
+ }) => {
997
+ const child = import_react3.Children.only(children);
998
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
999
+ (0, import_react3.cloneElement)(child, {
1000
+ className: iconStyles({ className, size, intent }),
1001
+ "data-spark-component": "icon",
1002
+ "aria-hidden": "true",
1003
+ focusable: "false",
1004
+ ...others
1005
+ }),
1006
+ label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
1007
+ ] });
1008
+ };
1009
+ Icon.displayName = "Icon";
1010
+
1011
+ // src/icon-button/IconButton.styles.tsx
1012
+ var import_internal_utils9 = require("@spark-ui/internal-utils");
1013
+ var import_class_variance_authority5 = require("class-variance-authority");
1014
+ var iconButtonStyles = (0, import_class_variance_authority5.cva)(["pl-0 pr-0"], {
1015
+ variants: {
1016
+ /**
1017
+ * Sets the size of the icon.
1018
+ */
1019
+ size: (0, import_internal_utils9.makeVariants)({
1020
+ sm: ["text-body-1"],
1021
+ md: ["text-body-1"],
1022
+ lg: ["text-display-3"]
1023
+ })
1024
+ }
1025
+ });
1026
+
1027
+ // src/icon-button/IconButton.tsx
1028
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1029
+ var IconButton = ({
1030
+ design = "filled",
1031
+ disabled = false,
1032
+ intent = "main",
1033
+ shape = "rounded",
1034
+ size = "md",
1035
+ className,
1036
+ ref,
1037
+ ...others
1038
+ }) => {
1039
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1040
+ Button,
1041
+ {
1042
+ "data-spark-component": "icon-button",
1043
+ ref,
1044
+ className: iconButtonStyles({ size, className }),
1045
+ design,
1046
+ disabled,
1047
+ intent,
1048
+ shape,
1049
+ size,
1050
+ ...others
1051
+ }
1052
+ );
1053
+ };
1054
+ IconButton.displayName = "IconButton";
1055
+
1056
+ // src/toast/Toast.tsx
1057
+ var import_Close = require("@spark-ui/icons/Close");
1058
+ var import_class_variance_authority7 = require("class-variance-authority");
1059
+
1060
+ // src/toast/Toast.styles.ts
1061
+ var import_class_variance_authority6 = require("class-variance-authority");
1062
+ var toastStyles = (0, import_class_variance_authority6.cva)(
1063
+ [
1064
+ "gap-lg p-lg flex w-max !w-[min(400px,calc(100vw-2rem))] flex-col rounded-lg",
1065
+ "absolute right-0 bottom-0 left-auto mr-0",
1066
+ "bg-clip-padding shadow-md select-none",
1067
+ "focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none",
1068
+ "z-[calc(1000-var(--toast-index))]",
1069
+ "after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
1070
+ // Stack effect while not focused
1071
+ "[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]",
1072
+ // Scale and translate
1073
+ "ease-standard [transition-property:opacity,transform]",
1074
+ "duration-400",
1075
+ // Present when the toast is animating in.
1076
+ "data-[starting-style]:[transform:translateY(150%)]",
1077
+ // Expanded: Present when the toast is expanded in the viewport.
1078
+ "data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]",
1079
+ // Present when the toast is animating out.
1080
+ "data-[ending-style]:duration-250",
1081
+ "data-[ending-style]:opacity-0",
1082
+ "data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
1083
+ "data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
1084
+ "data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
1085
+ // Limited: Present when the toast was removed due to exceeding the limit.
1086
+ "data-[limited]:opacity-0"
1087
+ ],
1088
+ {
1089
+ variants: {
1090
+ design: {
1091
+ filled: "",
1092
+ tinted: ""
1093
+ },
1094
+ intent: {
1095
+ success: "",
1096
+ alert: "",
1097
+ error: "",
1098
+ info: "",
1099
+ neutral: "",
1100
+ main: "",
1101
+ basic: "",
1102
+ support: "",
1103
+ accent: "",
1104
+ surface: "",
1105
+ surfaceInverse: ""
1106
+ }
1107
+ },
1108
+ compoundVariants: [
1109
+ // Filled variants
1110
+ {
1111
+ design: "filled",
1112
+ intent: "success",
1113
+ class: ["bg-success text-on-success"]
1114
+ },
1115
+ {
1116
+ design: "filled",
1117
+ intent: "alert",
1118
+ class: ["bg-alert text-on-alert"]
1119
+ },
1120
+ {
1121
+ design: "filled",
1122
+ intent: "error",
1123
+ class: ["bg-error text-on-error"]
1124
+ },
1125
+ {
1126
+ design: "filled",
1127
+ intent: "info",
1128
+ class: ["bg-info text-on-info"]
1129
+ },
1130
+ {
1131
+ design: "filled",
1132
+ intent: "neutral",
1133
+ class: ["bg-neutral text-on-neutral"]
1134
+ },
1135
+ {
1136
+ design: "filled",
1137
+ intent: "main",
1138
+ class: ["bg-main text-on-main"]
1139
+ },
1140
+ {
1141
+ design: "filled",
1142
+ intent: "basic",
1143
+ class: ["bg-basic text-on-basic"]
1144
+ },
1145
+ {
1146
+ design: "filled",
1147
+ intent: "support",
1148
+ class: ["bg-support text-on-support"]
1149
+ },
1150
+ {
1151
+ design: "filled",
1152
+ intent: "accent",
1153
+ class: ["bg-accent text-on-accent"]
1154
+ },
1155
+ {
1156
+ design: "filled",
1157
+ intent: "surface",
1158
+ class: ["bg-surface text-on-surface"]
1159
+ },
1160
+ {
1161
+ design: "filled",
1162
+ intent: "surfaceInverse",
1163
+ class: ["bg-surface-inverse text-on-surface-inverse"]
1164
+ },
1165
+ // Tinted variants
1166
+ {
1167
+ design: "tinted",
1168
+ intent: "success",
1169
+ class: ["bg-success-container text-on-success-container"]
1170
+ },
1171
+ {
1172
+ design: "tinted",
1173
+ intent: "alert",
1174
+ class: ["bg-alert-container text-on-alert-container"]
1175
+ },
1176
+ {
1177
+ design: "tinted",
1178
+ intent: "error",
1179
+ class: ["bg-error-container text-on-error-container"]
1180
+ },
1181
+ {
1182
+ design: "tinted",
1183
+ intent: "info",
1184
+ class: ["bg-info-container text-on-info-container"]
1185
+ },
1186
+ {
1187
+ design: "tinted",
1188
+ intent: "neutral",
1189
+ class: ["bg-neutral-container text-on-neutral-container"]
1190
+ },
1191
+ {
1192
+ design: "tinted",
1193
+ intent: "main",
1194
+ class: ["bg-main-container text-on-main-container"]
1195
+ },
1196
+ {
1197
+ design: "tinted",
1198
+ intent: "basic",
1199
+ class: ["bg-basic-container text-on-basic-container"]
1200
+ },
1201
+ {
1202
+ design: "tinted",
1203
+ intent: "support",
1204
+ class: ["bg-support-container text-on-support-container"]
1205
+ },
1206
+ {
1207
+ design: "tinted",
1208
+ intent: "accent",
1209
+ class: ["bg-accent-container text-on-accent-container"]
1210
+ },
1211
+ {
1212
+ design: "tinted",
1213
+ intent: "surface",
1214
+ class: ["bg-surface text-on-surface"]
1215
+ },
1216
+ {
1217
+ design: "tinted",
1218
+ intent: "surfaceInverse",
1219
+ class: ["bg-surface-inverse text-on-surface-inverse"]
1220
+ }
1221
+ ],
1222
+ defaultVariants: {
1223
+ design: "filled",
1224
+ intent: "neutral"
1225
+ }
1226
+ }
1227
+ );
1228
+ var snackbarItemVariantContent = (0, import_class_variance_authority6.cva)(
1229
+ [
1230
+ "inline-grid items-center",
1231
+ "col-start-1 row-start-1",
1232
+ "pl-md pr-lg"
1233
+ // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷
1234
+ ],
1235
+ {
1236
+ variants: {
1237
+ /**
1238
+ * Force action button displaying on a new line
1239
+ * @default false
1240
+ */
1241
+ actionOnNewline: {
1242
+ true: [
1243
+ "grid-rows-[52px_1fr_52px]",
1244
+ "grid-cols-[min-content_1fr_min-content]",
1245
+ "[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']"
1246
+ ],
1247
+ false: [
1248
+ "grid-cols-[min-content_1fr_min-content_min-content]",
1249
+ "[grid-template-areas:'icon_message_action_close']"
1250
+ ]
1251
+ }
1252
+ },
1253
+ defaultVariants: {
1254
+ actionOnNewline: false
1255
+ }
1256
+ }
1257
+ );
1258
+
1259
+ // src/toast/Toast.tsx
1260
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1261
+ function getButtonIntent(intent) {
1262
+ if (intent === "surfaceInverse") return "surface";
1263
+ if (intent === "surface") return "surfaceInverse";
1264
+ if (intent === "error") return "danger";
1265
+ return intent;
1266
+ }
1267
+ var getActionProps = (action, { toastDesign, toastIntent }) => {
1268
+ if (!action) return {};
1269
+ const { design, intent, className, onClick, ...rest } = action;
1270
+ return {
1271
+ design: design ?? (toastDesign === "filled" ? "tinted" : "filled"),
1272
+ intent: intent ?? getButtonIntent(toastIntent),
1273
+ className: (0, import_class_variance_authority7.cx)("mt-md self-start", className),
1274
+ onClick,
1275
+ ...rest
1276
+ };
1277
+ };
1278
+ function Toast({ toast }) {
1279
+ const {
1280
+ icon: ToastIcon,
1281
+ intent,
1282
+ design,
1283
+ action,
1284
+ isClosable,
1285
+ closeLabel = "Close"
1286
+ } = toast.data ?? {};
1287
+ const ActionButton = action?.close ? import_toast.Toast.Close : import_toast.Toast.Action;
1288
+ const actionProps = getActionProps(action, {
1289
+ toastDesign: design,
1290
+ toastIntent: intent
1291
+ });
1292
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1293
+ import_toast.Toast.Root,
1294
+ {
1295
+ swipeDirection: ["down", "right"],
1296
+ toast,
1297
+ className: (0, import_class_variance_authority7.cx)(
1298
+ toastStyles({
1299
+ design,
1300
+ intent
1301
+ })
1302
+ ),
1303
+ style: {
1304
+ ["--gap"]: "var(--spacing-md)",
1305
+ ["--offset-y"]: "calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))"
1306
+ },
1307
+ children: [
1308
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gap-lg flex items-center", children: [
1309
+ ToastIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "md", children: ToastIcon }),
1310
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gap-sm flex flex-col", children: [
1311
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Title, { className: toast.description ? "text-headline-2" : "text-body-1" }),
1312
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_toast.Toast.Description, { className: "text-body-1" }),
1313
+ action && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ActionButton, { render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { ...actionProps }), children: action.label })
1314
+ ] })
1315
+ ] }),
1316
+ isClosable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1317
+ import_toast.Toast.Close,
1318
+ {
1319
+ className: "top-sm right-sm absolute",
1320
+ render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1321
+ IconButton,
1322
+ {
1323
+ "aria-label": closeLabel,
1324
+ design,
1325
+ intent: getButtonIntent(intent),
1326
+ size: "sm"
1327
+ }
1328
+ ),
1329
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Close.Close, {}) })
1330
+ }
1331
+ )
1332
+ ]
1333
+ },
1334
+ toast.id
1335
+ );
1336
+ }
1337
+
1338
+ // src/toast/useToastManager.ts
1339
+ var import_toast2 = require("@base-ui-components/react/toast");
1340
+ var React = __toESM(require("react"));
1341
+ function useToastManager() {
1342
+ const baseToastManager = import_toast2.Toast.useToastManager();
1343
+ const closeAll = React.useCallback(() => {
1344
+ baseToastManager.toasts.forEach(({ id }) => baseToastManager.close(id));
1345
+ }, [baseToastManager]);
1346
+ return {
1347
+ ...baseToastManager,
1348
+ closeAll
1349
+ };
1350
+ }
1351
+
1352
+ // src/toast/index.tsx
1353
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1354
+ function ToastList() {
1355
+ const { toasts } = useToastManager();
1356
+ return toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Toast, { toast }, toast.id));
1357
+ }
1358
+ function ToastProvider({ children, limit = 3 }) {
1359
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_toast3.Toast.Provider, { limit, children: [
1360
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_toast3.Toast.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1361
+ import_toast3.Toast.Viewport,
1362
+ {
1363
+ className: (0, import_class_variance_authority8.cx)(
1364
+ "z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end"
1365
+ ),
1366
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ToastList, {})
1367
+ }
1368
+ ) }),
1369
+ children
1370
+ ] });
1371
+ }
1372
+ function ToastTrigger({
1373
+ children,
1374
+ onClick,
1375
+ asChild = false,
1376
+ title,
1377
+ description,
1378
+ timeout = 5e3,
1379
+ design = "filled",
1380
+ intent = "neutral",
1381
+ isClosable = true,
1382
+ icon,
1383
+ action,
1384
+ priority = "low"
1385
+ }) {
1386
+ const toastManager = import_toast3.Toast.useToastManager();
1387
+ const Component = asChild ? Slot : "button";
1388
+ function createToast(e) {
1389
+ onClick?.(e);
1390
+ toastManager.add({
1391
+ title,
1392
+ description,
1393
+ timeout,
1394
+ priority,
1395
+ data: {
1396
+ design,
1397
+ intent,
1398
+ isClosable,
1399
+ ...icon && { icon },
1400
+ action
1401
+ }
1402
+ });
1403
+ }
1404
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Component, { ...!asChild && { type: "button" }, onClick: createToast, children });
1405
+ }
1406
+ // Annotate the CommonJS export names for ESM import in node:
1407
+ 0 && (module.exports = {
1408
+ ToastProvider,
1409
+ ToastTrigger,
1410
+ useToastManager
1411
+ });
1412
+ //# sourceMappingURL=index.js.map