@zonsh/ui 0.0.0-stage → 0.2.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 (388) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -2
  3. package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
  4. package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
  5. package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
  6. package/assets/illustrations/drawing/bracket-construction.svg +77 -0
  7. package/assets/illustrations/drawing/crescent-dark.svg +28 -0
  8. package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
  9. package/assets/illustrations/drawing/crescent-guides.svg +33 -0
  10. package/assets/illustrations/drawing/crescent.svg +28 -0
  11. package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
  12. package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
  13. package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
  14. package/assets/illustrations/drawing/eclipse.svg +187 -0
  15. package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
  16. package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
  17. package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
  18. package/assets/illustrations/drawing/elevation-guides.svg +31 -0
  19. package/assets/illustrations/drawing/horizon-dark.svg +30 -0
  20. package/assets/illustrations/drawing/horizon.svg +30 -0
  21. package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
  22. package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
  23. package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
  24. package/assets/illustrations/drawing/nib-study.svg +107 -0
  25. package/assets/illustrations/editorial/assistant-640.webp +0 -0
  26. package/assets/illustrations/editorial/assistant.webp +0 -0
  27. package/assets/illustrations/editorial/automation-640.webp +0 -0
  28. package/assets/illustrations/editorial/automation.webp +0 -0
  29. package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
  30. package/assets/illustrations/editorial/bracket-left.webp +0 -0
  31. package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
  32. package/assets/illustrations/editorial/bracket-right.webp +0 -0
  33. package/assets/illustrations/editorial/custom-software-640.webp +0 -0
  34. package/assets/illustrations/editorial/custom-software.webp +0 -0
  35. package/assets/illustrations/editorial/digitalization-640.webp +0 -0
  36. package/assets/illustrations/editorial/digitalization.webp +0 -0
  37. package/assets/illustrations/editorial/integration-640.webp +0 -0
  38. package/assets/illustrations/editorial/integration.webp +0 -0
  39. package/assets/illustrations/editorial/problem-640.webp +0 -0
  40. package/assets/illustrations/editorial/problem.webp +0 -0
  41. package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
  42. package/assets/illustrations/editorial/process-analysis.webp +0 -0
  43. package/assets/illustrations/editorial/process-concept-640.webp +0 -0
  44. package/assets/illustrations/editorial/process-concept.webp +0 -0
  45. package/assets/illustrations/editorial/process-development-640.webp +0 -0
  46. package/assets/illustrations/editorial/process-development.webp +0 -0
  47. package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
  48. package/assets/illustrations/editorial/process-discovery.webp +0 -0
  49. package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
  50. package/assets/illustrations/editorial/process-maintenance.webp +0 -0
  51. package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
  52. package/assets/illustrations/editorial/process-prototype.webp +0 -0
  53. package/assets/illustrations/editorial/process-testing-640.webp +0 -0
  54. package/assets/illustrations/editorial/process-testing.webp +0 -0
  55. package/assets/illustrations/iso/automation-dark.svg +6 -0
  56. package/assets/illustrations/iso/automation.svg +6 -0
  57. package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
  58. package/assets/illustrations/iso/bar-chart.svg +6 -0
  59. package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
  60. package/assets/illustrations/iso/brackets-classic.svg +6 -0
  61. package/assets/illustrations/iso/brackets-dark.svg +6 -0
  62. package/assets/illustrations/iso/brackets.svg +6 -0
  63. package/assets/illustrations/iso/city-dark.svg +6 -0
  64. package/assets/illustrations/iso/city.svg +6 -0
  65. package/assets/illustrations/iso/conveyor-dark.svg +6 -0
  66. package/assets/illustrations/iso/conveyor.svg +6 -0
  67. package/assets/illustrations/iso/database-dark.svg +6 -0
  68. package/assets/illustrations/iso/database.svg +6 -0
  69. package/assets/illustrations/iso/documents-dark.svg +6 -0
  70. package/assets/illustrations/iso/documents.svg +6 -0
  71. package/assets/illustrations/iso/inbox-dark.svg +6 -0
  72. package/assets/illustrations/iso/inbox.svg +6 -0
  73. package/assets/illustrations/iso/laptop-dark.svg +6 -0
  74. package/assets/illustrations/iso/laptop.svg +6 -0
  75. package/assets/illustrations/iso/monitor-dark.svg +6 -0
  76. package/assets/illustrations/iso/monitor.svg +6 -0
  77. package/assets/illustrations/iso/pipeline-dark.svg +6 -0
  78. package/assets/illustrations/iso/pipeline.svg +6 -0
  79. package/assets/illustrations/iso/platform-dark.svg +6 -0
  80. package/assets/illustrations/iso/platform.svg +6 -0
  81. package/assets/illustrations/iso/server-dark.svg +6 -0
  82. package/assets/illustrations/iso/server.svg +6 -0
  83. package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
  84. package/assets/illustrations/iso/spreadsheet.svg +6 -0
  85. package/assets/illustrations/iso/timeline-dark.svg +6 -0
  86. package/assets/illustrations/iso/timeline.svg +6 -0
  87. package/assets/illustrations/sheet/construction.svg +115 -0
  88. package/assets/illustrations/sheet/crescent.svg +40 -0
  89. package/assets/illustrations/sheet/limb.svg +42 -0
  90. package/assets/illustrations/sheet/stress-axis.svg +119 -0
  91. package/assets/illustrations/sheet/totality.svg +215 -0
  92. package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
  93. package/assets/logo-left.svg +1 -0
  94. package/assets/logo-right.svg +1 -0
  95. package/assets/logo.svg +1 -0
  96. package/dist/components/_overlay.d.ts +47 -0
  97. package/dist/components/_overlay.js +59 -0
  98. package/dist/components/accordion.d.ts +32 -0
  99. package/dist/components/accordion.js +39 -0
  100. package/dist/components/alert-dialog.d.ts +45 -0
  101. package/dist/components/alert-dialog.js +56 -0
  102. package/dist/components/alert.d.ts +35 -0
  103. package/dist/components/alert.js +42 -0
  104. package/dist/components/ascii-field.d.ts +34 -0
  105. package/dist/components/ascii-field.js +410 -0
  106. package/dist/components/aspect-ratio.d.ts +14 -0
  107. package/dist/components/aspect-ratio.js +17 -0
  108. package/dist/components/avatar.d.ts +42 -0
  109. package/dist/components/avatar.js +55 -0
  110. package/dist/components/badge.d.ts +70 -0
  111. package/dist/components/badge.js +62 -0
  112. package/dist/components/breadcrumb.d.ts +22 -0
  113. package/dist/components/breadcrumb.js +32 -0
  114. package/dist/components/button-group.d.ts +30 -0
  115. package/dist/components/button-group.js +47 -0
  116. package/dist/components/button.d.ts +53 -0
  117. package/dist/components/button.js +130 -0
  118. package/dist/components/calendar.d.ts +26 -0
  119. package/dist/components/calendar.js +164 -0
  120. package/dist/components/card.d.ts +42 -0
  121. package/dist/components/card.js +76 -0
  122. package/dist/components/carousel.d.ts +90 -0
  123. package/dist/components/carousel.js +213 -0
  124. package/dist/components/chart.d.ts +180 -0
  125. package/dist/components/chart.js +286 -0
  126. package/dist/components/checkbox.d.ts +23 -0
  127. package/dist/components/checkbox.js +43 -0
  128. package/dist/components/code-block.d.ts +45 -0
  129. package/dist/components/code-block.js +58 -0
  130. package/dist/components/code-highlight.d.ts +13 -0
  131. package/dist/components/code-highlight.js +107 -0
  132. package/dist/components/collapsible.d.ts +20 -0
  133. package/dist/components/collapsible.js +32 -0
  134. package/dist/components/color-picker.d.ts +85 -0
  135. package/dist/components/color-picker.js +407 -0
  136. package/dist/components/combobox.d.ts +81 -0
  137. package/dist/components/combobox.js +100 -0
  138. package/dist/components/command.d.ts +112 -0
  139. package/dist/components/command.js +212 -0
  140. package/dist/components/context-menu.d.ts +29 -0
  141. package/dist/components/context-menu.js +35 -0
  142. package/dist/components/conversation.d.ts +27 -0
  143. package/dist/components/conversation.js +293 -0
  144. package/dist/components/copy-button.d.ts +46 -0
  145. package/dist/components/copy-button.js +118 -0
  146. package/dist/components/data-table.d.ts +175 -0
  147. package/dist/components/data-table.js +302 -0
  148. package/dist/components/date-picker.d.ts +91 -0
  149. package/dist/components/date-picker.js +207 -0
  150. package/dist/components/dialog.d.ts +48 -0
  151. package/dist/components/dialog.js +92 -0
  152. package/dist/components/direction.d.ts +16 -0
  153. package/dist/components/direction.js +18 -0
  154. package/dist/components/drawer.d.ts +60 -0
  155. package/dist/components/drawer.js +76 -0
  156. package/dist/components/empty.d.ts +31 -0
  157. package/dist/components/empty.js +50 -0
  158. package/dist/components/feature-list.d.ts +54 -0
  159. package/dist/components/feature-list.js +43 -0
  160. package/dist/components/field.d.ts +15 -0
  161. package/dist/components/field.js +36 -0
  162. package/dist/components/file-drop.d.ts +55 -0
  163. package/dist/components/file-drop.js +197 -0
  164. package/dist/components/filter-bar.d.ts +106 -0
  165. package/dist/components/filter-bar.js +296 -0
  166. package/dist/components/form.d.ts +33 -0
  167. package/dist/components/form.js +34 -0
  168. package/dist/components/graph.d.ts +105 -0
  169. package/dist/components/graph.js +786 -0
  170. package/dist/components/illustration.d.ts +85 -0
  171. package/dist/components/illustration.js +165 -0
  172. package/dist/components/input-group.d.ts +127 -0
  173. package/dist/components/input-group.js +292 -0
  174. package/dist/components/input.d.ts +16 -0
  175. package/dist/components/input.js +25 -0
  176. package/dist/components/item.d.ts +64 -0
  177. package/dist/components/item.js +116 -0
  178. package/dist/components/kbd.d.ts +33 -0
  179. package/dist/components/kbd.js +38 -0
  180. package/dist/components/label.d.ts +12 -0
  181. package/dist/components/label.js +24 -0
  182. package/dist/components/layout.d.ts +136 -0
  183. package/dist/components/layout.js +162 -0
  184. package/dist/components/logo.d.ts +54 -0
  185. package/dist/components/logo.js +96 -0
  186. package/dist/components/menu.d.ts +60 -0
  187. package/dist/components/menu.js +138 -0
  188. package/dist/components/menubar.d.ts +62 -0
  189. package/dist/components/menubar.js +223 -0
  190. package/dist/components/message.d.ts +42 -0
  191. package/dist/components/message.js +56 -0
  192. package/dist/components/meter.d.ts +31 -0
  193. package/dist/components/meter.js +25 -0
  194. package/dist/components/native-select.d.ts +26 -0
  195. package/dist/components/native-select.js +35 -0
  196. package/dist/components/navigation-menu.d.ts +42 -0
  197. package/dist/components/navigation-menu.js +97 -0
  198. package/dist/components/number-field.d.ts +36 -0
  199. package/dist/components/number-field.js +153 -0
  200. package/dist/components/otp-field.d.ts +35 -0
  201. package/dist/components/otp-field.js +94 -0
  202. package/dist/components/pagination.d.ts +31 -0
  203. package/dist/components/pagination.js +70 -0
  204. package/dist/components/pdf-viewer.d.ts +69 -0
  205. package/dist/components/pdf-viewer.js +929 -0
  206. package/dist/components/popover.d.ts +33 -0
  207. package/dist/components/popover.js +48 -0
  208. package/dist/components/preview-card.d.ts +25 -0
  209. package/dist/components/preview-card.js +22 -0
  210. package/dist/components/progress.d.ts +27 -0
  211. package/dist/components/progress.js +23 -0
  212. package/dist/components/prompt-input.d.ts +131 -0
  213. package/dist/components/prompt-input.js +403 -0
  214. package/dist/components/quote.d.ts +22 -0
  215. package/dist/components/quote.js +15 -0
  216. package/dist/components/radio-group.d.ts +18 -0
  217. package/dist/components/radio-group.js +34 -0
  218. package/dist/components/reasoning.d.ts +31 -0
  219. package/dist/components/reasoning.js +70 -0
  220. package/dist/components/resizable.d.ts +38 -0
  221. package/dist/components/resizable.js +41 -0
  222. package/dist/components/response.d.ts +30 -0
  223. package/dist/components/response.js +538 -0
  224. package/dist/components/scroll-area.d.ts +33 -0
  225. package/dist/components/scroll-area.js +31 -0
  226. package/dist/components/select.d.ts +35 -0
  227. package/dist/components/select.js +60 -0
  228. package/dist/components/separator.d.ts +14 -0
  229. package/dist/components/separator.js +17 -0
  230. package/dist/components/sidebar.d.ts +147 -0
  231. package/dist/components/sidebar.js +489 -0
  232. package/dist/components/site-header.d.ts +59 -0
  233. package/dist/components/site-header.js +67 -0
  234. package/dist/components/skeleton.d.ts +31 -0
  235. package/dist/components/skeleton.js +29 -0
  236. package/dist/components/slider.d.ts +24 -0
  237. package/dist/components/slider.js +129 -0
  238. package/dist/components/sources.d.ts +25 -0
  239. package/dist/components/sources.js +35 -0
  240. package/dist/components/spinner.d.ts +36 -0
  241. package/dist/components/spinner.js +72 -0
  242. package/dist/components/suggestions.d.ts +20 -0
  243. package/dist/components/suggestions.js +18 -0
  244. package/dist/components/switch.d.ts +14 -0
  245. package/dist/components/switch.js +26 -0
  246. package/dist/components/table.d.ts +162 -0
  247. package/dist/components/table.js +758 -0
  248. package/dist/components/tabs.d.ts +25 -0
  249. package/dist/components/tabs.js +162 -0
  250. package/dist/components/tag.d.ts +41 -0
  251. package/dist/components/tag.js +88 -0
  252. package/dist/components/tags-input.d.ts +40 -0
  253. package/dist/components/tags-input.js +239 -0
  254. package/dist/components/textarea.d.ts +13 -0
  255. package/dist/components/textarea.js +16 -0
  256. package/dist/components/theme.d.ts +41 -0
  257. package/dist/components/theme.js +112 -0
  258. package/dist/components/time-field.d.ts +51 -0
  259. package/dist/components/time-field.js +437 -0
  260. package/dist/components/timeline.d.ts +76 -0
  261. package/dist/components/timeline.js +99 -0
  262. package/dist/components/toast.d.ts +72 -0
  263. package/dist/components/toast.js +196 -0
  264. package/dist/components/toggle-group.d.ts +41 -0
  265. package/dist/components/toggle-group.js +140 -0
  266. package/dist/components/toggle.d.ts +23 -0
  267. package/dist/components/toggle.js +35 -0
  268. package/dist/components/tool-call.d.ts +52 -0
  269. package/dist/components/tool-call.js +57 -0
  270. package/dist/components/toolbar.d.ts +17 -0
  271. package/dist/components/toolbar.js +34 -0
  272. package/dist/components/tooltip.d.ts +42 -0
  273. package/dist/components/tooltip.js +47 -0
  274. package/dist/components/tree.d.ts +75 -0
  275. package/dist/components/tree.js +636 -0
  276. package/dist/components/typography.d.ts +134 -0
  277. package/dist/components/typography.js +176 -0
  278. package/dist/components/video-player.d.ts +276 -0
  279. package/dist/components/video-player.js +1352 -0
  280. package/dist/components/whiteboard.d.ts +80 -0
  281. package/dist/components/whiteboard.js +389 -0
  282. package/dist/index.d.ts +85 -0
  283. package/dist/index.js +86 -0
  284. package/dist/lib/cn.d.ts +20 -0
  285. package/dist/lib/cn.js +38 -0
  286. package/dist/lib/code-highlight.d.ts +31 -0
  287. package/dist/lib/code-highlight.js +24 -0
  288. package/dist/lib/code-theme.d.ts +19 -0
  289. package/dist/lib/code-theme.js +140 -0
  290. package/dist/lib/collapse-row.d.ts +9 -0
  291. package/dist/lib/collapse-row.js +129 -0
  292. package/dist/lib/digit-roll.d.ts +21 -0
  293. package/dist/lib/digit-roll.js +31 -0
  294. package/dist/lib/editorial-assets.d.ts +16 -0
  295. package/dist/lib/editorial-assets.js +56 -0
  296. package/dist/lib/figure/catalog.d.ts +127 -0
  297. package/dist/lib/figure/catalog.js +130 -0
  298. package/dist/lib/figure/figures/automation.d.ts +7 -0
  299. package/dist/lib/figure/figures/automation.js +143 -0
  300. package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
  301. package/dist/lib/figure/figures/bar-chart.js +99 -0
  302. package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
  303. package/dist/lib/figure/figures/brackets-classic.js +170 -0
  304. package/dist/lib/figure/figures/brackets.d.ts +8 -0
  305. package/dist/lib/figure/figures/brackets.js +84 -0
  306. package/dist/lib/figure/figures/city.d.ts +7 -0
  307. package/dist/lib/figure/figures/city.js +93 -0
  308. package/dist/lib/figure/figures/conveyor.d.ts +7 -0
  309. package/dist/lib/figure/figures/conveyor.js +97 -0
  310. package/dist/lib/figure/figures/database.d.ts +7 -0
  311. package/dist/lib/figure/figures/database.js +65 -0
  312. package/dist/lib/figure/figures/documents.d.ts +7 -0
  313. package/dist/lib/figure/figures/documents.js +83 -0
  314. package/dist/lib/figure/figures/inbox.d.ts +7 -0
  315. package/dist/lib/figure/figures/inbox.js +92 -0
  316. package/dist/lib/figure/figures/laptop.d.ts +7 -0
  317. package/dist/lib/figure/figures/laptop.js +67 -0
  318. package/dist/lib/figure/figures/monitor.d.ts +7 -0
  319. package/dist/lib/figure/figures/monitor.js +59 -0
  320. package/dist/lib/figure/figures/pipeline.d.ts +8 -0
  321. package/dist/lib/figure/figures/pipeline.js +117 -0
  322. package/dist/lib/figure/figures/platform.d.ts +7 -0
  323. package/dist/lib/figure/figures/platform.js +117 -0
  324. package/dist/lib/figure/figures/server.d.ts +7 -0
  325. package/dist/lib/figure/figures/server.js +115 -0
  326. package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
  327. package/dist/lib/figure/figures/spreadsheet.js +87 -0
  328. package/dist/lib/figure/figures/timeline.d.ts +7 -0
  329. package/dist/lib/figure/figures/timeline.js +65 -0
  330. package/dist/lib/figure/kernel.d.ts +152 -0
  331. package/dist/lib/figure/kernel.js +576 -0
  332. package/dist/lib/figure/parts.d.ts +42 -0
  333. package/dist/lib/figure/parts.js +126 -0
  334. package/dist/lib/form-reset.d.ts +11 -0
  335. package/dist/lib/form-reset.js +22 -0
  336. package/dist/lib/glide.d.ts +53 -0
  337. package/dist/lib/glide.js +138 -0
  338. package/dist/lib/graph-layout.d.ts +58 -0
  339. package/dist/lib/graph-layout.js +200 -0
  340. package/dist/lib/illustration-drawings.d.ts +89 -0
  341. package/dist/lib/illustration-drawings.js +539 -0
  342. package/dist/lib/illustration-info.d.ts +37 -0
  343. package/dist/lib/illustration-info.js +22 -0
  344. package/dist/lib/illustration-library.d.ts +87 -0
  345. package/dist/lib/illustration-library.js +352 -0
  346. package/dist/lib/logo-geometry.d.ts +29 -0
  347. package/dist/lib/logo-geometry.js +67 -0
  348. package/dist/lib/markdown-guard.d.ts +16 -0
  349. package/dist/lib/markdown-guard.js +123 -0
  350. package/dist/lib/merge-refs.d.ts +10 -0
  351. package/dist/lib/merge-refs.js +26 -0
  352. package/dist/lib/motion.d.ts +6 -0
  353. package/dist/lib/motion.js +12 -0
  354. package/dist/lib/pdf-worker.d.ts +1 -0
  355. package/dist/lib/pdf-worker.js +6 -0
  356. package/dist/lib/pdf.d.ts +19 -0
  357. package/dist/lib/pdf.js +58 -0
  358. package/dist/lib/platform.d.ts +33 -0
  359. package/dist/lib/platform.js +68 -0
  360. package/dist/lib/room.d.ts +25 -0
  361. package/dist/lib/room.js +46 -0
  362. package/dist/lib/table-fit.d.ts +143 -0
  363. package/dist/lib/table-fit.js +577 -0
  364. package/dist/lib/theme-script.d.ts +18 -0
  365. package/dist/lib/theme-script.js +29 -0
  366. package/dist/styles/expressive.css +188 -0
  367. package/dist/styles/fonts.css +145 -0
  368. package/dist/styles/index.css +206 -0
  369. package/dist/styles/material.css +313 -0
  370. package/dist/styles/parts/ai.css +360 -0
  371. package/dist/styles/parts/brand.css +75 -0
  372. package/dist/styles/parts/controls.css +725 -0
  373. package/dist/styles/parts/data.css +222 -0
  374. package/dist/styles/parts/editorial.css +120 -0
  375. package/dist/styles/parts/feedback.css +273 -0
  376. package/dist/styles/parts/foundations.css +166 -0
  377. package/dist/styles/parts/graph.css +214 -0
  378. package/dist/styles/parts/inputs.css +261 -0
  379. package/dist/styles/parts/isometric.css +124 -0
  380. package/dist/styles/parts/navigation.css +232 -0
  381. package/dist/styles/parts/overlays.css +250 -0
  382. package/dist/styles/parts/pdf.css +154 -0
  383. package/dist/styles/parts/react-flow.css +519 -0
  384. package/dist/styles/parts/whiteboard.css +855 -0
  385. package/dist/styles/tokens.css +290 -0
  386. package/dist/vite.d.ts +116 -0
  387. package/dist/vite.js +129 -0
  388. package/package.json +189 -3
