@lovett/ui 0.0.9 → 0.0.11

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 (55) hide show
  1. package/dist/index.d.ts +823 -135
  2. package/dist/index.js +2048 -358
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +44 -2
  5. package/dist/theme-v2.css +228 -0
  6. package/dist/tokens.css +123 -8
  7. package/package.json +1 -1
  8. package/src/__tests__/anchor.test.tsx +422 -0
  9. package/src/__tests__/combobox.test.tsx +677 -0
  10. package/src/__tests__/dropdown-menu.test.tsx +418 -0
  11. package/src/__tests__/helpers/geometry.ts +58 -0
  12. package/src/__tests__/layer-stack.test.tsx +228 -0
  13. package/src/__tests__/modal.test.tsx +180 -6
  14. package/src/__tests__/popover.test.tsx +460 -0
  15. package/src/__tests__/select.test.tsx +543 -0
  16. package/src/__tests__/tooltip.test.tsx +355 -0
  17. package/src/calculator-shell-v2.tsx +19 -39
  18. package/src/code-block.tsx +15 -26
  19. package/src/combobox.tsx +796 -0
  20. package/src/dropdown-menu.tsx +142 -152
  21. package/src/icons/brand.tsx +81 -2
  22. package/src/index.ts +111 -0
  23. package/src/lib/anchor.ts +427 -0
  24. package/src/lib/focus.ts +32 -0
  25. package/src/lib/layer-stack.ts +188 -0
  26. package/src/lib/refs.ts +31 -0
  27. package/src/metric-card.tsx +57 -22
  28. package/src/modal.tsx +149 -9
  29. package/src/page-shell.tsx +91 -2
  30. package/src/popover.tsx +407 -0
  31. package/src/segmented-pill.tsx +33 -10
  32. package/src/select.tsx +646 -0
  33. package/src/stat-row.tsx +108 -70
  34. package/src/styles.css +44 -2
  35. package/src/theme-v2.css +7 -245
  36. package/src/tokens.css +123 -8
  37. package/src/tooltip.tsx +297 -0
  38. package/src/react-syntax-highlighter-prism.d.ts +0 -34
  39. package/src/v2/README.md +0 -208
  40. package/src/v2/__demo__/showcase.tsx +0 -1045
  41. package/src/v2/action.tsx +0 -91
  42. package/src/v2/callout.tsx +0 -76
  43. package/src/v2/document-section.tsx +0 -82
  44. package/src/v2/document-shell.tsx +0 -0
  45. package/src/v2/field-row.tsx +0 -113
  46. package/src/v2/icons.tsx +0 -165
  47. package/src/v2/index.ts +0 -147
  48. package/src/v2/layout.tsx +0 -293
  49. package/src/v2/progress-track.tsx +0 -89
  50. package/src/v2/stat-tile.tsx +0 -129
  51. package/src/v2/states.tsx +0 -271
  52. package/src/v2/status-pill.tsx +0 -74
  53. package/src/v2/theme.css +0 -1861
  54. package/src/v2/timeline.tsx +0 -81
  55. package/src/v2/tokens.ts +0 -228
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import React2, { forwardRef, Children, isValidElement, useState, createContext, useContext, useId, useRef, useEffect, memo, useCallback, useMemo, useLayoutEffect, Fragment as Fragment$1, cloneElement } from 'react';
1
+ import React2, { forwardRef, Children, isValidElement, useState, createContext, useContext, useId, useRef, useEffect, cloneElement, useMemo, useCallback, useLayoutEffect, memo, Fragment as Fragment$1 } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import { twMerge } from 'tailwind-merge';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { Minus, Check, EyeOff, Eye, ChevronDown, Search, Play, VolumeX, Volume2, X, Pencil, GripVertical, Loader2, ChevronUp, ChevronsUpDown, ChevronLeft, ChevronRight, SlidersHorizontal, Copy, Plus, FolderClosed, FolderPlus, Folder, Paperclip, Upload, Image, Code, Table as Table$1, FileText, FileType, AlertCircle, RotateCcw, Link2, ArrowRight, MoreHorizontal, ThumbsUp as ThumbsUp$1, MessageCircle, Share2, Lock, Info, BarChart3, ExternalLink } from 'lucide-react';
5
+ import { Minus, Check, ChevronDown, X, Loader2, EyeOff, Eye, Search, Play, VolumeX, Volume2, Pencil, House, GripVertical, ChevronUp, ChevronsUpDown, ChevronLeft, ChevronRight, SlidersHorizontal, Copy, Plus, FolderClosed, FolderPlus, Folder, Paperclip, Upload, Image, Code, Table as Table$1, FileText, FileType, AlertCircle, RotateCcw, Link2, ArrowRight, MoreHorizontal, ThumbsUp as ThumbsUp$1, MessageCircle, Share2, Lock, Info, ExternalLink } from 'lucide-react';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { Link } from 'react-router-dom';
8
8
  import { toast, Toaster as Toaster$1 } from 'sonner';
@@ -11,20 +11,20 @@ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, close
11
11
  import { sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy, rectSortingStrategy, verticalListSortingStrategy, useSortable, arrayMove } from '@dnd-kit/sortable';
12
12
  import { CSS } from '@dnd-kit/utilities';
13
13
  import { PrismLight } from 'react-syntax-highlighter';
