@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,174 @@
1
+ // src/progress/Progress.tsx
2
+ import { cx } from "class-variance-authority";
3
+ import { Progress as RadixProgress2 } from "radix-ui";
4
+ import { useMemo, useState } from "react";
5
+
6
+ // src/progress/ProgressBar.styles.ts
7
+ import { cva } from "class-variance-authority";
8
+ var progressBarStyles = cva(
9
+ ["relative", "h-sz-4 w-full", "transform-gpu overflow-hidden", "bg-on-background/dim-4"],
10
+ {
11
+ variants: {
12
+ shape: {
13
+ square: [],
14
+ rounded: ["rounded-sm"]
15
+ }
16
+ }
17
+ }
18
+ );
19
+
20
+ // src/progress/ProgressContext.tsx
21
+ import { createContext, useContext } from "react";
22
+ var ProgressContext = createContext(null);
23
+ var ID_PREFIX = ":progress";
24
+ var useProgress = () => {
25
+ const context = useContext(ProgressContext);
26
+ if (!context) {
27
+ throw new Error("useProgress must be used within a Progress provider");
28
+ }
29
+ return context;
30
+ };
31
+
32
+ // src/progress/ProgressIndicator.tsx
33
+ import { Progress as RadixProgress } from "radix-ui";
34
+
35
+ // src/progress/ProgressIndicator.styles.ts
36
+ import { cva as cva2 } from "class-variance-authority";
37
+ var progressIndicatorStyles = cva2(["h-full w-full", "transition-transform duration-400"], {
38
+ variants: {
39
+ /**
40
+ * Color scheme of the progress component.
41
+ */
42
+ intent: {
43
+ basic: ["bg-basic"],
44
+ main: ["bg-main"],
45
+ support: ["bg-support"],
46
+ accent: ["bg-accent"],
47
+ success: ["bg-success"],
48
+ alert: ["bg-alert"],
49
+ danger: ["bg-error"],
50
+ info: ["bg-info"],
51
+ neutral: ["bg-neutral"]
52
+ },
53
+ /**
54
+ * Shape of the progress component.
55
+ */
56
+ shape: {
57
+ square: [],
58
+ rounded: ["rounded-sm"]
59
+ },
60
+ /**
61
+ * Sets if the progress value is not determinated.
62
+ */
63
+ isIndeterminate: {
64
+ true: ["absolute", "-translate-x-1/2", "animate-standalone-indeterminate-bar"],
65
+ false: []
66
+ }
67
+ }
68
+ });
69
+
70
+ // src/progress/ProgressIndicator.tsx
71
+ import { jsx } from "react/jsx-runtime";
72
+ var ProgressIndicator = ({
73
+ className,
74
+ style,
75
+ ref,
76
+ ...others
77
+ }) => {
78
+ const { value, max, intent, shape, isIndeterminate } = useProgress();
79
+ const x = (max - value) / max * 100;
80
+ return /* @__PURE__ */ jsx(
81
+ RadixProgress.ProgressIndicator,
82
+ {
83
+ className: progressIndicatorStyles({ className, intent, shape, isIndeterminate }),
84
+ style: { ...style, ...!isIndeterminate && { transform: `translateX(-${x}%)` } },
85
+ ref,
86
+ ...others
87
+ }
88
+ );
89
+ };
90
+ ProgressIndicator.displayName = "Progress.Indicator";
91
+
92
+ // src/progress/ProgressBar.tsx
93
+ import { jsx as jsx2 } from "react/jsx-runtime";
94
+ var ProgressBar = ({
95
+ className,
96
+ children = /* @__PURE__ */ jsx2(ProgressIndicator, {}),
97
+ ref,
98
+ ...others
99
+ }) => {
100
+ const { shape } = useProgress();
101
+ return /* @__PURE__ */ jsx2("div", { className: progressBarStyles({ className, shape }), ref, ...others, children });
102
+ };
103
+ ProgressBar.displayName = "Progress.Bar";
104
+
105
+ // src/progress/Progress.tsx
106
+ import { jsx as jsx3 } from "react/jsx-runtime";
107
+ var Progress = ({
108
+ className,
109
+ value: valueProp,
110
+ max = 100,
111
+ shape = "square",
112
+ intent = "basic",
113
+ isIndeterminate = false,
114
+ children = /* @__PURE__ */ jsx3(ProgressBar, {}),
115
+ ref,
116
+ ...others
117
+ }) => {
118
+ const [labelId, setLabelId] = useState();
119
+ const value = useMemo(() => {
120
+ return { value: valueProp ?? 0, max, intent, shape, isIndeterminate, onLabelId: setLabelId };
121
+ }, [max, valueProp, intent, shape, isIndeterminate, setLabelId]);
122
+ return /* @__PURE__ */ jsx3(ProgressContext.Provider, { "data-spark-component": "progress", value, children: /* @__PURE__ */ jsx3(
123
+ RadixProgress2.Progress,
124
+ {
125
+ ref,
126
+ className: cx("gap-sm flex flex-col", className),
127
+ value: valueProp,
128
+ "aria-labelledby": labelId,
129
+ max,
130
+ ...others,
131
+ children
132
+ }
133
+ ) });
134
+ };
135
+ Progress.displayName = "Progress";
136
+
137
+ // src/progress/ProgressLabel.tsx
138
+ import { useMergeRefs } from "@spark-ui/use-merge-refs";
139
+ import { useCallback, useId } from "react";
140
+ import { jsx as jsx4 } from "react/jsx-runtime";
141
+ var ProgressLabel = ({
142
+ id: idProp,
143
+ children,
144
+ ref: forwardedRef,
145
+ ...others
146
+ }) => {
147
+ const internalID = `${ID_PREFIX}-label-${useId()}`;
148
+ const id = idProp || internalID;
149
+ const { onLabelId } = useProgress();
150
+ const rootRef = useCallback(
151
+ (el) => {
152
+ onLabelId(el ? id : void 0);
153
+ },
154
+ [id, onLabelId]
155
+ );
156
+ const ref = useMergeRefs(forwardedRef, rootRef);
157
+ return /* @__PURE__ */ jsx4("span", { id, className: "text-body-2 text-on-surface", ref, ...others, children });
158
+ };
159
+ ProgressLabel.displayName = "Progress.Label";
160
+
161
+ // src/progress/index.ts
162
+ var Progress2 = Object.assign(Progress, {
163
+ Label: ProgressLabel,
164
+ Bar: ProgressBar,
165
+ Indicator: ProgressIndicator
166
+ });
167
+ Progress2.displayName = "Progress";
168
+ ProgressBar.displayName = "Progress.Bar";
169
+ ProgressIndicator.displayName = "Progress.Indicator";
170
+ ProgressLabel.displayName = "Progress.Label";
171
+ export {
172
+ Progress2 as Progress
173
+ };
174
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/progress/Progress.tsx","../../src/progress/ProgressBar.styles.ts","../../src/progress/ProgressContext.tsx","../../src/progress/ProgressIndicator.tsx","../../src/progress/ProgressIndicator.styles.ts","../../src/progress/ProgressBar.tsx","../../src/progress/ProgressLabel.tsx","../../src/progress/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Progress as RadixProgress } from 'radix-ui'\nimport { PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { ProgressBar } from './ProgressBar'\nimport { ProgressContext } from './ProgressContext'\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator.styles'\n\nexport interface ProgressProps\n extends RadixProgress.ProgressProps,\n Pick<ProgressIndicatorStylesProps, 'intent'> {\n shape?: 'square' | 'rounded'\n isIndeterminate?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Progress = ({\n className,\n value: valueProp,\n max = 100,\n shape = 'square',\n intent = 'basic',\n isIndeterminate = false,\n children = <ProgressBar />,\n ref,\n ...others\n}: PropsWithChildren<ProgressProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const value = useMemo(() => {\n return { value: valueProp ?? 0, max, intent, shape, isIndeterminate, onLabelId: setLabelId }\n }, [max, valueProp, intent, shape, isIndeterminate, setLabelId])\n\n return (\n <ProgressContext.Provider data-spark-component=\"progress\" value={value}>\n <RadixProgress.Progress\n ref={ref}\n className={cx('gap-sm flex flex-col', className)}\n value={valueProp}\n aria-labelledby={labelId}\n max={max}\n {...others}\n >\n {children}\n </RadixProgress.Progress>\n </ProgressContext.Provider>\n )\n}\n\nProgress.displayName = 'Progress'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const progressBarStyles = cva(\n ['relative', 'h-sz-4 w-full', 'transform-gpu overflow-hidden', 'bg-on-background/dim-4'],\n {\n variants: {\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type ProgressBarStylesProps = VariantProps<typeof progressBarStyles>\n","import { createContext, useContext } from 'react'\n\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator.styles'\n\nexport interface ProgressContextValue {\n value: number\n max: number\n isIndeterminate: boolean\n shape: 'square' | 'rounded'\n intent: ProgressIndicatorStylesProps['intent']\n onLabelId: (id?: string) => void\n}\n\nexport const ProgressContext = createContext<ProgressContextValue | null>(null)\n\nexport const ID_PREFIX = ':progress'\n\nexport const useProgress = () => {\n const context = useContext(ProgressContext)\n\n if (!context) {\n throw new Error('useProgress must be used within a Progress provider')\n }\n\n return context\n}\n","import { Progress as RadixProgress } from 'radix-ui'\nimport { ComponentPropsWithRef, PropsWithChildren } from 'react'\n\nimport { useProgress } from './ProgressContext'\nimport { progressIndicatorStyles } from './ProgressIndicator.styles'\n\nexport type ProgressIndicatorProps = ComponentPropsWithRef<'div'>\n\nexport const ProgressIndicator = ({\n className,\n style,\n ref,\n ...others\n}: PropsWithChildren<ProgressIndicatorProps>) => {\n const { value, max, intent, shape, isIndeterminate } = useProgress()\n const x = ((max - value) / max) * 100\n\n return (\n <RadixProgress.ProgressIndicator\n className={progressIndicatorStyles({ className, intent, shape, isIndeterminate })}\n style={{ ...style, ...(!isIndeterminate && { transform: `translateX(-${x}%)` }) }}\n ref={ref}\n {...others}\n />\n )\n}\n\nProgressIndicator.displayName = 'Progress.Indicator'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const progressIndicatorStyles = cva(['h-full w-full', 'transition-transform duration-400'], {\n variants: {\n /**\n * Color scheme of the progress component.\n */\n intent: {\n basic: ['bg-basic'],\n main: ['bg-main'],\n support: ['bg-support'],\n accent: ['bg-accent'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n neutral: ['bg-neutral'],\n },\n /**\n * Shape of the progress component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n /**\n * Sets if the progress value is not determinated.\n */\n isIndeterminate: {\n true: ['absolute', '-translate-x-1/2', 'animate-standalone-indeterminate-bar'],\n false: [],\n },\n },\n})\n\nexport type ProgressIndicatorStylesProps = VariantProps<typeof progressIndicatorStyles>\n","import { ComponentPropsWithRef, PropsWithChildren } from 'react'\n\nimport { progressBarStyles } from './ProgressBar.styles'\nimport { useProgress } from './ProgressContext'\nimport { ProgressIndicator } from './ProgressIndicator'\n\nexport type ProgressBarProps = ComponentPropsWithRef<'div'>\n\nexport const ProgressBar = ({\n className,\n children = <ProgressIndicator />,\n ref,\n ...others\n}: PropsWithChildren<ProgressBarProps>) => {\n const { shape } = useProgress()\n\n return (\n <div className={progressBarStyles({ className, shape })} ref={ref} {...others}>\n {children}\n </div>\n )\n}\n\nProgressBar.displayName = 'Progress.Bar'\n","import { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { ComponentPropsWithRef, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useProgress } from './ProgressContext'\n\nexport type ProgressLabelProps = ComponentPropsWithRef<'span'>\n\nexport const ProgressLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: ProgressLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useProgress()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <span id={id} className=\"text-body-2 text-on-surface\" ref={ref} {...others}>\n {children}\n </span>\n )\n}\n\nProgressLabel.displayName = 'Progress.Label'\n","import { Progress as Root } from './Progress'\nimport { ProgressBar } from './ProgressBar'\nimport { ProgressIndicator } from './ProgressIndicator'\nimport { ProgressLabel } from './ProgressLabel'\n\nexport const Progress: typeof Root & {\n Label: typeof ProgressLabel\n Bar: typeof ProgressBar\n Indicator: typeof ProgressIndicator\n} = Object.assign(Root, {\n Label: ProgressLabel,\n Bar: ProgressBar,\n Indicator: ProgressIndicator,\n})\n\nProgress.displayName = 'Progress'\nProgressBar.displayName = 'Progress.Bar'\nProgressIndicator.displayName = 'Progress.Indicator'\nProgressLabel.displayName = 'Progress.Label'\n\nexport { type ProgressProps } from './Progress'\nexport { type ProgressBarProps } from './ProgressBar'\nexport { type ProgressLabelProps } from './ProgressLabel'\nexport { type ProgressIndicatorProps } from './ProgressIndicator'\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,YAAYA,sB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yB,wBAAqB,YAAW,OACxD,0BAAAA;AAAA,IAACC,eAAc;AAAA,IAAd;AAAA,MACC;AAAA,MACA,WAAW,GAAG,wBAAwB,SAAS;AAAA,MAC/C,OAAO;AAAA,MACP,mBAAiB;AAAA,MACjB;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,SAAS,cAAc;;;AMjDvB,SAAS,oBAAoB;AAC7B,SAAgC,aAAa,aAAa;AAyBtD,gBAAAC,YAAA;AAnBG,IAAM,gBAAgB,CAAC;AAAA,EAC5B,IAAI;AAAA,EACJ;AAAA,EACA,KAAK;AAAA,EACL,GAAG;AACL,MAA0B;AACxB,QAAM,aAAa,GAAG,SAAS,UAAU,MAAM,CAAC;AAChD,QAAM,KAAK,UAAU;AAErB,QAAM,EAAE,UAAU,IAAI,YAAY;AAClC,QAAM,UAAU;AAAA,IACd,CAAC,OAAwB;AACvB,gBAAU,KAAK,KAAK,MAAS;AAAA,IAC/B;AAAA,IACA,CAAC,IAAI,SAAS;AAAA,EAChB;AACA,QAAM,MAAM,aAAa,cAAc,OAAO;AAE9C,SACE,gBAAAA,KAAC,UAAK,IAAQ,WAAU,+BAA8B,KAAW,GAAG,QACjE,UACH;AAEJ;AAEA,cAAc,cAAc;;;AC3BrB,IAAMC,YAIT,OAAO,OAAO,UAAM;AAAA,EACtB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AACb,CAAC;AAEDA,UAAS,cAAc;AACvB,YAAY,cAAc;AAC1B,kBAAkB,cAAc;AAChC,cAAc,cAAc;","names":["RadixProgress","cva","jsx","jsx","RadixProgress","jsx","Progress"]}
@@ -0,0 +1,81 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentPropsWithRef, PropsWithChildren, ReactNode, ComponentPropsWithoutRef } from 'react';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ declare const stepIndicatorVariant: (props?: ({
7
+ size?: "sm" | "md" | "lg" | null | undefined;
8
+ intent?: "main" | "basic" | "support" | "neutral" | "info" | "accent" | "danger" | "alert" | "success" | null | undefined;
9
+ design?: "outline" | "tinted" | null | undefined;
10
+ state?: "complete" | "incomplete" | "active" | null | undefined;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
+ type StepIndicatorVariantProps = VariantProps<typeof stepIndicatorVariant>;
13
+
14
+ interface ProgressTrackerProps extends ComponentPropsWithRef<'div'>, Pick<StepIndicatorVariantProps, 'size' | 'intent' | 'design'> {
15
+ /**
16
+ * The orientation of the progress tracker
17
+ * @default 'horizontal"
18
+ */
19
+ orientation?: 'horizontal' | 'vertical';
20
+ /**
21
+ * The index of the current step.
22
+ * @default 0
23
+ */
24
+ stepIndex?: number;
25
+ /**
26
+ * Event handler called when clicking on a step.
27
+ */
28
+ onStepClick?: (stepIndex: number) => void;
29
+ /**
30
+ * Sets the component as interactive or not.
31
+ * @default false
32
+ */
33
+ readOnly?: boolean;
34
+ }
35
+ declare const ProgressTracker$1: {
36
+ ({ stepIndex, onStepClick, readOnly, intent, size, design, orientation, children, className, ref, ...rest }: PropsWithChildren<ProgressTrackerProps>): react_jsx_runtime.JSX.Element;
37
+ displayName: string;
38
+ };
39
+
40
+ type ProgressTrackerStepProps = ComponentPropsWithRef<'li'> & ({
41
+ disabled?: boolean;
42
+ children: ReactNode;
43
+ } | {
44
+ disabled?: boolean;
45
+ 'aria-label': string;
46
+ });
47
+ declare const ProgressTrackerStep: {
48
+ ({ disabled, children, "aria-label": ariaLabel, className, ref, ...rest }: ProgressTrackerStepProps): react_jsx_runtime.JSX.Element;
49
+ displayName: string;
50
+ };
51
+
52
+ type ProgressTrackerStepIndicatorProps = ComponentPropsWithoutRef<'span'> & {
53
+ /**
54
+ * The content to be rendered when step status is complete (checkmark icon by default)
55
+ */
56
+ complete?: ReactNode;
57
+ /**
58
+ * The content to be rendered when step status is incomplete (step index by default)
59
+ */
60
+ incomplete?: ReactNode;
61
+ };
62
+ declare const ProgressTrackerStepIndicator: {
63
+ ({ complete, incomplete, className, }: ProgressTrackerStepIndicatorProps): react_jsx_runtime.JSX.Element;
64
+ displayName: string;
65
+ };
66
+
67
+ type ProgressTrackerStepLabelProps = ComponentPropsWithoutRef<'span'> & {
68
+ children: ReactNode;
69
+ };
70
+ declare const ProgressTrackerStepLabel: {
71
+ ({ className, children, }: ProgressTrackerStepLabelProps): react_jsx_runtime.JSX.Element;
72
+ displayName: string;
73
+ };
74
+
75
+ declare const ProgressTracker: typeof ProgressTracker$1 & {
76
+ Step: typeof ProgressTrackerStep;
77
+ StepLabel: typeof ProgressTrackerStepLabel;
78
+ StepIndicator: typeof ProgressTrackerStepIndicator;
79
+ };
80
+
81
+ export { ProgressTracker, type ProgressTrackerProps, type ProgressTrackerStepIndicatorProps, type ProgressTrackerStepProps };
@@ -0,0 +1,81 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentPropsWithRef, PropsWithChildren, ReactNode, ComponentPropsWithoutRef } from 'react';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ declare const stepIndicatorVariant: (props?: ({
7
+ size?: "sm" | "md" | "lg" | null | undefined;
8
+ intent?: "main" | "basic" | "support" | "neutral" | "info" | "accent" | "danger" | "alert" | "success" | null | undefined;
9
+ design?: "outline" | "tinted" | null | undefined;
10
+ state?: "complete" | "incomplete" | "active" | null | undefined;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
+ type StepIndicatorVariantProps = VariantProps<typeof stepIndicatorVariant>;
13
+
14
+ interface ProgressTrackerProps extends ComponentPropsWithRef<'div'>, Pick<StepIndicatorVariantProps, 'size' | 'intent' | 'design'> {
15
+ /**
16
+ * The orientation of the progress tracker
17
+ * @default 'horizontal"
18
+ */
19
+ orientation?: 'horizontal' | 'vertical';
20
+ /**
21
+ * The index of the current step.
22
+ * @default 0
23
+ */
24
+ stepIndex?: number;
25
+ /**
26
+ * Event handler called when clicking on a step.
27
+ */
28
+ onStepClick?: (stepIndex: number) => void;
29
+ /**
30
+ * Sets the component as interactive or not.
31
+ * @default false
32
+ */
33
+ readOnly?: boolean;
34
+ }
35
+ declare const ProgressTracker$1: {
36
+ ({ stepIndex, onStepClick, readOnly, intent, size, design, orientation, children, className, ref, ...rest }: PropsWithChildren<ProgressTrackerProps>): react_jsx_runtime.JSX.Element;
37
+ displayName: string;
38
+ };
39
+
40
+ type ProgressTrackerStepProps = ComponentPropsWithRef<'li'> & ({
41
+ disabled?: boolean;
42
+ children: ReactNode;
43
+ } | {
44
+ disabled?: boolean;
45
+ 'aria-label': string;
46
+ });
47
+ declare const ProgressTrackerStep: {
48
+ ({ disabled, children, "aria-label": ariaLabel, className, ref, ...rest }: ProgressTrackerStepProps): react_jsx_runtime.JSX.Element;
49
+ displayName: string;
50
+ };
51
+
52
+ type ProgressTrackerStepIndicatorProps = ComponentPropsWithoutRef<'span'> & {
53
+ /**
54
+ * The content to be rendered when step status is complete (checkmark icon by default)
55
+ */
56
+ complete?: ReactNode;
57
+ /**
58
+ * The content to be rendered when step status is incomplete (step index by default)
59
+ */
60
+ incomplete?: ReactNode;
61
+ };
62
+ declare const ProgressTrackerStepIndicator: {
63
+ ({ complete, incomplete, className, }: ProgressTrackerStepIndicatorProps): react_jsx_runtime.JSX.Element;
64
+ displayName: string;
65
+ };
66
+
67
+ type ProgressTrackerStepLabelProps = ComponentPropsWithoutRef<'span'> & {
68
+ children: ReactNode;
69
+ };
70
+ declare const ProgressTrackerStepLabel: {
71
+ ({ className, children, }: ProgressTrackerStepLabelProps): react_jsx_runtime.JSX.Element;
72
+ displayName: string;
73
+ };
74
+
75
+ declare const ProgressTracker: typeof ProgressTracker$1 & {
76
+ Step: typeof ProgressTrackerStep;
77
+ StepLabel: typeof ProgressTrackerStepLabel;
78
+ StepIndicator: typeof ProgressTrackerStepIndicator;
79
+ };
80
+
81
+ export { ProgressTracker, type ProgressTrackerProps, type ProgressTrackerStepIndicatorProps, type ProgressTrackerStepProps };