@constructive-io/ui 0.13.0 → 0.14.1

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 (90) hide show
  1. package/dist/{ai-B7XNnqYL.js → ai-4JrVVL3q.js} +311 -213
  2. package/dist/ai-4JrVVL3q.js.map +1 -0
  3. package/dist/{ai-DJ-YPj8c.cjs → ai-B08ufcbD.cjs} +309 -211
  4. package/dist/ai-B08ufcbD.cjs.map +1 -0
  5. package/dist/components/ai/index.cjs +1 -1
  6. package/dist/components/ai/index.d.cts +1 -1
  7. package/dist/components/ai/index.d.ts +1 -1
  8. package/dist/components/ai/index.js +1 -1
  9. package/dist/components/autocomplete.cjs +1 -1
  10. package/dist/components/autocomplete.js +1 -1
  11. package/dist/components/button.cjs +3 -3
  12. package/dist/components/button.cjs.map +1 -1
  13. package/dist/components/button.d.cts +1 -1
  14. package/dist/components/button.d.ts +1 -1
  15. package/dist/components/button.js +3 -3
  16. package/dist/components/button.js.map +1 -1
  17. package/dist/components/collapsible.cjs +1 -1
  18. package/dist/components/collapsible.cjs.map +1 -1
  19. package/dist/components/collapsible.js +1 -1
  20. package/dist/components/collapsible.js.map +1 -1
  21. package/dist/components/combobox.cjs +1 -1
  22. package/dist/components/combobox.js +1 -1
  23. package/dist/components/command.cjs +8 -3
  24. package/dist/components/command.cjs.map +1 -1
  25. package/dist/components/command.d.cts +4 -1
  26. package/dist/components/command.d.ts +4 -1
  27. package/dist/components/command.js +8 -3
  28. package/dist/components/command.js.map +1 -1
  29. package/dist/components/dropdown-menu.cjs +2 -2
  30. package/dist/components/dropdown-menu.cjs.map +1 -1
  31. package/dist/components/dropdown-menu.js +2 -2
  32. package/dist/components/dropdown-menu.js.map +1 -1
  33. package/dist/components/input-otp.cjs +1 -1
  34. package/dist/components/input-otp.js +1 -1
  35. package/dist/components/item.d.cts +1 -1
  36. package/dist/components/item.d.ts +1 -1
  37. package/dist/components/multi-select.cjs +1 -1
  38. package/dist/components/multi-select.js +1 -1
  39. package/dist/components/popover.cjs +7 -0
  40. package/dist/components/popover.cjs.map +1 -1
  41. package/dist/components/popover.d.cts +7 -1
  42. package/dist/components/popover.d.ts +7 -1
  43. package/dist/components/popover.js +7 -1
  44. package/dist/components/popover.js.map +1 -1
  45. package/dist/components/select.cjs +1 -1
  46. package/dist/components/select.js +1 -1
  47. package/dist/components/tabs.cjs +5 -2
  48. package/dist/components/tabs.cjs.map +1 -1
  49. package/dist/components/tabs.js +5 -2
  50. package/dist/components/tabs.js.map +1 -1
  51. package/dist/components/toggle-group.cjs +1 -1
  52. package/dist/components/toggle-group.js +1 -1
  53. package/dist/components/workspace-kit/index.cjs +51 -21
  54. package/dist/components/workspace-kit/index.cjs.map +1 -1
  55. package/dist/components/workspace-kit/index.d.cts +18 -6
  56. package/dist/components/workspace-kit/index.d.ts +18 -6
  57. package/dist/components/workspace-kit/index.js +51 -21
  58. package/dist/components/workspace-kit/index.js.map +1 -1
  59. package/dist/{fluid-highlight-DxWeZ7iu.js → fluid-highlight-CNELHV8o.js} +26 -11
  60. package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
  61. package/dist/{fluid-highlight-AW-OITqJ.cjs → fluid-highlight-YWFRZXsw.cjs} +30 -9
  62. package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
  63. package/dist/{index-z3LqQ5L5.d.ts → index-Cluc_xc5.d.ts} +23 -14
  64. package/dist/{index-CiO-3M_X.d.cts → index-DXoG0ghv.d.cts} +23 -14
  65. package/dist/index.cjs +1 -1
  66. package/dist/index.d.cts +3 -3
  67. package/dist/index.d.ts +3 -3
  68. package/dist/index.js +1 -1
  69. package/dist/{theme-DTTTlylA.d.ts → theme-CKpIa4Fj.d.cts} +42 -26
  70. package/dist/{theme-DTTTlylA.d.cts → theme-CKpIa4Fj.d.ts} +42 -26
  71. package/dist/theme-dials-config.d.cts +1 -1
  72. package/dist/theme-dials-config.d.ts +1 -1
  73. package/dist/theme-presets.d.cts +1 -1
  74. package/dist/theme-presets.d.ts +1 -1
  75. package/dist/{theme-tuning-TJ76tnxZ.d.cts → theme-tuning-CTOHSrsh.d.cts} +2 -2
  76. package/dist/{theme-tuning-DjgDvV8V.d.ts → theme-tuning-DOko6Pmy.d.ts} +2 -2
  77. package/dist/theme-tuning.d.cts +1 -1
  78. package/dist/theme-tuning.d.ts +1 -1
  79. package/dist/theme.cjs +28 -22
  80. package/dist/theme.cjs.map +1 -1
  81. package/dist/theme.d.cts +1 -1
  82. package/dist/theme.d.ts +1 -1
  83. package/dist/theme.js +28 -22
  84. package/dist/theme.js.map +1 -1
  85. package/package.json +5 -2
  86. package/src/styles/globals.css +43 -25
  87. package/dist/ai-B7XNnqYL.js.map +0 -1
  88. package/dist/ai-DJ-YPj8c.cjs.map +0 -1
  89. package/dist/fluid-highlight-AW-OITqJ.cjs.map +0 -1
  90. package/dist/fluid-highlight-DxWeZ7iu.js.map +0 -1
@@ -6,8 +6,10 @@ const require_components_badge = require('./components/badge.cjs');
6
6
  const require_components_kbd = require('./components/kbd.cjs');
7
7
  const require_components_spinner = require('./components/spinner.cjs');
8
8
  const require_components_alert = require('./components/alert.cjs');
9
+ const require_fluid_highlight = require('./fluid-highlight-YWFRZXsw.cjs');
9
10
  const require_components_tooltip = require('./components/tooltip.cjs');
10
11
  const require_components_popover = require('./components/popover.cjs');
12
+ const require_compose_refs = require('./compose-refs-uPrvNoiU.cjs');
11
13
  const require_components_collapsible = require('./components/collapsible.cjs');
12
14
  const require_components_avatar = require('./components/avatar.cjs');
13
15
  const require_components_command = require('./components/command.cjs');
