@spark-ui/components 17.2.3 → 17.2.4-beta.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 (302) hide show
  1. package/dist/DialogContent.styles-BSxCCi-u.mjs +62 -0
  2. package/dist/DialogContent.styles-BSxCCi-u.mjs.map +1 -0
  3. package/dist/DialogContent.styles-CAhJtUud.js +2 -0
  4. package/dist/DialogContent.styles-CAhJtUud.js.map +1 -0
  5. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js +2 -0
  6. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js.map +1 -0
  7. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs +14 -0
  8. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs.map +1 -0
  9. package/dist/accordion/index.js +2 -2
  10. package/dist/accordion/index.js.map +1 -1
  11. package/dist/accordion/index.mjs +99 -161
  12. package/dist/accordion/index.mjs.map +1 -1
  13. package/dist/alert-dialog/index.js +2 -2
  14. package/dist/alert-dialog/index.js.map +1 -1
  15. package/dist/alert-dialog/index.mjs +169 -235
  16. package/dist/alert-dialog/index.mjs.map +1 -1
  17. package/dist/avatar/index.js +2 -2
  18. package/dist/avatar/index.js.map +1 -1
  19. package/dist/avatar/index.mjs +187 -224
  20. package/dist/avatar/index.mjs.map +1 -1
  21. package/dist/badge/index.js +2 -2
  22. package/dist/badge/index.js.map +1 -1
  23. package/dist/badge/index.mjs +115 -81
  24. package/dist/badge/index.mjs.map +1 -1
  25. package/dist/breadcrumb/index.js +2 -2
  26. package/dist/breadcrumb/index.js.map +1 -1
  27. package/dist/breadcrumb/index.mjs +73 -106
  28. package/dist/breadcrumb/index.mjs.map +1 -1
  29. package/dist/button/index.js +1 -2
  30. package/dist/button/index.mjs +2 -5
  31. package/dist/button-BTDRzvpB.js +2 -0
  32. package/dist/button-BTDRzvpB.js.map +1 -0
  33. package/dist/button-_YZ_4J42.mjs +643 -0
  34. package/dist/button-_YZ_4J42.mjs.map +1 -0
  35. package/dist/card/index.js +2 -2
  36. package/dist/card/index.js.map +1 -1
  37. package/dist/card/index.mjs +327 -394
  38. package/dist/card/index.mjs.map +1 -1
  39. package/dist/carousel/index.js +2 -2
  40. package/dist/carousel/index.js.map +1 -1
  41. package/dist/carousel/index.mjs +515 -618
  42. package/dist/carousel/index.mjs.map +1 -1
  43. package/dist/checkbox/index.js +2 -2
  44. package/dist/checkbox/index.js.map +1 -1
  45. package/dist/checkbox/index.mjs +213 -246
  46. package/dist/checkbox/index.mjs.map +1 -1
  47. package/dist/chip/index.js +2 -2
  48. package/dist/chip/index.js.map +1 -1
  49. package/dist/chip/index.mjs +601 -652
  50. package/dist/chip/index.mjs.map +1 -1
  51. package/dist/chunk-C91j1N6u.js +1 -0
  52. package/dist/circular-meter/index.js +2 -2
  53. package/dist/circular-meter/index.js.map +1 -1
  54. package/dist/circular-meter/index.mjs +354 -309
  55. package/dist/circular-meter/index.mjs.map +1 -1
  56. package/dist/collapsible/index.js +2 -2
  57. package/dist/collapsible/index.js.map +1 -1
  58. package/dist/collapsible/index.mjs +53 -53
  59. package/dist/collapsible/index.mjs.map +1 -1
  60. package/dist/combobox/index.js +2 -2
  61. package/dist/combobox/index.js.map +1 -1
  62. package/dist/combobox/index.mjs +721 -876
  63. package/dist/combobox/index.mjs.map +1 -1
  64. package/dist/dialog/index.js +2 -2
  65. package/dist/dialog/index.js.map +1 -1
  66. package/dist/dialog/index.mjs +181 -206
  67. package/dist/dialog/index.mjs.map +1 -1
  68. package/dist/divider/index.js +2 -2
  69. package/dist/divider/index.js.map +1 -1
  70. package/dist/divider/index.mjs +178 -183
  71. package/dist/divider/index.mjs.map +1 -1
  72. package/dist/drawer/index.js +2 -2
  73. package/dist/drawer/index.js.map +1 -1
  74. package/dist/drawer/index.mjs +277 -309
  75. package/dist/drawer/index.mjs.map +1 -1
  76. package/dist/dropdown/index.js +2 -2
  77. package/dist/dropdown/index.js.map +1 -1
  78. package/dist/dropdown/index.mjs +429 -492
  79. package/dist/dropdown/index.mjs.map +1 -1
  80. package/dist/file-upload/index.js +2 -2
  81. package/dist/file-upload/index.js.map +1 -1
  82. package/dist/file-upload/index.mjs +540 -677
  83. package/dist/file-upload/index.mjs.map +1 -1
  84. package/dist/form-field/index.js +1 -2
  85. package/dist/form-field/index.mjs +2 -284
  86. package/dist/form-field-B8QzM655.mjs +231 -0
  87. package/dist/form-field-B8QzM655.mjs.map +1 -0
  88. package/dist/form-field-Bu_0E9tb.js +2 -0
  89. package/dist/form-field-Bu_0E9tb.js.map +1 -0
  90. package/dist/icon/index.js +1 -2
  91. package/dist/icon/index.mjs +2 -5
  92. package/dist/icon-CRPcdgYp.js +2 -0
  93. package/dist/icon-CRPcdgYp.js.map +1 -0
  94. package/dist/icon-D05Uqh8_.mjs +41 -0
  95. package/dist/icon-D05Uqh8_.mjs.map +1 -0
  96. package/dist/icon-button/index.js +1 -2
  97. package/dist/icon-button/index.mjs +2 -5
  98. package/dist/icon-button-6p3O7NIm.mjs +28 -0
  99. package/dist/icon-button-6p3O7NIm.mjs.map +1 -0
  100. package/dist/icon-button-CykysbgJ.js +2 -0
  101. package/dist/icon-button-CykysbgJ.js.map +1 -0
  102. package/dist/input/index.js +1 -2
  103. package/dist/input/index.mjs +2 -455
  104. package/dist/input-CmYeHYWQ.mjs +355 -0
  105. package/dist/input-CmYeHYWQ.mjs.map +1 -0
  106. package/dist/input-DNr40G2Z.js +2 -0
  107. package/dist/input-DNr40G2Z.js.map +1 -0
  108. package/dist/input-otp/index.js +2 -2
  109. package/dist/input-otp/index.js.map +1 -1
  110. package/dist/input-otp/index.mjs +344 -407
  111. package/dist/input-otp/index.mjs.map +1 -1
  112. package/dist/kbd/index.js +2 -2
  113. package/dist/kbd/index.js.map +1 -1
  114. package/dist/kbd/index.mjs +12 -17
  115. package/dist/kbd/index.mjs.map +1 -1
  116. package/dist/label/index.js +1 -2
  117. package/dist/label/index.mjs +2 -40
  118. package/dist/label-BqRlrca0.mjs +31 -0
  119. package/dist/label-BqRlrca0.mjs.map +1 -0
  120. package/dist/label-DU0p0d-f.js +2 -0
  121. package/dist/label-DU0p0d-f.js.map +1 -0
  122. package/dist/link-box/index.js +2 -2
  123. package/dist/link-box/index.js.map +1 -1
  124. package/dist/link-box/index.mjs +36 -34
  125. package/dist/link-box/index.mjs.map +1 -1
  126. package/dist/meter/index.js +2 -2
  127. package/dist/meter/index.js.map +1 -1
  128. package/dist/meter/index.mjs +149 -171
  129. package/dist/meter/index.mjs.map +1 -1
  130. package/dist/pagination/index.js +2 -2
  131. package/dist/pagination/index.js.map +1 -1
  132. package/dist/pagination/index.mjs +253 -214
  133. package/dist/pagination/index.mjs.map +1 -1
  134. package/dist/popover/index.js +1 -2
  135. package/dist/popover/index.mjs +2 -239
  136. package/dist/popover-CxZAQmw6.mjs +211 -0
  137. package/dist/popover-CxZAQmw6.mjs.map +1 -0
  138. package/dist/popover-GOovJ27J.js +2 -0
  139. package/dist/popover-GOovJ27J.js.map +1 -0
  140. package/dist/portal/index.js +2 -2
  141. package/dist/portal/index.js.map +1 -1
  142. package/dist/portal/index.mjs +8 -7
  143. package/dist/portal/index.mjs.map +1 -1
  144. package/dist/progress/index.js +1 -2
  145. package/dist/progress/index.mjs +2 -178
  146. package/dist/progress-cEf3tFbn.mjs +132 -0
  147. package/dist/progress-cEf3tFbn.mjs.map +1 -0
  148. package/dist/progress-rJZcPJsZ.js +2 -0
  149. package/dist/progress-rJZcPJsZ.js.map +1 -0
  150. package/dist/progress-tracker/index.js +2 -2
  151. package/dist/progress-tracker/index.js.map +1 -1
  152. package/dist/progress-tracker/index.mjs +303 -380
  153. package/dist/progress-tracker/index.mjs.map +1 -1
  154. package/dist/radio-group/index.js +2 -2
  155. package/dist/radio-group/index.js.map +1 -1
  156. package/dist/radio-group/index.mjs +204 -213
  157. package/dist/radio-group/index.mjs.map +1 -1
  158. package/dist/rating/index.js +2 -2
  159. package/dist/rating/index.js.map +1 -1
  160. package/dist/rating/index.mjs +189 -244
  161. package/dist/rating/index.mjs.map +1 -1
  162. package/dist/rating-display/index.js +2 -2
  163. package/dist/rating-display/index.js.map +1 -1
  164. package/dist/rating-display/index.mjs +165 -166
  165. package/dist/rating-display/index.mjs.map +1 -1
  166. package/dist/scrolling-list/index.js +2 -2
  167. package/dist/scrolling-list/index.js.map +1 -1
  168. package/dist/scrolling-list/index.mjs +216 -273
  169. package/dist/scrolling-list/index.mjs.map +1 -1
  170. package/dist/segmented-control/index.js +2 -2
  171. package/dist/segmented-control/index.js.map +1 -1
  172. package/dist/segmented-control/index.mjs +146 -180
  173. package/dist/segmented-control/index.mjs.map +1 -1
  174. package/dist/segmented-gauge/index.js +2 -2
  175. package/dist/segmented-gauge/index.js.map +1 -1
  176. package/dist/segmented-gauge/index.mjs +146 -195
  177. package/dist/segmented-gauge/index.mjs.map +1 -1
  178. package/dist/select/index.js +2 -2
  179. package/dist/select/index.js.map +1 -1
  180. package/dist/select/index.mjs +279 -327
  181. package/dist/select/index.mjs.map +1 -1
  182. package/dist/skeleton/index.js +2 -2
  183. package/dist/skeleton/index.js.map +1 -1
  184. package/dist/skeleton/index.mjs +92 -114
  185. package/dist/skeleton/index.mjs.map +1 -1
  186. package/dist/slider/index.js +2 -2
  187. package/dist/slider/index.js.map +1 -1
  188. package/dist/slider/index.mjs +259 -326
  189. package/dist/slider/index.mjs.map +1 -1
  190. package/dist/slot/index.js +2 -2
  191. package/dist/slot/index.js.map +1 -1
  192. package/dist/slot/index.mjs +12 -7
  193. package/dist/slot/index.mjs.map +1 -1
  194. package/dist/snackbar/index.js +2 -2
  195. package/dist/snackbar/index.js.map +1 -1
  196. package/dist/snackbar/index.mjs +404 -529
  197. package/dist/snackbar/index.mjs.map +1 -1
  198. package/dist/spinner/index.js +1 -2
  199. package/dist/spinner/index.mjs +2 -5
  200. package/dist/spinner-DFUoYvmm.js +2 -0
  201. package/dist/spinner-DFUoYvmm.js.map +1 -0
  202. package/dist/spinner-DULLiM6a.mjs +56 -0
  203. package/dist/spinner-DULLiM6a.mjs.map +1 -0
  204. package/dist/src/avatar/index.d.mts +2 -2
  205. package/dist/src/avatar/index.d.ts +2 -2
  206. package/dist/src/file-upload/index.d.mts +1 -1
  207. package/dist/src/file-upload/index.d.ts +1 -1
  208. package/dist/stepper/index.js +2 -2
  209. package/dist/stepper/index.js.map +1 -1
  210. package/dist/stepper/index.mjs +139 -176
  211. package/dist/stepper/index.mjs.map +1 -1
  212. package/dist/switch/index.js +2 -2
  213. package/dist/switch/index.js.map +1 -1
  214. package/dist/switch/index.mjs +194 -197
  215. package/dist/switch/index.mjs.map +1 -1
  216. package/dist/tabs/index.js +2 -2
  217. package/dist/tabs/index.js.map +1 -1
  218. package/dist/tabs/index.mjs +337 -389
  219. package/dist/tabs/index.mjs.map +1 -1
  220. package/dist/tag/index.js +2 -2
  221. package/dist/tag/index.js.map +1 -1
  222. package/dist/tag/index.mjs +192 -211
  223. package/dist/tag/index.mjs.map +1 -1
  224. package/dist/text-link/index.js +2 -2
  225. package/dist/text-link/index.js.map +1 -1
  226. package/dist/text-link/index.mjs +44 -5
  227. package/dist/text-link/index.mjs.map +1 -1
  228. package/dist/textarea/index.js +2 -2
  229. package/dist/textarea/index.js.map +1 -1
  230. package/dist/textarea/index.mjs +51 -50
  231. package/dist/textarea/index.mjs.map +1 -1
  232. package/dist/toast/index.js +2 -2
  233. package/dist/toast/index.js.map +1 -1
  234. package/dist/toast/index.mjs +314 -367
  235. package/dist/toast/index.mjs.map +1 -1
  236. package/dist/useRenderSlot-DP4fYerF.mjs +11 -0
  237. package/dist/useRenderSlot-DP4fYerF.mjs.map +1 -0
  238. package/dist/useRenderSlot-Xxf_s88b.js +2 -0
  239. package/dist/useRenderSlot-Xxf_s88b.js.map +1 -0
  240. package/dist/visually-hidden/index.js +2 -2
  241. package/dist/visually-hidden/index.js.map +1 -1
  242. package/dist/visually-hidden/index.mjs +25 -5
  243. package/dist/visually-hidden/index.mjs.map +1 -1
  244. package/package.json +4 -4
  245. package/dist/Button-1M9DcZl0.mjs +0 -704
  246. package/dist/Button-1M9DcZl0.mjs.map +0 -1
  247. package/dist/Button-FZceRWG2.js +0 -2
  248. package/dist/Button-FZceRWG2.js.map +0 -1
  249. package/dist/DialogContent.styles-CziMQtYr.js +0 -2
  250. package/dist/DialogContent.styles-CziMQtYr.js.map +0 -1
  251. package/dist/DialogContent.styles-Du7_Dkde.mjs +0 -60
  252. package/dist/DialogContent.styles-Du7_Dkde.mjs.map +0 -1
  253. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js +0 -2
  254. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js.map +0 -1
  255. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs +0 -13
  256. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs.map +0 -1
  257. package/dist/Icon-BO327oHU.mjs +0 -57
  258. package/dist/Icon-BO327oHU.mjs.map +0 -1
  259. package/dist/Icon-C-cNTnzd.js +0 -2
  260. package/dist/Icon-C-cNTnzd.js.map +0 -1
  261. package/dist/IconButton-BR1bJSQA.js +0 -2
  262. package/dist/IconButton-BR1bJSQA.js.map +0 -1
  263. package/dist/IconButton-DdB3Pq13.mjs +0 -43
  264. package/dist/IconButton-DdB3Pq13.mjs.map +0 -1
  265. package/dist/Slot-DLY1rJrG.mjs +0 -14
  266. package/dist/Slot-DLY1rJrG.mjs.map +0 -1
  267. package/dist/Slot-DQ8z2zsy.js +0 -2
  268. package/dist/Slot-DQ8z2zsy.js.map +0 -1
  269. package/dist/Spinner-Br4Rp9V2.js +0 -2
  270. package/dist/Spinner-Br4Rp9V2.js.map +0 -1
  271. package/dist/Spinner-Co3AjkQV.mjs +0 -68
  272. package/dist/Spinner-Co3AjkQV.mjs.map +0 -1
  273. package/dist/TextLink-5MvP0P8D.js +0 -2
  274. package/dist/TextLink-5MvP0P8D.js.map +0 -1
  275. package/dist/TextLink-Cc_LeVcx.mjs +0 -57
  276. package/dist/TextLink-Cc_LeVcx.mjs.map +0 -1
  277. package/dist/VisuallyHidden-CB6Nx76j.js +0 -2
  278. package/dist/VisuallyHidden-CB6Nx76j.js.map +0 -1
  279. package/dist/VisuallyHidden-DjlV0-CW.mjs +0 -28
  280. package/dist/VisuallyHidden-DjlV0-CW.mjs.map +0 -1
  281. package/dist/button/index.js.map +0 -1
  282. package/dist/button/index.mjs.map +0 -1
  283. package/dist/form-field/index.js.map +0 -1
  284. package/dist/form-field/index.mjs.map +0 -1
  285. package/dist/icon/index.js.map +0 -1
  286. package/dist/icon/index.mjs.map +0 -1
  287. package/dist/icon-button/index.js.map +0 -1
  288. package/dist/icon-button/index.mjs.map +0 -1
  289. package/dist/input/index.js.map +0 -1
  290. package/dist/input/index.mjs.map +0 -1
  291. package/dist/label/index.js.map +0 -1
  292. package/dist/label/index.mjs.map +0 -1
  293. package/dist/popover/index.js.map +0 -1
  294. package/dist/popover/index.mjs.map +0 -1
  295. package/dist/progress/index.js.map +0 -1
  296. package/dist/progress/index.mjs.map +0 -1
  297. package/dist/spinner/index.js.map +0 -1
  298. package/dist/spinner/index.mjs.map +0 -1
  299. package/dist/useRenderSlot-Bta2kdp4.mjs +0 -10
  300. package/dist/useRenderSlot-Bta2kdp4.mjs.map +0 -1
  301. package/dist/useRenderSlot-DATwjgpo.js +0 -2
  302. package/dist/useRenderSlot-DATwjgpo.js.map +0 -1
