@spark-ui/components 10.0.0

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