@@ -609,6 +611,7 @@ function MessageContent({ className, markdown = false, streaming = false, childr
609
611
  const contentClassName = require_utils.cn("min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]", typeof children === "string" && !markdown && "whitespace-pre-wrap", className);
610
612
  if (markdown && typeof children === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
611
613
  "data-slot": "message-content",
614
+ dir: "auto",
612
615
  streaming,
613
616
  className: contentClassName,
614
617
  ...props,
@@ -616,6 +619,7 @@ function MessageContent({ className, markdown = false, streaming = false, childr
616
619
  });
617
620
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
618
621
  "data-slot": "message-content",
622
+ dir: "auto",
619
623
  className: contentClassName,
620
624
  ...props,
621
625
  children
@@ -880,8 +884,9 @@ function useChatContainer() {
880
884
  * Scroll region for chat transcripts with stick-to-bottom tracking.
881
885
  * Pair with ScrollButton for jump-to-latest.
882
886
  */
883
- function ChatContainer({ className, children, bottomThreshold = 48, autoScroll = true, ...props }) {
887
+ function ChatContainer({ className, children, bottomThreshold = 48, autoScroll = true, ref, ...props }) {
884
888
  const scrollRef = react.useRef(null);
889
+ const mergedRef = require_compose_refs.useMergedRefs(scrollRef, ref);
885
890
  const [isAtBottom, setIsAtBottom] = react.useState(true);
886
891
  const isAtBottomRef = react.useRef(true);
887
892
  const scrollToBottom = react.useCallback((behavior = "smooth") => {
@@ -928,7 +933,7 @@ function ChatContainer({ className, children, bottomThreshold = 48, autoScroll =
928
933
  scrollToBottom
929
934
  },
930
935
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
931
- ref: scrollRef,
936
+ ref: mergedRef,
932
937
  "data-slot": "chat-container",
933
938
  "data-at-bottom": isAtBottom ? "true" : "false",
934
939
  className: require_utils.cn("relative min-h-0 flex-1 overflow-y-auto overscroll-contain", className),
@@ -961,7 +966,7 @@ function ScrollButton({ className, visible, label = "Scroll to latest", onClick,
961
966
  type,
962
967
  "aria-label": label,
963
968
  "data-slot": "scroll-button",
964
- className: require_utils.cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border bg-background/95 text-muted-foreground", "shadow-lg backdrop-blur-md", "dark:border-border dark:bg-card/90 dark:shadow-black/40", "outline-none transition-[transform,background-color,color,box-shadow,border-color] duration-(--duration-moderate) ease-out", "hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg", "focus-visible:ring-[3px] focus-visible:ring-ring/50", "motion-safe:active:scale-[0.96]", "animate-[fade-in_150ms_ease-out] motion-reduce:animate-none", className),
969
+ className: require_utils.cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border bg-background/95 text-muted-foreground", "shadow-lg backdrop-blur-md", "dark:border-border dark:bg-card/90 dark:shadow-black/40", "outline-none transition-[transform,box-shadow] duration-(--duration-moderate) ease-out", "hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg", "focus-visible:ring-[3px] focus-visible:ring-ring/50", "motion-safe:active:scale-[0.96]", "animate-[fade-in_150ms_ease-out] motion-reduce:animate-none", className),
965
970
  onClick: (event) => {
966
971
  scrollToBottom("smooth");
967
972
  onClick?.(event);
@@ -1053,7 +1058,7 @@ function Reasoning({ children, content, isStreaming = false, durationMs = null,
1053
1058
  className: require_utils.cn("w-full", className),
1054
1059
  "data-slot": "reasoning",
1055
1060
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
1056
- className: require_utils.cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "text-muted-foreground transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent hover:text-foreground", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"),
1061
+ className: require_utils.cn("group -mx-1.5 flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "text-muted-foreground transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent hover:text-foreground", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"),
1057
1062
  children: [
1058
1063
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Brain, { className: "size-3.5 shrink-0 opacity-80" }),
1059
1064
  isStreaming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextShimmer, {
@@ -1420,11 +1425,11 @@ function formatValue(value) {
1420
1425
  }
1421
1426
  function StatusIcon({ status }) {
1422
1427
  switch (status) {
1423
- case "pending": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "size-3.5 animate-spin text-info motion-reduce:animate-none" });
1424
- case "running": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Settings2, { className: "size-3.5 text-warning" });
1425
- case "success": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckCircle2, { className: "size-3.5 text-success" });
1426
- case "error": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleX, { className: "size-3.5 text-destructive" });
1427
- case "aborted": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Wrench, { className: "size-3.5 text-muted-foreground" });
1428
+ case "pending": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleDashed, { className: "size-3.5 shrink-0 text-muted-foreground" });
1429
+ case "running": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none" });
1430
+ case "success": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckCircle2, { className: "size-3.5 shrink-0 text-success" });
1431
+ case "error": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleX, { className: "size-3.5 shrink-0 text-destructive" });
1432
+ case "aborted": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Ban, { className: "size-3.5 shrink-0 text-muted-foreground" });
1428
1433
  }
1429
1434
  }
1430
1435
  function statusBadge(status) {
@@ -1471,6 +1476,8 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1471
1476
  children: name
1472
1477
  }),
1473
1478
  summary ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1479
+ dir: "auto",
1480
+ title: typeof summary === "string" ? summary : void 0,
1474
1481
  className: "min-w-0 truncate font-mono text-muted-foreground",
1475
1482
  children: summary
1476
1483
  }) : null
@@ -1488,6 +1495,8 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1488
1495
  children: name
1489
1496
  }),
1490
1497
  summary ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1498
+ dir: "auto",
1499
+ title: typeof summary === "string" ? summary : void 0,
1491
1500
  className: require_utils.cn("min-w-0 truncate rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.71875rem] text-muted-foreground"),
1492
1501
  children: summary
1493
1502
  }) : null,
@@ -1608,7 +1617,7 @@ function ToolGroup({ label, children, defaultOpen = true, className }) {
1608
1617
  className: require_utils.cn("-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.78125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
1609
1618
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
1610
1619
  "data-slot": "collapsible-icon",
1611
- className: "size-3"
1620
+ className: "size-3.5 shrink-0"
1612
1621
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1613
1622
  className: "tabular-nums",
1614
1623
  children: label
@@ -1629,7 +1638,7 @@ function ToolGroup({ label, children, defaultOpen = true, className }) {
1629
1638
  /**
1630
1639
  * Human-in-the-loop approval: simple confirm/skip or multi-question flow.
1631
1640
  */
1632
- function ApprovalCard({ title, description, questions, confirmLabel = "Confirm", skipLabel = "Skip", destructive = false, preview, onConfirm, onSkip, onDismiss, className, defaultSent = false }) {
1641
+ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm", skipLabel = "Skip", destructive = false, preview, eyebrow, onConfirm, onSkip, onDismiss, className, defaultSent = false }) {
1633
1642
  const multi = Boolean(questions?.length);
1634
1643
  const [qi, setQi] = react.useState(0);
1635
1644
  const [answers, setAnswers] = react.useState({});
@@ -1688,13 +1697,20 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1688
1697
  className: "flex items-start justify-between gap-2 px-3 pt-3",
1689
1698
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1690
1699
  className: "min-w-0 space-y-1",
1691
- children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1692
- className: "text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
1693
- children: title
1694
- }) : null, description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1695
- className: "text-xs text-pretty text-muted-foreground [overflow-wrap:anywhere]",
1696
- children: description
1697
- }) : null]
1700
+ children: [
1701
+ eyebrow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1702
+ className: "mb-1.5 flex min-h-4 items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0",
1703
+ children: eyebrow
1704
+ }) : null,
1705
+ title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1706
+ className: "text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
1707
+ children: title
1708
+ }) : null,
1709
+ description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1710
+ className: "text-xs text-pretty text-muted-foreground [overflow-wrap:anywhere]",
1711
+ children: description
1712
+ }) : null
1713
+ ]
1698
1714
  }), onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