@@ -1,176 +1,154 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { Meter as m } from "@base-ui/react/meter";
3
- import { cx as p, cva as h } from "class-variance-authority";
4
- import { createContext as w, useContext as L, useState as y, useMemo as R, useId as T, useCallback as V, useRef as f, useEffect as k } from "react";
5
- import { useMergeRefs as $ } from "@spark-ui/hooks/use-merge-refs";
6
- const x = w(null), A = ":meter", v = () => {
7
- const t = L(x);
8
- if (!t)
9
- throw new Error("useMeter must be used within a Meter provider");
10
- return t;
11
- }, N = ({
12
- className: t,
13
- value: r,
14
- max: a = 100,
15
- min: n = 0,
16
- shape: s = "rounded",
17
- intent: e = "support",
18
- children: o,
19
- ref: l,
20
- ...c
21
- }) => {
22
- const [i, u] = y(), I = R(() => ({
23
- value: r ?? 0,
24
- max: a,
25
- min: n,
26
- intent: e,
27
- shape: s,
28
- onLabelId: u
29
- }), [a, n, r, e, s, u]);
30
- return /* @__PURE__ */ d(x.Provider, { value: I, children: /* @__PURE__ */ d(
31
- m.Root,
32
- {
33
- "data-spark-component": "meter",
34
- ref: l,
35
- className: p(
36
- "gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]",
37
- t
38
- ),
39
- value: r,
40
- max: a,
41
- min: n,
42
- "aria-labelledby": i,
43
- ...c,
44
- children: o
45
- }
46
- ) });
1
+ import { cva as e, cx as t } from "class-variance-authority";
2
+ import { createContext as n, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
3
+ import { jsx as u } from "react/jsx-runtime";
4
+ import { useMergeRefs as d } from "@spark-ui/hooks/use-merge-refs";
5
+ import { Meter as f } from "@base-ui/react/meter";
6
+ //#region src/meter/MeterContext.tsx
7
+ var p = n(null), m = ":meter", h = () => {
8
+ let e = i(p);
9
+ if (!e) throw Error("useMeter must be used within a Meter provider");
10
+ return e;
11
+ }, g = ({ className: e, value: n, max: r = 100, min: i = 0, shape: a = "rounded", intent: o = "support", children: c, ref: d, ...m }) => {
12
+ let [h, g] = l(), _ = s(() => ({
13
+ value: n ?? 0,
14
+ max: r,
15
+ min: i,
16
+ intent: o,
17
+ shape: a,
18
+ onLabelId: g
19
+ }), [
20
+ r,
21
+ i,
22
+ n,
23
+ o,
24
+ a,
25
+ g
26
+ ]);
27
+ return /* @__PURE__ */ u(p.Provider, {
28
+ value: _,
29
+ children: /* @__PURE__ */ u(f.Root, {
30
+ "data-spark-component": "meter",
31
+ ref: d,
32
+ className: t("gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]", e),
33
+ value: n,
34
+ max: r,
35
+ min: i,
36
+ "aria-labelledby": h,
37
+ ...m,
38
+ children: c
39
+ })
40
+ });
47
41
  };
48
- N.displayName = "Meter";
49
- const b = ({
50
- id: t,
51
- children: r,
52
- ref: a,
53
- ...n
54
- }) => {
55
- const s = `${A}-label-${T()}`, e = t || s, { onLabelId: o } = v(), l = V(
56
- (i) => {
57
- o(i ? e : void 0);
58
- },
59
- [e, o]
60
- ), c = $(a, l);
61
- return /* @__PURE__ */ d(
62
- m.Label,
63
- {
64
- "data-spark-component": "meter-label",
65
- id: e,
66
- className: "default:text-body-1 text-on-surface default:font-bold",
67
- ref: c,
68
- ...n,
69
- children: r
70
- }
71
- );
42
+ g.displayName = "Meter";
43
+ //#endregion
44
+ //#region src/meter/MeterLabel.tsx
45
+ var _ = ({ id: e, children: t, ref: n, ...i }) => {
46
+ let a = `${m}-label-${o()}`, s = e || a, { onLabelId: c } = h(), l = d(n, r((e) => {
47
+ c(e ? s : void 0);
48
+ }, [s, c]));
49
+ return /* @__PURE__ */ u(f.Label, {
50
+ "data-spark-component": "meter-label",
51
+ id: s,
52
+ className: "default:text-body-1 text-on-surface default:font-bold",
53
+ ref: l,
54
+ ...i,
55
+ children: t
56
+ });
72
57
  };
73
- b.displayName = "Meter.Label";
74
- const C = h([
75
- "relative col-span-2",
76
- "h-sz-8 w-full",
77
- "transform-gpu overflow-hidden",
78
- "bg-on-background/dim-4"
79
- ]), E = h(
80
- ["size-full", "ease-standard transition-[width] duration-700", "motion-reduce:transition-none"],
81
- {
82
- variants: {
83
- /**
84
- * Color scheme of the meter component.
85
- */
86
- intent: {
87
- main: ["bg-main"],
88
- support: ["bg-support"],
89
- success: ["bg-success"],
90
- alert: ["bg-alert"],
91
- danger: ["bg-error"],
92
- info: ["bg-info"]
93
- },
94
- /**
95
- * Shape of the meter component.
96
- */
97
- shape: {
98
- square: [],
99
- rounded: ["rounded-sm"]
100
- }
101
- }
102
- }
103
- );
104
- function S(t, r, a = {}) {
105
- const { threshold: n = 0.1, rootMargin: s } = a, e = f(!1), o = f(r);
106
- return k(() => {
107
- o.current = r;
108
- }, [r]), k(() => {
109
- const l = t.current;
110
- if (!l || e.current) return;
111
- const c = new IntersectionObserver(
112
- (i) => {
113
- i.forEach((u) => {
114
- u.isIntersecting && !e.current && requestAnimationFrame(() => {
115
- e.current || (e.current = !0, o.current(), c.disconnect());
116
- });
117
- });
118
- },
119
- {
120
- threshold: n,
121
- rootMargin: s
122
- }
123
- );
124
- return c.observe(l), () => {
125
- c.disconnect();
126
- };
127
- }, [t, n, s]), e.current;
58
+ _.displayName = "Meter.Label";
59
+ //#endregion
60
+ //#region src/meter/MeterTrack.styles.ts
61
+ var v = e([
62
+ "relative col-span-2",
63
+ "h-sz-8 w-full",
64
+ "transform-gpu overflow-hidden",
65
+ "bg-on-background/dim-4"
66
+ ]), y = e([
67
+ "size-full",
68
+ "ease-standard transition-[width] duration-700",
69
+ "motion-reduce:transition-none"
70
+ ], { variants: {
71
+ intent: {
72
+ main: ["bg-main"],
73
+ support: ["bg-support"],
74
+ success: ["bg-success"],
75
+ alert: ["bg-alert"],
76
+ danger: ["bg-error"],
77
+ info: ["bg-info"]
78
+ },
79
+ shape: {
80
+ square: [],
81
+ rounded: ["rounded-sm"]
82
+ }
83
+ } });
84
+ //#endregion
85
+ //#region src/meter/useIntersectionAnimation.ts
86
+ function b(e, t, n = {}) {
87
+ let { threshold: r = .1, rootMargin: i } = n, o = c(!1), s = c(t);
88
+ return a(() => {
89
+ s.current = t;
90
+ }, [t]), a(() => {
91
+ let t = e.current;
92
+ if (!t || o.current) return;
93
+ let n = new IntersectionObserver((e) => {
94
+ e.forEach((e) => {
95
+ e.isIntersecting && !o.current && requestAnimationFrame(() => {
96
+ o.current || (o.current = !0, s.current(), n.disconnect());
97
+ });
98
+ });
99
+ }, {
100
+ threshold: r,
101
+ rootMargin: i
102
+ });
103
+ return n.observe(t), () => {
104
+ n.disconnect();
105
+ };
106
+ }, [
107
+ e,
108
+ r,
109
+ i
110
+ ]), o.current;
128
111
  }
129
- const g = ({ className: t, ...r }) => {
130
- const { value: a, max: n, min: s, intent: e, shape: o } = v(), l = (a - s) / (n - s) * 100, c = f(null), [i, u] = y(!1);
131
- return S(c, () => {
132
- u(!0);
133
- }), /* @__PURE__ */ d(
134
- m.Track,
135
- {
136
- ref: c,
137
- "data-spark-component": "meter-track",
138
- className: p(C(), { "rounded-sm": o === "rounded" }, t),
139
- ...r,
140
- children: /* @__PURE__ */ d(
141
- m.Indicator,
142
- {
143
- "data-spark-component": "meter-indicator",
144
- className: E({ intent: e, shape: o }),
145
- style: {
146
- width: i ? `${l}%` : "0%"
147
- }
148
- }
149
- )
150
- }
151
- );
112
+ //#endregion
113
+ //#region src/meter/MeterTrack.tsx
114
+ var x = ({ className: e, ...n }) => {
115
+ let { value: r, max: i, min: a, intent: o, shape: s } = h(), d = (r - a) / (i - a) * 100, p = c(null), [m, g] = l(!1);
116
+ return b(p, () => {
117
+ g(!0);
118
+ }), /* @__PURE__ */ u(f.Track, {
119
+ ref: p,
120
+ "data-spark-component": "meter-track",
121
+ className: t(v(), { "rounded-sm": s === "rounded" }, e),
122
+ ...n,
123
+ children: /* @__PURE__ */ u(f.Indicator, {
124
+ "data-spark-component": "meter-indicator",
125
+ className: y({
126
+ intent: o,
127
+ shape: s
128
+ }),
129
+ style: { width: m ? `${d}%` : "0%" }
130
+ })
131
+ });
152
132
  };
153
- g.displayName = "Meter.Track";
154
- const M = ({ className: t, children: r, ...a }) => /* @__PURE__ */ d(
155
- m.Value,
156
- {
157
- "data-spark-component": "meter-value",
158
- className: p("default:text-body-1 text-on-surface", "col-start-2 text-right", t),
159
- ...a,
160
- children: r
161
- }
162
- );
163
- M.displayName = "Meter.Value";
164
- const j = Object.assign(N, {
165
- Label: b,
166
- Track: g,
167
- Value: M
133
+ x.displayName = "Meter.Track";
134
+ //#endregion
135
+ //#region src/meter/MeterValue.tsx
136
+ var S = ({ className: e, children: n, ...r }) => /* @__PURE__ */ u(f.Value, {
137
+ "data-spark-component": "meter-value",
138
+ className: t("default:text-body-1 text-on-surface", "col-start-2 text-right", e),
139
+ ...r,
140
+ children: n
168
141
  });
169
- j.displayName = "Meter";
170
- b.displayName = "Meter.Label";
171
- g.displayName = "Meter.Track";
172
- M.displayName = "Meter.Value";
173
- export {
174
- j as Meter
175
- };
176
- //# sourceMappingURL=index.mjs.map
142
+ S.displayName = "Meter.Value";
143
+ //#endregion
144
+ //#region src/meter/index.ts
145
+ var C = Object.assign(g, {
146
+ Label: _,
147
+ Track: x,
148
+ Value: S
149
+ });
150
+ C.displayName = "Meter", _.displayName = "Meter.Label", x.displayName = "Meter.Track", S.displayName = "Meter.Value";
151
+ //#endregion
152
+ export { C as Meter };
153
+
154
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx(\n 'gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]',\n className\n )}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\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 <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\nexport type MeterValueProps = Omit<\n ComponentProps<typeof BaseMeter.Value>,\n 'render' | 'children'\n> & {\n children?: ((formattedValue: string, value: number) => ReactNode) | null | undefined\n}\n\nexport const MeterValue = ({ className, children, ...others }: MeterValueProps) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"names":["MeterContext","createContext","ID_PREFIX","useMeter","context","useContext","Meter","className","value","max","min","shape","intent","children","ref","others","labelId","setLabelId","useState","contextValue","useMemo","jsx","BaseMeter","cx","MeterLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","meterTrackStyles","cva","meterIndicatorStyles","useIntersectionAnimation","elementRef","onIntersect","options","threshold","rootMargin","hasTriggeredRef","useRef","callbackRef","useEffect","element","observer","entries","entry","MeterTrack","percentage","trackRef","hasAnimated","setHasAnimated","MeterValue","Root"],"mappings":";;;;;AAaO,MAAMA,IAAeC,EAAwC,IAAI,GAE3DC,IAAY,UAEZC,IAAW,MAAM;AAC5B,QAAMC,IAAUC,EAAWL,CAAY;AAEvC,MAAI,CAACI;AACH,UAAM,IAAI,MAAM,+CAA+C;AAGjE,SAAOA;AACT,GCJaE,IAAQ,CAAC;AAAA,EACpB,WAAAC;AAAA,EACA,OA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AM;AAAA,EAACC,EAAU;AAAA,EAAV;AAAA,IACC,wBAAqB;AAAA,IACrB,WAAWC,EAAG,uCAAuC,0BAA0BhB,CAAS;AAAA,IACvF,GAAGQ;AAAA,IAEH,UAAAF;AAAA,EAAA;AAAA;AAKP4C,EAAW,cAAc;AClBlB,MAAMnD,IAIT,OAAO,OAAOoD,GAAM;AAAA,EACtB,OAAOlC;AAAA,EACP,OAAO4B;AAAA,EACP,OAAOK;AACT,CAAC;AAEDnD,EAAM,cAAc;AACpBkB,EAAW,cAAc;AACzB4B,EAAW,cAAc;AACzBK,EAAW,cAAc;"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends\n Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx(\n 'gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]',\n className\n )}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\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 <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\nexport type MeterValueProps = Omit<\n ComponentProps<typeof BaseMeter.Value>,\n 'render' | 'children'\n> & {\n children?: ((formattedValue: string, value: number) => ReactNode) | null | undefined\n}\n\nexport const MeterValue = ({ className, children, ...others }: MeterValueProps) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"mappings":";;;;;;AAaA,IAAa,IAAe,EAAwC,KAAK,EAE5D,IAAY,UAEZ,UAAiB;CAC5B,IAAM,IAAU,EAAW,EAAa;AAExC,KAAI,CAAC,EACH,OAAU,MAAM,gDAAgD;AAGlE,QAAO;GCFI,KAAS,EACpB,cACA,UACA,SAAM,KACN,SAAM,GACN,WAAQ,WACR,YAAS,WACT,aACA,QACA,GAAG,QACgC;CACnC,IAAM,CAAC,GAAS,KAAc,GAAkB,EAE1C,IAAe,SACZ;EACL,OAAO,KAAS;EAChB;EACA;EACA;EACA;EACA,WAAW;EACZ,GACA;EAAC;EAAK;EAAK;EAAO;EAAQ;EAAO;EAAW,CAAC;AAEhD,QACE,kBAAC,EAAa,UAAd;EAAuB,OAAO;YAC5B,kBAAC,EAAU,MAAX;GACE,wBAAqB;GAChB;GACL,WAAW,EACT,kFACA,EACD;GACM;GACF;GACA;GACL,mBAAiB;GACjB,GAAI;GAEH;GACc,CAAA;EACK,CAAA;;AAI5B,EAAM,cAAc;;;AC3Dp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A;GACD,CACF;AAID,SAFA,EAAS,QAAQ,EAAQ,QAEZ;AACX,KAAS,YAAY;;IAEtB;EAAC;EAAY;EAAW;EAAW,CAAC,EAEhC,EAAgB;;;;AChEzB,IAAa,KAAc,EAAE,cAAW,GAAG,QAA8B;CACvE,IAAM,EAAE,UAAO,QAAK,QAAK,WAAQ,aAAU,GAAU,EAC/C,KAAe,IAAQ,MAAQ,IAAM,KAAQ,KAC7C,IAAW,EAAuB,KAAK,EACvC,CAAC,GAAa,KAAkB,EAAS,GAAM;AAOrD,QAJA,EAAyB,SAAgB;AACvC,IAAe,GAAK;GACpB,EAGA,kBAAC,EAAU,OAAX;EACE,KAAK;EACL,wBAAqB;EACrB,WAAW,EAAG,GAAkB,EAAE,EAAE,cAAc,MAAU,WAAW,EAAE,EAAU;EACnF,GAAI;YAEJ,kBAAC,EAAU,WAAX;GACE,wBAAqB;GACrB,WAAW,EAAqB;IAAE;IAAQ;IAAO,CAAC;GAClD,OAAO,EACL,OAAO,IAAc,GAAG,EAAW,KAAK,MACzC;GACD,CAAA;EACc,CAAA;;AAItB,EAAW,cAAc;;;AC5BzB,IAAa,KAAc,EAAE,cAAW,aAAU,GAAG,QAEjD,kBAAC,EAAU,OAAX;CACE,wBAAqB;CACrB,WAAW,EAAG,uCAAuC,0BAA0B,EAAU;CACzF,GAAI;CAEH;CACe,CAAA;AAItB,EAAW,cAAc;;;AClBzB,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,OAAO;CACP,OAAO;CACP,OAAO;CACR,CAAC;AAEF,EAAM,cAAc,SACpB,EAAW,cAAc,eACzB,EAAW,cAAc,eACzB,EAAW,cAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),C=require("@zag-js/pagination"),u=require("@zag-js/react"),h=require("react"),A=require("class-variance-authority"),D=require("@spark-ui/icons/ArrowDoubleLeft"),x=require("../Icon-C-cNTnzd.js"),P=require("../IconButton-BR1bJSQA.js"),I=require("../Button-FZceRWG2.js"),M=require("@spark-ui/icons/ArrowDoubleRight"),R=require("@spark-ui/icons/ArrowVerticalRight"),O=require("@spark-ui/icons/ArrowVerticalLeft");function F(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return i.default=e,Object.freeze(i)}const v=F(C);function E(e,i,n){const r=(n-1)/2;let a=Math.max(0,i-r),s=Math.min(e.length,i+r+1);return s-a<n&&(a=Math.max(0,Math.min(a,e.length-n)),s=Math.min(e.length,a+n)),e.slice(a,s)}const L=h.createContext(null),V=({children:e,count:i,visiblePageItems:n=7,pageSize:r,page:a,onPageChange:s,noEllipsis:l,type:c="link"})=>{const g=l?1/0:Math.max(0,Math.floor((n-5)/2)),d=h.useId(),p=u.useMachine(v.machine,{id:d,count:i,siblingCount:g,pageSize:r,page:a,onPageChange:s,type:c}),o=v.connect(p,u.normalizeProps),B=l?E(o.pages,o.page-1,n):o.pages;return t.jsx(L.Provider,{value:{type:c,pagination:{...o,pages:B,getFirstPageTriggerProps:()=>({...o.getPrevTriggerProps(),id:`${o.getRootProps().id}:first`,"data-part":"first-page-trigger",onClick:o.goToFirstPage}),getLastPageTriggerProps:()=>({...o.getNextTriggerProps(),id:`${o.getRootProps().id}:last`,"data-part":"last-page-trigger",onClick:o.goToLastPage})}},children:e})},m=()=>{const e=h.useContext(L);if(!e)throw Error("usePagination must be used within a Pagination provider");return e},q=({children:e,visiblePageItems:i=5,type:n="link",noEllipsis:r=!1,className:a,...s})=>t.jsx(V,{visiblePageItems:i,noEllipsis:r,type:n,...s,children:t.jsx(z,{className:a,children:e})}),z=({children:e,className:i})=>{const{pagination:n}=m(),r=n.getRootProps();return t.jsx("nav",{"data-spark-component":"pagination",...r,className:i,children:t.jsx("ul",{className:"gap-md flex flex-wrap",children:e})})};q.displayName="Pagination";const j=({children:e,index:i,className:n,ref:r,...a})=>{const{pagination:s}=m(),l=s.getEllipsisProps({index:i}),c={className:A.cx("flex size-sz-44 items-center justify-center",n),...a},g=u.mergeProps(l,c);return t.jsx("li",{children:t.jsx("span",{"data-spark-component":"pagination-ellipsis",ref:r,...g,children:e||"…"})})};j.displayName="Pagination.Ellipsis";const b=({children:e,className:i,href:n,ref:r,...a})=>{const{pagination:s,type:l}=m(),c=s.getFirstPageTriggerProps(),g=l==="link"&&c["data-disabled"]==="",d={"data-spark-component":"pagination-first-page-trigger",intent:"support",design:"contrast",...a,className:i,...g&&{disabled:!0,role:"link","aria-disabled":!0}},p=u.mergeProps(c,d),o=e||t.jsx(x.Icon,{children:t.jsx(D.ArrowDoubleLeft,{})});return t.jsx("li",{children:n?t.jsx(P.IconButton,{ref:r,...p,asChild:!0,children:t.jsx("a",{href:g?void 0:n,children:o})}):t.jsx(P.IconButton,{ref:r,...p,children:o})})};b.displayName="Pagination.FirstPageTrigger";function y({children:e,value:i,className:n,href:r,ref:a,...s}){const{pagination:l}=m(),c=l.getItemProps({type:"page",value:i}),g={"data-spark-component":"pagination-item",intent:"support",design:c["aria-current"]==="page"?"filled":"contrast",className:n,...s},d=u.mergeProps(c,g);return t.jsx("li",{children:r?t.jsx(I.Button,{ref:a,...d,asChild:!0,children:t.jsx("a",{href:r,children:e||i})}):t.jsx(I.Button,{ref:a,...d,children:e||i})})}y.displayName="Pagination.Item";const k=({children:e,className:i,href:n,ref:r,...a})=>{const{pagination:s,type:l}=m(),c=s.getLastPageTriggerProps(),g=l==="link"&&c["data-disabled"]==="",d={"data-spark-component":"pagination-last-page-trigger",intent:"support",design:"contrast",...a,className:i,...g&&{disabled:!0,role:"link","aria-disabled":!0}},p=u.mergeProps(c,d),o=e||t.jsx(x.Icon,{children:t.jsx(M.ArrowDoubleRight,{})});return t.jsx("li",{children:n?t.jsx(P.IconButton,{ref:r,...p,asChild:!0,children:t.jsx("a",{href:g?void 0:n,children:o})}):t.jsx(P.IconButton,{ref:r,...p,children:o})})};k.displayName="Pagination.LastPageTrigger";const N=({children:e,className:i,href:n,ref:r,...a})=>{const{pagination:s,type:l}=m(),c=s.getNextTriggerProps(),g=l==="link"&&c["data-disabled"]==="",d={"data-spark-component":"pagination-next-trigger",intent:"support",design:"contrast",...a,className:i,...g&&{disabled:!0,role:"link","aria-disabled":!0}},p=u.mergeProps(c,d),o=e||t.jsx(x.Icon,{children:t.jsx(R.ArrowVerticalRight,{})});return t.jsx("li",{children:n?t.jsx(P.IconButton,{ref:r,...p,asChild:!0,children:t.jsx("a",{href:g?void 0:n,children:o})}):t.jsx(P.IconButton,{ref:r,...p,children:o})})};N.displayName="Pagination.NextTrigger";const T=({children:e})=>{const{pagination:i}=m();return e(i)};T.displayName="Pagination.Pages";const f=({children:e,className:i,href:n,ref:r,...a})=>{const{pagination:s,type:l}=m(),c=s.getPrevTriggerProps(),g=l==="link"&&c["data-disabled"]==="",d={"data-spark-component":"pagination-prev-trigger",intent:"support",design:"contrast",...a,className:i,...g&&{disabled:!0,role:"link","aria-disabled":!0}},p=u.mergeProps(c,d),o=e||t.jsx(x.Icon,{children:t.jsx(O.ArrowVerticalLeft,{})});return t.jsx("li",{children:n?t.jsx(P.IconButton,{ref:r,...p,asChild:!0,children:t.jsx("a",{href:g?void 0:n,children:o})}):t.jsx(P.IconButton,{ref:r,...p,children:o})})};f.displayName="Pagination.PrevTrigger";const w=Object.assign(q,{PrevTrigger:f,NextTrigger:N,Pages:T,Item:y,Ellipsis:j,FirstPageTrigger:b,LastPageTrigger:k});w.displayName="Pagination";f.displayName="Pagination.PrevTrigger";N.displayName="Pagination.NextTrigger";T.displayName="Pagination.Pages";y.displayName="Pagination.Item";j.displayName="Pagination.Ellipsis";b.displayName="Pagination.FirstPageTrigger";k.displayName="Pagination.LastPageTrigger";exports.Pagination=w;
2
- //# sourceMappingURL=index.js.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`../icon-CRPcdgYp.js`),n=require(`../button-BTDRzvpB.js`),r=require(`../icon-button-CykysbgJ.js`);let i=require(`class-variance-authority`),a=require(`react`),o=require(`react/jsx-runtime`),s=require(`@spark-ui/icons/ArrowVerticalRight`),c=require(`@spark-ui/icons/ArrowVerticalLeft`),l=require(`@zag-js/pagination`);l=e.t(l);let u=require(`@zag-js/react`),d=require(`@spark-ui/icons/ArrowDoubleLeft`),f=require(`@spark-ui/icons/ArrowDoubleRight`);function p(e,t,n){let r=(n-1)/2,i=Math.max(0,t-r),a=Math.min(e.length,t+r+1);return a-i<n&&(i=Math.max(0,Math.min(i,e.length-n)),a=Math.min(e.length,i+n)),e.slice(i,a)}var m=(0,a.createContext)(null),h=({children:e,count:t,visiblePageItems:n=7,pageSize:r,page:i,onPageChange:s,noEllipsis:c,type:d=`link`})=>{let f=c?1/0:Math.max(0,Math.floor((n-5)/2)),h=(0,a.useId)(),g=(0,u.useMachine)(l.machine,{id:h,count:t,siblingCount:f,pageSize:r,page:i,onPageChange:s,type:d}),_=l.connect(g,u.normalizeProps),v=c?p(_.pages,_.page-1,n):_.pages;return(0,o.jsx)(m.Provider,{value:{type:d,pagination:{..._,pages:v,getFirstPageTriggerProps:()=>({..._.getPrevTriggerProps(),id:`${_.getRootProps().id}:first`,"data-part":`first-page-trigger`,onClick:_.goToFirstPage}),getLastPageTriggerProps:()=>({..._.getNextTriggerProps(),id:`${_.getRootProps().id}:last`,"data-part":`last-page-trigger`,onClick:_.goToLastPage})}},children:e})},g=()=>{let e=(0,a.useContext)(m);if(!e)throw Error(`usePagination must be used within a Pagination provider`);return e},_=({children:e,visiblePageItems:t=5,type:n=`link`,noEllipsis:r=!1,className:i,...a})=>(0,o.jsx)(h,{visiblePageItems:t,noEllipsis:r,type:n,...a,children:(0,o.jsx)(v,{className:i,children:e})}),v=({children:e,className:t})=>{let{pagination:n}=g(),r=n.getRootProps();return(0,o.jsx)(`nav`,{"data-spark-component":`pagination`,...r,className:t,children:(0,o.jsx)(`ul`,{className:`gap-md flex flex-wrap`,children:e})})};_.displayName=`Pagination`;var y=({children:e,index:t,className:n,ref:r,...a})=>{let{pagination:s}=g(),c=(0,u.mergeProps)(s.getEllipsisProps({index:t}),{className:(0,i.cx)(`flex size-sz-44 items-center justify-center`,n),...a});return(0,o.jsx)(`li`,{children:(0,o.jsx)(`span`,{"data-spark-component":`pagination-ellipsis`,ref:r,...c,children:e||`…`})})};y.displayName=`Pagination.Ellipsis`;var b=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:c,type:l}=g(),f=c.getFirstPageTriggerProps(),p=l===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-first-page-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(d.ArrowDoubleLeft,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};b.displayName=`Pagination.FirstPageTrigger`;function x({children:e,value:t,className:r,href:i,ref:a,...s}){let{pagination:c}=g(),l=c.getItemProps({type:`page`,value:t}),d=(0,u.mergeProps)(l,{"data-spark-component":`pagination-item`,intent:`support`,design:l[`aria-current`]===`page`?`filled`:`contrast`,className:r,...s});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(n.t,{ref:a,...d,asChild:!0,children:(0,o.jsx)(`a`,{href:i,children:e||t})}):(0,o.jsx)(n.t,{ref:a,...d,children:e||t})})}x.displayName=`Pagination.Item`;var S=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:c,type:l}=g(),d=c.getLastPageTriggerProps(),p=l===`link`&&d[`data-disabled`]===``,m=(0,u.mergeProps)(d,{"data-spark-component":`pagination-last-page-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(f.ArrowDoubleRight,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};S.displayName=`Pagination.LastPageTrigger`;var C=({children:e,className:n,href:i,ref:a,...c})=>{let{pagination:l,type:d}=g(),f=l.getNextTriggerProps(),p=d===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-next-trigger`,intent:`support`,design:`contrast`,...c,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(s.ArrowVerticalRight,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};C.displayName=`Pagination.NextTrigger`;var w=({children:e})=>{let{pagination:t}=g();return e(t)};w.displayName=`Pagination.Pages`;var T=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:l,type:d}=g(),f=l.getPrevTriggerProps(),p=d===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-prev-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(c.ArrowVerticalLeft,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};T.displayName=`Pagination.PrevTrigger`;var E=Object.assign(_,{PrevTrigger:T,NextTrigger:C,Pages:w,Item:x,Ellipsis:y,FirstPageTrigger:b,LastPageTrigger:S});E.displayName=`Pagination`,T.displayName=`Pagination.PrevTrigger`,C.displayName=`Pagination.NextTrigger`,w.displayName=`Pagination.Pages`,x.displayName=`Pagination.Item`,y.displayName=`Pagination.Ellipsis`,b.displayName=`Pagination.FirstPageTrigger`,S.displayName=`Pagination.LastPageTrigger`,exports.Pagination=E;
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/pagination/utils.ts","../../src/pagination/PaginationContext.tsx","../../src/pagination/Pagination.tsx","../../src/pagination/PaginationEllipsis.tsx","../../src/pagination/PaginationFirstPageTrigger.tsx","../../src/pagination/PaginationItem.tsx","../../src/pagination/PaginationLastPageTrigger.tsx","../../src/pagination/PaginationNextTrigger.tsx","../../src/pagination/PaginationPages.tsx","../../src/pagination/PaginationPrevTrigger.tsx","../../src/pagination/index.ts"],"sourcesContent":["export function sliceArrayWithIndex(arr: any[], index: number, length: number) {\n const relativeElements = (length - 1) / 2\n\n let start = Math.max(0, index - relativeElements)\n let end = Math.min(arr.length, index + relativeElements + 1)\n\n if (end - start < length) {\n start = Math.max(0, Math.min(start, arr.length - length))\n end = Math.min(arr.length, start + length)\n }\n\n return arr.slice(start, end)\n}\n","import * as pagination from '@zag-js/pagination'\nimport { normalizeProps, type PropTypes, useMachine } from '@zag-js/react'\nimport { createContext, type ReactNode, useContext, useId } from 'react'\n\nimport { sliceArrayWithIndex } from './utils'\n\nexport interface PaginationContextState<T extends PropTypes = PropTypes> {\n type: pagination.Props['type']\n pagination: pagination.Api<T> & {\n getFirstPageTriggerProps: () => ReturnType<pagination.Api<T>['getPrevTriggerProps']> & {\n 'data-part': string\n onClick: () => void\n }\n getLastPageTriggerProps: () => ReturnType<pagination.Api<T>['getNextTriggerProps']> & {\n 'data-part': string\n onClick: () => void\n }\n }\n}\n\nconst PaginationContext = createContext<PaginationContextState | null>(null)\n\nexport interface PaginationProviderProps {\n children: ReactNode\n /**\n * Total number of data items available across all pages.\n */\n count: number\n /**\n * Maximum amount of items displayed on a single page.\n */\n pageSize: number\n /**\n * Number of visible pages (or ellipsis) between previous and next page triggers.\n */\n visiblePageItems?: number\n /**\n * The current page (active page)\n */\n page?: pagination.Props['page']\n /**\n * If your pagination contains buttons instead of links, set `type` to `button`, extra attributes will be applied on page items for a11y.\n */\n type?: pagination.Props['type']\n onPageChange?: pagination.Props['onPageChange']\n noEllipsis?: boolean\n}\n\nexport const PaginationProvider = ({\n children,\n count,\n visiblePageItems = 7,\n pageSize,\n page,\n onPageChange,\n noEllipsis,\n type = 'link',\n}: PaginationProviderProps) => {\n /**\n * Here `Infinity` is used because we apply a custom slice ourselves to manage the \"no ellipsis\" version.\n * It means Zag won't filter out any page item, allowing us to apply our own slicing logic.\n */\n const siblingCount = noEllipsis ? Infinity : Math.max(0, Math.floor((visiblePageItems - 5) / 2))\n\n const id = useId()\n\n const service = useMachine(pagination.machine, {\n id,\n count,\n siblingCount,\n pageSize,\n page,\n onPageChange,\n type,\n })\n\n const api = pagination.connect(service, normalizeProps)\n const pages = noEllipsis\n ? sliceArrayWithIndex(api.pages, api.page - 1, visiblePageItems)\n : api.pages\n\n return (\n <PaginationContext.Provider\n value={{\n type,\n pagination: {\n ...api,\n pages,\n // Extending ZagJS anatomy\n getFirstPageTriggerProps: () => {\n return {\n ...api.getPrevTriggerProps(),\n id: `${api.getRootProps().id}:first`,\n 'data-part': 'first-page-trigger',\n onClick: api.goToFirstPage,\n }\n },\n getLastPageTriggerProps: () => {\n return {\n ...api.getNextTriggerProps(),\n id: `${api.getRootProps().id}:last`,\n 'data-part': 'last-page-trigger',\n onClick: api.goToLastPage,\n }\n },\n },\n }}\n >\n {children}\n </PaginationContext.Provider>\n )\n}\n\nexport const usePagination = () => {\n const context = useContext(PaginationContext)\n\n if (!context) {\n throw Error('usePagination must be used within a Pagination provider')\n }\n\n return context\n}\n","import { ReactNode } from 'react'\n\nimport {\n PaginationProvider,\n type PaginationProviderProps,\n usePagination,\n} from './PaginationContext'\n\nexport type PaginationProps = PaginationProviderProps & { className?: string }\n\nexport const Pagination = ({\n children,\n visiblePageItems = 5,\n type = 'link',\n noEllipsis = false,\n className,\n ...rest\n}: PaginationProps) => {\n return (\n <PaginationProvider\n visiblePageItems={visiblePageItems}\n noEllipsis={noEllipsis}\n type={type}\n {...rest}\n >\n <PaginationWrapper className={className}>{children}</PaginationWrapper>\n </PaginationProvider>\n )\n}\n\nconst PaginationWrapper = ({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) => {\n const { pagination } = usePagination()\n\n const props = pagination.getRootProps()\n\n return (\n <nav data-spark-component=\"pagination\" {...props} className={className}>\n <ul className=\"gap-md flex flex-wrap\">{children}</ul>\n </nav>\n )\n}\n\nPagination.displayName = 'Pagination'\n","import { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { usePagination } from './PaginationContext'\n\ninterface EllipsisProps extends ComponentPropsWithRef<'span'> {\n index: number\n}\n\nexport const Ellipsis = ({ children, index, className, ref, ...rest }: EllipsisProps) => {\n const { pagination } = usePagination()\n const apiProps = pagination.getEllipsisProps({ index })\n const localProps = {\n className: cx('flex size-sz-44 items-center justify-center', className),\n ...rest,\n }\n\n const mergedProps = mergeProps(apiProps, localProps)\n\n return (\n <li>\n <span data-spark-component=\"pagination-ellipsis\" ref={ref} {...mergedProps}>\n {children || '\\u2026'}\n </span>\n </li>\n )\n}\n\nEllipsis.displayName = 'Pagination.Ellipsis'\n","import { ArrowDoubleLeft } from '@spark-ui/icons/ArrowDoubleLeft'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type FirstPageTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const FirstPageTrigger = ({\n children,\n className,\n href,\n ref,\n ...props\n}: FirstPageTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getFirstPageTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-first-page-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowDoubleLeft />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nFirstPageTrigger.displayName = 'Pagination.FirstPageTrigger'\n","import { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, ReactElement, Ref } from 'react'\n\nimport { Button } from '../button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type ItemProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n value: number\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A numbered page item.\n * Should be used within `Pagination.Pages` to ensure proper functionality and accessibility.\n *\n * Can be rendered as an anchor or a button :\n * - Set a `href` prop to render the item as an anchor element.\n * - When using `href`, the `asChild` prop isn’t available since the component will already be rendered as an anchor element.\n */\nexport function Item({ children, value, className, href, ref, ...props }: ItemProps): ReactElement {\n const { pagination } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getItemProps({ type: 'page', value })\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-item',\n intent: 'support',\n design: apiProps['aria-current'] === 'page' ? 'filled' : 'contrast',\n className,\n ...props,\n }\n\n const mergedProps = mergeProps(apiProps, localProps)\n\n return (\n <li>\n {href ? (\n <Button ref={ref} {...mergedProps} asChild>\n <a href={href}>{children || value}</a>\n </Button>\n ) : (\n <Button ref={ref} {...mergedProps}>\n {children || value}\n </Button>\n )}\n </li>\n )\n}\n\nItem.displayName = 'Pagination.Item'\n","import { ArrowDoubleRight } from '@spark-ui/icons/ArrowDoubleRight'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type LastPageTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const LastPageTrigger = ({\n children,\n className,\n href,\n ref,\n ...props\n}: LastPageTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getLastPageTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-last-page-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowDoubleRight />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nLastPageTrigger.displayName = 'Pagination.LastPageTrigger'\n","import { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type NextTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const NextTrigger = ({ children, className, href, ref, ...props }: NextTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getNextTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-next-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowVerticalRight />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nNextTrigger.displayName = 'Pagination.NextTrigger'\n","import * as pagination from '@zag-js/pagination'\nimport { ReactNode } from 'react'\n\nimport { usePagination } from './PaginationContext'\n\n// Extract the 'page' type element from the pagination API's 'pages' array.\ntype PageItem = Extract<pagination.Api['pages'][number], { type: 'page' }>\n\n// Define a type that conditionally tweaks the pagination API\n// based on the generic T parameter.\ntype TweakedPaginationApi<T extends 'noEllipsis' | ''> = Omit<pagination.Api, 'pages'> & {\n pages: T extends 'noEllipsis' ? PageItem[] : pagination.Api['pages']\n}\n\ninterface PagesProps<T extends 'noEllipsis' | ''> {\n children: (pagination: TweakedPaginationApi<T>) => ReactNode\n}\n\nexport const Pages = <T extends 'noEllipsis' | '' = ''>({ children }: PagesProps<T>) => {\n const { pagination } = usePagination()\n\n return children(pagination as TweakedPaginationApi<T>)\n}\n\nPages.displayName = 'Pagination.Pages'\n","import { ArrowVerticalLeft } from '@spark-ui/icons/ArrowVerticalLeft'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type PrevTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const PrevTrigger = ({ children, className, href, ref, ...props }: PrevTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getPrevTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-prev-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowVerticalLeft />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nPrevTrigger.displayName = 'Pagination.PrevTrigger'\n","import type { FC } from 'react'\n\nimport { Pagination as Root, type PaginationProps } from './Pagination'\nimport { Ellipsis } from './PaginationEllipsis'\nimport { FirstPageTrigger } from './PaginationFirstPageTrigger'\nimport { Item } from './PaginationItem'\nimport { LastPageTrigger } from './PaginationLastPageTrigger'\nimport { NextTrigger } from './PaginationNextTrigger'\nimport { Pages } from './PaginationPages'\nimport { PrevTrigger } from './PaginationPrevTrigger'\n\nexport const Pagination: FC<PaginationProps> & {\n PrevTrigger: typeof PrevTrigger\n NextTrigger: typeof NextTrigger\n Pages: typeof Pages\n Item: typeof Item\n Ellipsis: typeof Ellipsis\n FirstPageTrigger: typeof FirstPageTrigger\n LastPageTrigger: typeof LastPageTrigger\n} = Object.assign(Root, {\n PrevTrigger,\n NextTrigger,\n Pages,\n Item,\n Ellipsis,\n FirstPageTrigger,\n LastPageTrigger,\n})\n\nPagination.displayName = 'Pagination'\n\nPrevTrigger.displayName = 'Pagination.PrevTrigger'\nNextTrigger.displayName = 'Pagination.NextTrigger'\nPages.displayName = 'Pagination.Pages'\nItem.displayName = 'Pagination.Item'\nEllipsis.displayName = 'Pagination.Ellipsis'\nFirstPageTrigger.displayName = 'Pagination.FirstPageTrigger'\nLastPageTrigger.displayName = 'Pagination.LastPageTrigger'\n"],"names":["sliceArrayWithIndex","arr","index","length","relativeElements","start","end","PaginationContext","createContext","PaginationProvider","children","count","visiblePageItems","pageSize","page","onPageChange","noEllipsis","type","siblingCount","id","useId","service","useMachine","pagination","api","normalizeProps","pages","jsx","usePagination","context","useContext","Pagination","className","rest","PaginationWrapper","props","Ellipsis","ref","apiProps","localProps","cx","mergedProps","mergeProps","FirstPageTrigger","href","shouldDisableLink","content","Icon","ArrowDoubleLeft","IconButton","Item","value","Button","LastPageTrigger","ArrowDoubleRight","NextTrigger","ArrowVerticalRight","Pages","PrevTrigger","ArrowVerticalLeft","Root"],"mappings":"wyBAAO,SAASA,EAAoBC,EAAYC,EAAeC,EAAgB,CAC7E,MAAMC,GAAoBD,EAAS,GAAK,EAExC,IAAIE,EAAQ,KAAK,IAAI,EAAGH,EAAQE,CAAgB,EAC5CE,EAAM,KAAK,IAAIL,EAAI,OAAQC,EAAQE,EAAmB,CAAC,EAE3D,OAAIE,EAAMD,EAAQF,IAChBE,EAAQ,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAOJ,EAAI,OAASE,CAAM,CAAC,EACxDG,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CACnB,EAMIJ,EAAcC,EAAAA,WAClBJ,EACAC,CAAA,EAGIO,EAAUpC,GACdiB,EAAAA,IAACoB,EAAAA,KAAA,CACC,SAAApB,MAACgC,EAAAA,oBAAkB,EACrB,EAGF,OACEhC,EAAAA,IAAC,KAAA,CACE,SAAAiB,EACCjB,EAAAA,IAACsB,EAAAA,WAAA,CAAW,IAAAZ,EAAW,GAAGI,EAAa,QAAO,GAC5C,SAAAd,EAAAA,IAAC,IAAA,CAAE,KAAMkB,EAAoB,OAAYD,EAAO,SAAAE,CAAA,CAAQ,CAAA,CAC1D,EAEAnB,EAAAA,IAACsB,EAAAA,WAAA,CAAW,IAAAZ,EAAW,GAAGI,EACvB,SAAAK,CAAA,CACH,EAEJ,CAEJ,EAEAY,EAAY,YAAc,yBCrEnB,MAAM3B,EAQT,OAAO,OAAO6B,EAAM,CACtB,YAAAF,EACA,YAAAH,EACA,MAAAE,EACA,KAAAP,EACA,SAAAd,EACA,iBAAAO,EACA,gBAAAU,CACF,CAAC,EAEDtB,EAAW,YAAc,aAEzB2B,EAAY,YAAc,yBAC1BH,EAAY,YAAc,yBAC1BE,EAAM,YAAc,mBACpBP,EAAK,YAAc,kBACnBd,EAAS,YAAc,sBACvBO,EAAiB,YAAc,8BAC/BU,EAAgB,YAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/pagination/utils.ts","../../src/pagination/PaginationContext.tsx","../../src/pagination/Pagination.tsx","../../src/pagination/PaginationEllipsis.tsx","../../src/pagination/PaginationFirstPageTrigger.tsx","../../src/pagination/PaginationItem.tsx","../../src/pagination/PaginationLastPageTrigger.tsx","../../src/pagination/PaginationNextTrigger.tsx","../../src/pagination/PaginationPages.tsx","../../src/pagination/PaginationPrevTrigger.tsx","../../src/pagination/index.ts"],"sourcesContent":["export function sliceArrayWithIndex(arr: any[], index: number, length: number) {\n const relativeElements = (length - 1) / 2\n\n let start = Math.max(0, index - relativeElements)\n let end = Math.min(arr.length, index + relativeElements + 1)\n\n if (end - start < length) {\n start = Math.max(0, Math.min(start, arr.length - length))\n end = Math.min(arr.length, start + length)\n }\n\n return arr.slice(start, end)\n}\n","import * as pagination from '@zag-js/pagination'\nimport { normalizeProps, type PropTypes, useMachine } from '@zag-js/react'\nimport { createContext, type ReactNode, useContext, useId } from 'react'\n\nimport { sliceArrayWithIndex } from './utils'\n\nexport interface PaginationContextState<T extends PropTypes = PropTypes> {\n type: pagination.Props['type']\n pagination: pagination.Api<T> & {\n getFirstPageTriggerProps: () => ReturnType<pagination.Api<T>['getPrevTriggerProps']> & {\n 'data-part': string\n onClick: () => void\n }\n getLastPageTriggerProps: () => ReturnType<pagination.Api<T>['getNextTriggerProps']> & {\n 'data-part': string\n onClick: () => void\n }\n }\n}\n\nconst PaginationContext = createContext<PaginationContextState | null>(null)\n\nexport interface PaginationProviderProps {\n children: ReactNode\n /**\n * Total number of data items available across all pages.\n */\n count: number\n /**\n * Maximum amount of items displayed on a single page.\n */\n pageSize: number\n /**\n * Number of visible pages (or ellipsis) between previous and next page triggers.\n */\n visiblePageItems?: number\n /**\n * The current page (active page)\n */\n page?: pagination.Props['page']\n /**\n * If your pagination contains buttons instead of links, set `type` to `button`, extra attributes will be applied on page items for a11y.\n */\n type?: pagination.Props['type']\n onPageChange?: pagination.Props['onPageChange']\n noEllipsis?: boolean\n}\n\nexport const PaginationProvider = ({\n children,\n count,\n visiblePageItems = 7,\n pageSize,\n page,\n onPageChange,\n noEllipsis,\n type = 'link',\n}: PaginationProviderProps) => {\n /**\n * Here `Infinity` is used because we apply a custom slice ourselves to manage the \"no ellipsis\" version.\n * It means Zag won't filter out any page item, allowing us to apply our own slicing logic.\n */\n const siblingCount = noEllipsis ? Infinity : Math.max(0, Math.floor((visiblePageItems - 5) / 2))\n\n const id = useId()\n\n const service = useMachine(pagination.machine, {\n id,\n count,\n siblingCount,\n pageSize,\n page,\n onPageChange,\n type,\n })\n\n const api = pagination.connect(service, normalizeProps)\n const pages = noEllipsis\n ? sliceArrayWithIndex(api.pages, api.page - 1, visiblePageItems)\n : api.pages\n\n return (\n <PaginationContext.Provider\n value={{\n type,\n pagination: {\n ...api,\n pages,\n // Extending ZagJS anatomy\n getFirstPageTriggerProps: () => {\n return {\n ...api.getPrevTriggerProps(),\n id: `${api.getRootProps().id}:first`,\n 'data-part': 'first-page-trigger',\n onClick: api.goToFirstPage,\n }\n },\n getLastPageTriggerProps: () => {\n return {\n ...api.getNextTriggerProps(),\n id: `${api.getRootProps().id}:last`,\n 'data-part': 'last-page-trigger',\n onClick: api.goToLastPage,\n }\n },\n },\n }}\n >\n {children}\n </PaginationContext.Provider>\n )\n}\n\nexport const usePagination = () => {\n const context = useContext(PaginationContext)\n\n if (!context) {\n throw Error('usePagination must be used within a Pagination provider')\n }\n\n return context\n}\n","import { ReactNode } from 'react'\n\nimport {\n PaginationProvider,\n type PaginationProviderProps,\n usePagination,\n} from './PaginationContext'\n\nexport type PaginationProps = PaginationProviderProps & { className?: string }\n\nexport const Pagination = ({\n children,\n visiblePageItems = 5,\n type = 'link',\n noEllipsis = false,\n className,\n ...rest\n}: PaginationProps) => {\n return (\n <PaginationProvider\n visiblePageItems={visiblePageItems}\n noEllipsis={noEllipsis}\n type={type}\n {...rest}\n >\n <PaginationWrapper className={className}>{children}</PaginationWrapper>\n </PaginationProvider>\n )\n}\n\nconst PaginationWrapper = ({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) => {\n const { pagination } = usePagination()\n\n const props = pagination.getRootProps()\n\n return (\n <nav data-spark-component=\"pagination\" {...props} className={className}>\n <ul className=\"gap-md flex flex-wrap\">{children}</ul>\n </nav>\n )\n}\n\nPagination.displayName = 'Pagination'\n","import { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { usePagination } from './PaginationContext'\n\ninterface EllipsisProps extends ComponentPropsWithRef<'span'> {\n index: number\n}\n\nexport const Ellipsis = ({ children, index, className, ref, ...rest }: EllipsisProps) => {\n const { pagination } = usePagination()\n const apiProps = pagination.getEllipsisProps({ index })\n const localProps = {\n className: cx('flex size-sz-44 items-center justify-center', className),\n ...rest,\n }\n\n const mergedProps = mergeProps(apiProps, localProps)\n\n return (\n <li>\n <span data-spark-component=\"pagination-ellipsis\" ref={ref} {...mergedProps}>\n {children || '\\u2026'}\n </span>\n </li>\n )\n}\n\nEllipsis.displayName = 'Pagination.Ellipsis'\n","import { ArrowDoubleLeft } from '@spark-ui/icons/ArrowDoubleLeft'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type FirstPageTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const FirstPageTrigger = ({\n children,\n className,\n href,\n ref,\n ...props\n}: FirstPageTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getFirstPageTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-first-page-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowDoubleLeft />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nFirstPageTrigger.displayName = 'Pagination.FirstPageTrigger'\n","import { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, ReactElement, Ref } from 'react'\n\nimport { Button } from '../button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type ItemProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n value: number\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A numbered page item.\n * Should be used within `Pagination.Pages` to ensure proper functionality and accessibility.\n *\n * Can be rendered as an anchor or a button :\n * - Set a `href` prop to render the item as an anchor element.\n * - When using `href`, the `asChild` prop isn’t available since the component will already be rendered as an anchor element.\n */\nexport function Item({ children, value, className, href, ref, ...props }: ItemProps): ReactElement {\n const { pagination } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getItemProps({ type: 'page', value })\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-item',\n intent: 'support',\n design: apiProps['aria-current'] === 'page' ? 'filled' : 'contrast',\n className,\n ...props,\n }\n\n const mergedProps = mergeProps(apiProps, localProps)\n\n return (\n <li>\n {href ? (\n <Button ref={ref} {...mergedProps} asChild>\n <a href={href}>{children || value}</a>\n </Button>\n ) : (\n <Button ref={ref} {...mergedProps}>\n {children || value}\n </Button>\n )}\n </li>\n )\n}\n\nItem.displayName = 'Pagination.Item'\n","import { ArrowDoubleRight } from '@spark-ui/icons/ArrowDoubleRight'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type LastPageTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const LastPageTrigger = ({\n children,\n className,\n href,\n ref,\n ...props\n}: LastPageTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getLastPageTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-last-page-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowDoubleRight />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nLastPageTrigger.displayName = 'Pagination.LastPageTrigger'\n","import { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type NextTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const NextTrigger = ({ children, className, href, ref, ...props }: NextTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getNextTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-next-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowVerticalRight />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nNextTrigger.displayName = 'Pagination.NextTrigger'\n","import * as pagination from '@zag-js/pagination'\nimport { ReactNode } from 'react'\n\nimport { usePagination } from './PaginationContext'\n\n// Extract the 'page' type element from the pagination API's 'pages' array.\ntype PageItem = Extract<pagination.Api['pages'][number], { type: 'page' }>\n\n// Define a type that conditionally tweaks the pagination API\n// based on the generic T parameter.\ntype TweakedPaginationApi<T extends 'noEllipsis' | ''> = Omit<pagination.Api, 'pages'> & {\n pages: T extends 'noEllipsis' ? PageItem[] : pagination.Api['pages']\n}\n\ninterface PagesProps<T extends 'noEllipsis' | ''> {\n children: (pagination: TweakedPaginationApi<T>) => ReactNode\n}\n\nexport const Pages = <T extends 'noEllipsis' | '' = ''>({ children }: PagesProps<T>) => {\n const { pagination } = usePagination()\n\n return children(pagination as TweakedPaginationApi<T>)\n}\n\nPages.displayName = 'Pagination.Pages'\n","import { ArrowVerticalLeft } from '@spark-ui/icons/ArrowVerticalLeft'\nimport { mergeProps } from '@zag-js/react'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { usePagination } from './PaginationContext'\n\ntype AnchorProps = ComponentPropsWithoutRef<'a'> & {\n href: string\n asChild?: never\n}\n\ntype ButtonProps = ComponentPropsWithoutRef<'button'> & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Unavailable for anchor items (with `href` prop) since the component will already be rendered as an anchor element.\n */\n asChild?: boolean\n href?: never\n}\n\nexport type PrevTriggerProps = (AnchorProps | ButtonProps) & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const PrevTrigger = ({ children, className, href, ref, ...props }: PrevTriggerProps) => {\n const { pagination, type } = usePagination()\n\n // ZagJS props\n const apiProps = pagination.getPrevTriggerProps()\n\n const shouldDisableLink =\n type === 'link' &&\n (apiProps as typeof apiProps & { 'data-disabled'?: string })['data-disabled'] === ''\n\n // Locally managed props\n const localProps = {\n 'data-spark-component': 'pagination-prev-trigger',\n intent: 'support',\n design: 'contrast',\n ...props,\n className,\n ...(shouldDisableLink && {\n disabled: true,\n role: 'link',\n 'aria-disabled': true,\n }),\n }\n\n // We know 'aria-label' is included in props\n type WithAriaLabel = Omit<typeof apiProps, 'aria-label'> & { 'aria-label': string }\n\n const mergedProps = mergeProps(\n apiProps,\n localProps as unknown as typeof apiProps\n ) as WithAriaLabel\n\n const content = children || (\n <Icon>\n <ArrowVerticalLeft />\n </Icon>\n )\n\n return (\n <li>\n {href ? (\n <IconButton ref={ref} {...mergedProps} asChild>\n <a href={shouldDisableLink ? undefined : href}>{content}</a>\n </IconButton>\n ) : (\n <IconButton ref={ref} {...mergedProps}>\n {content}\n </IconButton>\n )}\n </li>\n )\n}\n\nPrevTrigger.displayName = 'Pagination.PrevTrigger'\n","import type { FC } from 'react'\n\nimport { Pagination as Root, type PaginationProps } from './Pagination'\nimport { Ellipsis } from './PaginationEllipsis'\nimport { FirstPageTrigger } from './PaginationFirstPageTrigger'\nimport { Item } from './PaginationItem'\nimport { LastPageTrigger } from './PaginationLastPageTrigger'\nimport { NextTrigger } from './PaginationNextTrigger'\nimport { Pages } from './PaginationPages'\nimport { PrevTrigger } from './PaginationPrevTrigger'\n\nexport const Pagination: FC<PaginationProps> & {\n PrevTrigger: typeof PrevTrigger\n NextTrigger: typeof NextTrigger\n Pages: typeof Pages\n Item: typeof Item\n Ellipsis: typeof Ellipsis\n FirstPageTrigger: typeof FirstPageTrigger\n LastPageTrigger: typeof LastPageTrigger\n} = Object.assign(Root, {\n PrevTrigger,\n NextTrigger,\n Pages,\n Item,\n Ellipsis,\n FirstPageTrigger,\n LastPageTrigger,\n})\n\nPagination.displayName = 'Pagination'\n\nPrevTrigger.displayName = 'Pagination.PrevTrigger'\nNextTrigger.displayName = 'Pagination.NextTrigger'\nPages.displayName = 'Pagination.Pages'\nItem.displayName = 'Pagination.Item'\nEllipsis.displayName = 'Pagination.Ellipsis'\nFirstPageTrigger.displayName = 'Pagination.FirstPageTrigger'\nLastPageTrigger.displayName = 'Pagination.LastPageTrigger'\n"],"mappings":"qjBAAA,SAAgB,EAAoB,EAAY,EAAe,EAAgB,CAC7E,IAAM,GAAoB,EAAS,GAAK,EAEpC,EAAQ,KAAK,IAAI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