@spark-ui/components 11.1.0 → 11.1.1

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 (143) 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.ts +21 -0
  117. package/dist/spinner/index.js +139 -0
  118. package/dist/spinner/index.js.map +1 -0
  119. package/dist/stepper/index.d.ts +81 -0
  120. package/dist/stepper/index.js +1847 -0
  121. package/dist/stepper/index.js.map +1 -0
  122. package/dist/switch/index.d.ts +64 -0
  123. package/dist/switch/index.js +327 -0
  124. package/dist/switch/index.js.map +1 -0
  125. package/dist/tabs/index.d.ts +103 -0
  126. package/dist/tabs/index.js +1376 -0
  127. package/dist/tabs/index.js.map +1 -0
  128. package/dist/tag/index.d.ts +29 -0
  129. package/dist/tag/index.js +283 -0
  130. package/dist/tag/index.js.map +1 -0
  131. package/dist/text-link/index.d.ts +20 -0
  132. package/dist/text-link/index.js +100 -0
  133. package/dist/text-link/index.js.map +1 -0
  134. package/dist/textarea/index.d.ts +57 -0
  135. package/dist/textarea/index.js +797 -0
  136. package/dist/textarea/index.js.map +1 -0
  137. package/dist/toast/index.d.ts +56 -0
  138. package/dist/toast/index.js +1412 -0
  139. package/dist/toast/index.js.map +1 -0
  140. package/dist/visually-hidden/index.d.ts +16 -0
  141. package/dist/visually-hidden/index.js +67 -0
  142. package/dist/visually-hidden/index.js.map +1 -0
  143. package/package.json +5 -5