1699
1715
  type: "button",
1700
1716
  variant: "ghost",
@@ -1709,10 +1725,10 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1709
1725
  children: preview
1710
1726
  }) : null,
1711
1727
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1712
- className: "flex flex-wrap items-center justify-end gap-1.5 px-3 py-2.5",
1728
+ className: "flex flex-wrap items-center justify-end gap-1.5 p-3",
1713
1729
  children: [onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
1714
1730
  type: "button",
1715
- variant: "ghost",
1731
+ variant: "secondary",
1716
1732
  size: "sm",
1717
1733
  wrap: true,
1718
1734
  onClick: onSkip,
@@ -1747,7 +1763,7 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1747
1763
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1748
1764
  className: "flex shrink-0 items-center gap-1",
1749
1765
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1750
- className: "flex items-center gap-0.5",
1766
+ className: require_utils.cn("flex items-center gap-0.5", progress.length < 2 && "hidden"),
1751
1767
  "aria-hidden": true,
1752
1768
  children: progress.map((on, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_utils.cn("h-1 rounded-full transition-[width,background-color] duration-(--duration-slow)", on ? "w-3 bg-primary" : "w-1.5 bg-border") }, i))
1753
1769
  }), onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
@@ -1768,9 +1784,9 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1768
1784
  type: "button",
1769
1785
  "aria-pressed": on,
1770
1786
  onClick: () => toggleOption(option.id),
1771
- className: require_utils.cn("-mx-1.5 flex min-h-10 items-start gap-2 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", on && "bg-accent"),
1787
+ className: require_utils.cn("-mx-1.5 flex min-h-10 gap-2 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", option.description ? "items-start" : "items-center", "transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", on && "bg-accent"),
1772
1788
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1773
- className: require_utils.cn("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
1789
+ className: require_utils.cn("flex size-4 shrink-0 items-center justify-center rounded-full border", option.description && "mt-0.5", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
1774
1790
  children: on ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
1775
1791
  className: "size-2.5",
1776
1792
  strokeWidth: 3
@@ -2158,9 +2174,9 @@ function InlineDiff({ source, className, maxLines = 40 }) {
2158
2174
  hidden > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2159
2175
  className: "border-t border-border px-2.5 py-1 text-[0.6875rem] text-muted-foreground",
2160
2176
  children: [
2161
- "+",
2162
2177
  hidden,
2163
- " more lines"
2178
+ " more ",
2179
+ hidden === 1 ? "line" : "lines"
2164
2180
  ]
2165
2181
  }) : null
2166
2182
  ]
@@ -2471,7 +2487,9 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
2471
2487
  className: "min-w-0 flex-1 truncate font-medium tabular-nums",
2472
2488
  children: `${total}/${total} done`
2473
2489
  }) : focusStep ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2474
- className: "min-w-0 flex-1 truncate font-medium",
2490
+ dir: "auto",
2491
+ title: focusStep.label,
2492
+ className: "min-w-0 flex-1 truncate font-medium [text-align:match-parent]",
2475
2493
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2476
2494
  className: "me-1.5 font-mono text-[0.75rem] font-normal tabular-nums text-muted-foreground/60",
2477
2495
  children: [
@@ -2502,9 +2520,13 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
2502
2520
  }
2503
2521
  function PlanRow({ step }) {
2504
2522
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2505
- className: "flex items-center gap-2 rounded-md px-1.5 py-1 text-[0.8125rem]",
2506
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepIcon, { status: step.status }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2507
- className: require_utils.cn("min-w-0 flex-1 truncate", step.status === "done" ? "text-muted-foreground line-through" : "text-foreground"),
2523
+ className: "flex items-start gap-2 rounded-md px-1.5 py-1 text-[0.8125rem]",
2524
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2525
+ className: "flex h-5 shrink-0 items-center",
2526
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepIcon, { status: step.status })
2527
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2528
+ dir: "auto",
2529
+ className: require_utils.cn("min-w-0 flex-1 leading-5 text-pretty [overflow-wrap:anywhere] [text-align:match-parent]", step.status === "done" ? "text-muted-foreground line-through" : "text-foreground"),
2508
2530
  children: step.label
2509
2531
  })]
2510
2532
  });
@@ -3127,21 +3149,23 @@ const iconEnterClass = "transition-[opacity,scale,filter] duration-300 ease-[cub
3127
3149
  const STATUS_LABEL = {
3128
3150
  pending: "Queued",
3129
3151
  running: "Running",
3130
- done: "Done"
3152
+ done: "Done",
3153
+ error: "Failed"
3131
3154
  };
3132
3155
  /** Delay between rows as a trace enters, so it reads top to bottom. */
3133
3156
  const ROW_STAGGER_MS = 80;
3134
3157
  /**
3135
- * Quiet tool-call trace: a heading row followed by one row per call, joined by
3136
- * short connectors. Each row morphs from spinner to check as the call settles.
3158
+ * Quiet tool-call trace: a heading row, then one row per call hung from a
3159
+ * single rail under the heading glyph. Each row morphs from spinner to check
3160
+ * as the call settles, or to an alert when it fails.
3137
3161
  */
3138
3162
  function ToolTrace({ title = "Read tools", icon, steps, className, ...props }) {
3139
3163
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ol", {
3140
3164
  "data-slot": "tool-trace",
3141
- className: require_utils.cn("flex flex-col gap-2", className),
3165
+ className: require_utils.cn("flex flex-col", className),
3142
3166
  ...props,
3143
3167
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3144
- className: "flex h-7 items-center gap-2",
3168
+ className: "mb-1 flex h-7 items-center gap-2",
3145
3169
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, { children: icon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.BookOpen, {}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3146
3170
  className: "text-[0.8125rem] text-foreground",
3147
3171
  children: title
@@ -3151,18 +3175,17 @@ function ToolTrace({ title = "Read tools", icon, steps, className, ...props }) {
3151
3175
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3152
3176
  "data-status": status,
3153
3177
  style: { animationDelay: `${(index + 1) * ROW_STAGGER_MS}ms` },
3154
- className: "relative flex h-7 animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] items-center gap-2 motion-reduce:animate-none",
3178
+ className: "ms-2 flex h-8 animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] items-center gap-2 border-s border-subtle-foreground/25 ps-3 motion-reduce:animate-none",
3155
3179
  children: [
3156
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3157
- "aria-hidden": "true",
3158
- className: "absolute -top-2 left-2 h-2 w-px -translate-x-1/2 bg-subtle-foreground/35"
3159
- }),
3160
3180
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3161
3181
  className: "grid size-4 shrink-0 place-items-center text-subtle-foreground",
3162
3182
  children: [status === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3163
3183
  "aria-hidden": "true",
3164
3184
  className: require_utils.cn("size-3", iconEnterClass),
3165
3185
  strokeWidth: 2
3186
+ }) : status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleAlert, {
3187
+ "aria-hidden": "true",
3188
+ className: require_utils.cn("size-3.5 text-destructive", iconEnterClass)
3166
3189
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_spinner.Spinner, {
3167
3190
  "aria-hidden": "true",
3168
3191
  role: void 0,
@@ -3178,7 +3201,7 @@ function ToolTrace({ title = "Read tools", icon, steps, className, ...props }) {
3178
3201
  children: step.icon
3179
3202
  }) : null,
3180
3203
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3181
- className: require_utils.cn("truncate text-[0.8125rem]", status === "running" ? "text-foreground" : "text-muted-foreground"),
3204
+ className: require_utils.cn("truncate text-[0.8125rem]", status === "running" || status === "error" ? "text-foreground" : "text-muted-foreground"),
3182
3205
  children: step.label
3183
3206
  })
