anvilui 0.0.0-stage → 0.1.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -2
  3. package/dist/colors/colors.d.ts +16 -0
  4. package/dist/components/AnvilRoot/AnvilContext.d.ts +14 -0
  5. package/dist/components/AnvilRoot/AnvilRoot.d.ts +18 -0
  6. package/dist/components/AppBar/AppBar.d.ts +34 -0
  7. package/dist/components/Avatar/Avatar.d.ts +23 -0
  8. package/dist/components/Badge/Badge.d.ts +19 -0
  9. package/dist/components/BottomSheet/BottomSheet.d.ts +19 -0
  10. package/dist/components/Button/Button.d.ts +18 -0
  11. package/dist/components/Card/Card.d.ts +21 -0
  12. package/dist/components/Checkbox/Checkbox.d.ts +4 -0
  13. package/dist/components/Chip/Chip.d.ts +23 -0
  14. package/dist/components/Dialog/Dialog.d.ts +24 -0
  15. package/dist/components/Divider/Divider.d.ts +16 -0
  16. package/dist/components/FAB/FAB.d.ts +24 -0
  17. package/dist/components/Field/Field.d.ts +16 -0
  18. package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +22 -0
  19. package/dist/components/HoldButton/HoldButton.d.ts +15 -0
  20. package/dist/components/Icon/Icon.d.ts +7 -0
  21. package/dist/components/IconButton/IconButton.d.ts +11 -0
  22. package/dist/components/Input/Input.d.ts +15 -0
  23. package/dist/components/List/List.d.ts +26 -0
  24. package/dist/components/Menu/Menu.d.ts +22 -0
  25. package/dist/components/NavigationBar/NavigationBar.d.ts +20 -0
  26. package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +30 -0
  27. package/dist/components/NavigationRail/NavigationRail.d.ts +32 -0
  28. package/dist/components/Popover/Popover.d.ts +21 -0
  29. package/dist/components/Progress/Progress.d.ts +22 -0
  30. package/dist/components/RadioGroup/RadioGroup.d.ts +7 -0
  31. package/dist/components/Select/Select.d.ts +25 -0
  32. package/dist/components/Slider/Slider.d.ts +26 -0
  33. package/dist/components/Snackbar/Snackbar.d.ts +30 -0
  34. package/dist/components/SplitButton/SplitButton.d.ts +3 -0
  35. package/dist/components/SquigglyWave/SquigglyWave.d.ts +36 -0
  36. package/dist/components/Switch/Switch.d.ts +4 -0
  37. package/dist/components/Tabs/Tabs.d.ts +15 -0
  38. package/dist/components/Textarea/Textarea.d.ts +16 -0
  39. package/dist/components/ToggleGroup/ToggleGroup.d.ts +38 -0
  40. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  41. package/dist/components/Typography/Typography.d.ts +10 -0
  42. package/dist/index.cjs +2948 -0
  43. package/dist/index.cjs.map +1 -0
  44. package/dist/index.css +2671 -0
  45. package/dist/index.css.map +1 -0
  46. package/dist/index.d.ts +83 -0
  47. package/dist/index.js +2852 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/morph.d.ts +64 -0
  50. package/dist/themes/baseTheme.d.ts +3 -0
  51. package/dist/themes/monochromeTheme.d.ts +3 -0
  52. package/dist/themes/toCssVariables.d.ts +2 -0
  53. package/dist/themes/types.d.ts +51 -0
  54. package/dist/tokens/baseTokens.d.ts +2 -0
  55. package/dist/tokens/toCssVariables.d.ts +2 -0
  56. package/dist/tokens/types.d.ts +46 -0
  57. package/dist/utils.d.ts +4 -0
  58. package/package.json +45 -5
