@epilot/spark-ui 1.0.0-alpha.0 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,107 @@
1
- import { Slot } from '@radix-ui/react-slot';
2
- import { cva } from 'class-variance-authority';
3
- import * as React2 from 'react';
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import * as React4 from 'react';
3
+ import { useMemo, useCallback } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import * as DialogPrimitive from '@radix-ui/react-dialog';
7
+ import { Slot } from '@radix-ui/react-slot';
8
+ import { cva } from 'class-variance-authority';
9
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
10
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
11
+ import { Drawer as Drawer$1 } from 'vaul';
12
+ import { curveLinear, curveStepBefore, curveStepAfter, curveStep, curveMonotoneX } from '@visx/curve';
13
+ import { localPoint } from '@visx/event';
14
+ import { Group } from '@visx/group';
15
+ import { scaleTime, scaleLinear } from '@visx/scale';
16
+ import { LinePath } from '@visx/shape';
17
+ import { useTooltip, Tooltip } from '@visx/tooltip';
18
+ import { bisector, extent } from '@visx/vendor/d3-array';
19
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
20
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
21
+ import * as SelectPrimitive from '@radix-ui/react-select';
22
+ import * as SliderPrimitive from '@radix-ui/react-slider';
23
+ import * as SwitchPrimitives from '@radix-ui/react-switch';
24
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
8
25
 
9
26
  function cn(...inputs) {
10
27
  return twMerge(clsx(inputs));
11
28
  }
29
+ var ChevronDown = (props) => /* @__PURE__ */ jsx(
30
+ "svg",
31
+ {
32
+ fill: "none",
33
+ height: "16",
34
+ viewBox: "0 0 16 16",
35
+ width: "16",
36
+ xmlns: "http://www.w3.org/2000/svg",
37
+ ...props,
38
+ children: /* @__PURE__ */ jsx(
39
+ "path",
40
+ {
41
+ d: "M8 7.19992L4.93333 10.2666L4 9.33325L8 5.33325L12 9.33325L11.0667 10.2666L8 7.19992Z",
42
+ fill: "currentColor",
43
+ fillOpacity: "0.934"
44
+ }
45
+ )
46
+ }
47
+ );
48
+ var Accordion = AccordionPrimitive.Root;
49
+ var AccordionItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
50
+ AccordionPrimitive.Item,
51
+ {
52
+ className: cn("border-b border-gray", className),
53
+ ref,
54
+ ...props
55
+ }
56
+ ));
57
+ AccordionItem.displayName = "AccordionItem";
58
+ var AccordionTrigger = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
59
+ AccordionPrimitive.Trigger,
60
+ {
61
+ className: cn(
62
+ "flex flex-1 items-center justify-between rounded-md py-4 font-medium underline-offset-4 transition-all hover:underline focus-visible:ring [&[data-state=open]>svg]:rotate-180",
63
+ className
64
+ ),
65
+ ref,
66
+ ...props,
67
+ children: [
68
+ children,
69
+ /* @__PURE__ */ jsx(
70
+ ChevronDown,
71
+ {
72
+ className: "h-4 w-4 shrink-0 transition-transform duration-200",
73
+ role: "presentation"
74
+ }
75
+ )
76
+ ]
77
+ }
78
+ ) }));
79
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
80
+ var AccordionContent = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
81
+ AccordionPrimitive.Content,
82
+ {
83
+ className: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
84
+ ref,
85
+ ...props,
86
+ children: /* @__PURE__ */ jsx("div", { className: cn(className), children })
87
+ }
88
+ ));
89
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
90
+ var Badge = React4.forwardRef(
91
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
92
+ "span",
93
+ {
94
+ className: cn(
95
+ "inline-flex h-5 min-w-5 items-center justify-center rounded-md bg-base-gray-soft px-1.5 text-center text-xs font-normal tabular-nums text-gray",
96
+ className
97
+ ),
98
+ ref,
99
+ ...props,
100
+ children
101
+ }
102
+ )
103
+ );
104
+ Badge.displayName = "Badge";
12
105
  var buttonVariants = cva(
13
106
  `inline-flex items-center justify-center gap-2 whitespace-nowrap cursor-pointer text-base font-medium transition-colors focus-visible:outline-hidden focus-visible:ring focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-6 [&_svg]:shrink-0`,
14
107
  {
@@ -36,94 +129,225 @@ var buttonVariants = cva(
36
129
  }
37
130
  }
38
131
  );
39
- var Button = React2.forwardRef(
132
+ var Button = React4.forwardRef(
40
133
  ({ className, variant, size, asChild = false, ...props }, ref) => {
41
134
  const Comp = asChild ? Slot : "button";
42
135
  return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
43
136
  }
44
137
  );
45
138
  Button.displayName = "Button";
46
- var Card = React2.forwardRef(
139
+ var InfoIcon = (props) => /* @__PURE__ */ jsx(
140
+ "svg",
141
+ {
142
+ fill: "none",
143
+ height: "24",
144
+ viewBox: "0 0 24 24",
145
+ width: "24",
146
+ xmlns: "http://www.w3.org/2000/svg",
147
+ ...props,
148
+ children: /* @__PURE__ */ jsx(
149
+ "path",
150
+ {
151
+ d: "M11 17H13V11H11V17ZM12 9C12.2833 9 12.5208 8.90417 12.7125 8.7125C12.9042 8.52083 13 8.28333 13 8C13 7.71667 12.9042 7.47917 12.7125 7.2875C12.5208 7.09583 12.2833 7 12 7C11.7167 7 11.4792 7.09583 11.2875 7.2875C11.0958 7.47917 11 7.71667 11 8C11 8.28333 11.0958 8.52083 11.2875 8.7125C11.4792 8.90417 11.7167 9 12 9ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76667 19.225 7.875 17.675 6.325C16.125 4.775 14.2333 4 12 4C9.76667 4 7.875 4.775 6.325 6.325C4.775 7.875 4 9.76667 4 12C4 14.2333 4.775 16.125 6.325 17.675C7.875 19.225 9.76667 20 12 20Z",
152
+ fill: "currentColor"
153
+ }
154
+ )
155
+ }
156
+ );
157
+ var PendingIcon = (props) => /* @__PURE__ */ jsx(
158
+ "svg",
159
+ {
160
+ fill: "none",
161
+ height: "24",
162
+ viewBox: "0 0 24 24",
163
+ width: "24",
164
+ xmlns: "http://www.w3.org/2000/svg",
165
+ ...props,
166
+ children: /* @__PURE__ */ jsx(
167
+ "path",
168
+ {
169
+ d: "M12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76667 19.225 7.875 17.675 6.325C16.125 4.775 14.2333 4 12 4C9.76667 4 7.875 4.775 6.325 6.325C4.775 7.875 4 9.76667 4 12C4 14.2333 4.775 16.125 6.325 17.675C7.875 19.225 9.76667 20 12 20ZM12.5 7V12.25L16.5 14.65L15.75 15.85L11 13V7H12.5Z",
170
+ fill: "currentColor"
171
+ }
172
+ )
173
+ }
174
+ );
175
+ var WarningIcon = (props) => /* @__PURE__ */ jsx(
176
+ "svg",
177
+ {
178
+ fill: "none",
179
+ height: "24",
180
+ viewBox: "0 0 24 24",
181
+ width: "24",
182
+ xmlns: "http://www.w3.org/2000/svg",
183
+ ...props,
184
+ children: /* @__PURE__ */ jsx(
185
+ "path",
186
+ {
187
+ d: "M1 21L12 2L23 21H1ZM4.45 19H19.55L12 6L4.45 19ZM12 18C12.2833 18 12.5208 17.9042 12.7125 17.7125C12.9042 17.5208 13 17.2833 13 17C13 16.7167 12.9042 16.4792 12.7125 16.2875C12.5208 16.0958 12.2833 16 12 16C11.7167 16 11.4792 16.0958 11.2875 16.2875C11.0958 16.4792 11 16.7167 11 17C11 17.2833 11.0958 17.5208 11.2875 17.7125C11.4792 17.9042 11.7167 18 12 18ZM11 15H13V10H11V15Z",
188
+ fill: "currentColor"
189
+ }
190
+ )
191
+ }
192
+ );
193
+ var getIcon = (type) => {
194
+ switch (type) {
195
+ case "pending":
196
+ return /* @__PURE__ */ jsx(PendingIcon, { className: "shrink-0 text-info-light", role: "presentation" });
197
+ case "success":
198
+ return /* @__PURE__ */ jsx(InfoIcon, { className: "shrink-0 text-info-light", role: "presentation" });
199
+ case "warning":
200
+ return /* @__PURE__ */ jsx(WarningIcon, { className: "shrink-0 text-orange-11", role: "presentation" });
201
+ case "info":
202
+ return /* @__PURE__ */ jsx(InfoIcon, { className: "shrink-0 text-info-light", role: "presentation" });
203
+ default:
204
+ return null;
205
+ }
206
+ };
207
+ var getContainerClasses = (type) => {
208
+ const baseClasses = "flex items-center gap-3 rounded-2xl p-4 text-sm transition-colors duration-500";
209
+ switch (type) {
210
+ case "error":
211
+ return `${baseClasses} bg-base-error-soft text-error`;
212
+ case "pending":
213
+ case "success":
214
+ return `${baseClasses} bg-base-info-soft text-info`;
215
+ case "warning":
216
+ return `${baseClasses} bg-orange-a3 text-orange-12`;
217
+ case "info":
218
+ default:
219
+ return `${baseClasses} bg-base-info-soft text-info`;
220
+ }
221
+ };
222
+ var Callout = ({ text, type = "info", title, role, className }) => {
223
+ const icon = getIcon(type);
224
+ return /* @__PURE__ */ jsxs("div", { className: cn(getContainerClasses(type), className), role, children: [
225
+ icon,
226
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
227
+ title && /* @__PURE__ */ jsx("span", { className: "text-base font-bold", children: title }),
228
+ text
229
+ ] })
230
+ ] });
231
+ };
232
+ Callout.displayName = "Callout";
233
+ var Card = React4.forwardRef(
47
234
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
48
235
  "div",
49
236
  {
50
- className: cn("relative flex w-full flex-col gap-1 rounded-2xl bg-slate-a3 p-4", className),
237
+ className: cn(
238
+ "relative flex w-full flex-col gap-1 rounded-2xl bg-base-gray-soft p-4",
239
+ className
240
+ ),
51
241
  ref,
52
242
  ...props
53
243
  }
54
244
  )