3184
3207
  ]
@@ -3410,25 +3433,24 @@ function costTier(share, free) {
3410
3433
  return Math.min(COST_TIERS, Math.max(1, Math.ceil(share * COST_TIERS)));
3411
3434
  }
3412
3435
  /**
3413
- * Relative cost as a row of building blocks: one to four filled in the accent
3414
- * color, stepping up in height like a stack being built. Discrete tiers read
3415
- * faster than a continuous bar and keep the list calm while scanning.
3436
+ * Relative cost as a row of building blocks: one to four filled, stepping up in height like a stack being built.
3437
+ * Discrete tiers read faster than a continuous bar, and the muted fill keeps the list calm while scanning.
3416
3438
  */
3417
3439
  function CostBlocks({ tier }) {
3418
3440
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3419
3441
  role: "img",
3420
3442
  "aria-label": `Cost tier ${tier} of ${COST_TIERS}`,
3421
- className: "flex h-3 shrink-0 items-end gap-[3px]",
3443
+ className: "flex h-2.5 shrink-0 items-end gap-0.5",
3422
3444
  children: Array.from({ length: COST_TIERS }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3423
3445
  "aria-hidden": "true",
3424
- className: require_utils.cn("w-1.5 rounded-[1.5px]", index < tier ? "bg-primary" : "bg-[color-mix(in_oklab,currentColor_14%,transparent)]"),
3425
- style: { height: `${6 + index * 2}px` }
3446
+ className: require_utils.cn("w-[3px] rounded-[1px]", index < tier ? "bg-muted-foreground" : "bg-[color-mix(in_oklab,currentColor_14%,transparent)]"),
3447
+ style: { height: `${4 + index * 2}px` }
3426
3448
  }, index))
3427
3449
  });
3428
3450
  }
3429
3451
  function PriceText({ pricing }) {
3430
3452
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3431
- className: "text-xs text-muted-foreground tabular-nums",
3453
+ className: "text-[0.6875rem] text-muted-foreground tabular-nums",
3432
3454
  children: [
3433
3455
  formatPrice(pricing.input, pricing.currency),
3434
3456
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -3443,7 +3465,7 @@ function PriceText({ pricing }) {
3443
3465
  const MAX_ROW_TAGS = 2;
3444
3466
  function Tag({ tag }) {
3445
3467
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3446
- className: require_utils.cn("shrink-0 text-xs font-medium", tag === "deprecated" ? "text-muted-foreground line-through" : "text-link"),
3468
+ className: require_utils.cn("shrink-0 text-[0.6875rem] font-medium", tag === "new" ? "text-link" : tag === "deprecated" ? "text-subtle-foreground line-through" : "text-muted-foreground"),
3447
3469
  children: TAG_LABEL[tag]
3448
3470
  });
3449
3471
  }
@@ -3456,46 +3478,70 @@ function ModelGlyph({ model }) {
3456
3478
  })
3457
3479
  });
3458
3480
  }
3459
- /** A model's reasoning levels as a stacked menu: one row each, with its description and a check on the current one. */
3481
+ /**
3482
+ * A model's reasoning levels as compact radio rows. The description of the level under the pointer (or the chosen
3483
+ * one) shows once below them, in a slot sized to the longest so the card holds still while moving through them.
3484
+ */
3460
3485
  function LevelMenu({ model, levelId, onPick }) {
3461
- if (!model.levels?.length) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3462
- className: "px-2 py-1.5 text-xs text-muted-foreground",
3463
- children: "One mode, no reasoning levels"
3464
- });
3465
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3466
- role: "radiogroup",
3467
- "aria-label": `${model.name} reasoning level`,
3468
- className: "flex flex-col gap-px",
3469
- children: model.levels.map((level) => {
3470
- const checked = level.id === levelId;
3471
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3472
- type: "button",
3473
- role: "radio",
3474
- "aria-checked": checked,
3475
- onMouseDown: (event) => event.preventDefault(),
3476
- onClick: () => onPick(level.id),
3477
- className: require_utils.cn("flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-start outline-none pointer-coarse:min-h-11", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50", checked && "bg-overlay-hover"),
3478
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3479
- className: "flex min-w-0 flex-1 flex-col",
3486
+ const [peek, setPeek] = react.useState();
3487
+ const levels = model.levels ?? [];
3488
+ const shown = peek ?? levelId;
3489
+ const described = levels.some((level) => level.description);
3490
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
3491
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3492
+ className: "flex h-6 items-center justify-between gap-2 px-2 text-[0.6875rem] text-subtle-foreground",
3493
+ children: ["Reasoning", levels.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3494
+ "aria-hidden": "true",
3495
+ className: "hidden items-center gap-0.5 pointer-fine:flex",
3496
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, {
3497
+ className: "h-4 min-w-4 text-[0.625rem]",
3498
+ children: "←"
3499
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, {
3500
+ className: "h-4 min-w-4 text-[0.625rem]",
3501
+ children: "→"
3502
+ })]
3503
+ }) : null]
3504
+ }),
3505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3506
+ role: "radiogroup",
3507
+ "aria-label": `${model.name} reasoning level`,
3508
+ onPointerLeave: () => setPeek(void 0),
3509
+ className: "flex flex-col",
3510
+ children: levels.map((level) => {
3511
+ const checked = level.id === levelId;
3512
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3513
+ type: "button",
3514
+ role: "radio",
3515
+ "aria-checked": checked,
3516
+ onMouseDown: (event) => event.preventDefault(),
3517
+ onPointerEnter: () => setPeek(level.id),
3518
+ onFocus: () => setPeek(level.id),
3519
+ onBlur: () => setPeek(void 0),
3520
+ onClick: () => onPick(level.id),
3521
+ className: require_utils.cn("flex h-7 w-full cursor-pointer items-center gap-2 rounded-sm px-2 text-start text-[0.8125rem] outline-none pointer-coarse:h-11", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50", checked ? "font-medium text-foreground" : "text-foreground/80"),
3480
3522
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3481
- className: require_utils.cn("text-[0.8125rem]", checked ? "font-medium text-foreground" : "text-foreground/85"),
3523
+ className: "min-w-0 flex-1 truncate",
3482
3524
  children: level.label
3483
- }), level.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3484
- className: "text-xs text-muted-foreground",
3485
- children: level.description
3486
- }) : null]
3487
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3488
- "aria-hidden": "true",
3489
- className: require_utils.cn("size-3.5 shrink-0 text-foreground", checked ? "opacity-100" : "opacity-0")
3490
- })]
3491
- }, level.id);
3492
- })
3493
- });
3525
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3526
+ "aria-hidden": "true",
3527
+ className: require_utils.cn("size-3.5 shrink-0", checked ? "opacity-100" : "opacity-0")
3528
+ })]
3529
+ }, level.id);
3530
+ })
3531
+ }),
3532
+ described ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3533
+ className: "grid px-2 pt-1 pb-1.5 text-[0.6875rem] leading-4 text-pretty text-muted-foreground",
3534
+ children: levels.map((level) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3535
+ "aria-hidden": level.id !== shown,
3536
+ className: require_utils.cn("[grid-area:1/1]", level.id === shown ? "visible" : "invisible"),
3537
+ children: level.description
3538
+ }, level.id))
3539
+ }) : null
3540
+ ] });
3494
3541
  }