package/dist/index.js ADDED
@@ -0,0 +1,2852 @@
1
+ // src/colors/colors.ts
2
+ function colorClass(color = "primary", fillType = "filled") {
3
+ return `avl-color-${color} avl-fill-${fillType} `;
4
+ }
5
+
6
+ // src/utils.ts
7
+ function cx(...parts) {
8
+ return parts.filter(Boolean).join(" ");
9
+ }
10
+ function withClass(base, className) {
11
+ return (state) => cx(base, typeof className === "function" ? className(state) : className);
12
+ }
13
+ function mergeRefs(...refs) {
14
+ return (value) => {
15
+ for (const ref of refs) {
16
+ if (typeof ref === "function") ref(value);
17
+ else if (ref) ref.current = value;
18
+ }
19
+ };
20
+ }
21
+
22
+ // src/components/Typography/Typography.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ var tags = {
25
+ body: "p",
26
+ caption: "span",
27
+ h1: "h1",
28
+ h2: "h2",
29
+ h3: "h3",
30
+ h4: "h4",
31
+ h5: "h5",
32
+ h6: "h6"
33
+ };
34
+ function Typography({
35
+ type = "body",
36
+ as,
37
+ className,
38
+ ...props
39
+ }) {
40
+ const Tag = as ?? tags[type];
41
+ return /* @__PURE__ */ jsx(
42
+ Tag,
43
+ {
44
+ ...props,
45
+ className: cx(`avl-typography avl-typography-${type}`, className)
46
+ }
47
+ );
48
+ }
49
+
50
+ // src/components/AppBar/AppBar.tsx
51
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
52
+ function AppBar({
53
+ label,
54
+ labelAs = "div",
55
+ start,
56
+ end,
57
+ size = "normal",
58
+ centered = false,
59
+ // Not the library's usual primary: the bar frames the page, like navigation
60
+ color = "container",
61
+ fillType = "filled",
62
+ className,
63
+ ...props
64
+ }) {
65
+ return /* @__PURE__ */ jsxs(
66
+ "header",
67
+ {
68
+ ...props,
69
+ className: cx(
70
+ "avl-app-bar",
71
+ colorClass(color, fillType),
72
+ `avl-app-bar-size-${size}`,
73
+ centered && size === "normal" && "avl-app-bar-centered",
74
+ className
75
+ ),
76
+ children: [
77
+ /* @__PURE__ */ jsx2("div", { className: "avl-app-bar-start", children: start }),
78
+ /* @__PURE__ */ jsx2(
79
+ Typography,
80
+ {
81
+ as: labelAs,
82
+ type: size === "big" ? "h5" : "h6",
83
+ className: "avl-app-bar-label",
84
+ children: label
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx2("div", { className: "avl-app-bar-end", children: end })
88
+ ]
89
+ }
90
+ );
91
+ }
92
+
93
+ // src/components/Avatar/Avatar.tsx
94
+ import { Avatar as BaseAvatar } from "@base-ui/react/avatar";
95
+
96
+ // src/components/Icon/Icon.tsx
97
+ import "material-symbols/rounded.css";
98
+ import { jsx as jsx3 } from "react/jsx-runtime";
99
+ function Icon({ name, ...props }) {
100
+ const labelled = props["aria-label"] || props["aria-labelledby"];
101
+ return /* @__PURE__ */ jsx3(
102
+ "span",
103
+ {
104
+ "aria-hidden": labelled ? void 0 : true,
105
+ role: labelled ? "img" : void 0,
106
+ ...props,
107
+ className: cx("avl-icon material-symbols-rounded", props.className),
108
+ children: name
109
+ }
110
+ );
111
+ }
112
+
113
+ // src/components/Avatar/Avatar.tsx
114
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
115
+ function initials(name) {
116
+ const words = name.trim().split(/\s+/).filter(Boolean);
117
+ if (words.length === 0) return "";
118
+ const first = [...words[0]][0];
119
+ const last = words.length > 1 ? [...words[words.length - 1]][0] : "";
120
+ return (first + last).toUpperCase();
121
+ }
122
+ function Avatar({
123
+ src,
124
+ name,
125
+ icon = "person",
126
+ size = "normal",
127
+ color,
128
+ fillType,
129
+ className,
130
+ children,
131
+ ...props
132
+ }) {
133
+ const letters = name ? initials(name) : "";
134
+ return /* @__PURE__ */ jsxs2(
135
+ BaseAvatar.Root,
136
+ {
137
+ role: name ? "img" : void 0,
138
+ "aria-label": name,
139
+ "aria-hidden": name ? void 0 : true,
140
+ ...props,
141
+ className: withClass(
142
+ cx(
143
+ "avl-avatar",
144
+ colorClass(color, fillType),
145
+ `avl-avatar-size-${size}`
146
+ ),
147
+ className
148
+ ),
149
+ children: [
150
+ src && /* @__PURE__ */ jsx4(
151
+ BaseAvatar.Image,
152
+ {
153
+ src,
154
+ alt: "",
155
+ className: "avl-avatar-image"
156
+ }
157
+ ),
158
+ /* @__PURE__ */ jsx4(
159
+ BaseAvatar.Fallback,
160
+ {
161
+ delay: src ? 600 : void 0,
162
+ className: "avl-avatar-fallback",
163
+ "aria-hidden": true,
164
+ children: children ?? (letters || /* @__PURE__ */ jsx4(Icon, { name: icon }))
165
+ }
166
+ )
167
+ ]
168
+ }
169
+ );
170
+ }
171
+
172
+ // src/components/Badge/Badge.tsx
173
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
174
+ function Badge({
175
+ count: count2,
176
+ max = 999,
177
+ // Not the library's usual primary: Material badges are error-colored
178
+ color = "error",
179
+ className,
180
+ children,
181
+ ...props
182
+ }) {
183
+ const badge = count2 === 0 ? null : /* @__PURE__ */ jsx5(
184
+ "span",
185
+ {
186
+ "aria-hidden": true,
187
+ className: cx(
188
+ "avl-badge",
189
+ colorClass(color, "filled"),
190
+ count2 === void 0 && "avl-badge-dot",
191
+ !children && className
192
+ ),
193
+ ...!children && props,
194
+ children: count2 !== void 0 && (count2 > max ? `${max}+` : count2)
195
+ }
196
+ );
197
+ if (!children) return badge;
198
+ return /* @__PURE__ */ jsxs3("span", { ...props, className: cx("avl-badge-anchor", className), children: [
199
+ children,
200
+ badge
201
+ ] });
202
+ }
203
+
204
+ // src/components/BottomSheet/BottomSheet.tsx
205
+ import { useContext } from "react";
206
+ import { Drawer } from "@base-ui/react/drawer";
207
+
208
+ // src/components/AnvilRoot/AnvilContext.ts
209
+ import { createContext } from "react";
210
+ var AnvilContext = createContext(null);
211
+
212
+ // src/components/BottomSheet/BottomSheet.tsx
213
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
214
+ function BottomSheet(props) {
215
+ return /* @__PURE__ */ jsx6(Drawer.Root, { ...props, swipeDirection: "down" });
216
+ }
217
+ function BottomSheetTrigger({
218
+ className,
219
+ ...props
220
+ }) {
221
+ return /* @__PURE__ */ jsx6(
222
+ Drawer.Trigger,
223
+ {
224
+ ...props,
225
+ className: withClass("avl-bottom-sheet-trigger", className)
226
+ }
227
+ );
228
+ }
229
+ function BottomSheetPopup({
230
+ className,
231
+ children,
232
+ ...props
233
+ }) {
234
+ const avl = useContext(AnvilContext);
235
+ return (
236
+ // Into the AnvilRoot, not body, so the sheet sees the theme variables
237
+ /* @__PURE__ */ jsxs4(Drawer.Portal, { container: avl?.rootRef, children: [
238
+ /* @__PURE__ */ jsx6(Drawer.Backdrop, { className: "avl-bottom-sheet-backdrop" }),
239
+ /* @__PURE__ */ jsx6(Drawer.Viewport, { className: "avl-bottom-sheet-viewport", children: /* @__PURE__ */ jsxs4(
240
+ Drawer.Popup,
241
+ {
242
+ ...props,
243
+ className: withClass("avl-bottom-sheet-popup", className),
244
+ children: [
245
+ /* @__PURE__ */ jsx6("div", { className: "avl-bottom-sheet-handle", "aria-hidden": true }),
246
+ /* @__PURE__ */ jsx6(Drawer.Content, { className: "avl-bottom-sheet-content", children })
247
+ ]
248
+ }
249
+ ) })
250
+ ] })
251
+ );
252
+ }
253
+ function BottomSheetTitle({
254
+ className,
255
+ ...props
256
+ }) {
257
+ return /* @__PURE__ */ jsx6(
258
+ Drawer.Title,
259
+ {
260
+ ...props,
261
+ className: withClass("avl-bottom-sheet-title", className)
262
+ }
263
+ );
264
+ }
265
+ function BottomSheetDescription({
266
+ className,
267
+ ...props
268
+ }) {
269
+ return /* @__PURE__ */ jsx6(
270
+ Drawer.Description,
271
+ {
272
+ ...props,
273
+ className: withClass("avl-bottom-sheet-description", className)
274
+ }
275
+ );
276
+ }
277
+ function BottomSheetClose({
278
+ className,
279
+ ...props
280
+ }) {
281
+ return /* @__PURE__ */ jsx6(
282
+ Drawer.Close,
283
+ {
284
+ ...props,
285
+ className: withClass("avl-bottom-sheet-close", className)
286
+ }
287
+ );
288
+ }
289
+
290
+ // src/components/Button/Button.tsx
291
+ import { useLayoutEffect, useRef } from "react";
292
+ import {
293
+ Button as BaseButton
294
+ } from "@base-ui/react/button";
295
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
296
+ function Button({
297
+ size,
298
+ fillType,
299
+ color,
300
+ startIcon,
301
+ endIcon,
302
+ loading,
303
+ disabled,
304
+ children,
305
+ className,
306
+ ref,
307
+ ...props
308
+ }) {
309
+ const local = useRef(null);
310
+ useAnimatedWidth(local, loading !== void 0);
311
+ return /* @__PURE__ */ jsxs5(
312
+ BaseButton,
313
+ {
314
+ ...props,
315
+ ref: mergeRefs(local, ref),
316
+ disabled: disabled || loading,
317
+ focusableWhenDisabled: loading && !disabled || props.focusableWhenDisabled,
318
+ "aria-busy": loading || void 0,
319
+ className: withClass(
320
+ `avl-button ${colorClass(color, fillType)} avl-button-size-${size || "normal"}`,
321
+ className
322
+ ),
323
+ children: [
324
+ loading ? /* @__PURE__ */ jsx7(
325
+ "svg",
326
+ {
327
+ className: "avl-button-spinner",
328
+ viewBox: "0 0 24 24",
329
+ "aria-hidden": true,
330
+ children: /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "8", pathLength: 100 })
331
+ }
332
+ ) : startIcon && /* @__PURE__ */ jsx7(Icon, { name: startIcon }),
333
+ children,
334
+ endIcon && /* @__PURE__ */ jsx7(Icon, { name: endIcon })
335
+ ]
336
+ }
337
+ );
338
+ }
339
+ function useAnimatedWidth(ref, enabled) {
340
+ const lastWidth = useRef(null);
341
+ const running = useRef(null);
342
+ useLayoutEffect(() => {
343
+ const el = ref.current;
344
+ if (!el || !enabled) return;
345
+ const from = running.current?.playState === "running" ? el.offsetWidth : lastWidth.current;
346
+ running.current?.cancel();
347
+ const to = el.offsetWidth;
348
+ lastWidth.current = to;
349
+ if (from == null || Math.abs(from - to) < 1) return;
350
+ const style = getComputedStyle(el);
351
+ const length = style.getPropertyValue("--avl-ease-length-normal").trim();
352
+ const animation = el.animate(
353
+ { width: [`${from}px`, `${to}px`] },
354
+ {
355
+ duration: (parseFloat(length) || 0) * (length.endsWith("ms") ? 1 : 1e3),
356
+ easing: style.getPropertyValue("--avl-ease-out")
357
+ }
358
+ );
359
+ running.current = animation;
360
+ el.style.overflow = "hidden";
361
+ el.style.whiteSpace = "nowrap";
362
+ const done = () => {
363
+ if (running.current !== animation) return;
364
+ el.style.overflow = "";
365
+ el.style.whiteSpace = "";
366
+ };
367
+ animation.onfinish = done;
368
+ animation.oncancel = done;
369
+ });
370
+ }
371
+
372
+ // src/components/SplitButton/SplitButton.tsx
373
+ import { jsx as jsx8 } from "react/jsx-runtime";
374
+ function SplitButton({ className, ...props }) {
375
+ return /* @__PURE__ */ jsx8(
376
+ "div",
377
+ {
378
+ role: "group",
379
+ ...props,
380
+ className: cx("avl-split-button", className)
381
+ }
382
+ );
383
+ }
384
+
385
+ // src/components/HoldButton/HoldButton.tsx
386
+ import { useEffect, useRef as useRef2, useState } from "react";
387
+ import { jsx as jsx9 } from "react/jsx-runtime";
388
+ function HoldButton({
389
+ onConfirm,
390
+ holdDuration = 1500,
391
+ className,
392
+ style,
393
+ disabled,
394
+ onPointerDown,
395
+ onPointerUp,
396
+ onPointerLeave,
397
+ onPointerCancel,
398
+ onKeyDown,
399
+ onKeyUp,
400
+ onClick,
401
+ onContextMenu,
402
+ ...props
403
+ }) {
404
+ const [state, setState] = useState("idle");
405
+ const [nudges, setNudges] = useState(0);
406
+ const timer = useRef2(void 0);
407
+ const pressed = useRef2(false);
408
+ useEffect(() => () => clearTimeout(timer.current), []);
409
+ const confirm = () => {
410
+ setState("confirmed");
411
+ onConfirm();
412
+ timer.current = setTimeout(() => setState("idle"), 600);
413
+ };
414
+ const start = () => {
415
+ if (disabled || state !== "idle") return;
416
+ setState("holding");
417
+ timer.current = setTimeout(confirm, holdDuration);
418
+ };
419
+ const cancel = () => {
420
+ if (state !== "holding") return;
421
+ clearTimeout(timer.current);
422
+ setState("idle");
423
+ setNudges((n) => n + 1);
424
+ };
425
+ return /* @__PURE__ */ jsx9(
426
+ Button,
427
+ {
428
+ ...props,
429
+ disabled,
430
+ "aria-description": "Press and hold to confirm",
431
+ "data-hold": state === "idle" ? void 0 : state,
432
+ "data-nudge": nudges % 2 === 0 ? "even" : "odd",
433
+ className: (buttonState) => cx(
434
+ "avl-hold-button",
435
+ nudges > 0 && "avl-hold-button-nudged",
436
+ typeof className === "function" ? className(buttonState) : className
437
+ ),
438
+ style: (buttonState) => ({
439
+ "--avl-hold-duration": `${holdDuration}ms`,
440
+ ...typeof style === "function" ? style(buttonState) : style
441
+ }),
442
+ onPointerDown: (event) => {
443
+ onPointerDown?.(event);
444
+ if (event.button !== 0) return;
445
+ pressed.current = true;
446
+ start();
447
+ },
448
+ onPointerUp: (event) => {
449
+ onPointerUp?.(event);
450
+ cancel();
451
+ },
452
+ onPointerLeave: (event) => {
453
+ onPointerLeave?.(event);
454
+ pressed.current = false;
455
+ cancel();
456
+ },
457
+ onPointerCancel: (event) => {
458
+ onPointerCancel?.(event);
459
+ pressed.current = false;
460
+ cancel();
461
+ },
462
+ onKeyDown: (event) => {
463
+ onKeyDown?.(event);
464
+ if (event.key !== " " && event.key !== "Enter") return;
465
+ event.preventDefault();
466
+ if (!event.repeat) start();
467
+ },
468
+ onKeyUp: (event) => {
469
+ onKeyUp?.(event);
470
+ if (event.key !== " " && event.key !== "Enter") return;
471
+ event.preventDefault();
472
+ cancel();
473
+ },
474
+ onContextMenu: (event) => {
475
+ onContextMenu?.(event);
476
+ if (state === "holding") event.preventDefault();
477
+ },
478
+ onClick: (event) => {
479
+ onClick?.(event);
480
+ if (pressed.current) {
481
+ pressed.current = false;
482
+ return;
483
+ }
484
+ if (!disabled && state === "idle") confirm();
485
+ }
486
+ }
487
+ );
488
+ }
489
+
490
+ // src/components/Card/Card.tsx
491
+ import {
492
+ Button as BaseButton2
493
+ } from "@base-ui/react/button";
494
+ import { jsx as jsx10 } from "react/jsx-runtime";
495
+ var nestedControls = [
496
+ "a[href]",
497
+ "button",
498
+ "input",
499
+ "select",
500
+ "textarea",
501
+ "label",
502
+ "summary",
503
+ "[contenteditable]",
504
+ ...[
505
+ "button",
506
+ "link",
507
+ "checkbox",
508
+ "radio",
509
+ "switch",
510
+ "tab",
511
+ "menuitem",
512
+ "option",
513
+ "combobox",
514
+ "slider",
515
+ "textbox",
516
+ "spinbutton"
517
+ ].map((role) => `[role="${role}"]`)
518
+ ].join(",");
519
+ function isFromNestedControl(event) {
520
+ if (!(event.target instanceof Element)) return false;
521
+ const control = event.target.closest(nestedControls);
522
+ return control !== null && control !== event.currentTarget;
523
+ }
524
+ function Card(props) {
525
+ if (props.clickable) return /* @__PURE__ */ jsx10(ClickableCard, { ...props });
526
+ return /* @__PURE__ */ jsx10(StaticCard, { ...props });
527
+ }
528
+ function StaticCard({
529
+ clickable,
530
+ color = "container",
531
+ fillType = "filled",
532
+ className,
533
+ ...props
534
+ }) {
535
+ return /* @__PURE__ */ jsx10(
536
+ "div",
537
+ {
538
+ ...props,
539
+ className: cx("avl-card " + colorClass(color, fillType), className)
540
+ }
541
+ );
542
+ }
543
+ function ClickableCard({
544
+ clickable,
545
+ color = "container",
546
+ fillType,
547
+ className,
548
+ onClick,
549
+ ...props
550
+ }) {
551
+ return /* @__PURE__ */ jsx10(
552
+ BaseButton2,
553
+ {
554
+ nativeButton: false,
555
+ render: /* @__PURE__ */ jsx10("div", {}),
556
+ ...props,
557
+ onClick: (event) => {
558
+ if (!isFromNestedControl(event)) onClick?.(event);
559
+ },
560
+ className: withClass(
561
+ "avl-card avl-card-clickable " + colorClass(color, fillType),
562
+ className
563
+ )
564
+ }
565
+ );
566
+ }
567
+ function CardTitle({
568
+ type = "h6",
569
+ as = "div",
570
+ className,
571
+ ...props
572
+ }) {
573
+ return /* @__PURE__ */ jsx10(
574
+ Typography,
575
+ {
576
+ ...props,
577
+ type,
578
+ as,
579
+ className: cx("avl-card-title", className)
580
+ }
581
+ );
582
+ }
583
+ function CardContent({ className, ...props }) {
584
+ return /* @__PURE__ */ jsx10("div", { ...props, className: cx("avl-card-content", className) });
585
+ }
586
+ function CardActions({ className, ...props }) {
587
+ return /* @__PURE__ */ jsx10("div", { ...props, className: cx("avl-card-actions", className) });
588
+ }
589
+
590
+ // src/components/Chip/Chip.tsx
591
+ import {
592
+ Button as BaseButton3
593
+ } from "@base-ui/react/button";
594
+ import { Toggle } from "@base-ui/react/toggle";
595
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
596
+ function Chip({ startIcon, className, children, ...props }) {
597
+ return /* @__PURE__ */ jsxs6(
598
+ BaseButton3,
599
+ {
600
+ ...props,
601
+ className: withClass(
602
+ cx("avl-chip", startIcon && "avl-chip-has-icon"),
603
+ className
604
+ ),
605
+ children: [
606
+ startIcon && /* @__PURE__ */ jsx11(Icon, { name: startIcon }),
607
+ children
608
+ ]
609
+ }
610
+ );
611
+ }
612
+ function FilterChip({ className, children, ...props }) {
613
+ return /* @__PURE__ */ jsxs6(
614
+ Toggle,
615
+ {
616
+ ...props,
617
+ className: withClass("avl-chip avl-filter-chip", className),
618
+ children: [
619
+ /* @__PURE__ */ jsx11(Icon, { name: "check", className: "avl-filter-chip-check" }),
620
+ children
621
+ ]
622
+ }
623
+ );
624
+ }
625
+ function InputChip({
626
+ onRemove,
627
+ removeLabel = "Remove",
628
+ startIcon,
629
+ disabled,
630
+ className,
631
+ children,
632
+ ...props
633
+ }) {
634
+ return /* @__PURE__ */ jsxs6(
635
+ "span",
636
+ {
637
+ ...props,
638
+ className: cx(
639
+ "avl-chip avl-input-chip",
640
+ startIcon && "avl-chip-has-icon",
641
+ className
642
+ ),
643
+ "data-disabled": disabled || void 0,
644
+ children: [
645
+ startIcon && /* @__PURE__ */ jsx11(Icon, { name: startIcon }),
646
+ children,
647
+ /* @__PURE__ */ jsx11(
648
+ BaseButton3,
649
+ {
650
+ className: "avl-input-chip-remove",
651
+ "aria-label": removeLabel,
652
+ disabled,
653
+ onClick: onRemove,
654
+ children: /* @__PURE__ */ jsx11(Icon, { name: "close" })
655
+ }
656
+ )
657
+ ]
658
+ }
659
+ );
660
+ }
661
+
662
+ // src/components/Checkbox/Checkbox.tsx
663
+ import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
664
+ import { jsx as jsx12 } from "react/jsx-runtime";
665
+ var CHECK = "M5 12.5 L9.5 17 L19 7.5";
666
+ var DASH = "M6 12 L12 12 L18 12";
667
+ function Checkbox({ className, ...props }) {
668
+ return /* @__PURE__ */ jsx12(
669
+ BaseCheckbox.Root,
670
+ {
671
+ ...props,
672
+ className: withClass("avl-checkbox", className),
673
+ children: /* @__PURE__ */ jsx12(BaseCheckbox.Indicator, { className: "avl-checkbox-indicator", children: /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsx12(
674
+ "path",
675
+ {
676
+ d: props.indeterminate ? DASH : CHECK,
677
+ pathLength: 1
678
+ }
679
+ ) }) })
680
+ }
681
+ );
682
+ }
683
+
684
+ // src/components/Dialog/Dialog.tsx
685
+ import { useContext as useContext2 } from "react";
686
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
687
+
688
+ // src/morph.ts
689
+ import {
690
+ createContext as createContext2,
691
+ useLayoutEffect as useLayoutEffect2,
692
+ useRef as useRef3,
693
+ useState as useState2
694
+ } from "react";
695
+ import { flushSync } from "react-dom";
696
+ var MorphContext = createContext2(null);
697
+ function useMorphOpen({
698
+ morph: morph2,
699
+ open: controlledOpen,
700
+ defaultOpen,
701
+ onOpenChange
702
+ }) {
703
+ const trigger = useRef3(null);
704
+ const popup = useRef3(null);
705
+ const [uncontrolledOpen, setUncontrolledOpen] = useState2(defaultOpen);
706
+ const open = controlledOpen ?? uncontrolledOpen;
707
+ const hideTrigger = (hidden) => trigger.current?.toggleAttribute("data-morph-hidden", hidden);
708
+ useLayoutEffect2(() => {
709
+ if (!open) hideTrigger(false);
710
+ }, [open]);
711
+ const handleOpenChange = (next, details) => {
712
+ const update = () => {
713
+ onOpenChange?.(next, details);
714
+ if (details.isCanceled) return;
715
+ setUncontrolledOpen(next);
716
+ if (morph2) hideTrigger(next);
717
+ };
718
+ const from = next ? trigger.current : popup.current;
719
+ if (!morph2 || !from) {
720
+ update();
721
+ return;
722
+ }
723
+ morphBetween(
724
+ from,
725
+ update,
726
+ () => next ? popup.current : trigger.current
727
+ );
728
+ };
729
+ return {
730
+ open,
731
+ onOpenChange: handleOpenChange,
732
+ refs: morph2 ? { trigger, popup } : null
733
+ };
734
+ }
735
+ function morph(id, update, options) {
736
+ const from = findMorphTarget(id);
737
+ if (!from) {
738
+ update();
739
+ return Promise.resolve();
740
+ }
741
+ return morphBetween(from, update, () => findMorphTarget(id, from), options);
742
+ }
743
+ function findMorphTarget(id, except) {
744
+ const all = document.querySelectorAll(
745
+ `[data-morph-id="${CSS.escape(id)}"]`
746
+ );
747
+ return Array.from(all).find(
748
+ (el) => el !== except && el.getClientRects().length > 0
749
+ ) ?? null;
750
+ }
751
+ var count = 0;
752
+ function morphBetween(from, update, getTo, options = {}) {
753
+ if (!document.startViewTransition || matchMedia("(prefers-reduced-motion: reduce)").matches) {
754
+ update();
755
+ return Promise.resolve();
756
+ }
757
+ const name = `avl-morph-${++count}`;
758
+ const html = document.documentElement;
759
+ const fromStyle = getComputedStyle(from);
760
+ const length = fromStyle.getPropertyValue("--avl-ease-length-slow").trim() || "300ms";
761
+ const duration = options.duration ?? (parseFloat(length) || 300) * (length.endsWith("ms") ? 1 : 1e3);
762
+ const easing = options.easing ?? (fromStyle.getPropertyValue("--avl-ease-smooth").trim() || "ease");
763
+ const fromSurface = surfaceOf(from, fromStyle);
764
+ const style = document.createElement("style");
765
+ style.textContent = morphStyles(name, duration, easing);
766
+ document.head.append(style);
767
+ from.setAttribute("data-morphing", "");
768
+ from.style.setProperty("view-transition-name", name);
769
+ let to = null;
770
+ const transition = document.startViewTransition(async () => {
771
+ flushSync(update);
772
+ await new Promise((resolve) => setTimeout(resolve));
773
+ from.style.removeProperty("view-transition-name");
774
+ to = getTo();
775
+ if (!to) return;
776
+ to.style.setProperty("view-transition-name", name);
777
+ to.setAttribute("data-morphing", "");
778
+ });
779
+ transition.ready.then(() => {
780
+ if (!to) return;
781
+ const toSurface = surfaceOf(to, getComputedStyle(to));
782
+ const group = `::view-transition-group(${name})`;
783
+ html.animate(
784
+ {
785
+ borderRadius: [
786
+ fromSurface.color ? fromSurface.radius : toSurface.radius,
787
+ toSurface.color ? toSurface.radius : fromSurface.radius
788
+ ]
789
+ },
790
+ { duration, easing, fill: "both", pseudoElement: group }
791
+ );
792
+ const color = toSurface.color ? [
793
+ { backgroundColor: fromSurface.color ?? toSurface.color },
794
+ { backgroundColor: toSurface.color }
795
+ ] : [
796
+ { backgroundColor: fromSurface.color ?? "transparent" },
797
+ {
798
+ backgroundColor: fromSurface.color ?? "transparent",
799
+ offset: 0.4
800
+ },
801
+ { backgroundColor: "transparent" }
802
+ ];
803
+ html.animate(
804
+ color.map((frame, i) => ({
805
+ ...frame,
806
+ ...i === 0 && { boxShadow: fromSurface.shadow },
807
+ ...i === color.length - 1 && {
808
+ boxShadow: toSurface.shadow
809
+ }
810
+ })),
811
+ {
812
+ duration,
813
+ easing,
814
+ fill: "both",
815
+ pseudoElement: group
816
+ }
817
+ );
818
+ }).catch(() => {
819
+ });
820
+ return transition.finished.finally(() => {
821
+ for (const el of [from, to]) {
822
+ el?.style.removeProperty("view-transition-name");
823
+ el?.removeAttribute("data-morphing");
824
+ }
825
+ style.remove();
826
+ });
827
+ }
828
+ function surfaceOf(el, style) {
829
+ const color = style.backgroundColor;
830
+ const clear = color === "transparent" || color === "rgba(0, 0, 0, 0)";
831
+ const { width, height } = el.getBoundingClientRect();
832
+ const radius = Math.min(
833
+ parseFloat(style.borderRadius) || 0,
834
+ Math.min(width, height) / 2
835
+ );
836
+ return {
837
+ color: clear ? null : color,
838
+ radius: `${radius}px`,
839
+ shadow: style.boxShadow === "none" ? "0 0 0 transparent" : style.boxShadow
840
+ };
841
+ }
842
+ function morphStyles(name, duration, easing) {
843
+ return `
844
+ ::view-transition-group(${name}) {
845
+ overflow: clip;
846
+ animation-duration: ${duration}ms;
847
+ animation-timing-function: ${easing};
848
+ }
849
+ ::view-transition-image-pair(${name}),
850
+ ::view-transition-old(${name}),
851
+ ::view-transition-new(${name}) {
852
+ animation-duration: ${duration}ms;
853
+ }
854
+ ::view-transition-old(${name}),
855
+ ::view-transition-new(${name}) {
856
+ width: 100%;
857
+ height: 100%;
858
+ object-fit: none;
859
+ object-position: 50% 0;
860
+ mix-blend-mode: normal;
861
+ animation-timing-function: linear;
862
+ }
863
+ ::view-transition-old(${name}) { animation-name: avl-morph-out; }
864
+ ::view-transition-new(${name}) { animation-name: avl-morph-in; }
865
+ `;
866
+ }
867
+
868
+ // src/components/Dialog/Dialog.tsx
869
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
870
+ function Dialog({
871
+ morph: morph2 = false,
872
+ defaultOpen = false,
873
+ ...props
874
+ }) {
875
+ const state = useMorphOpen({
876
+ morph: morph2,
877
+ open: props.open,
878
+ defaultOpen,
879
+ onOpenChange: props.onOpenChange
880
+ });
881
+ return /* @__PURE__ */ jsx13(MorphContext, { value: state.refs, children: /* @__PURE__ */ jsx13(
882
+ BaseDialog.Root,
883
+ {
884
+ ...props,
885
+ open: state.open,
886
+ onOpenChange: state.onOpenChange
887
+ }
888
+ ) });
889
+ }
890
+ function DialogTrigger({
891
+ className,
892
+ ref,
893
+ ...props
894
+ }) {
895
+ const morph2 = useContext2(MorphContext);
896
+ return /* @__PURE__ */ jsx13(
897
+ BaseDialog.Trigger,
898
+ {
899
+ ...props,
900
+ ref: mergeRefs(morph2?.trigger, ref),
901
+ className: withClass("avl-dialog-trigger", className)
902
+ }
903
+ );
904
+ }
905
+ function DialogPopup({ className, ref, ...props }) {
906
+ const avl = useContext2(AnvilContext);
907
+ const morph2 = useContext2(MorphContext);
908
+ return (
909
+ // Into the AnvilRoot, not body, so the popup sees the theme variables
910
+ /* @__PURE__ */ jsxs7(BaseDialog.Portal, { container: avl?.rootRef, children: [
911
+ /* @__PURE__ */ jsx13(BaseDialog.Backdrop, { className: "avl-dialog-backdrop" }),
912
+ /* @__PURE__ */ jsx13(
913
+ BaseDialog.Popup,
914
+ {
915
+ ...props,
916
+ ref: mergeRefs(morph2?.popup, ref),
917
+ className: withClass("avl-dialog-popup", className)
918
+ }
919
+ )
920
+ ] })
921
+ );
922
+ }
923
+ function DialogTitle({ className, ...props }) {
924
+ return /* @__PURE__ */ jsx13(
925
+ BaseDialog.Title,
926
+ {
927
+ ...props,
928
+ className: withClass("avl-dialog-title", className)
929
+ }
930
+ );
931
+ }
932
+ function DialogDescription({
933
+ className,
934
+ ...props
935
+ }) {
936
+ return /* @__PURE__ */ jsx13(
937
+ BaseDialog.Description,
938
+ {
939
+ ...props,
940
+ className: withClass("avl-dialog-description", className)
941
+ }
942
+ );
943
+ }
944
+ function DialogActions({ className, ...props }) {
945
+ return /* @__PURE__ */ jsx13("div", { ...props, className: cx("avl-dialog-actions", className) });
946
+ }
947
+ function DialogClose({ className, ...props }) {
948
+ return /* @__PURE__ */ jsx13(
949
+ BaseDialog.Close,
950
+ {
951
+ ...props,
952
+ className: withClass("avl-dialog-close", className)
953
+ }
954
+ );
955
+ }
956
+
957
+ // src/components/Divider/Divider.tsx
958
+ import { useId } from "react";
959
+ import { Separator } from "@base-ui/react/separator";
960
+
961
+ // src/components/SquigglyWave/SquigglyWave.tsx
962
+ import { useEffect as useEffect2, useRef as useRef4 } from "react";
963
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
964
+ var WAVE_LENGTH = 40;
965
+ var WAVE_AMPLITUDE = 3;
966
+ var WAVE_MIDDLE = 6;
967
+ var STROKE_CAP = 2;
968
+ function wavePath(from, to, phase) {
969
+ const start = from + STROKE_CAP;
970
+ const end = to - STROKE_CAP;
971
+ if (end < start) return "";
972
+ const y = (x) => WAVE_MIDDLE + // + phase: the ripple travels from the leading end back to the start
973
+ WAVE_AMPLITUDE * Math.sin(2 * Math.PI * x / WAVE_LENGTH + phase);
974
+ let d = `M${start} ${y(start)}`;
975
+ for (let x = start + 2; x < end; x += 2) d += `L${x} ${y(x)}`;
976
+ return d + `L${end} ${y(end)}`;
977
+ }
978
+ function linePath(from, to) {
979
+ const start = from + STROKE_CAP;
980
+ const end = to - STROKE_CAP;
981
+ return end < start ? "" : `M${start} ${WAVE_MIDDLE}L${end} ${WAVE_MIDDLE}`;
982
+ }
983
+ function SquigglyWave(props) {
984
+ const svgRef = useRef4(null);
985
+ const waveRef = useRef4(null);
986
+ const restRef = useRef4(null);
987
+ const dotRef = useRef4(null);
988
+ const span = useRef4(props.span);
989
+ span.current = props.span;
990
+ const still = props.still ?? false;
991
+ const vertical = props.vertical ?? false;
992
+ useEffect2(() => {
993
+ const svg = svgRef.current;
994
+ const wave = waveRef.current;
995
+ const rest = restRef.current;
996
+ const dot = dotRef.current;
997
+ if (!svg || !wave || !rest || !dot) return;
998
+ const reduced = still || matchMedia("(prefers-reduced-motion: reduce)").matches;
999
+ const gap = parseFloat(
1000
+ getComputedStyle(svg).getPropertyValue("--avl-wave-gap")
1001
+ ) || 0;
1002
+ let current = null;
1003
+ let frame = 0;
1004
+ const draw = (now) => {
1005
+ const width = vertical ? svg.clientHeight : svg.clientWidth;
1006
+ const next = span.current(width, gap, svg, now);
1007
+ if (!current || next.snap || reduced) {
1008
+ current = { from: next.from, to: next.to };
1009
+ } else {
1010
+ current.from += (next.from - current.from) * 0.15;
1011
+ current.to += (next.to - current.to) * 0.15;
1012
+ }
1013
+ const phase = reduced ? 0 : now / 1e3 * 2 * Math.PI;
1014
+ wave.setAttribute("d", wavePath(current.from, current.to, phase));
1015
+ rest.setAttribute(
1016
+ "d",
1017
+ (next.rest ?? []).map(
1018
+ ([a, b]) => next.restWave ? wavePath(a, b, phase) : linePath(a, b)
1019
+ ).join("")
1020
+ );
1021
+ dot.setAttribute(
1022
+ "d",
1023
+ next.dot ? linePath(width - 2 * STROKE_CAP, width) : ""
1024
+ );
1025
+ if (!still) frame = requestAnimationFrame(draw);
1026
+ };
1027
+ if (still) {
1028
+ const observer = new ResizeObserver(() => draw(0));
1029
+ observer.observe(svg);
1030
+ return () => observer.disconnect();
1031
+ }
1032
+ frame = requestAnimationFrame(draw);
1033
+ return () => cancelAnimationFrame(frame);
1034
+ }, [still, vertical]);
1035
+ return /* @__PURE__ */ jsx14("svg", { ref: svgRef, className: "avl-squiggly-wave", "aria-hidden": true, children: /* @__PURE__ */ jsxs8("g", { transform: vertical ? "matrix(0 1 1 0 0 0)" : void 0, children: [
1036
+ /* @__PURE__ */ jsx14("path", { ref: restRef, className: "avl-squiggly-wave-rest" }),
1037
+ /* @__PURE__ */ jsx14("path", { ref: waveRef }),
1038
+ /* @__PURE__ */ jsx14("path", { ref: dotRef })
1039
+ ] }) });
1040
+ }
1041
+
1042
+ // src/components/Divider/Divider.tsx
1043
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1044
+ function Divider({
1045
+ label,
1046
+ squiggly = false,
1047
+ className,
1048
+ ...props
1049
+ }) {
1050
+ const labelId = useId();
1051
+ const hasLabel = label != null;
1052
+ const vertical = props.orientation === "vertical";
1053
+ const wave = squiggly && /* @__PURE__ */ jsx15("span", { className: "avl-divider-wave", children: /* @__PURE__ */ jsx15(
1054
+ SquigglyWave,
1055
+ {
1056
+ still: true,
1057
+ vertical,
1058
+ span: (width) => ({ from: 0, to: width, snap: true })
1059
+ }
1060
+ ) });
1061
+ return /* @__PURE__ */ jsxs9(
1062
+ Separator,
1063
+ {
1064
+ "aria-labelledby": hasLabel ? labelId : void 0,
1065
+ ...props,
1066
+ className: withClass(
1067
+ cx(
1068
+ "avl-divider",
1069
+ hasLabel && "avl-divider-labeled",
1070
+ squiggly && "avl-divider-squiggly"
1071
+ ),
1072
+ className
1073
+ ),
1074
+ children: [
1075
+ wave,
1076
+ hasLabel && /* @__PURE__ */ jsx15("span", { id: labelId, className: "avl-divider-label", children: label }),
1077
+ hasLabel && wave
1078
+ ]
1079
+ }
1080
+ );
1081
+ }
1082
+
1083
+ // src/components/FAB/FAB.tsx
1084
+ import { useEffect as useEffect3, useRef as useRef5 } from "react";
1085
+ import {
1086
+ Button as BaseButton4
1087
+ } from "@base-ui/react/button";
1088
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1089
+ function FAB({
1090
+ icon,
1091
+ label,
1092
+ size = "normal",
1093
+ sticky = true,
1094
+ color,
1095
+ fillType,
1096
+ className,
1097
+ ref,
1098
+ ...props
1099
+ }) {
1100
+ const local = useRef5(null);
1101
+ useMagnet(local, sticky && !props.disabled);
1102
+ return /* @__PURE__ */ jsxs10(
1103
+ BaseButton4,
1104
+ {
1105
+ ...props,
1106
+ ref: mergeRefs(local, ref),
1107
+ className: withClass(
1108
+ cx(
1109
+ "avl-fab",
1110
+ colorClass(color, fillType),
1111
+ `avl-fab-size-${size}`,
1112
+ label && "avl-fab-extended"
1113
+ ),
1114
+ className
1115
+ ),
1116
+ children: [
1117
+ /* @__PURE__ */ jsx16(Icon, { name: icon }),
1118
+ label
1119
+ ]
1120
+ }
1121
+ );
1122
+ }
1123
+ var STICK_RANGE = 24;
1124
+ var STICK_STRENGTH = 0.35;
1125
+ function useMagnet(ref, enabled) {
1126
+ useEffect3(() => {
1127
+ const el = ref.current;
1128
+ if (!el || !enabled) return;
1129
+ if (!matchMedia("(pointer: fine)").matches) return;
1130
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
1131
+ let pull = { x: 0, y: 0 };
1132
+ let frame = 0;
1133
+ const set = (x, y, stuck) => {
1134
+ pull = { x, y };
1135
+ el.style.setProperty("--avl-fab-pull-x", `${x}px`);
1136
+ el.style.setProperty("--avl-fab-pull-y", `${y}px`);
1137
+ el.toggleAttribute("data-stuck", stuck);
1138
+ };
1139
+ const onMove = (event) => {
1140
+ if (event.pointerType === "touch") return;
1141
+ cancelAnimationFrame(frame);
1142
+ frame = requestAnimationFrame(() => {
1143
+ const rect = el.getBoundingClientRect();
1144
+ const left = rect.left - pull.x;
1145
+ const top = rect.top - pull.y;
1146
+ const dx = event.clientX - (left + rect.width / 2);
1147
+ const dy = event.clientY - (top + rect.height / 2);
1148
+ const gapX = Math.max(0, Math.abs(dx) - rect.width / 2);
1149
+ const gapY = Math.max(0, Math.abs(dy) - rect.height / 2);
1150
+ if (Math.hypot(gapX, gapY) > STICK_RANGE) {
1151
+ if (pull.x || pull.y) set(0, 0, false);
1152
+ return;
1153
+ }
1154
+ const reach = rect.height / 2 + STICK_RANGE;
1155
+ const clamp = (d) => Math.max(-reach, Math.min(reach, d));
1156
+ set(
1157
+ clamp(dx) * STICK_STRENGTH,
1158
+ clamp(dy) * STICK_STRENGTH,
1159
+ true
1160
+ );
1161
+ });
1162
+ };
1163
+ const release = () => {
1164
+ cancelAnimationFrame(frame);
1165
+ set(0, 0, false);
1166
+ };
1167
+ document.addEventListener("pointermove", onMove, { passive: true });
1168
+ document.documentElement.addEventListener("pointerleave", release);
1169
+ return () => {
1170
+ cancelAnimationFrame(frame);
1171
+ document.removeEventListener("pointermove", onMove);
1172
+ document.documentElement.removeEventListener(
1173
+ "pointerleave",
1174
+ release
1175
+ );
1176
+ el.style.removeProperty("--avl-fab-pull-x");
1177
+ el.style.removeProperty("--avl-fab-pull-y");
1178
+ el.removeAttribute("data-stuck");
1179
+ };
1180
+ }, [ref, enabled]);
1181
+ }
1182
+
1183
+ // src/components/Field/Field.tsx
1184
+ import { Field as BaseField } from "@base-ui/react/field";
1185
+ import { jsx as jsx17 } from "react/jsx-runtime";
1186
+ function Field({ className, ...props }) {
1187
+ return /* @__PURE__ */ jsx17(
1188
+ BaseField.Root,
1189
+ {
1190
+ ...props,
1191
+ className: withClass("avl-field", className)
1192
+ }
1193
+ );
1194
+ }
1195
+ function FieldDescription({
1196
+ className,
1197
+ ...props
1198
+ }) {
1199
+ return /* @__PURE__ */ jsx17(
1200
+ BaseField.Description,
1201
+ {
1202
+ ...props,
1203
+ className: withClass("avl-field-description", className)
1204
+ }
1205
+ );
1206
+ }
1207
+ function FieldError({ className, ...props }) {
1208
+ return /* @__PURE__ */ jsx17(
1209
+ BaseField.Error,
1210
+ {
1211
+ ...props,
1212
+ className: withClass("avl-field-error", className)
1213
+ }
1214
+ );
1215
+ }
1216
+
1217
+ // src/components/IconButton/IconButton.tsx
1218
+ import {
1219
+ Button as BaseButton5
1220
+ } from "@base-ui/react/button";
1221
+ import { jsx as jsx18 } from "react/jsx-runtime";
1222
+ function IconButton({
1223
+ icon,
1224
+ color,
1225
+ fillType,
1226
+ className,
1227
+ ...props
1228
+ }) {
1229
+ return /* @__PURE__ */ jsx18(
1230
+ BaseButton5,
1231
+ {
1232
+ ...props,
1233
+ className: withClass(
1234
+ `avl-icon-button ${colorClass(color, fillType)}`,
1235
+ className
1236
+ ),
1237
+ children: /* @__PURE__ */ jsx18(Icon, { name: icon })
1238
+ }
1239
+ );
1240
+ }
1241
+
1242
+ // src/components/Input/Input.tsx
1243
+ import { Input as BaseInput } from "@base-ui/react/input";
1244
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
1245
+ function Input({
1246
+ label,
1247
+ size = "normal",
1248
+ className,
1249
+ placeholder,
1250
+ ...props
1251
+ }) {
1252
+ return /* @__PURE__ */ jsxs11(
1253
+ "label",
1254
+ {
1255
+ className: cx(
1256
+ "avl-input",
1257
+ `avl-input-size-${size}`,
1258
+ label != null && "avl-input-labeled",
1259
+ className
1260
+ ),
1261
+ children: [
1262
+ /* @__PURE__ */ jsx19(
1263
+ BaseInput,
1264
+ {
1265
+ ...props,
1266
+ placeholder: placeholder ?? " ",
1267
+ className: "avl-input-field"
1268
+ }
1269
+ ),
1270
+ label != null && /* @__PURE__ */ jsx19("span", { className: "avl-input-label", children: label }),
1271
+ /* @__PURE__ */ jsx19("fieldset", { "aria-hidden": true, className: "avl-input-outline", children: /* @__PURE__ */ jsx19("legend", { children: label != null && size === "normal" && /* @__PURE__ */ jsx19("span", { children: label }) }) })
1272
+ ]
1273
+ }
1274
+ );
1275
+ }
1276
+
1277
+ // src/components/List/List.tsx
1278
+ import { useRender } from "@base-ui/react/use-render";
1279
+ import { mergeProps } from "@base-ui/react/merge-props";
1280
+ import { Fragment, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
1281
+ function List({ divided = false, className, ...props }) {
1282
+ return /* @__PURE__ */ jsx20(
1283
+ "ul",
1284
+ {
1285
+ ...props,
1286
+ className: cx("avl-list", divided && "avl-list-divided", className)
1287
+ }
1288
+ );
1289
+ }
1290
+ function ListItem({
1291
+ label,
1292
+ description,
1293
+ start,
1294
+ end,
1295
+ render,
1296
+ className,
1297
+ ...props
1298
+ }) {
1299
+ const row = useRender({
1300
+ defaultTagName: "div",
1301
+ render,
1302
+ props: mergeProps(
1303
+ {
1304
+ className: cx(
1305
+ "avl-list-item",
1306
+ description != null && "avl-list-item-two-line",
1307
+ className
1308
+ ),
1309
+ children: /* @__PURE__ */ jsxs12(Fragment, { children: [
1310
+ start != null && /* @__PURE__ */ jsx20("span", { className: "avl-list-item-start", children: start }),
1311
+ /* @__PURE__ */ jsxs12("span", { className: "avl-list-item-text", children: [
1312
+ /* @__PURE__ */ jsx20("span", { className: "avl-list-item-label", children: label }),
1313
+ description != null && /* @__PURE__ */ jsx20("span", { className: "avl-list-item-description", children: description })
1314
+ ] }),
1315
+ end != null && /* @__PURE__ */ jsx20("span", { className: "avl-list-item-end", children: end })
1316
+ ] })
1317
+ },
1318
+ props
1319
+ )
1320
+ });
1321
+ return /* @__PURE__ */ jsx20("li", { className: "avl-list-item-wrapper", children: row });
1322
+ }
1323
+
1324
+ // src/components/Menu/Menu.tsx
1325
+ import { createContext as createContext3, useContext as useContext3 } from "react";
1326
+ import { Menu as BaseMenu } from "@base-ui/react/menu";
1327
+ import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
1328
+ function Menu(props) {
1329
+ return /* @__PURE__ */ jsx21(BaseMenu.Root, { ...props });
1330
+ }
1331
+ function MenuTrigger({ className, ...props }) {
1332
+ return /* @__PURE__ */ jsx21(
1333
+ BaseMenu.Trigger,
1334
+ {
1335
+ ...props,
1336
+ className: withClass("avl-menu-trigger", className)
1337
+ }
1338
+ );
1339
+ }
1340
+ var SubmenuContext = createContext3(false);
1341
+ function MenuPopup({
1342
+ side,
1343
+ align,
1344
+ sideOffset,
1345
+ alignOffset,
1346
+ className,
1347
+ ...props
1348
+ }) {
1349
+ const avl = useContext3(AnvilContext);
1350
+ const isSubmenu = useContext3(SubmenuContext);
1351
+ return (
1352
+ // Into the AnvilRoot, not `body`, so the popup sees the theme variables
1353
+ /* @__PURE__ */ jsx21(BaseMenu.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx21(
1354
+ BaseMenu.Positioner,
1355
+ {
1356
+ className: "avl-menu-positioner",
1357
+ side,
1358
+ align,
1359
+ sideOffset: sideOffset ?? (isSubmenu ? 8 : 4),
1360
+ alignOffset: alignOffset ?? (isSubmenu ? -4 : void 0),
1361
+ children: /* @__PURE__ */ jsx21(
1362
+ BaseMenu.Popup,
1363
+ {
1364
+ ...props,
1365
+ className: withClass("avl-menu-popup", className)
1366
+ }
1367
+ )
1368
+ }
1369
+ ) })
1370
+ );
1371
+ }
1372
+ function MenuSubmenu(props) {
1373
+ return /* @__PURE__ */ jsx21(SubmenuContext, { value: true, children: /* @__PURE__ */ jsx21(BaseMenu.SubmenuRoot, { ...props }) });
1374
+ }
1375
+ function MenuSubmenuTrigger({
1376
+ startIcon,
1377
+ className,
1378
+ children,
1379
+ ...props
1380
+ }) {
1381
+ return /* @__PURE__ */ jsxs13(
1382
+ BaseMenu.SubmenuTrigger,
1383
+ {
1384
+ ...props,
1385
+ className: withClass("avl-menu-item", className),
1386
+ children: [
1387
+ startIcon && /* @__PURE__ */ jsx21(Icon, { name: startIcon }),
1388
+ /* @__PURE__ */ jsx21("span", { className: "avl-menu-item-label", children }),
1389
+ /* @__PURE__ */ jsx21(Icon, { name: "arrow_right" })
1390
+ ]
1391
+ }
1392
+ );
1393
+ }
1394
+ function MenuGroup({ className, ...props }) {
1395
+ return /* @__PURE__ */ jsx21(
1396
+ BaseMenu.Group,
1397
+ {
1398
+ ...props,
1399
+ className: withClass("avl-menu-group", className)
1400
+ }
1401
+ );
1402
+ }
1403
+ function MenuItem({
1404
+ startIcon,
1405
+ endIcon,
1406
+ className,
1407
+ children,
1408
+ ...props
1409
+ }) {
1410
+ return /* @__PURE__ */ jsxs13(
1411
+ BaseMenu.Item,
1412
+ {
1413
+ ...props,
1414
+ className: withClass("avl-menu-item", className),
1415
+ children: [
1416
+ startIcon && /* @__PURE__ */ jsx21(Icon, { name: startIcon }),
1417
+ /* @__PURE__ */ jsx21("span", { className: "avl-menu-item-label", children }),
1418
+ endIcon && /* @__PURE__ */ jsx21(Icon, { name: endIcon })
1419
+ ]
1420
+ }
1421
+ );
1422
+ }
1423
+
1424
+ // src/components/Popover/Popover.tsx
1425
+ import { useContext as useContext4 } from "react";
1426
+ import { Popover as BasePopover } from "@base-ui/react/popover";
1427
+ import { jsx as jsx22 } from "react/jsx-runtime";
1428
+ function Popover({
1429
+ morph: morph2 = false,
1430
+ defaultOpen = false,
1431
+ ...props
1432
+ }) {
1433
+ const state = useMorphOpen({
1434
+ morph: morph2,
1435
+ open: props.open,
1436
+ defaultOpen,
1437
+ onOpenChange: props.onOpenChange
1438
+ });
1439
+ return /* @__PURE__ */ jsx22(MorphContext, { value: state.refs, children: /* @__PURE__ */ jsx22(
1440
+ BasePopover.Root,
1441
+ {
1442
+ ...props,
1443
+ open: state.open,
1444
+ onOpenChange: state.onOpenChange
1445
+ }
1446
+ ) });
1447
+ }
1448
+ function PopoverTrigger({
1449
+ className,
1450
+ ref,
1451
+ ...props
1452
+ }) {
1453
+ const morph2 = useContext4(MorphContext);
1454
+ return /* @__PURE__ */ jsx22(
1455
+ BasePopover.Trigger,
1456
+ {
1457
+ ...props,
1458
+ ref: mergeRefs(morph2?.trigger, ref),
1459
+ className: withClass("avl-popover-trigger", className)
1460
+ }
1461
+ );
1462
+ }
1463
+ function PopoverPopup({
1464
+ side,
1465
+ align,
1466
+ sideOffset,
1467
+ alignOffset,
1468
+ className,
1469
+ ref,
1470
+ ...props
1471
+ }) {
1472
+ const avl = useContext4(AnvilContext);
1473
+ const morph2 = useContext4(MorphContext);
1474
+ return (
1475
+ // Into the AnvilRoot, not body, so the popup sees the theme variables
1476
+ /* @__PURE__ */ jsx22(BasePopover.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx22(
1477
+ BasePopover.Positioner,
1478
+ {
1479
+ className: "avl-menu-positioner",
1480
+ side,
1481
+ align,
1482
+ sideOffset: sideOffset ?? 4,
1483
+ alignOffset,
1484
+ children: /* @__PURE__ */ jsx22(
1485
+ BasePopover.Popup,
1486
+ {
1487
+ ...props,
1488
+ ref: mergeRefs(morph2?.popup, ref),
1489
+ className: withClass(
1490
+ "avl-menu-popup avl-popover-popup",
1491
+ className
1492
+ )
1493
+ }
1494
+ )
1495
+ }
1496
+ ) })
1497
+ );
1498
+ }
1499
+ function PopoverTitle({ className, ...props }) {
1500
+ return /* @__PURE__ */ jsx22(
1501
+ BasePopover.Title,
1502
+ {
1503
+ ...props,
1504
+ className: withClass("avl-popover-title", className)
1505
+ }
1506
+ );
1507
+ }
1508
+ function PopoverDescription({
1509
+ className,
1510
+ ...props
1511
+ }) {
1512
+ return /* @__PURE__ */ jsx22(
1513
+ BasePopover.Description,
1514
+ {
1515
+ ...props,
1516
+ className: withClass("avl-popover-description", className)
1517
+ }
1518
+ );
1519
+ }
1520
+ function PopoverClose({ className, ...props }) {
1521
+ return /* @__PURE__ */ jsx22(
1522
+ BasePopover.Close,
1523
+ {
1524
+ ...props,
1525
+ className: withClass("avl-popover-close", className)
1526
+ }
1527
+ );
1528
+ }
1529
+
1530
+ // src/components/Progress/Progress.tsx
1531
+ import { Progress as BaseProgress } from "@base-ui/react/progress";
1532
+ import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
1533
+ var RING = { r: 20, gap: 8 };
1534
+ var INLINE_RING = { r: 18, gap: 12 };
1535
+ function Progress({
1536
+ type = "linear",
1537
+ squiggly = false,
1538
+ label,
1539
+ className,
1540
+ style,
1541
+ children,
1542
+ ...props
1543
+ }) {
1544
+ const { value, min = 0, max = 100 } = props;
1545
+ const fraction = value == null ? 0 : Math.min(1, Math.max(0, (value - min) / (max - min)));
1546
+ const pct = fraction * 100;
1547
+ const ring = type === "inline" ? INLINE_RING : RING;
1548
+ const ringGap = pct > 0 ? ring.gap : 0;
1549
+ return /* @__PURE__ */ jsxs14(
1550
+ BaseProgress.Root,
1551
+ {
1552
+ ...props,
1553
+ className: withClass(
1554
+ cx(
1555
+ "avl-progress",
1556
+ `avl-progress-${type}`,
1557
+ // Inline is a smaller ring, so it shares the circular styles
1558
+ type === "inline" && "avl-progress-circular",
1559
+ squiggly && type === "linear" && "avl-progress-squiggly"
1560
+ ),
1561
+ className
1562
+ ),
1563
+ style: (state) => ({
1564
+ "--avl-progress-fraction": fraction,
1565
+ ...typeof style === "function" ? style(state) : style
1566
+ }),
1567
+ children: [
1568
+ label != null && /* @__PURE__ */ jsx23(BaseProgress.Label, { className: "avl-progress-label", children: label }),
1569
+ type === "linear" ? /* @__PURE__ */ jsxs14(BaseProgress.Track, { className: "avl-progress-track", children: [
1570
+ squiggly ? /* @__PURE__ */ jsx23(
1571
+ SquigglyWave,
1572
+ {
1573
+ span: (width, gap, _svg, now) => value == null ? loadingSpan(width, gap, now) : (
1574
+ // Fill up to the value; .avl-progress-rest
1575
+ // draws the track one gap after it
1576
+ { from: 0, to: fraction * width }
1577
+ )
1578
+ }
1579
+ ) : /* @__PURE__ */ jsx23(BaseProgress.Indicator, { className: "avl-progress-indicator" }),
1580
+ /* @__PURE__ */ jsx23("span", { className: "avl-progress-rest" })
1581
+ ] }) : /* @__PURE__ */ jsxs14(
1582
+ BaseProgress.Track,
1583
+ {
1584
+ className: "avl-progress-ring",
1585
+ render: /* @__PURE__ */ jsx23("svg", { viewBox: "0 0 48 48" }),
1586
+ children: [
1587
+ /* @__PURE__ */ jsx23(
1588
+ "circle",
1589
+ {
1590
+ className: "avl-progress-ring-rest",
1591
+ cx: "24",
1592
+ cy: "24",
1593
+ r: ring.r,
1594
+ pathLength: 100,
1595
+ strokeDasharray: `${Math.max(0, 100 - pct - 2 * ringGap)} 100`,
1596
+ strokeDashoffset: -(pct + ringGap)
1597
+ }
1598
+ ),
1599
+ /* @__PURE__ */ jsx23(
1600
+ "circle",
1601
+ {
1602
+ className: "avl-progress-ring-indicator",
1603
+ cx: "24",
1604
+ cy: "24",
1605
+ r: ring.r,
1606
+ pathLength: 100,
1607
+ strokeDasharray: value == null ? "25 100" : `${pct} 100`
1608
+ }
1609
+ )
1610
+ ]
1611
+ }
1612
+ ),
1613
+ children
1614
+ ]
1615
+ }
1616
+ );
1617
+ }
1618
+ function loadingSpan(width, gap, now) {
1619
+ const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
1620
+ const period = reduced ? 4e3 : 1500;
1621
+ const segment = width * 0.4;
1622
+ const left = -segment + now % period / period * (width + segment);
1623
+ const from = Math.max(0, left);
1624
+ const to = Math.min(width, left + segment);
1625
+ const visible = to - from > 0;
1626
+ return {
1627
+ from,
1628
+ to,
1629
+ rest: visible ? [
1630
+ [0, from - gap],
1631
+ [to + gap, width]
1632
+ ] : [[0, width]],
1633
+ restWave: true,
1634
+ snap: true
1635
+ };
1636
+ }
1637
+
1638
+ // src/components/ToggleGroup/ToggleGroup.tsx
1639
+ import { createContext as createContext4, useContext as useContext5, useLayoutEffect as useLayoutEffect3, useRef as useRef6 } from "react";
1640
+ import { Radio as BaseRadio } from "@base-ui/react/radio";
1641
+ import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
1642
+ import { Toggle as BaseToggle } from "@base-ui/react/toggle";
1643
+ import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group";
1644
+ import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
1645
+ var MultipleContext = createContext4(false);
1646
+ function ToggleGroup({
1647
+ size = "normal",
1648
+ color,
1649
+ fillType,
1650
+ multiple = false,
1651
+ children,
1652
+ className,
1653
+ ref,
1654
+ ...props
1655
+ }) {
1656
+ const groupRef = useRef6(null);
1657
+ const indicatorRef = useRef6(null);
1658
+ useLayoutEffect3(() => {
1659
+ const group = groupRef.current;
1660
+ const indicator = indicatorRef.current;
1661
+ if (!group || !indicator) return;
1662
+ let previousLeft = null;
1663
+ const place = () => {
1664
+ const checked = group.querySelector(
1665
+ ".avl-toggle-group-item[data-checked]"
1666
+ );
1667
+ indicator.style.opacity = checked ? "1" : "0";
1668
+ if (!checked) return;
1669
+ const left = checked.offsetLeft;
1670
+ if (previousLeft != null && left !== previousLeft) {
1671
+ indicator.dataset.direction = left > previousLeft ? "forward" : "backward";
1672
+ }
1673
+ previousLeft = left;
1674
+ indicator.style.left = `${left}px`;
1675
+ indicator.style.right = `${group.clientWidth - left - checked.offsetWidth}px`;
1676
+ };
1677
+ place();
1678
+ const frame = requestAnimationFrame(
1679
+ () => group.setAttribute("data-ready", "")
1680
+ );
1681
+ const mutations = new MutationObserver(place);
1682
+ mutations.observe(group, {
1683
+ subtree: true,
1684
+ childList: true,
1685
+ attributeFilter: ["data-checked"]
1686
+ });
1687
+ const resizes = new ResizeObserver(place);
1688
+ resizes.observe(group);
1689
+ return () => {
1690
+ cancelAnimationFrame(frame);
1691
+ mutations.disconnect();
1692
+ resizes.disconnect();
1693
+ };
1694
+ }, [multiple]);
1695
+ const classes = withClass(
1696
+ "avl-toggle-group " + colorClass(color, fillType) + `avl-toggle-group-size-${size}`,
1697
+ // Its state type depends on which group renders; both take a string
1698
+ className
1699
+ );
1700
+ return /* @__PURE__ */ jsx24(MultipleContext, { value: multiple, children: multiple ? /* @__PURE__ */ jsx24(
1701
+ BaseToggleGroup,
1702
+ {
1703
+ ...props,
1704
+ multiple: true,
1705
+ ref,
1706
+ className: classes,
1707
+ children
1708
+ }
1709
+ ) : /* @__PURE__ */ jsxs15(
1710
+ BaseRadioGroup,
1711
+ {
1712
+ ...props,
1713
+ ref: mergeRefs(groupRef, ref),
1714
+ className: classes,
1715
+ children: [
1716
+ /* @__PURE__ */ jsx24(
1717
+ "div",
1718
+ {
1719
+ ref: indicatorRef,
1720
+ className: "avl-toggle-group-indicator",
1721
+ "aria-hidden": true
1722
+ }
1723
+ ),
1724
+ children
1725
+ ]
1726
+ }
1727
+ ) });
1728
+ }
1729
+ function ToggleGroupItem({
1730
+ startIcon,
1731
+ endIcon,
1732
+ children,
1733
+ className,
1734
+ value,
1735
+ ...props
1736
+ }) {
1737
+ const multiple = useContext5(MultipleContext);
1738
+ const classes = withClass(
1739
+ "avl-toggle-group-item",
1740
+ className
1741
+ );
1742
+ const content = /* @__PURE__ */ jsxs15(Fragment2, { children: [
1743
+ startIcon && /* @__PURE__ */ jsx24(Icon, { name: startIcon }),
1744
+ children,
1745
+ endIcon && /* @__PURE__ */ jsx24(Icon, { name: endIcon })
1746
+ ] });
1747
+ if (multiple) {
1748
+ return /* @__PURE__ */ jsxs15(
1749
+ BaseToggle,
1750
+ {
1751
+ ...props,
1752
+ value: String(value),
1753
+ className: classes,
1754
+ children: [
1755
+ /* @__PURE__ */ jsx24(Icon, { name: "check", className: "avl-toggle-group-check" }),
1756
+ content
1757
+ ]
1758
+ }
1759
+ );
1760
+ }
1761
+ return /* @__PURE__ */ jsx24(
1762
+ BaseRadio.Root,
1763
+ {
1764
+ ...props,
1765
+ value,
1766
+ nativeButton: true,
1767
+ render: /* @__PURE__ */ jsx24("button", {}),
1768
+ className: classes,
1769
+ children: content
1770
+ }
1771
+ );
1772
+ }
1773
+
1774
+ // src/components/RadioGroup/RadioGroup.tsx
1775
+ import { Radio as BaseRadio2 } from "@base-ui/react/radio";
1776
+ import { RadioGroup as BaseRadioGroup2 } from "@base-ui/react/radio-group";
1777
+ import { jsx as jsx25 } from "react/jsx-runtime";
1778
+ function RadioGroup({
1779
+ className,
1780
+ ...props
1781
+ }) {
1782
+ return /* @__PURE__ */ jsx25(
1783
+ BaseRadioGroup2,
1784
+ {
1785
+ ...props,
1786
+ className: withClass("avl-radio-group", className)
1787
+ }
1788
+ );
1789
+ }
1790
+ function Radio({ className, ...props }) {
1791
+ return /* @__PURE__ */ jsx25(
1792
+ BaseRadio2.Root,
1793
+ {
1794
+ ...props,
1795
+ className: withClass("avl-radio", className),
1796
+ children: /* @__PURE__ */ jsx25(BaseRadio2.Indicator, { className: "avl-radio-indicator" })
1797
+ }
1798
+ );
1799
+ }
1800
+
1801
+ // src/components/Select/Select.tsx
1802
+ import { useContext as useContext6 } from "react";
1803
+ import { Select as BaseSelect } from "@base-ui/react/select";
1804
+ import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
1805
+ function Select({
1806
+ label,
1807
+ placeholder,
1808
+ size = "normal",
1809
+ className,
1810
+ children,
1811
+ ...props
1812
+ }) {
1813
+ const avl = useContext6(AnvilContext);
1814
+ return /* @__PURE__ */ jsxs16(BaseSelect.Root, { ...props, children: [
1815
+ /* @__PURE__ */ jsxs16(
1816
+ "div",
1817
+ {
1818
+ className: cx(
1819
+ "avl-input",
1820
+ "avl-select",
1821
+ `avl-input-size-${size}`,
1822
+ label != null && "avl-input-labeled",
1823
+ className
1824
+ ),
1825
+ children: [
1826
+ /* @__PURE__ */ jsxs16(BaseSelect.Trigger, { className: "avl-input-field avl-select-trigger", children: [
1827
+ /* @__PURE__ */ jsx26(
1828
+ BaseSelect.Value,
1829
+ {
1830
+ className: "avl-select-value",
1831
+ placeholder
1832
+ }
1833
+ ),
1834
+ /* @__PURE__ */ jsx26(BaseSelect.Icon, { className: "avl-select-icon", children: /* @__PURE__ */ jsx26(Icon, { name: "arrow_drop_down" }) })
1835
+ ] }),
1836
+ label != null && /* @__PURE__ */ jsx26(BaseSelect.Label, { className: "avl-input-label", children: label }),
1837
+ /* @__PURE__ */ jsx26("fieldset", { "aria-hidden": true, className: "avl-input-outline", children: /* @__PURE__ */ jsx26("legend", { children: label != null && size === "normal" && /* @__PURE__ */ jsx26("span", { children: label }) }) })
1838
+ ]
1839
+ }
1840
+ ),
1841
+ /* @__PURE__ */ jsx26(BaseSelect.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx26(
1842
+ BaseSelect.Positioner,
1843
+ {
1844
+ className: "avl-menu-positioner",
1845
+ alignItemWithTrigger: false,
1846
+ sideOffset: 4,
1847
+ children: /* @__PURE__ */ jsx26(BaseSelect.Popup, { className: "avl-menu-popup avl-select-popup", children })
1848
+ }
1849
+ ) })
1850
+ ] });
1851
+ }
1852
+ function SelectItem({ className, children, ...props }) {
1853
+ return /* @__PURE__ */ jsxs16(
1854
+ BaseSelect.Item,
1855
+ {
1856
+ ...props,
1857
+ className: withClass("avl-menu-item avl-select-item", className),
1858
+ children: [
1859
+ /* @__PURE__ */ jsx26(BaseSelect.ItemText, { className: "avl-menu-item-label", children }),
1860
+ /* @__PURE__ */ jsx26(BaseSelect.ItemIndicator, { className: "avl-select-item-indicator", children: /* @__PURE__ */ jsx26(Icon, { name: "check" }) })
1861
+ ]
1862
+ }
1863
+ );
1864
+ }
1865
+
1866
+ // src/components/Slider/Slider.tsx
1867
+ import { Slider as BaseSlider } from "@base-ui/react/slider";
1868
+ import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
1869
+ function Slider({
1870
+ label,
1871
+ "aria-label": ariaLabel,
1872
+ showValue = true,
1873
+ squiggly = false,
1874
+ className,
1875
+ ...props
1876
+ }) {
1877
+ const initial = props.value ?? props.defaultValue;
1878
+ const thumbCount = Array.isArray(initial) ? initial.length : 1;
1879
+ const wavy = squiggly && props.orientation !== "vertical";
1880
+ return /* @__PURE__ */ jsxs17(
1881
+ BaseSlider.Root,
1882
+ {
1883
+ ...props,
1884
+ className: withClass(
1885
+ cx(
1886
+ "avl-slider",
1887
+ thumbCount > 1 && "avl-slider-range",
1888
+ wavy && "avl-slider-squiggly"
1889
+ ),
1890
+ className
1891
+ ),
1892
+ children: [
1893
+ label != null && /* @__PURE__ */ jsx27(BaseSlider.Label, { className: "avl-slider-label", children: label }),
1894
+ /* @__PURE__ */ jsx27(BaseSlider.Control, { className: "avl-slider-control", children: /* @__PURE__ */ jsxs17(BaseSlider.Track, { className: "avl-slider-track", children: [
1895
+ wavy ? /* @__PURE__ */ jsx27(SquigglyWave, { span: handleSpan }) : (
1896
+ // Clips the track pieces to the rounded track, without
1897
+ // also clipping the handles, which are taller
1898
+ /* @__PURE__ */ jsx27("div", { className: "avl-slider-rail", children: /* @__PURE__ */ jsx27(BaseSlider.Indicator, { className: "avl-slider-indicator" }) })
1899
+ ),
1900
+ Array.from({ length: thumbCount }, (_, i) => /* @__PURE__ */ jsx27(
1901
+ BaseSlider.Thumb,
1902
+ {
1903
+ index: i,
1904
+ "aria-label": ariaLabel,
1905
+ className: "avl-slider-thumb",
1906
+ children: showValue && /* @__PURE__ */ jsx27(BaseSlider.Value, { className: "avl-tooltip avl-slider-value", children: (formatted) => formatted[i] })
1907
+ },
1908
+ i
1909
+ ))
1910
+ ] }) })
1911
+ ]
1912
+ }
1913
+ );
1914
+ }
1915
+ function handleSpan(width, gap, svg) {
1916
+ const box = svg.getBoundingClientRect();
1917
+ const centers = Array.from(
1918
+ svg.parentElement?.querySelectorAll(".avl-slider-thumb") ?? [],
1919
+ (thumb) => {
1920
+ const rect = thumb.getBoundingClientRect();
1921
+ return rect.left + rect.width / 2 - box.left;
1922
+ }
1923
+ );
1924
+ if (centers.length === 0) return { from: 0, to: 0, snap: true };
1925
+ const first = centers[0];
1926
+ const last = centers[centers.length - 1];
1927
+ const range = centers.length > 1;
1928
+ return {
1929
+ from: range ? first + gap : 0,
1930
+ to: last - gap,
1931
+ rest: range ? [
1932
+ [0, first - gap],
1933
+ [last + gap, width]
1934
+ ] : [[last + gap, width]],
1935
+ dot: last + gap < width - gap,
1936
+ snap: true
1937
+ };
1938
+ }
1939
+
1940
+ // src/components/Snackbar/Snackbar.tsx
1941
+ import { useEffect as useEffect4, useRef as useRef7, useState as useState3 } from "react";
1942
+ import { Toast } from "@base-ui/react/toast";
1943
+ import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
1944
+ function useSnackbar() {
1945
+ const manager = Toast.useToastManager();
1946
+ return {
1947
+ /** Shows a snackbar at the bottom; open ones move up. Returns its id. */
1948
+ show: ({ message, action, closeButton, ...options }) => manager.add({
1949
+ ...options,
1950
+ description: message,
1951
+ actionProps: action && {
1952
+ children: action.label,
1953
+ onClick: action.onClick
1954
+ },
1955
+ data: { closeButton }
1956
+ }),
1957
+ /** Closes one snackbar by id, or all of them. */
1958
+ close: manager.close
1959
+ };
1960
+ }
1961
+ function SnackbarViewport() {
1962
+ const { toasts } = Toast.useToastManager();
1963
+ const viewportRef = useRef7(null);
1964
+ const [expanded, setExpanded] = useState3(false);
1965
+ const [hovered, setHovered] = useState3(false);
1966
+ const visibleCount = toasts.filter(
1967
+ (toast) => toast.transitionStatus !== "ending"
1968
+ ).length;
1969
+ const collapsed = visibleCount > 1 && !expanded && !hovered;
1970
+ useEffect4(() => {
1971
+ if (visibleCount <= 1) setExpanded(false);
1972
+ }, [visibleCount]);
1973
+ useEffect4(() => {
1974
+ if (!expanded) return;
1975
+ const viewport = viewportRef.current;
1976
+ const close = (event) => {
1977
+ if (!viewport?.contains(event.target)) setExpanded(false);
1978
+ };
1979
+ document.addEventListener("pointerdown", close);
1980
+ document.addEventListener("focusin", close);
1981
+ return () => {
1982
+ document.removeEventListener("pointerdown", close);
1983
+ document.removeEventListener("focusin", close);
1984
+ };
1985
+ }, [expanded]);
1986
+ let visibleIndex = 0;
1987
+ return /* @__PURE__ */ jsx28(
1988
+ Toast.Viewport,
1989
+ {
1990
+ ref: viewportRef,
1991
+ className: "avl-snackbar-viewport",
1992
+ "data-collapsed": collapsed || void 0,
1993
+ onMouseEnter: () => setHovered(true),
1994
+ onMouseLeave: () => setHovered(false),
1995
+ onClick: (event) => {
1996
+ if (!event.target.closest("button")) {
1997
+ setExpanded(true);
1998
+ }
1999
+ },
2000
+ onFocus: (event) => {
2001
+ if (event.target.matches(":focus-visible")) setExpanded(true);
2002
+ },
2003
+ children: toasts.map((toast) => {
2004
+ const behind = toast.transitionStatus !== "ending" && visibleIndex++ > 0;
2005
+ return /* @__PURE__ */ jsxs18(
2006
+ Toast.Root,
2007
+ {
2008
+ toast,
2009
+ swipeDirection: ["left", "right", "down"],
2010
+ className: "avl-snackbar",
2011
+ "data-behind": behind || void 0,
2012
+ inert: collapsed && behind || void 0,
2013
+ children: [
2014
+ /* @__PURE__ */ jsx28(Toast.Description, { className: "avl-snackbar-message" }),
2015
+ toast.actionProps && /* @__PURE__ */ jsx28(Toast.Action, { className: "avl-snackbar-action" }),
2016
+ toast.data?.closeButton && /* @__PURE__ */ jsx28(
2017
+ Toast.Close,
2018
+ {
2019
+ className: "avl-snackbar-close",
2020
+ "aria-label": "Close",
2021
+ children: /* @__PURE__ */ jsx28(Icon, { name: "close" })
2022
+ }
2023
+ )
2024
+ ]
2025
+ },
2026
+ toast.id
2027
+ );
2028
+ })
2029
+ }
2030
+ );
2031
+ }
2032
+
2033
+ // src/components/Switch/Switch.tsx
2034
+ import { Switch as BaseSwitch } from "@base-ui/react/switch";
2035
+ import { jsx as jsx29 } from "react/jsx-runtime";
2036
+ function Switch({ className, ...props }) {
2037
+ return /* @__PURE__ */ jsx29(
2038
+ BaseSwitch.Root,
2039
+ {
2040
+ ...props,
2041
+ className: withClass("avl-switch", className),
2042
+ children: /* @__PURE__ */ jsx29(BaseSwitch.Thumb, { className: "avl-switch-thumb" })
2043
+ }
2044
+ );
2045
+ }
2046
+
2047
+ // src/components/Tabs/Tabs.tsx
2048
+ import { Tabs as BaseTabs } from "@base-ui/react/tabs";
2049
+ import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
2050
+ function Tabs({ className, ...props }) {
2051
+ return /* @__PURE__ */ jsx30(
2052
+ BaseTabs.Root,
2053
+ {
2054
+ ...props,
2055
+ className: withClass("avl-tabs", className)
2056
+ }
2057
+ );
2058
+ }
2059
+ function TabsList({ className, children, ...props }) {
2060
+ return /* @__PURE__ */ jsxs19(
2061
+ BaseTabs.List,
2062
+ {
2063
+ ...props,
2064
+ className: withClass("avl-tabs-list", className),
2065
+ children: [
2066
+ children,
2067
+ /* @__PURE__ */ jsx30(BaseTabs.Indicator, { className: "avl-tabs-indicator" })
2068
+ ]
2069
+ }
2070
+ );
2071
+ }
2072
+ function TabsTab({ icon, className, children, ...props }) {
2073
+ return /* @__PURE__ */ jsx30(
2074
+ BaseTabs.Tab,
2075
+ {
2076
+ ...props,
2077
+ className: withClass("avl-tabs-tab", className),
2078
+ children: /* @__PURE__ */ jsxs19("span", { className: "avl-tabs-tab-content", children: [
2079
+ icon && /* @__PURE__ */ jsx30(Icon, { name: icon }),
2080
+ /* @__PURE__ */ jsx30("span", { className: "avl-tabs-tab-label", children })
2081
+ ] })
2082
+ }
2083
+ );
2084
+ }
2085
+ function TabsPanel({ className, ...props }) {
2086
+ return /* @__PURE__ */ jsx30(
2087
+ BaseTabs.Panel,
2088
+ {
2089
+ ...props,
2090
+ className: withClass("avl-tabs-panel", className)
2091
+ }
2092
+ );
2093
+ }
2094
+
2095
+ // src/components/Textarea/Textarea.tsx
2096
+ import { Input as BaseInput2 } from "@base-ui/react/input";
2097
+ import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
2098
+ function Textarea({
2099
+ label,
2100
+ size = "normal",
2101
+ className,
2102
+ placeholder,
2103
+ ...props
2104
+ }) {
2105
+ return /* @__PURE__ */ jsxs20(
2106
+ "label",
2107
+ {
2108
+ className: cx(
2109
+ "avl-input",
2110
+ "avl-textarea",
2111
+ `avl-input-size-${size}`,
2112
+ label != null && "avl-input-labeled",
2113
+ className
2114
+ ),
2115
+ children: [
2116
+ /* @__PURE__ */ jsx31(
2117
+ BaseInput2,
2118
+ {
2119
+ ...props,
2120
+ render: /* @__PURE__ */ jsx31("textarea", {}),
2121
+ placeholder: placeholder ?? " ",
2122
+ className: "avl-input-field"
2123
+ }
2124
+ ),
2125
+ label != null && /* @__PURE__ */ jsx31("span", { className: "avl-input-label", children: label }),
2126
+ /* @__PURE__ */ jsx31("fieldset", { "aria-hidden": true, className: "avl-input-outline", children: /* @__PURE__ */ jsx31("legend", { children: label != null && size === "normal" && /* @__PURE__ */ jsx31("span", { children: label }) }) })
2127
+ ]
2128
+ }
2129
+ );
2130
+ }
2131
+
2132
+ // src/components/FloatingToolbar/FloatingToolbar.tsx
2133
+ import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
2134
+ import { jsx as jsx32 } from "react/jsx-runtime";
2135
+ function FloatingToolbar({
2136
+ inverseColor = false,
2137
+ className,
2138
+ ...props
2139
+ }) {
2140
+ return /* @__PURE__ */ jsx32(
2141
+ BaseToolbar.Root,
2142
+ {
2143
+ ...props,
2144
+ className: withClass(
2145
+ cx(
2146
+ "avl-floating-toolbar",
2147
+ inverseColor && "avl-floating-toolbar-inverse"
2148
+ ),
2149
+ className
2150
+ )
2151
+ }
2152
+ );
2153
+ }
2154
+ function FloatingToolbarButton({
2155
+ fillType = "text",
2156
+ // Filled means highlighted: primary stands out on the toolbar's surface
2157
+ color = fillType === "filled" ? "primary" : "container",
2158
+ disabled,
2159
+ ...props
2160
+ }) {
2161
+ return /* @__PURE__ */ jsx32(
2162
+ BaseToolbar.Button,
2163
+ {
2164
+ disabled,
2165
+ render: /* @__PURE__ */ jsx32(IconButton, { ...props, color, fillType })
2166
+ }
2167
+ );
2168
+ }
2169
+ function FloatingToolbarSeparator({
2170
+ className,
2171
+ ...props
2172
+ }) {
2173
+ return /* @__PURE__ */ jsx32(
2174
+ BaseToolbar.Separator,
2175
+ {
2176
+ ...props,
2177
+ className: withClass(
2178
+ "avl-divider avl-floating-toolbar-separator",
2179
+ className
2180
+ )
2181
+ }
2182
+ );
2183
+ }
2184
+
2185
+ // src/components/Tooltip/Tooltip.tsx
2186
+ import { useContext as useContext7 } from "react";
2187
+ import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
2188
+ import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
2189
+ function Tooltip({
2190
+ label,
2191
+ children,
2192
+ delay,
2193
+ closeDelay,
2194
+ side,
2195
+ align,
2196
+ sideOffset,
2197
+ alignOffset,
2198
+ className,
2199
+ ...props
2200
+ }) {
2201
+ const avl = useContext7(AnvilContext);
2202
+ return /* @__PURE__ */ jsxs21(BaseTooltip.Root, { ...props, children: [
2203
+ /* @__PURE__ */ jsx33(
2204
+ BaseTooltip.Trigger,
2205
+ {
2206
+ render: children,
2207
+ delay,
2208
+ closeDelay
2209
+ }
2210
+ ),
2211
+ /* @__PURE__ */ jsx33(BaseTooltip.Portal, { container: avl?.rootRef, children: /* @__PURE__ */ jsx33(
2212
+ BaseTooltip.Positioner,
2213
+ {
2214
+ className: "avl-tooltip-positioner",
2215
+ side,
2216
+ align,
2217
+ sideOffset: sideOffset ?? 4,
2218
+ alignOffset,
2219
+ children: /* @__PURE__ */ jsx33(
2220
+ BaseTooltip.Popup,
2221
+ {
2222
+ className: withClass("avl-tooltip", className),
2223
+ children: label
2224
+ }
2225
+ )
2226
+ }
2227
+ ) })
2228
+ ] });
2229
+ }
2230
+
2231
+ // src/components/NavigationBar/NavigationBar.tsx
2232
+ import { useRender as useRender2 } from "@base-ui/react/use-render";
2233
+ import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
2234
+ import { Fragment as Fragment3, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
2235
+ function NavigationBar({ className, ...props }) {
2236
+ return /* @__PURE__ */ jsx34("nav", { ...props, className: cx("avl-navigation-bar", className) });
2237
+ }
2238
+ function NavigationBarItem({
2239
+ icon,
2240
+ label,
2241
+ active = false,
2242
+ render,
2243
+ className,
2244
+ ...props
2245
+ }) {
2246
+ return useRender2({
2247
+ defaultTagName: "a",
2248
+ render,
2249
+ state: { active },
2250
+ props: mergeProps2(
2251
+ {
2252
+ className: cx("avl-navigation-bar-item", className),
2253
+ "aria-current": active ? "page" : void 0,
2254
+ children: /* @__PURE__ */ jsxs22(Fragment3, { children: [
2255
+ /* @__PURE__ */ jsx34("span", { className: "avl-navigation-bar-item-indicator", children: /* @__PURE__ */ jsx34(Icon, { name: icon }) }),
2256
+ /* @__PURE__ */ jsx34("span", { className: "avl-navigation-bar-item-label", children: label })
2257
+ ] })
2258
+ },
2259
+ props
2260
+ )
2261
+ });
2262
+ }
2263
+
2264
+ // src/components/NavigationDrawer/NavigationDrawer.tsx
2265
+ import { useContext as useContext8 } from "react";
2266
+ import { Drawer as Drawer2 } from "@base-ui/react/drawer";
2267
+ import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
2268
+ function NavigationDrawer(props) {
2269
+ return /* @__PURE__ */ jsx35(Drawer2.Root, { ...props, swipeDirection: "left" });
2270
+ }
2271
+ function NavigationDrawerTrigger({
2272
+ className,
2273
+ ...props
2274
+ }) {
2275
+ return /* @__PURE__ */ jsx35(
2276
+ Drawer2.Trigger,
2277
+ {
2278
+ ...props,
2279
+ className: withClass("avl-navigation-drawer-trigger", className)
2280
+ }
2281
+ );
2282
+ }
2283
+ function NavigationDrawerPopup({
2284
+ className,
2285
+ ...props
2286
+ }) {
2287
+ const avl = useContext8(AnvilContext);
2288
+ return (
2289
+ // Into the AnvilRoot, not body, so the drawer sees the theme variables
2290
+ /* @__PURE__ */ jsxs23(Drawer2.Portal, { container: avl?.rootRef, children: [
2291
+ /* @__PURE__ */ jsx35(Drawer2.Backdrop, { className: "avl-navigation-drawer-backdrop" }),
2292
+ /* @__PURE__ */ jsx35(Drawer2.Viewport, { className: "avl-navigation-drawer-viewport", children: /* @__PURE__ */ jsx35(
2293
+ Drawer2.Popup,
2294
+ {
2295
+ ...props,
2296
+ className: withClass(
2297
+ "avl-navigation-drawer-popup",
2298
+ className
2299
+ )
2300
+ }
2301
+ ) })
2302
+ ] })
2303
+ );
2304
+ }
2305
+ function NavigationDrawerTitle({
2306
+ className,
2307
+ ...props
2308
+ }) {
2309
+ return /* @__PURE__ */ jsx35(
2310
+ Drawer2.Title,
2311
+ {
2312
+ ...props,
2313
+ className: withClass("avl-navigation-drawer-title", className)
2314
+ }
2315
+ );
2316
+ }
2317
+ function NavigationDrawerItem({
2318
+ icon,
2319
+ label,
2320
+ active = false,
2321
+ end,
2322
+ href,
2323
+ render = /* @__PURE__ */ jsx35("a", { href }),
2324
+ className,
2325
+ ...props
2326
+ }) {
2327
+ return /* @__PURE__ */ jsxs23(
2328
+ Drawer2.Close,
2329
+ {
2330
+ ...props,
2331
+ render,
2332
+ nativeButton: false,
2333
+ "aria-current": active ? "page" : void 0,
2334
+ className: withClass("avl-navigation-drawer-item", className),
2335
+ children: [
2336
+ /* @__PURE__ */ jsx35(Icon, { name: icon }),
2337
+ /* @__PURE__ */ jsx35("span", { className: "avl-navigation-drawer-item-label", children: label }),
2338
+ end != null && /* @__PURE__ */ jsx35("span", { className: "avl-navigation-drawer-item-end", children: end })
2339
+ ]
2340
+ }
2341
+ );
2342
+ }
2343
+
2344
+ // src/components/NavigationRail/NavigationRail.tsx
2345
+ import { useLayoutEffect as useLayoutEffect4, useRef as useRef8, useState as useState4 } from "react";
2346
+ import { useRender as useRender3 } from "@base-ui/react/use-render";
2347
+ import { mergeProps as mergeProps3 } from "@base-ui/react/merge-props";
2348
+ import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
2349
+ var FLIP_ID = "avl-navigation-rail-flip";
2350
+ function collectParts(rail) {
2351
+ const parts = [];
2352
+ const button = rail.querySelector(
2353
+ ".avl-navigation-rail-expand-button"
2354
+ );
2355
+ if (button) parts.push({ el: button });
2356
+ for (const item of rail.querySelectorAll(
2357
+ ".avl-navigation-rail-item"
2358
+ )) {
2359
+ parts.push({ el: item });
2360
+ const icon = item.querySelector(
2361
+ ".avl-navigation-rail-item-icon"
2362
+ );
2363
+ const text = item.querySelector(
2364
+ ".avl-navigation-rail-item-text"
2365
+ );
2366
+ if (icon) parts.push({ el: icon, parent: item });
2367
+ if (text) parts.push({ el: text, parent: item, fade: true });
2368
+ const end = item.querySelector(
2369
+ ".avl-navigation-rail-item-end"
2370
+ );
2371
+ if (end) parts.push({ el: end, parent: item, fade: true });
2372
+ }
2373
+ return parts;
2374
+ }
2375
+ function NavigationRail({
2376
+ hasExpandButton,
2377
+ expanded: expandedProp,
2378
+ defaultExpanded = true,
2379
+ onExpandedChange,
2380
+ children,
2381
+ className,
2382
+ ref,
2383
+ ...props
2384
+ }) {
2385
+ const [internalExpanded, setInternalExpanded] = useState4(defaultExpanded);
2386
+ const expanded = expandedProp ?? internalExpanded;
2387
+ const toggleExpanded = () => {
2388
+ setInternalExpanded(!expanded);
2389
+ onExpandedChange?.(!expanded);
2390
+ };
2391
+ const railRef = useRef8(null);
2392
+ const lastRects = useRef8(/* @__PURE__ */ new Map());
2393
+ useLayoutEffect4(() => {
2394
+ const rail = railRef.current;
2395
+ if (!rail) return;
2396
+ const style = getComputedStyle(rail);
2397
+ const duration = parseFloat(
2398
+ style.getPropertyValue("--avl-navigation-rail-duration")
2399
+ ) || 0;
2400
+ const easing = style.getPropertyValue("--avl-navigation-rail-ease").trim() || "ease";
2401
+ const before = lastRects.current;
2402
+ const after = /* @__PURE__ */ new Map();
2403
+ const parts = collectParts(rail);
2404
+ for (const { el } of parts) {
2405
+ for (const animation of el.getAnimations()) {
2406
+ if (animation.id === FLIP_ID) animation.cancel();
2407
+ }
2408
+ after.set(el, el.getBoundingClientRect());
2409
+ }
2410
+ lastRects.current = after;
2411
+ if (!before.size || !duration) return;
2412
+ for (const { el, parent, fade } of parts) {
2413
+ const from = before.get(el);
2414
+ if (!from) continue;
2415
+ const to = after.get(el);
2416
+ let x = from.left - to.left;
2417
+ let y = from.top - to.top;
2418
+ const parentFrom = parent && before.get(parent);
2419
+ if (parentFrom) {
2420
+ const parentTo = after.get(parent);
2421
+ x -= parentFrom.left - parentTo.left;
2422
+ y -= parentFrom.top - parentTo.top;
2423
+ }
2424
+ if (fade) {
2425
+ el.animate(
2426
+ [
2427
+ { opacity: 0 },
2428
+ { opacity: 0, offset: 0.4 },
2429
+ { opacity: 1 }
2430
+ ],
2431
+ { duration, easing: "ease-out", id: FLIP_ID }
2432
+ );
2433
+ continue;
2434
+ }
2435
+ if (!x && !y) continue;
2436
+ el.animate(
2437
+ [
2438
+ { transform: `translate(${x}px, ${y}px)` },
2439
+ { transform: "none" }
2440
+ ],
2441
+ { duration, easing, id: FLIP_ID }
2442
+ );
2443
+ }
2444
+ }, [expanded]);
2445
+ return /* @__PURE__ */ jsx36(
2446
+ "nav",
2447
+ {
2448
+ ...props,
2449
+ ref: mergeRefs(railRef, ref),
2450
+ className: cx("avl-navigation-rail", className),
2451
+ "data-expanded": expanded,
2452
+ children: /* @__PURE__ */ jsxs24("div", { className: "avl-navigation-rail-content", children: [
2453
+ hasExpandButton && /* @__PURE__ */ jsx36(
2454
+ IconButton,
2455
+ {
2456
+ className: "avl-navigation-rail-expand-button",
2457
+ icon: expanded ? "menu_open" : "menu",
2458
+ "aria-label": expanded ? "Collapse menu" : "Expand menu",
2459
+ "aria-expanded": expanded,
2460
+ fillType: "text",
2461
+ color: "container",
2462
+ "data-expanded": expanded,
2463
+ onClick: toggleExpanded
2464
+ }
2465
+ ),
2466
+ /* @__PURE__ */ jsx36("div", { className: "avl-navigation-rail-item-list", children })
2467
+ ] })
2468
+ }
2469
+ );
2470
+ }
2471
+ function NavigationRailItem({
2472
+ icon,
2473
+ label,
2474
+ active = false,
2475
+ end,
2476
+ render,
2477
+ className,
2478
+ ...props
2479
+ }) {
2480
+ return useRender3({
2481
+ defaultTagName: "a",
2482
+ render,
2483
+ state: { active },
2484
+ props: mergeProps3(
2485
+ {
2486
+ className: cx("avl-navigation-rail-item", className),
2487
+ "aria-current": active ? "page" : void 0,
2488
+ children: /* @__PURE__ */ jsxs24(Fragment4, { children: [
2489
+ /* @__PURE__ */ jsx36(
2490
+ Icon,
2491
+ {
2492
+ name: icon,
2493
+ className: "avl-navigation-rail-item-icon"
2494
+ }
2495
+ ),
2496
+ /* @__PURE__ */ jsx36(
2497
+ Typography,
2498
+ {
2499
+ as: "span",
2500
+ className: "avl-navigation-rail-item-text",
2501
+ children: label
2502
+ }
2503
+ ),
2504
+ end != null && /* @__PURE__ */ jsx36("span", { className: "avl-navigation-rail-item-end", children: end })
2505
+ ] })
2506
+ },
2507
+ props
2508
+ )
2509
+ });
2510
+ }
2511
+
2512
+ // src/tokens/baseTokens.ts
2513
+ var baseDesignTokens = {
2514
+ font: {
2515
+ main: '"Google Sans", sans-serif',
2516
+ title: '"Google Sans", sans-serif',
2517
+ mono: '"Google Sans Code", monospace'
2518
+ },
2519
+ fontSize: {
2520
+ body: "16px",
2521
+ caption: "12px",
2522
+ labelSmall: "12px",
2523
+ label: "14px",
2524
+ labelLarge: "18px",
2525
+ h1: "57px",
2526
+ h2: "45px",
2527
+ h3: "36px",
2528
+ h4: "32px",
2529
+ h5: "28px",
2530
+ h6: "24px"
2531
+ },
2532
+ spacing: 4,
2533
+ radius: {
2534
+ small: "4px",
2535
+ medium: "16px",
2536
+ large: "32px",
2537
+ button: "1000px",
2538
+ full: "1000px"
2539
+ },
2540
+ outlineSize: "1.5px",
2541
+ ease: {
2542
+ out: "cubic-bezier(0.34, 1.56, 0.64, 1)",
2543
+ in: "cubic-bezier(0.36, 0, 0.66, -0.56)",
2544
+ // Material 3's standard curve
2545
+ smooth: "cubic-bezier(0.2, 0, 0, 1)"
2546
+ },
2547
+ easeLength: {
2548
+ short: "100ms",
2549
+ normal: "200ms",
2550
+ slow: "300ms"
2551
+ }
2552
+ };
2553
+
2554
+ // src/themes/baseTheme.ts
2555
+ var baseLightTheme = {
2556
+ background: "#FDF7FF",
2557
+ onBackground: "#1D1B20",
2558
+ container: "#F2ECF4",
2559
+ onContainer: "#1D1B20",
2560
+ containerLow: "#F8F2FA",
2561
+ onContainerLow: "#49454E",
2562
+ outline: "#CAC4CF",
2563
+ primary: "#65558F",
2564
+ onPrimary: "#FFFFFF",
2565
+ primaryContainer: "#E9DDFF",
2566
+ onPrimaryContainer: "#4D3D75",
2567
+ tonal: "#E8DEF8",
2568
+ onTonal: "#4A4458",
2569
+ tonalContainer: "#E8DEF8",
2570
+ onTonalContainer: "#1E192B",
2571
+ error: "#BA1A1A",
2572
+ onError: "#FFFFFF",
2573
+ errorContainer: "#FFDAD6",
2574
+ onErrorContainer: "#93000A",
2575
+ warning: "#8A5300",
2576
+ onWarning: "#FFFFFF",
2577
+ warningContainer: "#FFDDB3",
2578
+ onWarningContainer: "#2B1700",
2579
+ success: "#1E6E33",
2580
+ onSuccess: "#FFFFFF",
2581
+ successContainer: "#A6F5AE",
2582
+ onSuccessContainer: "#00210A",
2583
+ inverseSurface: "#322F35",
2584
+ inverseOnSurface: "#F5EFF7",
2585
+ inversePrimary: "#CFBDFE"
2586
+ };
2587
+ var baseDarkTheme = {
2588
+ background: "#141218",
2589
+ onBackground: "#E6E0E9",
2590
+ container: "#2B292F",
2591
+ onContainer: "#E6E0E9",
2592
+ containerLow: "#1D1B20",
2593
+ onContainerLow: "#E6E0E9",
2594
+ outline: "#948F99",
2595
+ primary: "#CFBDFE",
2596
+ onPrimary: "#36265D",
2597
+ primaryContainer: "#4D3D75",
2598
+ onPrimaryContainer: "#E9DDFF",
2599
+ tonal: "#4A4458",
2600
+ onTonal: "#E8DEF8",
2601
+ tonalContainer: "#4A4458",
2602
+ onTonalContainer: "#E8DEF8",
2603
+ error: "#FFB4AB",
2604
+ onError: "#690005",
2605
+ errorContainer: "#93000A",
2606
+ onErrorContainer: "#FFDAD6",
2607
+ warning: "#FFB95C",
2608
+ onWarning: "#472A00",
2609
+ warningContainer: "#663D00",
2610
+ onWarningContainer: "#FFDDB3",
2611
+ success: "#8CDA9B",
2612
+ onSuccess: "#00390F",
2613
+ successContainer: "#00531D",
2614
+ onSuccessContainer: "#A6F5AE",
2615
+ inverseSurface: "#E6E0E9",
2616
+ inverseOnSurface: "#322F35",
2617
+ inversePrimary: "#65558F"
2618
+ };
2619
+
2620
+ // src/themes/monochromeTheme.ts
2621
+ var monochromeLightTheme = {
2622
+ ...baseLightTheme,
2623
+ background: "#FFFFFF",
2624
+ onBackground: "#111111",
2625
+ container: "#EEEEEE",
2626
+ onContainer: "#111111",
2627
+ containerLow: "#F6F6F6",
2628
+ onContainerLow: "#474747",
2629
+ outline: "#C8C8C8",
2630
+ primary: "#000000",
2631
+ onPrimary: "#FFFFFF",
2632
+ primaryContainer: "#E2E2E2",
2633
+ onPrimaryContainer: "#1B1B1B",
2634
+ tonal: "#E8E8E8",
2635
+ onTonal: "#3B3B3B",
2636
+ tonalContainer: "#E8E8E8",
2637
+ onTonalContainer: "#1B1B1B",
2638
+ inverseSurface: "#2A2A2A",
2639
+ inverseOnSurface: "#F2F2F2",
2640
+ inversePrimary: "#FFFFFF"
2641
+ };
2642
+ var monochromeDarkTheme = {
2643
+ ...baseDarkTheme,
2644
+ background: "#0F0F0F",
2645
+ onBackground: "#E8E8E8",
2646
+ container: "#2A2A2A",
2647
+ onContainer: "#E8E8E8",
2648
+ containerLow: "#1A1A1A",
2649
+ onContainerLow: "#E8E8E8",
2650
+ outline: "#8E8E8E",
2651
+ primary: "#FFFFFF",
2652
+ onPrimary: "#000000",
2653
+ primaryContainer: "#3A3A3A",
2654
+ onPrimaryContainer: "#EDEDED",
2655
+ tonal: "#3F3F3F",
2656
+ onTonal: "#E2E2E2",
2657
+ tonalContainer: "#3F3F3F",
2658
+ onTonalContainer: "#E2E2E2",
2659
+ inverseSurface: "#E8E8E8",
2660
+ inverseOnSurface: "#2A2A2A",
2661
+ inversePrimary: "#000000"
2662
+ };
2663
+
2664
+ // src/components/AnvilRoot/AnvilRoot.tsx
2665
+ import {
2666
+ useRef as useRef9,
2667
+ useState as useState5
2668
+ } from "react";
2669
+ import { Toast as Toast2 } from "@base-ui/react/toast";
2670
+ import { Tooltip as Tooltip2 } from "@base-ui/react/tooltip";
2671
+
2672
+ // src/themes/toCssVariables.ts
2673
+ function themeToCssVariables(theme) {
2674
+ const cssVars = {};
2675
+ const { surfaceVariant, onSurfaceVariant, ...rest } = theme;
2676
+ const filled = {
2677
+ inverseSurface: theme.onBackground,
2678
+ inverseOnSurface: theme.background,
2679
+ inversePrimary: `color-mix(in srgb, ${theme.primary} 55%, ${theme.background})`,
2680
+ ...rest,
2681
+ containerLow: rest.containerLow ?? surfaceVariant,
2682
+ onContainerLow: rest.onContainerLow ?? onSurfaceVariant
2683
+ };
2684
+ for (const [key, value] of Object.entries(filled)) {
2685
+ if (value === void 0) continue;
2686
+ const kebabKey = key.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
2687
+ cssVars[`--avl-color-${kebabKey}`] = value;
2688
+ }
2689
+ cssVars["--avl-color-surface-variant"] = "var(--avl-color-container-low)";
2690
+ cssVars["--avl-color-on-surface-variant"] = "var(--avl-color-on-container-low)";
2691
+ return cssVars;
2692
+ }
2693
+
2694
+ // src/tokens/toCssVariables.ts
2695
+ var kebab = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2696
+ function tokensToCssVariables(tokens) {
2697
+ const cssVars = {};
2698
+ for (let i = 1; i <= 20; i++) {
2699
+ cssVars[`--avl-spacing-x${i}`] = `${tokens.spacing * i}px`;
2700
+ }
2701
+ for (const [category, values] of Object.entries(tokens)) {
2702
+ if (category === "spacing") continue;
2703
+ const kebabCategory = kebab(category);
2704
+ if (typeof values === "string") {
2705
+ cssVars[`--avl-${kebabCategory}`] = values;
2706
+ continue;
2707
+ }
2708
+ for (const [key, value] of Object.entries(values)) {
2709
+ cssVars[`--avl-${kebabCategory}-${kebab(key)}`] = String(value);
2710
+ }
2711
+ }
2712
+ return cssVars;
2713
+ }
2714
+
2715
+ // src/components/AnvilRoot/AnvilRoot.tsx
2716
+ import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
2717
+ function AnvilRoot(props) {
2718
+ const [internalColorMode, setInternalColorMode] = useState5(
2719
+ props.defaultColorMode || "light"
2720
+ );
2721
+ const colorMode = props.colorMode ?? internalColorMode;
2722
+ const setColorMode = (next) => {
2723
+ const value = typeof next === "function" ? next(colorMode) : next;
2724
+ setInternalColorMode(value);
2725
+ props.onColorModeChange?.(value);
2726
+ };
2727
+ const tokens = props.tokens || baseDesignTokens;
2728
+ const lightTheme = props.lightTheme || baseLightTheme;
2729
+ const darkTheme = props.darkTheme || baseDarkTheme;
2730
+ const activeTheme = colorMode === "light" ? lightTheme : darkTheme;
2731
+ const rootRef = useRef9(null);
2732
+ const cssVars = {
2733
+ ...tokensToCssVariables(tokens),
2734
+ ...themeToCssVariables(activeTheme)
2735
+ };
2736
+ return /* @__PURE__ */ jsx37(
2737
+ AnvilContext,
2738
+ {
2739
+ value: {
2740
+ colorMode,
2741
+ setColorMode,
2742
+ tokens,
2743
+ lightTheme,
2744
+ darkTheme,
2745
+ rootRef
2746
+ },
2747
+ children: /* @__PURE__ */ jsx37(
2748
+ "div",
2749
+ {
2750
+ ref: rootRef,
2751
+ className: "avl-root",
2752
+ style: cssVars,
2753
+ children: /* @__PURE__ */ jsx37(Tooltip2.Provider, { children: /* @__PURE__ */ jsxs25(Toast2.Provider, { limit: 3, children: [
2754
+ props.children,
2755
+ /* @__PURE__ */ jsx37(SnackbarViewport, {})
2756
+ ] }) })
2757
+ }
2758
+ )
2759
+ }
2760
+ );
2761
+ }
2762
+ export {
2763
+ AnvilContext,
2764
+ AnvilRoot,
2765
+ AppBar,
2766
+ Avatar,
2767
+ Badge,
2768
+ BottomSheet,
2769
+ BottomSheetClose,
2770
+ BottomSheetDescription,
2771
+ BottomSheetPopup,
2772
+ BottomSheetTitle,
2773
+ BottomSheetTrigger,
2774
+ Button,
2775
+ Card,
2776
+ CardActions,
2777
+ CardContent,
2778
+ CardTitle,
2779
+ Checkbox,
2780
+ Chip,
2781
+ Dialog,
2782
+ DialogActions,
2783
+ DialogClose,
2784
+ DialogDescription,
2785
+ DialogPopup,
2786
+ DialogTitle,
2787
+ DialogTrigger,
2788
+ Divider,
2789
+ FAB,
2790
+ Field,
2791
+ FieldDescription,
2792
+ FieldError,
2793
+ FilterChip,
2794
+ FloatingToolbar,
2795
+ FloatingToolbarButton,
2796
+ FloatingToolbarSeparator,
2797
+ HoldButton,
2798
+ Icon,
2799
+ IconButton,
2800
+ Input,
2801
+ InputChip,
2802
+ List,
2803
+ ListItem,
2804
+ Menu,
2805
+ MenuGroup,
2806
+ MenuItem,
2807
+ MenuPopup,
2808
+ MenuSubmenu,
2809
+ MenuSubmenuTrigger,
2810
+ MenuTrigger,
2811
+ NavigationBar,
2812
+ NavigationBarItem,
2813
+ NavigationDrawer,
2814
+ NavigationDrawerItem,
2815
+ NavigationDrawerPopup,
2816
+ NavigationDrawerTitle,
2817
+ NavigationDrawerTrigger,
2818
+ NavigationRail,
2819
+ NavigationRailItem,
2820
+ Popover,
2821
+ PopoverClose,
2822
+ PopoverDescription,
2823
+ PopoverPopup,
2824
+ PopoverTitle,
2825
+ PopoverTrigger,
2826
+ Progress,
2827
+ Radio,
2828
+ RadioGroup,
2829
+ Select,
2830
+ SelectItem,
2831
+ Slider,
2832
+ SplitButton,
2833
+ Switch,
2834
+ Tabs,
2835
+ TabsList,
2836
+ TabsPanel,
2837
+ TabsTab,
2838
+ Textarea,
2839
+ ToggleGroup,
2840
+ ToggleGroupItem,
2841
+ Tooltip,
2842
+ Typography,
2843
+ baseDarkTheme,
2844
+ baseDesignTokens,
2845
+ baseLightTheme,
2846
+ monochromeDarkTheme,
2847
+ monochromeLightTheme,
2848
+ morph,
2849
+ morphBetween,
2850
+ useSnackbar
2851
+ };
2852
+ //# sourceMappingURL=index.js.map