@actioneer/ads 0.5.7 → 0.5.9

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 (147) hide show
  1. package/bin/ads-init.mjs +6 -0
  2. package/components/accordion.js +50 -48
  3. package/components/agent-icon.d.ts +12 -0
  4. package/components/agent-icon.js +133 -120
  5. package/components/ai-elements/chain-of-thought.d.ts +1 -1
  6. package/components/ai-elements/chain-of-thought.js +108 -108
  7. package/components/ai-elements/chart.js +16 -14
  8. package/components/ai-elements/inline-citation.js +41 -41
  9. package/components/ai-elements/message.js +4 -4
  10. package/components/ai-elements/queue.js +7 -7
  11. package/components/ai-elements/research-activity.js +114 -114
  12. package/components/ai-elements/shimmer.d.ts +2 -2
  13. package/components/ai-elements/speech-input.js +28 -28
  14. package/components/ai-elements/task-progress.js +26 -16
  15. package/components/ai-elements/task.js +17 -17
  16. package/components/ai-elements/tool.js +6 -6
  17. package/components/ai-elements/transcript.js +6 -5
  18. package/components/ai-elements/voice.js +1 -1
  19. package/components/alert.js +10 -10
  20. package/components/answer-sources.js +1 -1
  21. package/components/answer.js +115 -114
  22. package/components/assistant-ui/action-bar.js +94 -48
  23. package/components/assistant-ui/attachment.js +103 -75
  24. package/components/assistant-ui/badge.d.ts +1 -1
  25. package/components/assistant-ui/badge.js +17 -17
  26. package/components/assistant-ui/chain-of-thought.d.ts +1 -1
  27. package/components/assistant-ui/composer-add-context.js +9 -9
  28. package/components/assistant-ui/composer-deep-research.js +5 -5
  29. package/components/assistant-ui/composer-harness.js +11 -9
  30. package/components/assistant-ui/composer-trigger-popover.js +45 -34
  31. package/components/assistant-ui/composer.js +59 -59
  32. package/components/assistant-ui/error.js +14 -14
  33. package/components/assistant-ui/file.d.ts +1 -1
  34. package/components/assistant-ui/image.d.ts +1 -1
  35. package/components/assistant-ui/image.js +113 -103
  36. package/components/assistant-ui/markdown-text.js +18 -18
  37. package/components/assistant-ui/message.js +46 -45
  38. package/components/assistant-ui/quote.js +1 -1
  39. package/components/assistant-ui/reasoning.d.ts +1 -1
  40. package/components/assistant-ui/reasoning.js +66 -77
  41. package/components/assistant-ui/suggestions.js +4 -4
  42. package/components/assistant-ui/thread.js +22 -22
  43. package/components/assistant-ui/tool-fallback.js +60 -63
  44. package/components/assistant-ui/tool-group.d.ts +1 -1
  45. package/components/assistant-ui/tool-group.js +36 -42
  46. package/components/audio-waveform.js +25 -24
  47. package/components/autocomplete.d.ts +1 -0
  48. package/components/autocomplete.js +45 -43
  49. package/components/avatar.d.ts +1 -0
  50. package/components/avatar.js +27 -26
  51. package/components/badge.d.ts +1 -1
  52. package/components/breadcrumbs.d.ts +2 -0
  53. package/components/breadcrumbs.js +52 -50
  54. package/components/button.d.ts +2 -2
  55. package/components/button.js +22 -20
  56. package/components/card.js +8 -8
  57. package/components/carousel.js +105 -104
  58. package/components/chart.d.ts +6 -0
  59. package/components/chart.js +743 -672
  60. package/components/checkbox.js +74 -38
  61. package/components/chip.d.ts +1 -1
  62. package/components/code-block.js +3 -3
  63. package/components/collapsible.js +67 -23
  64. package/components/connector-card.js +6 -6
  65. package/components/drawer.d.ts +18 -11
  66. package/components/drawer.js +81 -78
  67. package/components/dropdown.d.ts +2 -0
  68. package/components/dropdown.js +88 -79
  69. package/components/empty-state.d.ts +1 -1
  70. package/components/empty-state.js +7 -7
  71. package/components/field.d.ts +4 -0
  72. package/components/field.js +45 -34
  73. package/components/file-dropzone.js +12 -12
  74. package/components/index.d.ts +3 -0
  75. package/components/index.js +584 -558
  76. package/components/input-field.js +51 -46
  77. package/components/input.js +20 -20
  78. package/components/link.js +9 -9
  79. package/components/modal.d.ts +5 -1
  80. package/components/modal.js +121 -76
  81. package/components/navbar.d.ts +1 -1
  82. package/components/navbar.js +1 -1
  83. package/components/number-field.js +38 -29
  84. package/components/page-header.js +12 -12
  85. package/components/pagination.js +19 -19
  86. package/components/panel.js +2 -2
  87. package/components/pixel-blast-svg.js +3 -3
  88. package/components/pixel-icon.d.ts +4 -0
  89. package/components/pixel-icon.js +210 -164
  90. package/components/popover.d.ts +1 -1
  91. package/components/popover.js +66 -64
  92. package/components/progress-circle.js +36 -32
  93. package/components/progress.js +28 -24
  94. package/components/radio.js +59 -49
  95. package/components/resizable-panel.js +1 -1
  96. package/components/reveal.d.ts +2 -2
  97. package/components/ripple.d.ts +3 -3
  98. package/components/scroll-area.js +17 -16
  99. package/components/segmented.d.ts +1 -0
  100. package/components/segmented.js +39 -36
  101. package/components/select.d.ts +7 -0
  102. package/components/select.js +186 -137
  103. package/components/setting-row.js +45 -42
  104. package/components/sidebar.js +131 -127
  105. package/components/skeleton.js +5 -5
  106. package/components/spinner.d.ts +13 -4
  107. package/components/spinner.js +42 -42
  108. package/components/stepper.js +21 -21
  109. package/components/switch.js +41 -39
  110. package/components/table.d.ts +16 -0
  111. package/components/table.js +393 -260
  112. package/components/tabs.js +149 -137
  113. package/components/toast.js +66 -66
  114. package/components/tooltip.js +2 -2
  115. package/components/tree.js +62 -51
  116. package/components/typography.d.ts +2 -1
  117. package/components/typography.js +33 -32
  118. package/components/ui/button.d.ts +2 -2
  119. package/components/ui/button.js +19 -19
  120. package/components/ui/collapsible.d.ts +1 -5
  121. package/components/ui/dialog.d.ts +3 -3
  122. package/components/ui/dialog.js +95 -58
  123. package/components/ui/tooltip.d.ts +2 -2
  124. package/components/ui/tooltip.js +67 -33
  125. package/components/viz-charts.js +95 -95
  126. package/demo/components/add-to-artifact.js +363 -0
  127. package/demo/lib/artifact-library.js +142 -0
  128. package/demo/lib/artifact-pin-guard.js +12 -0
  129. package/fonts/aribau-grotesk-medium.woff2 +0 -0
  130. package/fonts/aribau-grotesk-regular.woff2 +0 -0
  131. package/fonts.css +11 -11
  132. package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +17 -16
  133. package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +21 -20
  134. package/lib/icons.d.ts +24 -0
  135. package/lib/icons.js +114 -108
  136. package/lib/motion.d.ts +42 -39
  137. package/lib/motion.js +112 -52
  138. package/lib/spinner-mark.d.ts +9 -0
  139. package/lib/spinner-mark.js +98 -0
  140. package/llms.txt +53 -19
  141. package/manifest.json +258 -36
  142. package/package.json +1 -1
  143. package/styles.css +143 -124
  144. package/theme.css +90 -93
  145. package/components/ui/collapsible.js +0 -35
  146. package/fonts/aribau-grotesk-500.otf +0 -0
  147. package/fonts/aribau-grotesk-600.woff2 +0 -0
