@tulipfarm/sprout 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/README.md +45 -40
  2. package/dist/components/accordion.d.ts +2 -2
  3. package/dist/components/accordion.js +9 -9
  4. package/dist/components/agent-fanout.d.ts +2 -2
  5. package/dist/components/agent-fanout.js +65 -87
  6. package/dist/components/alert-dialog.d.ts +6 -6
  7. package/dist/components/alert-dialog.js +20 -20
  8. package/dist/components/alert.d.ts +6 -6
  9. package/dist/components/alert.js +13 -13
  10. package/dist/components/aspect-ratio.d.ts +2 -2
  11. package/dist/components/aspect-ratio.js +2 -2
  12. package/dist/components/attachment.d.ts +17 -17
  13. package/dist/components/attachment.js +82 -115
  14. package/dist/components/avatar.d.ts +10 -10
  15. package/dist/components/avatar.js +14 -14
  16. package/dist/components/badge.d.ts +4 -4
  17. package/dist/components/badge.js +18 -18
  18. package/dist/components/board.d.ts +107 -0
  19. package/dist/components/board.js +640 -0
  20. package/dist/components/brand-icon.d.ts +6 -6
  21. package/dist/components/brand-icon.js +55 -63
  22. package/dist/components/breadcrumb.d.ts +11 -11
  23. package/dist/components/breadcrumb.js +16 -18
  24. package/dist/components/button-group.d.ts +6 -6
  25. package/dist/components/button-group.js +14 -14
  26. package/dist/components/button.d.ts +11 -11
  27. package/dist/components/button.js +46 -56
  28. package/dist/components/calendar.d.ts +5 -5
  29. package/dist/components/calendar.js +44 -53
  30. package/dist/components/canvas.d.ts +4 -4
  31. package/dist/components/canvas.js +39 -46
  32. package/dist/components/card.d.ts +6 -6
  33. package/dist/components/card.js +17 -17
  34. package/dist/components/carousel.d.ts +7 -7
  35. package/dist/components/carousel.js +57 -75
  36. package/dist/components/chart.d.ts +5 -112
  37. package/dist/components/chart.js +5 -172
  38. package/dist/components/chat-confirmation.d.ts +13 -11
  39. package/dist/components/chat-confirmation.js +32 -38
  40. package/dist/components/chat-input.d.ts +4 -4
  41. package/dist/components/chat-input.js +74 -81
  42. package/dist/components/chat-plan.d.ts +2 -2
  43. package/dist/components/chat-plan.js +15 -20
  44. package/dist/components/chat-sources.d.ts +8 -8
  45. package/dist/components/chat-sources.js +18 -27
  46. package/dist/components/checkbox.d.ts +1 -1
  47. package/dist/components/checkbox.js +9 -9
  48. package/dist/components/choice-list.d.ts +2 -2
  49. package/dist/components/choice-list.js +16 -18
  50. package/dist/components/code-block.d.ts +5 -5
  51. package/dist/components/code-block.js +26 -26
  52. package/dist/components/collapsible.d.ts +1 -1
  53. package/dist/components/collapsible.js +7 -11
  54. package/dist/components/combobox.d.ts +3 -3
  55. package/dist/components/combobox.js +24 -24
  56. package/dist/components/command.d.ts +13 -13
  57. package/dist/components/command.js +61 -73
  58. package/dist/components/context-menu.d.ts +5 -5
  59. package/dist/components/context-menu.js +22 -22
  60. package/dist/components/dialog.d.ts +6 -6
  61. package/dist/components/dialog.js +23 -28
  62. package/dist/components/direction.d.ts +1 -1
  63. package/dist/components/direction.js +1 -1
  64. package/dist/components/dropdown-menu.d.ts +5 -5
  65. package/dist/components/dropdown-menu.js +20 -20
  66. package/dist/components/field.d.ts +11 -11
  67. package/dist/components/field.js +41 -61
  68. package/dist/components/file-explorer.d.ts +2 -2
  69. package/dist/components/file-explorer.js +89 -105
  70. package/dist/components/file-viewer.d.ts +10 -10
  71. package/dist/components/file-viewer.js +112 -140
  72. package/dist/components/form.d.ts +7 -7
  73. package/dist/components/form.js +24 -28
  74. package/dist/components/glass-banner.d.ts +3 -3
  75. package/dist/components/glass-banner.js +21 -24
  76. package/dist/components/gradient-banner.d.ts +5 -5
  77. package/dist/components/gradient-banner.js +13 -22
  78. package/dist/components/hover-card.d.ts +4 -4
  79. package/dist/components/hover-card.js +6 -6
  80. package/dist/components/input-group.d.ts +11 -11
  81. package/dist/components/input-group.js +22 -36
  82. package/dist/components/input-otp.d.ts +10 -10
  83. package/dist/components/input-otp.js +13 -15
  84. package/dist/components/input.d.ts +1 -1
  85. package/dist/components/input.js +7 -7
  86. package/dist/components/kbd.d.ts +3 -3
  87. package/dist/components/kbd.js +5 -5
  88. package/dist/components/label.d.ts +2 -2
  89. package/dist/components/label.js +2 -2
  90. package/dist/components/mention-list.d.ts +3 -3
  91. package/dist/components/mention-list.js +10 -10
  92. package/dist/components/menubar.d.ts +6 -6
  93. package/dist/components/menubar.js +22 -22
  94. package/dist/components/message-actions.d.ts +2 -2
  95. package/dist/components/message-actions.js +29 -31
  96. package/dist/components/message-response.d.ts +3 -3
  97. package/dist/components/message-response.js +18 -18
  98. package/dist/components/message-scroller.d.ts +12 -12
  99. package/dist/components/message-scroller.js +44 -56
  100. package/dist/components/message.d.ts +11 -11
  101. package/dist/components/message.js +25 -25
  102. package/dist/components/navigation-menu.d.ts +2 -2
  103. package/dist/components/navigation-menu.js +15 -15
  104. package/dist/components/notice-banner.d.ts +2 -2
  105. package/dist/components/notice-banner.js +2 -2
  106. package/dist/components/page-content.d.ts +2 -2
  107. package/dist/components/page-content.js +2 -2
  108. package/dist/components/page-header.d.ts +1 -1
  109. package/dist/components/page-header.js +16 -16
  110. package/dist/components/pagination.d.ts +9 -9
  111. package/dist/components/pagination.js +17 -17
  112. package/dist/components/plan-outline.d.ts +2 -2
  113. package/dist/components/plan-outline.js +43 -60
  114. package/dist/components/popover.d.ts +6 -6
  115. package/dist/components/popover.js +15 -15
  116. package/dist/components/presence-cursor.d.ts +2 -2
  117. package/dist/components/presence-cursor.js +3 -3
  118. package/dist/components/progress.d.ts +1 -1
  119. package/dist/components/progress.js +8 -8
  120. package/dist/components/prompt-list.d.ts +3 -3
  121. package/dist/components/prompt-list.js +6 -6
  122. package/dist/components/questionnaire.d.ts +19 -19
  123. package/dist/components/questionnaire.js +183 -242
  124. package/dist/components/radio-group.d.ts +2 -2
  125. package/dist/components/radio-group.js +6 -6
  126. package/dist/components/reasoning-effort.d.ts +3 -3
  127. package/dist/components/reasoning-effort.js +9 -12
  128. package/dist/components/record-list.d.ts +66 -0
  129. package/dist/components/record-list.js +151 -0
  130. package/dist/components/resizable.d.ts +5 -5
  131. package/dist/components/resizable.js +76 -102
  132. package/dist/components/result-card.d.ts +10 -5
  133. package/dist/components/result-card.js +42 -53
  134. package/dist/components/result-notice.d.ts +18 -0
  135. package/dist/components/result-notice.js +29 -0
  136. package/dist/components/review-card.d.ts +6 -6
  137. package/dist/components/review-card.js +18 -18
  138. package/dist/components/rich-text-editor.d.ts +2 -2
  139. package/dist/components/rich-text-editor.js +56 -72
  140. package/dist/components/schema-diagram.d.ts +3 -3
  141. package/dist/components/schema-diagram.js +39 -53
  142. package/dist/components/scroll-area.d.ts +1 -1
  143. package/dist/components/scroll-area.js +10 -14
  144. package/dist/components/search-dialog.d.ts +6 -6
  145. package/dist/components/search-dialog.js +16 -16
  146. package/dist/components/search-field.d.ts +1 -1
  147. package/dist/components/search-field.js +11 -11
  148. package/dist/components/select.d.ts +3 -3
  149. package/dist/components/select.js +20 -20
  150. package/dist/components/selection-slot.d.ts +2 -2
  151. package/dist/components/selection-slot.js +6 -9
  152. package/dist/components/separator.d.ts +15 -15
  153. package/dist/components/separator.js +22 -27
  154. package/dist/components/settings-list.d.ts +3 -3
  155. package/dist/components/settings-list.js +5 -5
  156. package/dist/components/sheet.d.ts +6 -6
  157. package/dist/components/sheet.js +27 -27
  158. package/dist/components/sidebar.d.ts +22 -22
  159. package/dist/components/sidebar.js +57 -58
  160. package/dist/components/skeleton.d.ts +5 -5
  161. package/dist/components/skeleton.js +14 -21
  162. package/dist/components/slider.d.ts +2 -2
  163. package/dist/components/slider.js +6 -6
  164. package/dist/components/spinner.d.ts +5 -5
  165. package/dist/components/spinner.js +22 -26
  166. package/dist/components/sql-viewer.d.ts +14 -14
  167. package/dist/components/sql-viewer.js +99 -128
  168. package/dist/components/state-panel-samples.d.ts +2 -2
  169. package/dist/components/state-panel-samples.js +209 -245
  170. package/dist/components/state-panel.d.ts +2 -35
  171. package/dist/components/state-panel.js +2 -29
  172. package/dist/components/state-sample.d.ts +7 -7
  173. package/dist/components/state-sample.js +18 -31
  174. package/dist/components/switch.d.ts +1 -1
  175. package/dist/components/switch.js +7 -7
  176. package/dist/components/table-nuqs.d.ts +2 -2
  177. package/dist/components/table-nuqs.js +11 -12
  178. package/dist/components/table.d.ts +4 -4
  179. package/dist/components/table.js +166 -235
  180. package/dist/components/tabs.d.ts +2 -2
  181. package/dist/components/tabs.js +12 -12
  182. package/dist/components/textarea.d.ts +2 -2
  183. package/dist/components/textarea.js +6 -8
  184. package/dist/components/timeline.d.ts +3 -0
  185. package/dist/components/timeline.js +3 -0
  186. package/dist/components/toast.d.ts +2 -2
  187. package/dist/components/toast.js +19 -25
  188. package/dist/components/toggle-group.d.ts +2 -2
  189. package/dist/components/toggle-group.js +18 -20
  190. package/dist/components/toggle.d.ts +2 -2
  191. package/dist/components/toggle.js +8 -8
  192. package/dist/components/tool-activity.d.ts +1 -1
  193. package/dist/components/tool-activity.js +83 -110
  194. package/dist/components/toolbar-status.d.ts +2 -2
  195. package/dist/components/toolbar-status.js +7 -7
  196. package/dist/components/tooltip.d.ts +5 -5
  197. package/dist/components/tooltip.js +12 -11
  198. package/dist/components/typed-text.d.ts +2 -2
  199. package/dist/components/typed-text.js +10 -12
  200. package/dist/components/view-switcher.d.ts +51 -0
  201. package/dist/components/view-switcher.js +114 -0
  202. package/dist/index.d.ts +98 -93
  203. package/dist/index.js +98 -93
  204. package/dist/internal/chart-kit.d.ts +142 -0
  205. package/dist/internal/chart-kit.js +200 -0
  206. package/dist/internal/charts/bars.d.ts +61 -0
  207. package/dist/internal/charts/bars.js +86 -0
  208. package/dist/internal/charts/lines.d.ts +67 -0
  209. package/dist/internal/charts/lines.js +70 -0
  210. package/dist/internal/charts/more.d.ts +77 -0
  211. package/dist/internal/charts/more.js +68 -0
  212. package/dist/internal/charts/parts.d.ts +54 -0
  213. package/dist/internal/charts/parts.js +82 -0
  214. package/dist/internal/charts/timeline-dates.d.ts +38 -0
  215. package/dist/internal/charts/timeline-dates.js +113 -0
  216. package/dist/internal/charts/timeline-window.d.ts +31 -0
  217. package/dist/internal/charts/timeline-window.js +26 -0
  218. package/dist/internal/charts/timeline.d.ts +72 -0
  219. package/dist/internal/charts/timeline.js +287 -0
  220. package/dist/internal/classes.d.ts +1 -1
  221. package/dist/internal/classes.js +7 -9
  222. package/dist/internal/code-tokens.d.ts +2 -2
  223. package/dist/internal/code-tokens.js +12 -12
  224. package/dist/internal/fieldset.d.ts +1 -1
  225. package/dist/internal/fieldset.js +6 -6
  226. package/dist/internal/file-kind.d.ts +1 -1
  227. package/dist/internal/file-kind.js +43 -51
  228. package/dist/internal/flow.d.ts +4 -4
  229. package/dist/internal/flow.js +20 -23
  230. package/dist/internal/languages.js +999 -999
  231. package/dist/internal/message-scroller.d.ts +3 -3
  232. package/dist/internal/message-scroller.js +64 -112
  233. package/dist/internal/pressable.d.ts +1 -1
  234. package/dist/internal/pressable.js +7 -7
  235. package/dist/internal/state-panel.d.ts +35 -0
  236. package/dist/internal/state-panel.js +22 -0
  237. package/dist/internal/syntax.d.ts +2 -2
  238. package/dist/internal/syntax.js +36 -47
  239. package/dist/styles/accordion.css +3 -5
  240. package/dist/styles/agent-fanout.css +64 -60
  241. package/dist/styles/alert-dialog.css +12 -26
  242. package/dist/styles/alert.css +10 -15
  243. package/dist/styles/attachment.css +51 -93
  244. package/dist/styles/avatar.css +17 -24
  245. package/dist/styles/badge.css +11 -36
  246. package/dist/styles/board.css +571 -0
  247. package/dist/styles/brand-icon.css +7 -8
  248. package/dist/styles/breadcrumb.css +4 -7
  249. package/dist/styles/button-group.css +8 -14
  250. package/dist/styles/button.css +22 -27
  251. package/dist/styles/calendar.css +24 -36
  252. package/dist/styles/canvas.css +2 -3
  253. package/dist/styles/card.css +7 -23
  254. package/dist/styles/carousel.css +11 -12
  255. package/dist/styles/chart.css +215 -31
  256. package/dist/styles/chat-input.css +15 -39
  257. package/dist/styles/chat-plan.css +3 -4
  258. package/dist/styles/chat-sources.css +3 -6
  259. package/dist/styles/checkbox.css +11 -25
  260. package/dist/styles/choice-list.css +17 -31
  261. package/dist/styles/code-block.css +11 -25
  262. package/dist/styles/collapsible.css +10 -15
  263. package/dist/styles/combobox.css +11 -15
  264. package/dist/styles/command.css +5 -8
  265. package/dist/styles/context-menu.css +2 -2
  266. package/dist/styles/dialog.css +5 -16
  267. package/dist/styles/dropdown-menu.css +2 -2
  268. package/dist/styles/field.css +15 -21
  269. package/dist/styles/file-explorer.css +19 -33
  270. package/dist/styles/file-viewer.css +13 -17
  271. package/dist/styles/form.css +3 -3
  272. package/dist/styles/glass-banner.css +12 -47
  273. package/dist/styles/gradient-banner.css +17 -35
  274. package/dist/styles/hover-card.css +9 -15
  275. package/dist/styles/index.css +116 -108
  276. package/dist/styles/input-group.css +25 -41
  277. package/dist/styles/input-otp.css +5 -6
  278. package/dist/styles/input.css +5 -5
  279. package/dist/styles/kbd.css +1 -1
  280. package/dist/styles/label.css +9 -30
  281. package/dist/styles/mention-list.css +6 -8
  282. package/dist/styles/menubar.css +5 -6
  283. package/dist/styles/message-actions.css +1 -1
  284. package/dist/styles/message-response.css +3 -5
  285. package/dist/styles/message-scroller.css +14 -21
  286. package/dist/styles/message.css +23 -60
  287. package/dist/styles/navigation-menu.css +14 -29
  288. package/dist/styles/notice-banner.css +1 -2
  289. package/dist/styles/page-header.css +7 -10
  290. package/dist/styles/pagination.css +1 -4
  291. package/dist/styles/plan-outline.css +20 -37
  292. package/dist/styles/popover.css +10 -19
  293. package/dist/styles/presence-cursor.css +1 -2
  294. package/dist/styles/progress.css +2 -4
  295. package/dist/styles/prompt-list.css +6 -17
  296. package/dist/styles/questionnaire.css +16 -40
  297. package/dist/styles/radio-group.css +12 -23
  298. package/dist/styles/reasoning-effort.css +8 -15
  299. package/dist/styles/record-list.css +243 -0
  300. package/dist/styles/resizable.css +10 -11
  301. package/dist/styles/result-card.css +17 -3
  302. package/dist/styles/result-notice.css +80 -0
  303. package/dist/styles/review-card.css +2 -3
  304. package/dist/styles/rich-text-editor.css +1 -2
  305. package/dist/styles/schema-diagram.css +12 -17
  306. package/dist/styles/scroll-area.css +8 -10
  307. package/dist/styles/search-dialog.css +1 -5
  308. package/dist/styles/search-field.css +1 -2
  309. package/dist/styles/select.css +7 -7
  310. package/dist/styles/selection-slot.css +1 -2
  311. package/dist/styles/separator.css +7 -8
  312. package/dist/styles/settings-list.css +1 -2
  313. package/dist/styles/sheet.css +40 -73
  314. package/dist/styles/sidebar.css +17 -21
  315. package/dist/styles/skeleton.css +9 -11
  316. package/dist/styles/slider.css +11 -21
  317. package/dist/styles/spinner.css +2 -2
  318. package/dist/styles/sql-viewer.css +29 -29
  319. package/dist/styles/state-panel.css +8 -9
  320. package/dist/styles/state-sample.css +20 -33
  321. package/dist/styles/switch.css +11 -18
  322. package/dist/styles/table.css +51 -77
  323. package/dist/styles/tabs.css +12 -16
  324. package/dist/styles/textarea.css +3 -3
  325. package/dist/styles/themes/chatgpt.css +11 -23
  326. package/dist/styles/themes/claude.css +12 -24
  327. package/dist/styles/themes/cloudflare.css +11 -23
  328. package/dist/styles/themes/discord.css +11 -23
  329. package/dist/styles/themes/github.css +11 -23
  330. package/dist/styles/themes/grok.css +11 -23
  331. package/dist/styles/themes/linear.css +12 -25
  332. package/dist/styles/themes/neutral.css +11 -23
  333. package/dist/styles/themes/notion.css +11 -23
  334. package/dist/styles/themes/perplexity.css +11 -23
  335. package/dist/styles/themes/raycast.css +11 -23
  336. package/dist/styles/themes/spotify.css +11 -23
  337. package/dist/styles/themes/stripe.css +11 -23
  338. package/dist/styles/themes/supabase.css +11 -23
  339. package/dist/styles/themes/tulipfarm.css +9 -10
  340. package/dist/styles/themes/vercel.css +12 -25
  341. package/dist/styles/timeline.css +276 -0
  342. package/dist/styles/toast.css +13 -20
  343. package/dist/styles/toggle-group.css +17 -23
  344. package/dist/styles/toggle.css +8 -8
  345. package/dist/styles/tool-activity.css +7 -13
  346. package/dist/styles/toolbar-status.css +2 -7
  347. package/dist/styles/tooltip.css +15 -21
  348. package/dist/styles/view-switcher.css +279 -0
  349. package/package.json +21 -1