3495
3542
  /**
3496
- * The side card for the active model: what it is, its reasoning levels as a
3497
- * menu, and its prices. It opens beside the list like a submenu, so the list
3498
- * never changes size while moving through it.
3543
+ * The side card for the active model: what it is, its reasoning levels, and its prices. It opens beside the list like
3544
+ * a submenu, so the list never changes size while moving through it.
3499
3545
  */
3500
3546
  function ModelDetails({ model, levelId, onPickLevel }) {
3501
3547
  const level = levelOf(model, levelId);
@@ -3522,55 +3568,38 @@ function ModelDetails({ model, levelId, onPickLevel }) {
3522
3568
  ];
3523
3569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3524
3570
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3525
- className: "flex items-center gap-2 px-3 pt-3 pb-2",
3526
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3527
- className: "min-w-0",
3528
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3529
- title: model.name,
3530
- className: "truncate text-[0.8125rem] font-medium text-foreground",
3531
- children: model.name
3532
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3533
- title: model.description ?? model.provider,
3534
- className: "truncate text-xs text-muted-foreground",
3535
- children: model.description ?? model.provider
3536
- })]
3571
+ className: "px-2 pt-1.5 pb-2",
3572
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3573
+ dir: "auto",
3574
+ title: model.name,
3575
+ className: "truncate text-[0.8125rem] font-medium text-foreground",
3576
+ children: model.name
3577
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3578
+ className: "line-clamp-2 text-[0.6875rem] leading-4 text-pretty text-muted-foreground",
3579
+ children: model.description ?? model.provider
3537
3580
  })]
3538
3581
  }),
3582
+ model.levels?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LevelMenu, {
3583
+ model,
3584
+ levelId: level?.id,
3585
+ onPick: onPickLevel
3586
+ }) : null,
3539
3587
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3540
- className: "px-1 pb-1",
3541
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LevelMenu, {
3542
- model,
3543
- levelId: level?.id,
3544
- onPick: onPickLevel
3545
- })
3588
+ "aria-hidden": "true",
3589
+ className: "mx-2 h-px bg-border/70"
3546
3590
  }),
3547
3591
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
3548
- className: "grid grid-cols-2 gap-x-3 gap-y-2 border-t border-border px-3 py-2.5",
3592
+ className: "grid grid-cols-2 gap-x-3 gap-y-1.5 px-2 pt-2 pb-1.5",
3549
3593
  children: facts.map((fact) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3550
3594
  className: "min-w-0",
3551
3595
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
3552
- className: "truncate text-[0.6875rem] leading-4 text-muted-foreground",
3596
+ className: "truncate text-[0.6875rem] leading-4 text-subtle-foreground",
3553
3597
  children: fact.label
3554
3598
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
3555
3599
  className: "truncate text-xs leading-4 text-foreground tabular-nums",
3556
3600
  children: fact.value
3557
3601
  })]
3558
3602
  }, fact.label))
3559
- }),
3560
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3561
- className: "hidden h-8 items-center gap-1 border-t border-border px-3 text-[0.6875rem] text-muted-foreground pointer-fine:flex",
3562
- children: [
3563
- model.levels && model.levels.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3564
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "←" }),
3565
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "→" }),
3566
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3567
- className: "me-2",
3568
- children: "level"
3569
- })
3570
- ] }) : null,
3571
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "↵" }),
3572
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "choose" })
3573
- ]
3574
3603
  })
3575
3604
  ] });
3576
3605
  }
@@ -3582,6 +3611,8 @@ function inTriangle(point, a, b, c) {
3582
3611
  const d3 = side(point, c, a);
3583
3612
  return !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0));
3584
3613
  }
3614
+ /** One shared empty list, so leaving the section props out doesn't rebuild the sections on every render. */
3615
+ const NO_IDS = [];
3585
3616
  /** How long a row crossed on the way to the side card waits before taking it over. */
3586
3617
  const PANEL_INTENT_MS = 240;
3587
3618
  /**
@@ -3591,7 +3622,7 @@ const PANEL_INTENT_MS = 240;
3591
3622
  * with its reasoning levels.
3592
3623
  * Controlled: the host owns the selection and persists recents.
3593
3624
  */
3594
- function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds = [], recommendedIds = [], priceDisplay: priceDisplayProp = "meter", allowPriceToggle, disabled, align = "start", side = "top", triggerClassName, contentClassName, label = "Model" }) {
3625
+ function ModelSelector({ models, value, onValueChange, pinnedIds = NO_IDS, recentIds = NO_IDS, recommendedIds = NO_IDS, priceDisplay: priceDisplayProp = "meter", allowPriceToggle, disabled, align = "start", side = "top", triggerClassName, levelClassName, contentClassName, label = "Model" }) {
3595
3626
  const [open, setOpen] = react.useState(false);
3596
3627
  const [query, setQuery] = react.useState("");
3597
3628
  const [highlighted, setHighlighted] = react.useState("");
@@ -3603,7 +3634,10 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3603
3634
  top: 0,
3604
3635
  side: "right"
3605
3636
  });
3637
+ /** The list's height when filtering starts, held so a short result list doesn't move the search field. */
3638
+ const [listHeight, setListHeight] = react.useState();
3606
3639
  const contentRef = react.useRef(null);
3640
+ const listRef = react.useRef(null);
3607
3641
  const panelRef = react.useRef(null);
3608
3642
  const trail = react.useRef([]);
3609
3643
  const intentTimer = react.useRef(void 0);
@@ -3703,7 +3737,7 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3703
3737
  const box = content.getBoundingClientRect();
3704
3738
  const rows = Array.from(content.querySelectorAll("[data-model-value]"));
3705
3739
  const row = rows.find((element) => element.dataset.modelValue === active) ?? rows.find((element) => element.dataset.modelValue?.endsWith(`::${value.modelId}`));
3706
- const rowTop = row ? row.getBoundingClientRect().top - box.top - 4 : 0;
3740
+ const rowTop = row ? require_fluid_highlight.unscaledRect(row, content, box).top - 4 : 0;
3707
3741
  const top = Math.round(Math.min(Math.max(8 - box.top, rowTop), window.innerHeight - box.top - card.offsetHeight - 8));
3708
3742
  const side = box.right + card.offsetWidth + 8 > window.innerWidth ? "left" : "right";
3709
3743
  setPanel((current) => current.top === top && current.side === side ? current : {
@@ -3740,12 +3774,12 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3740
3774
  const trailing = (model, pricing) => {
3741
3775
  if (model.disabled && model.disabledReason) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3742
3776
  title: model.disabledReason,
3743
- className: "truncate text-xs text-muted-foreground",
3777
+ className: "truncate text-[0.6875rem] text-muted-foreground",
3744
3778
  children: model.disabledReason
3745
3779
  });
3746
3780
  if (priceDisplay === "none" || !pricing) return null;
3747
3781
  if (isFree(pricing)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3748
- className: "text-xs font-medium text-link",
3782
+ className: "text-[0.6875rem] font-medium text-muted-foreground",
3749
3783
  children: "Free"
3750
3784
  });