14
- import { oneLight, vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism/index.js';
15
- import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash.js';
16
- import css from 'react-syntax-highlighter/dist/esm/languages/prism/css.js';
17
- import diff from 'react-syntax-highlighter/dist/esm/languages/prism/diff.js';
18
- import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript.js';
19
- import json from 'react-syntax-highlighter/dist/esm/languages/prism/json.js';
20
- import jsx66 from 'react-syntax-highlighter/dist/esm/languages/prism/jsx.js';
21
- import markdown from 'react-syntax-highlighter/dist/esm/languages/prism/markdown.js';
22
- import markup from 'react-syntax-highlighter/dist/esm/languages/prism/markup.js';
23
- import python from 'react-syntax-highlighter/dist/esm/languages/prism/python.js';
24
- import sql from 'react-syntax-highlighter/dist/esm/languages/prism/sql.js';
25
- import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx.js';
26
- import typescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript.js';
27
- import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml.js';
14
+ import { oneLight, vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
15
+ import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
16
+ import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
17
+ import diff from 'react-syntax-highlighter/dist/esm/languages/prism/diff';
18
+ import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
19
+ import json from 'react-syntax-highlighter/dist/esm/languages/prism/json';
20
+ import jsx70 from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
21
+ import markdown from 'react-syntax-highlighter/dist/esm/languages/prism/markdown';
22
+ import markup from 'react-syntax-highlighter/dist/esm/languages/prism/markup';
23
+ import python from 'react-syntax-highlighter/dist/esm/languages/prism/python';
24
+ import sql from 'react-syntax-highlighter/dist/esm/languages/prism/sql';
25
+ import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx';
26
+ import typescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript';
27
+ import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml';
28
28
  import ReactMarkdown from 'react-markdown';
29
29
  import remarkGfm from 'remark-gfm';
30
30
 
@@ -481,15 +481,159 @@ var Textarea = forwardRef(function Textarea2({ error, shellClassName, className,
481
481
  }
482
482
  );
483
483
  });
484
- function Modal({ isOpen, onClose, title, children, className }) {
484
+
485
+ // src/lib/focus.ts
486
+ var FOCUSABLE_SELECTOR = [
487
+ "a[href]",
488
+ "area[href]",
489
+ "button:not([disabled])",
490
+ 'input:not([disabled]):not([type="hidden"])',
491
+ "select:not([disabled])",
492
+ "textarea:not([disabled])",
493
+ "iframe",
494
+ "summary",
495
+ '[contenteditable="true"]',
496
+ "[tabindex]"
497
+ ].join(",");
498
+ function tabbablesWithin(root) {
499
+ return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
500
+ (el) => el.tabIndex >= 0 && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true" && !el.closest("[hidden]")
501
+ );
502
+ }
503
+ var stack = [];
504
+ var listening = false;
505
+ function onDocumentKeyDown(event) {
506
+ if (event.key !== "Escape") return;
507
+ const top = stack[stack.length - 1];
508
+ if (!top) return;
509
+ event.stopPropagation();
510
+ top.onEscape(event);
511
+ }
512
+ function pushLayer(record) {
513
+ stack.push(record);
514
+ if (!listening) {
515
+ document.addEventListener("keydown", onDocumentKeyDown);
516
+ listening = true;
517
+ }
518
+ return () => {
519
+ const at = stack.lastIndexOf(record);
520
+ if (at !== -1) stack.splice(at, 1);
521
+ if (stack.length === 0 && listening) {
522
+ document.removeEventListener("keydown", onDocumentKeyDown);
523
+ listening = false;
524
+ }
525
+ };
526
+ }
527
+ function useLayer(options) {
528
+ const { enabled, kind, elementRef, onEscape } = options;
529
+ const onEscapeRef = useRef(onEscape);
530
+ useEffect(() => {
531
+ onEscapeRef.current = onEscape;
532
+ });
533
+ const recordRef = useRef(null);
534
+ useEffect(() => {
535
+ if (!enabled) return;
536
+ const record = {
537
+ kind,
538
+ element: () => elementRef?.current ?? null,
539
+ onEscape: (event) => onEscapeRef.current(event)
540
+ };
541
+ recordRef.current = record;
542
+ const pop = pushLayer(record);
543
+ return () => {
544
+ pop();
545
+ if (recordRef.current === record) recordRef.current = null;
546
+ };
547
+ }, [enabled, kind, elementRef]);
548
+ return useMemo(
549
+ () => ({
550
+ isTop: () => {
551
+ const record = recordRef.current;
552
+ return record !== null && stack[stack.length - 1] === record;
553
+ },
554
+ isTopOfKind: () => {
555
+ const record = recordRef.current;
556
+ if (!record) return false;
557
+ for (let i = stack.length - 1; i >= 0; i--) {
558
+ const layer = stack[i];
559
+ if (layer === record) return true;
560
+ if (layer?.kind === record.kind) return false;
561
+ }
562
+ return false;
563
+ },
564
+ containsInLayerAbove: (node) => {
565
+ const record = recordRef.current;
566
+ if (!record) return false;
567
+ const at = stack.indexOf(record);
568
+ if (at === -1) return false;
569
+ for (let i = at + 1; i < stack.length; i++) {
570
+ if (stack[i]?.element()?.contains(node)) return true;
571
+ }
572
+ return false;
573
+ }
574
+ }),
575
+ []
576
+ );
577
+ }
578
+ function useEscapeKey(onEscape, options = {}) {
579
+ const { enabled = true, kind = "popover" } = options;
580
+ return useLayer({ enabled, kind, onEscape });
581
+ }
582
+ function Modal({ isOpen, onClose, title, children, className, ariaLabel }) {
583
+ const panelRef = useRef(null);
584
+ const titleId = useId();
485
585
  useEffect(() => {
486
586
  if (!isOpen) return;
487
- const handleEscape = (e) => {
488
- if (e.key === "Escape") onClose();
587
+ const panel = panelRef.current;
588
+ if (!panel) return;
589
+ const previous = document.activeElement instanceof HTMLElement && document.activeElement !== document.body ? document.activeElement : null;
590
+ const initial = panel.querySelector("[data-autofocus]");
591
+ (initial ?? panel).focus();
592
+ return () => {
593
+ if (previous && previous.isConnected) previous.focus();
594
+ };
595
+ }, [isOpen]);
596
+ const layer = useLayer({
597
+ enabled: isOpen,
598
+ kind: "modal",
599
+ elementRef: panelRef,
600
+ onEscape: () => onClose()
601
+ });
602
+ useEffect(() => {
603
+ if (!isOpen) return;
604
+ const panel = panelRef.current;
605
+ if (!panel) return;
606
+ const handleKeyDown = (e) => {
607
+ if (e.key !== "Tab") return;
608
+ if (!layer.isTopOfKind()) return;
609
+ const active = document.activeElement;
610
+ if (!(active instanceof HTMLElement) || !panel.contains(active)) return;
611
+ const tabbables = tabbablesWithin(panel);
612
+ const first = tabbables[0];
613
+ const last = tabbables[tabbables.length - 1];
614
+ if (!first || !last) {
615
+ e.preventDefault();
616
+ panel.focus();
617
+ return;
618
+ }
619
+ if (active === panel) {
620
+ if (e.shiftKey) {
621
+ e.preventDefault();
622
+ last.focus();
623
+ }
624
+ return;
625
+ }
626
+ if (e.shiftKey && active === first) {
627
+ e.preventDefault();
628
+ last.focus();
629
+ } else if (!e.shiftKey && active === last) {
630
+ e.preventDefault();
631
+ first.focus();
632
+ }
489
633
  };
490
- document.addEventListener("keydown", handleEscape);
491
- return () => document.removeEventListener("keydown", handleEscape);
492
- }, [isOpen, onClose]);
634
+ document.addEventListener("keydown", handleKeyDown);
635
+ return () => document.removeEventListener("keydown", handleKeyDown);
636
+ }, [isOpen, layer]);
493
637
  if (!isOpen) return null;
494
638
  return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
495
639
  /* @__PURE__ */ jsx(
@@ -503,6 +647,12 @@ function Modal({ isOpen, onClose, title, children, className }) {
503
647
  /* @__PURE__ */ jsxs(
504
648
  "div",
505
649
  {
650
+ ref: panelRef,
651
+ role: "dialog",
652
+ "aria-modal": "true",
653
+ "aria-labelledby": title ? titleId : void 0,
654
+ "aria-label": title ? void 0 : ariaLabel,
655
+ tabIndex: -1,
506
656
  "data-framed": "true",
507
657
  className: cn(
508
658
  "ds-card-surface relative w-full max-w-2xl flex flex-col max-h-[90vh] overflow-hidden",
@@ -511,7 +661,14 @@ function Modal({ isOpen, onClose, title, children, className }) {
511
661
  style: { borderRadius: "var(--radius-xl)" },
512
662
  children: [
513
663
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 shrink-0 px-4 py-3", children: [
514
- /* @__PURE__ */ jsx("h2", { className: "text-[15px] font-bold tracking-[-0.01em] text-[rgb(var(--foreground))]", children: title }),
664
+ /* @__PURE__ */ jsx(
665
+ "h2",
666
+ {
667
+ id: titleId,
668
+ className: "text-[15px] font-bold tracking-[-0.01em] text-[rgb(var(--foreground))]",
669
+ children: title
670
+ }
671
+ ),
515
672
  /* @__PURE__ */ jsx(
516
673
  "button",
517
674
  {
@@ -1626,6 +1783,86 @@ var BRAND_ICONS = {
1626
1783
  snapchat: BrandSnapchat,
1627
1784
  tiktok: BrandTikTok
1628
1785
  };
1786
+ var COLOR_MARKS = {
1787
+ instagram: { viewBox: "0 0 256 256", path: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M128 23.064c34.177 0 38.225.13 51.722.745c12.48.57 19.258 2.655 23.769 4.408c5.974 2.322 10.238 5.096 14.717 9.575s7.253 8.743 9.575 14.717c1.753 4.511 3.838 11.289 4.408 23.768c.615 13.498.745 17.546.745 51.723s-.13 38.226-.745 51.723c-.57 12.48-2.655 19.257-4.408 23.768c-2.322 5.974-5.096 10.239-9.575 14.718s-8.743 7.253-14.717 9.574c-4.511 1.753-11.289 3.839-23.769 4.408c-13.495.616-17.543.746-51.722.746s-38.228-.13-51.723-.746c-12.48-.57-19.257-2.655-23.768-4.408c-5.974-2.321-10.239-5.095-14.718-9.574c-4.479-4.48-7.253-8.744-9.574-14.718c-1.753-4.51-3.839-11.288-4.408-23.768c-.616-13.497-.746-17.545-.746-51.723s.13-38.225.746-51.722c.57-12.48 2.655-19.258 4.408-23.769c2.321-5.974 5.095-10.238 9.574-14.717c4.48-4.48 8.744-7.253 14.718-9.575c4.51-1.753 11.288-3.838 23.768-4.408c13.497-.615 17.545-.745 51.723-.745M128 0C93.237 0 88.878.147 75.226.77c-13.625.622-22.93 2.786-31.071 5.95c-8.418 3.271-15.556 7.648-22.672 14.764S9.991 35.738 6.72 44.155C3.555 52.297 1.392 61.602.77 75.226C.147 88.878 0 93.237 0 128s.147 39.122.77 52.774c.622 13.625 2.785 22.93 5.95 31.071c3.27 8.417 7.647 15.556 14.763 22.672s14.254 11.492 22.672 14.763c8.142 3.165 17.446 5.328 31.07 5.95c13.653.623 18.012.77 52.775.77s39.122-.147 52.774-.77c13.624-.622 22.929-2.785 31.07-5.95c8.418-3.27 15.556-7.647 22.672-14.763s11.493-14.254 14.764-22.672c3.164-8.142 5.328-17.446 5.95-31.07c.623-13.653.77-18.012.77-52.775s-.147-39.122-.77-52.774c-.622-13.624-2.786-22.929-5.95-31.07c-3.271-8.418-7.648-15.556-14.764-22.672S220.262 9.99 211.845 6.72c-8.142-3.164-17.447-5.328-31.071-5.95C167.122.147 162.763 0 128 0m0 62.27c-36.302 0-65.73 29.43-65.73 65.73s29.428 65.73 65.73 65.73c36.301 0 65.73-29.428 65.73-65.73c0-36.301-29.429-65.73-65.73-65.73m0 108.397c-23.564 0-42.667-19.103-42.667-42.667S104.436 85.333 128 85.333s42.667 19.103 42.667 42.667s-19.103 42.667-42.667 42.667m83.686-110.994c0 8.484-6.876 15.36-15.36 15.36s-15.36-6.876-15.36-15.36s6.877-15.36 15.36-15.36s15.36 6.877 15.36 15.36" }) }) },
1788
+ facebook: { viewBox: "0 0 256 256", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1789
+ /* @__PURE__ */ jsx("path", { fill: "#1877f2", d: "M256 128C256 57.308 198.692 0 128 0S0 57.308 0 128c0 63.888 46.808 116.843 108 126.445V165H75.5v-37H108V99.8c0-32.08 19.11-49.8 48.348-49.8C170.352 50 185 52.5 185 52.5V84h-16.14C152.959 84 148 93.867 148 103.99V128h35.5l-5.675 37H148v89.445c61.192-9.602 108-62.556 108-126.445" }),
1790
+ /* @__PURE__ */ jsx("path", { fill: "#fff", d: "m177.825 165l5.675-37H148v-24.01C148 93.866 152.959 84 168.86 84H185V52.5S170.352 50 156.347 50C127.11 50 108 67.72 108 99.8V128H75.5v37H108v89.445A129 129 0 0 0 128 256a129 129 0 0 0 20-1.555V165z" })
1791
+ ] }) },
1792
+ meta: { viewBox: "0 0 256 171", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1793
+ /* @__PURE__ */ jsxs("defs", { children: [
1794
+ /* @__PURE__ */ jsxs("linearGradient", { id: "SVGYeLhubCc", x1: "13.878%", x2: "89.144%", y1: "55.934%", y2: "58.694%", children: [
1795
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#0064e1" }),
1796
+ /* @__PURE__ */ jsx("stop", { offset: "40%", stopColor: "#0064e1" }),
1797
+ /* @__PURE__ */ jsx("stop", { offset: "83%", stopColor: "#0073ee" }),
1798
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#0082fb" })
1799
+ ] }),
1800
+ /* @__PURE__ */ jsxs("linearGradient", { id: "SVGll66Sdsg", x1: "54.315%", x2: "54.315%", y1: "82.782%", y2: "39.307%", children: [
1801
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#0082fb" }),
1802
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#0064e0" })
1803
+ ] })
1804
+ ] }),
1805
+ /* @__PURE__ */ jsx("path", { fill: "#0081fb", d: "M27.651 112.136c0 9.775 2.146 17.28 4.95 21.82c3.677 5.947 9.16 8.466 14.751 8.466c7.211 0 13.808-1.79 26.52-19.372c10.185-14.092 22.186-33.874 30.26-46.275l13.675-21.01c9.499-14.591 20.493-30.811 33.1-41.806C161.196 4.985 172.298 0 183.47 0c18.758 0 36.625 10.87 50.3 31.257C248.735 53.584 256 81.707 256 110.729c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363v-27.616c15.695 0 19.612-14.422 19.612-30.927c0-23.52-5.484-49.623-17.564-68.273c-8.574-13.23-19.684-21.313-31.907-21.313c-13.22 0-23.859 9.97-35.815 27.75c-6.356 9.445-12.882 20.956-20.208 33.944l-8.066 14.289c-16.203 28.728-20.307 35.271-28.408 46.07c-14.2 18.91-26.324 26.076-42.287 26.076c-18.935 0-30.91-8.2-38.325-20.556C2.973 139.413 0 126.202 0 111.148z" }),
1806
+ /* @__PURE__ */ jsx("path", { fill: "url(#SVGYeLhubCc)", d: "M21.802 33.206C34.48 13.666 52.774 0 73.757 0C85.91 0 97.99 3.597 110.605 13.897c13.798 11.261 28.505 29.805 46.853 60.368l6.58 10.967c15.881 26.459 24.917 40.07 30.205 46.49c6.802 8.243 11.565 10.7 17.752 10.7c15.695 0 19.612-14.422 19.612-30.927l24.393-.766c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363c-11.395 0-21.49-2.475-32.654-13.007c-8.582-8.083-18.615-22.443-26.334-35.352l-22.96-38.352C118.528 64.08 107.96 49.73 101.845 43.23c-6.578-6.988-15.036-15.428-28.532-15.428c-10.923 0-20.2 7.666-27.963 19.39z" }),
1807
+ /* @__PURE__ */ jsx("path", { fill: "url(#SVGll66Sdsg)", d: "M73.312 27.802c-10.923 0-20.2 7.666-27.963 19.39c-10.976 16.568-17.698 41.245-17.698 64.944c0 9.775 2.146 17.28 4.95 21.82L9.027 149.482C2.973 139.413 0 126.202 0 111.148C0 83.772 7.514 55.24 21.802 33.206C34.48 13.666 52.774 0 73.757 0z" })
1808
+ ] }) },
1809
+ x: { viewBox: "0 0 251 256", path: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M149.079 108.399L242.33 0h-22.098l-80.97 94.12L74.59 0H0l97.796 142.328L0 256h22.1l85.507-99.395L175.905 256h74.59L149.073 108.399zM118.81 143.58l-9.909-14.172l-78.84-112.773h33.943l63.625 91.011l9.909 14.173l82.705 118.3H186.3l-67.49-96.533z" }) }) },
1810
+ linkedin: { viewBox: "0 0 256 256", path: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { fill: "#0a66c2", d: "M218.123 218.127h-37.931v-59.403c0-14.165-.253-32.4-19.728-32.4c-19.756 0-22.779 15.434-22.779 31.369v60.43h-37.93V95.967h36.413v16.694h.51a39.91 39.91 0 0 1 35.928-19.733c38.445 0 45.533 25.288 45.533 58.186zM56.955 79.27c-12.157.002-22.014-9.852-22.016-22.009s9.851-22.014 22.008-22.016c12.157-.003 22.014 9.851 22.016 22.008A22.013 22.013 0 0 1 56.955 79.27m18.966 138.858H37.95V95.967h37.97zM237.033.018H18.89C8.58-.098.125 8.161-.001 18.471v219.053c.122 10.315 8.576 18.582 18.89 18.474h218.144c10.336.128 18.823-8.139 18.966-18.474V18.454c-.147-10.33-8.635-18.588-18.966-18.453" }) }) },
1811
+ youtube: { viewBox: "0 0 256 180", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1812
+ /* @__PURE__ */ jsx("path", { fill: "red", d: "M250.346 28.075A32.18 32.18 0 0 0 227.69 5.418C207.824 0 127.87 0 127.87 0S47.912.164 28.046 5.582A32.18 32.18 0 0 0 5.39 28.24c-6.009 35.298-8.34 89.084.165 122.97a32.18 32.18 0 0 0 22.656 22.657c19.866 5.418 99.822 5.418 99.822 5.418s79.955 0 99.82-5.418a32.18 32.18 0 0 0 22.657-22.657c6.338-35.348 8.291-89.1-.164-123.134" }),
1813
+ /* @__PURE__ */ jsx("path", { fill: "#fff", d: "m102.421 128.06l66.328-38.418l-66.328-38.418z" })
1814
+ ] }) },
1815
+ pinterest: { viewBox: "0 0 256 256", path: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { fill: "#cb1f27", d: "M0 128.002c0 52.414 31.518 97.442 76.619 117.239c-.36-8.938-.064-19.668 2.228-29.393c2.461-10.391 16.47-69.748 16.47-69.748s-4.089-8.173-4.089-20.252c0-18.969 10.994-33.136 24.686-33.136c11.643 0 17.268 8.745 17.268 19.217c0 11.704-7.465 29.211-11.304 45.426c-3.207 13.578 6.808 24.653 20.203 24.653c24.252 0 40.586-31.149 40.586-68.055c0-28.054-18.895-49.052-53.262-49.052c-38.828 0-63.017 28.956-63.017 61.3c0 11.152 3.288 19.016 8.438 25.106c2.368 2.797 2.697 3.922 1.84 7.134c-.614 2.355-2.024 8.025-2.608 10.272c-.852 3.242-3.479 4.401-6.409 3.204c-17.884-7.301-26.213-26.886-26.213-48.902c0-36.361 30.666-79.961 91.482-79.961c48.87 0 81.035 35.364 81.035 73.325c0 50.213-27.916 87.726-69.066 87.726c-13.819 0-26.818-7.47-31.271-15.955c0 0-7.431 29.492-9.005 35.187c-2.714 9.869-8.026 19.733-12.883 27.421a127.9 127.9 0 0 0 36.277 5.249c70.684 0 127.996-57.309 127.996-128.005C256.001 57.309 198.689 0 128.005 0C57.314 0 0 57.309 0 128.002" }) }) },
1816
+ tiktok: { viewBox: "0 0 256 290", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1817
+ /* @__PURE__ */ jsx("path", { fill: "#ff004f", d: "M189.72 104.421c18.678 13.345 41.56 21.197 66.273 21.197v-47.53a67 67 0 0 1-13.918-1.456v37.413c-24.711 0-47.59-7.851-66.272-21.195v96.996c0 48.523-39.356 87.855-87.9 87.855c-18.113 0-34.949-5.473-48.934-14.86c15.962 16.313 38.222 26.432 62.848 26.432c48.548 0 87.905-39.332 87.905-87.857v-96.995zm17.17-47.952c-9.546-10.423-15.814-23.893-17.17-38.785v-6.113h-13.189c3.32 18.927 14.644 35.097 30.358 44.898M69.673 225.607a40 40 0 0 1-8.203-24.33c0-22.192 18.001-40.186 40.21-40.186a40.3 40.3 0 0 1 12.197 1.883v-48.593c-4.61-.631-9.262-.9-13.912-.801v37.822a40.3 40.3 0 0 0-12.203-1.882c-22.208 0-40.208 17.992-40.208 40.187c0 15.694 8.997 29.281 22.119 35.9" }),
1818
+ /* @__PURE__ */ jsx("path", { d: "M175.803 92.849c18.683 13.344 41.56 21.195 66.272 21.195V76.631c-13.794-2.937-26.005-10.141-35.186-20.162c-15.715-9.802-27.038-25.972-30.358-44.898h-34.643v189.843c-.079 22.132-18.049 40.052-40.21 40.052c-13.058 0-24.66-6.221-32.007-15.86c-13.12-6.618-22.118-20.206-22.118-35.898c0-22.193 18-40.187 40.208-40.187c4.255 0 8.356.662 12.203 1.882v-37.822c-47.692.985-86.047 39.933-86.047 87.834c0 23.912 9.551 45.589 25.053 61.428c13.985 9.385 30.82 14.86 48.934 14.86c48.545 0 87.9-39.335 87.9-87.857z" }),
1819
+ /* @__PURE__ */ jsx("path", { fill: "#00f2ea", d: "M242.075 76.63V66.516a66.3 66.3 0 0 1-35.186-10.047a66.47 66.47 0 0 0 35.186 20.163M176.53 11.57a68 68 0 0 1-.728-5.457V0h-47.834v189.845c-.076 22.13-18.046 40.05-40.208 40.05a40.06 40.06 0 0 1-18.09-4.287c7.347 9.637 18.949 15.857 32.007 15.857c22.16 0 40.132-17.918 40.21-40.05V11.571zM99.966 113.58v-10.769a89 89 0 0 0-12.061-.818C39.355 101.993 0 141.327 0 189.845c0 30.419 15.467 57.227 38.971 72.996c-15.502-15.838-25.053-37.516-25.053-61.427c0-47.9 38.354-86.848 86.048-87.833" })
1820
+ ] }) },
1821
+ snapchat: { viewBox: "147.353 39.286 514.631 514.631", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1822
+ /* @__PURE__ */ jsx("path", { style: { fill: "#FFFC00" }, d: "M147.553,423.021v0.023c0.308,11.424,0.403,22.914,2.33,34.268 c2.042,12.012,4.961,23.725,10.53,34.627c7.529,14.756,17.869,27.217,30.921,37.396c9.371,7.309,19.608,13.111,30.94,16.771 c16.524,5.33,33.571,7.373,50.867,7.473c10.791,0.068,21.575,0.338,32.37,0.293c78.395-0.33,156.792,0.566,235.189-0.484 c10.403-0.141,20.636-1.41,30.846-3.277c19.569-3.582,36.864-11.932,51.661-25.133c17.245-15.381,28.88-34.205,34.132-56.924 c3.437-14.85,4.297-29.916,4.444-45.035v-3.016c0-1.17-0.445-256.892-0.486-260.272c-0.115-9.285-0.799-18.5-2.54-27.636 c-2.117-11.133-5.108-21.981-10.439-32.053c-5.629-10.641-12.68-20.209-21.401-28.57c-13.359-12.81-28.775-21.869-46.722-26.661 c-16.21-4.327-32.747-5.285-49.405-5.27c-0.027-0.004-0.09-0.173-0.094-0.255H278.56c-0.005,0.086-0.008,0.172-0.014,0.255 c-9.454,0.173-18.922,0.102-28.328,1.268c-10.304,1.281-20.509,3.21-30.262,6.812c-15.362,5.682-28.709,14.532-40.11,26.347 c-12.917,13.386-22.022,28.867-26.853,46.894c-4.31,16.084-5.248,32.488-5.271,49.008", children: " " }),
1823
+ " ",
1824
+ /* @__PURE__ */ jsx("path", { style: { fill: "#FFFFFF" }, d: "M407.001,473.488c-1.068,0-2.087-0.039-2.862-0.076c-0.615,0.053-1.25,0.076-1.886,0.076 c-22.437,0-37.439-10.607-50.678-19.973c-9.489-6.703-18.438-13.031-28.922-14.775c-5.149-0.854-10.271-1.287-15.22-1.287 c-8.917,0-15.964,1.383-21.109,2.389c-3.166,0.617-5.896,1.148-8.006,1.148c-2.21,0-4.895-0.49-6.014-4.311 c-0.887-3.014-1.523-5.934-2.137-8.746c-1.536-7.027-2.65-11.316-5.281-11.723c-28.141-4.342-44.768-10.738-48.08-18.484 c-0.347-0.814-0.541-1.633-0.584-2.443c-0.129-2.309,1.501-4.334,3.777-4.711c22.348-3.68,42.219-15.492,59.064-35.119 c13.049-15.195,19.457-29.713,20.145-31.316c0.03-0.072,0.065-0.148,0.101-0.217c3.247-6.588,3.893-12.281,1.926-16.916 c-3.626-8.551-15.635-12.361-23.58-14.882c-1.976-0.625-3.845-1.217-5.334-1.808c-7.043-2.782-18.626-8.66-17.083-16.773 c1.124-5.916,8.949-10.036,15.273-10.036c1.756,0,3.312,0.308,4.622,0.923c7.146,3.348,13.575,5.045,19.104,5.045 c6.876,0,10.197-2.618,11-3.362c-0.198-3.668-0.44-7.546-0.674-11.214c0-0.004-0.005-0.048-0.005-0.048 c-1.614-25.675-3.627-57.627,4.546-75.95c24.462-54.847,76.339-59.112,91.651-59.112c0.408,0,6.674-0.062,6.674-0.062 c0.283-0.005,0.59-0.009,0.908-0.009c15.354,0,67.339,4.27,91.816,59.15c8.173,18.335,6.158,50.314,4.539,76.016l-0.076,1.23 c-0.222,3.49-0.427,6.793-0.6,9.995c0.756,0.696,3.795,3.096,9.978,3.339c5.271-0.202,11.328-1.891,17.998-5.014 c2.062-0.968,4.345-1.169,5.895-1.169c2.343,0,4.727,0.456,6.714,1.285l0.106,0.041c5.66,2.009,9.367,6.024,9.447,10.242 c0.071,3.932-2.851,9.809-17.223,15.485c-1.472,0.583-3.35,1.179-5.334,1.808c-7.952,2.524-19.951,6.332-23.577,14.878 c-1.97,4.635-1.322,10.326,1.926,16.912c0.036,0.072,0.067,0.145,0.102,0.221c1,2.344,25.205,57.535,79.209,66.432 c2.275,0.379,3.908,2.406,3.778,4.711c-0.048,0.828-0.248,1.656-0.598,2.465c-3.289,7.703-19.915,14.09-48.064,18.438 c-2.642,0.408-3.755,4.678-5.277,11.668c-0.63,2.887-1.271,5.717-2.146,8.691c-0.819,2.797-2.641,4.164-5.567,4.164h-0.441 c-1.905,0-4.604-0.346-8.008-1.012c-5.95-1.158-12.623-2.236-21.109-2.236c-4.948,0-10.069,0.434-15.224,1.287 c-10.473,1.744-19.421,8.062-28.893,14.758C444.443,462.88,429.436,473.488,407.001,473.488", children: " " }),
1825
+ " ",
1826
+ /* @__PURE__ */ jsx("path", { style: { fill: "#020202" }, d: "M408.336,124.235c14.455,0,64.231,3.883,87.688,56.472c7.724,17.317,5.744,48.686,4.156,73.885 c-0.248,3.999-0.494,7.875-0.694,11.576l-0.084,1.591l1.062,1.185c0.429,0.476,4.444,4.672,13.374,5.017l0.144,0.008l0.15-0.003 c5.904-0.225,12.554-2.059,19.776-5.442c1.064-0.498,2.48-0.741,3.978-0.741c1.707,0,3.521,0.321,5.017,0.951l0.226,0.09 c3.787,1.327,6.464,3.829,6.505,6.093c0.022,1.28-0.935,5.891-14.359,11.194c-1.312,0.518-3.039,1.069-5.041,1.7 c-8.736,2.774-21.934,6.96-26.376,17.427c-2.501,5.896-1.816,12.854,2.034,20.678c1.584,3.697,26.52,59.865,82.631,69.111 c-0.011,0.266-0.079,0.557-0.229,0.9c-0.951,2.24-6.996,9.979-44.612,15.783c-5.886,0.902-7.328,7.5-9,15.17 c-0.604,2.746-1.218,5.518-2.062,8.381c-0.258,0.865-0.306,0.914-1.233,0.914c-0.128,0-0.278,0-0.442,0 c-1.668,0-4.2-0.346-7.135-0.922c-5.345-1.041-12.647-2.318-21.982-2.318c-5.21,0-10.577,0.453-15.962,1.352 c-11.511,1.914-20.872,8.535-30.786,15.543c-13.314,9.408-27.075,19.143-48.071,19.143c-0.917,0-1.812-0.031-2.709-0.076 l-0.236-0.01l-0.237,0.018c-0.515,0.045-1.034,0.068-1.564,0.068c-20.993,0-34.76-9.732-48.068-19.143 c-9.916-7.008-19.282-13.629-30.791-15.543c-5.38-0.896-10.752-1.352-15.959-1.352c-9.333,0-16.644,1.428-21.978,2.471 c-2.935,0.574-5.476,1.066-7.139,1.066c-1.362,0-1.388-0.08-1.676-1.064c-0.844-2.865-1.461-5.703-2.062-8.445 c-1.676-7.678-3.119-14.312-9.002-15.215c-37.613-5.809-43.659-13.561-44.613-15.795c-0.149-0.352-0.216-0.652-0.231-0.918 c56.11-9.238,81.041-65.408,82.63-69.119c3.857-7.818,4.541-14.775,2.032-20.678c-4.442-10.461-17.638-14.653-26.368-17.422 c-2.007-0.635-3.735-1.187-5.048-1.705c-11.336-4.479-14.823-8.991-14.305-11.725c0.601-3.153,6.067-6.359,10.837-6.359 c1.072,0,2.012,0.173,2.707,0.498c7.747,3.631,14.819,5.472,21.022,5.472c9.751,0,14.091-4.537,14.557-5.055l1.057-1.182 l-0.085-1.583c-0.197-3.699-0.44-7.574-0.696-11.565c-1.583-25.205-3.563-56.553,4.158-73.871 c23.37-52.396,72.903-56.435,87.525-56.435c0.36,0,6.717-0.065,6.717-0.065C407.744,124.239,408.033,124.235,408.336,124.235 M408.336,115.197h-0.017c-0.333,0-0.646,0-0.944,0.004c-2.376,0.024-6.282,0.062-6.633,0.066c-8.566,0-25.705,1.21-44.115,9.336 c-10.526,4.643-19.994,10.921-28.14,18.66c-9.712,9.221-17.624,20.59-23.512,33.796c-8.623,19.336-6.576,51.905-4.932,78.078 l0.006,0.041c0.176,2.803,0.361,5.73,0.53,8.582c-1.265,0.581-3.316,1.194-6.339,1.194c-4.864,0-10.648-1.555-17.187-4.619 c-1.924-0.896-4.12-1.349-6.543-1.349c-3.893,0-7.997,1.146-11.557,3.239c-4.479,2.63-7.373,6.347-8.159,10.468 c-0.518,2.726-0.493,8.114,5.492,13.578c3.292,3.008,8.128,5.782,14.37,8.249c1.638,0.645,3.582,1.261,5.641,1.914 c7.145,2.271,17.959,5.702,20.779,12.339c1.429,3.365,0.814,7.793-1.823,13.145c-0.069,0.146-0.138,0.289-0.201,0.439 c-0.659,1.539-6.807,15.465-19.418,30.152c-7.166,8.352-15.059,15.332-23.447,20.752c-10.238,6.617-21.316,10.943-32.923,12.855 c-4.558,0.748-7.813,4.809-7.559,9.424c0.078,1.33,0.39,2.656,0.931,3.939c0.004,0.008,0.009,0.016,0.013,0.023 c1.843,4.311,6.116,7.973,13.063,11.203c8.489,3.943,21.185,7.26,37.732,9.855c0.836,1.59,1.704,5.586,2.305,8.322 c0.629,2.908,1.285,5.898,2.22,9.074c1.009,3.441,3.626,7.553,10.349,7.553c2.548,0,5.478-0.574,8.871-1.232 c4.969-0.975,11.764-2.305,20.245-2.305c4.702,0,9.575,0.414,14.48,1.229c9.455,1.574,17.606,7.332,27.037,14 c13.804,9.758,29.429,20.803,53.302,20.803c0.651,0,1.304-0.021,1.949-0.066c0.789,0.037,1.767,0.066,2.799,0.066 c23.88,0,39.501-11.049,53.29-20.799l0.022-0.02c9.433-6.66,17.575-12.41,27.027-13.984c4.903-0.814,9.775-1.229,14.479-1.229 c8.102,0,14.517,1.033,20.245,2.15c3.738,0.736,6.643,1.09,8.872,1.09l0.218,0.004h0.226c4.917,0,8.53-2.699,9.909-7.422 c0.916-3.109,1.57-6.029,2.215-8.986c0.562-2.564,1.46-6.674,2.296-8.281c16.558-2.6,29.249-5.91,37.739-9.852 c6.931-3.215,11.199-6.873,13.053-11.166c0.556-1.287,0.881-2.621,0.954-3.979c0.261-4.607-2.999-8.676-7.56-9.424 c-51.585-8.502-74.824-61.506-75.785-63.758c-0.062-0.148-0.132-0.295-0.205-0.438c-2.637-5.354-3.246-9.777-1.816-13.148 c2.814-6.631,13.621-10.062,20.771-12.332c2.07-0.652,4.021-1.272,5.646-1.914c7.039-2.78,12.07-5.796,15.389-9.221 c3.964-4.083,4.736-7.995,4.688-10.555c-0.121-6.194-4.856-11.698-12.388-14.393c-2.544-1.052-5.445-1.607-8.399-1.607 c-2.011,0-4.989,0.276-7.808,1.592c-6.035,2.824-11.441,4.368-16.082,4.588c-2.468-0.125-4.199-0.66-5.32-1.171 c0.141-2.416,0.297-4.898,0.458-7.486l0.067-1.108c1.653-26.19,3.707-58.784-4.92-78.134c-5.913-13.253-13.853-24.651-23.604-33.892 c-8.178-7.744-17.678-14.021-28.242-18.661C434.052,116.402,416.914,115.197,408.336,115.197", children: " " }),
1827
+ " ",
1828
+ /* @__PURE__ */ jsx("rect", { x: "147.553", y: "39.443", style: { fill: "none" }, width: "514.231", height: "514.23", children: " " })
1829
+ ] }) },
1830
+ google: { viewBox: "0 0 256 262", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1831
+ /* @__PURE__ */ jsx("path", { fill: "#4285f4", d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027" }),
1832
+ /* @__PURE__ */ jsx("path", { fill: "#34a853", d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1" }),
1833
+ /* @__PURE__ */ jsx("path", { fill: "#fbbc05", d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z" }),
1834
+ /* @__PURE__ */ jsx("path", { fill: "#eb4335", d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251" })
1835
+ ] }) },
1836
+ amazon: { viewBox: "0 0 512 512", path: /* @__PURE__ */ jsxs(Fragment, { children: [
1837
+ /* @__PURE__ */ jsx("path", { d: "m0 0H512V512H0", fill: "#f90" }),
1838
+ /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M283 187c-62 2-121 19-121 81 0 43 26 64 61 64 31 0 51-12 68-30 8 11 10 16 24 27q5 3 10-1l31-27q4-4 0-10c-7-11-15-19-15-39v-64c0-27 2-52-18-70-17-16-38-20-62-21-53-1-88 28-93 62q-1 8 7 9l37 5c6 1 9-4 10-8 6-22 29-28 43-23 20 6 18 29 18 45m-36 105c-15 0-25-13-25-30 1-36 29-42 61-42v18c0 32-17 54-36 54m168 106c13-11 26-38 25-57 0-7-1-8-8-10-13-4-46-5-62 10-3 3-2 5 1 5 11-2 45-6 50 2 4 7-8 35-12 47-2 5 2 6 6 3M58 342c96 91 247 94 345 25 7-4 0-12-6-9A376 376 0 0162 337c-4-3-8 2-4 5" })
1839
+ ] }) },
1840
+ walmart: { viewBox: "-231.5 619.2 64 64", path: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M-199.47 640.732c1.488 0 2.778-.794 2.878-1.786l1.488-16.77c0-1.687-1.985-2.977-4.366-2.977-2.48 0-4.366 1.4-4.366 2.977l1.488 16.77c.1.992 1.4 1.786 2.878 1.786M-208.6 646c.794-1.3.695-2.778-.1-3.374L-222.492 633c-1.4-.794-3.572.198-4.763 2.282s-.992 4.465.397 5.26l15.28 7.144c.992.298 2.282-.397 2.977-1.687m18.16 0c.794 1.3 2.084 1.984 2.977 1.588l15.28-7.144c1.4-.794 1.687-3.175.397-5.26-1.2-2.084-3.374-3.076-4.763-2.282l-13.792 9.625c-.794.695-.893 2.183-.1 3.473m-9.027 15.678c1.488 0 2.778.794 2.878 1.786l1.488 16.77c0 1.687-1.985 2.977-4.366 2.977-2.48 0-4.366-1.4-4.366-2.977l1.488-16.77c.1-.992 1.4-1.786 2.878-1.786m9.027-5.277c.794-1.3 2.084-1.985 2.977-1.588l15.28 7.045c1.4.794 1.687 3.175.397 5.26-1.2 2.084-3.374 3.076-4.763 2.282l-13.792-9.625c-.794-.595-.893-2.084-.1-3.374m-18.157 0c.794 1.3.695 2.778-.1 3.374l-13.792 9.625c-1.4.794-3.572-.198-4.763-2.282s-.992-4.465.397-5.26l15.28-7.045c.992-.397 2.282.298 2.977 1.588" }) }) }
1841
+ };
1842
+ function hasBrandIcon(name) {
1843
+ return name in COLOR_MARKS;
1844
+ }
1845
+ function BrandIcon({ name, size = 16, className, title }) {
1846
+ const mark = COLOR_MARKS[name];
1847
+ if (!mark) return null;
1848
+ return /* @__PURE__ */ jsxs(
1849
+ "svg",
1850
+ {
1851
+ viewBox: mark.viewBox,
1852
+ width: size,
1853
+ height: size,
1854
+ className,
1855
+ preserveAspectRatio: "xMidYMid meet",
1856
+ role: title ? "img" : void 0,
1857
+ "aria-hidden": title ? void 0 : true,
1858
+ focusable: "false",
1859
+ children: [
1860
+ title && /* @__PURE__ */ jsx("title", { children: title }),
1861
+ mark.path
1862
+ ]
1863
+ }
1864
+ );
1865
+ }
1629
1866
  var RING_FILLS = ["rgb(var(--accent) / 0.45)", "rgb(var(--accent) / 0.28)", "rgb(var(--accent) / 0.14)"];
1630
1867
  var RING_STROKE = "rgb(var(--accent) / 0.5)";
1631
1868
  var GRID_STROKE = "rgb(var(--foreground) / 0.04)";
@@ -1655,7 +1892,10 @@ function Choropleth({ mode = "radius", className, style }) {
1655
1892
  );
1656
1893
  }
1657
1894
  var PageHeaderSlotContext = createContext(null);
1658
- function PageHeaderSlotProvider({ children }) {
1895
+ function PageHeaderSlotProvider({
1896
+ children,
1897
+ home = null
1898
+ }) {
1659
1899
  const [hostEl, setHostEl] = useState(null);
1660
1900
  const [centerEl, setCenterEl] = useState(null);
1661
1901
  const [scrollEl, setScrollEl] = useState(null);
@@ -1669,6 +1909,7 @@ function PageHeaderSlotProvider({ children }) {
1669
1909
  PageHeaderSlotContext.Provider,
1670
1910
  {
1671
1911
  value: {
1912
+ home,
1672
1913
  hostEl,
1673
1914
  centerEl,
1674
1915
  scrollEl,
@@ -1858,17 +2099,39 @@ function PageHeaderHost({
1858
2099
  }
1859
2100
  );
1860
2101
  }
2102
+ function useBreadcrumbHome() {
2103
+ return useContext(PageHeaderSlotContext)?.home ?? null;
2104
+ }
2105
+ function HomeCrumbLink({ home }) {
2106
+ return /* @__PURE__ */ jsx(
2107
+ Link,
2108
+ {
2109
+ to: home.to,
2110
+ "aria-label": home.label,
2111
+ title: home.label,
2112
+ className: "shrink-0 flex items-center transition-colors hover:text-[rgb(var(--foreground))]",
2113
+ style: { color: "inherit" },
2114
+ children: /* @__PURE__ */ jsx(House, { className: "h-[15px] w-[15px]", strokeWidth: 1.9, "aria-hidden": "true" })
2115
+ }
2116
+ );
2117
+ }
1861
2118
  function Breadcrumbs({
1862
2119
  parents,
1863
2120
  current
1864
2121
  }) {
2122
+ const home = useBreadcrumbHome();
2123
+ const visibleParents = home && parents[0]?.to === home.to ? parents.slice(1) : parents;
1865
2124
  return /* @__PURE__ */ jsxs(
1866
2125
  "nav",
1867
2126
  {
1868
2127
  className: "flex items-center gap-1.5 text-[13px] min-w-0",
1869
2128
  style: { color: "rgb(var(--text-tertiary))" },
1870
2129
  children: [
1871
- parents.map((c, i) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 min-w-0", children: [
2130
+ home && /* @__PURE__ */ jsxs(Fragment, { children: [
2131
+ /* @__PURE__ */ jsx(HomeCrumbLink, { home }),
2132
+ (visibleParents.length > 0 || current) && /* @__PURE__ */ jsx("span", { className: "shrink-0", style: { color: "rgb(var(--text-muted))" }, children: "/" })
2133
+ ] }),
2134
+ visibleParents.map((c, i) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 min-w-0", children: [
1872
2135
  c.to ? /* @__PURE__ */ jsx(
1873
2136
  Link,
1874
2137
  {
@@ -2412,6 +2675,16 @@ function OptionTileGroup(props) {
2412
2675
  }
2413
2676
  );
2414
2677
  }
2678
+
2679
+ // src/lib/clipboard.ts
2680
+ async function copyText(value, label) {
2681
+ try {
2682
+ await navigator.clipboard.writeText(value);
2683
+ toast.success(label ? `Copied ${label}` : `Copied ${value}`);
2684
+ } catch {
2685
+ toast.error("Copy failed");
2686
+ }
2687
+ }
2415
2688
  var TONE_COLOR = {
2416
2689
  neutral: "rgb(var(--foreground))",
2417
2690
  accent: "rgb(var(--accent))",
@@ -2426,7 +2699,9 @@ function MetricCard({
2426
2699
  tone = "neutral",
2427
2700
  icon,
2428
2701
  labelPosition = "bottom",
2429
- className
2702
+ className,
2703
+ copyable = false,
2704
+ copyValue
2430
2705
  }) {
2431
2706
  const labelEl = labelPosition === "top" ? /* @__PURE__ */ jsx(
2432
2707
  "div",
@@ -2454,24 +2729,40 @@ function MetricCard({
2454
2729
  }
2455
2730
  )
2456
2731
  ] });
2457
- return /* @__PURE__ */ jsx(
2458
- "div",
2459
- {
2460
- className: className ?? "flex flex-col gap-1 px-4 py-3 border",
2461
- style: {
2462
- background: "rgb(var(--surface-overlay-soft))",
2463
- borderColor: "rgb(var(--border))",
2464
- borderRadius: "var(--radius-lg)"
2465
- },
2466
- children: labelPosition === "top" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2467
- labelEl,
2468
- valueEl
2469
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2470
- valueEl,
2471
- labelEl
2472
- ] })
2473
- }
2474
- );
2732
+ const body = labelPosition === "top" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2733
+ labelEl,
2734
+ valueEl
2735
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2736
+ valueEl,
2737
+ labelEl
2738
+ ] });
2739
+ const surfaceClass = className ?? "flex flex-col gap-1 px-4 py-3 border";
2740
+ const surfaceStyle = {
2741
+ background: "rgb(var(--surface-overlay-soft))",
2742
+ borderColor: "rgb(var(--border))",
2743
+ borderRadius: "var(--radius-lg)"
2744
+ };
2745
+ const text = copyValue ?? (typeof value === "string" ? value : void 0);
2746
+ if (copyable && text !== void 0) {
2747
+ return /* @__PURE__ */ jsx(
2748
+ "button",
2749
+ {
2750
+ type: "button",
2751
+ onClick: () => void copyText(text, label),
2752
+ title: `Copy ${label}`,
2753
+ "aria-label": `Copy ${label}: ${text}`,
2754
+ className: cn(
2755
+ surfaceClass,
2756
+ "text-left cursor-pointer transition-[border-color,box-shadow]",
2757
+ "hover:border-[rgb(var(--border-strong))] hover:[box-shadow:var(--shadow-sm)]",
2758
+ "focus-visible:outline-none focus-visible:[box-shadow:var(--ring-focus)]"
2759
+ ),
2760
+ style: surfaceStyle,
2761
+ children: body
2762
+ }
2763
+ );
2764
+ }
2765
+ return /* @__PURE__ */ jsx("div", { className: surfaceClass, style: surfaceStyle, children: body });
2475
2766
  }
2476
2767
  function ProgressBar({ label, percent, status, height = 8 }) {
2477
2768
  const determinate = typeof percent === "number";
@@ -2727,16 +3018,6 @@ function TokenBadge({
2727
3018
  }
2728
3019
  );
2729
3020
  }
2730
-
2731
- // src/lib/clipboard.ts
2732
- async function copyText(value, label) {
2733
- try {
2734
- await navigator.clipboard.writeText(value);
2735
- toast.success(label ? `Copied ${label}` : `Copied ${value}`);
2736
- } catch {
2737
- toast.error("Copy failed");
2738
- }
2739
- }
2740
3021
  var ValueChip = forwardRef(
2741
3022
  function ValueChip2({ children, copyValue, copyLabel, size = "md", fill, className, ...rest }, ref) {
2742
3023
  const shared = cn(
@@ -3426,6 +3707,403 @@ var Checkbox = forwardRef(
3426
3707
  );
3427
3708
  }
3428
3709
  );
3710
+
3711
+ // src/lib/refs.ts
3712
+ function assignRef(ref, node) {
3713
+ if (!ref) return;
3714
+ if (typeof ref === "function") {
3715
+ ref(node);
3716
+ return;
3717
+ }
3718
+ ref.current = node;
3719
+ }
3720
+ function composeRefs(...refs) {
3721
+ return (node) => {
3722
+ for (const ref of refs) assignRef(ref, node);
3723
+ };
3724
+ }
3725
+ var OPPOSITE = {
3726
+ top: "bottom",
3727
+ bottom: "top",
3728
+ left: "right",
3729
+ right: "left"
3730
+ };
3731
+ function isVertical(side) {
3732
+ return side === "top" || side === "bottom";
3733
+ }
3734
+ function clampNumber(value, min, max) {
3735
+ return Math.max(min, Math.min(value, max));
3736
+ }
3737
+ function computeAnchoredPosition(anchor, floating, viewport, options = {}) {
3738
+ const {
3739
+ side: preferred = "bottom",
3740
+ align = "start",
3741
+ offset = 6,
3742
+ alignOffset = 0,
3743
+ flip = true,
3744
+ clampToViewport = true,
3745
+ gutter = 8
3746
+ } = options;
3747
+ const anchorRight = anchor.left + anchor.width;
3748
+ const anchorBottom = anchor.top + anchor.height;
3749
+ const room = {
3750
+ top: anchor.top - gutter,
3751
+ bottom: viewport.height - anchorBottom - gutter,
3752
+ left: anchor.left - gutter,
3753
+ right: viewport.width - anchorRight - gutter
3754
+ };
3755
+ const needed = (side2) => (isVertical(side2) ? floating.height : floating.width) + offset;
3756
+ let side = preferred;
3757
+ if (flip && room[preferred] < needed(preferred)) {
3758
+ const opposite = OPPOSITE[preferred];
3759
+ if (room[opposite] >= needed(opposite) || room[opposite] > room[preferred]) {
3760
+ side = opposite;
3761
+ }
3762
+ }
3763
+ let left;
3764
+ let top;
3765
+ if (isVertical(side)) {
3766
+ top = side === "bottom" ? anchorBottom + offset : anchor.top - floating.height - offset;
3767
+ switch (align) {
3768
+ case "start":
3769
+ left = anchor.left + alignOffset;
3770
+ break;
3771
+ case "center":
3772
+ left = anchor.left + anchor.width / 2 - floating.width / 2 + alignOffset;
3773
+ break;
3774
+ case "end":
3775
+ left = anchorRight - floating.width - alignOffset;
3776
+ break;
3777
+ }
3778
+ } else {
3779
+ left = side === "right" ? anchorRight + offset : anchor.left - floating.width - offset;
3780
+ switch (align) {
3781
+ case "start":
3782
+ top = anchor.top + alignOffset;
3783
+ break;
3784
+ case "center":
3785
+ top = anchor.top + anchor.height / 2 - floating.height / 2 + alignOffset;
3786
+ break;
3787
+ case "end":
3788
+ top = anchorBottom - floating.height - alignOffset;
3789
+ break;
3790
+ }
3791
+ }
3792
+ if (clampToViewport) {
3793
+ left = clampNumber(left, gutter, viewport.width - floating.width - gutter);
3794
+ top = clampNumber(top, gutter, viewport.height - floating.height - gutter);
3795
+ }
3796
+ return {
3797
+ left: Math.round(left),
3798
+ top: Math.round(top),
3799
+ placement: { side, align }
3800
+ };
3801
+ }
3802
+ var PARKED_STYLE = {
3803
+ position: "fixed",
3804
+ // Parked far off-screen, not at (0, 0): if a renderer paints the
3805
+ // unpositioned frame despite `visibility: hidden`, nothing flashes at the
3806
+ // viewport's top-left corner.
3807
+ left: -99999,
3808
+ top: -99999,
3809
+ visibility: "hidden",
3810
+ opacity: 0,
3811
+ pointerEvents: "none"
3812
+ };
3813
+ function viewportSize() {
3814
+ const root = document.documentElement;
3815
+ return {
3816
+ width: root.clientWidth || window.innerWidth,
3817
+ height: root.clientHeight || window.innerHeight
3818
+ };
3819
+ }
3820
+ function samePosition(a, b) {
3821
+ return a !== null && a.left === b.left && a.top === b.top && a.placement.side === b.placement.side && a.placement.align === b.placement.align;
3822
+ }
3823
+ function useAnchoredPosition(options) {
3824
+ const {
3825
+ anchorRef,
3826
+ anchorRect = null,
3827
+ enabled = true,
3828
+ side = "bottom",
3829
+ align = "start",
3830
+ offset = 6,
3831
+ alignOffset = 0,
3832
+ flip = true,
3833
+ clampToViewport = true,
3834
+ gutter = 8
3835
+ } = options;
3836
+ const floatingRef = useRef(null);
3837
+ const [floating, setFloating] = useState(null);
3838
+ const ref = useCallback((node) => {
3839
+ floatingRef.current = node;
3840
+ setFloating(node);
3841
+ }, []);
3842
+ const [position, setPosition] = useState(null);
3843
+ const anchorRectRef = useRef(anchorRect);
3844
+ useLayoutEffect(() => {
3845
+ anchorRectRef.current = anchorRect;
3846
+ });
3847
+ const rectKey = anchorRect ? `${anchorRect.left}|${anchorRect.top}|${anchorRect.width}|${anchorRect.height}` : "";
3848
+ const measure = useCallback(() => {
3849
+ const node = floatingRef.current;
3850
+ if (!node) return;
3851
+ const rect = anchorRectRef.current ?? anchorRef?.current?.getBoundingClientRect() ?? null;
3852
+ if (!rect) return;
3853
+ const next = computeAnchoredPosition(
3854
+ rect,
3855
+ { width: node.offsetWidth, height: node.offsetHeight },
3856
+ viewportSize(),
3857
+ { side, align, offset, alignOffset, flip, clampToViewport, gutter }
3858
+ );
3859
+ setPosition((prev) => samePosition(prev, next) ? prev : next);
3860
+ }, [anchorRef, side, align, offset, alignOffset, flip, clampToViewport, gutter]);
3861
+ useLayoutEffect(() => {
3862
+ if (!enabled || !floating) {
3863
+ setPosition((prev) => prev === null ? prev : null);
3864
+ return;
3865
+ }
3866
+ measure();
3867
+ window.addEventListener("resize", measure);
3868
+ window.addEventListener("scroll", measure, true);
3869
+ let observer = null;
3870
+ if (typeof ResizeObserver !== "undefined") {
3871
+ observer = new ResizeObserver(() => measure());
3872
+ observer.observe(floating);
3873
+ const anchorEl = anchorRef?.current;
3874
+ if (anchorEl) observer.observe(anchorEl);
3875
+ }
3876
+ return () => {
3877
+ window.removeEventListener("resize", measure);
3878
+ window.removeEventListener("scroll", measure, true);
3879
+ observer?.disconnect();
3880
+ };
3881
+ }, [enabled, floating, measure, anchorRef, rectKey]);
3882
+ const positioned = position !== null;
3883
+ const style = positioned ? { position: "fixed", left: position.left, top: position.top } : PARKED_STYLE;
3884
+ return {
3885
+ ref,
3886
+ floatingRef,
3887
+ style,
3888
+ placement: position?.placement ?? null,
3889
+ positioned,
3890
+ update: measure
3891
+ };
3892
+ }
3893
+ function useOutsideClick(targets, onOutside, options = {}) {
3894
+ const { enabled = true, layer } = options;
3895
+ const targetsRef = useRef(targets);
3896
+ const handlerRef = useRef(onOutside);
3897
+ useEffect(() => {
3898
+ targetsRef.current = targets;
3899
+ handlerRef.current = onOutside;
3900
+ });
3901
+ useEffect(() => {
3902
+ if (!enabled) return;
3903
+ const onPointerDown = (event) => {
3904
+ const target = event.target;
3905
+ if (!(target instanceof Node)) return;
3906
+ for (const candidate of targetsRef.current) {
3907
+ const el = candidate instanceof Node ? candidate : candidate?.current;
3908
+ if (el?.contains(target)) return;
3909
+ }
3910
+ if (layer?.containsInLayerAbove(target)) return;
3911
+ handlerRef.current(event);
3912
+ };
3913
+ document.addEventListener("pointerdown", onPointerDown);
3914
+ return () => document.removeEventListener("pointerdown", onPointerDown);
3915
+ }, [enabled, layer]);
3916
+ }
3917
+ var POPOVER_SURFACE_STYLE = {
3918
+ background: "rgb(var(--popover))",
3919
+ color: "rgb(var(--popover-foreground))",
3920
+ border: "1px solid rgb(var(--border))",
3921
+ boxShadow: "var(--shadow-lg)"
3922
+ };
3923
+ var PopoverCtx = createContext(null);
3924
+ function usePopoverCtx(consumer) {
3925
+ const ctx = useContext(PopoverCtx);
3926
+ if (!ctx) {
3927
+ throw new Error(
3928
+ `${consumer} must be rendered inside <Popover>. Wrap your trigger + content with the Popover root component.`
3929
+ );
3930
+ }
3931
+ return ctx;
3932
+ }
3933
+ function PopoverRoot({
3934
+ open: controlledOpen,
3935
+ defaultOpen,
3936
+ onOpenChange,
3937
+ anchorRect = null,
3938
+ children
3939
+ }) {
3940
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
3941
+ const isControlled = controlledOpen !== void 0;
3942
+ const open = isControlled ? Boolean(controlledOpen) : uncontrolledOpen;
3943
+ const triggerRef = useRef(null);
3944
+ const interactedOutsideRef = useRef(false);
3945
+ const generatedId = useId();
3946
+ const contentId = `popover-${generatedId.replace(/:/g, "")}`;
3947
+ const setOpen = useCallback(
3948
+ (next) => {
3949
+ if (!isControlled) setUncontrolledOpen(next);
3950
+ onOpenChange?.(next);
3951
+ },
3952
+ [isControlled, onOpenChange]
3953
+ );
3954
+ const value = useMemo(
3955
+ () => ({ open, setOpen, triggerRef, contentId, anchorRect, interactedOutsideRef }),
3956
+ [open, setOpen, contentId, anchorRect]
3957
+ );
3958
+ return /* @__PURE__ */ jsx(PopoverCtx.Provider, { value, children });
3959
+ }
3960
+ var PopoverTrigger = forwardRef(
3961
+ function PopoverTrigger2({ asChild, onClick, children, ...rest }, forwardedRef) {
3962
+ const { open, setOpen, triggerRef, contentId } = usePopoverCtx("Popover.Trigger");
3963
+ const ariaProps = {
3964
+ "aria-haspopup": "dialog",
3965
+ "aria-expanded": open,
3966
+ "aria-controls": open ? contentId : void 0,
3967
+ "data-state": open ? "open" : "closed"
3968
+ };
3969
+ if (asChild) {
3970
+ if (!isValidElement(children)) {
3971
+ throw new Error("Popover.Trigger with `asChild` expects exactly one element child.");
3972
+ }
3973
+ const child = children;
3974
+ const childOnClick = child.props.onClick;
3975
+ return cloneElement(child, {
3976
+ ...rest,
3977
+ ...ariaProps,
3978
+ ref: composeRefs(child.props.ref, forwardedRef, triggerRef),
3979
+ onClick: (event) => {
3980
+ childOnClick?.(event);
3981
+ onClick?.(event);
3982
+ if (!event.defaultPrevented) setOpen(!open);
3983
+ }
3984
+ });
3985
+ }
3986
+ return /* @__PURE__ */ jsx(
3987
+ "button",
3988
+ {
3989
+ ref: composeRefs(forwardedRef, triggerRef),
3990
+ type: "button",
3991
+ ...ariaProps,
3992
+ onClick: (event) => {
3993
+ onClick?.(event);
3994
+ if (!event.defaultPrevented) setOpen(!open);
3995
+ },
3996
+ ...rest,
3997
+ children
3998
+ }
3999
+ );
4000
+ }
4001
+ );
4002
+ var PopoverContent = forwardRef(
4003
+ function PopoverContent2({
4004
+ children,
4005
+ side = "bottom",
4006
+ align = "start",
4007
+ offset = 6,
4008
+ alignOffset = 0,
4009
+ flip = true,
4010
+ clampToViewport = true,
4011
+ role = "dialog",
4012
+ unstyled,
4013
+ className,
4014
+ style,
4015
+ ...rest
4016
+ }, forwardedRef) {
4017
+ const { open, setOpen, triggerRef, contentId, anchorRect, interactedOutsideRef } = usePopoverCtx("Popover.Content");
4018
+ const contentRef = useRef(null);
4019
+ const {
4020
+ ref: positionRef,
4021
+ style: positionStyle,
4022
+ placement,
4023
+ positioned
4024
+ } = useAnchoredPosition({
4025
+ anchorRef: triggerRef,
4026
+ anchorRect,
4027
+ side,
4028
+ align,
4029
+ offset,
4030
+ alignOffset,
4031
+ flip,
4032
+ clampToViewport,
4033
+ enabled: open
4034
+ });
4035
+ const layer = useLayer({
4036
+ enabled: open,
4037
+ kind: "popover",
4038
+ elementRef: contentRef,
4039
+ onEscape: () => setOpen(false)
4040
+ });
4041
+ useOutsideClick(
4042
+ [triggerRef, contentRef],
4043
+ () => {
4044
+ interactedOutsideRef.current = true;
4045
+ setOpen(false);
4046
+ },
4047
+ { enabled: open, layer }
4048
+ );
4049
+ useEffect(() => {
4050
+ if (!open || !positioned) return;
4051
+ const node = contentRef.current;
4052
+ if (!node) return;
4053
+ interactedOutsideRef.current = false;
4054
+ const trigger = triggerRef.current;
4055
+ const previous = document.activeElement instanceof HTMLElement && document.activeElement !== document.body ? document.activeElement : null;
4056
+ const initial = node.querySelector("[data-autofocus]") ?? tabbablesWithin(node)[0] ?? node;
4057
+ initial.focus();
4058
+ return () => {
4059
+ if (interactedOutsideRef.current) return;
4060
+ const active = document.activeElement;
4061
+ if (active !== null && active !== document.body && !node.contains(active)) return;
4062
+ const target = trigger ?? previous;
4063
+ if (target?.isConnected) target.focus();
4064
+ };
4065
+ }, [open, positioned, triggerRef, interactedOutsideRef]);
4066
+ const ref = useMemo(
4067
+ () => composeRefs(forwardedRef, contentRef, positionRef),
4068
+ [forwardedRef, positionRef]
4069
+ );
4070
+ if (!open || typeof document === "undefined") return null;
4071
+ return createPortal(
4072
+ /* @__PURE__ */ jsx(
4073
+ "div",
4074
+ {
4075
+ ref,
4076
+ id: contentId,
4077
+ role: role === "none" ? void 0 : role,
4078
+ tabIndex: -1,
4079
+ "data-slot": "popover-content",
4080
+ "data-state": "open",
4081
+ "data-side": placement?.side,
4082
+ "data-align": placement?.align,
4083
+ "data-positioned": positioned ? "true" : "false",
4084
+ className: cn(
4085
+ "fixed z-[100] outline-none",
4086
+ !unstyled && "rounded-[var(--radius-lg)] p-3",
4087
+ positioned && "ds-enter-pop",
4088
+ className
4089
+ ),
4090
+ style: {
4091
+ ...positionStyle,
4092
+ ...unstyled ? void 0 : POPOVER_SURFACE_STYLE,
4093
+ ...style
4094
+ },
4095
+ ...rest,
4096
+ children
4097
+ }
4098
+ ),
4099
+ document.body
4100
+ );
4101
+ }
4102
+ );
4103
+ var Popover = Object.assign(PopoverRoot, {
4104
+ Trigger: PopoverTrigger,
4105
+ Content: PopoverContent
4106
+ });
3429
4107
  var DropdownMenuCtx = createContext(null);
3430
4108
  function useDropdownMenuCtx(consumer) {
3431
4109
  const ctx = useContext(DropdownMenuCtx);
@@ -3463,22 +4141,21 @@ function DropdownMenu({
3463
4141
  );
3464
4142
  return /* @__PURE__ */ jsx(DropdownMenuCtx.Provider, { value, children });
3465
4143
  }
3466
- function DropdownMenuTrigger({
3467
- unstyled,
3468
- className,
3469
- onClick,
3470
- children,
3471
- ...rest
3472
- }) {
4144
+ var DropdownMenuTrigger = forwardRef(function DropdownMenuTrigger2({ unstyled, className, onClick, children, ...rest }, forwardedRef) {
3473
4145
  const { open, setOpen, triggerRef, contentId } = useDropdownMenuCtx("DropdownMenuTrigger");
4146
+ const ref = useMemo(
4147
+ () => composeRefs(forwardedRef, triggerRef),
4148
+ [forwardedRef, triggerRef]
4149
+ );
3474
4150
  return /* @__PURE__ */ jsx(
3475
4151
  "button",
3476
4152
  {
3477
- ref: triggerRef,
4153
+ ref,
3478
4154
  type: "button",
3479
4155
  "aria-haspopup": "menu",
3480
4156
  "aria-expanded": open,
3481
4157
  "aria-controls": open ? contentId : void 0,
4158
+ "data-state": open ? "open" : "closed",
3482
4159
  className: cn(
3483
4160
  !unstyled && "btn btn-secondary",
3484
4161
  className
@@ -3491,8 +4168,8 @@ function DropdownMenuTrigger({
3491
4168
  children
3492
4169
  }
3493
4170
  );
3494
- }
3495
- function DropdownMenuContent({
4171
+ });
4172
+ var DropdownMenuContent = forwardRef(function DropdownMenuContent2({
3496
4173
  children,
3497
4174
  align = "start",
3498
4175
  alignOffset = 0,
@@ -3501,100 +4178,62 @@ function DropdownMenuContent({
3501
4178
  className,
3502
4179
  style,
3503
4180
  ...rest
3504
- }) {
4181
+ }, forwardedRef) {
3505
4182
  const { open, setOpen, triggerRef, contentId } = useDropdownMenuCtx("DropdownMenuContent");
3506
4183
  const contentRef = useRef(null);
3507
- const [position, setPosition] = useState(
3508
- null
3509
- );
3510
- useLayoutEffect(() => {
3511
- if (!open) {
3512
- setPosition(null);
3513
- return;
3514
- }
3515
- const measure = () => {
3516
- const triggerEl = triggerRef.current;
3517
- const contentEl = contentRef.current;
3518
- if (!triggerEl || !contentEl) return;
3519
- const triggerRect = triggerEl.getBoundingClientRect();
3520
- const contentRect = contentEl.getBoundingClientRect();
3521
- let left = triggerRect.left + alignOffset;
3522
- if (align === "end") left = triggerRect.right - contentRect.width - alignOffset;
3523
- else if (align === "center")
3524
- left = triggerRect.left + triggerRect.width / 2 - contentRect.width / 2 + alignOffset;
3525
- let top = side === "bottom" ? triggerRect.bottom + sideOffset : triggerRect.top - contentRect.height - sideOffset;
3526
- const gutter = 8;
3527
- const maxLeft = window.innerWidth - contentRect.width - gutter;
3528
- const maxTop = window.innerHeight - contentRect.height - gutter;
3529
- left = Math.max(gutter, Math.min(left, maxLeft));
3530
- top = Math.max(gutter, Math.min(top, maxTop));
3531
- setPosition({ left, top });
3532
- };
3533
- measure();
3534
- window.addEventListener("resize", measure);
3535
- window.addEventListener("scroll", measure, true);
3536
- return () => {
3537
- window.removeEventListener("resize", measure);
3538
- window.removeEventListener("scroll", measure, true);
3539
- };
3540
- }, [open, align, alignOffset, side, sideOffset, triggerRef]);
3541
- useEffect(() => {
3542
- if (!open) return;
3543
- const onPointerDown = (event) => {
3544
- const target = event.target;
3545
- if (!target) return;
3546
- if (contentRef.current?.contains(target)) return;
3547
- if (triggerRef.current?.contains(target)) return;
4184
+ const {
4185
+ ref: positionRef,
4186
+ style: positionStyle,
4187
+ placement,
4188
+ positioned
4189
+ } = useAnchoredPosition({
4190
+ anchorRef: triggerRef,
4191
+ side,
4192
+ align,
4193
+ offset: sideOffset,
4194
+ alignOffset,
4195
+ enabled: open
4196
+ });
4197
+ const layer = useLayer({
4198
+ enabled: open,
4199
+ kind: "popover",
4200
+ elementRef: contentRef,
4201
+ onEscape: () => {
3548
4202
  setOpen(false);
3549
- };
3550
- const onKeyDown = (event) => {
3551
- if (event.key === "Escape") {
3552
- event.stopPropagation();
3553
- setOpen(false);
3554
- triggerRef.current?.focus();
3555
- }
3556
- };
3557
- document.addEventListener("pointerdown", onPointerDown);
3558
- document.addEventListener("keydown", onKeyDown);
3559
- return () => {
3560
- document.removeEventListener("pointerdown", onPointerDown);
3561
- document.removeEventListener("keydown", onKeyDown);
3562
- };
3563
- }, [open, setOpen, triggerRef]);
4203
+ triggerRef.current?.focus();
4204
+ }
4205
+ });
4206
+ useOutsideClick([triggerRef, contentRef], () => setOpen(false), {
4207
+ enabled: open,
4208
+ layer
4209
+ });
4210
+ const ref = useMemo(
4211
+ () => composeRefs(forwardedRef, contentRef, positionRef),
4212
+ [forwardedRef, positionRef]
4213
+ );
3564
4214
  if (!open || typeof document === "undefined") return null;
3565
- const isPositioned = position !== null;
3566
4215
  return createPortal(
3567
4216
  /* @__PURE__ */ jsx(
3568
4217
  "div",
3569
4218
  {
3570
- ref: contentRef,
4219
+ ref,
3571
4220
  id: contentId,
3572
4221
  role: "menu",
3573
4222
  "data-slot": "dropdown-menu-content",
3574
4223
  "data-state": "open",
3575
- "data-positioned": isPositioned ? "true" : "false",
4224
+ "data-side": placement?.side,
4225
+ "data-align": placement?.align,
4226
+ "data-positioned": positioned ? "true" : "false",
3576
4227
  className: cn(
3577
4228
  "fixed z-[100] min-w-48 max-w-[min(28rem,calc(100vw-16px))]",
3578
4229
  "p-1.5 overflow-y-auto",
3579
4230
  "rounded-[var(--radius-lg)]",
3580
- isPositioned && "ds-enter-pop",
4231
+ positioned && "ds-enter-pop",
3581
4232
  className
3582
4233
  ),
3583
4234
  style: {
3584
- // Anchor the unpositioned phase WAY off-screen as a defense
3585
- // against any browser/renderer that doesn't fully respect
3586
- // visibility:hidden during a same-frame double-render. If the
3587
- // first paint slips through, it's at (-99999, -99999), not at
3588
- // viewport (0, 0) where a left-edge flash would be visible.
3589
- left: position?.left ?? -99999,
3590
- top: position?.top ?? -99999,
3591
- opacity: isPositioned ? void 0 : 0,
3592
- pointerEvents: isPositioned ? void 0 : "none",
3593
- visibility: isPositioned ? "visible" : "hidden",
3594
- background: "rgb(var(--popover))",
3595
- color: "rgb(var(--popover-foreground))",
3596
- border: "1px solid rgb(var(--border))",
3597
- boxShadow: "var(--shadow-lg, 0 10px 32px rgba(0,0,0,0.18))",
4235
+ ...positionStyle,
4236
+ ...POPOVER_SURFACE_STYLE,
3598
4237
  ...style
3599
4238
  },
3600
4239
  ...rest,
@@ -3603,19 +4242,13 @@ function DropdownMenuContent({
3603
4242
  ),
3604
4243
  document.body
3605
4244
  );
3606
- }
3607
- function DropdownMenuItem({
3608
- variant = "default",
3609
- inset,
3610
- className,
3611
- onClick,
3612
- children,
3613
- ...rest
3614
- }) {
4245
+ });
4246
+ var DropdownMenuItem = forwardRef(function DropdownMenuItem2({ variant = "default", inset, className, onClick, children, ...rest }, forwardedRef) {
3615
4247
  const { setOpen } = useDropdownMenuCtx("DropdownMenuItem");
3616
4248
  return /* @__PURE__ */ jsx(
3617
4249
  "button",
3618
4250
  {
4251
+ ref: forwardedRef,
3619
4252
  role: "menuitem",
3620
4253
  type: "button",
3621
4254
  "data-slot": "dropdown-menu-item",
@@ -3640,19 +4273,12 @@ function DropdownMenuItem({
3640
4273
  children
3641
4274
  }
3642
4275
  );
3643
- }
3644
- function DropdownMenuCheckboxItem({
3645
- checked,
3646
- onCheckedChange,
3647
- className,
3648
- children,
3649
- onClick,
3650
- disabled,
3651
- ...rest
3652
- }) {
4276
+ });
4277
+ var DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({ checked, onCheckedChange, className, children, onClick, disabled, ...rest }, forwardedRef) {
3653
4278
  return /* @__PURE__ */ jsxs(
3654
4279
  "button",
3655
4280
  {
4281
+ ref: forwardedRef,
3656
4282
  role: "menuitemcheckbox",
3657
4283
  type: "button",
3658
4284
  "data-slot": "dropdown-menu-checkbox-item",
@@ -3686,7 +4312,7 @@ function DropdownMenuCheckboxItem({
3686
4312
  ]
3687
4313
  }
3688
4314
  );
3689
- }
4315
+ });
3690
4316
  function DropdownMenuSeparator({
3691
4317
  className,
3692
4318
  ...rest
@@ -5331,113 +5957,1169 @@ function DataGrid({
5331
5957
  sort: sort ?? null,
5332
5958
  onSortChange
5333
5959
  }
5334
- ) })
5960
+ ) })
5961
+ ]
5962
+ }
5963
+ ),
5964
+ renderDrawerPanel ? renderDrawerPanel(drawerPanelProps) : /* @__PURE__ */ jsx(
5965
+ DrawerPanel,
5966
+ {
5967
+ isOpen: drawerIsOpen,
5968
+ onClose: closeDrawer,
5969
+ drawerRow,
5970
+ drawerColumn,
5971
+ drawerCellValue,
5972
+ getRowLabel,
5973
+ isEditableColumn,
5974
+ isEmptyValue,
5975
+ modal: drawerModal,
5976
+ size: drawerSize ?? void 0
5977
+ }
5978
+ )
5979
+ ] });
5980
+ }
5981
+ function DataGridToolbar({
5982
+ search,
5983
+ children,
5984
+ className
5985
+ }) {
5986
+ return /* @__PURE__ */ jsxs(
5987
+ "div",
5988
+ {
5989
+ className: cn(
5990
+ "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
5991
+ className
5992
+ ),
5993
+ children: [
5994
+ search ? /* @__PURE__ */ jsx("div", { className: "w-full sm:max-w-sm", children: search }) : /* @__PURE__ */ jsx("span", {}),
5995
+ children ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 sm:justify-end", children }) : null
5996
+ ]
5997
+ }
5998
+ );
5999
+ }
6000
+ function DataGridColumnOptionsMenu({
6001
+ showSummaries,
6002
+ onShowSummariesChange,
6003
+ visibleColumns,
6004
+ visibleColumnIds,
6005
+ hiddenColumns,
6006
+ toggleColumnVisibility,
6007
+ optionsSensors,
6008
+ onOptionColumnDragEnd,
6009
+ optionsDndContextId,
6010
+ triggerLabel = "Options"
6011
+ }) {
6012
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6013
+ /* @__PURE__ */ jsxs(DropdownMenuTrigger, { "aria-label": "Open table options", children: [
6014
+ /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4" }),
6015
+ /* @__PURE__ */ jsx("span", { children: triggerLabel })
6016
+ ] }),
6017
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [
6018
+ /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Options" }) }),
6019
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6020
+ /* @__PURE__ */ jsx(
6021
+ DropdownMenuCheckboxItem,
6022
+ {
6023
+ checked: showSummaries,
6024
+ onCheckedChange: (checked) => onShowSummariesChange(checked === true),
6025
+ children: "Show summary row"
6026
+ }
6027
+ ),
6028
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6029
+ /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Columns" }) }),
6030
+ /* @__PURE__ */ jsx(
6031
+ DndContext,
6032
+ {
6033
+ id: optionsDndContextId,
6034
+ sensors: optionsSensors,
6035
+ collisionDetection: closestCenter,
6036
+ onDragEnd: onOptionColumnDragEnd,
6037
+ children: /* @__PURE__ */ jsx(
6038
+ SortableContext,
6039
+ {
6040
+ items: visibleColumns.map((column) => column.id),
6041
+ strategy: verticalListSortingStrategy,
6042
+ children: visibleColumns.map((column) => /* @__PURE__ */ jsx(
6043
+ SortableColumnOptionItem,
6044
+ {
6045
+ column,
6046
+ checked: true,
6047
+ disabled: visibleColumnIds.length === 1,
6048
+ onCheckedChange: (checked) => toggleColumnVisibility(column.id, checked)
6049
+ },
6050
+ column.id
6051
+ ))
6052
+ }
6053
+ )
6054
+ }
6055
+ ),
6056
+ hiddenColumns.length > 0 ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
6057
+ hiddenColumns.map((column) => /* @__PURE__ */ jsx(
6058
+ DropdownMenuCheckboxItem,
6059
+ {
6060
+ checked: false,
6061
+ onCheckedChange: (checked) => toggleColumnVisibility(column.id, checked === true),
6062
+ children: column.label
6063
+ },
6064
+ column.id
6065
+ ))
6066
+ ] })
6067
+ ] });
6068
+ }
6069
+ var SHELL_SIZE_CLASS = {
6070
+ sm: "size-sm",
6071
+ md: ""
6072
+ };
6073
+ var VALUE_SIZE_CLASS = {
6074
+ sm: "gap-2 pl-2.5 text-[12.5px]",
6075
+ md: "gap-2 pl-3 text-[13.5px]"
6076
+ };
6077
+ var LISTBOX_CLASS = "fixed z-[100] max-h-[min(60vh,20rem)] overflow-y-auto rounded-[var(--radius-lg)] p-1.5 outline-none";
6078
+ var TYPEAHEAD_RESET_MS = 500;
6079
+ function isPrintableKey(event) {
6080
+ return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
6081
+ }
6082
+ function sanitizeId(id) {
6083
+ return id.replace(/[^a-zA-Z0-9_-]/g, "");
6084
+ }
6085
+ function ListboxOption({
6086
+ id,
6087
+ label,
6088
+ description,
6089
+ icon,
6090
+ count,
6091
+ selected,
6092
+ highlighted,
6093
+ disabled,
6094
+ onSelect,
6095
+ onHighlight,
6096
+ children
6097
+ }) {
6098
+ return /* @__PURE__ */ jsxs(
6099
+ "button",
6100
+ {
6101
+ type: "button",
6102
+ role: "option",
6103
+ id,
6104
+ "aria-selected": selected,
6105
+ "aria-disabled": disabled ? true : void 0,
6106
+ tabIndex: -1,
6107
+ "data-slot": "listbox-option",
6108
+ "data-highlighted": highlighted ? "" : void 0,
6109
+ "data-selected": selected ? "" : void 0,
6110
+ "data-disabled": disabled ? "" : void 0,
6111
+ className: cn(
6112
+ "flex w-full cursor-default items-center gap-2.5 text-left",
6113
+ "rounded-[var(--radius-md)] px-2.5 py-2 text-[13px] font-medium",
6114
+ "outline-none transition-colors",
6115
+ "aria-disabled:pointer-events-none aria-disabled:opacity-50"
6116
+ ),
6117
+ style: {
6118
+ background: highlighted ? "rgb(var(--surface-overlay))" : "transparent",
6119
+ color: "rgb(var(--foreground))"
6120
+ },
6121
+ onClick: () => {
6122
+ if (!disabled) onSelect();
6123
+ },
6124
+ onPointerMove: () => {
6125
+ if (!disabled && !highlighted) onHighlight();
6126
+ },
6127
+ children: [
6128
+ children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
6129
+ icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center", children: icon }) : null,
6130
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
6131
+ /* @__PURE__ */ jsx("span", { className: "block truncate", children: label }),
6132
+ description ? /* @__PURE__ */ jsx(
6133
+ "span",
6134
+ {
6135
+ className: "block truncate text-[11.5px] font-normal",
6136
+ style: { color: "rgb(var(--text-tertiary))" },
6137
+ children: description
6138
+ }
6139
+ ) : null
6140
+ ] }),
6141
+ typeof count === "number" ? /* @__PURE__ */ jsx(
6142
+ "span",
6143
+ {
6144
+ className: "shrink-0 text-[11px] font-medium tabular-nums",
6145
+ style: { color: "rgb(var(--text-muted))" },
6146
+ children: count.toLocaleString()
6147
+ }
6148
+ ) : null
6149
+ ] }),
6150
+ /* @__PURE__ */ jsx("span", { className: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center", "aria-hidden": "true", children: selected ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5", style: { color: "rgb(var(--accent))" } }) : null })
6151
+ ]
6152
+ }
6153
+ );
6154
+ }
6155
+ var SelectImpl = forwardRef(function Select({
6156
+ options,
6157
+ value: valueProp,
6158
+ defaultValue = null,
6159
+ onValueChange,
6160
+ placeholder = "Select\u2026",
6161
+ size = "md",
6162
+ error,
6163
+ open: openProp,
6164
+ defaultOpen,
6165
+ onOpenChange,
6166
+ side = "bottom",
6167
+ align = "start",
6168
+ listboxClassName,
6169
+ id,
6170
+ className,
6171
+ style,
6172
+ disabled,
6173
+ onClick,
6174
+ onKeyDown,
6175
+ "aria-label": ariaLabel,
6176
+ "aria-labelledby": ariaLabelledby,
6177
+ ...rest
6178
+ }, forwardedRef) {
6179
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
6180
+ const isControlledValue = valueProp !== void 0;
6181
+ const value = isControlledValue ? valueProp : uncontrolledValue;
6182
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
6183
+ const isControlledOpen = openProp !== void 0;
6184
+ const open = isControlledOpen ? Boolean(openProp) : uncontrolledOpen;
6185
+ const setOpen = useCallback(
6186
+ (next) => {
6187
+ if (!isControlledOpen) setUncontrolledOpen(next);
6188
+ onOpenChange?.(next);
6189
+ },
6190
+ [isControlledOpen, onOpenChange]
6191
+ );
6192
+ const triggerRef = useRef(null);
6193
+ const listboxRef = useRef(null);
6194
+ const baseId = sanitizeId(useId());
6195
+ const triggerId = id ?? `select-${baseId}`;
6196
+ const listboxId = `select-listbox-${baseId}`;
6197
+ const optionId = (index) => `${listboxId}-opt-${index}`;
6198
+ const selectedIndex = useMemo(
6199
+ () => options.findIndex((option) => option.value === value),
6200
+ [options, value]
6201
+ );
6202
+ const selected = selectedIndex >= 0 ? options[selectedIndex] : void 0;
6203
+ const firstEnabled = options.findIndex((option) => !option.disabled);
6204
+ let lastEnabled = -1;
6205
+ for (let i = options.length - 1; i >= 0; i--) {
6206
+ if (!options[i]?.disabled) {
6207
+ lastEnabled = i;
6208
+ break;
6209
+ }
6210
+ }
6211
+ const [highlight, setHighlight] = useState(null);
6212
+ const activeIndex = highlight !== null && highlight < options.length ? highlight : selectedIndex >= 0 ? selectedIndex : firstEnabled;
6213
+ const openList = useCallback(
6214
+ (initial) => {
6215
+ setHighlight(initial);
6216
+ setOpen(true);
6217
+ },
6218
+ [setOpen]
6219
+ );
6220
+ const closeList = useCallback(() => {
6221
+ setOpen(false);
6222
+ setHighlight(null);
6223
+ }, [setOpen]);
6224
+ const commit = (index) => {
6225
+ const option = options[index];
6226
+ if (!option || option.disabled) return;
6227
+ if (option.value !== value) {
6228
+ if (!isControlledValue) setUncontrolledValue(option.value);
6229
+ onValueChange?.(option.value);
6230
+ }
6231
+ closeList();
6232
+ triggerRef.current?.focus();
6233
+ };
6234
+ const step = (from, direction) => {
6235
+ for (let i = from + direction; i >= 0 && i < options.length; i += direction) {
6236
+ if (!options[i]?.disabled) return i;
6237
+ }
6238
+ return from;
6239
+ };
6240
+ const typeaheadRef = useRef({ text: "", timer: null });
6241
+ useEffect(() => {
6242
+ const state = typeaheadRef.current;
6243
+ return () => {
6244
+ if (state.timer !== null) window.clearTimeout(state.timer);
6245
+ };
6246
+ }, []);
6247
+ const typeahead = (char, from) => {
6248
+ const state = typeaheadRef.current;
6249
+ if (state.timer !== null) window.clearTimeout(state.timer);
6250
+ state.text += char.toLowerCase();
6251
+ state.timer = window.setTimeout(() => {
6252
+ state.text = "";
6253
+ state.timer = null;
6254
+ }, TYPEAHEAD_RESET_MS);
6255
+ const typed = state.text;
6256
+ const first = typed.charAt(0);
6257
+ const repeated = typed.length > 1 && typed.split("").every((c) => c === first);
6258
+ const needle = repeated ? first : typed;
6259
+ const count = options.length;
6260
+ if (count === 0) return null;
6261
+ const startAt = needle.length === 1 ? from + 1 : Math.max(from, 0);
6262
+ for (let k = 0; k < count; k++) {
6263
+ const i = (startAt + k) % count;
6264
+ const option = options[i];
6265
+ if (option && !option.disabled && option.label.toLowerCase().startsWith(needle)) return i;
6266
+ }
6267
+ return null;
6268
+ };
6269
+ const handleKeyDown = (event) => {
6270
+ onKeyDown?.(event);
6271
+ if (event.defaultPrevented) return;
6272
+ const { key } = event;
6273
+ if (!open) {
6274
+ if (key === "ArrowDown" || key === "ArrowUp" || key === "Enter" || key === " ") {
6275
+ event.preventDefault();
6276
+ openList(null);
6277
+ return;
6278
+ }
6279
+ if (key === "Home" || key === "End") {
6280
+ event.preventDefault();
6281
+ openList(key === "Home" ? firstEnabled : lastEnabled);
6282
+ return;
6283
+ }
6284
+ if (isPrintableKey(event)) {
6285
+ event.preventDefault();
6286
+ openList(typeahead(key, selectedIndex));
6287
+ }
6288
+ return;
6289
+ }
6290
+ switch (key) {
6291
+ case "ArrowDown":
6292
+ event.preventDefault();
6293
+ setHighlight(step(activeIndex, 1));
6294
+ return;
6295
+ case "ArrowUp":
6296
+ event.preventDefault();
6297
+ setHighlight(step(activeIndex, -1));
6298
+ return;
6299
+ case "Home":
6300
+ event.preventDefault();
6301
+ setHighlight(firstEnabled);
6302
+ return;
6303
+ case "End":
6304
+ event.preventDefault();
6305
+ setHighlight(lastEnabled);
6306
+ return;
6307
+ case "Enter":
6308
+ case " ":
6309
+ event.preventDefault();
6310
+ commit(activeIndex);
6311
+ return;
6312
+ case "Tab":
6313
+ closeList();
6314
+ return;
6315
+ case "Escape":
6316
+ return;
6317
+ default:
6318
+ if (isPrintableKey(event)) {
6319
+ event.preventDefault();
6320
+ const match = typeahead(key, activeIndex);
6321
+ if (match !== null) setHighlight(match);
6322
+ }
6323
+ }
6324
+ };
6325
+ const {
6326
+ ref: positionRef,
6327
+ style: positionStyle,
6328
+ placement,
6329
+ positioned
6330
+ } = useAnchoredPosition({
6331
+ anchorRef: triggerRef,
6332
+ side,
6333
+ align,
6334
+ enabled: open
6335
+ });
6336
+ const layer = useLayer({
6337
+ enabled: open,
6338
+ kind: "popover",
6339
+ elementRef: listboxRef,
6340
+ onEscape: () => {
6341
+ closeList();
6342
+ triggerRef.current?.focus();
6343
+ }
6344
+ });
6345
+ useOutsideClick([triggerRef, listboxRef], closeList, { enabled: open, layer });
6346
+ const [triggerWidth, setTriggerWidth] = useState(null);
6347
+ useLayoutEffect(() => {
6348
+ if (!open) return;
6349
+ setTriggerWidth(triggerRef.current?.offsetWidth ?? null);
6350
+ }, [open]);
6351
+ useEffect(() => {
6352
+ if (!open) return;
6353
+ listboxRef.current?.querySelector("[data-highlighted]")?.scrollIntoView({ block: "nearest" });
6354
+ }, [open, activeIndex]);
6355
+ const triggerRefs = useMemo(
6356
+ () => composeRefs(forwardedRef, triggerRef),
6357
+ [forwardedRef]
6358
+ );
6359
+ const listboxRefs = useMemo(
6360
+ () => composeRefs(listboxRef, positionRef),
6361
+ [positionRef]
6362
+ );
6363
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6364
+ /* @__PURE__ */ jsxs(
6365
+ "button",
6366
+ {
6367
+ ref: triggerRefs,
6368
+ id: triggerId,
6369
+ type: "button",
6370
+ role: "combobox",
6371
+ "aria-haspopup": "listbox",
6372
+ "aria-expanded": open,
6373
+ "aria-controls": open ? listboxId : void 0,
6374
+ "aria-activedescendant": open && activeIndex >= 0 ? optionId(activeIndex) : void 0,
6375
+ "aria-label": ariaLabel,
6376
+ "aria-labelledby": ariaLabelledby,
6377
+ "aria-invalid": error ? true : void 0,
6378
+ disabled,
6379
+ "data-slot": "select-trigger",
6380
+ "data-state": open ? "open" : "closed",
6381
+ "data-size": size,
6382
+ "data-placeholder": selected ? void 0 : "",
6383
+ className: cn(
6384
+ "input-shell appearance-none p-0 text-left",
6385
+ SHELL_SIZE_CLASS[size],
6386
+ error && "is-error",
6387
+ disabled && "is-disabled",
6388
+ className
6389
+ ),
6390
+ style: { alignItems: "center", ...style },
6391
+ onClick: (event) => {
6392
+ onClick?.(event);
6393
+ if (event.defaultPrevented) return;
6394
+ if (open) closeList();
6395
+ else openList(null);
6396
+ },
6397
+ onKeyDown: handleKeyDown,
6398
+ ...rest,
6399
+ children: [
6400
+ /* @__PURE__ */ jsxs(
6401
+ "span",
6402
+ {
6403
+ "data-slot": "select-value",
6404
+ className: cn(
6405
+ "flex min-w-0 flex-1 items-center font-medium leading-[1.4]",
6406
+ VALUE_SIZE_CLASS[size]
6407
+ ),
6408
+ children: [
6409
+ selected?.icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center", children: selected.icon }) : null,
6410
+ /* @__PURE__ */ jsx(
6411
+ "span",
6412
+ {
6413
+ className: "truncate",
6414
+ style: {
6415
+ color: selected ? "rgb(var(--foreground))" : "rgb(var(--text-tertiary))"
6416
+ },
6417
+ children: selected ? selected.label : placeholder
6418
+ }
6419
+ )
6420
+ ]
6421
+ }
6422
+ ),
6423
+ /* @__PURE__ */ jsx("span", { className: "affix", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
6424
+ ChevronDown,
6425
+ {
6426
+ className: cn(
6427
+ "h-4 w-4 transition-transform duration-[var(--dur-fast)] ease-[var(--ease-out)] motion-reduce:transition-none",
6428
+ open && "rotate-180"
6429
+ )
6430
+ }
6431
+ ) })
6432
+ ]
6433
+ }
6434
+ ),
6435
+ open && typeof document !== "undefined" ? createPortal(
6436
+ /* @__PURE__ */ jsx(
6437
+ "div",
6438
+ {
6439
+ ref: listboxRefs,
6440
+ id: listboxId,
6441
+ role: "listbox",
6442
+ "aria-label": ariaLabelledby ? void 0 : ariaLabel,
6443
+ "aria-labelledby": ariaLabelledby ?? (ariaLabel ? void 0 : triggerId),
6444
+ tabIndex: -1,
6445
+ "data-slot": "select-listbox",
6446
+ "data-state": "open",
6447
+ "data-side": placement?.side,
6448
+ "data-align": placement?.align,
6449
+ "data-positioned": positioned ? "true" : "false",
6450
+ className: cn(LISTBOX_CLASS, positioned && "ds-enter-pop", listboxClassName),
6451
+ style: {
6452
+ ...positionStyle,
6453
+ ...POPOVER_SURFACE_STYLE,
6454
+ ...triggerWidth ? { minWidth: triggerWidth } : void 0
6455
+ },
6456
+ onMouseDown: (event) => event.preventDefault(),
6457
+ children: options.length === 0 ? /* @__PURE__ */ jsx(
6458
+ "div",
6459
+ {
6460
+ "data-slot": "select-empty",
6461
+ className: "px-2.5 py-2 text-[12.5px]",
6462
+ style: { color: "rgb(var(--text-tertiary))" },
6463
+ children: "No options"
6464
+ }
6465
+ ) : options.map((option, index) => /* @__PURE__ */ jsx(
6466
+ ListboxOption,
6467
+ {
6468
+ id: optionId(index),
6469
+ label: option.label,
6470
+ description: option.description,
6471
+ icon: option.icon,
6472
+ selected: option.value === value,
6473
+ highlighted: index === activeIndex,
6474
+ disabled: option.disabled,
6475
+ onSelect: () => commit(index),
6476
+ onHighlight: () => setHighlight(index)
6477
+ },
6478
+ option.value
6479
+ ))
6480
+ }
6481
+ ),
6482
+ document.body
6483
+ ) : null
6484
+ ] });
6485
+ });
6486
+ var Select2 = SelectImpl;
6487
+ var SHELL_SIZE_CLASS2 = {
6488
+ sm: "size-sm",
6489
+ md: ""
6490
+ };
6491
+ var MULTI_SHELL_STYLE = {
6492
+ sm: {
6493
+ height: "auto",
6494
+ minHeight: "var(--ctrl-sm)",
6495
+ alignItems: "center",
6496
+ flexWrap: "wrap",
6497
+ gap: "var(--space-1)",
6498
+ paddingTop: "var(--space-1)",
6499
+ paddingBottom: "var(--space-1)"
6500
+ },
6501
+ md: {
6502
+ height: "auto",
6503
+ minHeight: "var(--ctrl-md)",
6504
+ alignItems: "center",
6505
+ flexWrap: "wrap",
6506
+ gap: "var(--space-1)",
6507
+ paddingTop: "var(--space-1)",
6508
+ paddingBottom: "var(--space-1)"
6509
+ }
6510
+ };
6511
+ var MULTI_INPUT_STYLE = { minWidth: "6rem" };
6512
+ function defaultFilter(option, query) {
6513
+ const needle = query.toLowerCase();
6514
+ return option.label.toLowerCase().includes(needle) || (option.description?.toLowerCase().includes(needle) ?? false);
6515
+ }
6516
+ function sanitizeId2(id) {
6517
+ return id.replace(/[^a-zA-Z0-9_-]/g, "");
6518
+ }
6519
+ var ComboboxImpl = forwardRef(function Combobox(props, forwardedRef) {
6520
+ const {
6521
+ options,
6522
+ groups,
6523
+ loading,
6524
+ placeholder,
6525
+ size = "md",
6526
+ disabled,
6527
+ error,
6528
+ inputValue: inputValueProp,
6529
+ defaultInputValue = "",
6530
+ onInputValueChange,
6531
+ shouldFilter = true,
6532
+ filter,
6533
+ emptyMessage = "No results",
6534
+ loadingMessage = "Loading\u2026",
6535
+ renderOption,
6536
+ open: openProp,
6537
+ onOpenChange,
6538
+ side = "bottom",
6539
+ align = "start",
6540
+ id,
6541
+ autoFocus,
6542
+ "aria-label": ariaLabel,
6543
+ "aria-labelledby": ariaLabelledby,
6544
+ className,
6545
+ listboxClassName
6546
+ } = props;
6547
+ const isMultiple = props.multiple === true;
6548
+ const [uncontrolledSelection, setUncontrolledSelection] = useState(() => {
6549
+ if (props.multiple === true) return [...props.defaultValue ?? []];
6550
+ return props.defaultValue == null ? [] : [props.defaultValue];
6551
+ });
6552
+ const isControlledValue = props.value !== void 0;
6553
+ const selection = props.value === void 0 ? uncontrolledSelection : props.multiple === true ? props.value : props.value === null ? [] : [props.value];
6554
+ const emit = (next) => {
6555
+ if (!isControlledValue) setUncontrolledSelection(next);
6556
+ if (props.multiple === true) props.onValueChange?.(next);
6557
+ else props.onValueChange?.(next[0] ?? null);
6558
+ };
6559
+ const [uncontrolledInput, setUncontrolledInput] = useState(defaultInputValue);
6560
+ const inputValue = inputValueProp ?? uncontrolledInput;
6561
+ const setInputValue = (next) => {
6562
+ if (inputValueProp === void 0) setUncontrolledInput(next);
6563
+ onInputValueChange?.(next);
6564
+ };
6565
+ const [dirty, setDirty] = useState(false);
6566
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
6567
+ const isControlledOpen = openProp !== void 0;
6568
+ const open = isControlledOpen ? Boolean(openProp) : uncontrolledOpen;
6569
+ const setOpen = useCallback(
6570
+ (next) => {
6571
+ if (!isControlledOpen) setUncontrolledOpen(next);
6572
+ onOpenChange?.(next);
6573
+ },
6574
+ [isControlledOpen, onOpenChange]
6575
+ );
6576
+ const openRef = useRef(open);
6577
+ useLayoutEffect(() => {
6578
+ openRef.current = open;
6579
+ });
6580
+ const shellRef = useRef(null);
6581
+ const inputRef = useRef(null);
6582
+ const listboxRef = useRef(null);
6583
+ const baseId = sanitizeId2(useId());
6584
+ const inputId = id ?? `combobox-${baseId}`;
6585
+ const listboxId = `combobox-listbox-${baseId}`;
6586
+ const optionId = (index) => `${listboxId}-opt-${index}`;
6587
+ const byValue = useMemo(() => {
6588
+ const map = /* @__PURE__ */ new Map();
6589
+ for (const option of options) map.set(option.value, option);
6590
+ return map;
6591
+ }, [options]);
6592
+ const selectedSingle = isMultiple ? void 0 : byValue.get(selection[0] ?? "");
6593
+ const filterQuery = dirty ? inputValue.trim() : "";
6594
+ const { sections, flat } = useMemo(() => {
6595
+ const matches = filter ?? defaultFilter;
6596
+ const visible = shouldFilter && filterQuery ? options.filter((option) => matches(option, filterQuery)) : options;
6597
+ const byGroup = /* @__PURE__ */ new Map();
6598
+ for (const option of visible) {
6599
+ const key = option.group ?? null;
6600
+ const list = byGroup.get(key) ?? [];
6601
+ list.push(option);
6602
+ byGroup.set(key, list);
6603
+ }
6604
+ const order = [{ key: null, label: null }];
6605
+ if (groups) {
6606
+ for (const group of groups) order.push({ key: group.id, label: group.label });
6607
+ for (const key of byGroup.keys()) {
6608
+ if (key !== null && !groups.some((group) => group.id === key)) {
6609
+ order.push({ key, label: key });
6610
+ }
6611
+ }
6612
+ } else {
6613
+ for (const key of byGroup.keys()) if (key !== null) order.push({ key, label: key });
6614
+ }
6615
+ const flatList = [];
6616
+ const sectionList = [];
6617
+ for (const { key, label } of order) {
6618
+ const members = byGroup.get(key);
6619
+ if (!members || members.length === 0) continue;
6620
+ sectionList.push({
6621
+ key: key ?? "__ungrouped",
6622
+ label,
6623
+ items: members.map((option) => ({ option, index: flatList.push(option) - 1 }))
6624
+ });
6625
+ }
6626
+ return { sections: sectionList, flat: flatList };
6627
+ }, [options, groups, filter, shouldFilter, filterQuery]);
6628
+ const firstEnabled = flat.findIndex((option) => !option.disabled);
6629
+ const selectedFlatIndex = !isMultiple && !dirty && selectedSingle ? flat.findIndex((option) => option.value === selectedSingle.value) : -1;
6630
+ const [highlight, setHighlight] = useState(null);
6631
+ const activeIndex = highlight !== null && highlight < flat.length ? highlight : selectedFlatIndex >= 0 ? selectedFlatIndex : firstEnabled;
6632
+ const step = (from, direction) => {
6633
+ for (let i = from + direction; i >= 0 && i < flat.length; i += direction) {
6634
+ if (!flat[i]?.disabled) return i;
6635
+ }
6636
+ return from;
6637
+ };
6638
+ const openList = () => {
6639
+ if (openRef.current) return;
6640
+ setHighlight(null);
6641
+ setOpen(true);
6642
+ };
6643
+ const closeList = (clearIfEmpty) => {
6644
+ if (!openRef.current) return;
6645
+ openRef.current = false;
6646
+ if (!isMultiple && clearIfEmpty && dirty && inputValue.trim() === "" && selection.length > 0) {
6647
+ emit([]);
6648
+ }
6649
+ if (isMultiple && inputValue !== "") setInputValue("");
6650
+ setDirty(false);
6651
+ setHighlight(null);
6652
+ setOpen(false);
6653
+ };
6654
+ const choose = (index) => {
6655
+ const option = flat[index];
6656
+ if (!option || option.disabled) return;
6657
+ if (isMultiple) {
6658
+ const has = selection.includes(option.value);
6659
+ emit(has ? selection.filter((value) => value !== option.value) : [...selection, option.value]);
6660
+ } else {
6661
+ if (selection[0] !== option.value) emit([option.value]);
6662
+ closeList(false);
6663
+ }
6664
+ inputRef.current?.focus();
6665
+ };
6666
+ const removeChip = (value) => {
6667
+ emit(selection.filter((candidate) => candidate !== value));
6668
+ inputRef.current?.focus();
6669
+ };
6670
+ const text = isMultiple || dirty ? inputValue : selectedSingle?.label ?? "";
6671
+ const handleChange = (next) => {
6672
+ setInputValue(next);
6673
+ setDirty(true);
6674
+ setHighlight(null);
6675
+ if (!openRef.current) setOpen(true);
6676
+ };
6677
+ const handleKeyDown = (event) => {
6678
+ switch (event.key) {
6679
+ case "ArrowDown":
6680
+ event.preventDefault();
6681
+ if (!open) openList();
6682
+ else setHighlight(step(activeIndex, 1));
6683
+ return;
6684
+ case "ArrowUp":
6685
+ event.preventDefault();
6686
+ if (!open) openList();
6687
+ else setHighlight(step(activeIndex, -1));
6688
+ return;
6689
+ case "Enter":
6690
+ if (open) {
6691
+ event.preventDefault();
6692
+ if (activeIndex >= 0) choose(activeIndex);
6693
+ }
6694
+ return;
6695
+ case "Backspace":
6696
+ if (isMultiple && text === "" && selection.length > 0) {
6697
+ event.preventDefault();
6698
+ emit(selection.slice(0, -1));
6699
+ }
6700
+ return;
6701
+ case "Tab":
6702
+ if (open) closeList(true);
6703
+ return;
6704
+ default:
6705
+ return;
6706
+ }
6707
+ };
6708
+ const handleBlur = (event) => {
6709
+ if (event.relatedTarget instanceof Node && shellRef.current?.contains(event.relatedTarget)) {
6710
+ return;
6711
+ }
6712
+ closeList(true);
6713
+ };
6714
+ const {
6715
+ ref: positionRef,
6716
+ style: positionStyle,
6717
+ placement,
6718
+ positioned
6719
+ } = useAnchoredPosition({
6720
+ anchorRef: shellRef,
6721
+ side,
6722
+ align,
6723
+ enabled: open
6724
+ });
6725
+ const layer = useLayer({
6726
+ enabled: open,
6727
+ kind: "popover",
6728
+ elementRef: listboxRef,
6729
+ onEscape: () => closeList(false)
6730
+ });
6731
+ useOutsideClick([shellRef, listboxRef], () => closeList(true), { enabled: open, layer });
6732
+ const [shellWidth, setShellWidth] = useState(null);
6733
+ useLayoutEffect(() => {
6734
+ if (!open) return;
6735
+ setShellWidth(shellRef.current?.offsetWidth ?? null);
6736
+ }, [open]);
6737
+ useEffect(() => {
6738
+ if (!open) return;
6739
+ listboxRef.current?.querySelector("[data-highlighted]")?.scrollIntoView({ block: "nearest" });
6740
+ }, [open, activeIndex]);
6741
+ useEffect(() => {
6742
+ if (!autoFocus) return;
6743
+ const node = inputRef.current;
6744
+ if (!node) return;
6745
+ if (node.closest('[data-positioned="false"]')) return;
6746
+ node.focus();
6747
+ }, []);
6748
+ const inputRefs = useMemo(
6749
+ () => composeRefs(forwardedRef, inputRef),
6750
+ [forwardedRef]
6751
+ );
6752
+ const listboxRefs = useMemo(
6753
+ () => composeRefs(listboxRef, positionRef),
6754
+ [positionRef]
6755
+ );
6756
+ const chips = isMultiple ? selection : [];
6757
+ const hasChips = chips.length > 0;
6758
+ const shellStyle = isMultiple ? hasChips ? { ...MULTI_SHELL_STYLE[size], paddingLeft: "var(--space-2)" } : MULTI_SHELL_STYLE[size] : void 0;
6759
+ const renderItem = ({ option, index }) => {
6760
+ const selected = selection.includes(option.value);
6761
+ const highlighted = index === activeIndex;
6762
+ return /* @__PURE__ */ jsx(
6763
+ ListboxOption,
6764
+ {
6765
+ id: optionId(index),
6766
+ label: option.label,
6767
+ description: option.description,
6768
+ icon: option.icon,
6769
+ count: option.count,
6770
+ selected,
6771
+ highlighted,
6772
+ disabled: option.disabled,
6773
+ onSelect: () => choose(index),
6774
+ onHighlight: () => setHighlight(index),
6775
+ children: renderOption ? renderOption(option, { selected, highlighted, query: filterQuery }) : void 0
6776
+ },
6777
+ option.value
6778
+ );
6779
+ };
6780
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6781
+ /* @__PURE__ */ jsxs(
6782
+ "div",
6783
+ {
6784
+ ref: shellRef,
6785
+ "data-slot": "combobox",
6786
+ "data-state": open ? "open" : "closed",
6787
+ "data-size": size,
6788
+ className: cn(
6789
+ "input-shell has-trailing",
6790
+ SHELL_SIZE_CLASS2[size],
6791
+ hasChips && "has-leading",
6792
+ error && "is-error",
6793
+ disabled && "is-disabled",
6794
+ className
6795
+ ),
6796
+ style: shellStyle,
6797
+ children: [
6798
+ chips.map((value) => {
6799
+ const label = byValue.get(value)?.label ?? value;
6800
+ return /* @__PURE__ */ jsxs(
6801
+ "span",
6802
+ {
6803
+ "data-slot": "combobox-chip",
6804
+ className: "inline-flex items-center gap-1 rounded-[var(--radius-xs)] py-0.5 pl-2 pr-1 text-[12px] font-medium",
6805
+ style: {
6806
+ background: "rgb(var(--surface-overlay))",
6807
+ color: "rgb(var(--foreground))"
6808
+ },
6809
+ children: [
6810
+ /* @__PURE__ */ jsx("span", { className: "max-w-[12rem] truncate", children: label }),
6811
+ /* @__PURE__ */ jsx(
6812
+ "button",
6813
+ {
6814
+ type: "button",
6815
+ "aria-label": `Remove ${label}`,
6816
+ disabled,
6817
+ onClick: () => removeChip(value),
6818
+ className: "inline-flex h-4 w-4 items-center justify-center rounded-[var(--radius-xs)] transition-colors hover:bg-[rgb(var(--surface-overlay-strong))]",
6819
+ style: { color: "rgb(var(--text-muted))" },
6820
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3", "aria-hidden": "true" })
6821
+ }
6822
+ )
6823
+ ]
6824
+ },
6825
+ value
6826
+ );
6827
+ }),
6828
+ /* @__PURE__ */ jsx(
6829
+ "input",
6830
+ {
6831
+ ref: inputRefs,
6832
+ id: inputId,
6833
+ type: "text",
6834
+ role: "combobox",
6835
+ "aria-haspopup": "listbox",
6836
+ "aria-expanded": open,
6837
+ "aria-controls": open ? listboxId : void 0,
6838
+ "aria-autocomplete": "list",
6839
+ "aria-activedescendant": open && activeIndex >= 0 ? optionId(activeIndex) : void 0,
6840
+ "aria-label": ariaLabel,
6841
+ "aria-labelledby": ariaLabelledby,
6842
+ "aria-invalid": error ? true : void 0,
6843
+ autoComplete: "off",
6844
+ spellCheck: false,
6845
+ disabled,
6846
+ placeholder: hasChips ? "" : placeholder,
6847
+ value: text,
6848
+ "data-slot": "combobox-input",
6849
+ "data-autofocus": autoFocus ? "" : void 0,
6850
+ style: isMultiple ? MULTI_INPUT_STYLE : void 0,
6851
+ onChange: (event) => handleChange(event.target.value),
6852
+ onKeyDown: handleKeyDown,
6853
+ onClick: openList,
6854
+ onFocus: (event) => event.currentTarget.select(),
6855
+ onBlur: handleBlur
6856
+ }
6857
+ ),
6858
+ loading ? /* @__PURE__ */ jsx("span", { className: "affix", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin motion-reduce:animate-none" }) }) : null,
6859
+ /* @__PURE__ */ jsx(
6860
+ "button",
6861
+ {
6862
+ type: "button",
6863
+ tabIndex: -1,
6864
+ "aria-label": open ? "Close options" : "Open options",
6865
+ disabled,
6866
+ className: "affix action",
6867
+ onMouseDown: (event) => event.preventDefault(),
6868
+ onClick: () => {
6869
+ if (open) closeList(false);
6870
+ else openList();
6871
+ inputRef.current?.focus();
6872
+ },
6873
+ children: /* @__PURE__ */ jsx(
6874
+ ChevronDown,
6875
+ {
6876
+ className: cn(
6877
+ "h-4 w-4 transition-transform duration-[var(--dur-fast)] ease-[var(--ease-out)] motion-reduce:transition-none",
6878
+ open && "rotate-180"
6879
+ ),
6880
+ "aria-hidden": "true"
6881
+ }
6882
+ )
6883
+ }
6884
+ )
5335
6885
  ]
5336
6886
  }
5337
6887
  ),
5338
- renderDrawerPanel ? renderDrawerPanel(drawerPanelProps) : /* @__PURE__ */ jsx(
5339
- DrawerPanel,
5340
- {
5341
- isOpen: drawerIsOpen,
5342
- onClose: closeDrawer,
5343
- drawerRow,
5344
- drawerColumn,
5345
- drawerCellValue,
5346
- getRowLabel,
5347
- isEditableColumn,
5348
- isEmptyValue,
5349
- modal: drawerModal,
5350
- size: drawerSize ?? void 0
5351
- }
5352
- )
6888
+ open && typeof document !== "undefined" ? createPortal(
6889
+ /* @__PURE__ */ jsx(
6890
+ "div",
6891
+ {
6892
+ ref: listboxRefs,
6893
+ id: listboxId,
6894
+ role: "listbox",
6895
+ "aria-multiselectable": isMultiple || void 0,
6896
+ "aria-busy": loading || void 0,
6897
+ "aria-label": ariaLabelledby ? void 0 : ariaLabel,
6898
+ "aria-labelledby": ariaLabelledby,
6899
+ tabIndex: -1,
6900
+ "data-slot": "combobox-listbox",
6901
+ "data-state": "open",
6902
+ "data-side": placement?.side,
6903
+ "data-align": placement?.align,
6904
+ "data-positioned": positioned ? "true" : "false",
6905
+ className: cn(LISTBOX_CLASS, positioned && "ds-enter-pop", listboxClassName),
6906
+ style: {
6907
+ ...positionStyle,
6908
+ ...POPOVER_SURFACE_STYLE,
6909
+ ...shellWidth ? { minWidth: shellWidth } : void 0
6910
+ },
6911
+ onMouseDown: (event) => event.preventDefault(),
6912
+ children: flat.length === 0 ? /* @__PURE__ */ jsx(
6913
+ "div",
6914
+ {
6915
+ "data-slot": "combobox-empty",
6916
+ className: "px-2.5 py-2 text-[12.5px]",
6917
+ style: { color: "rgb(var(--text-tertiary))" },
6918
+ children: loading ? loadingMessage : emptyMessage
6919
+ }
6920
+ ) : sections.map(
6921
+ (section) => section.label === null ? section.items.map(renderItem) : /* @__PURE__ */ jsxs(
6922
+ "div",
6923
+ {
6924
+ role: "group",
6925
+ "aria-labelledby": `${listboxId}-group-${sanitizeId2(section.key)}`,
6926
+ "data-slot": "combobox-group",
6927
+ children: [
6928
+ /* @__PURE__ */ jsx(
6929
+ "div",
6930
+ {
6931
+ id: `${listboxId}-group-${sanitizeId2(section.key)}`,
6932
+ "data-slot": "combobox-group-label",
6933
+ className: "px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-[0.4px]",
6934
+ style: { color: "rgb(var(--text-muted))" },
6935
+ children: section.label
6936
+ }
6937
+ ),
6938
+ section.items.map(renderItem)
6939
+ ]
6940
+ },
6941
+ section.key
6942
+ )
6943
+ )
6944
+ }
6945
+ ),
6946
+ document.body
6947
+ ) : null
5353
6948
  ] });
5354
- }
5355
- function DataGridToolbar({
5356
- search,
6949
+ });
6950
+ var Combobox2 = ComboboxImpl;
6951
+ var TOOLTIP_SURFACE_STYLE = {
6952
+ background: "rgb(var(--popover))",
6953
+ color: "rgb(var(--popover-foreground))",
6954
+ border: "1px solid rgb(var(--border))",
6955
+ boxShadow: "var(--shadow-md)",
6956
+ borderRadius: "var(--radius-sm)",
6957
+ padding: "var(--space-1) var(--space-2)"
6958
+ };
6959
+ function Tooltip({
6960
+ content,
5357
6961
  children,
6962
+ side = "top",
6963
+ align = "center",
6964
+ offset = 6,
6965
+ openDelay = 300,
6966
+ closeDelay = 0,
6967
+ open: openProp,
6968
+ defaultOpen,
6969
+ onOpenChange,
5358
6970
  className
5359
6971
  }) {
5360
- return /* @__PURE__ */ jsxs(
5361
- "div",
5362
- {
5363
- className: cn(
5364
- "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
5365
- className
5366
- ),
5367
- children: [
5368
- search ? /* @__PURE__ */ jsx("div", { className: "w-full sm:max-w-sm", children: search }) : /* @__PURE__ */ jsx("span", {}),
5369
- children ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 sm:justify-end", children }) : null
5370
- ]
6972
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
6973
+ const isControlled = openProp !== void 0;
6974
+ const open = isControlled ? Boolean(openProp) : uncontrolledOpen;
6975
+ const setOpen = useCallback(
6976
+ (next) => {
6977
+ if (!isControlled) setUncontrolledOpen(next);
6978
+ onOpenChange?.(next);
6979
+ },
6980
+ [isControlled, onOpenChange]
6981
+ );
6982
+ const triggerRef = useRef(null);
6983
+ const tipRef = useRef(null);
6984
+ const timerRef = useRef(null);
6985
+ const pointerDownRef = useRef(false);
6986
+ const pressEndListenerRef = useRef(null);
6987
+ const clearPressEndListener = useCallback(() => {
6988
+ const listener = pressEndListenerRef.current;
6989
+ if (listener === null) return;
6990
+ pressEndListenerRef.current = null;
6991
+ document.removeEventListener("pointerup", listener);
6992
+ document.removeEventListener("pointercancel", listener);
6993
+ }, []);
6994
+ useEffect(() => clearPressEndListener, [clearPressEndListener]);
6995
+ const tipId = `tooltip-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
6996
+ const clearTimer = useCallback(() => {
6997
+ if (timerRef.current !== null) {
6998
+ window.clearTimeout(timerRef.current);
6999
+ timerRef.current = null;
5371
7000
  }
7001
+ }, []);
7002
+ useEffect(() => clearTimer, [clearTimer]);
7003
+ const scheduleOpen = useCallback(
7004
+ (delay) => {
7005
+ clearTimer();
7006
+ if (delay <= 0) {
7007
+ setOpen(true);
7008
+ return;
7009
+ }
7010
+ timerRef.current = window.setTimeout(() => {
7011
+ timerRef.current = null;
7012
+ setOpen(true);
7013
+ }, delay);
7014
+ },
7015
+ [clearTimer, setOpen]
5372
7016
  );
5373
- }
5374
- function DataGridColumnOptionsMenu({
5375
- showSummaries,
5376
- onShowSummariesChange,
5377
- visibleColumns,
5378
- visibleColumnIds,
5379
- hiddenColumns,
5380
- toggleColumnVisibility,
5381
- optionsSensors,
5382
- onOptionColumnDragEnd,
5383
- optionsDndContextId,
5384
- triggerLabel = "Options"
5385
- }) {
5386
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5387
- /* @__PURE__ */ jsxs(DropdownMenuTrigger, { "aria-label": "Open table options", children: [
5388
- /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4" }),
5389
- /* @__PURE__ */ jsx("span", { children: triggerLabel })
5390
- ] }),
5391
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [
5392
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Options" }) }),
5393
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5394
- /* @__PURE__ */ jsx(
5395
- DropdownMenuCheckboxItem,
5396
- {
5397
- checked: showSummaries,
5398
- onCheckedChange: (checked) => onShowSummariesChange(checked === true),
5399
- children: "Show summary row"
5400
- }
5401
- ),
5402
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5403
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Columns" }) }),
7017
+ const scheduleClose = useCallback(
7018
+ (delay) => {
7019
+ clearTimer();
7020
+ if (delay <= 0) {
7021
+ setOpen(false);
7022
+ return;
7023
+ }
7024
+ timerRef.current = window.setTimeout(() => {
7025
+ timerRef.current = null;
7026
+ setOpen(false);
7027
+ }, delay);
7028
+ },
7029
+ [clearTimer, setOpen]
7030
+ );
7031
+ const {
7032
+ ref: positionRef,
7033
+ style: positionStyle,
7034
+ placement,
7035
+ positioned
7036
+ } = useAnchoredPosition({
7037
+ anchorRef: triggerRef,
7038
+ side,
7039
+ align,
7040
+ offset,
7041
+ enabled: open
7042
+ });
7043
+ useLayer({
7044
+ enabled: open,
7045
+ kind: "popover",
7046
+ elementRef: tipRef,
7047
+ onEscape: () => {
7048
+ clearTimer();
7049
+ setOpen(false);
7050
+ }
7051
+ });
7052
+ const tipRefs = useMemo(
7053
+ () => composeRefs(tipRef, positionRef),
7054
+ [positionRef]
7055
+ );
7056
+ if (!isValidElement(children)) {
7057
+ throw new Error("Tooltip expects exactly one element child to use as its trigger.");
7058
+ }
7059
+ if (content === null || content === void 0 || content === false) return children;
7060
+ const childProps = children.props;
7061
+ const describedBy = open ? [childProps["aria-describedby"], tipId].filter(Boolean).join(" ") : childProps["aria-describedby"];
7062
+ const trigger = cloneElement(children, {
7063
+ ref: composeRefs(childProps.ref, triggerRef),
7064
+ "aria-describedby": describedBy,
7065
+ onPointerEnter: (event) => {
7066
+ childProps.onPointerEnter?.(event);
7067
+ if (event.pointerType === "touch") return;
7068
+ scheduleOpen(openDelay);
7069
+ },
7070
+ onPointerLeave: (event) => {
7071
+ childProps.onPointerLeave?.(event);
7072
+ scheduleClose(closeDelay);
7073
+ },
7074
+ onPointerDown: (event) => {
7075
+ childProps.onPointerDown?.(event);
7076
+ pointerDownRef.current = true;
7077
+ clearPressEndListener();
7078
+ const onPressEnd = () => {
7079
+ pointerDownRef.current = false;
7080
+ clearPressEndListener();
7081
+ };
7082
+ pressEndListenerRef.current = onPressEnd;
7083
+ document.addEventListener("pointerup", onPressEnd);
7084
+ document.addEventListener("pointercancel", onPressEnd);
7085
+ clearTimer();
7086
+ setOpen(false);
7087
+ },
7088
+ onFocus: (event) => {
7089
+ childProps.onFocus?.(event);
7090
+ if (pointerDownRef.current) return;
7091
+ scheduleOpen(0);
7092
+ },
7093
+ onBlur: (event) => {
7094
+ childProps.onBlur?.(event);
7095
+ scheduleClose(0);
7096
+ }
7097
+ });
7098
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7099
+ trigger,
7100
+ open && typeof document !== "undefined" ? createPortal(
5404
7101
  /* @__PURE__ */ jsx(
5405
- DndContext,
7102
+ "div",
5406
7103
  {
5407
- id: optionsDndContextId,
5408
- sensors: optionsSensors,
5409
- collisionDetection: closestCenter,
5410
- onDragEnd: onOptionColumnDragEnd,
5411
- children: /* @__PURE__ */ jsx(
5412
- SortableContext,
5413
- {
5414
- items: visibleColumns.map((column) => column.id),
5415
- strategy: verticalListSortingStrategy,
5416
- children: visibleColumns.map((column) => /* @__PURE__ */ jsx(
5417
- SortableColumnOptionItem,
5418
- {
5419
- column,
5420
- checked: true,
5421
- disabled: visibleColumnIds.length === 1,
5422
- onCheckedChange: (checked) => toggleColumnVisibility(column.id, checked)
5423
- },
5424
- column.id
5425
- ))
5426
- }
5427
- )
7104
+ ref: tipRefs,
7105
+ id: tipId,
7106
+ role: "tooltip",
7107
+ "data-slot": "tooltip",
7108
+ "data-state": "open",
7109
+ "data-side": placement?.side,
7110
+ "data-align": placement?.align,
7111
+ "data-positioned": positioned ? "true" : "false",
7112
+ className: cn(
7113
+ "pointer-events-none fixed z-[110] max-w-xs text-xs font-medium leading-snug",
7114
+ positioned && "ds-enter-pop",
7115
+ className
7116
+ ),
7117
+ style: { ...positionStyle, ...TOOLTIP_SURFACE_STYLE },
7118
+ children: content
5428
7119
  }
5429
7120
  ),
5430
- hiddenColumns.length > 0 ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
5431
- hiddenColumns.map((column) => /* @__PURE__ */ jsx(
5432
- DropdownMenuCheckboxItem,
5433
- {
5434
- checked: false,
5435
- onCheckedChange: (checked) => toggleColumnVisibility(column.id, checked === true),
5436
- children: column.label
5437
- },
5438
- column.id
5439
- ))
5440
- ] })
7121
+ document.body
7122
+ ) : null
5441
7123
  ] });
5442
7124
  }
5443
7125
  var VARIANT_CLASS2 = {
@@ -7285,7 +8967,14 @@ function SegmentedPill({
7285
8967
  className
7286
8968
  ),
7287
8969
  style: {
7288
- background: "rgb(var(--surface-overlay-soft))",
8970
+ // OPAQUE. This was --surface-overlay-soft, a translucent tint, with a
8971
+ // translucent --accent-subtle pill on top of it — two alpha layers
8972
+ // stacked. In light that composited to a 245 pill inside a 247 strip:
8973
+ // the ACTIVE segment rendered DARKER than the track it sits in, so the
8974
+ // raised element read as recessed and the whole control looked washed
8975
+ // out. --surface-frame is the recessed-well token and is darker than
8976
+ // --surface-card in BOTH themes, so the direction holds either way.
8977
+ background: "rgb(var(--surface-frame))",
7289
8978
  border: "1px solid rgb(var(--border))",
7290
8979
  borderRadius: "var(--radius-full)"
7291
8980
  },
@@ -7314,9 +9003,17 @@ function SegmentedPill({
7314
9003
  style: {
7315
9004
  borderRadius: "var(--radius-full)",
7316
9005
  ...isActive ? {
7317
- background: "rgb(var(--accent-subtle))",
9006
+ // The active segment STEPS UP off the track: an opaque
9007
+ // surface sandwiched between the accent border and the
9008
+ // strip, plus a small shadow. --surface-card is +8 on the
9009
+ // frame in light and +6 in dark, so it reads raised in both.
9010
+ background: "rgb(var(--surface-card))",
7318
9011
  border: "1px solid rgb(var(--accent))",
7319
- color: "rgb(var(--accent))"
9012
+ // --accent-ink, not --accent: the brand red is 5.64:1 on a
9013
+ // light card but 3.05:1 on a dark one, i.e. an accent LABEL
9014
+ // fails AA in dark. --accent-ink is the theme-tuned form.
9015
+ color: "rgb(var(--accent-ink))",
9016
+ boxShadow: "var(--shadow-sm)"
7320
9017
  } : {
7321
9018
  background: "transparent",
7322
9019
  border: "1px solid transparent",
@@ -7329,7 +9026,7 @@ function SegmentedPill({
7329
9026
  {
7330
9027
  className: "inline-flex shrink-0",
7331
9028
  style: {
7332
- color: isActive ? "rgb(var(--accent))" : "rgb(var(--text-muted))"
9029
+ color: isActive ? "rgb(var(--accent-ink))" : "rgb(var(--text-muted))"
7333
9030
  },
7334
9031
  "aria-hidden": "true",
7335
9032
  children: item.icon
@@ -8246,7 +9943,7 @@ var LANGUAGES = {
8246
9943
  javascript,
8247
9944
  js: javascript,
8248
9945
  json,
8249
- jsx: jsx66,
9946
+ jsx: jsx70,
8250
9947
  markdown,
8251
9948
  md: markdown,
8252
9949
  html: markup,
@@ -8995,26 +10692,6 @@ function HeaderTitle({ title }) {
8995
10692
  /* @__PURE__ */ jsx("span", { style: accent, children: last })
8996
10693
  ] });
8997
10694
  }
8998
- function BenchmarkPlaceholder() {
8999
- return /* @__PURE__ */ jsxs(
9000
- "div",
9001
- {
9002
- className: "flex items-center",
9003
- style: {
9004
- gap: 10,
9005
- padding: "12px 16px",
9006
- borderRadius: "var(--radius-lg)",
9007
- background: "rgb(var(--muted))",
9008
- border: "1px dashed rgb(var(--border))",
9009
- color: "rgb(var(--text-muted))"
9010
- },
9011
- children: [
9012
- /* @__PURE__ */ jsx(BarChart3, { size: 15 }),
9013
- /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 500 }, children: "Benchmark unavailable in manual mode" })
9014
- ]
9015
- }
9016
- );
9017
- }
9018
10695
  function AssumptionsPopover({ children }) {
9019
10696
  const [open, setOpen] = useState(false);
9020
10697
  return /* @__PURE__ */ jsxs(
@@ -9108,10 +10785,9 @@ function CalculatorShellV2({
9108
10785
  const header = /* @__PURE__ */ jsxs(
9109
10786
  "header",
9110
10787
  {
9111
- className: "flex items-center",
10788
+ className: "flex items-center px-4 py-4 sm:px-6 sm:py-5",
9112
10789
  style: {
9113
10790
  gap: 16,
9114
- padding: "20px 24px",
9115
10791
  background: "rgb(var(--brand-ink))",
9116
10792
  borderRadius: isOpen ? "var(--radius-xl)" : 0
9117
10793
  },
@@ -9135,7 +10811,8 @@ function CalculatorShellV2({
9135
10811
  /* @__PURE__ */ jsx(
9136
10812
  "div",
9137
10813
  {
9138
- className: "font-semibold uppercase",
10814
+ className: "font-semibold uppercase truncate",
10815
+ title: eyebrow,
9139
10816
  style: {
9140
10817
  fontFamily: "var(--font-mono)",
9141
10818
  fontSize: 11,
@@ -9165,10 +10842,9 @@ function CalculatorShellV2({
9165
10842
  const footer = /* @__PURE__ */ jsxs(
9166
10843
  "footer",
9167
10844
  {
9168
- className: "flex items-center",
10845
+ className: "flex flex-wrap items-center px-4 py-4 sm:px-6",
9169
10846
  style: {
9170
10847
  gap: 12,
9171
- padding: "16px 24px",
9172
10848
  borderTop: isOpen ? "none" : "1px solid rgb(var(--border))",
9173
10849
  marginTop: isOpen ? 4 : 0,
9174
10850
  background: isOpen ? "transparent" : "rgb(var(--bg-card))"
@@ -9215,7 +10891,7 @@ function CalculatorShellV2({
9215
10891
  const body = /* @__PURE__ */ jsxs(Fragment, { children: [
9216
10892
  inputs,
9217
10893
  result,
9218
- benchmarkSlot ?? /* @__PURE__ */ jsx(BenchmarkPlaceholder, {})
10894
+ benchmarkSlot
9219
10895
  ] });
9220
10896
  return /* @__PURE__ */ jsx(
9221
10897
  "div",
@@ -9249,8 +10925,8 @@ function CalculatorShellV2({
9249
10925
  /* @__PURE__ */ jsx(
9250
10926
  "div",
9251
10927
  {
9252
- className: "flex flex-col",
9253
- style: { padding: "var(--space-6)", gap: "var(--space-4)" },
10928
+ className: "flex flex-col p-4 sm:p-6",
10929
+ style: { gap: "var(--space-4)" },
9254
10930
  children: body
9255
10931
  }
9256
10932
  ),
@@ -9261,90 +10937,104 @@ function CalculatorShellV2({
9261
10937
  }
9262
10938
  );
9263
10939
  }
9264
- function StatRow({ steps, className }) {
9265
- return /* @__PURE__ */ jsx("div", { className, style: { display: "flex", alignItems: "stretch", gap: 0 }, children: steps.map((s, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
9266
- i > 0 && /* @__PURE__ */ jsx(
9267
- "div",
9268
- {
9269
- className: "flex items-center shrink-0",
9270
- style: { padding: "0 2px", color: "rgb(var(--text-muted))" },
9271
- "aria-hidden": "true",
9272
- children: /* @__PURE__ */ jsx(ArrowRight, { size: 14, strokeWidth: 2.2 })
9273
- }
9274
- ),
9275
- /* @__PURE__ */ jsxs(
9276
- "div",
9277
- {
9278
- "data-pivotal": s.pivotal ? "true" : void 0,
9279
- style: {
9280
- flex: 1,
9281
- minWidth: 0,
9282
- borderRadius: "var(--radius-lg)",
9283
- padding: 5,
9284
- background: s.pivotal ? "rgb(var(--accent))" : "rgb(var(--brand-ink))"
9285
- },
9286
- children: [
10940
+ function StatRow({ steps, copyable = false, className }) {
10941
+ return /* @__PURE__ */ jsx(
10942
+ "div",
10943
+ {
10944
+ className: cn("grid grid-cols-2 gap-2 sm:flex sm:items-stretch sm:gap-0", className),
10945
+ children: steps.map((s, i) => {
10946
+ const panelStyle = {
10947
+ background: "rgb(var(--bg-card))",
10948
+ borderRadius: 10,
10949
+ padding: "12px 10px",
10950
+ minHeight: 46
10951
+ };
10952
+ const figure = /* @__PURE__ */ jsx(
10953
+ "span",
10954
+ {
10955
+ className: "font-extrabold tabular-nums",
10956
+ style: {
10957
+ fontSize: 22,
10958
+ letterSpacing: "-0.025em",
10959
+ lineHeight: 1,
10960
+ color: s.pivotal ? "rgb(var(--accent))" : "rgb(var(--foreground))"
10961
+ },
10962
+ children: s.value
10963
+ }
10964
+ );
10965
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
10966
+ i > 0 && /* @__PURE__ */ jsx(
10967
+ "div",
10968
+ {
10969
+ className: "hidden sm:flex items-center shrink-0",
10970
+ style: { padding: "0 2px", color: "rgb(var(--text-muted))" },
10971
+ "aria-hidden": "true",
10972
+ children: /* @__PURE__ */ jsx(ArrowRight, { size: 14, strokeWidth: 2.2 })
10973
+ }
10974
+ ),
9287
10975
  /* @__PURE__ */ jsxs(
9288
10976
  "div",
9289
10977
  {
9290
- className: "flex items-center",
10978
+ "data-pivotal": s.pivotal ? "true" : void 0,
9291
10979
  style: {
9292
- gap: 5,
9293
- padding: "4px 7px 6px",
9294
- color: "rgb(255 255 255 / 0.7)",
9295
- minWidth: 0
10980
+ flex: 1,
10981
+ minWidth: 0,
10982
+ borderRadius: "var(--radius-lg)",
10983
+ padding: 5,
10984
+ background: s.pivotal ? "rgb(var(--accent))" : "rgb(var(--brand-ink))"
9296
10985
  },
9297
10986
  children: [
9298
- /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: s.icon }),
9299
- /* @__PURE__ */ jsx(
9300
- "span",
10987
+ /* @__PURE__ */ jsxs(
10988
+ "div",
9301
10989
  {
9302
- className: "font-bold uppercase",
9303
- title: s.label,
10990
+ className: "flex items-center",
9304
10991
  style: {
9305
- fontSize: "9.5px",
9306
- letterSpacing: "0.05em",
9307
- whiteSpace: "nowrap",
9308
- overflow: "hidden",
9309
- textOverflow: "ellipsis",
9310
- minWidth: 0,
9311
- flex: 1
10992
+ gap: 5,
10993
+ padding: "4px 7px 6px",
10994
+ color: "rgb(255 255 255 / 0.7)",
10995
+ minWidth: 0
9312
10996
  },
9313
- children: s.label
10997
+ children: [
10998
+ /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: s.icon }),
10999
+ /* @__PURE__ */ jsx(
11000
+ "span",
11001
+ {
11002
+ className: "font-bold uppercase",
11003
+ title: s.label,
11004
+ style: {
11005
+ fontSize: "9.5px",
11006
+ letterSpacing: "0.05em",
11007
+ whiteSpace: "nowrap",
11008
+ overflow: "hidden",
11009
+ textOverflow: "ellipsis",
11010
+ minWidth: 0,
11011
+ flex: 1
11012
+ },
11013
+ children: s.label
11014
+ }
11015
+ )
11016
+ ]
9314
11017
  }
9315
- )
11018
+ ),
11019
+ copyable ? /* @__PURE__ */ jsx(
11020
+ "button",
11021
+ {
11022
+ type: "button",
11023
+ onClick: () => void copyText(s.copyValue ?? s.value, s.label),
11024
+ title: `Copy ${s.label}`,
11025
+ "aria-label": `Copy ${s.label}: ${s.value}`,
11026
+ className: "grid w-full place-items-center text-center cursor-pointer transition-[box-shadow,transform] hover:-translate-y-px hover:[box-shadow:var(--shadow-sm)] focus-visible:outline-none focus-visible:[box-shadow:var(--ring-focus)]",
11027
+ style: { ...panelStyle, border: "none" },
11028
+ children: figure
11029
+ }
11030
+ ) : /* @__PURE__ */ jsx("div", { className: "grid place-items-center text-center", style: panelStyle, children: figure })
9316
11031
  ]
9317
11032
  }
9318
- ),
9319
- /* @__PURE__ */ jsx(
9320
- "div",
9321
- {
9322
- className: "grid place-items-center text-center",
9323
- style: {
9324
- background: "rgb(var(--bg-card))",
9325
- borderRadius: 10,
9326
- padding: "12px 10px",
9327
- minHeight: 46
9328
- },
9329
- children: /* @__PURE__ */ jsx(
9330
- "span",
9331
- {
9332
- className: "font-extrabold tabular-nums",
9333
- style: {
9334
- fontSize: 22,
9335
- letterSpacing: "-0.025em",
9336
- lineHeight: 1,
9337
- color: s.pivotal ? "rgb(var(--accent))" : "rgb(var(--foreground))"
9338
- },
9339
- children: s.value
9340
- }
9341
- )
9342
- }
9343
11033
  )
9344
- ]
9345
- }
9346
- )
9347
- ] }, i)) });
11034
+ ] }, i);
11035
+ })
11036
+ }
11037
+ );
9348
11038
  }
9349
11039
  function Slider({
9350
11040
  value,
@@ -14446,6 +16136,6 @@ var PLACEMENT_CONFIGS = [
14446
16136
  }
14447
16137
  ];
14448
16138
 
14449
- export { AccordionCompound as Accordion, AllocationSparkbar, AppScroll, BRAND_ICONS, Badge, BrandFacebook, BrandInstagram, BrandLinkedIn, BrandLogoTile, BrandMessenger, BrandMeta, BrandNextdoor, BrandPinterest, BrandSnapchat, BrandTikTok, BulkActionBar, Button, ButtonGroup, CalculatorShell, CalculatorShellV2, card_default as Card, Checkbox, ChipNav, Choropleth, CodeBlock, CollapsibleCard, CompletionRing, CopyField, DataGrid, DataGridColumnOptionsMenu, DataGridDragOverlay, DataGridDropIndicator, DataGridToolbar, DetailSection, DeviceFrame, DragHandle, DropdownButton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyPlaceholder, EmptyState, FOLDER_COLOR_KEYS, FileDropZone, FilePreviewGrid, FilePreviewItem, FileThumbnail, FileUploadButton, FilterBar, FilterDropdown, FloatingDrawer, FloatingStatusBar, FolderCard, FolderTreePicker, FrameStack, HEADER_HEIGHT, HeroFormCardCompound as HeroFormCard, IconTile, IdentityLabel, IdentityValue, Input, Kbd, ListItem, MarkdownCode, MarkdownRenderer, MenuButton, MetaCell, meta_previews_exports as MetaPreviews, MetricCard, MicrosoftLogo, modal_default as Modal, OptionTile, OptionTileGroup, PLACEMENT_CONFIGS, PageHeaderHost, PageHeaderSlotProvider, PageHero, page_shell_default as PageShell, Pagination, PillButton, profile_section_default as ProfileSection, ProgressBar, Radio, RadioGroup, RangeSlider, ResizableHandle, ResizablePane, SECTION_SCROLL_OFFSET, SearchBar, SectionLabel, SegmentedPill, Shell2 as Shell, ShellStat, Slider, SortableItem, SortableList, SortableTable, StatRow, StatsGrid, StepLoader, Tabs, TagChipInput, TagRow, TextInput, Textarea, TextareaInput, Toaster, TokenBadge, ValueChip, bestTextOn, cn, contrastRatio, copyText, folderColorVar, formatCurrency, formatNumber, formatPercent, formatRatio, hexToRgbTuple, hslString, relativeLuminance, rgbCss, rgbString, useFileUpload, wcagBadges };
16139
+ export { AccordionCompound as Accordion, AllocationSparkbar, AppScroll, BRAND_ICONS, Badge, BrandFacebook, BrandIcon, BrandInstagram, BrandLinkedIn, BrandLogoTile, BrandMessenger, BrandMeta, BrandNextdoor, BrandPinterest, BrandSnapchat, BrandTikTok, BulkActionBar, Button, ButtonGroup, CalculatorShell, CalculatorShellV2, card_default as Card, Checkbox, ChipNav, Choropleth, CodeBlock, CollapsibleCard, Combobox2 as Combobox, CompletionRing, CopyField, DataGrid, DataGridColumnOptionsMenu, DataGridDragOverlay, DataGridDropIndicator, DataGridToolbar, DetailSection, DeviceFrame, DragHandle, DropdownButton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyPlaceholder, EmptyState, FOLDER_COLOR_KEYS, FileDropZone, FilePreviewGrid, FilePreviewItem, FileThumbnail, FileUploadButton, FilterBar, FilterDropdown, FloatingDrawer, FloatingStatusBar, FolderCard, FolderTreePicker, FrameStack, HEADER_HEIGHT, HeroFormCardCompound as HeroFormCard, HomeCrumbLink, IconTile, IdentityLabel, IdentityValue, Input, Kbd, LISTBOX_CLASS, ListItem, ListboxOption, MarkdownCode, MarkdownRenderer, MenuButton, MetaCell, meta_previews_exports as MetaPreviews, MetricCard, MicrosoftLogo, modal_default as Modal, OptionTile, OptionTileGroup, PLACEMENT_CONFIGS, POPOVER_SURFACE_STYLE, PageHeaderHost, PageHeaderSlotProvider, PageHero, page_shell_default as PageShell, Pagination, PillButton, Popover, profile_section_default as ProfileSection, ProgressBar, Radio, RadioGroup, RangeSlider, ResizableHandle, ResizablePane, SECTION_SCROLL_OFFSET, SearchBar, SectionLabel, SegmentedPill, Select2 as Select, Shell2 as Shell, ShellStat, Slider, SortableItem, SortableList, SortableTable, StatRow, StatsGrid, StepLoader, Tabs, TagChipInput, TagRow, TextInput, Textarea, TextareaInput, Toaster, TokenBadge, Tooltip, ValueChip, bestTextOn, cn, computeAnchoredPosition, contrastRatio, copyText, folderColorVar, formatCurrency, formatNumber, formatPercent, formatRatio, hasBrandIcon, hexToRgbTuple, hslString, relativeLuminance, rgbCss, rgbString, useAnchoredPosition, useBreadcrumbHome, useEscapeKey, useFileUpload, useLayer, useOutsideClick, wcagBadges };
14450
16140
  //# sourceMappingURL=index.js.map
14451
16141
  //# sourceMappingURL=index.js.map