@@ -1,25 +1,25 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef } from "react";
4
- import { ArrowUpRight } from "reicon-react/icons/ArrowUpRight";
5
- import { ChevronDown } from "reicon-react/icons/ChevronDown";
6
- import { FileText } from "reicon-react/icons/FileText";
7
- import { cn } from "../internal/classes.js";
8
- import { Button } from "./button.js";
9
- import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "./collapsible.js";
10
- import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
11
- import { Spinner } from "./spinner.js";
3
+ import { useRef } from 'react';
4
+ import { ArrowUpRight } from 'reicon-react/icons/ArrowUpRight';
5
+ import { ChevronDown } from 'reicon-react/icons/ChevronDown';
6
+ import { FileText } from 'reicon-react/icons/FileText';
7
+ import { cn } from '../internal/classes.js';
8
+ import { Button } from './button.js';
9
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible.js';
10
+ import { Popover, PopoverContent, PopoverTrigger } from './popover.js';
11
+ import { Spinner } from './spinner.js';
12
12
  const hoverDelay = 300;
13
13
  const hoverCloseDelay = 150;
14
14
  function hostOf(href) {
15
15
  try {
16
- return new URL(href).hostname.replace(/^www\./, "");
16
+ return new URL(href).hostname.replace(/^www\./, '');
17
17
  }
18
18
  catch {
19
19
  return null;
20
20
  }
21
21
  }