55
245
  );
56
246
  Card.displayName = "Card";
57
- var CardHeader = React2.forwardRef(
247
+ var CardHeader = React4.forwardRef(
58
248
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-4", className), ref, ...props })
59
249
  );
60
250
  CardHeader.displayName = "CardHeader";
61
- var CardIcon = React2.forwardRef(
251
+ var CardIcon = React4.forwardRef(
62
252
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
63
253
  "div",
64
254
  {
65
- className: cn("flex shrink-0 items-center justify-center text-slate-11", className),
255
+ className: cn("flex shrink-0 items-center justify-center text-accent-active", className),
66
256
  ref,
67
257
  ...props
68
258
  }
69
259
  )
70
260
  );
71
261
  CardIcon.displayName = "CardIcon";
72
- var CardTitle = React2.forwardRef(
262
+ var CardTitle = React4.forwardRef(
73
263
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
74
264
  "h3",
75
265
  {
76
- className: cn("text-base font-medium leading-5 text-slate-12", className),
266
+ className: cn("text-base font-medium leading-5 text-gray", className),
77
267
  ref,
78
268
  ...props
79
269
  }
80
270
  )
81
271
  );
82
272
  CardTitle.displayName = "CardTitle";
83
- var CardDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-5 text-slate-11", className), ref, ...props }));
273
+ var CardDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-5 text-gray-light", className), ref, ...props }));
84
274
  CardDescription.displayName = "CardDescription";
85
- var CardContent = React2.forwardRef(
275
+ var CardContent = React4.forwardRef(
86
276
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("", className), ref, ...props })
87
277
  );
88
278
  CardContent.displayName = "CardContent";
89
- var CardFooter = React2.forwardRef(
279
+ var CardFooter = React4.forwardRef(
90
280
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
91
281
  "div",
92
282
  {
93
- className: cn("flex items-center justify-end gap-2 pt-2", className),
283
+ className: cn("flex items-center text-gray justify-end gap-2 pt-2", className),
94
284
  ref,
95
285
  ...props
96
286
  }
97
287
  )
98
288
  );
99
289
  CardFooter.displayName = "CardFooter";
100
- var CardSkeleton = React2.forwardRef(
290
+ var CardSkeleton = React4.forwardRef(
101
291
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
102
292
  "div",
103
293
  {
104
294
  className: cn(
105
- "relative flex w-full items-center gap-4 rounded-2xl bg-slate-a3 p-4 opacity-80",
295
+ "relative flex w-full items-center gap-4 rounded-2xl bg-spark-a3 p-4 opacity-80",
106
296
  className
107
297
  ),
108
298
  ref,
109
299
  ...props,
110
300
  children: [
111
- /* @__PURE__ */ jsx("div", { className: "size-10 shrink-0 animate-pulse rounded-full bg-slate-a5" }),
301
+ /* @__PURE__ */ jsx("div", { className: "size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft" }),
112
302
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-y-2", children: [
113
- /* @__PURE__ */ jsx("div", { className: "h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-slate-a5" }),
114
- /* @__PURE__ */ jsx("div", { className: "h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-slate-a5" })
303
+ /* @__PURE__ */ jsx("div", { className: "h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-base-gray-soft" }),
304
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-base-gray-soft" })
115
305
  ] })
116
306
  ]
117
307
  }
118
308
  )
119
309
  );
120
310
  CardSkeleton.displayName = "CardSkeleton";
121
- var Dialog = DialogPrimitive.Root;
122
- var DialogTrigger = DialogPrimitive.Trigger;
123
- var DialogPortal = DialogPrimitive.Portal;
124
- var DialogClose = DialogPrimitive.Close;
125
- var DialogOverlay = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
126
- DialogPrimitive.Overlay,
311
+ var CheckIcon = (props) => /* @__PURE__ */ jsx(
312
+ "svg",
313
+ {
314
+ fill: "none",
315
+ height: "12",
316
+ viewBox: "0 0 12 12",
317
+ width: "12",
318
+ xmlns: "http://www.w3.org/2000/svg",
319
+ ...props,
320
+ children: /* @__PURE__ */ jsx(
321
+ "path",
322
+ {
323
+ d: "M4.77498 7.575L9.01248 3.3375C9.11248 3.2375 9.22915 3.1875 9.36248 3.1875C9.49582 3.1875 9.61248 3.2375 9.71248 3.3375C9.81248 3.4375 9.86248 3.55625 9.86248 3.69375C9.86248 3.83125 9.81248 3.95 9.71248 4.05L5.12498 8.65C5.02498 8.75 4.90832 8.8 4.77498 8.8C4.64165 8.8 4.52498 8.75 4.42498 8.65L2.27498 6.5C2.17498 6.4 2.12706 6.28125 2.13123 6.14375C2.1354 6.00625 2.18748 5.8875 2.28748 5.7875C2.38748 5.6875 2.50623 5.6375 2.64373 5.6375C2.78123 5.6375 2.89998 5.6875 2.99998 5.7875L4.77498 7.575Z",
324
+ fill: "currentColor"
325
+ }
326
+ )
327
+ }
328
+ );
329
+ var Checkbox = React4.forwardRef(({ className, size = "default", bordered = false, ...props }, ref) => /* @__PURE__ */ jsx(
330
+ CheckboxPrimitive.Root,
331
+ {
332
+ className: cn(
333
+ "peer inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors focus-visible:outline-hidden focus-visible:ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-base-accent-solid data-[state=unchecked]:bg-base-accent-soft",
334
+ size === "default" && "h-4 w-4",
335
+ size === "large" && "h-6 w-6",
336
+ bordered ? "border-2 border-accent-ui" : "border-2 border-transparent",
337
+ className
338
+ ),
339
+ ref,
340
+ ...props,
341
+ children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: "inline-flex items-center justify-center text-accent-contrast transition-none", children: /* @__PURE__ */ jsx(CheckIcon, { className: cn(size === "large" ? "size-4" : "size-3.5") }) })
342
+ }
343
+ ));
344
+ Checkbox.displayName = "Checkbox";
345
+ var Dialog = SheetPrimitive.Root;
346
+ var DialogTrigger = SheetPrimitive.Trigger;
347
+ var DialogPortal = SheetPrimitive.Portal;
348
+ var DialogClose = SheetPrimitive.Close;
349
+ var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
350
+ SheetPrimitive.Overlay,
127
351
  {
128
352
  className: cn(
129
353
  "fixed inset-0 z-50 bg-black-a6 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 dark:bg-black-a8",
@@ -134,16 +358,16 @@ var DialogOverlay = React2.forwardRef(({ className, ...props }, ref) => /* @__PU
134
358
  ...props
135
359
  }
136
360
  ));
137
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
361
+ DialogOverlay.displayName = SheetPrimitive.Overlay.displayName;
138
362
  var onInteractOutsideHandler = (event) => {
139
363
  const target = event.target;
140
364
  const isOverlay = target.dataset.overlay === "true";
141
365
  if (!isOverlay) event.preventDefault();
142
366
  };
143
- var DialogContent = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Fragment, { children: [
367
+ var DialogContent = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Fragment, { children: [
144
368
  /* @__PURE__ */ jsx(DialogOverlay, {}),
145
369
  /* @__PURE__ */ jsx(
146
- DialogPrimitive.Content,
370
+ SheetPrimitive.Content,
147
371
  {
148
372
  className: cn(
149
373
  "fixed left-[50%] top-[50%] z-50 grid w-[90%] min-w-80 max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl bg-slate-2 p-6 text-gray shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-50% data-[state=closed]:slide-out-to-top-48% data-[state=open]:slide-in-from-top-48% dark:bg-gray-2 sm:w-1/2",
@@ -156,7 +380,7 @@ var DialogContent = React2.forwardRef(({ className, children, ...props }, ref) =
156
380
  }
157
381
  )
158
382
  ] }));
159
- DialogContent.displayName = DialogPrimitive.Content.displayName;
383
+ DialogContent.displayName = SheetPrimitive.Content.displayName;
160
384
  var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("", className), ...props });