@@ -0,0 +1,1756 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/snackbar/index.ts
21
+ var snackbar_exports = {};
22
+ __export(snackbar_exports, {
23
+ Snackbar: () => Snackbar2,
24
+ addSnackbar: () => addSnackbar,
25
+ clearSnackbarQueue: () => clearSnackbarQueue
26
+ });
27
+ module.exports = __toCommonJS(snackbar_exports);
28
+
29
+ // src/snackbar/Snackbar.tsx
30
+ var import_toast3 = require("@react-stately/toast");
31
+ var import_react9 = require("react");
32
+ var import_react_dom = require("react-dom");
33
+
34
+ // src/snackbar/SnackbarRegion.tsx
35
+ var import_toast2 = require("@react-aria/toast");
36
+ var import_react7 = require("react");
37
+
38
+ // src/snackbar/SnackbarItem.tsx
39
+ var import_toast = require("@react-aria/toast");
40
+ var import_react6 = require("react");
41
+
42
+ // src/snackbar/SnackbarItem.styles.ts
43
+ var import_class_variance_authority = require("class-variance-authority");
44
+
45
+ // src/snackbar/snackbarVariants.ts
46
+ var filledVariants = [
47
+ {
48
+ design: "filled",
49
+ intent: "success",
50
+ class: ["bg-success text-on-success"]
51
+ },
52
+ {
53
+ design: "filled",
54
+ intent: "alert",
55
+ class: ["bg-alert text-on-alert"]
56
+ },
57
+ {
58
+ design: "filled",
59
+ intent: "error",
60
+ class: ["bg-error text-on-error"]
61
+ },
62
+ {
63
+ design: "filled",
64
+ intent: "info",
65
+ class: ["bg-info text-on-info"]
66
+ },
67
+ {
68
+ design: "filled",
69
+ intent: "neutral",
70
+ class: ["bg-neutral text-on-neutral"]
71
+ },
72
+ {
73
+ design: "filled",
74
+ intent: "main",
75
+ class: ["bg-main text-on-main"]
76
+ },
77
+ {
78
+ design: "filled",
79
+ intent: "basic",
80
+ class: ["bg-basic text-on-basic"]
81
+ },
82
+ {
83
+ design: "filled",
84
+ intent: "support",
85
+ class: ["bg-support text-on-support"]
86
+ },
87
+ {
88
+ design: "filled",
89
+ intent: "accent",
90
+ class: ["bg-accent text-on-accent"]
91
+ },
92
+ {
93
+ design: "filled",
94
+ intent: "inverse",
95
+ class: ["bg-surface-inverse text-on-surface-inverse"]
96
+ }
97
+ ];
98
+ var tintedVariants = [
99
+ {
100
+ design: "tinted",
101
+ intent: "success",
102
+ class: ["bg-success-container text-on-success-container"]
103
+ },
104
+ {
105
+ design: "tinted",
106
+ intent: "alert",
107
+ class: ["bg-alert-container text-on-alert-container"]
108
+ },
109
+ {
110
+ design: "tinted",
111
+ intent: "error",
112
+ class: ["bg-error-container text-on-error-container"]
113
+ },
114
+ {
115
+ design: "tinted",
116
+ intent: "info",
117
+ class: ["bg-info-container text-on-info-container"]
118
+ },
119
+ {
120
+ design: "tinted",
121
+ intent: "neutral",
122
+ class: ["bg-neutral-container text-on-neutral-container"]
123
+ },
124
+ {
125
+ design: "tinted",
126
+ intent: "main",
127
+ class: ["bg-main-container text-on-main-container"]
128
+ },
129
+ {
130
+ design: "tinted",
131
+ intent: "basic",
132
+ class: ["bg-basic-container text-on-basic-container"]
133
+ },
134
+ {
135
+ design: "tinted",
136
+ intent: "support",
137
+ class: ["bg-support-container text-on-support-container"]
138
+ },
139
+ {
140
+ design: "tinted",
141
+ intent: "accent",
142
+ class: ["bg-accent-container text-on-accent-container"]
143
+ },
144
+ {
145
+ design: "tinted",
146
+ intent: "inverse",
147
+ class: ["bg-surface-inverse text-on-surface-inverse"]
148
+ }
149
+ ];
150
+
151
+ // src/snackbar/SnackbarItem.styles.ts
152
+ var snackbarItemVariant = (0, import_class_variance_authority.cva)(
153
+ [
154
+ "rounded-md shadow-sm",
155
+ "max-w-[600px]",
156
+ "cursor-default pointer-events-auto touch-none select-none",
157
+ "absolute",
158
+ /**
159
+ * Focus
160
+ */
161
+ "group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset",
162
+ /**
163
+ * Positionning
164
+ */
165
+ "group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0",
166
+ "group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0",
167
+ /**
168
+ * Animation and opacity
169
+ */
170
+ "animation-duration-400",
171
+ "[animation-fill-mode: forwards]!",
172
+ "data-[animation=queued]:animate-fade-in",
173
+ "data-[animation=entering]:animation-ease-decelerate-back",
174
+ "data-[animation=exiting]:animation-ease-accelerate",
175
+ // Parent position bottom|bottom-left|bottom-right
176
+ "data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom",
177
+ "data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity",
178
+ "data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom",
179
+ "data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom",
180
+ "data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom",
181
+ "data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom",
182
+ "data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom",
183
+ // Parent position top|top-left|top-right
184
+ "data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top",
185
+ "data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top",
186
+ "data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top",
187
+ "data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top",
188
+ "data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top",
189
+ "data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top",
190
+ /**
191
+ * Swipe
192
+ */
193
+ "data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x)",
194
+ "data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x)",
195
+ "data-[swipe=cancel]:translate-x-0",
196
+ "data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right",
197
+ "data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left"
198
+ ],
199
+ {
200
+ variants: {
201
+ /**
202
+ * Set different look and feel
203
+ * @default 'filled'
204
+ */
205
+ design: {
206
+ filled: "",
207
+ tinted: ""
208
+ },
209
+ /**
210
+ * Set color intent
211
+ * @default 'neutral'
212
+ */
213
+ intent: {
214
+ success: "",
215
+ alert: "",
216
+ error: "",
217
+ info: "",
218
+ neutral: "",
219
+ main: "",
220
+ basic: "",
221
+ support: "",
222
+ accent: "",
223
+ inverse: ""
224
+ }
225
+ },
226
+ compoundVariants: [...filledVariants, ...tintedVariants],
227
+ defaultVariants: {
228
+ design: "filled",
229
+ intent: "neutral"
230
+ }
231
+ }
232
+ );
233
+ var snackbarItemVariantContent = (0, import_class_variance_authority.cva)(
234
+ [
235
+ "inline-grid items-center",
236
+ "col-start-1 row-start-1",
237
+ "pl-md pr-lg"
238
+ // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷
239
+ ],
240
+ {
241
+ variants: {
242
+ /**
243
+ * Force action button displaying on a new line
244
+ * @default false
245
+ */
246
+ actionOnNewline: {
247
+ true: [
248
+ "grid-rows-[52px_1fr_52px]",
249
+ "grid-cols-[min-content_1fr_min-content]",
250
+ "[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']"
251
+ ],
252
+ false: [
253
+ "grid-cols-[min-content_1fr_min-content_min-content]",
254
+ "[grid-template-areas:'icon_message_action_close']"
255
+ ]
256
+ }
257
+ },
258
+ defaultVariants: {
259
+ actionOnNewline: false
260
+ }
261
+ }
262
+ );
263
+
264
+ // src/snackbar/SnackbarItemAction.tsx
265
+ var import_class_variance_authority5 = require("class-variance-authority");
266
+
267
+ // src/button/Button.tsx
268
+ var import_class_variance_authority4 = require("class-variance-authority");
269
+ var import_react2 = require("react");
270
+
271
+ // src/slot/Slot.tsx
272
+ var import_radix_ui = require("radix-ui");
273
+ var import_react = require("react");
274
+ var import_jsx_runtime = require("react/jsx-runtime");
275
+ var Slottable = import_radix_ui.Slot.Slottable;
276
+ var Slot = ({ ref, ...props }) => {
277
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
278
+ };
279
+ var wrapPolymorphicSlot = (asChild, children, callback) => {
280
+ if (!asChild) return callback(children);
281
+ return (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(
282
+ children,
283
+ void 0,
284
+ callback(children.props.children)
285
+ ) : null;
286
+ };
287
+
288
+ // src/visually-hidden/VisuallyHidden.tsx
289
+ var import_jsx_runtime2 = require("react/jsx-runtime");
290
+ var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
291
+ const Component = asChild ? Slot : "span";
292
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
293
+ Component,
294
+ {
295
+ ...props,
296
+ ref,
297
+ style: {
298
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
299
+ position: "absolute",
300
+ border: 0,
301
+ width: 1,
302
+ height: 1,
303
+ padding: 0,
304
+ margin: -1,
305
+ overflow: "hidden",
306
+ clip: "rect(0, 0, 0, 0)",
307
+ whiteSpace: "nowrap",
308
+ wordWrap: "normal",
309
+ ...props.style
310
+ }
311
+ }
312
+ );
313
+ };
314
+ VisuallyHidden.displayName = "VisuallyHidden";
315
+
316
+ // src/spinner/Spinner.styles.tsx
317
+ var import_internal_utils = require("@spark-ui/internal-utils");
318
+ var import_class_variance_authority2 = require("class-variance-authority");
319
+ var defaultVariants = {
320
+ intent: "current",
321
+ size: "current",
322
+ isBackgroundVisible: false
323
+ };
324
+ var spinnerStyles = (0, import_class_variance_authority2.cva)(
325
+ ["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
326
+ {
327
+ variants: {
328
+ /**
329
+ * 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.
330
+ */
331
+ size: {
332
+ current: ["u-current-font-size"],
333
+ sm: ["w-sz-20", "h-sz-20"],
334
+ md: ["w-sz-28", "h-sz-28"],
335
+ full: ["w-full", "h-full"]
336
+ },
337
+ /**
338
+ * Color scheme of the spinner.
339
+ */
340
+ intent: (0, import_internal_utils.makeVariants)({
341
+ current: ["border-current"],
342
+ main: ["border-main"],
343
+ support: ["border-support"],
344
+ accent: ["border-accent"],
345
+ basic: ["border-basic"],
346
+ success: ["border-success"],
347
+ alert: ["border-alert"],
348
+ error: ["border-error"],
349
+ info: ["border-info"],
350
+ neutral: ["border-neutral"]
351
+ }),
352
+ /**
353
+ * Size of the button.
354
+ */
355
+ isBackgroundVisible: {
356
+ true: ["border-b-neutral-container", "border-l-neutral-container"],
357
+ false: ["border-b-transparent", "border-l-transparent"]
358
+ }
359
+ },
360
+ defaultVariants
361
+ }
362
+ );
363
+
364
+ // src/spinner/Spinner.tsx
365
+ var import_jsx_runtime3 = require("react/jsx-runtime");
366
+ var Spinner = ({
367
+ className,
368
+ size = "current",
369
+ intent = "current",
370
+ label,
371
+ isBackgroundVisible,
372
+ ref,
373
+ ...others
374
+ }) => {
375
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
376
+ "span",
377
+ {
378
+ role: "status",
379
+ "data-spark-component": "spinner",
380
+ ref,
381
+ className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
382
+ ...others,
383
+ children: label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
384
+ }
385
+ );
386
+ };
387
+
388
+ // src/button/Button.styles.tsx
389
+ var import_internal_utils7 = require("@spark-ui/internal-utils");
390
+ var import_class_variance_authority3 = require("class-variance-authority");
391
+
392
+ // src/button/variants/filled.ts
393
+ var import_internal_utils2 = require("@spark-ui/internal-utils");
394
+ var filledVariants2 = [
395
+ // Main
396
+ {
397
+ intent: "main",
398
+ design: "filled",
399
+ class: (0, import_internal_utils2.tw)([
400
+ "bg-main",
401
+ "text-on-main",
402
+ "hover:bg-main-hovered",
403
+ "enabled:active:bg-main-hovered",
404
+ "focus-visible:bg-main-hovered"
405
+ ])
406
+ },
407
+ // Support
408
+ {
409
+ intent: "support",
410
+ design: "filled",
411
+ class: (0, import_internal_utils2.tw)([
412
+ "bg-support",
413
+ "text-on-support",
414
+ "hover:bg-support-hovered",
415
+ "enabled:active:bg-support-hovered",
416
+ "focus-visible:bg-support-hovered"
417
+ ])
418
+ },
419
+ // Accent
420
+ {
421
+ intent: "accent",
422
+ design: "filled",
423
+ class: (0, import_internal_utils2.tw)([
424
+ "bg-accent",
425
+ "text-on-accent",
426
+ "hover:bg-accent-hovered",
427
+ "enabled:active:bg-accent-hovered",
428
+ "focus-visible:bg-accent-hovered"
429
+ ])
430
+ },
431
+ // Basic
432
+ {
433
+ intent: "basic",
434
+ design: "filled",
435
+ class: (0, import_internal_utils2.tw)([
436
+ "bg-basic",
437
+ "text-on-basic",
438
+ "hover:bg-basic-hovered",
439
+ "enabled:active:bg-basic-hovered",
440
+ "focus-visible:bg-basic-hovered"
441
+ ])
442
+ },
443
+ // Success
444
+ {
445
+ intent: "success",
446
+ design: "filled",
447
+ class: (0, import_internal_utils2.tw)([
448
+ "bg-success",
449
+ "text-on-success",
450
+ "hover:bg-success-hovered",
451
+ "enabled:active:bg-success-hovered",
452
+ "focus-visible:bg-success-hovered"
453
+ ])
454
+ },
455
+ // Alert
456
+ {
457
+ intent: "alert",
458
+ design: "filled",
459
+ class: (0, import_internal_utils2.tw)([
460
+ "bg-alert",
461
+ "text-on-alert",
462
+ "hover:bg-alert-hovered",
463
+ "enabled:active:bg-alert-hovered",
464
+ "focus-visible:bg-alert-hovered"
465
+ ])
466
+ },
467
+ // Danger
468
+ {
469
+ intent: "danger",
470
+ design: "filled",
471
+ class: (0, import_internal_utils2.tw)([
472
+ "text-on-error bg-error",
473
+ "hover:bg-error-hovered enabled:active:bg-error-hovered",
474
+ "focus-visible:bg-error-hovered"
475
+ ])
476
+ },
477
+ // Info
478
+ {
479
+ intent: "info",
480
+ design: "filled",
481
+ class: (0, import_internal_utils2.tw)([
482
+ "text-on-error bg-info",
483
+ "hover:bg-info-hovered enabled:active:bg-info-hovered",
484
+ "focus-visible:bg-info-hovered"
485
+ ])
486
+ },
487
+ // Neutral
488
+ {
489
+ intent: "neutral",
490
+ design: "filled",
491
+ class: (0, import_internal_utils2.tw)([
492
+ "bg-neutral",
493
+ "text-on-neutral",
494
+ "hover:bg-neutral-hovered",
495
+ "enabled:active:bg-neutral-hovered",
496
+ "focus-visible:bg-neutral-hovered"
497
+ ])
498
+ },
499
+ // Surface
500
+ {
501
+ intent: "surface",
502
+ design: "filled",
503
+ class: (0, import_internal_utils2.tw)([
504
+ "bg-surface",
505
+ "text-on-surface",
506
+ "hover:bg-surface-hovered",
507
+ "enabled:active:bg-surface-hovered",
508
+ "focus-visible:bg-surface-hovered"
509
+ ])
510
+ },
511
+ {
512
+ intent: "surfaceInverse",
513
+ design: "filled",
514
+ class: (0, import_internal_utils2.tw)([
515
+ "bg-surface-inverse",
516
+ "text-on-surface-inverse",
517
+ "hover:bg-surface-inverse-hovered",
518
+ "enabled:active:bg-surface-inverse-hovered",
519
+ "focus-visible:bg-surface-inverse-hovered"
520
+ ])
521
+ }
522
+ ];
523
+
524
+ // src/button/variants/ghost.ts
525
+ var import_internal_utils3 = require("@spark-ui/internal-utils");
526
+ var ghostVariants = [
527
+ {
528
+ intent: "main",
529
+ design: "ghost",
530
+ class: (0, import_internal_utils3.tw)([
531
+ "text-on-main-container",
532
+ "hover:bg-main/dim-5",
533
+ "enabled:active:bg-main/dim-5",
534
+ "focus-visible:bg-main/dim-5"
535
+ ])
536
+ },
537
+ {
538
+ intent: "support",
539
+ design: "ghost",
540
+ class: (0, import_internal_utils3.tw)([
541
+ "text-on-support-container",
542
+ "hover:bg-support/dim-5",
543
+ "enabled:active:bg-support/dim-5",
544
+ "focus-visible:bg-support/dim-5"
545
+ ])
546
+ },
547
+ {
548
+ intent: "accent",
549
+ design: "ghost",
550
+ class: (0, import_internal_utils3.tw)([
551
+ "text-on-accent-container",
552
+ "hover:bg-accent/dim-5",
553
+ "enabled:active:bg-accent/dim-5",
554
+ "focus-visible:bg-accent/dim-5"
555
+ ])
556
+ },
557
+ {
558
+ intent: "basic",
559
+ design: "ghost",
560
+ class: (0, import_internal_utils3.tw)([
561
+ "text-on-basic-container",
562
+ "hover:bg-basic/dim-5",
563
+ "enabled:active:bg-basic/dim-5",
564
+ "focus-visible:bg-basic/dim-5"
565
+ ])
566
+ },
567
+ {
568
+ intent: "success",
569
+ design: "ghost",
570
+ class: (0, import_internal_utils3.tw)([
571
+ "text-on-success-container",
572
+ "hover:bg-success/dim-5",
573
+ "enabled:active:bg-success/dim-5",
574
+ "focus-visible:bg-success/dim-5"
575
+ ])
576
+ },
577
+ {
578
+ intent: "alert",
579
+ design: "ghost",
580
+ class: (0, import_internal_utils3.tw)([
581
+ "text-on-alert-container",
582
+ "hover:bg-alert/dim-5",
583
+ "enabled:active:bg-alert/dim-5",
584
+ "focus-visible:bg-alert/dim-5"
585
+ ])
586
+ },
587
+ {
588
+ intent: "danger",
589
+ design: "ghost",
590
+ class: (0, import_internal_utils3.tw)([
591
+ "text-on-error-container",
592
+ "hover:bg-error/dim-5",
593
+ "enabled:active:bg-error/dim-5",
594
+ "focus-visible:bg-error/dim-5"
595
+ ])
596
+ },
597
+ {
598
+ intent: "info",
599
+ design: "ghost",
600
+ class: (0, import_internal_utils3.tw)([
601
+ "text-on-info-container",
602
+ "hover:bg-info/dim-5",
603
+ "enabled:active:bg-info/dim-5",
604
+ "focus-visible:bg-info/dim-5"
605
+ ])
606
+ },
607
+ {
608
+ intent: "neutral",
609
+ design: "ghost",
610
+ class: (0, import_internal_utils3.tw)([
611
+ "text-on-neutral-container",
612
+ "hover:bg-neutral/dim-5",
613
+ "enabled:active:bg-neutral/dim-5",
614
+ "focus-visible:bg-neutral/dim-5"
615
+ ])
616
+ },
617
+ {
618
+ intent: "surface",
619
+ design: "ghost",
620
+ class: (0, import_internal_utils3.tw)([
621
+ "text-surface",
622
+ "hover:bg-surface/dim-5",
623
+ "enabled:active:bg-surface/dim-5",
624
+ "focus-visible:bg-surface/dim-5"
625
+ ])
626
+ },
627
+ {
628
+ intent: "surfaceInverse",
629
+ design: "ghost",
630
+ class: (0, import_internal_utils3.tw)([
631
+ "text-surface-inverse",
632
+ "hover:bg-surface-inverse/dim-5",
633
+ "enabled:active:bg-surface-inverse/dim-5",
634
+ "focus-visible:bg-surface-inverse/dim-5"
635
+ ])
636
+ }
637
+ ];
638
+
639
+ // src/button/variants/outlined.ts
640
+ var import_internal_utils4 = require("@spark-ui/internal-utils");
641
+ var outlinedVariants = [
642
+ {
643
+ intent: "main",
644
+ design: "outlined",
645
+ class: (0, import_internal_utils4.tw)([
646
+ "hover:bg-main/dim-5",
647
+ "enabled:active:bg-main/dim-5",
648
+ "focus-visible:bg-main/dim-5",
649
+ "text-main"
650
+ ])
651
+ },
652
+ {
653
+ intent: "support",
654
+ design: "outlined",
655
+ class: (0, import_internal_utils4.tw)([
656
+ "hover:bg-support/dim-5",
657
+ "enabled:active:bg-support/dim-5",
658
+ "focus-visible:bg-support/dim-5",
659
+ "text-support"
660
+ ])
661
+ },
662
+ {
663
+ intent: "accent",
664
+ design: "outlined",
665
+ class: (0, import_internal_utils4.tw)([
666
+ "hover:bg-accent/dim-5",
667
+ "enabled:active:bg-accent/dim-5",
668
+ "focus-visible:bg-accent/dim-5",
669
+ "text-accent"
670
+ ])
671
+ },
672
+ {
673
+ intent: "basic",
674
+ design: "outlined",
675
+ class: (0, import_internal_utils4.tw)([
676
+ "hover:bg-basic/dim-5",
677
+ "enabled:active:bg-basic/dim-5",
678
+ "focus-visible:bg-basic/dim-5",
679
+ "text-basic"
680
+ ])
681
+ },
682
+ {
683
+ intent: "success",
684
+ design: "outlined",
685
+ class: (0, import_internal_utils4.tw)([
686
+ "hover:bg-success/dim-5",
687
+ "enabled:active:bg-success/dim-5",
688
+ "focus-visible:bg-success/dim-5",
689
+ "text-success"
690
+ ])
691
+ },
692
+ {
693
+ intent: "alert",
694
+ design: "outlined",
695
+ class: (0, import_internal_utils4.tw)([
696
+ "hover:bg-alert/dim-5",
697
+ "enabled:active:bg-alert/dim-5",
698
+ "focus-visible:bg-alert/dim-5",
699
+ "text-alert"
700
+ ])
701
+ },
702
+ {
703
+ intent: "danger",
704
+ design: "outlined",
705
+ class: (0, import_internal_utils4.tw)([
706
+ "hover:bg-error/dim-5",
707
+ "enabled:active:bg-error/dim-5",
708
+ "focus-visible:bg-error/dim-5",
709
+ "text-error"
710
+ ])
711
+ },
712
+ {
713
+ intent: "info",
714
+ design: "outlined",
715
+ class: (0, import_internal_utils4.tw)([
716
+ "hover:bg-info/dim-5",
717
+ "enabled:active:bg-info/dim-5",
718
+ "focus-visible:bg-info/dim-5",
719
+ "text-info"
720
+ ])
721
+ },
722
+ {
723
+ intent: "neutral",
724
+ design: "outlined",
725
+ class: (0, import_internal_utils4.tw)([
726
+ "hover:bg-neutral/dim-5",
727
+ "enabled:active:bg-neutral/dim-5",
728
+ "focus-visible:bg-neutral/dim-5",
729
+ "text-neutral"
730
+ ])
731
+ },
732
+ {
733
+ intent: "surface",
734
+ design: "outlined",
735
+ class: (0, import_internal_utils4.tw)([
736
+ "hover:bg-surface/dim-5",
737
+ "enabled:active:bg-surface/dim-5",
738
+ "focus-visible:bg-surface/dim-5",
739
+ "text-surface"
740
+ ])
741
+ },
742
+ {
743
+ intent: "surfaceInverse",
744
+ design: "outlined",
745
+ class: (0, import_internal_utils4.tw)([
746
+ "hover:bg-surface-inverse/dim-5",
747
+ "enabled:active:bg-surface-inverse/dim-5",
748
+ "focus-visible:bg-surface-inverse/dim-5",
749
+ "text-surface-inverse"
750
+ ])
751
+ }
752
+ ];
753
+
754
+ // src/button/variants/tinted.ts
755
+ var import_internal_utils5 = require("@spark-ui/internal-utils");
756
+ var tintedVariants2 = [
757
+ {
758
+ intent: "main",
759
+ design: "tinted",
760
+ class: (0, import_internal_utils5.tw)([
761
+ "bg-main-container",
762
+ "text-on-main-container",
763
+ "hover:bg-main-container-hovered",
764
+ "enabled:active:bg-main-container-hovered",
765
+ "focus-visible:bg-main-container-hovered"
766
+ ])
767
+ },
768
+ {
769
+ intent: "support",
770
+ design: "tinted",
771
+ class: (0, import_internal_utils5.tw)([
772
+ "bg-support-container",
773
+ "text-on-support-container",
774
+ "hover:bg-support-container-hovered",
775
+ "enabled:active:bg-support-container-hovered",
776
+ "focus-visible:bg-support-container-hovered"
777
+ ])
778
+ },
779
+ {
780
+ intent: "accent",
781
+ design: "tinted",
782
+ class: (0, import_internal_utils5.tw)([
783
+ "bg-accent-container",
784
+ "text-on-accent-container",
785
+ "hover:bg-accent-container-hovered",
786
+ "enabled:active:bg-accent-container-hovered",
787
+ "focus-visible:bg-accent-container-hovered"
788
+ ])
789
+ },
790
+ {
791
+ intent: "basic",
792
+ design: "tinted",
793
+ class: (0, import_internal_utils5.tw)([
794
+ "bg-basic-container",
795
+ "text-on-basic-container",
796
+ "hover:bg-basic-container-hovered",
797
+ "enabled:active:bg-basic-container-hovered",
798
+ "focus-visible:bg-basic-container-hovered"
799
+ ])
800
+ },
801
+ {
802
+ intent: "success",
803
+ design: "tinted",
804
+ class: (0, import_internal_utils5.tw)([
805
+ "bg-success-container",
806
+ "text-on-success-container",
807
+ "hover:bg-success-container-hovered",
808
+ "enabled:active:bg-success-container-hovered",
809
+ "focus-visible:bg-success-container-hovered"
810
+ ])
811
+ },
812
+ {
813
+ intent: "alert",
814
+ design: "tinted",
815
+ class: (0, import_internal_utils5.tw)([
816
+ "bg-alert-container",
817
+ "text-on-alert-container",
818
+ "hover:bg-alert-container-hovered",
819
+ "enabled:active:bg-alert-container-hovered",
820
+ "focus-visible:bg-alert-container-hovered"
821
+ ])
822
+ },
823
+ {
824
+ intent: "danger",
825
+ design: "tinted",
826
+ class: (0, import_internal_utils5.tw)([
827
+ "bg-error-container",
828
+ "text-on-error-container",
829
+ "hover:bg-error-container-hovered",
830
+ "enabled:active:bg-error-container-hovered",
831
+ "focus-visible:bg-error-container-hovered"
832
+ ])
833
+ },
834
+ {
835
+ intent: "info",
836
+ design: "tinted",
837
+ class: (0, import_internal_utils5.tw)([
838
+ "bg-info-container",
839
+ "text-on-info-container",
840
+ "hover:bg-info-container-hovered",
841
+ "enabled:active:bg-info-container-hovered",
842
+ "focus-visible:bg-info-container-hovered"
843
+ ])
844
+ },
845
+ {
846
+ intent: "neutral",
847
+ design: "tinted",
848
+ class: (0, import_internal_utils5.tw)([
849
+ "bg-neutral-container",
850
+ "text-on-neutral-container",
851
+ "hover:bg-neutral-container-hovered",
852
+ "enabled:active:bg-neutral-container-hovered",
853
+ "focus-visible:bg-neutral-container-hovered"
854
+ ])
855
+ },
856
+ {
857
+ intent: "surface",
858
+ design: "tinted",
859
+ class: (0, import_internal_utils5.tw)([
860
+ "bg-surface",
861
+ "text-on-surface",
862
+ "hover:bg-surface-hovered",
863
+ "enabled:active:bg-surface-hovered",
864
+ "focus-visible:bg-surface-hovered"
865
+ ])
866
+ },
867
+ {
868
+ intent: "surfaceInverse",
869
+ design: "tinted",
870
+ class: (0, import_internal_utils5.tw)([
871
+ "bg-surface-inverse",
872
+ "text-on-surface-inverse",
873
+ "hover:bg-surface-inverse-hovered",
874
+ "enabled:active:bg-surface-inverse-hovered",
875
+ "focus-visible:bg-surface-inverse-hovered"
876
+ ])
877
+ }
878
+ ];
879
+
880
+ // src/button/variants/contrast.ts
881
+ var import_internal_utils6 = require("@spark-ui/internal-utils");
882
+ var contrastVariants = [
883
+ {
884
+ intent: "main",
885
+ design: "contrast",
886
+ class: (0, import_internal_utils6.tw)([
887
+ "text-on-main-contaier bg-surface",
888
+ "hover:bg-main-container-hovered",
889
+ "enabled:active:bg-main-container-hovered",
890
+ "focus-visible:bg-main-container-hovered"
891
+ ])
892
+ },
893
+ {
894
+ intent: "support",
895
+ design: "contrast",
896
+ class: (0, import_internal_utils6.tw)([
897
+ "text-on-support-container bg-surface",
898
+ "hover:bg-support-container-hovered",
899
+ "enabled:active:bg-support-container-hovered",
900
+ "focus-visible:bg-support-container-hovered"
901
+ ])
902
+ },
903
+ {
904
+ intent: "accent",
905
+ design: "contrast",
906
+ class: (0, import_internal_utils6.tw)([
907
+ "text-on-accent-container bg-surface",
908
+ "hover:bg-accent-container-hovered",
909
+ "enabled:active:bg-accent-container-hovered",
910
+ "focus-visible:bg-accent-container-hovered"
911
+ ])
912
+ },
913
+ {
914
+ intent: "basic",
915
+ design: "contrast",
916
+ class: (0, import_internal_utils6.tw)([
917
+ "text-on-basic-container bg-surface",
918
+ "hover:bg-basic-container-hovered",
919
+ "enabled:active:bg-basic-container-hovered",
920
+ "focus-visible:bg-basic-container-hovered"
921
+ ])
922
+ },
923
+ {
924
+ intent: "success",
925
+ design: "contrast",
926
+ class: (0, import_internal_utils6.tw)([
927
+ "text-on-success-container bg-surface",
928
+ "hover:bg-success-container-hovered",
929
+ "enabled:active:bg-success-container-hovered",
930
+ "focus-visible:bg-success-container-hovered"
931
+ ])
932
+ },
933
+ {
934
+ intent: "alert",
935
+ design: "contrast",
936
+ class: (0, import_internal_utils6.tw)([
937
+ "text-on-alert-container bg-surface",
938
+ "hover:bg-alert-container-hovered",
939
+ "enabled:active:bg-alert-container-hovered",
940
+ "focus-visible:bg-alert-container-hovered"
941
+ ])
942
+ },
943
+ {
944
+ intent: "danger",
945
+ design: "contrast",
946
+ class: (0, import_internal_utils6.tw)([
947
+ "text-on-error-container bg-surface",
948
+ "hover:bg-error-container-hovered",
949
+ "enabled:active:bg-error-container-hovered",
950
+ "focus-visible:bg-error-container-hovered"
951
+ ])
952
+ },
953
+ {
954
+ intent: "info",
955
+ design: "contrast",
956
+ class: (0, import_internal_utils6.tw)([
957
+ "text-on-info-container bg-surface",
958
+ "hover:bg-info-container-hovered",
959
+ "enabled:active:bg-info-container-hovered",
960
+ "focus-visible:bg-info-container-hovered"
961
+ ])
962
+ },
963
+ {
964
+ intent: "neutral",
965
+ design: "contrast",
966
+ class: (0, import_internal_utils6.tw)([
967
+ "text-on-neutral-container bg-surface",
968
+ "hover:bg-neutral-container-hovered",
969
+ "enabled:active:bg-neutral-container-hovered",
970
+ "focus-visible:bg-neutral-container-hovered"
971
+ ])
972
+ },
973
+ {
974
+ intent: "surface",
975
+ design: "contrast",
976
+ class: (0, import_internal_utils6.tw)([
977
+ "text-on-surface bg-surface",
978
+ "hover:bg-surface-hovered",
979
+ "enabled:active:bg-surface-hovered",
980
+ "focus-visible:bg-surface-hovered"
981
+ ])
982
+ },
983
+ {
984
+ intent: "surfaceInverse",
985
+ design: "contrast",
986
+ class: (0, import_internal_utils6.tw)([
987
+ "text-on-surface-inverse bg-surface-inverse",
988
+ "hover:bg-surface-inverse-hovered",
989
+ "enabled:active:bg-surface-inverse-hovered",
990
+ "focus-visible:bg-surface-inverse-hovered"
991
+ ])
992
+ }
993
+ ];
994
+
995
+ // src/button/Button.styles.tsx
996
+ var buttonStyles = (0, import_class_variance_authority3.cva)(
997
+ [
998
+ "u-shadow-border-transition",
999
+ "box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
1000
+ "default:px-lg",
1001
+ "text-body-1 font-bold",
1002
+ "focus-visible:u-outline"
1003
+ ],
1004
+ {
1005
+ variants: {
1006
+ /**
1007
+ * Main style of the button.
1008
+ *
1009
+ * - `filled`: Button will be plain.
1010
+ *
1011
+ * - `outlined`: Button will be transparent with an outline.
1012
+ *
1013
+ * - `tinted`: Button will be filled but using a lighter color scheme.
1014
+ *
1015
+ * - `ghost`: Button will look like a link. No borders, plain text.
1016
+ *
1017
+ * - `contrast`: Button will be surface filled. No borders, plain text.
1018
+ *
1019
+ */
1020
+ design: (0, import_internal_utils7.makeVariants)({
1021
+ filled: [],
1022
+ outlined: ["bg-transparent", "border-sm", "border-current"],
1023
+ tinted: [],
1024
+ ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
1025
+ contrast: []
1026
+ }),
1027
+ underline: {
1028
+ true: ["underline"]
1029
+ },
1030
+ /**
1031
+ * Color scheme of the button.
1032
+ */
1033
+ intent: (0, import_internal_utils7.makeVariants)({
1034
+ main: [],
1035
+ support: [],
1036
+ accent: [],
1037
+ basic: [],
1038
+ success: [],
1039
+ alert: [],
1040
+ danger: [],
1041
+ info: [],
1042
+ neutral: [],
1043
+ surface: [],
1044
+ surfaceInverse: []
1045
+ }),
1046
+ /**
1047
+ * Size of the button.
1048
+ */
1049
+ size: (0, import_internal_utils7.makeVariants)({
1050
+ sm: ["min-w-sz-32", "h-sz-32"],
1051
+ md: ["min-w-sz-44", "h-sz-44"],
1052
+ lg: ["min-w-sz-56", "h-sz-56"]
1053
+ }),
1054
+ /**
1055
+ * Shape of the button.
1056
+ */
1057
+ shape: (0, import_internal_utils7.makeVariants)({
1058
+ rounded: ["rounded-lg"],
1059
+ square: ["rounded-0"],
1060
+ pill: ["rounded-full"]
1061
+ }),
1062
+ /**
1063
+ * Disable the button, preventing user interaction and adding opacity.
1064
+ */
1065
+ disabled: {
1066
+ true: ["cursor-not-allowed", "opacity-dim-3"],
1067
+ false: ["cursor-pointer"]
1068
+ }
1069
+ },
1070
+ compoundVariants: [
1071
+ ...filledVariants2,
1072
+ ...outlinedVariants,
1073
+ ...tintedVariants2,
1074
+ ...ghostVariants,
1075
+ ...contrastVariants
1076
+ ],
1077
+ defaultVariants: {
1078
+ design: "filled",
1079
+ intent: "main",
1080
+ size: "md",
1081
+ shape: "rounded"
1082
+ }
1083
+ }
1084
+ );
1085
+
1086
+ // src/button/Button.tsx
1087
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1088
+ var blockedEventHandlers = [
1089
+ "onClick",
1090
+ "onMouseDown",
1091
+ "onMouseUp",
1092
+ "onMouseEnter",
1093
+ "onMouseLeave",
1094
+ "onMouseOver",
1095
+ "onMouseOut",
1096
+ "onKeyDown",
1097
+ "onKeyPress",
1098
+ "onKeyUp",
1099
+ "onSubmit"
1100
+ ];
1101
+ var Button = ({
1102
+ children,
1103
+ design = "filled",
1104
+ disabled = false,
1105
+ intent = "main",
1106
+ isLoading = false,
1107
+ loadingLabel,
1108
+ loadingText,
1109
+ shape = "rounded",
1110
+ size = "md",
1111
+ asChild,
1112
+ className,
1113
+ underline = false,
1114
+ ref,
1115
+ ...others
1116
+ }) => {
1117
+ const Component = asChild ? Slot : "button";
1118
+ const shouldNotInteract = !!disabled || isLoading;
1119
+ const disabledEventHandlers = (0, import_react2.useMemo)(() => {
1120
+ const result = {};
1121
+ if (shouldNotInteract) {
1122
+ blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
1123
+ }
1124
+ return result;
1125
+ }, [shouldNotInteract]);
1126
+ const spinnerProps = {
1127
+ size: "current",
1128
+ className: loadingText ? "inline-block" : "absolute",
1129
+ ...loadingLabel && { "aria-label": loadingLabel }
1130
+ };
1131
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1132
+ Component,
1133
+ {
1134
+ "data-spark-component": "button",
1135
+ ...Component === "button" && { type: "button" },
1136
+ ref,
1137
+ className: buttonStyles({
1138
+ className,
1139
+ design,
1140
+ disabled: shouldNotInteract,
1141
+ intent,
1142
+ shape,
1143
+ size,
1144
+ underline
1145
+ }),
1146
+ disabled: !!disabled,
1147
+ "aria-busy": isLoading,
1148
+ "aria-live": isLoading ? "assertive" : "off",
1149
+ ...others,
1150
+ ...disabledEventHandlers,
1151
+ children: wrapPolymorphicSlot(
1152
+ asChild,
1153
+ children,
1154
+ (slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1155
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { ...spinnerProps }),
1156
+ loadingText && loadingText,
1157
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1158
+ "div",
1159
+ {
1160
+ "aria-hidden": true,
1161
+ className: (0, import_class_variance_authority4.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
1162
+ children: slotted
1163
+ }
1164
+ )
1165
+ ] }) : slotted
1166
+ )
1167
+ }
1168
+ );
1169
+ };
1170
+ Button.displayName = "Button";
1171
+
1172
+ // src/snackbar/SnackbarItemContext.tsx
1173
+ var import_react3 = require("react");
1174
+ var SnackbarItemContext = (0, import_react3.createContext)({});
1175
+ var useSnackbarItemContext = () => (0, import_react3.useContext)(SnackbarItemContext);
1176
+
1177
+ // src/snackbar/SnackbarItemAction.tsx
1178
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1179
+ var SnackbarItemAction = ({
1180
+ design: designProp = "filled",
1181
+ intent: intentProp = "neutral",
1182
+ onClick,
1183
+ children,
1184
+ className,
1185
+ ref,
1186
+ ...rest
1187
+ }) => {
1188
+ const { toast, state } = useSnackbarItemContext();
1189
+ const intent = intentProp ?? toast.content.intent;
1190
+ const design = designProp ?? toast.content.design;
1191
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1192
+ Button,
1193
+ {
1194
+ "data-spark-component": "snackbar-item-action",
1195
+ ref,
1196
+ size: "md",
1197
+ shape: "rounded",
1198
+ ...intent === "inverse" ? {
1199
+ design: "ghost",
1200
+ intent: "surface"
1201
+ } : {
1202
+ design,
1203
+ intent: intent === "error" ? "danger" : intent
1204
+ },
1205
+ onClick: (e) => {
1206
+ onClick?.(e);
1207
+ state.close(toast.key);
1208
+ },
1209
+ style: { gridArea: "action", ...rest.style },
1210
+ className: (0, import_class_variance_authority5.cx)("ml-md justify-self-end", className),
1211
+ ...rest,
1212
+ children
1213
+ }
1214
+ );
1215
+ };
1216
+ SnackbarItemAction.displayName = "Snackbar.ItemAction";
1217
+
1218
+ // src/snackbar/SnackbarItemClose.tsx
1219
+ var import_Close = require("@spark-ui/icons/Close");
1220
+ var import_class_variance_authority8 = require("class-variance-authority");
1221
+
1222
+ // src/icon/Icon.tsx
1223
+ var import_react4 = require("react");
1224
+
1225
+ // src/icon/Icon.styles.tsx
1226
+ var import_internal_utils8 = require("@spark-ui/internal-utils");
1227
+ var import_class_variance_authority6 = require("class-variance-authority");
1228
+ var iconStyles = (0, import_class_variance_authority6.cva)(["fill-current shrink-0"], {
1229
+ variants: {
1230
+ /**
1231
+ * Color scheme of the icon.
1232
+ */
1233
+ intent: (0, import_internal_utils8.makeVariants)({
1234
+ current: ["text-current"],
1235
+ main: ["text-main"],
1236
+ support: ["text-support"],
1237
+ accent: ["text-accent"],
1238
+ basic: ["text-basic"],
1239
+ success: ["text-success"],
1240
+ alert: ["text-alert"],
1241
+ error: ["text-error"],
1242
+ info: ["text-info"],
1243
+ neutral: ["text-neutral"]
1244
+ }),
1245
+ /**
1246
+ * Sets the size of the icon.
1247
+ */
1248
+ size: (0, import_internal_utils8.makeVariants)({
1249
+ current: ["u-current-font-size"],
1250
+ sm: ["w-sz-16", "h-sz-16"],
1251
+ md: ["w-sz-24", "h-sz-24"],
1252
+ lg: ["w-sz-32", "h-sz-32"],
1253
+ xl: ["w-sz-40", "h-sz-40"]
1254
+ })
1255
+ }
1256
+ });
1257
+
1258
+ // src/icon/Icon.tsx
1259
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1260
+ var Icon = ({
1261
+ label,
1262
+ className,
1263
+ size = "current",
1264
+ intent = "current",
1265
+ children,
1266
+ ...others
1267
+ }) => {
1268
+ const child = import_react4.Children.only(children);
1269
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1270
+ (0, import_react4.cloneElement)(child, {
1271
+ className: iconStyles({ className, size, intent }),
1272
+ "data-spark-component": "icon",
1273
+ "aria-hidden": "true",
1274
+ focusable: "false",
1275
+ ...others
1276
+ }),
1277
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(VisuallyHidden, { children: label })
1278
+ ] });
1279
+ };
1280
+ Icon.displayName = "Icon";
1281
+
1282
+ // src/icon-button/IconButton.styles.tsx
1283
+ var import_internal_utils9 = require("@spark-ui/internal-utils");
1284
+ var import_class_variance_authority7 = require("class-variance-authority");
1285
+ var iconButtonStyles = (0, import_class_variance_authority7.cva)(["pl-0 pr-0"], {
1286
+ variants: {
1287
+ /**
1288
+ * Sets the size of the icon.
1289
+ */
1290
+ size: (0, import_internal_utils9.makeVariants)({
1291
+ sm: ["text-body-1"],
1292
+ md: ["text-body-1"],
1293
+ lg: ["text-display-3"]
1294
+ })
1295
+ }
1296
+ });
1297
+
1298
+ // src/icon-button/IconButton.tsx
1299
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1300
+ var IconButton = ({
1301
+ design = "filled",
1302
+ disabled = false,
1303
+ intent = "main",
1304
+ shape = "rounded",
1305
+ size = "md",
1306
+ className,
1307
+ ref,
1308
+ ...others
1309
+ }) => {
1310
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1311
+ Button,
1312
+ {
1313
+ "data-spark-component": "icon-button",
1314
+ ref,
1315
+ className: iconButtonStyles({ size, className }),
1316
+ design,
1317
+ disabled,
1318
+ intent,
1319
+ shape,
1320
+ size,
1321
+ ...others
1322
+ }
1323
+ );
1324
+ };
1325
+ IconButton.displayName = "IconButton";
1326
+
1327
+ // src/snackbar/SnackbarItemClose.tsx
1328
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1329
+ var SnackbarItemClose = ({
1330
+ design: designProp = "filled",
1331
+ intent: intentProp = "neutral",
1332
+ "aria-label": ariaLabel,
1333
+ onClick,
1334
+ className,
1335
+ ref,
1336
+ ...rest
1337
+ }) => {
1338
+ const { toast, state } = useSnackbarItemContext();
1339
+ const intent = intentProp ?? toast.content.intent;
1340
+ const design = designProp ?? toast.content.design;
1341
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1342
+ IconButton,
1343
+ {
1344
+ "data-spark-component": "snackbar-item-close",
1345
+ ref,
1346
+ size: "md",
1347
+ shape: "rounded",
1348
+ ...intent === "inverse" ? {
1349
+ design: "ghost",
1350
+ intent: "surface"
1351
+ } : {
1352
+ design,
1353
+ intent: intent === "error" ? "danger" : intent
1354
+ },
1355
+ "aria-label": ariaLabel,
1356
+ onClick: (e) => {
1357
+ onClick?.(e);
1358
+ state.close(toast.key);
1359
+ },
1360
+ style: { gridArea: "close", ...rest.style },
1361
+ className: (0, import_class_variance_authority8.cx)("ml-md justify-self-end", className),
1362
+ ...rest,
1363
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Close.Close, {}) })
1364
+ }
1365
+ );
1366
+ };
1367
+ SnackbarItemClose.displayName = "Snackbar.ItemClose";
1368
+
1369
+ // src/snackbar/SnackbarItemIcon.tsx
1370
+ var import_class_variance_authority9 = require("class-variance-authority");
1371
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1372
+ var SnackbarItemIcon = ({
1373
+ children,
1374
+ className,
1375
+ ...rest
1376
+ }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1377
+ Icon,
1378
+ {
1379
+ size: "md",
1380
+ className: (0, import_class_variance_authority9.cx)("mx-md", className),
1381
+ style: { gridArea: "icon", ...rest.style },
1382
+ ...rest,
1383
+ children
1384
+ }
1385
+ );
1386
+ SnackbarItemIcon.displayName = "Snackbar.ItemIcon";
1387
+
1388
+ // src/snackbar/useSwipe.ts
1389
+ var import_react5 = require("react");
1390
+ var SWIPE_THRESHOLD = 75;
1391
+ var useSwipe = ({
1392
+ swipeRef,
1393
+ onSwipeStart,
1394
+ onSwipeMove,
1395
+ onSwipeCancel,
1396
+ onSwipeEnd,
1397
+ threshold = 10
1398
+ }) => {
1399
+ const [state, setState] = (0, import_react5.useState)();
1400
+ const direction = (0, import_react5.useRef)(null);
1401
+ const origin = (0, import_react5.useRef)(null);
1402
+ const delta = (0, import_react5.useRef)(null);
1403
+ const handleSwipeStart = (evt) => {
1404
+ origin.current = { x: evt.clientX, y: evt.clientY };
1405
+ document.addEventListener("selectstart", (e) => e.preventDefault());
1406
+ };
1407
+ const handleSwipeMove = (evt) => {
1408
+ if (!origin.current) return;
1409
+ const deltaX = Math.abs(evt.clientX - origin.current.x);
1410
+ const deltaY = Math.abs(evt.clientY - origin.current.y);
1411
+ let moveState;
1412
+ if (deltaX > deltaY && deltaX > threshold) {
1413
+ direction.current = evt.clientX > origin.current.x ? "right" : "left";
1414
+ } else if (deltaY > threshold) {
1415
+ direction.current = evt.clientY > origin.current.y ? "down" : "up";
1416
+ }
1417
+ if (!direction.current) return;
1418
+ if (!delta.current) {
1419
+ moveState = "start";
1420
+ delta.current = { x: deltaX, y: deltaY };
1421
+ onSwipeStart?.({ state: moveState, direction: direction.current });
1422
+ } else {
1423
+ moveState = "move";
1424
+ delta.current = { x: deltaX, y: deltaY };
1425
+ swipeRef.current.style.setProperty(
1426
+ "--swipe-position-x",
1427
+ `${deltaX > deltaY ? evt.clientX - origin.current.x : 0}px`
1428
+ );
1429
+ swipeRef.current.style.setProperty(
1430
+ "--swipe-position-y",
1431
+ `${!(deltaX > deltaY) ? evt.clientY - origin.current.y : 0}px`
1432
+ );
1433
+ onSwipeMove?.({ state: moveState, direction: direction.current });
1434
+ }
1435
+ setState(moveState);
1436
+ };
1437
+ const handleSwipeEnd = () => {
1438
+ const proxyDelta = delta.current;
1439
+ origin.current = null;
1440
+ delta.current = null;
1441
+ if (proxyDelta) {
1442
+ const { x: deltaX, y: deltaY } = proxyDelta;
1443
+ let endState;
1444
+ if (deltaX > deltaY) {
1445
+ if (deltaX > SWIPE_THRESHOLD) {
1446
+ endState = "end";
1447
+ onSwipeEnd?.({ state: endState, direction: direction.current });
1448
+ } else {
1449
+ endState = "cancel";
1450
+ onSwipeCancel?.({ state: endState, direction: direction.current });
1451
+ }
1452
+ } else {
1453
+ if (deltaY > SWIPE_THRESHOLD) {
1454
+ endState = "end";
1455
+ onSwipeEnd?.({ state: endState, direction: direction.current });
1456
+ } else {
1457
+ endState = "cancel";
1458
+ onSwipeCancel?.({ state: endState, direction: direction.current });
1459
+ }
1460
+ }
1461
+ setState(endState);
1462
+ document.removeEventListener("selectstart", (e) => e.preventDefault());
1463
+ }
1464
+ };
1465
+ (0, import_react5.useEffect)(() => {
1466
+ if (!swipeRef.current) return;
1467
+ const swipeElement = swipeRef.current;
1468
+ swipeElement.addEventListener("pointerdown", handleSwipeStart);
1469
+ document.addEventListener("pointermove", handleSwipeMove);
1470
+ document.addEventListener("pointerup", handleSwipeEnd);
1471
+ return () => {
1472
+ swipeElement.removeEventListener("pointerdown", handleSwipeStart);
1473
+ document.removeEventListener("pointermove", handleSwipeMove);
1474
+ document.removeEventListener("pointerup", handleSwipeEnd);
1475
+ };
1476
+ }, []);
1477
+ return {
1478
+ state,
1479
+ direction: direction.current
1480
+ };
1481
+ };
1482
+
1483
+ // src/snackbar/SnackbarItem.tsx
1484
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1485
+ var SnackbarItem = ({
1486
+ "aria-label": ariaLabel,
1487
+ "aria-labelledby": ariaLabelledby,
1488
+ "aria-describedby": ariaDescribedby,
1489
+ "aria-details": ariaDetails,
1490
+ design: designProp,
1491
+ intent: intentProp,
1492
+ actionOnNewline: actionOnNewlineProp,
1493
+ className,
1494
+ children,
1495
+ ref: forwardedRef,
1496
+ ...rest
1497
+ }) => {
1498
+ const innerRef = (0, import_react6.useRef)(null);
1499
+ const ref = typeof forwardedRef !== "function" ? forwardedRef || innerRef : innerRef;
1500
+ const { toast, state } = useSnackbarItemContext();
1501
+ const { state: swipeState, direction: swipeDirection } = useSwipe({
1502
+ swipeRef: ref,
1503
+ onSwipeStart: state.pauseAll,
1504
+ onSwipeCancel: state.resumeAll,
1505
+ onSwipeEnd: ({ direction }) => {
1506
+ ;
1507
+ ["left", "right"].includes(`${direction}`) && state.close(toast.key);
1508
+ }
1509
+ });
1510
+ const { message, icon, isClosable, onAction, actionLabel } = toast.content;
1511
+ const intent = intentProp ?? toast.content.intent;
1512
+ const design = designProp ?? toast.content.design;
1513
+ const actionOnNewline = actionOnNewlineProp ?? toast.content.actionOnNewline;
1514
+ const ariaProps = {
1515
+ ariaLabel,
1516
+ ariaLabelledby,
1517
+ ariaDescribedby,
1518
+ ariaDetails
1519
+ };
1520
+ const { toastProps, titleProps, closeButtonProps, contentProps } = (0, import_toast.useToast)(
1521
+ { toast, ...ariaProps },
1522
+ state,
1523
+ ref
1524
+ );
1525
+ const findElement = (0, import_react6.useCallback)(
1526
+ (elementDisplayName) => {
1527
+ const childrenArray = import_react6.Children.toArray(children);
1528
+ const match = childrenArray.filter(import_react6.isValidElement).find(
1529
+ (child) => !!child.type.displayName?.includes(
1530
+ elementDisplayName
1531
+ )
1532
+ );
1533
+ return match;
1534
+ },
1535
+ [children]
1536
+ );
1537
+ const iconFromChildren = findElement("Snackbar.ItemIcon");
1538
+ const actionBtnFromChildren = findElement("Snackbar.ItemAction");
1539
+ const closeBtnFromChildren = findElement("Snackbar.ItemClose");
1540
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1541
+ "div",
1542
+ {
1543
+ "data-spark-component": "snackbar-item",
1544
+ className: snackbarItemVariant({ design, intent, className }),
1545
+ "data-animation": toast.animation,
1546
+ ...!(swipeState === "cancel" && toast.animation === "exiting") && {
1547
+ "data-swipe": swipeState,
1548
+ "data-swipe-direction": swipeDirection
1549
+ },
1550
+ ...toast.animation === "exiting" && {
1551
+ // Remove snackbar when the exiting animation completes
1552
+ onAnimationEnd: () => state.remove(toast.key)
1553
+ },
1554
+ ref,
1555
+ ...toastProps,
1556
+ ...rest,
1557
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: snackbarItemVariantContent({ actionOnNewline }), ...contentProps, children: [
1558
+ renderSubComponent(iconFromChildren, icon ? SnackbarItemIcon : null, {
1559
+ children: icon
1560
+ }),
1561
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1562
+ "p",
1563
+ {
1564
+ className: "px-md py-lg text-body-2 row-span-3",
1565
+ style: { gridArea: "message" },
1566
+ ...titleProps,
1567
+ children: message
1568
+ }
1569
+ ),
1570
+ renderSubComponent(
1571
+ actionBtnFromChildren,
1572
+ actionLabel && onAction ? SnackbarItemAction : null,
1573
+ { intent, design, onClick: onAction, children: actionLabel }
1574
+ ),
1575
+ renderSubComponent(closeBtnFromChildren, isClosable ? SnackbarItemClose : null, {
1576
+ intent,
1577
+ design,
1578
+ /**
1579
+ * React Spectrum typing of aria-label is inaccurate, and aria-label value should never be undefined.
1580
+ * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L40
1581
+ */
1582
+ "aria-label": closeButtonProps["aria-label"]
1583
+ })
1584
+ ] })
1585
+ }
1586
+ );
1587
+ };
1588
+ SnackbarItem.displayName = "Snackbar.Item";
1589
+ var renderSubComponent = (childItem, defaultItem, props) => {
1590
+ if (childItem) {
1591
+ return (0, import_react6.cloneElement)(childItem, { ...props, ...childItem.props });
1592
+ } else if (defaultItem) {
1593
+ const Item = defaultItem;
1594
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Item, { ...props });
1595
+ } else {
1596
+ return null;
1597
+ }
1598
+ };
1599
+
1600
+ // src/snackbar/SnackbarRegion.styles.ts
1601
+ var import_class_variance_authority10 = require("class-variance-authority");
1602
+ var snackbarRegionVariant = (0, import_class_variance_authority10.cva)(
1603
+ [
1604
+ "fixed inset-x-lg z-toast group",
1605
+ "outline-hidden pointer-events-none",
1606
+ "grid grid-rows-1 grid-cols-1 gap-lg"
1607
+ ],
1608
+ {
1609
+ variants: {
1610
+ /**
1611
+ * Set snackbar item position
1612
+ * @default 'bottom'
1613
+ */
1614
+ position: {
1615
+ top: "top-lg justify-items-center",
1616
+ "top-right": "top-lg justify-items-end",
1617
+ "top-left": "top-lg justify-items-start",
1618
+ bottom: "bottom-lg justify-items-center",
1619
+ "bottom-right": "bottom-lg justify-items-end",
1620
+ "bottom-left": "bottom-lg justify-items-start"
1621
+ }
1622
+ },
1623
+ defaultVariants: {
1624
+ position: "bottom"
1625
+ }
1626
+ }
1627
+ );
1628
+
1629
+ // src/snackbar/SnackbarRegion.tsx
1630
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1631
+ var SnackbarRegion = ({
1632
+ children = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SnackbarItem, {}),
1633
+ state,
1634
+ position = "bottom",
1635
+ className,
1636
+ ref: forwardedRef,
1637
+ ...rest
1638
+ }) => {
1639
+ const innerRef = (0, import_react7.useRef)(null);
1640
+ const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
1641
+ const { regionProps } = (0, import_toast2.useToastRegion)(rest, state, ref);
1642
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1643
+ "div",
1644
+ {
1645
+ ...regionProps,
1646
+ ref,
1647
+ "data-position": position,
1648
+ className: snackbarRegionVariant({ position, className }),
1649
+ children: state.visibleToasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SnackbarItemContext.Provider, { value: { toast, state }, children: (0, import_react7.cloneElement)(children, { key: toast.key }) }, toast.key))
1650
+ }
1651
+ );
1652
+ };
1653
+
1654
+ // src/snackbar/useSnackbarGlobalStore.ts
1655
+ var import_react8 = require("react");
1656
+ var useSnackbarGlobalStore = ({
1657
+ providers,
1658
+ subscriptions
1659
+ }) => {
1660
+ const subscribe = (0, import_react8.useCallback)(
1661
+ (listener) => {
1662
+ subscriptions.add(listener);
1663
+ return () => subscriptions.delete(listener);
1664
+ },
1665
+ [subscriptions]
1666
+ );
1667
+ const getLastSnackbarProvider = (0, import_react8.useCallback)(() => [...providers].reverse()[0], [providers]);
1668
+ const addProvider = (0, import_react8.useCallback)(
1669
+ (provider2) => {
1670
+ providers.add(provider2);
1671
+ for (const subscribeFn of subscriptions) {
1672
+ subscribeFn();
1673
+ }
1674
+ },
1675
+ [providers, subscriptions]
1676
+ );
1677
+ const deleteProvider = (0, import_react8.useCallback)(
1678
+ (provider2) => {
1679
+ providers.delete(provider2);
1680
+ for (const subscribeFn of subscriptions) {
1681
+ subscribeFn();
1682
+ }
1683
+ },
1684
+ [providers, subscriptions]
1685
+ );
1686
+ const provider = (0, import_react8.useSyncExternalStore)(subscribe, getLastSnackbarProvider, getLastSnackbarProvider);
1687
+ return {
1688
+ provider,
1689
+ addProvider,
1690
+ deleteProvider
1691
+ };
1692
+ };
1693
+
1694
+ // src/snackbar/Snackbar.tsx
1695
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1696
+ var GLOBAL_SNACKBAR_QUEUE = null;
1697
+ var getGlobalSnackBarQueue = () => {
1698
+ if (!GLOBAL_SNACKBAR_QUEUE) {
1699
+ GLOBAL_SNACKBAR_QUEUE = new import_toast3.ToastQueue({
1700
+ maxVisibleToasts: 1,
1701
+ hasExitAnimation: true
1702
+ });
1703
+ }
1704
+ return GLOBAL_SNACKBAR_QUEUE;
1705
+ };
1706
+ var clearSnackbarQueue = () => {
1707
+ GLOBAL_SNACKBAR_QUEUE = null;
1708
+ };
1709
+ var GLOBAL_SNACKBAR_STORE = {
1710
+ providers: /* @__PURE__ */ new Set(),
1711
+ subscriptions: /* @__PURE__ */ new Set()
1712
+ };
1713
+ var Snackbar = ({ ref: forwardedRef, ...props }) => {
1714
+ const ref = (0, import_react9.useRef)(null);
1715
+ const state = (0, import_toast3.useToastQueue)(getGlobalSnackBarQueue());
1716
+ const { provider, addProvider, deleteProvider } = useSnackbarGlobalStore(GLOBAL_SNACKBAR_STORE);
1717
+ (0, import_react9.useEffect)(() => {
1718
+ addProvider(ref);
1719
+ return () => {
1720
+ for (const toast of getGlobalSnackBarQueue().visibleToasts) {
1721
+ toast.animation = void 0;
1722
+ }
1723
+ deleteProvider(ref);
1724
+ };
1725
+ }, []);
1726
+ return ref === provider && state.visibleToasts.length > 0 ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SnackbarRegion, { ref: forwardedRef, state, ...props }), document.body) : null;
1727
+ };
1728
+ Snackbar.displayName = "Snackbar";
1729
+ var addSnackbar = ({ onClose, timeout = 5e3, priority, ...content }) => {
1730
+ const queue = getGlobalSnackBarQueue();
1731
+ queue.add(content, {
1732
+ onClose,
1733
+ timeout: timeout && !content.onAction ? Math.max(timeout, 5e3) : void 0,
1734
+ priority
1735
+ });
1736
+ };
1737
+
1738
+ // src/snackbar/index.ts
1739
+ var Snackbar2 = Object.assign(Snackbar, {
1740
+ Item: SnackbarItem,
1741
+ ItemAction: SnackbarItemAction,
1742
+ ItemClose: SnackbarItemClose,
1743
+ ItemIcon: SnackbarItemIcon
1744
+ });
1745
+ Snackbar2.displayName = "Snackbar";
1746
+ SnackbarItem.displayName = "Snackbar.Item";
1747
+ SnackbarItemAction.displayName = "Snackbar.ItemAction";
1748
+ SnackbarItemClose.displayName = "Snackbar.ItemClose";
1749
+ SnackbarItemIcon.displayName = "Snackbar.ItemIcon";
1750
+ // Annotate the CommonJS export names for ESM import in node:
1751
+ 0 && (module.exports = {
1752
+ Snackbar,
1753
+ addSnackbar,
1754
+ clearSnackbarQueue
1755
+ });
1756
+ //# sourceMappingURL=index.js.map