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