@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,55 +1,51 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState, } from "react";
4
- import { cn } from "../internal/classes.js";
5
- import { Alert } from "./alert.js";
6
- import { Badge } from "./badge.js";
7
- import { Button, jumpTo, useActionControl, } from "./button.js";
8
- import { FieldsDisabled } from "./field.js";
9
- export const formFooterLayoutNames = ["bar", "stack", "compact"];
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { cn } from '../internal/classes.js';
5
+ import { Alert } from './alert.js';
6
+ import { Badge } from './badge.js';
7
+ import { Button, jumpTo, useActionControl, } from './button.js';
8
+ import { FieldsDisabled } from './field.js';
9
+ export const formFooterLayoutNames = ['bar', 'stack', 'compact'];
10
10
  export const formSectionLevelNames = [2, 3];
11
11
  /**
12
12
  * A `noValidate` form that prevents the native submit, locks the fields inside
13
13
  * while `disabled`, and moves focus to the first invalid control after a
14
14
  * failed submit.
15
15
  */
16
- export function Form({ id, disabled = false, onSubmit, label, className, children, }) {
16
+ export function Form({ id, disabled = false, onSubmit, label, className, children }) {
17
17
  const formRef = useRef(null);
18
18
  const [failedSubmits, setFailedSubmits] = useState(0);
19
19
  useEffect(() => {
20
- const invalid = failedSubmits > 0
21
- ? formRef.current?.querySelector('[aria-invalid="true"]')
22
- : null;
20
+ const invalid = failedSubmits > 0 ? formRef.current?.querySelector('[aria-invalid="true"]') : null;
23
21
  if (invalid)
24
22
  jumpTo(invalid);
25
23
  }, [failedSubmits]);
26
- return (_jsx(FieldsDisabled, { value: disabled, children: _jsx("form", { id: id, ref: formRef, "data-slot": "form", noValidate: true, "aria-label": label, className: cn("sprout-form", className), onSubmit: (event) => {
24
+ return (_jsx(FieldsDisabled, { value: disabled, children: _jsx("form", { id: id, ref: formRef, "data-slot": "form", noValidate: true, "aria-label": label, className: cn('sprout-form', className), onSubmit: event => {
27
25
  event.preventDefault();
28
- if (onSubmit() === "invalid")
29
- setFailedSubmits((count) => count + 1);
26
+ if (onSubmit() === 'invalid')
27
+ setFailedSubmits(count => count + 1);
30
28
  }, children: children }) }));
31
29
  }
32
30
  /** A bordered, named region of a form with a title, description, and optional meta badge. */
33
- export function FormSection({ title, description, meta, label, id, level = 2, className, children, }) {
34
- const Heading = level === 3 ? "h3" : "h2";
35
- return (_jsxs("section", { id: id, "data-slot": "form-section", "aria-label": label ?? title, className: cn("sprout-form-section", className), children: [_jsxs("div", { className: "sprout-form-section-header", children: [_jsxs("div", { className: "sprout-form-section-text", children: [_jsx(Heading, { className: "sprout-form-section-title", children: title }), description && (_jsx("p", { className: "sprout-form-section-description", children: description }))] }), meta && _jsx(Badge, { variant: "secondary", children: meta })] }), _jsx("div", { className: "sprout-form-section-content", children: children })] }));
31
+ export function FormSection({ title, description, meta, label, id, level = 2, className, children }) {
32
+ const Heading = level === 3 ? 'h3' : 'h2';
33
+ return (_jsxs("section", { id: id, "data-slot": "form-section", "aria-label": label ?? title, className: cn('sprout-form-section', className), children: [_jsxs("div", { className: "sprout-form-section-header", children: [_jsxs("div", { className: "sprout-form-section-text", children: [_jsx(Heading, { className: "sprout-form-section-title", children: title }), description && _jsx("p", { className: "sprout-form-section-description", children: description })] }), meta && _jsx(Badge, { variant: "secondary", children: meta })] }), _jsx("div", { className: "sprout-form-section-content", children: children })] }));
36
34
  }
37
35
  /**
38
36
  * The save area of a form: the submit with busy and blocked states, an
39
37
  * optional secondary submit and cancel, an unsaved-changes line, a note, and
40
38
  * an error alert.
41
39
  */
42
- export function FormFooter({ form, summary, submit, secondarySubmit, dirty, cancel, note, error, layout = "bar", className, children, }) {
40
+ export function FormFooter({ form, summary, submit, secondarySubmit, dirty, cancel, note, error, layout = 'bar', className, children, }) {
43
41
  const action = useActionControl(submit.state);
44
- const stack = layout === "stack";
45
- const compact = layout === "compact";
46
- const size = stack ? "lg" : "default";
47
- const wide = stack ? "sprout-form-footer-wide" : undefined;
48
- const save = (_jsx(Button, { type: "submit", form: form, size: size, className: wide, ...action.button, children: submit.state.kind === "busy" ? submit.pendingLabel : submit.label }));
42
+ const stack = layout === 'stack';
43
+ const compact = layout === 'compact';
44
+ const size = stack ? 'lg' : 'default';
45
+ const wide = stack ? 'sprout-form-footer-wide' : undefined;
46
+ const save = (_jsx(Button, { type: "submit", form: form, size: size, className: wide, ...action.button, children: submit.state.kind === 'busy' ? submit.pendingLabel : submit.label }));
49
47
  const secondary = secondarySubmit && (_jsx(Button, { type: "submit", form: form, size: size, variant: "outline", className: wide, disabled: secondarySubmit.disabled, onClick: secondarySubmit.onSelect, children: secondarySubmit.label }));
50
- const cancelButton = !cancel ? null : cancel.kind === "leave" ? (_jsx(Button, { variant: "outline", size: size, className: wide, nativeButton: false, render: cancel.link, children: cancel.label })) : dirty && submit.state.kind !== "busy" ? (_jsx(Button, { variant: "outline", size: size, className: wide, onClick: cancel.onReset, children: cancel.label })) : null;
48
+ const cancelButton = !cancel ? null : cancel.kind === 'leave' ? (_jsx(Button, { variant: "outline", size: size, className: wide, nativeButton: false, render: cancel.link, children: cancel.label })) : dirty && submit.state.kind !== 'busy' ? (_jsx(Button, { variant: "outline", size: size, className: wide, onClick: cancel.onReset, children: cancel.label })) : null;
51
49
  const status = (_jsxs(_Fragment, { children: [dirty && (_jsxs("p", { className: "sprout-form-footer-dirty", children: [_jsx("span", { "aria-hidden": "true", className: "sprout-form-footer-dirty-dot" }), "Unsaved changes"] })), note && _jsx("p", { className: "sprout-form-footer-note", children: note })] }));
52
- return (_jsxs("div", { "data-slot": "form-footer", "data-layout": layout, className: cn("sprout-form-footer", className), children: [stack ? (_jsxs(_Fragment, { children: [status, _jsxs("div", { className: "sprout-form-footer-stack", children: [save, secondary, cancelButton] })] })) : (_jsxs("div", { className: "sprout-form-footer-row", children: [_jsx("div", { className: compact && !summary
53
- ? "sprout-form-footer-sr-only"
54
- : "sprout-form-footer-status", children: summary ?? status }), _jsxs("div", { className: "sprout-form-footer-actions", children: [compact && children, cancelButton, secondary, save] })] })), action.reason, error && _jsx(Alert, { variant: "destructive", children: error }), !compact && children] }));
50
+ return (_jsxs("div", { "data-slot": "form-footer", "data-layout": layout, className: cn('sprout-form-footer', className), children: [stack ? (_jsxs(_Fragment, { children: [status, _jsxs("div", { className: "sprout-form-footer-stack", children: [save, secondary, cancelButton] })] })) : (_jsxs("div", { className: "sprout-form-footer-row", children: [_jsx("div", { className: compact && !summary ? 'sprout-form-footer-sr-only' : 'sprout-form-footer-status', children: summary ?? status }), _jsxs("div", { className: "sprout-form-footer-actions", children: [compact && children, cancelButton, secondary, save] })] })), action.reason, error && _jsx(Alert, { variant: "destructive", children: error }), !compact && children] }));
55
51
  }
@@ -1,5 +1,5 @@
1
- import { type ComponentProps, type ReactNode } from "react";
2
- export interface GlassBannerProps extends Omit<ComponentProps<"div">, "title" | "children"> {
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ export interface GlassBannerProps extends Omit<ComponentProps<'div'>, 'title' | 'children'> {
3
3
  /** The headline on the glass. */
4
4
  title: ReactNode;
5
5
  /** A quieter line under the title. It also names the chip list. */
@@ -13,7 +13,7 @@ export interface GlassBannerProps extends Omit<ComponentProps<"div">, "title" |
13
13
  * by the caption, or by the title when there is no caption.
14
14
  */
15
15
  export declare function GlassBanner({ title, caption, className, children, ...props }: GlassBannerProps): import("react").JSX.Element;
16
- export interface GlassChipProps extends Omit<ComponentProps<"li">, "children"> {
16
+ export interface GlassChipProps extends Omit<ComponentProps<'li'>, 'children'> {
17
17
  /** A 28px round badge before the text, such as a brand glyph or icon. */
18
18
  icon?: ReactNode;
19
19
  children: ReactNode;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useId, useImperativeHandle, useRef, } from "react";
3
- import { cn } from "../internal/classes.js";
2
+ import { useEffect, useId, useImperativeHandle, useRef } from 'react';
3
+ import { cn } from '../internal/classes.js';
4
4
  /**
5
5
  * A frosted showcase banner with draggable glass chips. The bubble art is
6
6
  * hidden from assistive technology; the chips are announced as a list named
@@ -10,16 +10,13 @@ export function GlassBanner({ title, caption, className, children, ...props }) {
10
10
  const id = useId();
11
11
  const titleId = `${id}-title`;
12
12
  const captionId = `${id}-caption`;
13
- const hasCaption = caption !== undefined &&
14
- caption !== null &&
15
- caption !== false &&
16
- caption !== "";
17
- return (_jsxs("div", { "data-slot": "glass-banner", ...props, className: cn("sprout-glass-banner", className), children: [_jsx("div", { "data-slot": "glass-banner-art", className: "sprout-glass-banner-art", "aria-hidden": "true", children: Array.from({ length: 5 }, (_, index) => (_jsx("span", { "data-slot": "glass-bubble", className: "sprout-glass-bubble" }, index))) }), _jsxs("div", { "data-slot": "glass-banner-copy", className: "sprout-glass-banner-copy", children: [_jsx("p", { id: titleId, "data-slot": "glass-banner-title", className: "sprout-glass-banner-title", children: title }), hasCaption && (_jsx("p", { id: captionId, "data-slot": "glass-banner-caption", className: "sprout-glass-banner-caption", children: caption }))] }), _jsx("ul", { "data-slot": "glass-banner-chips", className: "sprout-glass-banner-chips", "aria-labelledby": hasCaption ? captionId : titleId, children: children })] }));
13
+ const hasCaption = caption !== undefined && caption !== null && caption !== false && caption !== '';
14
+ return (_jsxs("div", { "data-slot": "glass-banner", ...props, className: cn('sprout-glass-banner', className), children: [_jsx("div", { "data-slot": "glass-banner-art", className: "sprout-glass-banner-art", "aria-hidden": "true", children: Array.from({ length: 5 }, (_, index) => (_jsx("span", { "data-slot": "glass-bubble", className: "sprout-glass-bubble" }, index))) }), _jsxs("div", { "data-slot": "glass-banner-copy", className: "sprout-glass-banner-copy", children: [_jsx("p", { id: titleId, "data-slot": "glass-banner-title", className: "sprout-glass-banner-title", children: title }), hasCaption && (_jsx("p", { id: captionId, "data-slot": "glass-banner-caption", className: "sprout-glass-banner-caption", children: caption }))] }), _jsx("ul", { "data-slot": "glass-banner-chips", className: "sprout-glass-banner-chips", "aria-labelledby": hasCaption ? captionId : titleId, children: children })] }));
18
15
  }
19
16
  const clamp = (value, limit) => Math.max(-limit, Math.min(limit, value));
20
- const prefersReducedMotion = () => typeof window !== "undefined" &&
21
- typeof window.matchMedia === "function" &&
22
- window.matchMedia("(prefers-reduced-motion: reduce)").matches;
17
+ const prefersReducedMotion = () => typeof window !== 'undefined' &&
18
+ typeof window.matchMedia === 'function' &&
19
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;
23
20
  /**
24
21
  * A glass pill that can be dragged with a pointer and springs back on
25
22
  * release, stretching with its speed. The drag is play only: chips are not
@@ -43,8 +40,8 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
43
40
  };
44
41
  const rest = () => {
45
42
  x = y = vx = vy = 0;
46
- element.style.transform = "";
47
- element.removeAttribute("data-dragging");
43
+ element.style.transform = '';
44
+ element.removeAttribute('data-dragging');
48
45
  frame = 0;
49
46
  };
50
47
  const tick = () => {
@@ -74,7 +71,7 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
74
71
  return;
75
72
  pointer = event.pointerId;
76
73
  element.setPointerCapture?.(pointer);
77
- element.setAttribute("data-dragging", "");
74
+ element.setAttribute('data-dragging', '');
78
75
  startX = event.clientX - x;
79
76
  startY = event.clientY - y;
80
77
  targetX = x;
@@ -98,19 +95,19 @@ export function GlassChip({ icon, className, children, ref, ...props }) {
98
95
  }
99
96
  run();
100
97
  };
101
- element.addEventListener("pointerdown", down);
102
- element.addEventListener("pointermove", move);
103
- element.addEventListener("pointerup", up);
104
- element.addEventListener("pointercancel", up);
105
- element.addEventListener("lostpointercapture", up);
98
+ element.addEventListener('pointerdown', down);
99
+ element.addEventListener('pointermove', move);
100
+ element.addEventListener('pointerup', up);
101
+ element.addEventListener('pointercancel', up);
102
+ element.addEventListener('lostpointercapture', up);
106
103
  return () => {
107
104
  cancelAnimationFrame(frame);
108
- element.removeEventListener("pointerdown", down);
109
- element.removeEventListener("pointermove", move);
110
- element.removeEventListener("pointerup", up);
111
- element.removeEventListener("pointercancel", up);
112
- element.removeEventListener("lostpointercapture", up);
105
+ element.removeEventListener('pointerdown', down);
106
+ element.removeEventListener('pointermove', move);
107
+ element.removeEventListener('pointerup', up);
108
+ element.removeEventListener('pointercancel', up);
109
+ element.removeEventListener('lostpointercapture', up);
113
110
  };
114
111
  }, []);
115
- return (_jsx("li", { ref: chip, "data-slot": "glass-chip", ...props, className: cn("sprout-glass-chip", className), children: _jsxs("span", { "data-slot": "glass-chip-surface", className: "sprout-glass-chip-surface", children: [icon && (_jsx("span", { "data-slot": "glass-chip-icon", className: "sprout-glass-chip-icon", children: icon })), _jsx("span", { "data-slot": "glass-chip-label", className: "sprout-glass-chip-label", children: children })] }) }));
112
+ return (_jsx("li", { ref: chip, "data-slot": "glass-chip", ...props, className: cn('sprout-glass-chip', className), children: _jsxs("span", { "data-slot": "glass-chip-surface", className: "sprout-glass-chip-surface", children: [icon && (_jsx("span", { "data-slot": "glass-chip-icon", className: "sprout-glass-chip-icon", children: icon })), _jsx("span", { "data-slot": "glass-chip-label", className: "sprout-glass-chip-label", children: children })] }) }));
116
113
  }
@@ -1,11 +1,11 @@
1
- import { type ComponentProps } from "react";
1
+ import { type ComponentProps } from 'react';
2
2
  export declare const gradientBannerVariantNames: readonly ["aurora", "citrus", "lagoon", "iris", "cobalt", "mint"];
3
3
  export declare const gradientBannerSizeNames: readonly ["sm", "md", "lg", "xl"];
4
4
  export declare const gradientBannerPanelToneNames: readonly ["light", "dark"];
5
5
  export type GradientBannerVariant = (typeof gradientBannerVariantNames)[number];
6
6
  export type GradientBannerSize = (typeof gradientBannerSizeNames)[number];
7
7
  export type GradientBannerPanelTone = (typeof gradientBannerPanelToneNames)[number];
8
- export interface GradientBannerProps extends ComponentProps<"div"> {
8
+ export interface GradientBannerProps extends ComponentProps<'div'> {
9
9
  /** Color story of the art. Defaults to `"aurora"`. */
10
10
  variant?: GradientBannerVariant | undefined;
11
11
  /** `sm` 96px, `md` 160px, `lg` 240px (default), `xl` 360px minimum height. */
@@ -18,15 +18,15 @@ export interface GradientBannerProps extends ComponentProps<"div"> {
18
18
  * assistive technology; only children are announced.
19
19
  */
20
20
  export declare function GradientBanner({ variant, size, texture, className, children, ...props }: GradientBannerProps): import("react").JSX.Element;
21
- export interface GradientBannerPanelProps extends ComponentProps<"div"> {
21
+ export interface GradientBannerPanelProps extends ComponentProps<'div'> {
22
22
  /** `"light"` paper (default) or `"dark"` night surface. */
23
23
  tone?: GradientBannerPanelTone | undefined;
24
24
  }
25
25
  /** A solid surface that keeps text readable on any banner variant. */
26
26
  export declare function GradientBannerPanel({ tone, className, ...props }: GradientBannerPanelProps): import("react").JSX.Element;
27
27
  /** A pill label that adapts to the panel tone around it. */
28
- export declare function GradientBannerBadge({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
29
- export interface GradientBannerProgressProps extends Omit<ComponentProps<"div">, "children"> {
28
+ export declare function GradientBannerBadge({ className, ...props }: ComponentProps<'span'>): import("react").JSX.Element;
29
+ export interface GradientBannerProgressProps extends Omit<ComponentProps<'div'>, 'children'> {
30
30
  /** Percent complete. Values outside 0–100 are clamped. */
31
31
  value: number;
32
32
  }
@@ -1,43 +1,34 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, useId } from "react";
3
- import { cn } from "../internal/classes.js";
4
- export const gradientBannerVariantNames = [
5
- "aurora",
6
- "citrus",
7
- "lagoon",
8
- "iris",
9
- "cobalt",
10
- "mint",
11
- ];
12
- export const gradientBannerSizeNames = ["sm", "md", "lg", "xl"];
13
- export const gradientBannerPanelToneNames = ["light", "dark"];
2
+ import { Children, useId } from 'react';
3
+ import { cn } from '../internal/classes.js';
4
+ export const gradientBannerVariantNames = ['aurora', 'citrus', 'lagoon', 'iris', 'cobalt', 'mint'];
5
+ export const gradientBannerSizeNames = ['sm', 'md', 'lg', 'xl'];
6
+ export const gradientBannerPanelToneNames = ['light', 'dark'];
14
7
  /**
15
8
  * Decorative gradient art with centered content on top. The art is hidden from
16
9
  * assistive technology; only children are announced.
17
10
  */
18
- export function GradientBanner({ variant = "aurora", size = "lg", texture = true, className, children, ...props }) {
11
+ export function GradientBanner({ variant = 'aurora', size = 'lg', texture = true, className, children, ...props }) {
19
12
  const grainId = useId();
20
13
  const hasContent = Children.toArray(children).length > 0;
21
- return (_jsxs("div", { "data-slot": "gradient-banner", "data-variant": variant, "data-size": size, ...props, className: cn("sprout-gradient-banner", className), children: [_jsxs("div", { "data-slot": "gradient-banner-art", className: "sprout-gradient-banner-art", "aria-hidden": "true", children: [_jsx("span", { className: "sprout-gradient-banner-fold" }), _jsx("span", { className: "sprout-gradient-banner-light" }), texture && (_jsxs("svg", { "data-slot": "gradient-banner-texture", className: "sprout-gradient-banner-texture", "aria-hidden": "true", focusable: "false", children: [_jsxs("filter", { id: grainId, x: "0%", y: "0%", width: "100%", height: "100%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.82", numOctaves: "3", stitchTiles: "stitch", seed: "17" }), _jsx("feColorMatrix", { type: "saturate", values: "0" })] }), _jsx("rect", { width: "100%", height: "100%", filter: `url(#${grainId})` })] }))] }), hasContent && (_jsx("div", { "data-slot": "gradient-banner-content", className: "sprout-gradient-banner-content", children: children }))] }));
14
+ return (_jsxs("div", { "data-slot": "gradient-banner", "data-variant": variant, "data-size": size, ...props, className: cn('sprout-gradient-banner', className), children: [_jsxs("div", { "data-slot": "gradient-banner-art", className: "sprout-gradient-banner-art", "aria-hidden": "true", children: [_jsx("span", { className: "sprout-gradient-banner-fold" }), _jsx("span", { className: "sprout-gradient-banner-light" }), texture && (_jsxs("svg", { "data-slot": "gradient-banner-texture", className: "sprout-gradient-banner-texture", "aria-hidden": "true", focusable: "false", children: [_jsxs("filter", { id: grainId, x: "0%", y: "0%", width: "100%", height: "100%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.82", numOctaves: "3", stitchTiles: "stitch", seed: "17" }), _jsx("feColorMatrix", { type: "saturate", values: "0" })] }), _jsx("rect", { width: "100%", height: "100%", filter: `url(#${grainId})` })] }))] }), hasContent && (_jsx("div", { "data-slot": "gradient-banner-content", className: "sprout-gradient-banner-content", children: children }))] }));
22
15
  }
23
16
  /** A solid surface that keeps text readable on any banner variant. */
24
- export function GradientBannerPanel({ tone = "light", className, ...props }) {
25
- return (_jsx("div", { "data-slot": "gradient-banner-panel", "data-tone": tone, ...props, className: cn("sprout-gradient-banner-panel", className) }));
17
+ export function GradientBannerPanel({ tone = 'light', className, ...props }) {
18
+ return (_jsx("div", { "data-slot": "gradient-banner-panel", "data-tone": tone, ...props, className: cn('sprout-gradient-banner-panel', className) }));
26
19
  }
27
20
  /** A pill label that adapts to the panel tone around it. */
28
21
  export function GradientBannerBadge({ className, ...props }) {
29
- return (_jsx("span", { "data-slot": "gradient-banner-badge", ...props, className: cn("sprout-gradient-banner-badge", className) }));
22
+ return (_jsx("span", { "data-slot": "gradient-banner-badge", ...props, className: cn('sprout-gradient-banner-badge', className) }));
30
23
  }
31
24
  /**
32
25
  * A thin `progressbar` in the current text color. Name it with `aria-label`
33
26
  * or `aria-labelledby`.
34
27
  */
35
28
  export function GradientBannerProgress({ value, className, style, ...props }) {
36
- const percent = Number.isFinite(value)
37
- ? Math.min(Math.max(value, 0), 100)
38
- : 0;
29
+ const percent = Number.isFinite(value) ? Math.min(Math.max(value, 0), 100) : 0;
39
30
  return (_jsx("div", { "data-slot": "gradient-banner-progress", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(percent), ...props, style: {
40
31
  ...style,
41
- ["--sprout-gradient-banner-progress"]: percent / 100,
42
- }, className: cn("sprout-gradient-banner-progress", className), children: _jsx("div", { className: "sprout-gradient-banner-progress-fill" }) }));
32
+ ['--sprout-gradient-banner-progress']: percent / 100,
33
+ }, className: cn('sprout-gradient-banner-progress', className), children: _jsx("div", { className: "sprout-gradient-banner-progress-fill" }) }));
43
34
  }
@@ -1,4 +1,4 @@
1
- import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
1
+ import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
2
2
  export type HoverCardProps = PreviewCardPrimitive.Root.Props;
3
3
  /**
4
4
  * A card that previews what a link points to. It opens when the link is
@@ -12,12 +12,12 @@ export type HoverCardTriggerProps = PreviewCardPrimitive.Trigger.Props;
12
12
  * `closeDelay` (300ms).
13
13
  */
14
14
  export declare function HoverCardTrigger({ className, ...props }: HoverCardTriggerProps): import("react").JSX.Element;
15
- type PositionerProps = Pick<PreviewCardPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset" | "anchor" | "collisionPadding" | "collisionAvoidance" | "sticky" | "positionMethod">;
15
+ type PositionerProps = Pick<PreviewCardPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionPadding' | 'collisionAvoidance' | 'sticky' | 'positionMethod'>;
16
16
  export interface HoverCardContentProps extends PreviewCardPrimitive.Popup.Props, PositionerProps {
17
17
  /** Keep the card in the DOM while closed. */
18
- keepMounted?: PreviewCardPrimitive.Portal.Props["keepMounted"];
18
+ keepMounted?: PreviewCardPrimitive.Portal.Props['keepMounted'];
19
19
  /** Where the portal renders. Defaults to `document.body`. */
20
- container?: PreviewCardPrimitive.Portal.Props["container"];
20
+ container?: PreviewCardPrimitive.Portal.Props['container'];
21
21
  }
22
22
  /**
23
23
  * The 16rem floating card. It renders its own portal and positioner, so place
@@ -1,7 +1,7 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
4
- import { stateClassName } from "../internal/classes.js";
3
+ import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
4
+ import { stateClassName } from '../internal/classes.js';
5
5
  /**
6
6
  * A card that previews what a link points to. It opens when the link is
7
7
  * hovered or keyboard-focused and closes on Escape, blur, or pointer leave.
@@ -15,12 +15,12 @@ export function HoverCard(props) {
15
15
  * `closeDelay` (300ms).
16
16
  */
17
17
  export function HoverCardTrigger({ className, ...props }) {
18
- return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props, className: stateClassName("sprout-hover-card-trigger", className) }));
18
+ return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props, className: stateClassName('sprout-hover-card-trigger', className) }));
19
19
  }
20
20
  /**
21
21
  * The 16rem floating card. It renders its own portal and positioner, so place
22
22
  * it directly inside `HoverCard`.
23
23
  */
24
- export function HoverCardContent({ side = "bottom", sideOffset = 4, align = "center", alignOffset = 4, collisionPadding = 8, collisionAvoidance, sticky, positionMethod, anchor, keepMounted = false, container, className, ...props }) {
25
- return (_jsx(PreviewCardPrimitive.Portal, { "data-slot": "hover-card-portal", keepMounted: keepMounted, container: container, children: _jsx(PreviewCardPrimitive.Positioner, { className: "sprout-hover-card-positioner", anchor: anchor, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", ...props, className: stateClassName("sprout-hover-card-content", className) }) }) }));
24
+ export function HoverCardContent({ side = 'bottom', sideOffset = 4, align = 'center', alignOffset = 4, collisionPadding = 8, collisionAvoidance, sticky, positionMethod, anchor, keepMounted = false, container, className, ...props }) {
25
+ return (_jsx(PreviewCardPrimitive.Portal, { "data-slot": "hover-card-portal", keepMounted: keepMounted, container: container, children: _jsx(PreviewCardPrimitive.Positioner, { className: "sprout-hover-card-positioner", anchor: anchor, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, collisionAvoidance: collisionAvoidance, sticky: sticky, positionMethod: positionMethod, children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", ...props, className: stateClassName('sprout-hover-card-content', className) }) }) }));
26
26
  }
@@ -1,7 +1,7 @@
1
- import type { ComponentProps } from "react";
2
- import { type ButtonProps } from "./button.js";
3
- import { type InputProps } from "./input.js";
4
- import { type TextareaProps } from "./textarea.js";
1
+ import type { ComponentProps } from 'react';
2
+ import { type ButtonProps } from './button.js';
3
+ import { type InputProps } from './input.js';
4
+ import { type TextareaProps } from './textarea.js';
5
5
  export declare const inputGroupSizeNames: readonly ["default", "lg"];
6
6
  export declare const inputGroupVariantNames: readonly ["default", "composer", "question-composer"];
7
7
  export declare const inputGroupAddonAlignNames: readonly ["inline-start", "inline-end", "block-start", "block-end"];
@@ -10,7 +10,7 @@ export type InputGroupSize = (typeof inputGroupSizeNames)[number];
10
10
  export type InputGroupVariant = (typeof inputGroupVariantNames)[number];
11
11
  export type InputGroupAddonAlign = (typeof inputGroupAddonAlignNames)[number];
12
12
  export type InputGroupButtonSize = (typeof inputGroupButtonSizeNames)[number];
13
- export interface InputGroupProps extends ComponentProps<"div"> {
13
+ export interface InputGroupProps extends ComponentProps<'div'> {
14
14
  /** `default` is 32px tall with 14px text. `lg` is 44px with 16px text. */
15
15
  size?: InputGroupSize | null;
16
16
  /**
@@ -28,7 +28,7 @@ export interface InputGroupProps extends ComponentProps<"div"> {
28
28
  * `InputGroupTextarea`, or a rich text editor, drives those states.
29
29
  */
30
30
  export declare function InputGroup({ size, variant, className, ...props }: InputGroupProps): import("react").JSX.Element;
31
- export interface InputGroupAddonProps extends ComponentProps<"div"> {
31
+ export interface InputGroupAddonProps extends ComponentProps<'div'> {
32
32
  /** Inline additions sit beside the control; block additions span a row above or below it. */
33
33
  align?: InputGroupAddonAlign | null;
34
34
  }
@@ -38,10 +38,10 @@ export interface InputGroupAddonProps extends ComponentProps<"div"> {
38
38
  * in it except a button focuses the control, like a label.
39
39
  */
40
40
  export declare function InputGroupAddon({ align, className, onClick, ...props }: InputGroupAddonProps): import("react").JSX.Element;
41
- export interface InputGroupButtonProps extends Omit<ButtonProps, "size" | "type"> {
41
+ export interface InputGroupButtonProps extends Omit<ButtonProps, 'size' | 'type'> {
42
42
  /** `xs` and `sm` fit a label; `icon-xs` (24px) and `icon-sm` (28px) are square. */
43
43
  size?: InputGroupButtonSize | null;
44
- type?: "button" | "submit" | "reset";
44
+ type?: 'button' | 'submit' | 'reset';
45
45
  }
46
46
  /**
47
47
  * A compact Sprout `Button` sized to sit inside an `InputGroup` addon. It is
@@ -50,16 +50,16 @@ export interface InputGroupButtonProps extends Omit<ButtonProps, "size" | "type"
50
50
  * combobox trigger.
51
51
  */
52
52
  export declare function InputGroupButton({ size, variant, type, className, ...props }: InputGroupButtonProps): import("react").JSX.Element;
53
- export type InputGroupTextProps = ComponentProps<"span">;
53
+ export type InputGroupTextProps = ComponentProps<'span'>;
54
54
  /** Muted text or an icon with text inside an addon, such as a URL prefix or a unit. */
55
55
  export declare function InputGroupText({ className, ...props }: InputGroupTextProps): import("react").JSX.Element;
56
- export type InputGroupInputProps = Omit<InputProps, "scale">;
56
+ export type InputGroupInputProps = Omit<InputProps, 'scale'>;
57
57
  /**
58
58
  * A Sprout `Input` without its own border, fill, or ring, so the group draws
59
59
  * them. It reads a surrounding `Field` the same way `Input` does.
60
60
  */
61
61
  export declare function InputGroupInput({ className, ...props }: InputGroupInputProps): import("react").JSX.Element;
62
- export type InputGroupTextareaProps = Omit<TextareaProps, "variant">;
62
+ export type InputGroupTextareaProps = Omit<TextareaProps, 'variant'>;
63
63
  /**
64
64
  * A Sprout `Textarea` without its own border, fill, or ring, so the group
65
65
  * draws them. It grows with its content from a 96px floor and never resizes
@@ -1,27 +1,13 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { cn } from "../internal/classes.js";
4
- import { Button } from "./button.js";
5
- import { Input } from "./input.js";
6
- import { Textarea } from "./textarea.js";
7
- export const inputGroupSizeNames = ["default", "lg"];
8
- export const inputGroupVariantNames = [
9
- "default",
10
- "composer",
11
- "question-composer",
12
- ];
13
- export const inputGroupAddonAlignNames = [
14
- "inline-start",
15
- "inline-end",
16
- "block-start",
17
- "block-end",
18
- ];
19
- export const inputGroupButtonSizeNames = [
20
- "xs",
21
- "sm",
22
- "icon-xs",
23
- "icon-sm",
24
- ];
3
+ import { cn } from '../internal/classes.js';
4
+ import { Button } from './button.js';
5
+ import { Input } from './input.js';
6
+ import { Textarea } from './textarea.js';
7
+ export const inputGroupSizeNames = ['default', 'lg'];
8
+ export const inputGroupVariantNames = ['default', 'composer', 'question-composer'];
9
+ export const inputGroupAddonAlignNames = ['inline-start', 'inline-end', 'block-start', 'block-end'];
10
+ export const inputGroupButtonSizeNames = ['xs', 'sm', 'icon-xs', 'icon-sm'];
25
11
  /**
26
12
  * One bordered field made of a control and its additions: icons, text,
27
13
  * shortcuts, and buttons. The group draws the border, fill, focus ring, and
@@ -30,9 +16,9 @@ export const inputGroupButtonSizeNames = [
30
16
  * `InputGroupTextarea`, or a rich text editor, drives those states.
31
17
  */
32
18
  export function InputGroup({ size, variant, className, ...props }) {
33
- const scale = size ?? "default";
34
- const kind = variant ?? "default";
35
- return (_jsx("div", { "data-slot": "input-group", role: "group", "data-size": scale, "data-variant": kind, ...props, className: cn("sprout-input-group", `sprout-input-group-size-${scale}`, `sprout-input-group-variant-${kind}`, className) }));
19
+ const scale = size ?? 'default';
20
+ const kind = variant ?? 'default';
21
+ return (_jsx("div", { "data-slot": "input-group", role: "group", "data-size": scale, "data-variant": kind, ...props, className: cn('sprout-input-group', `sprout-input-group-size-${scale}`, `sprout-input-group-variant-${kind}`, className) }));
36
22
  }
37
23
  const controlSelector = '[data-slot="input-group-control"], input, textarea, [contenteditable="true"]';
38
24
  /**
@@ -41,7 +27,7 @@ const controlSelector = '[data-slot="input-group-control"], input, textarea, [co
41
27
  * in it except a button focuses the control, like a label.
42
28
  */
43
29
  export function InputGroupAddon({ align, className, onClick, ...props }) {
44
- const side = align ?? "inline-start";
30
+ const side = align ?? 'inline-start';
45
31
  const focusControl = (event) => {
46
32
  onClick?.(event);
47
33
  if (event.defaultPrevented)
@@ -50,11 +36,11 @@ export function InputGroupAddon({ align, className, onClick, ...props }) {
50
36
  if (target.closest("button, a[href], [role='button'], input, textarea"))
51
37
  return;
52
38
  const control = event.currentTarget.parentElement?.querySelector(controlSelector);
53
- if (!control || control.matches(":disabled"))
39
+ if (!control || control.matches(':disabled'))
54
40
  return;
55
41
  control.focus();
56
42
  };
57
- return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": side, ...props, onClick: focusControl, className: cn("sprout-input-group-addon", `sprout-input-group-addon-align-${side}`, className) }));
43
+ return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": side, ...props, onClick: focusControl, className: cn('sprout-input-group-addon', `sprout-input-group-addon-align-${side}`, className) }));
58
44
  }
59
45
  /**
60
46
  * A compact Sprout `Button` sized to sit inside an `InputGroup` addon. It is
@@ -62,21 +48,21 @@ export function InputGroupAddon({ align, className, onClick, ...props }) {
62
48
  * submits a form by accident. Use `render` to make it a menu, popover, or
63
49
  * combobox trigger.
64
50
  */
65
- export function InputGroupButton({ size, variant, type = "button", className, ...props }) {
66
- const scale = size ?? "xs";
67
- const kind = variant ?? "ghost";
68
- return (_jsx(Button, { type: type, variant: kind, "data-size": scale, "data-variant": kind, ...props, className: (state) => cn("sprout-input-group-button", `sprout-input-group-button-size-${scale}`, typeof className === "function" ? className(state) : className) }));
51
+ export function InputGroupButton({ size, variant, type = 'button', className, ...props }) {
52
+ const scale = size ?? 'xs';
53
+ const kind = variant ?? 'ghost';
54
+ return (_jsx(Button, { type: type, variant: kind, "data-size": scale, "data-variant": kind, ...props, className: state => cn('sprout-input-group-button', `sprout-input-group-button-size-${scale}`, typeof className === 'function' ? className(state) : className) }));
69
55
  }
70
56
  /** Muted text or an icon with text inside an addon, such as a URL prefix or a unit. */
71
57
  export function InputGroupText({ className, ...props }) {
72
- return (_jsx("span", { "data-slot": "input-group-text", ...props, className: cn("sprout-input-group-text", className) }));
58
+ return _jsx("span", { "data-slot": "input-group-text", ...props, className: cn('sprout-input-group-text', className) });
73
59
  }
74
60
  /**
75
61
  * A Sprout `Input` without its own border, fill, or ring, so the group draws
76
62
  * them. It reads a surrounding `Field` the same way `Input` does.
77
63
  */
78
64
  export function InputGroupInput({ className, ...props }) {
79
- return (_jsx(Input, { "data-slot": "input-group-control", ...props, className: (state) => cn("sprout-input-group-input", typeof className === "function" ? className(state) : className) }));
65
+ return (_jsx(Input, { "data-slot": "input-group-control", ...props, className: state => cn('sprout-input-group-input', typeof className === 'function' ? className(state) : className) }));
80
66
  }
81
67
  /**
82
68
  * A Sprout `Textarea` without its own border, fill, or ring, so the group
@@ -84,5 +70,5 @@ export function InputGroupInput({ className, ...props }) {
84
70
  * by hand.
85
71
  */
86
72
  export function InputGroupTextarea({ className, ...props }) {
87
- return (_jsx(Textarea, { variant: "embedded", "data-slot": "input-group-control", ...props, className: cn("sprout-input-group-textarea", className) }));
73
+ return (_jsx(Textarea, { variant: "embedded", "data-slot": "input-group-control", ...props, className: cn('sprout-input-group-textarea', className) }));
88
74
  }
@@ -1,15 +1,15 @@
1
- import { type ComponentProps, type ReactNode } from "react";
2
- import { OTPField } from "@base-ui/react/otp-field";
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { OTPField } from '@base-ui/react/otp-field';
3
3
  export type InputOTPState = OTPField.Root.State;
4
4
  export type InputOTPSlotState = OTPField.Input.State;
5
- type Invalid = boolean | "true" | "false" | "grammar" | "spelling";
6
- export interface InputOTPProps extends Omit<OTPField.Root.Props, "length" | "aria-invalid" | "children"> {
5
+ type Invalid = boolean | 'true' | 'false' | 'grammar' | 'spelling';
6
+ export interface InputOTPProps extends Omit<OTPField.Root.Props, 'length' | 'aria-invalid' | 'children'> {
7
7
  /** Number of character slots. Matches the slot indexes you render. */
8
8
  maxLength: number;
9
9
  /** Called with the new code on every edit, paste, or autofill. */
10
10
  onChange?: ((value: string) => void) | undefined;
11
11
  /** Marks every slot invalid and draws the danger ring on its group. */
12
- "aria-invalid"?: Invalid | undefined;
12
+ 'aria-invalid'?: Invalid | undefined;
13
13
  children?: ReactNode;
14
14
  }
15
15
  /**
@@ -18,20 +18,20 @@ export interface InputOTPProps extends Omit<OTPField.Root.Props, "length" | "ari
18
18
  * End, Backspace, and Delete all work. `aria-label` names the whole code and
19
19
  * its first slot; later slots are announced as "Character 2 of 6".
20
20
  */
21
- export declare function InputOTP({ maxLength, onChange, onValueChange, className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-invalid": ariaInvalid, validationType, ...props }: InputOTPProps): import("react").JSX.Element;
22
- export type InputOTPGroupProps = ComponentProps<"div">;
21
+ export declare function InputOTP({ maxLength, onChange, onValueChange, className, children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, validationType, ...props }: InputOTPProps): import("react").JSX.Element;
22
+ export type InputOTPGroupProps = ComponentProps<'div'>;
23
23
  /** Joins adjacent slots into one bordered segment. */
24
24
  export declare function InputOTPGroup({ className, ...props }: InputOTPGroupProps): import("react").JSX.Element;
25
- export interface InputOTPSlotProps extends Omit<OTPField.Input.Props, "aria-invalid"> {
25
+ export interface InputOTPSlotProps extends Omit<OTPField.Input.Props, 'aria-invalid'> {
26
26
  /** Zero-based position of this slot in the code. */
27
27
  index: number;
28
- "aria-invalid"?: Invalid | undefined;
28
+ 'aria-invalid'?: Invalid | undefined;
29
29
  }
30
30
  /**
31
31
  * One character of the code. Render slots in index order; Base UI tracks
32
32
  * focus and value by their DOM order.
33
33
  */
34
- export declare function InputOTPSlot({ index, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-invalid": ariaInvalid, ...props }: InputOTPSlotProps): import("react").JSX.Element;
34
+ export declare function InputOTPSlot({ index, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, ...props }: InputOTPSlotProps): import("react").JSX.Element;
35
35
  export type InputOTPSeparatorProps = ComponentProps<typeof OTPField.Separator>;
36
36
  /** A dash between slot groups, such as `123–456`. */
37
37
  export declare function InputOTPSeparator({ className, children, ...props }: InputOTPSeparatorProps): import("react").JSX.Element;