161
385
  DialogHeader.displayName = "DialogHeader";
162
386
  var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
@@ -167,30 +391,30 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
167
391
  }
168
392
  );
169
393
  DialogFooter.displayName = "DialogFooter";
170
- var DialogTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
171
- DialogPrimitive.Title,
394
+ var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
395
+ SheetPrimitive.Title,
172
396
  {
173
397
  className: cn("text-lg font-bold text-gray", className),
174
398
  ref,
175
399
  ...props
176
400
  }
177
401
  ));
178
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
179
- var DialogDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
180
- DialogPrimitive.Description,
402
+ DialogTitle.displayName = SheetPrimitive.Title.displayName;
403
+ var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
404
+ SheetPrimitive.Description,
181
405
  {
182
406
  className: cn("text-md text-gray", className),
183
407
  ref,
184
408
  ...props
185
409
  }
186
410
  ));
187
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
188
- var DisplayField = React2.forwardRef(
411
+ DialogDescription.displayName = SheetPrimitive.Description.displayName;
412
+ var DisplayField = React4.forwardRef(
189
413
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
190
414
  "div",
191
415
  {
192
416
  className: cn(
193
- "relative flex min-h-12 w-full flex-col gap-y-2 rounded-2xl bg-slate-a3 p-4",
417
+ "relative flex min-h-12 w-full justify-between gap-2 rounded-2xl bg-base-gray-soft p-4",
194
418
  className
195
419
  ),
196
420
  ref,
@@ -199,26 +423,23 @@ var DisplayField = React2.forwardRef(
199
423
  )
200
424
  );
201
425
  DisplayField.displayName = "DisplayField";
202
- var DisplayFieldLabel = React2.forwardRef(
426
+ var DisplayFieldLabel = React4.forwardRef(
203
427
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
204
428
  "span",
205
429
  {
206
- className: cn(
207
- "text-sm font-medium leading-5 text-slate-11 [overflow-wrap:break-word]",
208
- className
209
- ),
430
+ className: cn("text-sm font-medium leading-5 text-gray-light wrap-break-word", className),
210
431
  ref,
211
432
  ...props
212
433
  }
213
434
  )
214
435
  );
215
436
  DisplayFieldLabel.displayName = "DisplayFieldLabel";
216
- var DisplayFieldValue = React2.forwardRef(
437
+ var DisplayFieldValue = React4.forwardRef(
217
438
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
218
439
  "span",
219
440
  {
220
441
  className: cn(
221
- "min-h-5 w-full whitespace-pre-wrap text-base tabular-nums leading-5 text-slate-12",
442
+ "min-h-5 w-full whitespace-pre-wrap text-base tabular-nums leading-5 text-gray",
222
443
  className
223
444
  ),
224
445
  ref,
@@ -227,29 +448,1071 @@ var DisplayFieldValue = React2.forwardRef(
227
448
  )
228
449
  );
229
450
  DisplayFieldValue.displayName = "DisplayFieldValue";
230
- var DisplayFieldContent = React2.forwardRef(
451
+ var DisplayFieldContent = React4.forwardRef(
231
452
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("", className), ref, ...props })
232
453
  );
233
454
  DisplayFieldContent.displayName = "DisplayFieldContent";
234
- var DisplayFieldSkeleton = React2.forwardRef(
455
+ var DisplayFieldSkeleton = React4.forwardRef(
235
456
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
236
457
  "div",
237
458
  {
238
459
  className: cn(
239
- "relative flex h-20 w-full flex-col gap-y-2 rounded-2xl bg-slate-a3 p-4 opacity-80",
460
+ "relative flex h-20 w-full flex-col gap-y-2 rounded-2xl bg-base-gray-soft p-4 opacity-80",
240
461
  className
241
462
  ),
242
463
  ref,
243
464
  ...props,
244
465
  children: [
245
- /* @__PURE__ */ jsx("div", { className: "h-5 w-1/2 max-w-52 animate-pulse rounded-md bg-slate-a5" }),
246
- /* @__PURE__ */ jsx("div", { className: "h-5 w-3/4 max-w-72 animate-pulse rounded-md bg-slate-a5" })
466
+ /* @__PURE__ */ jsx("div", { className: "h-5 w-1/2 max-w-52 animate-pulse rounded-md bg-base-gray-soft" }),
467
+ /* @__PURE__ */ jsx("div", { className: "h-5 w-3/4 max-w-72 animate-pulse rounded-md bg-base-gray-soft" })
247
468
  ]
248
469
  }
249
470
  )
250
471
  );
251
472
  DisplayFieldSkeleton.displayName = "DisplayFieldSkeleton";
473
+ var Drawer = ({
474
+ shouldScaleBackground = true,
475
+ ...props
476
+ }) => /* @__PURE__ */ jsx(Drawer$1.Root, { shouldScaleBackground, ...props });
477
+ Drawer.displayName = "Drawer";
478
+ var DrawerTrigger = Drawer$1.Trigger;
479
+ var DrawerPortal = Drawer$1.Portal;
480
+ var DrawerClose = Drawer$1.Close;
481
+ var DrawerOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
482
+ Drawer$1.Overlay,
483
+ {
484
+ className: cn("fixed inset-0 z-50 bg-black-a6 dark:bg-black-a8", className),
485
+ "data-overlay": "true",
486
+ ref,
487
+ ...props
488
+ }
489
+ ));
490
+ DrawerOverlay.displayName = Drawer$1.Overlay.displayName;
491
+ var DrawerPill = ({ className }) => /* @__PURE__ */ jsx(
492
+ "div",
493
+ {
494
+ className: cn(
495
+ "mx-auto mt-2.5 h-1.5 w-16 shrink-0 rounded-[24px] bg-base-gray-soft",
496
+ className
497
+ )
498
+ }
499
+ );
500
+ var DrawerContent = React4.forwardRef(({ className, pillClassName, children, ...props }, ref) => /* @__PURE__ */ jsxs(DrawerPortal, { children: [
501
+ /* @__PURE__ */ jsx(DrawerOverlay, {}),
502
+ /* @__PURE__ */ jsxs(
503
+ Drawer$1.Content,
504
+ {
505
+ className: cn(
506
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col gap-4 rounded-t-2xl bg-slate-2 text-gray dark:bg-gray-2",
507
+ className
508
+ ),
509
+ ref,
510
+ ...props,
511
+ children: [
512
+ /* @__PURE__ */ jsx(DrawerPill, { className: pillClassName }),
513
+ children
514
+ ]
515
+ }
516
+ )
517
+ ] }));
518
+ DrawerContent.displayName = "DrawerContent";
519
+ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1 px-6 py-3", className), ...props });
520
+ DrawerHeader.displayName = "DrawerHeader";
521
+ var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("mt-auto flex flex-col gap-2 text-gray", className), ...props });
522
+ DrawerFooter.displayName = "DrawerFooter";
523
+ var DrawerTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
524
+ Drawer$1.Title,
525
+ {
526
+ className: cn("text-lg font-bold text-gray", className),
527
+ ref,
528
+ ...props
529
+ }
530
+ ));
531
+ DrawerTitle.displayName = Drawer$1.Title.displayName;
532
+ var DrawerDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
533
+ Drawer$1.Description,
534
+ {
535
+ className: cn("text-sm text-gray", className),
536
+ ref,
537
+ ...props
538
+ }
539
+ ));
540
+ DrawerDescription.displayName = Drawer$1.Description.displayName;
541
+ var POSITIONS = {
542
+ solar: { x: 120, y: 70 },
543
+ grid: { x: 360, y: 70 },
544
+ home: { x: 240, y: 190 },
545
+ battery: { x: 100, y: 330 },
546
+ "heat-pump": { x: 240, y: 355 },
547
+ ev: { x: 380, y: 330 }
548
+ };
549
+ var NODE_RADIUS = 32;
550
+ var HOME_RADIUS = 38;
551
+ var STYLES = {
552
+ solar: { label: "Solar", bg: "var(--orange-3)", icon: "var(--orange-11)", flow: "var(--orange-9)" },
553
+ battery: { label: "Battery", bg: "var(--green-3)", icon: "var(--green-11)", flow: "var(--green-9)" },
554
+ grid: { label: "Grid", bg: "var(--mauve-3)", icon: "var(--mauve-11)", flow: "var(--mauve-9)" },
555
+ home: { label: "Home", bg: "var(--slate-3)", icon: "var(--slate-11)", flow: "var(--slate-9)" },
556
+ ev: { label: "EV Charger", bg: "var(--blue-3)", icon: "var(--blue-11)", flow: "var(--blue-9)" },
557
+ "heat-pump": { label: "Heat Pump", bg: "var(--red-3)", icon: "var(--red-11)", flow: "var(--red-9)" }
558
+ };
559
+ var defaultFormatPower = (power) => {
560
+ const abs = Math.abs(power);
561
+ if (abs >= 1) return `${abs.toFixed(1)} kW`;
562
+ return `${(abs * 1e3).toFixed(0)} W`;
563
+ };
564
+ function getFlowPath(from, to) {
565
+ const mx = (from.x + to.x) / 2;
566
+ return `M ${from.x} ${from.y} C ${mx} ${from.y}, ${mx} ${to.y}, ${to.x} ${to.y}`;
567
+ }
568
+ function getAnimDuration(power) {
569
+ const clamped = Math.max(0.1, Math.min(10, Math.abs(power)));
570
+ return Math.max(1, 4 - clamped * 0.3);
571
+ }
572
+ function SolarIcon({ color }) {
573
+ return /* @__PURE__ */ jsxs("g", { style: { color }, children: [
574
+ /* @__PURE__ */ jsx("rect", { fill: "none", height: "18", rx: "1.5", stroke: "currentColor", strokeWidth: "1.8", width: "18", x: "-9", y: "-9" }),
575
+ /* @__PURE__ */ jsx("line", { stroke: "currentColor", strokeWidth: "1", x1: "-9", x2: "9", y1: "-3", y2: "-3" }),
576
+ /* @__PURE__ */ jsx("line", { stroke: "currentColor", strokeWidth: "1", x1: "-9", x2: "9", y1: "3", y2: "3" }),
577
+ /* @__PURE__ */ jsx("line", { stroke: "currentColor", strokeWidth: "1", x1: "-3", x2: "-3", y1: "-9", y2: "9" }),
578
+ /* @__PURE__ */ jsx("line", { stroke: "currentColor", strokeWidth: "1", x1: "3", x2: "3", y1: "-9", y2: "9" })
579
+ ] });
580
+ }
581
+ function BatteryIcon({ color, level = 50 }) {
582
+ const h = Math.max(1, Math.min(100, level) / 100 * 16);
583
+ return /* @__PURE__ */ jsxs("g", { style: { color }, children: [
584
+ /* @__PURE__ */ jsx("rect", { fill: "currentColor", height: "3", rx: "1", width: "6", x: "-3", y: "-13" }),
585
+ /* @__PURE__ */ jsx("rect", { fill: "none", height: "20", rx: "2.5", stroke: "currentColor", strokeWidth: "1.8", width: "14", x: "-7", y: "-10" }),
586
+ /* @__PURE__ */ jsx("rect", { fill: "currentColor", height: h, opacity: 0.5, rx: "1", width: "9", x: "-4.5", y: 10 - h })
587
+ ] });
588
+ }
589
+ function GridIcon({ color }) {
590
+ return /* @__PURE__ */ jsx("g", { style: { color }, children: /* @__PURE__ */ jsx("path", { d: "M0 -12 L0 12 M-9 -5 L9 -5 M-7 1 L7 1 M-5 7 L5 7", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" }) });
591
+ }
592
+ function HomeIcon({ color }) {
593
+ return /* @__PURE__ */ jsxs("g", { style: { color }, children: [
594
+ /* @__PURE__ */ jsx("path", { d: "M-12 2 L0 -11 L12 2", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2.2" }),
595
+ /* @__PURE__ */ jsx("rect", { fill: "none", height: "12", rx: "1.5", stroke: "currentColor", strokeWidth: "1.8", width: "18", x: "-9", y: "2" }),
596
+ /* @__PURE__ */ jsx("rect", { fill: "currentColor", height: "7", opacity: 0.35, rx: "1", width: "6", x: "-3", y: "7" })
597
+ ] });
598
+ }
599
+ function EvIcon({ color }) {
600
+ return /* @__PURE__ */ jsxs("g", { style: { color }, children: [
601
+ /* @__PURE__ */ jsx("path", { d: "M-11 3 L-9 -3 L-3 -8 L7 -8 L11 -1 L11 3 Z", fill: "none", stroke: "currentColor", strokeLinejoin: "round", strokeWidth: "1.8" }),
602
+ /* @__PURE__ */ jsx("circle", { cx: "-5", cy: "5", fill: "none", r: "3", stroke: "currentColor", strokeWidth: "1.5" }),
603
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "5", fill: "none", r: "3", stroke: "currentColor", strokeWidth: "1.5" }),
604
+ /* @__PURE__ */ jsx("path", { d: "M1 -5 L-1 0 L2 0 L0 4", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.2" })
605
+ ] });
606
+ }
607
+ function HeatPumpIcon({ color }) {
608
+ return /* @__PURE__ */ jsxs("g", { style: { color }, children: [
609
+ /* @__PURE__ */ jsx("rect", { fill: "none", height: "16", rx: "3", stroke: "currentColor", strokeWidth: "1.8", width: "22", x: "-11", y: "-8" }),
610
+ /* @__PURE__ */ jsx("circle", { cx: "0", cy: "0", fill: "none", r: "5", stroke: "currentColor", strokeWidth: "1.5" }),
611
+ /* @__PURE__ */ jsx("path", { d: "M0 -4 C2 -2 2 2 0 4 C-2 2 -2 -2 0 -4", fill: "currentColor", opacity: 0.3 }),
612
+ /* @__PURE__ */ jsx("path", { d: "M-4 0 C-2 -2 2 -2 4 0 C2 2 -2 2 -4 0", fill: "currentColor", opacity: 0.3 })
613
+ ] });
614
+ }
615
+ var NODE_ICONS = {
616
+ solar: SolarIcon,
617
+ battery: BatteryIcon,
618
+ grid: GridIcon,
619
+ home: HomeIcon,
620
+ ev: EvIcon,
621
+ "heat-pump": HeatPumpIcon
622
+ };
623
+ function FlowConnection({
624
+ from,
625
+ to,
626
+ color,
627
+ power
628
+ }) {
629
+ const d = getFlowPath(from, to);
630
+ const dur = getAnimDuration(power);
631
+ const dots = 3;
632
+ return /* @__PURE__ */ jsxs("g", { children: [
633
+ /* @__PURE__ */ jsx("path", { d, fill: "none", opacity: 0.15, stroke: color, strokeWidth: 2 }),
634
+ Array.from({ length: dots }, (_, i) => /* @__PURE__ */ jsx("circle", { fill: color, opacity: 0.85, r: 3.5, children: /* @__PURE__ */ jsx("animateMotion", { begin: `${i * dur / dots}s`, dur: `${dur}s`, path: d, repeatCount: "indefinite" }) }, i))
635
+ ] });
636
+ }
637
+ function FlowNode({
638
+ node,
639
+ formatPower
640
+ }) {
641
+ const pos = POSITIONS[node.type];
642
+ const style = STYLES[node.type];
643
+ const radius = node.type === "home" ? HOME_RADIUS : NODE_RADIUS;
644
+ const Icon2 = NODE_ICONS[node.type];
645
+ const label = node.label ?? style.label;
646
+ const inactive = node.power === 0;
647
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${pos.x}, ${pos.y})`, children: [
648
+ /* @__PURE__ */ jsx(
649
+ "circle",
650
+ {
651
+ fill: style.bg,
652
+ opacity: inactive ? 0.5 : 1,
653
+ r: radius,
654
+ stroke: style.flow,
655
+ strokeWidth: 2
656
+ }
657
+ ),
658
+ /* @__PURE__ */ jsx("g", { transform: "translate(0, -2)", children: /* @__PURE__ */ jsx(Icon2, { color: style.icon, level: node.batteryLevel }) }),
659
+ /* @__PURE__ */ jsx(
660
+ "text",
661
+ {
662
+ fill: style.icon,
663
+ fontSize: "11",
664
+ fontWeight: "600",
665
+ textAnchor: "middle",
666
+ y: radius + 16,
667
+ children: label
668
+ }
669
+ ),
670
+ /* @__PURE__ */ jsx(
671
+ "text",
672
+ {
673
+ fill: style.icon,
674
+ fontSize: "12",
675
+ fontWeight: "500",
676
+ opacity: 0.75,
677
+ textAnchor: "middle",
678
+ y: radius + 30,
679
+ children: formatPower(node.power)
680
+ }
681
+ ),
682
+ node.type === "battery" && node.batteryLevel != null && /* @__PURE__ */ jsxs(Fragment, { children: [
683
+ /* @__PURE__ */ jsx(
684
+ "rect",
685
+ {
686
+ fill: style.flow,
687
+ height: "16",
688
+ rx: "8",
689
+ width: "24",
690
+ x: radius - 24,
691
+ y: -radius + 2
692
+ }
693
+ ),
694
+ /* @__PURE__ */ jsxs(
695
+ "text",
696
+ {
697
+ fill: "white",
698
+ fontSize: "9",
699
+ fontWeight: "700",
700
+ textAnchor: "middle",
701
+ x: radius - 12,
702
+ y: -radius + 13,
703
+ children: [
704
+ Math.round(node.batteryLevel),
705
+ "%"
706
+ ]
707
+ }
708
+ )
709
+ ] })
710
+ ] });
711
+ }
712
+ function EnergyFlowChart({
713
+ nodes,
714
+ flows = [],
715
+ className,
716
+ formatPower = defaultFormatPower
717
+ }) {
718
+ const nodeMap = useMemo(() => new Map(nodes.map((n) => [n.type, n])), [nodes]);
719
+ const validFlows = useMemo(
720
+ () => flows.filter((f) => nodeMap.has(f.from) && nodeMap.has(f.to) && f.power > 0),
721
+ [flows, nodeMap]
722
+ );
723
+ return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs(
724
+ "svg",
725
+ {
726
+ "aria-label": "Energy flow diagram",
727
+ className: "block h-auto w-full",
728
+ role: "img",
729
+ viewBox: "0 0 480 420",
730
+ children: [
731
+ validFlows.map((f, i) => /* @__PURE__ */ jsx(
732
+ FlowConnection,
733
+ {
734
+ color: STYLES[f.from].flow,
735
+ from: POSITIONS[f.from],
736
+ power: f.power,
737
+ to: POSITIONS[f.to]
738
+ },
739
+ `${f.from}-${f.to}-${i}`
740
+ )),
741
+ nodes.map((node) => /* @__PURE__ */ jsx(FlowNode, { formatPower, node }, node.type))
742
+ ]
743
+ }
744
+ ) });
745
+ }
746
+ EnergyFlowChart.displayName = "EnergyFlowChart";
747
+ var hintIdCounter = 0;
748
+ var Input = React4.forwardRef(
749
+ ({ containerClassName, label, value, className, onChange, readOnly, hint, icon, ...props }, ref) => {
750
+ const hintId = useMemo(() => {
751
+ if (!hint) return void 0;
752
+ return `input-hint-${++hintIdCounter}`;
753
+ }, [hint]);
754
+ const customClassName = {
755
+ "border-transparent": !label?.length,
756
+ "border-input-active": props["aria-invalid"] !== true && (typeof value === "string" ? value.length > 0 : typeof value === "number" ? true : false),
757
+ "text-error! !focus-visible:border-input-invalid border-input-invalid!": props["aria-invalid"] === true
758
+ };
759
+ return /* @__PURE__ */ jsxs(
760
+ "div",
761
+ {
762
+ className: cn(
763
+ "relative flex w-full flex-col gap-y-1 rounded-2xl bg-input-base px-4 py-3",
764
+ containerClassName
765
+ ),
766
+ children: [
767
+ label && /* @__PURE__ */ jsx("label", { className: "text-sm font-normal leading-5 text-gray-light", htmlFor: label, children: label }),
768
+ /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-between gap-2", children: [
769
+ /* @__PURE__ */ jsx(
770
+ "input",
771
+ {
772
+ "aria-describedby": hintId,
773
+ className: cn(
774
+ "flex h-10 w-full rounded-none border-b-2 border-input bg-transparent py-2 text-base leading-5 text-gray outline-hidden transition-colors duration-100 placeholder:text-gray-disabled focus:border-input-active read-only:focus:border-transparent focus-visible:border-input-active read-only:focus-visible:border-transparent disabled:cursor-not-allowed disabled:border-input-disabled disabled:text-gray-disabled [&:user-invalid]:border-input-invalid [&:user-invalid]:text-error [&:user-invalid]:focus-visible:border-input-invalid [&:user-valid]:border-input-active",
775
+ customClassName,
776
+ className
777
+ ),
778
+ id: label,
779
+ onChange,
780
+ readOnly,
781
+ ref,
782
+ value,
783
+ ...props
784
+ }
785
+ ),
786
+ icon ? icon : null
787
+ ] }),
788
+ hint ? /* @__PURE__ */ jsx("div", { id: hintId, children: hint }) : null
789
+ ]
790
+ }
791
+ );
792
+ }
793
+ );
794
+ Input.displayName = "Input";
795
+ var Label = React4.forwardRef(
796
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
797
+ "label",
798
+ {
799
+ className: cn("text-base font-normal leading-5 text-gray-light", className),
800
+ ref,
801
+ ...props
802
+ }
803
+ )
804
+ );
805
+ Label.displayName = "Label";
806
+ var DEFAULT_MARGIN = { top: 16, right: 16, bottom: 40, left: 48 };
807
+ var CURVE_MAP = {
808
+ monotone: curveMonotoneX,
809
+ step: curveStep,
810
+ "step-after": curveStepAfter,
811
+ "step-before": curveStepBefore,
812
+ linear: curveLinear
813
+ };
814
+ var resolveCurve = (type) => CURVE_MAP[type];
815
+ var bisectDate = bisector((d) => d.date).left;
816
+ var defaultFormatDate = (date) => date.toLocaleDateString(void 0, { month: "short", day: "numeric" });
817
+ var defaultFormatValue = (value) => value.toLocaleString();
818
+ var LINE_COLORS = [
819
+ "stroke-spark-9",
820
+ "stroke-green-9",
821
+ "stroke-blue-9",
822
+ "stroke-orange-9",
823
+ "stroke-red-9"
824
+ ];
825
+ var DOT_COLORS = ["fill-spark-9", "fill-green-9", "fill-blue-9", "fill-orange-9", "fill-red-9"];
826
+ var TEXT_COLORS = [
827
+ "text-spark-a11",
828
+ "text-success-light",
829
+ "text-info-light",
830
+ "text-warning-light",
831
+ "text-error-light"
832
+ ];
833
+ function LineChart({
834
+ series,
835
+ width,
836
+ height,
837
+ margin = DEFAULT_MARGIN,
838
+ curve: defaultCurve = "monotone",
839
+ showGrid = true,
840
+ showTooltip: enableTooltip = true,
841
+ className,
842
+ xTickCount = 5,
843
+ yTickCount = 4,
844
+ formatDate = defaultFormatDate,
845
+ formatValue = defaultFormatValue
846
+ }) {
847
+ const { showTooltip, hideTooltip, tooltipData, tooltipLeft, tooltipTop, tooltipOpen } = useTooltip();
848
+ const innerWidth = Math.max(0, width - margin.left - margin.right);
849
+ const innerHeight = Math.max(0, height - margin.top - margin.bottom);
850
+ const allData = useMemo(() => series.flatMap((s) => s.data), [series]);
851
+ const xScale = useMemo(
852
+ () => scaleTime({
853
+ range: [0, innerWidth],
854
+ domain: extent(allData, (d) => d.date)
855
+ }),
856
+ [allData, innerWidth]
857
+ );
858
+ const yScale = useMemo(
859
+ () => scaleLinear({
860
+ range: [innerHeight, 0],
861
+ domain: [0, Math.max(...allData.map((d) => d.value)) * 1.1],
862
+ nice: true
863
+ }),
864
+ [allData, innerHeight]
865
+ );
866
+ const xTicks = xScale.ticks(xTickCount);
867
+ const yTicks = yScale.ticks(yTickCount);
868
+ const handleTooltip = useCallback(
869
+ (event) => {
870
+ if (!enableTooltip) return;
871
+ const point = localPoint(event);
872
+ if (!point) return;
873
+ const x0 = xScale.invert(point.x - margin.left);
874
+ for (let i = 0; i < series.length; i++) {
875
+ const s = series[i];
876
+ if (!s) continue;
877
+ const index = bisectDate(s.data, x0, 1);
878
+ const d0 = s.data[index - 1];
879
+ const d1 = s.data[index];
880
+ if (!d0) continue;
881
+ const d = d1 && x0.valueOf() - d0.date.valueOf() > d1.date.valueOf() - x0.valueOf() ? d1 : d0;
882
+ showTooltip({
883
+ tooltipData: { datum: d, seriesIndex: i },
884
+ tooltipLeft: xScale(d.date) + margin.left,
885
+ tooltipTop: yScale(d.value) + margin.top
886
+ });
887
+ break;
888
+ }
889
+ },
890
+ [enableTooltip, margin, series, showTooltip, xScale, yScale]
891
+ );
892
+ if (width < 10 || height < 10) return null;
893
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
894
+ /* @__PURE__ */ jsx("svg", { className: "block", height, width, children: /* @__PURE__ */ jsxs(Group, { left: margin.left, top: margin.top, children: [
895
+ showGrid && yTicks.map((tick) => /* @__PURE__ */ jsx(
896
+ "line",
897
+ {
898
+ className: "stroke-slate-a4",
899
+ strokeDasharray: "4,4",
900
+ x1: 0,
901
+ x2: innerWidth,
902
+ y1: yScale(tick),
903
+ y2: yScale(tick)
904
+ },
905
+ `grid-y-${tick}`
906
+ )),
907
+ /* @__PURE__ */ jsx(
908
+ "line",
909
+ {
910
+ className: "stroke-slate-a6",
911
+ x1: 0,
912
+ x2: innerWidth,
913
+ y1: innerHeight,
914
+ y2: innerHeight
915
+ }
916
+ ),
917
+ xTicks.map((tick) => /* @__PURE__ */ jsx(
918
+ "text",
919
+ {
920
+ className: "fill-slate-a11 text-xs",
921
+ dy: "1em",
922
+ textAnchor: "middle",
923
+ x: xScale(tick),
924
+ y: innerHeight + 8,
925
+ children: formatDate(tick)
926
+ },
927
+ `x-${tick.valueOf()}`
928
+ )),
929
+ yTicks.map((tick) => /* @__PURE__ */ jsx(
930
+ "text",
931
+ {
932
+ className: "fill-slate-a11 text-xs",
933
+ dx: "-0.5em",
934
+ dy: "0.32em",
935
+ textAnchor: "end",
936
+ x: -4,
937
+ y: yScale(tick),
938
+ children: formatValue(tick)
939
+ },
940
+ `y-${tick}`
941
+ )),
942
+ series.map((s, i) => /* @__PURE__ */ jsx(
943
+ LinePath,
944
+ {
945
+ className: cn(LINE_COLORS[i % LINE_COLORS.length], s.className),
946
+ curve: resolveCurve(s.curve ?? defaultCurve),
947
+ data: s.data,
948
+ fill: "none",
949
+ strokeDasharray: s.dashed ? s.dashPattern ?? "6,4" : void 0,
950
+ strokeWidth: 2,
951
+ x: (d) => xScale(d.date),
952
+ y: (d) => yScale(d.value)
953
+ },
954
+ s.id
955
+ )),
956
+ enableTooltip && /* @__PURE__ */ jsx(
957
+ "rect",
958
+ {
959
+ fill: "transparent",
960
+ height: innerHeight,
961
+ onMouseLeave: hideTooltip,
962
+ onMouseMove: handleTooltip,
963
+ onTouchEnd: hideTooltip,
964
+ onTouchMove: handleTooltip,
965
+ width: innerWidth,
966
+ x: 0,
967
+ y: 0
968
+ }
969
+ ),
970
+ tooltipOpen && tooltipData && /* @__PURE__ */ jsxs(Fragment, { children: [
971
+ /* @__PURE__ */ jsx(
972
+ "line",
973
+ {
974
+ className: "stroke-slate-a6",
975
+ pointerEvents: "none",
976
+ strokeDasharray: "4,4",
977
+ x1: xScale(tooltipData.datum.date),
978
+ x2: xScale(tooltipData.datum.date),
979
+ y1: 0,
980
+ y2: innerHeight
981
+ }
982
+ ),
983
+ /* @__PURE__ */ jsx(
984
+ "circle",
985
+ {
986
+ className: cn(DOT_COLORS[tooltipData.seriesIndex % DOT_COLORS.length]),
987
+ cx: xScale(tooltipData.datum.date),
988
+ cy: yScale(tooltipData.datum.value),
989
+ pointerEvents: "none",
990
+ r: 4,
991
+ stroke: "white",
992
+ strokeWidth: 2
993
+ }
994
+ )
995
+ ] })
996
+ ] }) }),
997
+ tooltipOpen && !!tooltipData && /* @__PURE__ */ jsx(
998
+ Tooltip,
999
+ {
1000
+ left: tooltipLeft,
1001
+ style: {
1002
+ position: "absolute",
1003
+ pointerEvents: "none",
1004
+ background: "transparent",
1005
+ border: "none",
1006
+ boxShadow: "none",
1007
+ padding: 0
1008
+ },
1009
+ top: tooltipTop,
1010
+ children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-slate-2 px-3 py-2 text-sm shadow-md dark:bg-gray-2", children: [
1011
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-light", children: formatDate(tooltipData.datum.date) }),
1012
+ /* @__PURE__ */ jsx(
1013
+ "div",
1014
+ {
1015
+ className: cn(
1016
+ "font-medium",
1017
+ TEXT_COLORS[tooltipData.seriesIndex % TEXT_COLORS.length]
1018
+ ),
1019
+ children: formatValue(tooltipData.datum.value)
1020
+ }
1021
+ )
1022
+ ] })
1023
+ }
1024
+ )
1025
+ ] });
1026
+ }
1027
+ LineChart.displayName = "LineChart";
1028
+ var Popover = PopoverPrimitive.Root;
1029
+ var PopoverTrigger = PopoverPrimitive.Trigger;
1030
+ var PopoverContent = React4.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1031
+ PopoverPrimitive.Content,
1032
+ {
1033
+ align,
1034
+ className: cn(
1035
+ "z-50 w-72 rounded-xl border bg-slate-2 p-4 shadow-xs outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)",
1036
+ className
1037
+ ),
1038
+ ref,
1039
+ sideOffset,
1040
+ ...props
1041
+ }
1042
+ ) }));
1043
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
1044
+ var sizeClasses = {
1045
+ sm: "h-1",
1046
+ default: "h-2",
1047
+ lg: "h-3"
1048
+ };
1049
+ var Progress = React4.forwardRef(
1050
+ ({ className, value, max = 100, size = "default", ...props }, ref) => {
1051
+ const percentage = Math.min(100, Math.max(0, value / max * 100));
1052
+ return /* @__PURE__ */ jsx(
1053
+ "div",
1054
+ {
1055
+ "aria-valuemax": max,
1056
+ "aria-valuemin": 0,
1057
+ "aria-valuenow": value,
1058
+ className: cn(
1059
+ "w-full overflow-hidden rounded-full bg-slate-a4",
1060
+ sizeClasses[size],
1061
+ className
1062
+ ),
1063
+ ref,
1064
+ role: "progressbar",
1065
+ ...props,
1066
+ children: /* @__PURE__ */ jsx(
1067
+ "div",
1068
+ {
1069
+ className: "h-full rounded-full bg-spark-9 transition-all duration-300",
1070
+ style: { width: `${percentage}%` }
1071
+ }
1072
+ )
1073
+ }
1074
+ );
1075
+ }
1076
+ );
1077
+ Progress.displayName = "Progress";
1078
+ var ScrollArea = React4.forwardRef(({ className, children, direction = "vertical", ...props }, ref) => /* @__PURE__ */ jsxs(
1079
+ ScrollAreaPrimitive.Root,
1080
+ {
1081
+ className: cn("relative overflow-hidden", className),
1082
+ ref,
1083
+ ...props,
1084
+ children: [
1085
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "size-full rounded-[inherit]", children }),
1086
+ direction !== "horizontal" && /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
1087
+ direction !== "vertical" && /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
1088
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
1089
+ ]
1090
+ }
1091
+ ));
1092
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
1093
+ var ScrollBar = React4.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
1094
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
1095
+ {
1096
+ className: cn(
1097
+ "flex touch-none select-none transition-colors",
1098
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
1099
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px empty:hidden",
1100
+ className
1101
+ ),
1102
+ orientation,
1103
+ ref,
1104
+ ...props,
1105
+ children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-[24px] bg-gray-8" })
1106
+ }
1107
+ ));
1108
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
1109
+ var ChevronDownIcon = (props) => /* @__PURE__ */ jsx(
1110
+ "svg",
1111
+ {
1112
+ fill: "none",
1113
+ height: "24",
1114
+ viewBox: "0 0 24 24",
1115
+ width: "24",
1116
+ xmlns: "http://www.w3.org/2000/svg",
1117
+ ...props,
1118
+ children: /* @__PURE__ */ jsx(
1119
+ "path",
1120
+ {
1121
+ d: "M12 14.975C11.8667 14.975 11.7417 14.9542 11.625 14.9125C11.5083 14.8708 11.4 14.8 11.3 14.7L6.7 10.1C6.51667 9.91667 6.425 9.68334 6.425 9.4C6.425 9.11667 6.51667 8.88334 6.7 8.7C6.88334 8.51667 7.11667 8.425 7.4 8.425C7.68334 8.425 7.91667 8.51667 8.1 8.7L12 12.6L15.9 8.7C16.0833 8.51667 16.3167 8.425 16.6 8.425C16.8833 8.425 17.1167 8.51667 17.3 8.7C17.4833 8.88334 17.575 9.11667 17.575 9.4C17.575 9.68334 17.4833 9.91667 17.3 10.1L12.7 14.7C12.6 14.8 12.4917 14.8708 12.375 14.9125C12.2583 14.9542 12.1333 14.975 12 14.975Z",
1122
+ fill: "currentColor"
1123
+ }
1124
+ )
1125
+ }
1126
+ );
1127
+ var Select = SelectPrimitive.Root;
1128
+ var SelectGroup = SelectPrimitive.Group;
1129
+ var SelectValue = SelectPrimitive.Value;
1130
+ var SelectTrigger = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
1131
+ SelectPrimitive.Trigger,
1132
+ {
1133
+ className: cn(
1134
+ "flex w-full items-center justify-between focus:outline-hidden focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
1135
+ className
1136
+ ),
1137
+ ref,
1138
+ ...props,
1139
+ children
1140
+ }
1141
+ ));
1142
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
1143
+ var SelectTriggerIcon = () => /* @__PURE__ */ jsx(
1144
+ SelectPrimitive.Icon,
1145
+ {
1146
+ asChild: true,
1147
+ className: "not-sr-only in-data-[state=open]:rotate-180",
1148
+ role: "presentation",
1149
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-6 shrink-0 text-spark-a11" })
1150
+ }
1151
+ );
1152
+ SelectTriggerIcon.displayName = "SelectTriggerIcon";
1153
+ var SelectScrollUpButton = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1154
+ SelectPrimitive.ScrollUpButton,
1155
+ {
1156
+ className: cn(
1157
+ "absolute left-0 right-0 top-0 z-1 flex w-full cursor-default items-center justify-center py-1 transition-all max-sm:pointer-events-none",
1158
+ className
1159
+ ),
1160
+ ref,
1161
+ ...props,
1162
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-6 shrink-0 rotate-180" })
1163
+ }
1164
+ ));
1165
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
1166
+ var SelectScrollDownButton = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1167
+ SelectPrimitive.ScrollDownButton,
1168
+ {
1169
+ className: cn(
1170
+ "absolute bottom-0 left-0 right-0 z-1 flex w-full cursor-default items-center justify-center py-1 transition-all max-sm:pointer-events-none",
1171
+ className
1172
+ ),
1173
+ ref,
1174
+ ...props,
1175
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-6 shrink-0" })
1176
+ }
1177
+ ));
1178
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
1179
+ var SelectLabel = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1180
+ SelectPrimitive.Label,
1181
+ {
1182
+ className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
1183
+ ref,
1184
+ ...props
1185
+ }
1186
+ ));
1187
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
1188
+ var SelectItem = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
1189
+ SelectPrimitive.Item,
1190
+ {
1191
+ className: cn(
1192
+ "relative flex w-full cursor-default select-none items-center outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
1193
+ className
1194
+ ),
1195
+ ref,
1196
+ ...props,
1197
+ children: /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
1198
+ }
1199
+ ));
1200
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
1201
+ var SelectSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1202
+ SelectPrimitive.Separator,
1203
+ {
1204
+ className: cn("-mx-1 my-1 h-px", className),
1205
+ ref,
1206
+ ...props
1207
+ }
1208
+ ));
1209
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
1210
+ var SelectContent = React4.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
1211
+ SelectPrimitive.Content,
1212
+ {
1213
+ className: cn(
1214
+ "duration-250 relative z-50 max-h-96 w-[var(--radix-select-trigger-width)] min-w-[8rem] overflow-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-100 data-[state=open]:zoom-in-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",
1215
+ position === "popper" && "data-[side=bottom]:translate-y-0 data-[side=left]:-translate-x-0 data-[side=right]:translate-x-0 data-[side=top]:-translate-y-0",
1216
+ className
1217
+ ),
1218
+ position,
1219
+ ref,
1220
+ ...props,
1221
+ children: [
1222
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
1223
+ /* @__PURE__ */ jsx(
1224
+ SelectPrimitive.Viewport,
1225
+ {
1226
+ className: cn(
1227
+ "p-0",
1228
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-[var(--radix-select-trigger-width)]"
1229
+ ),
1230
+ children
1231
+ }
1232
+ ),
1233
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
1234
+ ]
1235
+ }
1236
+ ) }));
1237
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
1238
+ var Separator2 = React4.forwardRef(
1239
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
1240
+ "div",
1241
+ {
1242
+ className: cn(
1243
+ "shrink-0 bg-gray",
1244
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
1245
+ className
1246
+ ),
1247
+ "data-orientation": orientation,
1248
+ ref,
1249
+ role: decorative ? "none" : "separator",
1250
+ ...props
1251
+ }
1252
+ )
1253
+ );
1254
+ Separator2.displayName = "Separator";
1255
+ var XIcon = (props) => /* @__PURE__ */ jsx(
1256
+ "svg",
1257
+ {
1258
+ className: "size-6",
1259
+ fill: "none",
1260
+ height: "24",
1261
+ viewBox: "0 0 24 24",
1262
+ width: "24",
1263
+ xmlns: "http://www.w3.org/2000/svg",
1264
+ ...props,
1265
+ children: /* @__PURE__ */ jsx(
1266
+ "path",
1267
+ {
1268
+ d: "M12 13.4L7.1 18.3C6.91667 18.4833 6.68333 18.575 6.4 18.575C6.11667 18.575 5.88333 18.4833 5.7 18.3C5.51667 18.1167 5.425 17.8833 5.425 17.6C5.425 17.3167 5.51667 17.0833 5.7 16.9L10.6 12L5.7 7.09999C5.51667 6.91665 5.425 6.68332 5.425 6.39999C5.425 6.11665 5.51667 5.88332 5.7 5.69999C5.88333 5.51665 6.11667 5.42499 6.4 5.42499C6.68333 5.42499 6.91667 5.51665 7.1 5.69999L12 10.6L16.9 5.69999C17.0833 5.51665 17.3167 5.42499 17.6 5.42499C17.8833 5.42499 18.1167 5.51665 18.3 5.69999C18.4833 5.88332 18.575 6.11665 18.575 6.39999C18.575 6.68332 18.4833 6.91665 18.3 7.09999L13.4 12L18.3 16.9C18.4833 17.0833 18.575 17.3167 18.575 17.6C18.575 17.8833 18.4833 18.1167 18.3 18.3C18.1167 18.4833 17.8833 18.575 17.6 18.575C17.3167 18.575 17.0833 18.4833 16.9 18.3L12 13.4Z",
1269
+ fill: "currentColor"
1270
+ }
1271
+ )
1272
+ }
1273
+ );
1274
+ var Sheet = SheetPrimitive.Root;
1275
+ var SheetTrigger = SheetPrimitive.Trigger;
1276
+ var SheetClose = SheetPrimitive.Close;
1277
+ var SheetPortal = SheetPrimitive.Portal;
1278
+ var SheetOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1279
+ SheetPrimitive.Overlay,
1280
+ {
1281
+ className: cn(
1282
+ "fixed inset-0 z-50 bg-black-a6 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1283
+ className
1284
+ ),
1285
+ ref,
1286
+ ...props
1287
+ }
1288
+ ));
1289
+ SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
1290
+ var sheetVariants = cva(
1291
+ "fixed z-50 gap-4 bg-slate-2 shadow-lg transition ease-in-out p-safe-offset-6 data-[state=closed]:duration-300 data-[state=open]:duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out",
1292
+ {
1293
+ variants: {
1294
+ side: {
1295
+ top: "inset-x-0 top-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1296
+ bottom: "inset-x-0 bottom-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1297
+ left: "inset-y-0 left-0 h-full w-3/4 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1298
+ right: "inset-y-0 right-0 h-full w-3/4 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
1299
+ }
1300
+ },
1301
+ defaultVariants: {
1302
+ side: "right"
1303
+ }
1304
+ }
1305
+ );
1306
+ var SheetContent = React4.forwardRef(({ side = "right", className, children, closeLabel, closeClassName, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
1307
+ /* @__PURE__ */ jsx(SheetOverlay, {}),
1308
+ /* @__PURE__ */ jsxs(
1309
+ SheetPrimitive.Content,
1310
+ {
1311
+ className: cn("text-gray", sheetVariants({ side }), className),
1312
+ ref,
1313
+ ...props,
1314
+ children: [
1315
+ closeLabel ? /* @__PURE__ */ jsxs(
1316
+ SheetPrimitive.Close,
1317
+ {
1318
+ className: cn(
1319
+ "inline-flex w-fit items-center gap-1 rounded-sm p-1 text-sm font-bold text-spark-a11 transition-colors focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-0 disabled:pointer-events-none hover:text-spark-a12",
1320
+ closeClassName
1321
+ ),
1322
+ children: [
1323
+ /* @__PURE__ */ jsx(XIcon, {}),
1324
+ /* @__PURE__ */ jsx("span", { children: closeLabel })
1325
+ ]
1326
+ }
1327
+ ) : /* @__PURE__ */ jsx(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity focus:outline-hidden focus:ring focus-visible:ring disabled:pointer-events-none data-[state=open]:bg-base-gray-soft hover:opacity-100", children: /* @__PURE__ */ jsx(XIcon, {}) }),
1328
+ children
1329
+ ]
1330
+ }
1331
+ )
1332
+ ] }));
1333
+ SheetContent.displayName = SheetPrimitive.Content.displayName;
1334
+ var SheetHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props });
1335
+ SheetHeader.displayName = "SheetHeader";
1336
+ var SheetFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
1337
+ "div",
1338
+ {
1339
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
1340
+ ...props
1341
+ }
1342
+ );
1343
+ SheetFooter.displayName = "SheetFooter";
1344
+ var SheetTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1345
+ SheetPrimitive.Title,
1346
+ {
1347
+ className: cn("text-lg font-semibold text-gray", className),
1348
+ ref,
1349
+ ...props
1350
+ }
1351
+ ));
1352
+ SheetTitle.displayName = SheetPrimitive.Title.displayName;
1353
+ var SheetDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1354
+ SheetPrimitive.Description,
1355
+ {
1356
+ className: cn("text-sm text-gray-light", className),
1357
+ ref,
1358
+ ...props
1359
+ }
1360
+ ));
1361
+ SheetDescription.displayName = SheetPrimitive.Description.displayName;
1362
+ var Slider = React4.forwardRef(
1363
+ ({ className, hint, min = 0, max = 100, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2", children: [
1364
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex gap-0.75 pr-2 text-sm text-gray-light", children: [
1365
+ min,
1366
+ hint ? /* @__PURE__ */ jsx("span", { children: hint }) : null
1367
+ ] }),
1368
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(
1369
+ SliderPrimitive.Root,
1370
+ {
1371
+ className: cn("relative flex h-5 touch-none select-none items-center", className),
1372
+ max,
1373
+ min,
1374
+ ref,
1375
+ ...props,
1376
+ children: [
1377
+ /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-[5px] w-full grow rounded-md bg-slate-a7", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full rounded-md bg-base-accent-solid outline-hidden focus:outline-hidden" }) }),
1378
+ /* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block size-4 rounded-circle bg-base-accent-solid outline-hidden ring-4 ring-spark-a8 ring-offset-2 ring-offset-spark-3 focus:outline-hidden dark:ring-offset-white-contrast" })
1379
+ ]
1380
+ }
1381
+ ) }),
1382
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex gap-0.75 pl-2 text-sm text-gray-light", children: [
1383
+ max,
1384
+ hint ? /* @__PURE__ */ jsx("span", { children: hint }) : null
1385
+ ] })
1386
+ ] })
1387
+ );
1388
+ Slider.displayName = "Slider";
1389
+ var CloseIcon = (props) => /* @__PURE__ */ jsx(
1390
+ "svg",
1391
+ {
1392
+ fill: "none",
1393
+ height: "12",
1394
+ viewBox: "0 0 12 12",
1395
+ width: "12",
1396
+ xmlns: "http://www.w3.org/2000/svg",
1397
+ ...props,
1398
+ children: /* @__PURE__ */ jsx("g", { opacity: "0.6", children: /* @__PURE__ */ jsx(
1399
+ "path",
1400
+ {
1401
+ d: "M6.00003 6.6999L3.55002 9.1499C3.45836 9.24157 3.34169 9.2874 3.20002 9.2874C3.05836 9.2874 2.94169 9.24157 2.85002 9.1499C2.75836 9.05824 2.71252 8.94157 2.71252 8.7999C2.71252 8.65824 2.75836 8.54157 2.85002 8.4499L5.30002 5.9999L2.85002 3.5499C2.75836 3.45824 2.71252 3.34157 2.71252 3.1999C2.71252 3.05824 2.75836 2.94157 2.85002 2.8499C2.94169 2.75824 3.05836 2.7124 3.20002 2.7124C3.34169 2.7124 3.45836 2.75824 3.55002 2.8499L6.00003 5.2999L8.45003 2.8499C8.54169 2.75824 8.65836 2.7124 8.80003 2.7124C8.94169 2.7124 9.05836 2.75824 9.15003 2.8499C9.24169 2.94157 9.28753 3.05824 9.28753 3.1999C9.28753 3.34157 9.24169 3.45824 9.15003 3.5499L6.70002 5.9999L9.15003 8.4499C9.24169 8.54157 9.28753 8.65824 9.28753 8.7999C9.28753 8.94157 9.24169 9.05824 9.15003 9.1499C9.05836 9.24157 8.94169 9.2874 8.80003 9.2874C8.65836 9.2874 8.54169 9.24157 8.45003 9.1499L6.00003 6.6999Z",
1402
+ fill: "currentColor"
1403
+ }
1404
+ ) })
1405
+ }
1406
+ );
1407
+ var CheckIcon2 = (props) => /* @__PURE__ */ jsx(
1408
+ "svg",
1409
+ {
1410
+ fill: "none",
1411
+ height: "12",
1412
+ viewBox: "0 0 12 12",
1413
+ width: "12",
1414
+ xmlns: "http://www.w3.org/2000/svg",
1415
+ ...props,
1416
+ children: /* @__PURE__ */ jsx(
1417
+ "path",
1418
+ {
1419
+ d: "M4.77498 7.575L9.01248 3.3375C9.11248 3.2375 9.22915 3.1875 9.36248 3.1875C9.49582 3.1875 9.61248 3.2375 9.71248 3.3375C9.81248 3.4375 9.86248 3.55625 9.86248 3.69375C9.86248 3.83125 9.81248 3.95 9.71248 4.05L5.12498 8.65C5.02498 8.75 4.90832 8.8 4.77498 8.8C4.64165 8.8 4.52498 8.75 4.42498 8.65L2.27498 6.5C2.17498 6.4 2.12706 6.28125 2.13123 6.14375C2.1354 6.00625 2.18748 5.8875 2.28748 5.7875C2.38748 5.6875 2.50623 5.6375 2.64373 5.6375C2.78123 5.6375 2.89998 5.6875 2.99998 5.7875L4.77498 7.575Z",
1420
+ fill: "currentColor"
1421
+ }
1422
+ )
1423
+ }
1424
+ );
1425
+ var Switch = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1426
+ SwitchPrimitives.Root,
1427
+ {
1428
+ className: cn(
1429
+ "peer inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-circle border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-base-accent-solid data-[state=unchecked]:bg-base-accent-soft",
1430
+ className
1431
+ ),
1432
+ ref,
1433
+ ...props,
1434
+ children: /* @__PURE__ */ jsx(
1435
+ SwitchPrimitives.Thumb,
1436
+ {
1437
+ className: cn(
1438
+ "pointer-events-none inline-flex h-5 w-5 items-center justify-center rounded-circle bg-white-contrast shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
1439
+ ),
1440
+ children: props.checked ? /* @__PURE__ */ jsx(CheckIcon2, { className: "text-accent-active dark:text-spark-8", role: "presentation" }) : /* @__PURE__ */ jsx(CloseIcon, { className: "text-gray-light dark:text-slate-8", role: "presentation" })
1441
+ }
1442
+ )
1443
+ }
1444
+ ));
1445
+ Switch.displayName = "Switch";
1446
+ var Tabs = TabsPrimitive.Root;
1447
+ var tabsListVariants = {
1448
+ default: "inline-flex h-10 items-center justify-center gap-1",
1449
+ underline: "inline-flex h-10 items-center gap-4 border-b border-gray",
1450
+ pill: "inline-flex h-10 items-center gap-0 rounded-lg bg-slate-a3 p-1"
1451
+ };
1452
+ var TabsList = React4.forwardRef(({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(
1453
+ TabsPrimitive.List,
1454
+ {
1455
+ className: cn(tabsListVariants[variant], className),
1456
+ "data-variant": variant,
1457
+ ref,
1458
+ ...props
1459
+ }
1460
+ ));
1461
+ TabsList.displayName = TabsPrimitive.List.displayName;
1462
+ var tabsTriggerBase = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all duration-200 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50";
1463
+ var tabsTriggerVariants = {
1464
+ default: "rounded-sm px-3 py-1.5 text-gray-light data-[state=active]:text-accent-active",
1465
+ underline: "relative px-1 pb-2.5 text-gray-light data-[state=active]:text-accent-active after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-full after:scale-x-0 after:bg-base-accent-solid after:transition-transform data-[state=active]:after:scale-x-100",
1466
+ pill: "rounded-md px-4 py-1.5 text-gray-light data-[state=active]:bg-slate-1 data-[state=active]:text-accent-active data-[state=active]:shadow-sm"
1467
+ };
1468
+ var TabsTrigger = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1469
+ TabsPrimitive.Trigger,
1470
+ {
1471
+ className: cn(
1472
+ tabsTriggerBase,
1473
+ // Auto-detect variant from parent via CSS — fallback to default styling.
1474
+ // The variant-specific classes are applied via group selectors.
1475
+ "group-data-[variant=underline]:relative group-data-[variant=underline]:px-1 group-data-[variant=underline]:pb-2.5",
1476
+ tabsTriggerVariants.default,
1477
+ className
1478
+ ),
1479
+ ref,
1480
+ ...props,
1481
+ children: props.children
1482
+ }
1483
+ ));
1484
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
1485
+ var TabsTriggerUnderline = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1486
+ TabsPrimitive.Trigger,
1487
+ {
1488
+ className: cn(tabsTriggerBase, tabsTriggerVariants.underline, className),
1489
+ ref,
1490
+ ...props
1491
+ }
1492
+ ));
1493
+ TabsTriggerUnderline.displayName = "TabsTriggerUnderline";
1494
+ var TabsTriggerPill = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1495
+ TabsPrimitive.Trigger,
1496
+ {
1497
+ className: cn(tabsTriggerBase, tabsTriggerVariants.pill, className),
1498
+ ref,
1499
+ ...props
1500
+ }
1501
+ ));
1502
+ TabsTriggerPill.displayName = "TabsTriggerPill";
1503
+ var TabsContent = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1504
+ TabsPrimitive.Content,
1505
+ {
1506
+ className: cn(
1507
+ "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-0",
1508
+ className
1509
+ ),
1510
+ ref,
1511
+ ...props
1512
+ }
1513
+ ));
1514
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
252
1515
 
253
- export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, CardSkeleton, CardTitle, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayField, DisplayFieldContent, DisplayFieldLabel, DisplayFieldSkeleton, DisplayFieldValue, buttonVariants, cn };
1516
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Badge, Button, Callout, Card, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, CardSkeleton, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayField, DisplayFieldContent, DisplayFieldLabel, DisplayFieldSkeleton, DisplayFieldValue, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, EnergyFlowChart, Input, Label, LineChart, Popover, PopoverContent, PopoverTrigger, Progress, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectTriggerIcon, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Slider, Switch, Tabs, TabsContent, TabsList, TabsTrigger, TabsTriggerPill, TabsTriggerUnderline, buttonVariants, cn, sheetVariants };
254
1517
  //# sourceMappingURL=index.js.map
255
1518
  //# sourceMappingURL=index.js.map