3751
3785
  if (priceDisplay === "price") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PriceText, { pricing });
@@ -3755,6 +3789,7 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3755
3789
  const level = levelOf(model, levelFor(model));
3756
3790
  const pricing = pricingOf(model, level);
3757
3791
  const tags = model.tags?.filter((tag) => !(tag === "free" && isFree(pricing) && priceDisplay !== "none"));
3792
+ const current = model.id === value.modelId;
3758
3793
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_command.CommandItem, {
3759
3794
  value: `${section}::${model.id}`,
3760
3795
  "data-model-value": `${section}::${model.id}`,
@@ -3766,37 +3801,38 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3766
3801
  ],
3767
3802
  disabled: model.disabled,
3768
3803
  onSelect: () => choose(model),
3769
- className: "h-9 gap-2 rounded-sm pointer-coarse:h-11",
3804
+ className: "h-7.5 gap-2 rounded-sm px-2 py-0 pointer-coarse:h-11",
3770
3805
  children: [
3771
3806
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model }),
3772
3807
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3773
3808
  className: "flex min-w-0 flex-1 items-baseline gap-1.5",
3774
3809
  children: [
3775
3810
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3811
+ dir: "auto",
3776
3812
  title: model.name,
3777
- className: "truncate text-foreground",
3813
+ className: "min-w-0 truncate text-[0.8125rem] font-medium text-foreground",
3778
3814
  children: model.name
3779
3815
  }),
3780
3816
  level ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3781
3817
  title: level.label,
3782
- className: "shrink truncate text-muted-foreground",
3818
+ className: "min-w-0 shrink-[8] truncate text-[0.6875rem] text-muted-foreground",
3783
3819
  children: level.label
3784
3820
  }) : null,
3785
3821
  tags?.slice(0, MAX_ROW_TAGS).map((tag) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, { tag }, tag)),
3786
3822
  tags && tags.length > MAX_ROW_TAGS ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3787
3823
  title: tags.slice(MAX_ROW_TAGS).map((tag) => TAG_LABEL[tag]).join(", "),
3788
- className: "shrink-0 text-xs text-muted-foreground tabular-nums",
3824
+ className: "shrink-0 text-[0.6875rem] text-muted-foreground tabular-nums",
3789
3825
  children: ["+", tags.length - MAX_ROW_TAGS]
3790
3826
  }) : null
3791
3827
  ]
3792
3828
  }),
3793
3829
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3794
- className: "flex min-w-14 shrink-0 justify-end text-muted-foreground",
3830
+ className: "flex min-w-10 shrink-0 justify-end text-muted-foreground",
3795
3831
  children: trailing(model, pricing)
3796
3832
  }),
3797
3833
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3798
3834
  "aria-hidden": "true",
3799
- className: require_utils.cn("size-3.5 shrink-0 text-foreground", model.id === value.modelId ? "opacity-100" : "opacity-0")
3835
+ className: require_utils.cn("size-3.5 shrink-0 text-foreground", current ? "opacity-100" : "opacity-0")
3800
3836
  })
3801
3837
  ]
3802
3838
  }, `${section}::${model.id}`);
@@ -3808,6 +3844,7 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3808
3844
  setOpen(next);
3809
3845
  if (next) {
3810
3846
  setQuery("");
3847
+ setListHeight(void 0);
3811
3848
  setPendingLevels({});
3812
3849
  const home = [...sections.browsing, ...sections.all].find((section) => section.items.some((model) => model.id === value.modelId));
3813
3850
  if (home) setHighlighted(`${home.id}::${value.modelId}`);
@@ -3817,28 +3854,29 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3817
3854
  "aria-label": selected ? `${label}: ${selected.name}${selectedLevel ? `, ${selectedLevel.label}` : ""}` : label,
3818
3855
  disabled,
3819
3856
  onClick: (event) => event.stopPropagation(),
3820
- className: require_utils.cn("flex h-8 max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[0.8125rem] text-foreground outline-none", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50 data-popup-open:bg-overlay-hover", "transition-transform duration-(--duration-fast) motion-safe:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-64", triggerClassName),
3857
+ className: require_utils.cn("relative flex h-7 max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-1.5 text-xs font-medium text-foreground/85 outline-none", "hover:bg-overlay-hover hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 data-popup-open:bg-overlay-hover data-popup-open:text-foreground", "before:absolute before:inset-x-0 before:-inset-y-1.5", "transition-transform duration-(--duration-fast) motion-safe:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-64", triggerClassName),
3821
3858
  children: [
3822
3859
  selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model: selected }) : null,
3823
3860
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3861
+ dir: "auto",
3824
3862
  title: selected?.name ?? "Choose a model",
3825
3863
  className: "truncate",
3826
3864
  children: selected?.name ?? "Choose a model"
3827
3865
  }),
3828
3866
  selectedLevel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3829
3867
  title: selectedLevel.label,
3830
- className: "truncate text-muted-foreground",
3868
+ className: require_utils.cn("truncate font-normal text-muted-foreground", levelClassName),
3831
3869
  children: selectedLevel.label
3832
3870
  }) : null,
3833
3871
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
3834
3872
  "aria-hidden": "true",
3835
- className: "size-3.5 shrink-0 text-muted-foreground"
3873
+ className: "size-3 shrink-0 text-muted-foreground"
3836
3874
  })
3837
3875
  ]
3838
3876
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_popover.PopoverContent, {
3839
3877
  side,
3840
3878
  align,
3841
- className: require_utils.cn("relative w-[min(22rem,calc(100vw-1.5rem))] p-0", contentClassName),
3879
+ className: require_utils.cn(require_components_popover.popoverSurfaceClass, "relative w-[min(17rem,calc(100vw-1.5rem))] p-0 max-sm:overflow-y-auto sm:overflow-visible", contentClassName),
3842
3880
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3843
3881
  ref: contentRef,
3844
3882
  onPointerMove: (event) => {
@@ -3854,28 +3892,35 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3854
3892
  loop: true,
3855
3893
  className: "rounded-[inherit]",
3856
3894
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3857
- className: "relative border-b border-border",
3895
+ className: "mx-1 flex items-center gap-1 border-b border-border/70 py-1 *:data-[slot=command-input-wrapper]:min-w-0 *:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:p-0",
3858
3896
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandInput, {
3859
3897
  value: query,
3860
- onValueChange: setQuery,
3898
+ onValueChange: (next) => {
3899
+ if (next && !query && listRef.current) setListHeight(listRef.current.offsetHeight);
3900
+ if (!next) setListHeight(void 0);
3901
+ setQuery(next);
3902
+ },
3861
3903
  placeholder: "Search models",
3862
- className: "pe-9"
3904
+ className: "gap-2 px-2 [&_input]:h-7 [&_input]:text-[0.8125rem] [&_svg]:size-3.5"
3863
3905
  }), canTogglePrice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3864
3906
  type: "button",
3865
3907
  "aria-label": "Show prices per million tokens",
3866
3908
  "aria-pressed": priceDisplay === "price",
3867
3909
  onClick: () => setPriceDisplay((current) => current === "price" ? "meter" : "price"),
3868
- className: require_utils.cn("absolute top-1/2 end-2.5 grid size-7 -translate-y-1/2 cursor-pointer place-items-center rounded-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", priceDisplay === "price" ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-overlay-hover hover:text-foreground"),
3910
+ className: require_utils.cn("grid size-6 shrink-0 cursor-pointer place-items-center rounded-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", priceDisplay === "price" ? "bg-overlay-hover text-foreground" : "text-muted-foreground hover:bg-overlay-hover hover:text-foreground"),
3869
3911
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleDollarSign, {
3870
3912
  "aria-hidden": "true",
3871
- className: "size-4"
3913
+ className: "size-3.5"
3872
3914
  })
3873
3915
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, { children: priceDisplay === "price" ? "Show relative cost" : "Show prices per 1M tokens" })] }) : null]
3874
3916
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_command.CommandList, {
3875
- className: "h-[min(20rem,50vh)] max-h-none p-1 not-empty:p-1",
3917
+ ref: listRef,
3918
+ density: "compact",
3919
+ style: listHeight ? { height: listHeight } : void 0,
3920
+ className: "max-h-[min(20rem,50vh)]",
3876
3921
  onScroll: placePanel,
3877
3922
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandEmpty, {
3878
- className: "py-6 text-center text-sm text-muted-foreground",
3923
+ className: "py-6 text-center text-[0.8125rem] text-muted-foreground",
3879
3924
  children: "No models matched"
3880
3925
  }), visible.map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandGroup, {
3881
3926
  heading: section.label,
@@ -3891,7 +3936,7 @@ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds
3891
3936
  if (active && active !== highlighted) setHighlighted(active);
3892
3937
  },
