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