@@ -14,6 +14,7 @@ export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDiv
14
14
  options: SegmentedOption[];
15
15
  value: string;
16
16
  onChange: (value: string) => void;
17
+ elevated?: boolean;
17
18
  }
18
19
  export declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<HTMLDivElement>>;
19
20
  export {};
@@ -1,40 +1,40 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as x } from "react/jsx-runtime";
2
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
3
3
  import * as l from "react";
4
- import { MotionConfig as h, motion as v } from "motion/react";
5
- import { cva as d } from "class-variance-authority";
6
- import { cn as c } from "../lib/cn.js";
7
- import { EASE_OUT as w } from "../lib/motion.js";
8
- const y = d(
4
+ import { MotionConfig as v, motion as w } from "motion/react";
5
+ import { cva as c } from "class-variance-authority";
6
+ import { cn as o } from "../lib/cn.js";
7
+ import { springControl as y } from "../lib/motion.js";
8
+ const D = c(
9
9
  // Borderless recessed track on ink-200 (bg-surface) — matches the Tabs
10
- // primary track (the pill provides the definition; a stroke around the
10
+ // primary track (the selected segment provides the definition; a stroke around the
11
11
  // track read as a second, heavier control).
12
- "inline-flex items-center gap-1 rounded-full bg-surface p-1",
12
+ "inline-flex items-center gap-1 bg-surface p-1",
13
13
  {
14
14
  variants: {
15
15
  size: {
16
- sm: "text-xs",
17
- md: "text-xs",
18
- lg: "text-base"
16
+ sm: "rounded-sm text-xs",
17
+ md: "rounded-md text-xs",
18
+ lg: "rounded-md text-base"
19
19
  }
20
20
  },
21
21
  defaultVariants: { size: "md" }
22
22
  }
23
- ), D = d(
24
- c(
25
- // The active pill is a shared motion thumb that SLIDES between options
23
+ ), k = c(
24
+ o(
25
+ // The active segment is a shared motion thumb that SLIDES between options
26
26
  // (layoutId), so the option itself only carries text color.
27
- "relative inline-flex items-center justify-center whitespace-nowrap rounded-full font-normal select-none",
28
- "transition-colors duration-(--duration-fast) cursor-pointer",
27
+ "relative inline-flex items-center justify-center whitespace-nowrap font-normal select-none",
28
+ "transition-colors duration-150 cursor-pointer",
29
29
  "outline-none focus-visible:ring-3 focus-visible:ring-ring",
30
30
  "disabled:pointer-events-none disabled:opacity-50"
31
31
  ),
32
32
  {
33
33
  variants: {
34
34
  size: {
35
- sm: "h-6 px-2.5",
36
- md: "h-8 px-3",
37
- lg: "h-9 px-4"
35
+ sm: "h-6 rounded-sm px-2.5",
36
+ md: "h-8 rounded-md px-3",
37
+ lg: "h-9 rounded-md px-4"
38
38
  },
39
39
  selected: {
40
40
  true: "text-foreground",
@@ -43,33 +43,33 @@ const y = d(
43
43
  },
44
44
  defaultVariants: { size: "md", selected: !1 }
45
45
  }
46
- ), k = l.forwardRef(({ options: r, value: a, onChange: s, size: o, className: u, ...m }, f) => {
47
- const p = l.useId(), i = (e) => {
48
- const t = r.findIndex((g) => g.value === a), b = ((t < 0 ? 0 : t) + e + r.length) % r.length;
46
+ ), I = l.forwardRef(({ options: r, value: a, onChange: s, size: i, className: u, elevated: m = !0, ...f }, p) => {
47
+ const g = l.useId(), d = (e) => {
48
+ const t = r.findIndex((x) => x.value === a), b = ((t < 0 ? 0 : t) + e + r.length) % r.length;
49
49
  s(r[b].value);
50
50
  };
51
51
  return /* @__PURE__ */ n(
52
52
  "div",
53
53
  {
54
- ref: f,
54
+ ref: p,
55
55
  role: "radiogroup",
56
56
  onKeyDown: (e) => {
57
57
  switch (e.key) {
58
58
  case "ArrowRight":
59
59
  case "ArrowDown":
60
- e.preventDefault(), i(1);
60
+ e.preventDefault(), d(1);
61
61
  break;
62
62
  case "ArrowLeft":
63
63
  case "ArrowUp":
64
- e.preventDefault(), i(-1);
64
+ e.preventDefault(), d(-1);
65
65
  break;
66
66
  }
67
67
  },
68
- className: c(y({ size: o }), u),
69
- ...m,
70
- children: /* @__PURE__ */ n(h, { reducedMotion: "user", children: r.map((e) => {
68
+ className: o(D({ size: i }), u),
69
+ ...f,
70
+ children: /* @__PURE__ */ n(v, { reducedMotion: "user", children: r.map((e) => {
71
71
  const t = e.value === a;
72
- return /* @__PURE__ */ x(
72
+ return /* @__PURE__ */ h(
73
73
  "button",
74
74
  {
75
75
  type: "button",
@@ -78,16 +78,19 @@ const y = d(
78
78
  "aria-label": e.ariaLabel,
79
79
  tabIndex: t ? 0 : -1,
80
80
  onClick: () => s(e.value),
81
- className: D({ size: o, selected: t }),
81
+ className: k({ size: i, selected: t }),
82
82
  children: [
83
83
  t && /* @__PURE__ */ n(
84
- v.span,
84
+ w.span,
85
85
  {
86
- layoutId: p,
86
+ layoutId: g,
87
87
  "aria-hidden": !0,
88
88
  layoutDependency: a,
89
- transition: { duration: 0.2, ease: w },
90
- className: "absolute inset-0 rounded-full bg-elevated shadow-elevation"
89
+ transition: y,
90
+ className: o(
91
+ "absolute inset-0 rounded-[inherit] bg-elevated",
92
+ m && "shadow-elevation"
93
+ )
91
94
  }
92
95
  ),
93
96
  /* @__PURE__ */ n("span", { className: "relative", children: e.label })
@@ -99,7 +102,7 @@ const y = d(
99
102
  }
100
103
  );
101
104
  });
102
- k.displayName = "SegmentedControl";
105
+ I.displayName = "SegmentedControl";
103
106
  export {
104
- k as SegmentedControl
107
+ I as SegmentedControl
105
108
  };
@@ -12,17 +12,24 @@ export interface SelectProps extends VariantProps<typeof selectTriggerVariants>
12
12
  items: SelectItem[];
13
13
  value?: string;
14
14
  onChange?: (value: string) => void;
15
+ multiple?: boolean;
16
+ values?: string[];
17
+ onValuesChange?: (values: string[]) => void;
15
18
  placeholder?: string;
16
19
  disabled?: boolean;
17
20
  isInvalid?: boolean;
18
21
  className?: string;
19
22
  id?: string;
23
+ "aria-label"?: string;
24
+ "aria-describedby"?: string;
20
25
  /**
21
26
  * Which side the listbox opens toward. Use `"top"` when the trigger sits
22
27
  * at the bottom of a clipped container (e.g. a table footer inside an
23
28
  * `overflow-clip` shell) so the menu isn't cut off. Defaults to `"bottom"`.
24
29
  */
25
30
  placement?: "top" | "bottom";
31
+ /** Render the listbox at the document root so overflow containers cannot clip it. */
32
+ portal?: boolean;
26
33
  }
27
34
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLButtonElement>>;
28
35
  export {};
@@ -1,124 +1,221 @@
1
1
  "use client";
2
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { jsx as u, jsxs as k } from "react/jsx-runtime";
3
3
  import * as s from "react";
4
- import { cva as j } from "class-variance-authority";
5
- import { MotionConfig as M, AnimatePresence as V, motion as $ } from "motion/react";
6
- import { ChevronDown as C, Check as K } from "../lib/icons.js";
7
- import { cn as d } from "../lib/cn.js";
8
- import { inputBaseClass as L } from "./field.js";
9
- import { floatVariants as O } from "../lib/motion.js";
10
- import { Ripple as P } from "./ripple.js";
11
- const T = j(
12
- d(
13
- L,
4
+ import { createPortal as q } from "react-dom";
5
+ import { cva as C } from "class-variance-authority";
6
+ import { MotionConfig as F, AnimatePresence as G, motion as J } from "motion/react";
7
+ import { Check as Q, ChevronDown as V } from "../lib/icons.js";
8
+ import { cn as f } from "../lib/cn.js";
9
+ import { inputBaseClass as W } from "./field.js";
10
+ import { floatVariants as X } from "../lib/motion.js";
11
+ import { Ripple as Y } from "./ripple.js";
12
+ const Z = C(
13
+ f(
14
+ W,
14
15
  "items-center justify-between gap-2 text-left cursor-pointer",
15
16
  "[&_svg]:pointer-events-none [&_svg]:shrink-0"
16
17
  ),
17
18
  {
18
19
  variants: {
19
20
  size: {
20
- sm: "h-8 text-xs",
21
- md: "h-10 text-xs",
22
- lg: "h-11 text-base"
21
+ sm: "h-8 rounded-sm text-xs",
22
+ md: "h-10 rounded-md text-xs",
23
+ lg: "h-11 rounded-md text-base"
23
24
  }
24
25
  },
25
26
  defaultVariants: { size: "md" }
26
27
  }
27
- ), _ = s.forwardRef(
28
+ ), ee = s.forwardRef(
28
29
  ({
29
- items: r,
30
- value: c,
31
- onChange: b,
32
- placeholder: I = "Select…",
33
- size: N,
34
- disabled: w,
35
- isInvalid: E,
36
- className: R,
37
- id: A,
38
- placement: v = "bottom"
39
- }, S) => {
40
- const [o, l] = s.useState(!1), [a, x] = s.useState(-1), g = s.useRef(null), k = s.useRef(null), u = s.useId(), h = r.find((e) => e.value === c), z = s.useCallback(() => {
41
- const e = r.findIndex((t) => t.value === c);
42
- return e >= 0 && !r[e].disabled ? e : r.findIndex((t) => !t.disabled);
43
- }, [r, c]);
30
+ items: o,
31
+ value: h,
32
+ onChange: E,
33
+ multiple: d = !1,
34
+ values: l = [],
35
+ onValuesChange: I,
36
+ placeholder: R = "Select…",
37
+ size: M,
38
+ disabled: L,
39
+ isInvalid: B,
40
+ className: H,
41
+ id: O,
42
+ placement: m = "bottom",
43
+ portal: p = !1,
44
+ "aria-label": P,
45
+ "aria-describedby": T
46
+ }, _) => {
47
+ const [r, b] = s.useState(!1), [c, N] = s.useState(-1), z = s.useRef(null), w = s.useRef(null), g = s.useId(), [i, S] = s.useState(null), D = o.find((e) => e.value === h), v = d ? o.filter((e) => l.includes(e.value)) : [], K = s.useCallback(() => {
48
+ const e = d ? o.findIndex((t) => l.includes(t.value)) : o.findIndex((t) => t.value === h);
49
+ return e >= 0 && !o[e].disabled ? e : o.findIndex((t) => !t.disabled);
50
+ }, [o, d, h, l]);
44
51
  s.useEffect(() => {
45
- if (!o) return;
52
+ if (!r) return;
46
53
  const e = (t) => {
47
- var n;
48
- (n = g.current) != null && n.contains(t.target) || l(!1);
54
+ var a, x;
55
+ const n = t.target;
56
+ (a = z.current) != null && a.contains(n) || (x = w.current) != null && x.contains(n) || b(!1);
49
57
  };
50
58
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
51
- }, [o]), s.useEffect(() => {
59
+ }, [r]), s.useLayoutEffect(() => {
60
+ if (!r || !p) {
61
+ S(null);
62
+ return;
63
+ }
64
+ const e = () => {
65
+ var a, x;
66
+ const t = (a = z.current) == null ? void 0 : a.getBoundingClientRect();
67
+ if (!t) return;
68
+ const n = ((x = w.current) == null ? void 0 : x.offsetHeight) ?? 0;
69
+ S({
70
+ top: m === "top" ? t.top - n - 6 : t.bottom + 6,
71
+ left: t.left,
72
+ width: t.width
73
+ });
74
+ };
75
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
76
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
77
+ };
78
+ }, [r, m, p]), s.useEffect(() => {
52
79
  var t;
53
- if (!o || a < 0) return;
54
- const e = (t = k.current) == null ? void 0 : t.children[a];
80
+ if (!r || c < 0) return;
81
+ const e = (t = w.current) == null ? void 0 : t.children[c];
55
82
  e == null || e.scrollIntoView({ block: "nearest" });
56
- }, [o, a]);
57
- const f = () => {
58
- w || (x(z()), l(!0));
59
- }, y = (e) => {
60
- x((t) => {
83
+ }, [r, c]);
84
+ const y = () => {
85
+ L || (N(K()), b(!0));
86
+ }, A = (e) => {
87
+ N((t) => {
61
88
  let n = t;
62
- for (let p = 0; p < r.length; p++)
63
- if (n = (n + e + r.length) % r.length, !r[n].disabled) return n;
89
+ for (let a = 0; a < o.length; a++)
90
+ if (n = (n + e + o.length) % o.length, !o[n].disabled) return n;
64
91
  return t;
65
92
  });
66
- }, D = (e) => {
67
- const t = r[e];
68
- !t || t.disabled || (b == null || b(t.value), l(!1));
69
- };
70
- return /* @__PURE__ */ m("div", { ref: g, className: "relative", children: [
71
- /* @__PURE__ */ m(
93
+ }, $ = (e) => {
94
+ const t = o[e];
95
+ if (!(!t || t.disabled)) {
96
+ if (d) {
97
+ I == null || I(
98
+ l.includes(t.value) ? l.filter((n) => n !== t.value) : [...l, t.value]
99
+ );
100
+ return;
101
+ }
102
+ E == null || E(t.value), b(!1);
103
+ }
104
+ }, U = (e) => {
105
+ switch (e.key) {
106
+ case "ArrowDown":
107
+ e.preventDefault(), r ? A(1) : y();
108
+ break;
109
+ case "ArrowUp":
110
+ e.preventDefault(), r ? A(-1) : y();
111
+ break;
112
+ case "Enter":
113
+ case " ":
114
+ e.preventDefault(), r ? $(c) : y();
115
+ break;
116
+ case "Escape":
117
+ r && (e.preventDefault(), e.stopPropagation(), b(!1));
118
+ break;
119
+ case "Tab":
120
+ b(!1);
121
+ break;
122
+ }
123
+ }, j = /* @__PURE__ */ u(F, { reducedMotion: "user", children: /* @__PURE__ */ u(G, { children: r && /* @__PURE__ */ k(
124
+ J.ul,
125
+ {
126
+ ref: w,
127
+ id: g,
128
+ role: "listbox",
129
+ "aria-multiselectable": d || void 0,
130
+ "aria-activedescendant": c >= 0 ? `${g}-opt-${c}` : void 0,
131
+ variants: X,
132
+ initial: "hidden",
133
+ animate: "visible",
134
+ exit: "hidden",
135
+ style: {
136
+ transformOrigin: m === "top" ? "bottom" : "top",
137
+ ...p ? {
138
+ position: "fixed",
139
+ top: (i == null ? void 0 : i.top) ?? 0,
140
+ left: (i == null ? void 0 : i.left) ?? 0,
141
+ width: (i == null ? void 0 : i.width) ?? 0,
142
+ visibility: i ? "visible" : "hidden",
143
+ zIndex: 60
144
+ } : {}
145
+ },
146
+ className: f(
147
+ "max-h-60 overflow-auto p-1",
148
+ "rounded-md border border-border bg-elevated shadow-elevation",
149
+ p ? "fixed" : f(
150
+ "absolute z-50 w-full",
151
+ m === "top" ? "bottom-full mb-1.5" : "top-full mt-1.5"
152
+ )
153
+ ),
154
+ children: [
155
+ /* @__PURE__ */ u(Y, { origin: m === "top" ? "bottom" : "top" }),
156
+ o.map((e, t) => {
157
+ const n = d ? l.includes(e.value) : e.value === h, a = t === c;
158
+ return /* @__PURE__ */ k(
159
+ "li",
160
+ {
161
+ id: `${g}-opt-${t}`,
162
+ role: "option",
163
+ "aria-selected": n,
164
+ "aria-disabled": e.disabled || void 0,
165
+ onMouseEnter: () => !e.disabled && N(t),
166
+ onClick: () => $(t),
167
+ className: f(
168
+ "flex cursor-pointer items-center justify-between gap-2",
169
+ "rounded-sm px-2 py-1.5 text-xs text-foreground select-none",
170
+ a && !e.disabled && "bg-muted",
171
+ e.disabled && "pointer-events-none opacity-50"
172
+ ),
173
+ children: [
174
+ /* @__PURE__ */ u("span", { className: "truncate", children: e.label }),
175
+ n && /* @__PURE__ */ u(Q, { className: "size-4 shrink-0", "aria-hidden": !0 })
176
+ ]
177
+ },
178
+ e.value
179
+ );
180
+ })
181
+ ]
182
+ }
183
+ ) }) });
184
+ return /* @__PURE__ */ k("div", { ref: z, className: "relative", children: [
185
+ /* @__PURE__ */ k(
72
186
  "button",
73
187
  {
74
- ref: S,
75
- id: A,
188
+ ref: _,
189
+ id: O,
76
190
  type: "button",
77
191
  role: "combobox",
78
192
  "aria-haspopup": "listbox",
79
- "aria-expanded": o,
80
- "aria-controls": u,
81
- "aria-invalid": E || void 0,
82
- disabled: w,
83
- onClick: () => o ? l(!1) : f(),
84
- onKeyDown: (e) => {
85
- switch (e.key) {
86
- case "ArrowDown":
87
- e.preventDefault(), o ? y(1) : f();
88
- break;
89
- case "ArrowUp":
90
- e.preventDefault(), o ? y(-1) : f();
91
- break;
92
- case "Enter":
93
- case " ":
94
- e.preventDefault(), o ? D(a) : f();
95
- break;
96
- case "Escape":
97
- o && (e.preventDefault(), l(!1));
98
- break;
99
- case "Tab":
100
- l(!1);
101
- break;
102
- }
103
- },
104
- className: d(T({ size: N }), R),
193
+ "aria-expanded": r,
194
+ "aria-controls": g,
195
+ "aria-invalid": B || void 0,
196
+ "aria-label": P,
197
+ "aria-describedby": T,
198
+ disabled: L,
199
+ onClick: () => r ? b(!1) : y(),
200
+ onKeyDown: U,
201
+ className: f(Z({ size: M }), H),
105
202
  children: [
106
- /* @__PURE__ */ i(
203
+ /* @__PURE__ */ u(
107
204
  "span",
108
205
  {
109
- className: d(
206
+ className: f(
110
207
  "truncate",
111
- !h && "text-muted-foreground"
208
+ d ? v.length === 0 && "text-muted-foreground" : !D && "text-muted-foreground"
112
209
  ),
113
- children: h ? h.label : I
210
+ children: d ? v.length === 0 ? R : v.length === 1 ? v[0].label : `${v.length} selected` : D ? D.label : R
114
211
  }
115
212
  ),
116
- /* @__PURE__ */ i(
117
- C,
213
+ /* @__PURE__ */ u(
214
+ V,
118
215
  {
119
- className: d(
120
- "size-4 text-muted-foreground transition-transform duration-(--duration-fast) ease-out motion-reduce:transition-none",
121
- o && "rotate-180"
216
+ className: f(
217
+ "size-4 text-muted-foreground transition-transform duration-150 ease-out motion-reduce:transition-none",
218
+ r && "rotate-180"
122
219
  ),
123
220
  "aria-hidden": !0
124
221
  }
@@ -126,59 +223,11 @@ const T = j(
126
223
  ]
127
224
  }
128
225
  ),
129
- /* @__PURE__ */ i(M, { reducedMotion: "user", children: /* @__PURE__ */ i(V, { children: o && /* @__PURE__ */ m(
130
- $.ul,
131
- {
132
- ref: k,
133
- id: u,
134
- role: "listbox",
135
- "aria-activedescendant": a >= 0 ? `${u}-opt-${a}` : void 0,
136
- variants: O,
137
- initial: "hidden",
138
- animate: "visible",
139
- exit: "hidden",
140
- style: {
141
- transformOrigin: v === "top" ? "bottom" : "top"
142
- },
143
- className: d(
144
- "absolute z-50 max-h-60 w-full overflow-auto p-1",
145
- "rounded-md border border-border bg-elevated shadow-elevation",
146
- v === "top" ? "bottom-full mb-1.5" : "top-full mt-1.5"
147
- ),
148
- children: [
149
- /* @__PURE__ */ i(P, { origin: v === "top" ? "bottom" : "top" }),
150
- r.map((e, t) => {
151
- const n = e.value === c, p = t === a;
152
- return /* @__PURE__ */ m(
153
- "li",
154
- {
155
- id: `${u}-opt-${t}`,
156
- role: "option",
157
- "aria-selected": n,
158
- "aria-disabled": e.disabled || void 0,
159
- onMouseEnter: () => !e.disabled && x(t),
160
- onClick: () => D(t),
161
- className: d(
162
- "flex cursor-pointer items-center justify-between gap-2",
163
- "rounded-sm px-2 py-1.5 text-xs text-foreground select-none",
164
- p && !e.disabled && "bg-muted",
165
- e.disabled && "pointer-events-none opacity-50"
166
- ),
167
- children: [
168
- /* @__PURE__ */ i("span", { className: "truncate", children: e.label }),
169
- n && /* @__PURE__ */ i(K, { className: "size-4 shrink-0", "aria-hidden": !0 })
170
- ]
171
- },
172
- e.value
173
- );
174
- })
175
- ]
176
- }
177
- ) }) })
226
+ p && typeof document < "u" ? q(j, document.body) : j
178
227
  ] });
179
228
  }
180
229
  );
181
- _.displayName = "Select";
230
+ ee.displayName = "Select";
182
231
  export {
183
- _ as Select
232
+ ee as Select
184
233
  };