3893
3938
  style: panel.side === "below" ? void 0 : { top: panel.top },
3894
- className: require_utils.cn(panel.side === "below" ? "border-t border-border" : require_utils.cn("absolute w-64 rounded-lg border bg-popover text-popover-foreground shadow-lg", panel.side === "right" ? "left-full ml-1.5" : "right-full mr-1.5")),
3939
+ className: require_utils.cn("p-1", panel.side === "below" ? "mx-1 border-t border-border/70 px-0" : require_utils.cn(require_components_popover.popoverSurfaceClass, "absolute w-56", panel.side === "right" ? "left-full ml-1.5" : "right-full mr-1.5")),
3895
3940
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelDetails, {
3896
3941
  model: detailModel,
3897
3942
  levelId: levelFor(detailModel),
@@ -3976,41 +4021,44 @@ function PromptInputAttachments({ className, ...props }) {
3976
4021
 
3977
4022
  //#endregion
3978
4023
  //#region src/components/ai/ask-card.tsx
3979
- const KEYS = "ABCDEFGHIJ";
3980
- function QuestionHeading({ id, children }) {
4024
+ function QuestionHeading({ id, icon, children }) {
4025
+ const glyph = icon === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {}) : icon;
3981
4026
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3982
- className: "flex min-h-7 items-start gap-2 px-1 py-1",
3983
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {
4027
+ className: "flex items-start gap-2",
4028
+ children: [glyph ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3984
4029
  "aria-hidden": "true",
3985
- className: "mt-0.5 size-4 shrink-0 text-muted-foreground"
3986
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4030
+ className: "flex h-5 shrink-0 items-center text-muted-foreground [&_svg]:size-4",
4031
+ children: glyph
4032
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3987
4033
  id,
3988
- className: "min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]",
4034
+ className: "min-w-0 text-pretty text-sm font-medium text-foreground [overflow-wrap:anywhere]",
3989
4035
  children
3990
4036
  })]
3991
4037
  });
3992
4038
  }
3993
- function KeyBadge({ children, active }) {
4039
+ /** Radio dot: a ring at rest, a filled disc with a pip once chosen. */
4040
+ function RadioMark({ checked }) {
3994
4041
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3995
4042
  "aria-hidden": "true",
3996
- className: require_utils.cn("grid size-5 shrink-0 place-items-center rounded-[5px] border text-[0.6875rem] font-medium tabular-nums", active ? "border-primary bg-primary text-primary-foreground" : "border-border bg-muted text-muted-foreground"),
3997
- children
4043
+ className: require_utils.cn("mt-0.5 grid size-4 shrink-0 place-items-center rounded-full border", checked ? "border-primary bg-primary" : "border-subtle-foreground/50"),
4044
+ children: checked ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_utils.cn("size-1.5 rounded-full bg-primary-foreground", iconEnterClass) }) : null
3998
4045
  });
3999
4046
  }