22
- function SourceContent({ source, number, }) {
22
+ function SourceContent({ source, number }) {
23
23
  const host = number === undefined ? null : hostOf(source.href);
24
24
  return (_jsxs("div", { "data-slot": "chat-source", className: "sprout-chat-sources-source", children: [number !== undefined && (_jsxs("p", { className: "sprout-chat-sources-preview-head", children: [_jsx("span", { className: "sprout-chat-sources-badge", "aria-hidden": "true", children: number }), _jsx("span", { children: host ?? `Source ${number}` })] })), _jsx("p", { className: "sprout-chat-sources-title", children: source.title }), _jsx("p", { className: "sprout-chat-sources-location", children: source.location }), _jsx("p", { className: "sprout-chat-sources-excerpt", children: source.excerpt }), _jsxs("a", { href: source.href, target: "_blank", rel: "noopener noreferrer", className: "sprout-chat-sources-link", children: ["Open source", _jsx(ArrowUpRight, { size: 14, "aria-hidden": "true" }), _jsx("span", { className: "sprout-chat-sources-sr-only", children: " in a new tab" })] })] }));
25
25
  }
@@ -36,22 +36,16 @@ export function InlineCitation({ source, number }) {
36
36
  */
37
37
  export function ChatSources({ sources, defaultOpen, className, ...props }) {
38
38
  if (sources.length === 0)
39
- return (_jsx("div", { "data-slot": "chat-sources", "data-empty": "", ...props, className: cn("sprout-chat-sources", className), children: _jsx("p", { className: "sprout-chat-sources-empty", children: "No sources were used for this response." }) }));
40
- return (_jsxs(Collapsible, { "data-slot": "chat-sources", defaultOpen: defaultOpen, ...props, className: cn("sprout-chat-sources", className), children: [_jsxs(CollapsibleTrigger, { className: "sprout-chat-sources-trigger", children: [_jsx(FileText, { size: 16, "aria-hidden": "true" }), _jsxs("span", { children: [sources.length, " ", sources.length === 1 ? "source" : "sources"] }), _jsx(ChevronDown, { size: 14, "aria-hidden": "true", "data-slot": "collapsible-indicator" })] }), _jsx(CollapsibleContent, { variant: "sidebar", children: _jsx("ol", { className: "sprout-chat-sources-list", children: sources.map((source, index) => (_jsxs("li", { className: "sprout-chat-sources-item", children: [_jsx("span", { className: "sprout-chat-sources-number", children: index + 1 }), _jsx(SourceContent, { source: source })] }, source.id))) }) })] }));
39
+ return (_jsx("div", { "data-slot": "chat-sources", "data-empty": "", ...props, className: cn('sprout-chat-sources', className), children: _jsx("p", { className: "sprout-chat-sources-empty", children: "No sources were used for this response." }) }));
40
+ return (_jsxs(Collapsible, { "data-slot": "chat-sources", defaultOpen: defaultOpen, ...props, className: cn('sprout-chat-sources', className), children: [_jsxs(CollapsibleTrigger, { className: "sprout-chat-sources-trigger", children: [_jsx(FileText, { size: 16, "aria-hidden": "true" }), _jsxs("span", { children: [sources.length, " ", sources.length === 1 ? 'source' : 'sources'] }), _jsx(ChevronDown, { size: 14, "aria-hidden": "true", "data-slot": "collapsible-indicator" })] }), _jsx(CollapsibleContent, { variant: "sidebar", children: _jsx("ol", { className: "sprout-chat-sources-list", children: sources.map((source, index) => (_jsxs("li", { className: "sprout-chat-sources-item", children: [_jsx("span", { className: "sprout-chat-sources-number", children: index + 1 }), _jsx(SourceContent, { source: source })] }, source.id))) }) })] }));
41
41
  }
42
- export const citationStateKindNames = [
43
- "idle",
44
- "loading",
45
- "ready",
46
- "unavailable",
47
- "error",
48
- ];
42
+ export const citationStateKindNames = ['idle', 'loading', 'ready', 'unavailable', 'error'];
49
43
  /**
50
44
  * A citation link whose passage is checked each time it opens, on hover or
51
45
  * click. While checking it shows a spinner; an unavailable source never shows
52
46
  * an old passage.
53
47
  */
54
- export function CheckedCitation({ label, state, onOpen, onRetry, }) {
48
+ export function CheckedCitation({ label, state, onOpen, onRetry }) {
55
49
  const popup = useRef(null);
56
50
  const openReason = useRef(undefined);
57
51
  return (_jsxs(Popover, { onOpenChange: (open, details) => {
@@ -62,12 +56,9 @@ export function CheckedCitation({ label, state, onOpen, onRetry, }) {
62
56
  }
63
57
  // Base UI keeps a hover-close timer from before a reopen; a passage
64
58
  // opened by click or keyboard closes only by click, Escape, or outside press.
65
- if (details.reason === "trigger-hover" &&
66
- openReason.current === "trigger-press")
59
+ if (details.reason === 'trigger-hover' && openReason.current === 'trigger-press')
67
60
  details.cancel();
68
- }, children: [_jsx(PopoverTrigger, { openOnHover: true, delay: hoverDelay, closeDelay: hoverCloseDelay, "data-slot": "checked-citation", className: "sprout-chat-sources-checked", render: _jsx(Button, { variant: "link", size: "task-link", "aria-label": `Source: ${label}` }), children: label }), _jsx(PopoverContent, { ref: popup, "data-citation-state": state.kind, className: "sprout-chat-sources-preview", children: state.kind === "idle" || state.kind === "loading" ? (_jsxs("p", { role: "status", className: "sprout-chat-sources-checking", children: [_jsx(Spinner, { "aria-hidden": "true" }), "Checking access to this source\u2026"] })) : state.kind === "ready" ? (_jsxs("div", { "data-slot": "chat-source", className: "sprout-chat-sources-source", children: [_jsx("p", { className: "sprout-chat-sources-title", children: state.title }), _jsx("p", { className: "sprout-chat-sources-location", children: state.location }), _jsx("p", { className: "sprout-chat-sources-excerpt", "data-preserve-lines": "", children: state.excerpt })] })) : (_jsxs("div", { className: "sprout-chat-sources-source", children: [_jsx("p", { className: "sprout-chat-sources-title", children: state.kind === "unavailable"
69
- ? "Source unavailable"
70
- : "Couldn’t load this source" }), _jsx("p", { role: "alert", className: "sprout-chat-sources-excerpt", children: state.message }), state.kind === "error" && (_jsx(Button, { variant: "outline", size: "sm", className: "sprout-chat-sources-retry", onClick: () => {
61
+ }, children: [_jsx(PopoverTrigger, { openOnHover: true, delay: hoverDelay, closeDelay: hoverCloseDelay, "data-slot": "checked-citation", className: "sprout-chat-sources-checked", render: _jsx(Button, { variant: "link", size: "task-link", "aria-label": `Source: ${label}` }), children: label }), _jsx(PopoverContent, { ref: popup, "data-citation-state": state.kind, className: "sprout-chat-sources-preview", children: state.kind === 'idle' || state.kind === 'loading' ? (_jsxs("p", { role: "status", className: "sprout-chat-sources-checking", children: [_jsx(Spinner, { "aria-hidden": "true" }), "Checking access to this source\u2026"] })) : state.kind === 'ready' ? (_jsxs("div", { "data-slot": "chat-source", className: "sprout-chat-sources-source", children: [_jsx("p", { className: "sprout-chat-sources-title", children: state.title }), _jsx("p", { className: "sprout-chat-sources-location", children: state.location }), _jsx("p", { className: "sprout-chat-sources-excerpt", "data-preserve-lines": "", children: state.excerpt })] })) : (_jsxs("div", { className: "sprout-chat-sources-source", children: [_jsx("p", { className: "sprout-chat-sources-title", children: state.kind === 'unavailable' ? 'Source unavailable' : 'Couldn’t load this source' }), _jsx("p", { role: "alert", className: "sprout-chat-sources-excerpt", children: state.message }), state.kind === 'error' && (_jsx(Button, { variant: "outline", size: "sm", className: "sprout-chat-sources-retry", onClick: () => {
71
62
  // The button leaves as loading starts; keep focus in the passage.
72
63
  popup.current?.focus();
73
64
  onRetry();
@@ -1,4 +1,4 @@
1
- import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
1
+ import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
2
2
  export declare const checkboxVariantNames: readonly ["default", "neutral"];
3
3
  export type CheckboxVariant = (typeof checkboxVariantNames)[number];
4
4
  export interface CheckboxProps extends BaseCheckbox.Root.Props {
@@ -1,17 +1,17 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
4
- import { Check } from "reicon-react/icons/Check";
5
- import { Minus } from "reicon-react/icons/Minus";
6
- import { cn, stateClassName } from "../internal/classes.js";
7
- import { useFieldsetDisabled } from "../internal/fieldset.js";
8
- export const checkboxVariantNames = ["default", "neutral"];
3
+ import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
4
+ import { Check } from 'reicon-react/icons/Check';
5
+ import { Minus } from 'reicon-react/icons/Minus';
6
+ import { cn, stateClassName } from '../internal/classes.js';
7
+ import { useFieldsetDisabled } from '../internal/fieldset.js';
8
+ export const checkboxVariantNames = ['default', 'neutral'];
9
9
  /**
10
10
  * A 16px checkbox with a larger hit area. Name it with a wrapping `Label`,
11
11
  * a `Label htmlFor` pointing at its `id`, or `aria-label`. Pass
12
12
  * `indeterminate` to show a mixed state, such as a "select all" box.
13
13
  */
14
- export function Checkbox({ variant = "default", indeterminate = false, className, disabled, ref, ...props }) {
14
+ export function Checkbox({ variant = 'default', indeterminate = false, className, disabled, ref, ...props }) {
15
15
  const [fieldsetDisabled, fieldsetRef] = useFieldsetDisabled(ref);
16
- return (_jsx(BaseCheckbox.Root, { "data-slot": "checkbox", "data-variant": variant, indeterminate: indeterminate, ...props, ref: fieldsetRef, disabled: disabled || fieldsetDisabled, className: stateClassName(cn("sprout-checkbox", `sprout-checkbox-variant-${variant}`), className), children: _jsx(BaseCheckbox.Indicator, { "data-slot": "checkbox-indicator", className: "sprout-checkbox-indicator", children: indeterminate ? (_jsx(Minus, { "aria-hidden": "true" })) : (_jsx(Check, { "aria-hidden": "true" })) }) }));
16
+ return (_jsx(BaseCheckbox.Root, { "data-slot": "checkbox", "data-variant": variant, indeterminate: indeterminate, ...props, ref: fieldsetRef, disabled: disabled || fieldsetDisabled, className: stateClassName(cn('sprout-checkbox', `sprout-checkbox-variant-${variant}`), className), children: _jsx(BaseCheckbox.Indicator, { "data-slot": "checkbox-indicator", className: "sprout-checkbox-indicator", children: indeterminate ? _jsx(Minus, { "aria-hidden": "true" }) : _jsx(Check, { "aria-hidden": "true" }) }) }));
17
17
  }
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from "react";
1
+ import { type ReactNode } from 'react';
2
2
  export declare const choiceListLayoutNames: readonly ["stacked", "compact"];
3
3
  export type ChoiceListLayout = (typeof choiceListLayoutNames)[number];
4
4
  export interface ChoiceListOption {
@@ -50,4 +50,4 @@ export interface ChoiceSummaryProps {
50
50
  children?: ReactNode;
51
51
  }
52
52
  /** One line that shows a question and its recorded answer. */
53
- export declare function ChoiceSummary({ prompt, answer, className, children, }: ChoiceSummaryProps): import("react").JSX.Element;
53
+ export declare function ChoiceSummary({ prompt, answer, className, children }: ChoiceSummaryProps): import("react").JSX.Element;
@@ -1,36 +1,34 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useId } from "react";
4
- import { Check } from "reicon-react/icons/Check";
5
- import { HelpCircle } from "reicon-react/icons/HelpCircle";
6
- import { cn } from "../internal/classes.js";
7
- import { Badge } from "./badge.js";
8
- export const choiceListLayoutNames = ["stacked", "compact"];
3
+ import { useId } from 'react';
4
+ import { Check } from 'reicon-react/icons/Check';
5
+ import { HelpCircle } from 'reicon-react/icons/HelpCircle';
6
+ import { cn } from '../internal/classes.js';
7
+ import { Badge } from './badge.js';
8
+ export const choiceListLayoutNames = ['stacked', 'compact'];
9
9
  const recommendedSuffix = /\s*\(recommended\)\s*$/i;
10
10
  /**
11
11
  * A fieldset of radio or checkbox rows for answering a question, with an
12
12
  * optional typed answer. Value is always an array of option ids.
13
13
  */
14
- export function ChoiceList({ legend, options, value, onChange, multiple = false, disabled = false, error, layout = "stacked", textOption, className, }) {
14
+ export function ChoiceList({ legend, options, value, onChange, multiple = false, disabled = false, error, layout = 'stacked', textOption, className, }) {
15
15
  const name = useId();
16
- const compact = layout === "compact";
16
+ const compact = layout === 'compact';
17
17
  const errorId = `${name}-choices-error`;
18
18
  const textId = `${name}-text`;
19
19
  const textErrorId = `${name}-text-error`;
20
- return (_jsxs("fieldset", { "data-slot": "choice-list", "data-layout": layout, "data-multiple": multiple || undefined, disabled: disabled, className: cn("sprout-choice-list", className), children: [_jsx("legend", { className: compact && !multiple
21
- ? "sprout-choice-list-sr-only"
22
- : "sprout-choice-list-legend", children: legend }), _jsx("div", { "data-slot": "choice-list-options", className: "sprout-choice-list-options", children: options.map((option, index) => {
20
+ return (_jsxs("fieldset", { "data-slot": "choice-list", "data-layout": layout, "data-multiple": multiple || undefined, disabled: disabled, className: cn('sprout-choice-list', className), children: [_jsx("legend", { className: compact && !multiple ? 'sprout-choice-list-sr-only' : 'sprout-choice-list-legend', children: legend }), _jsx("div", { "data-slot": "choice-list-options", className: "sprout-choice-list-options", children: options.map((option, index) => {
23
21
  const checked = value.includes(option.id);
24
22
  const recommended = option.recommended === true || recommendedSuffix.test(option.label);
25
- const label = option.label.replace(recommendedSuffix, "");
26
- return (_jsxs("label", { "data-slot": "choice-list-option", "data-checked": checked || undefined, "data-disabled": disabled || undefined, "data-recommended": recommended || undefined, className: "sprout-choice-list-option", children: [_jsx("input", { type: multiple ? "checkbox" : "radio", name: name, value: option.id, checked: checked, "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : undefined, onChange: (event) => onChange(multiple
23
+ const label = option.label.replace(recommendedSuffix, '');
24
+ return (_jsxs("label", { "data-slot": "choice-list-option", "data-checked": checked || undefined, "data-disabled": disabled || undefined, "data-recommended": recommended || undefined, className: "sprout-choice-list-option", children: [_jsx("input", { type: multiple ? 'checkbox' : 'radio', name: name, value: option.id, checked: checked, "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : undefined, onChange: event => onChange(multiple
27
25
  ? event.target.checked
28
26
  ? [...value, option.id]
29
- : value.filter((id) => id !== option.id)
27
+ : value.filter(id => id !== option.id)
30
28
  : [option.id]), className: "sprout-choice-list-input" }), _jsx("span", { "aria-hidden": "true", className: "sprout-choice-list-mark", children: checked ? _jsx(Check, {}) : compact ? index + 1 : null }), _jsxs("span", { className: "sprout-choice-list-label", children: [label, recommended && (_jsx(Badge, { variant: "info", className: "sprout-choice-list-badge", children: "Recommended" }))] })] }, option.id));
31
- }) }), error && (_jsx("p", { id: errorId, className: "sprout-choice-list-error", children: error })), textOption && (!compact || textOption.active) && (_jsxs("div", { id: textOption.id ?? `${name}-custom`, "data-slot": "choice-list-text", "data-checked": textOption.active || undefined, "data-invalid": textOption.error ? true : undefined, className: "sprout-choice-list-text", children: [_jsx("span", { "aria-hidden": "true", className: "sprout-choice-list-mark", children: textOption.active && _jsx(Check, {}) }), _jsxs("div", { className: "sprout-choice-list-text-body", children: [_jsx("label", { htmlFor: textId, className: "sprout-choice-list-text-label", children: textOption.label ?? "Your answer" }), _jsx("textarea", { id: textId, autoFocus: compact, rows: 1, value: textOption.value, disabled: disabled, placeholder: textOption.placeholder ?? "Type a different answer…", "aria-describedby": textOption.error ? textErrorId : undefined, "aria-invalid": textOption.error ? true : undefined, onFocus: textOption.onFocus, onChange: (event) => textOption.onChange(event.target.value), className: "sprout-choice-list-textarea" }), textOption.error && (_jsx("p", { id: textErrorId, role: "alert", className: "sprout-choice-list-error", children: textOption.error }))] })] }))] }));
29
+ }) }), error && (_jsx("p", { id: errorId, className: "sprout-choice-list-error", children: error })), textOption && (!compact || textOption.active) && (_jsxs("div", { id: textOption.id ?? `${name}-custom`, "data-slot": "choice-list-text", "data-checked": textOption.active || undefined, "data-invalid": textOption.error ? true : undefined, className: "sprout-choice-list-text", children: [_jsx("span", { "aria-hidden": "true", className: "sprout-choice-list-mark", children: textOption.active && _jsx(Check, {}) }), _jsxs("div", { className: "sprout-choice-list-text-body", children: [_jsx("label", { htmlFor: textId, className: "sprout-choice-list-text-label", children: textOption.label ?? 'Your answer' }), _jsx("textarea", { id: textId, autoFocus: compact, rows: 1, value: textOption.value, disabled: disabled, placeholder: textOption.placeholder ?? 'Type a different answer…', "aria-describedby": textOption.error ? textErrorId : undefined, "aria-invalid": textOption.error ? true : undefined, onFocus: textOption.onFocus, onChange: event => textOption.onChange(event.target.value), className: "sprout-choice-list-textarea" }), textOption.error && (_jsx("p", { id: textErrorId, role: "alert", className: "sprout-choice-list-error", children: textOption.error }))] })] }))] }));
32
30
  }
33
31
  /** One line that shows a question and its recorded answer. */
34
- export function ChoiceSummary({ prompt, answer, className, children, }) {
35
- return (_jsxs("div", { "data-slot": "choice-summary", className: cn("sprout-choice-summary", className), children: [_jsx(HelpCircle, { "aria-hidden": "true", className: "sprout-choice-summary-icon" }), _jsx("span", { className: "sprout-choice-summary-prompt", children: prompt }), answer && (_jsxs("span", { className: "sprout-choice-summary-answer", children: [_jsx(Check, { "aria-hidden": "true", className: "sprout-choice-summary-check" }), _jsx("span", { className: "sprout-choice-summary-answer-text", children: answer })] })), children] }));
32
+ export function ChoiceSummary({ prompt, answer, className, children }) {
33
+ return (_jsxs("div", { "data-slot": "choice-summary", className: cn('sprout-choice-summary', className), children: [_jsx(HelpCircle, { "aria-hidden": "true", className: "sprout-choice-summary-icon" }), _jsx("span", { className: "sprout-choice-summary-prompt", children: prompt }), answer && (_jsxs("span", { className: "sprout-choice-summary-answer", children: [_jsx(Check, { "aria-hidden": "true", className: "sprout-choice-summary-check" }), _jsx("span", { className: "sprout-choice-summary-answer-text", children: answer })] })), children] }));
36
34
  }
@@ -1,14 +1,14 @@
1
- import { type HTMLAttributes } from "react";
2
- import { type CodeLanguage } from "../internal/languages.js";
3
- import { languageForFilename } from "../internal/syntax.js";
1
+ import { type HTMLAttributes } from 'react';
2
+ import { type CodeLanguage } from '../internal/languages.js';
3
+ import { languageForFilename } from '../internal/syntax.js';
4
4
  export type { CodeLanguage };
5
5
  export { languageForFilename };
6
6
  export declare const codeBlockVariantNames: readonly ["inline", "file", "preview"];
7
7
  export type CodeBlockVariant = (typeof codeBlockVariantNames)[number];
8
8
  /** Every language that gets syntax colors. Aliases and file extensions such as `ts`, `py`, and `yml` work too. */
9
9
  export declare const codeBlockLanguages: readonly ["abap", "actionscript-3", "ada", "ahk", "ahk2", "angular-html", "angular-ts", "apache", "apex", "apl", "applescript", "ara", "asciidoc", "asm", "astro", "awk", "ballerina", "bat", "beancount", "berry", "bibtex", "bicep", "bird2", "blade", "bsl", "c", "c3", "cadence", "cairo", "chapel", "clarity", "clojure", "cmake", "cobol", "codeowners", "codeql", "coffee", "common-lisp", "coq", "cpp", "crystal", "csharp", "css", "csv", "cue", "cypher", "d", "dart", "dax", "desktop", "diff", "docker", "dotenv", "dream-maker", "edge", "elixir", "elm", "emacs-lisp", "erb", "erlang", "fennel", "fish", "fluent", "fortran-fixed-form", "fortran-free-form", "fsharp", "gdresource", "gdscript", "gdshader", "genie", "gherkin", "git-commit", "git-rebase", "gleam", "glimmer-js", "glimmer-ts", "glsl", "gn", "gnuplot", "go", "graphql", "groovy", "hack", "haml", "handlebars", "haskell", "haxe", "hcl", "hjson", "hlsl", "html", "html-derivative", "http", "hurl", "hxml", "hy", "imba", "ini", "java", "javascript", "jinja", "jison", "json", "json5", "jsonc", "jsonl", "jsonnet", "jssm", "jsx", "julia", "just", "kdl", "kotlin", "kusto", "latex", "lean", "less", "liquid", "llvm", "log", "logo", "lua", "luau", "make", "markdown", "marko", "matlab", "mdc", "mdx", "mermaid", "mipsasm", "mojo", "moonbit", "move", "narrat", "nextflow", "nextflow-groovy", "nginx", "nim", "nix", "nsis", "nushell", "objective-c", "objective-cpp", "ocaml", "odin", "openscad", "org", "pascal", "perl", "php", "pkl", "plsql", "po", "polar", "postcss", "powerquery", "powershell", "prisma", "prolog", "proto", "pug", "puppet", "purescript", "python", "qml", "qmldir", "qss", "r", "racket", "raku", "razor", "rbs", "reg", "regexp", "rel", "riscv", "ron", "rosmsg", "rst", "ruby", "rust", "sas", "sass", "scala", "scheme", "scss", "sdbl", "shaderlab", "shellscript", "shellsession", "smalltalk", "smithy", "solidity", "soy", "sparql", "splunk", "sql", "ssh-config", "stata", "stylus", "surrealql", "svelte", "swift", "system-verilog", "systemd", "talonscript", "tasl", "tcl", "templ", "terraform", "tex", "toml", "ts-tags", "tsv", "tsx", "turtle", "twig", "typescript", "typespec", "typst", "v", "vala", "vb", "verilog", "vhdl", "viml", "vue", "vue-html", "vue-vine", "vyper", "wasm", "wenyan", "wgsl", "wikitext", "wit", "wolfram", "xml", "xsl", "yaml", "zenscript", "zig"];
10
- export type CodeBlockCopyState = "idle" | "copying" | "copied" | "error";
11
- export interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
10
+ export type CodeBlockCopyState = 'idle' | 'copying' | 'copied' | 'error';
11
+ export interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
12
12
  code: string;
13
13
  /** A language name, alias, or extension. Defaults to the one `filename` implies, else plain text. */
14
14
  language?: string | undefined;
@@ -1,15 +1,15 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Fragment, useEffect, useMemo, useRef, useState, } from "react";
4
- import { Check } from "reicon-react/icons/Check";
5
- import { Copy } from "reicon-react/icons/Copy";
6
- import { cn } from "../internal/classes.js";
7
- import { codeLanguageIds, codeLanguageNames, } from "../internal/languages.js";
8
- import { tokenClass, useCodeTokens } from "../internal/code-tokens.js";
9
- import { languageForFilename, loadCodeLanguage, resolveCodeLanguage, } from "../internal/syntax.js";
10
- import { Button } from "./button.js";
3
+ import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
4
+ import { Check } from 'reicon-react/icons/Check';
5
+ import { Copy } from 'reicon-react/icons/Copy';
6
+ import { cn } from '../internal/classes.js';
7
+ import { codeLanguageIds, codeLanguageNames } from '../internal/languages.js';
8
+ import { tokenClass, useCodeTokens } from '../internal/code-tokens.js';
9
+ import { languageForFilename, loadCodeLanguage, resolveCodeLanguage } from '../internal/syntax.js';
10
+ import { Button } from './button.js';
11
11
  export { languageForFilename };
12
- export const codeBlockVariantNames = ["inline", "file", "preview"];
12
+ export const codeBlockVariantNames = ['inline', 'file', 'preview'];
13
13
  /** Every language that gets syntax colors. Aliases and file extensions such as `ts`, `py`, and `yml` work too. */
14
14
  export const codeBlockLanguages = codeLanguageIds;
15
15
  const copiedResetMs = 2000;
@@ -19,46 +19,46 @@ export function isHighlightedLanguage(language) {
19
19
  /** The display name for a language, alias, or extension, such as “TypeScript” for `ts`. */
20
20
  export function codeLanguageName(language) {
21
21
  const resolved = resolveCodeLanguage(language);
22
- return resolved ? codeLanguageNames[resolved] : "Plain text";
22
+ return resolved ? codeLanguageNames[resolved] : 'Plain text';
23
23
  }
24
24
  /**
25
25
  * Loads the grammars for these languages, so the next render colors them
26
26
  * at once. Await it before server rendering to send highlighted HTML.
27
27
  */
28
28
  export async function preloadCodeLanguages(...languages) {
29
- await Promise.all(languages.flatMap((language) => {
29
+ await Promise.all(languages.flatMap(language => {
30
30
  const resolved = resolveCodeLanguage(language);
31
31
  return resolved ? [loadCodeLanguage(resolved)] : [];
32
32
  }));
33
33
  }
34
- export function CodeBlock({ code, language, filename, lineNumbers = true, wrap = false, variant = "inline", className, ...props }) {
35
- const [copyState, setCopyState] = useState("idle");
34
+ export function CodeBlock({ code, language, filename, lineNumbers = true, wrap = false, variant = 'inline', className, ...props }) {
35
+ const [copyState, setCopyState] = useState('idle');
36
36
  const timer = useRef(undefined);
37
37
  useEffect(() => () => clearTimeout(timer.current), []);
38
38
  const resolved = resolveCodeLanguage(language, filename);
39
39
  const tokens = useCodeTokens(code, resolved);
40
- const lineCount = useMemo(() => code.split("\n").length, [code]);
40
+ const lineCount = useMemo(() => code.split('\n').length, [code]);
41
41
  const copy = async () => {
42
42
  clearTimeout(timer.current);
43
- setCopyState("copying");
43
+ setCopyState('copying');
44
44
  try {
45
45
  await navigator.clipboard.writeText(code);
46
- setCopyState("copied");
47
- timer.current = setTimeout(() => setCopyState("idle"), copiedResetMs);
46
+ setCopyState('copied');
47
+ timer.current = setTimeout(() => setCopyState('idle'), copiedResetMs);
48
48
  }
49
49
  catch {
50
- setCopyState("error");
50
+ setCopyState('error');
51
51
  }
52
52
  };
53
- const languageLabel = resolved ? codeLanguageNames[resolved] : "Plain text";
53
+ const languageLabel = resolved ? codeLanguageNames[resolved] : 'Plain text';
54
54
  const label = filename ?? languageLabel;
55
- const copied = copyState === "copied";
56
- const preview = variant === "preview";
57
- return (_jsxs("div", { "data-slot": "code-block", "data-variant": variant, "data-language": resolved ?? "text", "data-highlighted": tokens ? "" : undefined, "data-wrap": wrap ? "" : undefined, "data-copy-state": copyState, ...props, className: cn("sprout-code-block", className), children: [!preview && (_jsxs("div", { className: "sprout-code-block-header", children: [_jsx("span", { className: "sprout-code-block-label", children: label }), _jsxs(Button, { variant: "ghost", size: "sm", focusableWhenDisabled: true, disabled: copyState === "copying", onClick: () => void copy(), "aria-label": `Copy ${filename ?? "code"}`, className: "sprout-code-block-copy", children: [_jsx("span", { className: "sprout-code-block-icon", "aria-hidden": "true", children: copied ? _jsx(Check, { size: 14 }) : _jsx(Copy, { size: 14 }) }), copied ? "Copied" : "Copy"] })] })), _jsxs("div", { className: "sprout-code-block-viewport", ...(preview
55
+ const copied = copyState === 'copied';
56
+ const preview = variant === 'preview';
57
+ return (_jsxs("div", { "data-slot": "code-block", "data-variant": variant, "data-language": resolved ?? 'text', "data-highlighted": tokens ? '' : undefined, "data-wrap": wrap ? '' : undefined, "data-copy-state": copyState, ...props, className: cn('sprout-code-block', className), children: [!preview && (_jsxs("div", { className: "sprout-code-block-header", children: [_jsx("span", { className: "sprout-code-block-label", children: label }), _jsxs(Button, { variant: "ghost", size: "sm", focusableWhenDisabled: true, disabled: copyState === 'copying', onClick: () => void copy(), "aria-label": `Copy ${filename ?? 'code'}`, className: "sprout-code-block-copy", children: [_jsx("span", { className: "sprout-code-block-icon", "aria-hidden": "true", children: copied ? _jsx(Check, { size: 14 }) : _jsx(Copy, { size: 14 }) }), copied ? 'Copied' : 'Copy'] })] })), _jsxs("div", { className: "sprout-code-block-viewport", ...(preview
58
58
  ? {}
59
59
  : {
60
60
  tabIndex: 0,
61
- role: "region",
62
- "aria-label": filename ?? `${languageLabel} code`,
63
- }), children: [lineNumbers && !wrap && (_jsx("pre", { "aria-hidden": "true", className: "sprout-code-block-gutter", children: Array.from({ length: lineCount }, (_, index) => index + 1).join("\n") })), _jsx("pre", { className: "sprout-code-block-pre", children: tokens ? (_jsx("code", { className: "sprout-code-block-syntax", children: tokens.map((line, row) => (_jsxs(Fragment, { children: [row > 0 && "\n", line.map((token, index) => (_jsx("span", { className: tokenClass(token), children: token.content }, index)))] }, row))) })) : (_jsx("code", { children: code })) })] }), copyState === "error" && (_jsx("p", { role: "alert", className: "sprout-code-block-error", children: "Clipboard unavailable. Select the code to copy it, or try Copy again." })), !preview && (_jsx("span", { className: "sprout-code-block-sr-only", role: "status", children: copied ? "Code copied to clipboard." : "" }))] }));
61
+ role: 'region',
62
+ 'aria-label': filename ?? `${languageLabel} code`,
63
+ }), children: [lineNumbers && !wrap && (_jsx("pre", { "aria-hidden": "true", className: "sprout-code-block-gutter", children: Array.from({ length: lineCount }, (_, index) => index + 1).join('\n') })), _jsx("pre", { className: "sprout-code-block-pre", children: tokens ? (_jsx("code", { className: "sprout-code-block-syntax", children: tokens.map((line, row) => (_jsxs(Fragment, { children: [row > 0 && '\n', line.map((token, index) => (_jsx("span", { className: tokenClass(token), children: token.content }, index)))] }, row))) })) : (_jsx("code", { children: code })) })] }), copyState === 'error' && (_jsx("p", { role: "alert", className: "sprout-code-block-error", children: "Clipboard unavailable. Select the code to copy it, or try Copy again." })), !preview && (_jsx("span", { className: "sprout-code-block-sr-only", role: "status", children: copied ? 'Code copied to clipboard.' : '' }))] }));
64
64
  }
@@ -1,4 +1,4 @@
1
- import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
1
+ import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible';
2
2
  export declare const collapsibleContentVariantNames: readonly ["default", "sidebar", "card"];
3
3
  export type CollapsibleContentVariant = (typeof collapsibleContentVariantNames)[number];
4
4
  export type CollapsibleProps = BaseCollapsible.Root.Props;
@@ -1,18 +1,14 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
4
- import { stateClassName } from "../internal/classes.js";
5
- export const collapsibleContentVariantNames = [
6
- "default",
7
- "sidebar",
8
- "card",
9
- ];
3
+ import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible';
4
+ import { stateClassName } from '../internal/classes.js';
5
+ export const collapsibleContentVariantNames = ['default', 'sidebar', 'card'];
10
6
  /**
11
7
  * Shows and hides one region. Pass `open` and `onOpenChange` to control it,
12
8
  * or `defaultOpen` to let it manage itself.
13
9
  */
14
10
  export function Collapsible({ className, ...props }) {
15
- return (_jsx(BaseCollapsible.Root, { "data-slot": "collapsible", ...props, className: stateClassName("sprout-collapsible", className) }));
11
+ return (_jsx(BaseCollapsible.Root, { "data-slot": "collapsible", ...props, className: stateClassName('sprout-collapsible', className) }));
16
12
  }
17
13
  /**
18
14
  * The button that opens and closes the content. Use `render` to make a
@@ -20,8 +16,8 @@ export function Collapsible({ className, ...props }) {
20
16
  * `data-slot="collapsible-indicator"` and it turns while the content is open.
21
17
  */
22
18
  export function CollapsibleTrigger({ className, ...props }) {
23
- return (_jsx(BaseCollapsible.Trigger, { "data-slot": "collapsible-trigger", ...props, className: stateClassName("sprout-collapsible-trigger", className) }));
19
+ return (_jsx(BaseCollapsible.Trigger, { "data-slot": "collapsible-trigger", ...props, className: stateClassName('sprout-collapsible-trigger', className) }));
24
20
  }
25
- export function CollapsibleContent({ variant = "default", className, ...props }) {
21
+ export function CollapsibleContent({ variant = 'default', className, ...props }) {
26
22
  return (_jsx(BaseCollapsible.Panel, { "data-slot": "collapsible-content", "data-variant": variant, ...props, className: stateClassName(`sprout-collapsible-content sprout-collapsible-content-${variant}`, className) }));
27
23
  }
@@ -1,4 +1,4 @@
1
- import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox";
1
+ import { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
2
2
  export type ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<Value, Multiple>;
3
3
  /**
4
4
  * Holds the value, the typed query, and the open state. It takes every Base
@@ -22,7 +22,7 @@ export type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props;
22
22
  * its search field inside the list.
23
23
  */
24
24
  export declare function ComboboxTrigger({ className, children, ...props }: ComboboxTriggerProps): import("react").JSX.Element;
25
- export interface ComboboxInputProps extends Omit<ComboboxPrimitive.Input.Props, "className"> {
25
+ export interface ComboboxInputProps extends Omit<ComboboxPrimitive.Input.Props, 'className'> {
26
26
  /** Classes for the surrounding `InputGroup`. */
27
27
  className?: string;
28
28
  /** Shows the chevron button that opens the list. On by default. */
@@ -40,7 +40,7 @@ export interface ComboboxInputProps extends Omit<ComboboxPrimitive.Input.Props,
40
40
  * inline-start `InputGroupAddon` with an icon.
41
41
  */
42
42
  export declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, ...props }: ComboboxInputProps): import("react").JSX.Element;
43
- type PositionerProps = Pick<ComboboxPrimitive.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor">;
43
+ type PositionerProps = Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>;
44
44
  export interface ComboboxContentProps extends ComboboxPrimitive.Popup.Props, PositionerProps {
45
45
  }
46
46
  /**
@@ -1,13 +1,13 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef } from "react";
4
- import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox";
5
- import { Check } from "reicon-react/icons/Check";
6
- import { ChevronDown } from "reicon-react/icons/ChevronDown";
7
- import { X } from "reicon-react/icons/X";
8
- import { cn, stateClassName } from "../internal/classes.js";
9
- import { Button } from "./button.js";
10
- import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "./input-group.js";
3
+ import { useRef } from 'react';
4
+ import { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
5
+ import { Check } from 'reicon-react/icons/Check';
6
+ import { ChevronDown } from 'reicon-react/icons/ChevronDown';
7
+ import { X } from 'reicon-react/icons/X';
8
+ import { cn, stateClassName } from '../internal/classes.js';
9
+ import { Button } from './button.js';
10
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group.js';
11
11
  /**
12
12
  * Holds the value, the typed query, and the open state. It takes every Base
13
13
  * UI combobox root prop, including `items`, `multiple`, `value`,
@@ -30,10 +30,10 @@ export function ComboboxValue(props) {
30
30
  * its search field inside the list.
31
31
  */
32
32
  export function ComboboxTrigger({ className, children, ...props }) {
33
- return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", "aria-label": children == null ? "Show options" : undefined, ...props, className: stateClassName("sprout-combobox-trigger", className), children: [children, _jsx(ChevronDown, { "aria-hidden": "true", className: "sprout-combobox-trigger-icon" })] }));
33
+ return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", "aria-label": children == null ? 'Show options' : undefined, ...props, className: stateClassName('sprout-combobox-trigger', className), children: [children, _jsx(ChevronDown, { "aria-hidden": "true", className: "sprout-combobox-trigger-icon" })] }));
34
34
  }
35
35
  function ComboboxClear({ className, ...props }) {
36
- return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", "aria-label": "Clear selection", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }), ...props, className: stateClassName("sprout-combobox-clear", className), children: _jsx(X, { "aria-hidden": "true" }) }));
36
+ return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", "aria-label": "Clear selection", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }), ...props, className: stateClassName('sprout-combobox-clear', className), children: _jsx(X, { "aria-hidden": "true" }) }));
37
37
  }
38
38
  /**
39
39
  * A search field in a Sprout `InputGroup`. Typing filters the list; the
@@ -42,7 +42,7 @@ function ComboboxClear({ className, ...props }) {
42
42
  * inline-start `InputGroupAddon` with an icon.
43
43
  */
44
44
  export function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
45
- return (_jsxs(InputGroup, { className: cn("sprout-combobox-input-group", className), children: [_jsx(ComboboxPrimitive.Input, { render: _jsx(InputGroupInput, {}), disabled: disabled, ...props }), _jsxs(InputGroupAddon, { align: "inline-end", children: [showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", render: _jsx(ComboboxTrigger, {}), "data-slot": "input-group-button", className: "sprout-combobox-input-trigger", disabled: disabled })), showClear && _jsx(ComboboxClear, { disabled: disabled })] }), children] }));
45
+ return (_jsxs(InputGroup, { className: cn('sprout-combobox-input-group', className), children: [_jsx(ComboboxPrimitive.Input, { render: _jsx(InputGroupInput, {}), disabled: disabled, ...props }), _jsxs(InputGroupAddon, { align: "inline-end", children: [showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", render: _jsx(ComboboxTrigger, {}), "data-slot": "input-group-button", className: "sprout-combobox-input-trigger", disabled: disabled })), showClear && _jsx(ComboboxClear, { disabled: disabled })] }), children] }));
46
46
  }
47
47
  /**
48
48
  * The list surface. It renders its own portal and positioner, opens below
@@ -50,28 +50,28 @@ export function ComboboxInput({ className, children, disabled = false, showTrigg
50
50
  * Pass `anchor` from `useComboboxAnchor` to line it up with a whole chips
51
51
  * field instead of the text input.
52
52
  */
53
- export function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
54
- return (_jsx(ComboboxPrimitive.Portal, { children: _jsx(ComboboxPrimitive.Positioner, { className: "sprout-combobox-positioner", side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, anchor: anchor, collisionPadding: 8, children: _jsx(ComboboxPrimitive.Popup, { "data-slot": "combobox-content", "data-chips": !!anchor, ...props, className: stateClassName("sprout-combobox-content", className) }) }) }));
53
+ export function ComboboxContent({ className, side = 'bottom', sideOffset = 6, align = 'start', alignOffset = 0, anchor, ...props }) {
54
+ return (_jsx(ComboboxPrimitive.Portal, { children: _jsx(ComboboxPrimitive.Positioner, { className: "sprout-combobox-positioner", side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, anchor: anchor, collisionPadding: 8, children: _jsx(ComboboxPrimitive.Popup, { "data-slot": "combobox-content", "data-chips": !!anchor, ...props, className: stateClassName('sprout-combobox-content', className) }) }) }));
55
55
  }
56
56
  /** Holds the items. Pass a function as children to render each filtered item. */
57
57
  export function ComboboxList({ className, ...props }) {
58
- return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", ...props, className: stateClassName("sprout-combobox-list", className) }));
58
+ return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", ...props, className: stateClassName('sprout-combobox-list', className) }));
59
59
  }
60
60
  /** One choice. Long text wraps. A check mark shows when it is chosen. */
61
61
  export function ComboboxItem({ className, children, ...props }) {
62
- return (_jsxs(ComboboxPrimitive.Item, { "data-slot": "combobox-item", ...props, className: stateClassName("sprout-combobox-item", className), children: [children, _jsx(ComboboxPrimitive.ItemIndicator, { className: "sprout-combobox-item-indicator", render: _jsx("span", {}), children: _jsx(Check, { "aria-hidden": "true" }) })] }));
62
+ return (_jsxs(ComboboxPrimitive.Item, { "data-slot": "combobox-item", ...props, className: stateClassName('sprout-combobox-item', className), children: [children, _jsx(ComboboxPrimitive.ItemIndicator, { className: "sprout-combobox-item-indicator", render: _jsx("span", {}), children: _jsx(Check, { "aria-hidden": "true" }) })] }));
63
63
  }
64
64
  /** Groups related items. Pass `items` and a `ComboboxCollection` to filter inside it. */
65
65
  export function ComboboxGroup({ className, ...props }) {
66
- return (_jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", ...props, className: stateClassName("sprout-combobox-group", className) }));
66
+ return (_jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", ...props, className: stateClassName('sprout-combobox-group', className) }));
67
67
  }
68
68
  /** A small muted heading that names a `ComboboxGroup`. */
69
69
  export function ComboboxLabel({ className, ...props }) {
70
- return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", ...props, className: stateClassName("sprout-combobox-label", className) }));
70
+ return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", ...props, className: stateClassName('sprout-combobox-label', className) }));
71
71
  }
72
72
  /** Renders the filtered items of the surrounding group with a function child. */
73
73
  export function ComboboxCollection(props) {
74
- return (_jsx(ComboboxPrimitive.Collection, { "data-slot": "combobox-collection", ...props }));
74
+ return _jsx(ComboboxPrimitive.Collection, { "data-slot": "combobox-collection", ...props });
75
75
  }
76
76
  /**
77
77
  * Shows its children only when no item matches, and announces them to
@@ -79,10 +79,10 @@ export function ComboboxCollection(props) {
79
79
  * items.
80
80
  */
81
81
  export function ComboboxEmpty({ className, ...props }) {
82
- return (_jsx(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", ...props, className: stateClassName("sprout-combobox-empty", className) }));
82
+ return (_jsx(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", ...props, className: stateClassName('sprout-combobox-empty', className) }));
83
83
  }
84
84
  export function ComboboxSeparator({ className, ...props }) {
85
- return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", ...props, className: stateClassName("sprout-combobox-separator", className) }));
85
+ return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", ...props, className: stateClassName('sprout-combobox-separator', className) }));
86
86
  }
87
87
  /**
88
88
  * The bordered field for `multiple` comboboxes. Put a `ComboboxValue` that
@@ -90,15 +90,15 @@ export function ComboboxSeparator({ className, ...props }) {
90
90
  * and right move between chips; Backspace removes one.
91
91
  */
92
92
  export function ComboboxChips({ className, ...props }) {
93
- return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", ...props, className: stateClassName("sprout-combobox-chips", className) }));
93
+ return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", ...props, className: stateClassName('sprout-combobox-chips', className) }));
94
94
  }
95
95
  /** One chosen value inside `ComboboxChips`. */
96
96
  export function ComboboxChip({ className, children, showRemove = true, ...props }) {
97
- return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", ...props, className: stateClassName("sprout-combobox-chip", className), children: [children, showRemove && (_jsx(ComboboxPrimitive.ChipRemove, { "aria-label": typeof children === "string" ? `Remove ${children}` : "Remove item", render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "sprout-combobox-chip-remove", "data-slot": "combobox-chip-remove", children: _jsx(X, { "aria-hidden": "true" }) }))] }));
97
+ return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", ...props, className: stateClassName('sprout-combobox-chip', className), children: [children, showRemove && (_jsx(ComboboxPrimitive.ChipRemove, { "aria-label": typeof children === 'string' ? `Remove ${children}` : 'Remove item', render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "sprout-combobox-chip-remove", "data-slot": "combobox-chip-remove", children: _jsx(X, { "aria-hidden": "true" }) }))] }));
98
98
  }
99
99
  /** The text input that sits after the chips and fills the rest of the row. */
100
100
  export function ComboboxChipsInput({ className, ...props }) {
101
- return (_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-chip-input", ...props, className: stateClassName("sprout-combobox-chips-input", className) }));
101
+ return (_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-chip-input", ...props, className: stateClassName('sprout-combobox-chips-input', className) }));
102
102
  }
103
103
  /** A ref for `ComboboxChips` to pass as `ComboboxContent`’s `anchor`. */
104
104
  export function useComboboxAnchor() {