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