4000
- function AskQuestionField({ question, choice, onChoose, otherLabel, disabled }) {
4047
+ function AskQuestionField({ question, choice, onChoose, otherLabel, icon, disabled }) {
4001
4048
  const headingId = react.useId();
4002
4049
  const otherValue = choice && "other" in choice ? choice.other : "";
4003
- const rowClass = "flex min-h-9 w-full items-center gap-2.5 rounded-sm border px-2 py-1.5 text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50";
4050
+ const rowClass = "-mx-1.5 flex min-h-8 items-start gap-2.5 rounded-md px-1.5 py-1.5 text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50";
4004
4051
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4005
- className: "flex flex-col gap-1.5",
4052
+ className: "flex flex-col gap-2",
4006
4053
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionHeading, {
4007
4054
  id: headingId,
4055
+ icon,
4008
4056
  children: question.question
4009
4057
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4010
4058
  role: "radiogroup",
4011
4059
  "aria-labelledby": headingId,
4012
- className: "flex flex-col gap-1.5",
4013
- children: [question.options.map((option, index) => {
4060
+ className: "flex flex-col gap-0.5",
4061
+ children: [question.options.map((option) => {
4014
4062
  const checked = Boolean(choice && "option" in choice && choice.option === option.id);
4015
4063
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4016
4064
  type: "button",
@@ -4018,21 +4066,15 @@ function AskQuestionField({ question, choice, onChoose, otherLabel, disabled })
4018
4066
  "aria-checked": checked,
4019
4067
  disabled,
4020
4068
  onClick: () => onChoose({ option: option.id }),
4021
- className: require_utils.cn(rowClass, "cursor-pointer disabled:cursor-not-allowed disabled:opacity-64", checked ? "border-primary/40 bg-primary/6 text-foreground" : "border-border bg-card text-foreground hover:bg-overlay-hover"),
4022
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KeyBadge, {
4023
- active: checked,
4024
- children: KEYS[index]
4025
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4069
+ className: require_utils.cn(rowClass, "cursor-pointer hover:bg-overlay-hover disabled:cursor-not-allowed disabled:opacity-64", checked ? "bg-overlay-hover text-foreground" : "text-muted-foreground hover:text-foreground"),
4070
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioMark, { checked }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4026
4071
  className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
4027
4072
  children: option.label
4028
4073
  })]
4029
4074
  }, option.id);
4030
4075
  }), question.allowOther !== false ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4031
- className: require_utils.cn(rowClass, "cursor-text focus-within:ring-[3px] focus-within:ring-ring/50", otherValue ? "border-primary/40 bg-primary/6" : "border-border bg-card"),
4032
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KeyBadge, {
4033
- active: Boolean(otherValue),
4034
- children: KEYS[question.options.length]
4035
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4076
+ className: require_utils.cn(rowClass, "cursor-text focus-within:bg-overlay-hover", otherValue && "bg-overlay-hover"),
4077
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioMark, { checked: Boolean(otherValue) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4036
4078
  type: "text",
4037
4079
  value: otherValue,
4038
4080
  disabled,
@@ -4059,16 +4101,22 @@ function AnswerChip({ children, muted }) {
4059
4101
  });
4060
4102
  }
4061
4103
  /**
4062
- * Inline clarifying questions from an agent. Each question offers lettered
4063
- * options plus a free-text row; the card settles into a one-line summary per
4064
- * question once answered or skipped.
4104
+ * Inline clarifying questions from an agent, one at a time. Each question
4105
+ * offers its options as radio rows plus a free-text row; Continue moves to the
4106
+ * next question and submits after the last. The card settles into a one-line
4107
+ * summary per question once answered or skipped.
4065
4108
  */
4066
- function AskCard({ questions, answer, onSubmit, onSkip, continueLabel = "Continue", skipLabel = "Skip", otherLabel = "Something else", disabled, className, ...props }) {
4109
+ function AskCard({ questions, answer, onSubmit, onSkip, continueLabel = "Continue", skipLabel = "Skip", otherLabel = "Something else", eyebrow, icon, disabled, className, ...props }) {
4067
4110
  const [choices, setChoices] = react.useState({});
4068
- const complete = questions.every((question) => {
4069
- const choice = choices[question.id];
4070
- return choice && ("option" in choice || choice.other.trim().length > 0);
4071
- });
4111
+ const [page, setPage] = react.useState(0);
4112
+ const answered = (question) => {
4113
+ const choice = question ? choices[question.id] : void 0;
4114
+ return Boolean(choice && ("option" in choice || choice.other.trim().length > 0));
4115
+ };
4116
+ const complete = questions.every(answered);
4117
+ const current = questions[Math.min(page, questions.length - 1)];
4118
+ const last = page >= questions.length - 1;
4119
+ const paged = questions.length > 1;
4072
4120
  if (answer) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4073
4121
  "data-slot": "ask-card",
4074
4122
  "data-state": "answered",
@@ -4078,55 +4126,105 @@ function AskCard({ questions, answer, onSubmit, onSkip, continueLabel = "Continu
4078
4126
  const choice = "choices" in answer ? answer.choices[question.id] : void 0;
4079
4127
  const label = choice ? "option" in choice ? question.options.find((option) => option.id === choice.option)?.label : `“${choice.other}”` : void 0;
4080
4128
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4081
- className: "flex flex-wrap items-center gap-x-2 gap-y-1",
4082
- children: [
4083
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {
4084
- "aria-hidden": "true",
4085
- className: "size-4 shrink-0 text-muted-foreground"
4086
- }),
4087
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4129
+ className: "flex items-start gap-2",
4130
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {
4131
+ "aria-hidden": "true",
4132
+ className: "mt-0.5 size-4 shrink-0 text-muted-foreground"
4133
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4134
+ className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",
4135
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4088
4136
  className: "min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]",
4089
4137
  children: question.question
4090
- }),
4091
- label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, { children: label }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, {
4138
+ }), label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, { children: label }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, {
4092
4139
  muted: true,
4093
4140
  children: "Skipped"
4094
- })
4095
- ]
4141
+ })]
4142
+ })]
4096
4143
  }, question.id);
4097
4144
  })
4098
4145
  });
4099
4146
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4100
4147
  "data-slot": "ask-card",
4101
4148
  "data-state": "open",
4102
- className: require_utils.cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-3 rounded-xl bg-card p-2 shadow-card motion-reduce:animate-none", className),
4149
+ className: require_utils.cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-3 rounded-xl bg-card p-3 shadow-card motion-reduce:animate-none", className),
4103
4150
  ...props,
4104
- children: [questions.map((question) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AskQuestionField, {
4105
- question,
4106
- choice: choices[question.id],
4107
- disabled,
4108
- otherLabel,
4109
- onChoose: (choice) => setChoices((current) => {
4110
- const next = { ...current };
4111
- if (choice) next[question.id] = choice;
4112
- else delete next[question.id];
4113
- return next;
4151
+ children: [
4152
+ eyebrow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4153
+ className: "-mb-1 flex min-h-4 items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0",
4154
+ children: eyebrow
4155
+ }) : null,
4156
+ current ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4157
+ className: "animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] motion-reduce:animate-none",
4158
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AskQuestionField, {
4159
+ question: current,
4160
+ choice: choices[current.id],
4161
+ disabled,
4162
+ otherLabel,
4163
+ icon,
4164
+ onChoose: (choice) => setChoices((value) => {
4165
+ const next = { ...value };
4166
+ if (choice) next[current.id] = choice;
4167
+ else delete next[current.id];
4168
+ return next;
4169
+ })
4170
+ })
4171
+ }, current.id) : null,
4172
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4173
+ className: "flex flex-wrap items-center gap-2",
4174
+ children: [paged ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4175
+ className: "-ms-1 flex items-center text-xs text-muted-foreground tabular-nums",
4176
+ children: [
4177
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4178
+ size: "icon-xs",
4179
+ variant: "ghost",
4180
+ "aria-label": "Previous question",
4181
+ disabled: page === 0,
4182
+ onClick: () => setPage(page - 1),
4183
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronUp, { "aria-hidden": "true" })
4184
+ }),
4185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4186
+ "aria-hidden": "true",
4187
+ children: [
4188
+ page + 1,
4189
+ "/",
4190
+ questions.length
4191
+ ]
4192
+ }),
4193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4194
+ className: "sr-only",
4195
+ children: [
4196
+ "Question ",
4197
+ page + 1,
4198
+ " of ",
4199
+ questions.length
4200
+ ]
4201
+ }),
4202
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4203
+ size: "icon-xs",
4204
+ variant: "ghost",
4205
+ "aria-label": "Next question",
4206
+ disabled: last || !answered(current),
4207
+ onClick: () => setPage(page + 1),
4208
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { "aria-hidden": "true" })
4209
+ })
4210
+ ]
4211
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4212
+ className: "ms-auto flex flex-wrap items-center gap-1.5",
4213
+ children: [onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4214
+ size: "sm",
4215
+ variant: "secondary",
4216
+ disabled,
4217
+ onClick: onSkip,
4218
+ children: skipLabel
4219
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4220
+ size: "sm",
4221
+ disabled: disabled || (last ? !complete : !answered(current)),
4222
+ onClick: () => last ? onSubmit?.(choices) : setPage(page + 1),
4223
+ children: continueLabel
4224
+ })]
4225
+ })]
4114
4226
  })
4115
- }, question.id)), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4116
- className: "flex flex-wrap items-center gap-2",
4117
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4118
- size: "xs",
4119
- disabled: disabled || !complete,
4120
- onClick: () => onSubmit?.(choices),
4121
- children: continueLabel
4122
- }), onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4123
- size: "xs",
4124
- variant: "outline",
4125
- disabled,
4126
- onClick: onSkip,
4127
- children: skipLabel
4128
- }) : null]
4129
- })]
4227
+ ]
4130
4228
  });
4131
4229
  }
4132
4230
 
@@ -4721,4 +4819,4 @@ Object.defineProperty(exports, 'useThrottledText', {
4721
4819
  return useThrottledText;
4722
4820
  }
4723
4821
  });
4724
- //# sourceMappingURL=ai-DJ-YPj8c.cjs.map
4822
+ //# sourceMappingURL=ai-B08ufcbD.cjs.map