@@ -0,0 +1,25 @@
1
+ import { Tabs as BaseTabs } from "@base-ui/react/tabs";
2
+ import * as React from "react";
3
+ export type TabsVariant = "segmented" | "underline";
4
+ /**
5
+ * Tabs — switch between related panels on the same page.
6
+ *
7
+ * Two looks, set on `TabsList`: `segmented` (default) is a recessed track holding one raised,
8
+ * current segment; `underline` is mono labels on a hairline baseline with a 1px foreground
9
+ * indicator. The rule people break: tabs switch *panels*, not pages. For site sections use
10
+ * `NavigationMenu` or `Sidebar`; for 2–5 options that set a value, use `ToggleGroup`.
11
+ *
12
+ * The root is full width, so it never shrink-wraps to the active panel's text: switching
13
+ * tabs never moves the list. Panels may differ in height; content below them reflows.
14
+ */
15
+ export declare function Tabs({ className, ...props }: BaseTabs.Root.Props): React.JSX.Element;
16
+ export interface TabsListProps extends BaseTabs.List.Props {
17
+ /** `segmented` (default): recessed track + raised current segment. `underline`: mono labels on a hairline. */
18
+ variant?: TabsVariant;
19
+ }
20
+ /** The row of tabs; scrolls sideways when they don't fit. Renders the animated indicator itself — do not add one. */
21
+ export declare function TabsList({ variant, className, children, ref, ...props }: TabsListProps): React.JSX.Element;
22
+ /** One tab. Pass a `value` matching its `TabsPanel`. */
23
+ export declare function TabsTab({ className, ...props }: BaseTabs.Tab.Props): React.JSX.Element;
24
+ /** The content for one tab. Only the active panel is mounted unless `keepMounted` is set. */
25
+ export declare function TabsPanel({ className, ...props }: BaseTabs.Panel.Props): React.JSX.Element;
@@ -0,0 +1,162 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Tabs as BaseTabs } from "@base-ui/react/tabs";
4
+ import * as React from "react";
5
+ import { sx } from "../lib/cn.js";
6
+ import { useMergedRef } from "../lib/glide.js";
7
+ const TabsVariantContext = React.createContext("segmented");
8
+ /**
9
+ * Tabs — switch between related panels on the same page.
10
+ *
11
+ * Two looks, set on `TabsList`: `segmented` (default) is a recessed track holding one raised,
12
+ * current segment; `underline` is mono labels on a hairline baseline with a 1px foreground
13
+ * indicator. The rule people break: tabs switch *panels*, not pages. For site sections use
14
+ * `NavigationMenu` or `Sidebar`; for 2–5 options that set a value, use `ToggleGroup`.
15
+ *
16
+ * The root is full width, so it never shrink-wraps to the active panel's text: switching
17
+ * tabs never moves the list. Panels may differ in height; content below them reflows.
18
+ */
19
+ export function Tabs({ className, ...props }) {
20
+ return (_jsx(BaseTabs.Root, { "data-slot": "tabs", className: sx("flex w-full flex-col gap-5 data-[orientation=vertical]:flex-row", className), ...props }));
21
+ }
22
+ /*
23
+ * More tabs than fit their row scroll sideways inside the list instead of pushing the page wider;
24
+ * Base UI keeps the active and the focused tab in view. The scrollbar stays hidden, as in the
25
+ * sidebar. A scroller clips at its padding box, so focus outlines need room inside it: the
26
+ * segmented track has its 3px inset; the underline list takes 2px of padding (1px below, where
27
+ * its hairline runs) back with negative margins, so nothing moves.
28
+ */
29
+ const scrolls = "data-[orientation=horizontal]:overflow-x-auto data-[orientation=horizontal]:overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";
30
+ const listVariants = {
31
+ segmented: [
32
+ "relative z-0 inline-flex w-fit max-w-full min-h-(--control-h) items-center gap-0.5 rounded-control p-[3px] material-field data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",
33
+ scrolls,
34
+ "scroll-px-[3px]",
35
+ ].join(" "),
36
+ underline: [
37
+ "relative z-0 flex items-center gap-6",
38
+ scrolls,
39
+ "data-[orientation=horizontal]:-mx-0.5 data-[orientation=horizontal]:-mt-0.5 data-[orientation=horizontal]:px-0.5 data-[orientation=horizontal]:pt-0.5 data-[orientation=horizontal]:pb-px data-[orientation=horizontal]:scroll-px-0.5",
40
+ // The hairline is a 1px line painted in the bottom padding, where the indicator covers it: a
41
+ // border would lie outside the scroller's clip, and the indicator with it. Forced colours drop
42
+ // painted lines, so there it is a border again, under a Highlight indicator.
43
+ "data-[orientation=horizontal]:bg-linear-to-r data-[orientation=horizontal]:from-border/60 data-[orientation=horizontal]:to-border/60 data-[orientation=horizontal]:bg-size-[calc(100%-4px)_1px] data-[orientation=horizontal]:bg-position-[2px_100%] data-[orientation=horizontal]:bg-no-repeat forced-colors:data-[orientation=horizontal]:border-b",
44
+ "data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-start data-[orientation=vertical]:gap-0 data-[orientation=vertical]:border-s data-[orientation=vertical]:border-border/60",
45
+ ].join(" "),
46
+ };
47
+ const indicatorVariants = {
48
+ segmented: [
49
+ "pointer-events-none absolute top-0 left-0 -z-10 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top) rounded-item",
50
+ "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised",
51
+ "transition-[translate,width,height] duration-(--duration) ease-(--ease)",
52
+ ].join(" "),
53
+ underline: [
54
+ "pointer-events-none absolute bottom-0 left-0 h-px w-(--active-tab-width) translate-x-(--active-tab-left) bg-foreground forced-colors:bg-[color:Highlight] forced-colors:forced-color-adjust-none",
55
+ "data-[orientation=vertical]:top-0 data-[orientation=vertical]:bottom-auto data-[orientation=vertical]:-start-px data-[orientation=vertical]:h-(--active-tab-height) data-[orientation=vertical]:w-px data-[orientation=vertical]:translate-x-0 data-[orientation=vertical]:translate-y-(--active-tab-top)",
56
+ "transition-[translate,width,height] duration-(--duration) ease-(--ease)",
57
+ ].join(" "),
58
+ };
59
+ /**
60
+ * Keeps the active tab in view in a list that scrolls sideways: when it mounts, when the tab
61
+ * changes, and when the list or a tab resizes — web fonts arriving after Base UI's own first
62
+ * scroll, a hidden list shown — until someone scrolls the list themselves. Only the list scrolls,
63
+ * never the page, and its scroll-padding stays clear. It works from the boxes on screen, so LTR
64
+ * and RTL alike. (ToggleGroup has the same.)
65
+ */
66
+ function useRevealChosen(list, item, attribute) {
67
+ React.useLayoutEffect(() => {
68
+ const row = list.current;
69
+ if (!row)
70
+ return;
71
+ let held = false;
72
+ // The item chosen last (in `multiple` mode, the one just pressed), else the first chosen one.
73
+ let last = null;
74
+ const reveal = () => {
75
+ if (last && !last.hasAttribute(attribute))
76
+ last = null;
77
+ const chosen = row.scrollWidth > row.clientWidth && (last ?? row.querySelector(`${item}[${attribute}]`));
78
+ if (!chosen)
79
+ return;
80
+ const style = getComputedStyle(row);
81
+ const left = row.getBoundingClientRect().left + row.clientLeft;
82
+ const start = left + (Number.parseFloat(style.scrollPaddingLeft) || 0);
83
+ const end = left + row.clientWidth - (Number.parseFloat(style.scrollPaddingRight) || 0);
84
+ const box = chosen.getBoundingClientRect();
85
+ // Wider than the room: its start shows (its right edge in RTL).
86
+ const delta = box.left < start && box.right > end
87
+ ? style.direction === "rtl"
88
+ ? box.right - end
89
+ : box.left - start
90
+ : box.left < start
91
+ ? box.left - start
92
+ : Math.max(0, box.right - end);
93
+ if (delta)
94
+ row.scrollLeft += delta;
95
+ };
96
+ const resize = new ResizeObserver(() => !held && reveal());
97
+ const observe = () => {
98
+ resize.disconnect();
99
+ resize.observe(row);
100
+ row.querySelectorAll(item).forEach((node) => resize.observe(node));
101
+ };
102
+ const mutations = new MutationObserver((records) => {
103
+ if (records.some((r) => r.type === "childList"))
104
+ observe();
105
+ const chosen = records
106
+ .filter((r) => r.type === "attributes" && r.target.hasAttribute(attribute))
107
+ .at(-1);
108
+ if (chosen) {
109
+ last = chosen.target;
110
+ held = false;
111
+ reveal();
112
+ }
113
+ });
114
+ mutations.observe(row, {
115
+ subtree: true,
116
+ childList: true,
117
+ attributes: true,
118
+ attributeFilter: [attribute],
119
+ });
120
+ // Scrolling the list by hand, or moving through it by keyboard, leaves it where it is.
121
+ const hold = () => {
122
+ held = true;
123
+ };
124
+ const events = ["wheel", "touchstart", "keydown"];
125
+ for (const type of events)
126
+ row.addEventListener(type, hold, { passive: true });
127
+ observe();
128
+ reveal();
129
+ return () => {
130
+ resize.disconnect();
131
+ mutations.disconnect();
132
+ for (const type of events)
133
+ row.removeEventListener(type, hold);
134
+ };
135
+ }, [list, item, attribute]);
136
+ }
137
+ /** The row of tabs; scrolls sideways when they don't fit. Renders the animated indicator itself — do not add one. */
138
+ export function TabsList({ variant = "segmented", className, children, ref, ...props }) {
139
+ const [listRef, setListRef] = useMergedRef(ref);
140
+ useRevealChosen(listRef, '[data-slot="tabs-tab"]', "data-active");
141
+ return (_jsx(TabsVariantContext.Provider, { value: variant, children: _jsxs(BaseTabs.List, { ref: setListRef, "data-slot": "tabs-list", "data-variant": variant, className: sx(listVariants[variant], className), ...props, children: [children, _jsx(BaseTabs.Indicator, { "data-slot": "tabs-indicator", className: indicatorVariants[variant] })] }) }));
142
+ }
143
+ const tabVariants = {
144
+ segmented: "min-h-(--control-h-sm) gap-2 px-3 text-sm justify-center rounded-item font-body text-control-muted hover:not-data-disabled:text-foreground data-active:text-foreground",
145
+ underline: "min-h-(--control-h) gap-2 font-mono text-[13px] text-muted-foreground hover:not-data-disabled:text-foreground data-active:text-foreground data-[orientation=vertical]:min-h-(--control-h-sm) data-[orientation=vertical]:ps-4",
146
+ };
147
+ /** One tab. Pass a `value` matching its `TabsPanel`. */
148
+ export function TabsTab({ className, ...props }) {
149
+ const variant = React.useContext(TabsVariantContext);
150
+ return (_jsx(BaseTabs.Tab, { "data-slot": "tabs-tab", className: sx([
151
+ "relative inline-flex shrink-0 cursor-pointer items-center leading-none whitespace-nowrap focus-ring select-none",
152
+ "transition-colors duration-(--duration) ease-(--ease)",
153
+ // A disabled tab stays focusable (Base UI) and still takes hover, so a tooltip can say why.
154
+ "disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",
155
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
156
+ tabVariants[variant],
157
+ ], className), ...props }));
158
+ }
159
+ /** The content for one tab. Only the active panel is mounted unless `keepMounted` is set. */
160
+ export function TabsPanel({ className, ...props }) {
161
+ return (_jsx(BaseTabs.Panel, { "data-slot": "tabs-panel", className: sx("min-w-0 flex-1 focus-ring", className), ...props }));
162
+ }
@@ -0,0 +1,41 @@
1
+ import * as React from "react";
2
+ declare const tagVariants: {
3
+ /** Raised, foreground ink. */
4
+ readonly default: "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-key text-foreground";
5
+ /** Raised, muted ink — for secondary metadata. */
6
+ readonly muted: "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-key text-muted-foreground";
7
+ /** Border only, no fill — for tags sitting on a raised surface already. */
8
+ readonly outline: "border border-field-edge bg-transparent text-foreground-soft";
9
+ /** Status: done, saved, connected. */
10
+ readonly success: string;
11
+ /** Status: needs attention soon — expiring, partial, nearly full. */
12
+ readonly warning: string;
13
+ /** Status: neutral news — new, in progress, unsaved. */
14
+ readonly info: string;
15
+ /** Status: an error or a failed state. */
16
+ readonly destructive: string;
17
+ /** Category tones: no fixed meaning — pick one per kind and keep it everywhere. */
18
+ readonly blue: string;
19
+ readonly aqua: string;
20
+ readonly violet: string;
21
+ readonly magenta: string;
22
+ readonly orange: string;
23
+ readonly lime: string;
24
+ };
25
+ export type TagVariant = keyof typeof tagVariants;
26
+ export interface TagProps extends React.ComponentProps<"span"> {
27
+ variant?: TagVariant;
28
+ /** A leading 6px dot in the current ink, for status ("Live", "Draft"). */
29
+ dot?: boolean;
30
+ }
31
+ /**
32
+ * Tag — a small mono label for metadata: a technology, a status, a category.
33
+ *
34
+ * 22px tall, Licht Mono 11px with 0.02em tracking, 7px radius, on a raised key surface.
35
+ * Tags are labels, not controls — they do not respond to hover. Coloured tags are tints: the
36
+ * four status colours for a state, the six category tones for a kind people need to tell apart
37
+ * (a file type, a phase). The rule people break: colour as decoration — a tone with no meaning,
38
+ * or the same tone meaning two things in one app.
39
+ */
40
+ export declare function Tag({ variant, dot, className, children, ...props }: TagProps): React.JSX.Element;
41
+ export {};
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/cn.js";
5
+ const raised = "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-key";
6
+ /* A coloured tag is a tint, not a key: the colour's ink on a 10% wash inside a 30% edge. The wash
7
+ takes a little from the ink's contrast, the more so on a darker ground, so the text is the ink
8
+ deepened 12% toward the foreground, enough to keep 4.5:1 on its wash over any ground in both
9
+ themes, a selected row (--control-hover) included. Spelled out per colour so Tailwind sees
10
+ every class. */
11
+ const tints = {
12
+ success: "border-success/30 bg-success/10 text-[color:color-mix(in_oklab,var(--success),var(--foreground)_12%)]",
13
+ warning: "border-warning/30 bg-warning/10 text-[color:color-mix(in_oklab,var(--warning),var(--foreground)_12%)]",
14
+ info: "border-info/30 bg-info/10 text-[color:color-mix(in_oklab,var(--info),var(--foreground)_12%)]",
15
+ destructive: "border-destructive/30 bg-destructive/10 text-[color:color-mix(in_oklab,var(--destructive),var(--foreground)_12%)]",
16
+ "tone-blue": "border-tone-blue/30 bg-tone-blue/10 text-[color:color-mix(in_oklab,var(--tone-blue),var(--foreground)_12%)]",
17
+ "tone-aqua": "border-tone-aqua/30 bg-tone-aqua/10 text-[color:color-mix(in_oklab,var(--tone-aqua),var(--foreground)_12%)]",
18
+ "tone-violet": "border-tone-violet/30 bg-tone-violet/10 text-[color:color-mix(in_oklab,var(--tone-violet),var(--foreground)_12%)]",
19
+ "tone-magenta": "border-tone-magenta/30 bg-tone-magenta/10 text-[color:color-mix(in_oklab,var(--tone-magenta),var(--foreground)_12%)]",
20
+ "tone-orange": "border-tone-orange/30 bg-tone-orange/10 text-[color:color-mix(in_oklab,var(--tone-orange),var(--foreground)_12%)]",
21
+ "tone-lime": "border-tone-lime/30 bg-tone-lime/10 text-[color:color-mix(in_oklab,var(--tone-lime),var(--foreground)_12%)]",
22
+ };
23
+ const tint = (colour) => `border ${tints[colour]}`;
24
+ const tagVariants = {
25
+ /** Raised, foreground ink. */
26
+ default: `${raised} text-foreground`,
27
+ /** Raised, muted ink — for secondary metadata. */
28
+ muted: `${raised} text-muted-foreground`,
29
+ /** Border only, no fill — for tags sitting on a raised surface already. */
30
+ outline: "border border-field-edge bg-transparent text-foreground-soft",
31
+ /** Status: done, saved, connected. */
32
+ success: tint("success"),
33
+ /** Status: needs attention soon — expiring, partial, nearly full. */
34
+ warning: tint("warning"),
35
+ /** Status: neutral news — new, in progress, unsaved. */
36
+ info: tint("info"),
37
+ /** Status: an error or a failed state. */
38
+ destructive: tint("destructive"),
39
+ /** Category tones: no fixed meaning — pick one per kind and keep it everywhere. */
40
+ blue: tint("tone-blue"),
41
+ aqua: tint("tone-aqua"),
42
+ violet: tint("tone-violet"),
43
+ magenta: tint("tone-magenta"),
44
+ orange: tint("tone-orange"),
45
+ lime: tint("tone-lime"),
46
+ };
47
+ const isText = (part) => typeof part === "string" || typeof part === "number";
48
+ /**
49
+ * Text children (a run of them) become one label that ends in "…" when the tag is narrower than
50
+ * it; the full text stays in the page for assistive tech. Icons and other elements keep their size.
51
+ */
52
+ function withText(children) {
53
+ const parts = React.Children.toArray(children);
54
+ if (!parts.some(isText))
55
+ return children;
56
+ const out = [];
57
+ let run = "";
58
+ const flush = () => {
59
+ if (run.trim())
60
+ out.push(_jsx("span", { "data-slot": "tag-text", className: "min-w-0 overflow-x-clip text-ellipsis", children: run }, `text-${out.length}`));
61
+ run = "";
62
+ };
63
+ for (const part of parts) {
64
+ if (isText(part))
65
+ run += part;
66
+ else {
67
+ flush();
68
+ out.push(part);
69
+ }
70
+ }
71
+ flush();
72
+ return out;
73
+ }
74
+ /**
75
+ * Tag — a small mono label for metadata: a technology, a status, a category.
76
+ *
77
+ * 22px tall, Licht Mono 11px with 0.02em tracking, 7px radius, on a raised key surface.
78
+ * Tags are labels, not controls — they do not respond to hover. Coloured tags are tints: the
79
+ * four status colours for a state, the six category tones for a kind people need to tell apart
80
+ * (a file type, a phase). The rule people break: colour as decoration — a tone with no meaning,
81
+ * or the same tone meaning two things in one app.
82
+ */
83
+ export function Tag({ variant = "default", dot = false, className, children, ...props }) {
84
+ return (_jsxs("span", { "data-slot": "tag", "data-variant": variant, className: cn(
85
+ // A tag never grows past its container: its text ends in "…" instead. In a row it keeps
86
+ // its full width while a neighbour can give way; `min-w-0` lets it shrink with them.
87
+ "inline-flex min-h-[22px] w-fit max-w-full items-center gap-1.5 rounded-item px-2 font-mono text-[11px] leading-none tracking-[0.02em] whitespace-nowrap", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3", tagVariants[variant], className), ...props, children: [dot && _jsx("span", { "aria-hidden": true, "data-slot": "tag-dot", className: "size-1.5 shrink-0 rounded-full bg-current" }), withText(children)] }));
88
+ }
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ declare const groupSizes: {
3
+ readonly sm: "min-h-(--control-h-sm) p-0.5";
4
+ readonly default: "min-h-(--control-h) p-[3px]";
5
+ };
6
+ export interface TagsInputProps extends Omit<React.ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "size" | "max" | "type" | "className"> {
7
+ value?: string[];
8
+ defaultValue?: string[];
9
+ /** Called with the new list after a tag is added or removed. */
10
+ onValueChange?: (value: string[]) => void;
11
+ /** `sm` (30px) for dense surfaces; `default` (38px) everywhere else. */
12
+ size?: keyof typeof groupSizes;
13
+ /** Return `false` for a tag that is not valid (not an email, say): it is kept, marked invalid. */
14
+ validate?: (tag: string) => boolean;
15
+ /** The most tags the field takes; past it, typing stops until one is removed. */
16
+ max?: number;
17
+ /** Submits each tag as a hidden input under this name. */
18
+ name?: string;
19
+ /**
20
+ * At least one tag: until there is one the field is `valueMissing`, which stops a form's submit
21
+ * and marks the `Field` invalid.
22
+ */
23
+ required?: boolean;
24
+ /** The remove button's name. Default: "Remove {tag}". */
25
+ removeLabel?: (tag: string) => string;
26
+ /** Classes for the visible field, not the bare `<input>`. */
27
+ className?: string;
28
+ }
29
+ /**
30
+ * TagsInput — free-typed values as chips inside one recessed field: labels, keywords, the email
31
+ * addresses to invite. Enter or a comma adds what was typed; pasting `a, b, c` adds all three;
32
+ * Backspace in the empty input selects the last chip, and a second Backspace removes it.
33
+ *
34
+ * The chips are `ComboboxChips`' own. Use a multiple `Combobox` when the values come from a list
35
+ * (team members, languages); use TagsInput when people type their own. Duplicates are ignored
36
+ * (letter case aside). Pass `validate` to mark the tags that don't fit, and say why under the
37
+ * field. The rule people break: colouring tags by kind — they are raised secondary surfaces.
38
+ */
39
+ export declare function TagsInput({ value: valueProp, defaultValue, onValueChange, size, validate, max, name, removeLabel, className, placeholder, disabled, readOnly, required, id, ref, onKeyDown, onPaste, onFocus, onBlur, ...props }: TagsInputProps): React.JSX.Element;
40
+ export {};
@@ -0,0 +1,239 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useDirection } from "@base-ui/react/direction-provider";
4
+ import { Field as BaseField } from "@base-ui/react/field";
5
+ import { CircleAlertIcon, XIcon } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cn } from "../lib/cn.js";
8
+ import { mergeRefs } from "../lib/merge-refs.js";
9
+ /* The field and chips are ComboboxChips' own: the same group, the same raised 30px chips with 7px
10
+ corners and a round remove button, so a multiple Combobox and a TagsInput read as one family. */
11
+ const groupSizes = {
12
+ sm: "min-h-(--control-h-sm) p-0.5",
13
+ default: "min-h-(--control-h) p-[3px]",
14
+ };
15
+ const chipSizes = {
16
+ sm: "min-h-(--control-inset-sm) pe-0.5 ps-2 text-xs",
17
+ default: "min-h-(--control-h-sm) pe-[3px] ps-2.5 text-[13px]",
18
+ };
19
+ const removeSizes = {
20
+ sm: "size-[18px] [&_svg]:size-3",
21
+ default: "size-(--control-inset-sm) [&_svg]:size-3.5",
22
+ };
23
+ const inputSizes = {
24
+ sm: "min-h-(--control-inset-sm) text-[13px]",
25
+ default: "min-h-(--control-h-sm) text-base sm:text-[15px]",
26
+ };
27
+ /** Split typed or pasted text into tags: commas, semicolons, tabs and new lines. */
28
+ const splitTags = (text) => text
29
+ .split(/[,;\t\n]+/)
30
+ .map((t) => t.trim())
31
+ .filter(Boolean);
32
+ /**
33
+ * TagsInput — free-typed values as chips inside one recessed field: labels, keywords, the email
34
+ * addresses to invite. Enter or a comma adds what was typed; pasting `a, b, c` adds all three;
35
+ * Backspace in the empty input selects the last chip, and a second Backspace removes it.
36
+ *
37
+ * The chips are `ComboboxChips`' own. Use a multiple `Combobox` when the values come from a list
38
+ * (team members, languages); use TagsInput when people type their own. Duplicates are ignored
39
+ * (letter case aside). Pass `validate` to mark the tags that don't fit, and say why under the
40
+ * field. The rule people break: colouring tags by kind — they are raised secondary surfaces.
41
+ */
42
+ export function TagsInput({ value: valueProp, defaultValue, onValueChange, size = "default", validate, max, name, removeLabel = (tag) => `Remove ${tag}`, className, placeholder, disabled, readOnly, required, id, ref, onKeyDown, onPaste, onFocus, onBlur, ...props }) {
43
+ const [valueState, setValueState] = React.useState(defaultValue ?? []);
44
+ const tags = valueProp ?? valueState;
45
+ const [text, setText] = React.useState("");
46
+ const input = React.useRef(null);
47
+ const refs = React.useMemo(() => mergeRefs(input, ref), [ref]);
48
+ /** The Field's own input, out of sight: it holds the tags the Field validates. */
49
+ const fieldInput = React.useRef(null);
50
+ const chips = React.useRef([]);
51
+ const full = max != null && tags.length >= max;
52
+ // Disabled by the prop or by a disabled Field, which Base UI sets on the input.
53
+ const locked = () => !!input.current?.disabled || !!readOnly;
54
+ // The chips run before the input: to its left, or to its right in a right-to-left page.
55
+ const rtl = useDirection() === "rtl";
56
+ const towardChips = rtl ? "ArrowRight" : "ArrowLeft";
57
+ const awayFromChips = rtl ? "ArrowLeft" : "ArrowRight";
58
+ // Tags are unique, but a value passed in may repeat one: a repeat gets a key of its own.
59
+ const counts = new Map();
60
+ const keys = tags.map((tag) => {
61
+ const n = counts.get(tag) ?? 0;
62
+ counts.set(tag, n + 1);
63
+ return n ? `${tag}\u0000${n}` : tag;
64
+ });
65
+ /* A form's reset puts back the tags it started with, as it does a native input's text. */
66
+ const initial = React.useRef(defaultValue);
67
+ initial.current = defaultValue;
68
+ React.useEffect(() => {
69
+ const form = input.current?.form;
70
+ if (!form)
71
+ return;
72
+ const reset = () => {
73
+ setValueState(initial.current ?? []);
74
+ setText("");
75
+ };
76
+ form.addEventListener("reset", reset);
77
+ return () => form.removeEventListener("reset", reset);
78
+ }, []);
79
+ /* A tag that is already there is not added again; the one there lights up for a moment instead. */
80
+ const [repeat, setRepeat] = React.useState(null);
81
+ React.useEffect(() => {
82
+ if (!repeat)
83
+ return;
84
+ const t = setTimeout(() => setRepeat(null), 900);
85
+ return () => clearTimeout(t);
86
+ }, [repeat]);
87
+ const commit = (next) => {
88
+ setValueState(next);
89
+ onValueChange?.(next);
90
+ };
91
+ /** Add the tags in `raw`; returns the text left over (what did not fit under `max`). */
92
+ const add = (raw) => {
93
+ const next = [...tags];
94
+ const seen = new Set(next.map((t) => t.toLowerCase()));
95
+ const parts = splitTags(raw);
96
+ let i = 0;
97
+ for (; i < parts.length; i++) {
98
+ if (max != null && next.length >= max)
99
+ break;
100
+ const tag = parts[i];
101
+ if (seen.has(tag.toLowerCase())) {
102
+ setRepeat(next.find((t) => t.toLowerCase() === tag.toLowerCase()) ?? null);
103
+ continue;
104
+ }
105
+ seen.add(tag.toLowerCase());
106
+ next.push(tag);
107
+ }
108
+ if (next.length !== tags.length)
109
+ commit(next);
110
+ return parts.slice(i).join(", ");
111
+ };
112
+ /* Where focus goes once a removal has rendered: a chip's index, or -1 for the input. */
113
+ const refocus = React.useRef(null);
114
+ React.useLayoutEffect(() => {
115
+ if (refocus.current == null)
116
+ return;
117
+ const target = refocus.current;
118
+ refocus.current = null;
119
+ ((target >= 0 ? chips.current[target] : null) ?? input.current)?.focus();
120
+ });
121
+ /**
122
+ * Remove the tag at `index`. From the keyboard, Backspace goes to the chip before it (the input
123
+ * after the last one, so Backspace, Backspace only ever takes the last tag) and Delete to the
124
+ * chip that takes its place.
125
+ */
126
+ const remove = (index, focus) => {
127
+ commit(tags.filter((_, i) => i !== index));
128
+ const last = index === tags.length - 1;
129
+ refocus.current =
130
+ focus === "input" || (last && focus === "previous") || (last && focus === "same")
131
+ ? -1
132
+ : focus === "previous"
133
+ ? Math.max(0, index - 1)
134
+ : index;
135
+ };
136
+ const handleInputKeyDown = (event) => {
137
+ onKeyDown?.(event);
138
+ // Not while an IME is composing: its Enter picks the characters (Safari ends the composition
139
+ // first, but still marks the key 229).
140
+ if (event.defaultPrevented || event.nativeEvent.isComposing || event.keyCode === 229 || locked())
141
+ return;
142
+ const el = event.currentTarget;
143
+ if ((event.key === "Enter" || event.key === ",") && text.trim()) {
144
+ event.preventDefault();
145
+ setText(add(text));
146
+ }
147
+ else if (event.key === ",") {
148
+ event.preventDefault();
149
+ }
150
+ else if ((event.key === "Backspace" || event.key === towardChips) &&
151
+ el.selectionStart === 0 &&
152
+ el.selectionEnd === 0 &&
153
+ tags.length > 0) {
154
+ event.preventDefault();
155
+ chips.current[tags.length - 1]?.focus();
156
+ }
157
+ };
158
+ const handleChipKeyDown = (index) => (event) => {
159
+ if (event.target !== event.currentTarget)
160
+ return;
161
+ const { key } = event;
162
+ if (key === towardChips) {
163
+ event.preventDefault();
164
+ chips.current[Math.max(0, index - 1)]?.focus();
165
+ }
166
+ else if (key === awayFromChips) {
167
+ event.preventDefault();
168
+ (chips.current[index + 1] ?? input.current)?.focus();
169
+ }
170
+ else if (key === "Backspace" || key === "Delete") {
171
+ event.preventDefault();
172
+ if (!locked())
173
+ remove(index, key === "Backspace" ? "previous" : "same");
174
+ }
175
+ else if (key === "Escape" || (key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey)) {
176
+ // Typing goes back to the input, and the character with it.
177
+ input.current?.focus();
178
+ }
179
+ };
180
+ const handlePaste = (event) => {
181
+ onPaste?.(event);
182
+ if (event.defaultPrevented || locked())
183
+ return;
184
+ const pasted = event.clipboardData.getData("text");
185
+ if (!/[,;\t\n]/.test(pasted))
186
+ return;
187
+ event.preventDefault();
188
+ // The list goes where the caret is, over any text selected.
189
+ const el = event.currentTarget;
190
+ setText(add(text.slice(0, el.selectionStart ?? text.length) + pasted + text.slice(el.selectionEnd ?? text.length)));
191
+ };
192
+ return (_jsx(BaseField.Control, { ref: fieldInput, id: id, name: name,
193
+ // The tags, as the Field and a Form see them: comma-separated, as an email input's `multiple`.
194
+ value: tags.join(","), disabled: disabled,
195
+ // The Field's own input, out of sight, holds the tags for validation and `onFormSubmit`, and
196
+ // carries `required`, as Base UI's Select does: a submit that finds it empty focuses it, and it
197
+ // hands focus on to the text input. The text input takes the label, the descriptions and the
198
+ // validity; a native form gets one hidden input per tag under the name, ours or the Field's.
199
+ render: (control) => {
200
+ const { ref: fieldRef, id: controlId, name: formName, value: formValue, disabled: off, onChange: fieldChange, onFocus: fieldFocus, onBlur: fieldBlur, onKeyDown: _onKeyDown, className: _className, defaultValue: _defaultValue, autoFocus: _autoFocus, "aria-invalid": fieldInvalid, ...field } = control;
201
+ return (_jsxs("div", { "data-slot": "tags-input", "data-size": size, "data-readonly": readOnly ? "" : undefined, "data-full": full ? "" : undefined, className: cn("group/tags-input flex w-full material-field cursor-text items-center rounded-control font-body", groupSizes[size], "has-[[data-slot=tags-input-input][aria-invalid=true]]:border-destructive has-[[data-slot=tags-input-input][aria-invalid=true]]:shadow-invalid", "has-[[data-slot=tags-input-input]:disabled]:cursor-not-allowed has-[[data-slot=tags-input-input]:disabled]:opacity-55", className), onMouseDown: (event) => {
202
+ // A press on the field's empty space puts the caret in the input, as on a text field.
203
+ if (event.target.closest("input, button, [data-slot=tags-input-chip]"))
204
+ return;
205
+ event.preventDefault();
206
+ input.current?.focus();
207
+ }, onFocus: (event) => fieldFocus?.(event), onBlur: (event) => {
208
+ // Focus leaving the field — the text input and the chips — is a blur for the Field,
209
+ // which validates the tags in its input.
210
+ if (event.currentTarget.contains(event.relatedTarget))
211
+ return;
212
+ if (fieldInput.current)
213
+ fieldBlur?.({
214
+ currentTarget: fieldInput.current,
215
+ });
216
+ }, children: [_jsxs("div", { "data-slot": "tags-input-chips", role: tags.length > 0 ? "toolbar" : undefined, className: "flex w-full flex-wrap items-center gap-[3px]", children: [tags.map((tag, index) => {
217
+ const invalid = validate ? !validate(tag) : false;
218
+ return (_jsxs("div", { ref: (el) => {
219
+ chips.current[index] = el;
220
+ }, "data-slot": "tags-input-chip", "data-invalid": invalid ? "" : undefined, "data-repeat": repeat === tag ? "" : undefined, tabIndex: -1, onKeyDown: handleChipKeyDown(index), className: cn("inline-flex max-w-full cursor-default items-center gap-1 rounded-item border border-transparent leading-none font-medium text-foreground", "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised", "transition-[box-shadow,border-color,color] duration-(--duration) ease-(--ease)", "group-has-[[data-slot=tags-input-input]:disabled]/tags-input:pointer-events-none", chipSizes[size], readOnly && "pe-2.5 group-data-[size=sm]/tags-input:pe-2",
221
+ // Not valid: a 1px red edge, red ink and an alert icon, read out as "invalid".
222
+ "data-invalid:border-destructive/60 data-invalid:text-destructive",
223
+ // The tag that was typed again is marked with a current item's edge for a moment.
224
+ "data-repeat:shadow-raised-current"), children: [invalid && _jsx(CircleAlertIcon, { "aria-hidden": true, className: "size-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [tag, invalid && _jsx("span", { className: "sr-only", children: " (invalid)" })] }), !readOnly && (_jsx("button", { type: "button", tabIndex: -1, "data-slot": "tags-input-chip-remove", "aria-label": removeLabel(tag),
225
+ // Keep focus where it is: a click removes the tag, then returns to the input.
226
+ onMouseDown: (event) => event.preventDefault(), onClick: () => {
227
+ if (locked())
228
+ return;
229
+ remove(index, "input");
230
+ }, className: cn("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-[background-color,color] duration-(--duration) ease-brand hover:bg-control-hover hover:text-foreground", "group-has-[[data-slot=tags-input-input]:disabled]/tags-input:pointer-events-none", removeSizes[size]), children: _jsx(XIcon, {}) }))] }, keys[index]));
231
+ }), _jsx("input", { ...field, ...props, ref: refs, id: controlId, "data-slot": "tags-input-input", value: text, onChange: (event) => setText(event.currentTarget.value), onKeyDown: handleInputKeyDown, onPaste: handlePaste, onFocus: onFocus, onBlur: (event) => {
232
+ onBlur?.(event);
233
+ // What was typed and not yet added is added on leaving, so a submit never loses it.
234
+ if (text.trim() && !locked())
235
+ setText(add(text));
236
+ }, placeholder: tags.length > 0 ? undefined : placeholder, disabled: off, readOnly: readOnly || full, "aria-required": required || undefined, "aria-invalid": fieldInvalid || tags.some((t) => validate && !validate(t)) || undefined, autoComplete: "off", className: cn("min-w-16 flex-1 bg-transparent px-1.5 outline-none placeholder:text-control-muted disabled:cursor-not-allowed", inputSizes[size]) }), formName &&
237
+ tags.map((tag, index) => (_jsx("input", { type: "hidden", name: formName, value: tag, form: props.form, disabled: off }, keys[index])))] }), _jsx("input", { ref: fieldRef, value: formValue ?? "", onChange: fieldChange, required: required, disabled: off, readOnly: readOnly, form: props.form, "aria-hidden": true, tabIndex: -1, autoComplete: "off", onFocus: () => input.current?.focus(), className: "sr-only" })] }));
238
+ } }));
239
+ }
@@ -0,0 +1,13 @@
1
+ import { Field as BaseField } from "@base-ui/react/field";
2
+ export interface TextareaProps extends Omit<BaseField.Control.Props, "render"> {
3
+ }
4
+ /**
5
+ * Textarea — a recessed multi-line field: the field material, 10px corners, at least 140px
6
+ * tall, full width of its column, and resizable vertically with the handle in its corner.
7
+ * Text stays ≥16px on mobile to avoid iOS zoom. Place inside `<Field>` for label + validation.
8
+ *
9
+ * Use it for anything longer than a sentence. The rule people break: setting `rows` or a
10
+ * fixed height to make it look tidy — keep the 140px minimum and let people drag it taller.
11
+ * For a textarea with a toolbar (a count, a Send button), use `InputGroupTextarea`.
12
+ */
13
+ export declare function Textarea({ className, ...props }: TextareaProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Field as BaseField } from "@base-ui/react/field";
4
+ import { sx } from "../lib/cn.js";
5
+ /**
6
+ * Textarea — a recessed multi-line field: the field material, 10px corners, at least 140px
7
+ * tall, full width of its column, and resizable vertically with the handle in its corner.
8
+ * Text stays ≥16px on mobile to avoid iOS zoom. Place inside `<Field>` for label + validation.
9
+ *
10
+ * Use it for anything longer than a sentence. The rule people break: setting `rows` or a
11
+ * fixed height to make it look tidy — keep the 140px minimum and let people drag it taller.
12
+ * For a textarea with a toolbar (a count, a Send button), use `InputGroupTextarea`.
13
+ */
14
+ export function Textarea({ className, ...props }) {
15
+ return (_jsx(BaseField.Control, { "data-slot": "textarea", render: _jsx("textarea", {}), className: sx("min-h-[140px] w-full material-field resize-y rounded-control px-3.5 py-3 font-body text-base outline-none sm:text-[15px]", className), ...props }));
16
+ }