@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,35 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Field as BaseField } from "@base-ui/react/field";
4
+ import { ChevronsUpDownIcon } from "lucide-react";
5
+ import { cn } from "../lib/cn.js";
6
+ const sizes = {
7
+ sm: "min-h-(--control-h-sm) pe-8 ps-2.5 text-[13px]",
8
+ default: "min-h-(--control-h) pe-10 ps-3.5 text-base sm:text-[15px]",
9
+ };
10
+ /**
11
+ * NativeSelect — a real `<select>` in the field material: recessed, 10px corners, 38px (30px
12
+ * dense), with the same two-way chevron as `Select`. The browser draws the option list, so it
13
+ * is the platform's own picker on phones and works before JavaScript loads.
14
+ *
15
+ * Prefer it for plain forms, long lists (countries, years) and mobile-first screens. Reach for
16
+ * `Select` when the options need custom rendering, groups with rich labels or a styled popup.
17
+ * The rule people break: styling `<option>` — browsers ignore most of it; keep options as text.
18
+ */
19
+ export function NativeSelect({ size = "default", className, wrapperClassName, children, ...props }) {
20
+ return (_jsxs("div", { "data-slot": "native-select-wrapper", "data-size": size, className: cn("group/native-select relative inline-flex w-full min-w-0", wrapperClassName), children: [_jsx(BaseField.Control, { "data-slot": "native-select", "data-size": size, render: _jsx("select", {}), className: cn("w-full min-w-0 material-field cursor-pointer appearance-none rounded-control font-body leading-none text-foreground outline-none", "disabled:cursor-not-allowed",
21
+ // An empty first option is the placeholder: show it muted while it is chosen.
22
+ "has-[option[value='']:checked]:text-control-muted",
23
+ // The listbox the browser draws follows the theme.
24
+ "[&_optgroup]:bg-field-surface [&_option]:bg-field-surface [&_option]:text-foreground", sizes[size], className), ...props, children: children }), _jsx(ChevronsUpDownIcon, { "aria-hidden": true, "data-slot": "native-select-icon", className: cn("pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground transition-colors duration-(--duration) ease-brand", "group-has-[select:disabled]/native-select:opacity-55 group-has-[select:enabled:hover]/native-select:text-foreground",
25
+ // At the end, where a select's own arrow sits: the left in a right-to-left page.
26
+ size === "sm" ? "end-2 size-3.5" : "end-3 size-4") })] }));
27
+ }
28
+ /** One `<option>`. Plain text only: browsers ignore most styling on options. */
29
+ export function NativeSelectOption(props) {
30
+ return _jsx("option", { "data-slot": "native-select-option", ...props });
31
+ }
32
+ /** A labelled group of options (`<optgroup>`). */
33
+ export function NativeSelectOptGroup(props) {
34
+ return _jsx("optgroup", { "data-slot": "native-select-optgroup", ...props });
35
+ }
@@ -0,0 +1,42 @@
1
+ import { NavigationMenu as BaseNavigationMenu } from "@base-ui/react/navigation-menu";
2
+ import * as React from "react";
3
+ /** `text`: mono links that brighten. `pill`: one raised surface glides between them. `underline`: a 1px rule does. */
4
+ export type NavigationMenuVariant = "text" | "pill" | "underline";
5
+ export interface NavigationMenuProps extends BaseNavigationMenu.Root.Props {
6
+ /** The bar's design. Default `text`. */
7
+ variant?: NavigationMenuVariant;
8
+ /** Positioner props for the shared popup: side, align, sideOffset, collisionPadding … */
9
+ positioner?: Omit<BaseNavigationMenu.Positioner.Props, "children">;
10
+ }
11
+ /**
12
+ * NavigationMenu — the site header's links, with optional dropdown panels.
13
+ *
14
+ * Top-level entries are Licht Mono 13px in `foreground-soft`, turning `foreground` on hover,
15
+ * open or current. Panels open in one shared `material-menu` popup (12px) that resizes between
16
+ * items. The popup, portal and viewport are rendered for you. The rule people break: putting
17
+ * actions ("Sign up") inside the menu — navigation goes to places; actions are `Button`s.
18
+ */
19
+ export declare function NavigationMenu({ variant, positioner, className, children, dir, ...props }: NavigationMenuProps): React.JSX.Element;
20
+ /**
21
+ * The row of top-level items. In the `pill` and `underline` designs it also draws the one
22
+ * indicator that glides between them (see `useGlide`).
23
+ */
24
+ export declare function NavigationMenuList({ className, children, ref, ...props }: BaseNavigationMenu.List.Props): React.JSX.Element;
25
+ /** One top-level entry: a `NavigationMenuLink`, or a `NavigationMenuTrigger` + `NavigationMenuContent`. */
26
+ export declare function NavigationMenuItem({ className, ...props }: BaseNavigationMenu.Item.Props): React.JSX.Element;
27
+ /** A top-level item that opens a panel. The chevron is included. */
28
+ export declare function NavigationMenuTrigger({ className, children, ...props }: BaseNavigationMenu.Trigger.Props): React.JSX.Element;
29
+ /** The panel for one trigger. It is moved into the shared popup when open. */
30
+ export declare function NavigationMenuContent({ className, ...props }: BaseNavigationMenu.Content.Props): React.JSX.Element;
31
+ export interface NavigationMenuLinkProps extends BaseNavigationMenu.Link.Props {
32
+ /**
33
+ * `bar` (default): a top-level mono link in the header row.
34
+ * `row`: a 38px+ row inside a panel — flat at rest, raised on hover and when `active`.
35
+ */
36
+ variant?: "bar" | "row";
37
+ }
38
+ /**
39
+ * A navigation link. Set `active` on the current page (it sets `aria-current="page"`).
40
+ * For client-side routing pass your router's link through `render`.
41
+ */
42
+ export declare function NavigationMenuLink({ variant, className, ...props }: NavigationMenuLinkProps): React.JSX.Element;
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { NavigationMenu as BaseNavigationMenu } from "@base-ui/react/navigation-menu";
4
+ import { ChevronDownIcon } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn, sx } from "../lib/cn.js";
7
+ import { glideMotion, useGlide, useMergedRef } from "../lib/glide.js";
8
+ import { usePopupDir } from "./_overlay.js";
9
+ const VariantContext = React.createContext("text");
10
+ /**
11
+ * NavigationMenu — the site header's links, with optional dropdown panels.
12
+ *
13
+ * Top-level entries are Licht Mono 13px in `foreground-soft`, turning `foreground` on hover,
14
+ * open or current. Panels open in one shared `material-menu` popup (12px) that resizes between
15
+ * items. The popup, portal and viewport are rendered for you. The rule people break: putting
16
+ * actions ("Sign up") inside the menu — navigation goes to places; actions are `Button`s.
17
+ */
18
+ export function NavigationMenu({ variant = "text", positioner, className, children, dir, ...props }) {
19
+ // The shared popup is portalled out of the bar: it takes the bar's direction itself.
20
+ const popupDir = usePopupDir(dir);
21
+ return (_jsxs(BaseNavigationMenu.Root, { "data-slot": "navigation-menu", "data-variant": variant, dir: dir, className: sx("relative", className), ...props, children: [_jsx(VariantContext.Provider, { value: variant, children: children }), _jsx(BaseNavigationMenu.Portal, { children: _jsx(BaseNavigationMenu.Positioner, { sideOffset: 8, collisionPadding: { top: 8, bottom: 8, left: 16, right: 16 }, collisionAvoidance: { side: "none" }, dir: popupDir, ...positioner, className: sx([
22
+ "z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) outline-none",
23
+ "transition-[top,left,right,bottom] duration-(--duration) ease-(--ease) data-instant:transition-none",
24
+ // Hover bridge across the side offset so the pointer can travel into the popup.
25
+ "before:absolute before:content-[''] data-[side=bottom]:before:inset-x-0 data-[side=bottom]:before:-top-2 data-[side=bottom]:before:h-2 data-[side=top]:before:inset-x-0 data-[side=top]:before:-bottom-2 data-[side=top]:before:h-2",
26
+ ], positioner?.className), children: _jsx(BaseNavigationMenu.Popup, { "data-slot": "navigation-menu-popup", className: [
27
+ "relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-button material-menu outline-none",
28
+ "transition-[opacity,scale,width,height] duration-(--duration) ease-(--ease)",
29
+ "data-ending-style:scale-[0.97] data-ending-style:opacity-0 data-starting-style:scale-[0.97] data-starting-style:opacity-0",
30
+ ].join(" "), children: _jsx(BaseNavigationMenu.Viewport, { "data-slot": "navigation-menu-viewport", className: "relative h-full w-full overflow-hidden" }) }) }) })] }));
31
+ }
32
+ const BAR = ':is([data-slot="navigation-menu-trigger"], [data-slot="navigation-menu-link"][data-variant="bar"])';
33
+ /** The item the pill or underline covers: the open trigger, else the pointed or focused item, else the current page. */
34
+ const lit = (root) => root.querySelector('[data-slot="navigation-menu-trigger"][data-popup-open]') ??
35
+ root.querySelector(`${BAR}:is(:hover, :focus-visible)`) ??
36
+ root.querySelector(`${BAR}:is([data-active], [aria-current="page"])`);
37
+ /**
38
+ * The row of top-level items. In the `pill` and `underline` designs it also draws the one
39
+ * indicator that glides between them (see `useGlide`).
40
+ */
41
+ export function NavigationMenuList({ className, children, ref, ...props }) {
42
+ const variant = React.useContext(VariantContext);
43
+ const [listRef, setRef] = useMergedRef(ref);
44
+ const glide = useGlide(listRef, lit, {
45
+ enabled: variant !== "text",
46
+ attributes: ["data-popup-open", "data-active", "aria-current"],
47
+ events: ["pointerover", "pointerout", "focusin", "focusout"],
48
+ items: '[data-slot="navigation-menu-item"]',
49
+ // Crossing the gap between two items keeps the indicator, so it glides instead of blinking.
50
+ linger: 120,
51
+ });
52
+ const rect = glide.rect;
53
+ return (_jsxs(BaseNavigationMenu.List, { ref: setRef, "data-slot": "navigation-menu-list",
54
+ // Too narrow for every item: the row wraps rather than running off the screen.
55
+ className: sx("relative m-0 flex list-none flex-wrap items-center gap-1 p-0", className), ...props, children: [variant !== "text" && (_jsx("span", { "aria-hidden": true, "data-slot": "navigation-menu-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, variant === "pill"
56
+ ? "rounded-button bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised"
57
+ : "h-px bg-foreground"), style: rect
58
+ ? variant === "pill"
59
+ ? { translate: `${rect.x}px ${rect.y}px`, width: rect.width, height: rect.height }
60
+ : // The rule sits on the item's bottom edge, in whichever row the item is.
61
+ { translate: `${rect.x}px ${rect.y + rect.height - 1}px`, width: rect.width }
62
+ : undefined })), children] }));
63
+ }
64
+ /** One top-level entry: a `NavigationMenuLink`, or a `NavigationMenuTrigger` + `NavigationMenuContent`. */
65
+ export function NavigationMenuItem({ className, ...props }) {
66
+ return _jsx(BaseNavigationMenu.Item, { "data-slot": "navigation-menu-item", className: className, ...props });
67
+ }
68
+ // `relative`: the items paint above the list's gliding indicator.
69
+ const barItem = [
70
+ "relative gap-1.5 px-3 inline-flex min-h-(--control-h) cursor-pointer items-center rounded-button font-mono text-[13px] leading-none whitespace-nowrap text-foreground-soft no-underline focus-ring select-none",
71
+ "transition-colors duration-(--duration) ease-(--ease) hover:text-foreground",
72
+ "data-active:text-foreground data-popup-open:text-foreground aria-[current=page]:text-foreground",
73
+ "data-disabled:pointer-events-none data-disabled:opacity-50",
74
+ ].join(" ");
75
+ /** A top-level item that opens a panel. The chevron is included. */
76
+ export function NavigationMenuTrigger({ className, children, ...props }) {
77
+ return (_jsxs(BaseNavigationMenu.Trigger, { "data-slot": "navigation-menu-trigger", className: sx(barItem, className), ...props, children: [children, _jsx(BaseNavigationMenu.Icon, { "data-slot": "navigation-menu-icon", className: "flex transition-[rotate] duration-(--duration) ease-(--ease) data-popup-open:rotate-180", children: _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3.5" }) })] }));
78
+ }
79
+ /** The panel for one trigger. It is moved into the shared popup when open. */
80
+ export function NavigationMenuContent({ className, ...props }) {
81
+ return (_jsx(BaseNavigationMenu.Content, { "data-slot": "navigation-menu-content", className: sx([
82
+ "w-[calc(100vw-32px)] p-2 sm:w-max sm:max-w-[520px]",
83
+ "transition-[opacity,translate] duration-(--duration) ease-(--ease)",
84
+ "data-ending-style:opacity-0 data-starting-style:opacity-0",
85
+ "data-starting-style:data-[activation-direction=left]:-translate-x-1/4 data-starting-style:data-[activation-direction=right]:translate-x-1/4",
86
+ "data-ending-style:data-[activation-direction=left]:translate-x-1/4 data-ending-style:data-[activation-direction=right]:-translate-x-1/4",
87
+ ], className), ...props }));
88
+ }
89
+ /**
90
+ * A navigation link. Set `active` on the current page (it sets `aria-current="page"`).
91
+ * For client-side routing pass your router's link through `render`.
92
+ */
93
+ export function NavigationMenuLink({ variant = "bar", className, ...props }) {
94
+ return (_jsx(BaseNavigationMenu.Link, { "data-slot": "navigation-menu-link", "data-variant": variant, className: sx(variant === "bar"
95
+ ? barItem
96
+ : "flex min-h-(--control-h) flex-col justify-center gap-1 rounded-button material-row px-3 py-2.5 font-body text-sm no-underline focus-ring [&_small]:text-[13px] [&_small]:leading-snug [&_small]:text-muted-foreground", className), ...props }));
97
+ }
@@ -0,0 +1,36 @@
1
+ import { NumberField as BaseNumberField } from "@base-ui/react/number-field";
2
+ import * as React from "react";
3
+ declare const groupSizes: {
4
+ readonly sm: "min-h-(--control-h-sm) p-0.5";
5
+ readonly default: "min-h-(--control-h) p-[3px]";
6
+ };
7
+ export interface NumberFieldProps extends BaseNumberField.Root.Props {
8
+ /** `sm` (30px) for dense surfaces; `default` (38px) everywhere else. */
9
+ size?: keyof typeof groupSizes;
10
+ /**
11
+ * A visible label rendered as a scrub area: drag across it horizontally to change the value.
12
+ * Omit it when the field already sits under a `<FieldLabel>`.
13
+ */
14
+ label?: React.ReactNode;
15
+ /** Placeholder for the input while it is empty. */
16
+ placeholder?: string;
17
+ /**
18
+ * `sides`: a round − before the number and a + after it, the number centred. `stacked`: the
19
+ * number at the start like an Input's text, with ▲ and ▼ stacked at the end of the field.
20
+ */
21
+ steppers?: "sides" | "stacked";
22
+ /** Accessible names for the steppers. */
23
+ decrementLabel?: string;
24
+ incrementLabel?: string;
25
+ }
26
+ /**
27
+ * NumberField — a recessed field for exact numbers, with raised −/+ steppers and mono, tabular
28
+ * digits so values do not jitter as they change.
29
+ *
30
+ * Use it for counts, quantities and amounts where the exact value matters. Pass `format`
31
+ * (`Intl.NumberFormatOptions`) for currency or units instead of typing them into the label.
32
+ * The rule people break: no `min`/`max` — set the bounds so the steppers stop where the
33
+ * business rule does.
34
+ */
35
+ export declare function NumberField({ size, steppers, label, placeholder, decrementLabel, incrementLabel, id: idProp, className, value: valueProp, defaultValue, onValueChange, ...props }: NumberFieldProps): React.JSX.Element;
36
+ export {};
@@ -0,0 +1,153 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { NumberField as BaseNumberField } from "@base-ui/react/number-field";
4
+ import { ChevronDownIcon, ChevronUpIcon, MinusIcon, MoveHorizontalIcon, PlusIcon } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn, sx } from "../lib/cn.js";
7
+ import { DigitRoll, reducedMotion } from "../lib/digit-roll.js";
8
+ const groupSizes = {
9
+ sm: "min-h-(--control-h-sm) p-0.5",
10
+ default: "min-h-(--control-h) p-[3px]",
11
+ };
12
+ const stepperSizes = {
13
+ sm: "size-(--control-inset-sm) material-row",
14
+ default: "size-(--control-inset) material-raised",
15
+ };
16
+ /** The stacked pair: one key split in two, as tall as a side stepper, the halves meeting square. */
17
+ const stackSizes = {
18
+ sm: "h-(--control-inset-sm) w-5",
19
+ default: "h-(--control-inset) w-6",
20
+ };
21
+ /**
22
+ * The number starts where an Input's text does: its padding, less the group's inset — at the
23
+ * left, or at the right in a right-to-left field, with the steppers at the other end.
24
+ */
25
+ const stackedInput = { sm: "text-start ps-2", default: "text-start ps-[11px]" };
26
+ /**
27
+ * The digit roll over it. The roll is always laid out left to right, so its digits keep their
28
+ * order, which leaves its start on the left: in a right-to-left field it is moved to the right.
29
+ */
30
+ const stackedRoll = {
31
+ sm: "justify-start pl-2 [:dir(rtl)>&]:justify-end [:dir(rtl)>&]:pr-2 [:dir(rtl)>&]:pl-0",
32
+ default: "justify-start pl-[11px] [:dir(rtl)>&]:justify-end [:dir(rtl)>&]:pr-[11px] [:dir(rtl)>&]:pl-0",
33
+ };
34
+ /** Keys that step the value without editing the text: they leave a hidden caret hidden. */
35
+ const STEP_KEYS = new Set([
36
+ "ArrowUp",
37
+ "ArrowDown",
38
+ "PageUp",
39
+ "PageDown",
40
+ "Home",
41
+ "End",
42
+ "Shift",
43
+ "Alt",
44
+ "Control",
45
+ "Meta",
46
+ "Tab",
47
+ "Escape",
48
+ ]);
49
+ /**
50
+ * Changes that step the value — the steppers, keys, wheel and scrubbing the label roll the digits;
51
+ * typing, pasting and blur formatting don't.
52
+ */
53
+ const STEP_REASONS = new Set(["increment-press", "decrement-press", "keyboard", "wheel", "scrub"]);
54
+ /**
55
+ * NumberField — a recessed field for exact numbers, with raised −/+ steppers and mono, tabular
56
+ * digits so values do not jitter as they change.
57
+ *
58
+ * Use it for counts, quantities and amounts where the exact value matters. Pass `format`
59
+ * (`Intl.NumberFormatOptions`) for currency or units instead of typing them into the label.
60
+ * The rule people break: no `min`/`max` — set the bounds so the steppers stop where the
61
+ * business rule does.
62
+ */
63
+ export function NumberField({ size = "default", steppers = "sides", label, placeholder, decrementLabel = "Decrease", incrementLabel = "Increase", id: idProp, className, value: valueProp, defaultValue, onValueChange, ...props }) {
64
+ const generatedId = React.useId();
65
+ const id = idProp ?? generatedId;
66
+ const textSize = size === "sm" ? "text-[13px]" : "text-base sm:text-[15px]";
67
+ const stacked = steppers === "stacked";
68
+ // The roll overlay sits where the input's text does.
69
+ const textAlign = stacked ? stackedRoll[size] : "";
70
+ /*
71
+ * Uncontrolled, the value is kept here rather than inside Base UI, which has no reset of its own:
72
+ * a form's reset puts the default back, as it does a native input's.
73
+ */
74
+ const controlled = valueProp !== undefined;
75
+ const [own, setOwn] = React.useState(defaultValue ?? null);
76
+ const value = controlled ? valueProp : own;
77
+ const input = React.useRef(null);
78
+ const reset = React.useRef(() => { });
79
+ reset.current = () => {
80
+ if (!controlled)
81
+ setOwn(defaultValue ?? null);
82
+ };
83
+ React.useEffect(() => {
84
+ const form = input.current?.form;
85
+ if (!form)
86
+ return;
87
+ const onReset = () => reset.current();
88
+ form.addEventListener("reset", onReset);
89
+ return () => form.removeEventListener("reset", onReset);
90
+ }, []);
91
+ /* The digit roll: remember the text and direction of a step, read the new text once it renders. */
92
+ const pending = React.useRef(null);
93
+ const [roll, setRoll] = React.useState(null);
94
+ // A step re-renders this wrapper so the effect below runs, even if a controlling parent doesn't.
95
+ const [, setStepped] = React.useState(0);
96
+ const endRoll = React.useCallback(() => setRoll(null), []);
97
+ React.useLayoutEffect(() => {
98
+ const step = pending.current;
99
+ const el = input.current;
100
+ if (!step || !el)
101
+ return;
102
+ pending.current = null;
103
+ if (el.value !== step.from)
104
+ setRoll({ from: step.from, to: el.value, dir: step.dir, key: performance.now() });
105
+ });
106
+ /*
107
+ * The caret. A mouse press on a stepper or the scrub label moves focus into the input (Base UI
108
+ * does this so the arrow keys keep stepping), but a blinking caret there reads as "type here".
109
+ * It stays hidden until the number itself is clicked or the text is edited.
110
+ */
111
+ const [caretHidden, setCaretHidden] = React.useState(false);
112
+ const hideCaret = (e) => {
113
+ if (e.pointerType !== "touch")
114
+ setCaretHidden(true);
115
+ };
116
+ const showCaret = () => setCaretHidden(false);
117
+ const handleValueChange = (next, details) => {
118
+ const before = value;
119
+ if (input.current &&
120
+ STEP_REASONS.has(details.reason) &&
121
+ next != null &&
122
+ before != null &&
123
+ next !== before &&
124
+ !reducedMotion()) {
125
+ // During a running roll the input text is the value it is rolling to: the next roll starts there.
126
+ pending.current = { from: input.current.value, dir: next > before ? 1 : -1 };
127
+ setStepped((n) => n + 1);
128
+ }
129
+ onValueChange?.(next, details);
130
+ if (!controlled && !details.isCanceled)
131
+ setOwn(next);
132
+ };
133
+ const stepper = cn("inline-flex shrink-0 cursor-pointer items-center justify-center text-foreground focus-ring", "data-disabled:pointer-events-none data-disabled:opacity-50");
134
+ // Stacked, the halves keep the key's 7px outer corners and meet square in the middle.
135
+ const decrement = (_jsx(BaseNumberField.Decrement, { "data-slot": "number-field-decrement", "aria-label": decrementLabel, onPointerDown: hideCaret, className: cn(stepper, stacked
136
+ ? cn("min-h-0 w-full flex-1 rounded-b-item [&_svg]:size-3", size === "sm" ? "material-row" : "material-raised")
137
+ : cn("rounded-full [&_svg]:size-3.5", stepperSizes[size])), children: stacked ? _jsx(ChevronDownIcon, {}) : _jsx(MinusIcon, {}) }));
138
+ const increment = (_jsx(BaseNumberField.Increment, { "data-slot": "number-field-increment", "aria-label": incrementLabel, onPointerDown: hideCaret, className: cn(stepper, stacked
139
+ ? cn("min-h-0 w-full flex-1 rounded-t-item [&_svg]:size-3", size === "sm" ? "material-row" : "material-raised")
140
+ : cn("rounded-full [&_svg]:size-3.5", stepperSizes[size])), children: stacked ? _jsx(ChevronUpIcon, {}) : _jsx(PlusIcon, {}) }));
141
+ return (_jsxs(BaseNumberField.Root, { "data-slot": "number-field", "data-size": size, "data-steppers": steppers, id: id, className: sx("flex flex-col items-start gap-2", className), value: value, onValueChange: handleValueChange, ...props, children: [label != null && (_jsxs(BaseNumberField.ScrubArea, { "data-slot": "number-field-scrub-area", onPointerDown: hideCaret, className: "cursor-ew-resize select-none data-disabled:cursor-not-allowed data-disabled:opacity-55", children: [_jsx("label", { htmlFor: id, className: "cursor-ew-resize text-sm leading-snug font-medium text-foreground select-none", children: label }), _jsx(BaseNumberField.ScrubAreaCursor, { className: "text-foreground drop-shadow-[0_1px_1px_#0006]", children: _jsx(MoveHorizontalIcon, { className: "size-5" }) })] })), _jsxs(BaseNumberField.Group, { "data-slot": "number-field-group", className: cn("flex w-full material-field items-center gap-1 rounded-control",
142
+ // The whole group already dims when disabled; do not dim the steppers twice.
143
+ "data-disabled:[&_button]:opacity-100", groupSizes[size]), children: [!stacked && decrement, _jsxs("span", { className: "relative flex min-w-0 flex-1 items-center self-stretch", children: [_jsx(BaseNumberField.Input, { ref: input, "data-slot": "number-field-input", placeholder: placeholder, onPointerDown: showCaret, onBlur: showCaret, onKeyDown: (e) => {
144
+ // While an IME composes (229 marks it in Safari), its keys pick characters: they
145
+ // don't step, or commit a half-typed number.
146
+ if (e.nativeEvent.isComposing || e.keyCode === 229)
147
+ return e.preventBaseUIHandler();
148
+ if (caretHidden && !STEP_KEYS.has(e.key))
149
+ showCaret();
150
+ }, className: cn("w-full min-w-0 bg-transparent font-mono text-foreground tabular-nums outline-none placeholder:text-control-muted", stacked ? stackedInput[size] : "text-center", caretHidden ? "caret-transparent" : "caret-foreground", textSize,
151
+ // While the digits roll, the overlay draws them; the input keeps its caret and value.
152
+ roll && "text-transparent") }), roll && (_jsx(DigitRoll, { roll: roll, slot: "number-field-roll", className: cn(textSize, textAlign), onDone: endRoll }, roll.key))] }), stacked ? (_jsxs("span", { "data-slot": "number-field-steppers", className: cn("flex shrink-0 flex-col", stackSizes[size]), children: [increment, decrement] })) : (increment)] })] }));
153
+ }
@@ -0,0 +1,35 @@
1
+ import { OTPField as BaseOTPField } from "@base-ui/react/otp-field";
2
+ import * as React from "react";
3
+ declare const slotSizes: {
4
+ readonly default: "h-(--control-h) max-w-(--control-h) text-base";
5
+ readonly lg: "h-(--control-h-lg) max-w-(--control-h-lg) text-lg";
6
+ };
7
+ type OtpFieldSize = keyof typeof slotSizes;
8
+ export interface OtpFieldProps extends BaseOTPField.Root.Props {
9
+ /** `default` 38px slots; `lg` 46px slots for a code entry that is the whole screen. */
10
+ size?: OtpFieldSize;
11
+ /**
12
+ * Split the generated slots into chunks of this many, with a separator between them
13
+ * (`3` renders a 6-digit code as 123 – 456). Ignored when you pass your own children.
14
+ */
15
+ groupSize?: number;
16
+ ref?: React.Ref<HTMLDivElement>;
17
+ }
18
+ /**
19
+ * OtpField — a one-time code entry: one recessed square per character, mono digits.
20
+ *
21
+ * With no children it renders `length` slots for you, labelled "Character n of N" after the
22
+ * first. Label it with `<FieldLabel>` inside a `<Field>` (or a native `<label htmlFor={id}>`)
23
+ * and say where the code was sent in a `<FieldDescription>`. The rule people break: hiding
24
+ * paste — users copy codes from email, so never block it or split it across separate fields.
25
+ * The focus ring is one indicator that glides from slot to slot as the code is typed or erased.
26
+ * The slots read left to right on a right-to-left page too, as the code does in the message.
27
+ */
28
+ export declare function OtpField({ size, groupSize, length, className, children, ref, value: valueProp, defaultValue, onValueChange, ...props }: OtpFieldProps): React.JSX.Element;
29
+ export interface OtpFieldSlotProps extends BaseOTPField.Input.Props {
30
+ }
31
+ /** One character slot. Use directly only for custom layouts; `OtpField` renders them by default. */
32
+ export declare function OtpFieldSlot({ className, ...props }: OtpFieldSlotProps): React.JSX.Element;
33
+ /** A short rule between groups of slots. Decorative for sighted users, announced as a separator. */
34
+ export declare function OtpFieldSeparator({ className, ...props }: React.ComponentProps<typeof BaseOTPField.Separator>): React.JSX.Element;
35
+ export {};
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { DirectionProvider } from "@base-ui/react/direction-provider";
4
+ import { OTPField as BaseOTPField } from "@base-ui/react/otp-field";
5
+ import * as React from "react";
6
+ import { cn, sx } from "../lib/cn.js";
7
+ import { glideMotion, glideStyle, useGlide, useMergedRef } from "../lib/glide.js";
8
+ const SLOT = '[data-slot="otp-field-slot"]';
9
+ const findFocused = (root) => root.querySelector(`${SLOT}:focus`);
10
+ /* Square while there is room; narrower (never shorter) where the row has less, as on a phone. */
11
+ const slotSizes = {
12
+ default: "h-(--control-h) max-w-(--control-h) text-base",
13
+ lg: "h-(--control-h-lg) max-w-(--control-h-lg) text-lg",
14
+ };
15
+ const SizeContext = React.createContext("default");
16
+ /**
17
+ * OtpField — a one-time code entry: one recessed square per character, mono digits.
18
+ *
19
+ * With no children it renders `length` slots for you, labelled "Character n of N" after the
20
+ * first. Label it with `<FieldLabel>` inside a `<Field>` (or a native `<label htmlFor={id}>`)
21
+ * and say where the code was sent in a `<FieldDescription>`. The rule people break: hiding
22
+ * paste — users copy codes from email, so never block it or split it across separate fields.
23
+ * The focus ring is one indicator that glides from slot to slot as the code is typed or erased.
24
+ * The slots read left to right on a right-to-left page too, as the code does in the message.
25
+ */
26
+ export function OtpField({ size = "default", groupSize, length, className, children, ref, value: valueProp, defaultValue, onValueChange, ...props }) {
27
+ const [rootRef, setRootRef] = useMergedRef(ref);
28
+ const glide = useGlide(rootRef, findFocused, { events: ["focusin", "focusout"], items: SLOT });
29
+ /*
30
+ * Uncontrolled, the code is kept here rather than inside Base UI, which has no reset of its own:
31
+ * a form's reset puts the default back, as it does a native input's.
32
+ */
33
+ const controlled = valueProp !== undefined;
34
+ const [own, setOwn] = React.useState(defaultValue ?? "");
35
+ const reset = React.useRef(() => { });
36
+ reset.current = () => {
37
+ if (!controlled)
38
+ setOwn(defaultValue ?? "");
39
+ };
40
+ React.useEffect(() => {
41
+ const form = rootRef.current?.querySelector("input")?.form;
42
+ if (!form)
43
+ return;
44
+ const onReset = () => reset.current();
45
+ form.addEventListener("reset", onReset);
46
+ return () => form.removeEventListener("reset", onReset);
47
+ }, [rootRef]);
48
+ let content = children;
49
+ if (content == null) {
50
+ const slots = Array.from({ length }, (_, index) => (_jsx(OtpFieldSlot, { "aria-label": index === 0 ? undefined : `Character ${index + 1} of ${length}` }, index)));
51
+ if (groupSize && groupSize > 0 && groupSize < length) {
52
+ const chunks = [];
53
+ for (let start = 0; start < length; start += groupSize) {
54
+ if (start > 0)
55
+ chunks.push(_jsx(OtpFieldSeparator, {}, `separator-${start}`));
56
+ chunks.push(_jsx("div", { "data-slot": "otp-field-group", className: "flex min-w-0 gap-2", children: slots.slice(start, start + groupSize) }, `group-${start}`));
57
+ }
58
+ content = chunks;
59
+ }
60
+ else {
61
+ content = slots;
62
+ }
63
+ }
64
+ return (_jsx(SizeContext.Provider, { value: size, children: _jsxs(BaseOTPField.Root, { "data-slot": "otp-field", "data-size": size, "data-glide": glide.visible ? "" : undefined, ref: setRootRef, length: length, value: controlled ? valueProp : own, onValueChange: (next, details) => {
65
+ onValueChange?.(next, details);
66
+ if (!controlled && !details.isCanceled)
67
+ setOwn(next);
68
+ },
69
+ // A code reads left to right, as in the email it came in, also on a right-to-left page:
70
+ // the slots keep that order, and sit at the field's start (the right) there.
71
+ dir: "ltr", className: sx("group/otp relative flex min-w-0 items-center gap-2 data-disabled:opacity-55 [:dir(rtl)>&]:justify-end", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "otp-field-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-control border border-control-focus outline-2 outline-control-focus duration-[calc(var(--duration)*1.3)]"), style: glideStyle(glide) }), _jsx(DirectionProvider, { direction: "ltr", children: content })] }) }));
72
+ }
73
+ /** One character slot. Use directly only for custom layouts; `OtpField` renders them by default. */
74
+ export function OtpFieldSlot({ className, ...props }) {
75
+ const size = React.useContext(SizeContext);
76
+ return (_jsx(BaseOTPField.Input, { "data-slot": "otp-field-slot", className: sx([
77
+ "m-0 material-field rounded-control p-0 text-center font-mono text-foreground tabular-nums caret-transparent",
78
+ // A percentage width with a cap: 38px (46px) where it fits, and a share of a narrower row
79
+ // — a form control's percentage width doesn't count towards the row's minimum width, so
80
+ // eight slots on a 360px phone narrow instead of pushing the page sideways.
81
+ "w-full min-w-0",
82
+ "data-disabled:cursor-not-allowed",
83
+ // A filled slot selects its character on focus so typing replaces it; the focus ring
84
+ // already marks the slot, so the selection itself stays unpainted.
85
+ "selection:bg-transparent selection:text-foreground",
86
+ // The gliding indicator draws the focus ring once it is placed.
87
+ "group-data-glide/otp:focus:border-field-edge group-data-glide/otp:focus:outline-none",
88
+ slotSizes[size],
89
+ ], className), ...props }));
90
+ }
91
+ /** A short rule between groups of slots. Decorative for sighted users, announced as a separator. */
92
+ export function OtpFieldSeparator({ className, ...props }) {
93
+ return (_jsx(BaseOTPField.Separator, { "data-slot": "otp-field-separator", className: sx("h-px w-3 shrink-0 bg-field-edge", className), ...props }));
94
+ }
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ export interface PaginationProps extends Omit<React.ComponentProps<"nav">, "onChange"> {
3
+ /** The current page, 1-based. */
4
+ page: number;
5
+ /** Total number of pages. */
6
+ pageCount: number;
7
+ /** Called with the new page. Omit when every page is a link (`getHref`). */
8
+ onPageChange?: (page: number) => void;
9
+ /** Render pages as links instead of buttons. */
10
+ getHref?: (page: number) => string;
11
+ /** Pages shown on each side of the current one. Defaults to 1. */
12
+ siblingCount?: number;
13
+ /** `sm` 30px for dense tables and admin screens; `default` 38px. */
14
+ size?: "sm" | "default";
15
+ /** Accessible names. */
16
+ labels?: {
17
+ nav?: string;
18
+ previous?: string;
19
+ next?: string;
20
+ page?: (page: number) => string;
21
+ };
22
+ }
23
+ /**
24
+ * Pagination — move through a long list one page at a time.
25
+ *
26
+ * Raised 30 or 38px squares with mono, tabular numbers. The current page is raised on the
27
+ * hovered fill and carries the `--control-focus` edge, which glides to the new page on change. The rule people break: paginating
28
+ * something short. Under ~50 rows, show them all; a table with `dense` rows is easier to scan
29
+ * than a page switcher.
30
+ */
31
+ export declare function Pagination({ page, pageCount, onPageChange, getHref, siblingCount, size, labels, className, ref, ...props }: PaginationProps): React.JSX.Element;
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { glideMotion, glideStyle, useGlide, useMergedRef } from "../lib/glide.js";
7
+ import { Button } from "./button.js";
8
+ const PAGE = '[data-slot="pagination-page"]';
9
+ const findCurrent = (nav) => nav.querySelector(`${PAGE}[aria-current="page"]`);
10
+ function getPages(page, count, siblings) {
11
+ // first, last, current ± siblings, two ellipses → a constant width
12
+ const total = siblings * 2 + 5;
13
+ if (count <= total)
14
+ return Array.from({ length: count }, (_, i) => i + 1);
15
+ const start = Math.max(2, page - siblings);
16
+ const end = Math.min(count - 1, page + siblings);
17
+ const showStart = start > 3;
18
+ const showEnd = end < count - 2;
19
+ const range = (a, b) => Array.from({ length: b - a + 1 }, (_, i) => a + i);
20
+ if (!showStart && showEnd)
21
+ return [...range(1, siblings * 2 + 3), "ellipsis-end", count];
22
+ if (showStart && !showEnd)
23
+ return [1, "ellipsis-start", ...range(count - (siblings * 2 + 2), count)];
24
+ return [1, "ellipsis-start", ...range(start, end), "ellipsis-end", count];
25
+ }
26
+ /**
27
+ * Pagination — move through a long list one page at a time.
28
+ *
29
+ * Raised 30 or 38px squares with mono, tabular numbers. The current page is raised on the
30
+ * hovered fill and carries the `--control-focus` edge, which glides to the new page on change. The rule people break: paginating
31
+ * something short. Under ~50 rows, show them all; a table with `dense` rows is easier to scan
32
+ * than a page switcher.
33
+ */
34
+ export function Pagination({ page, pageCount, onPageChange, getHref, siblingCount = 1, size = "default", labels, className, ref, ...props }) {
35
+ const [navRef, setNavRef] = useMergedRef(ref);
36
+ const glide = useGlide(navRef, findCurrent, { attributes: ["aria-current"], items: PAGE });
37
+ // A count straight from a division (95 rows / 10) rounds up; one that is not a number yet, or
38
+ // not finite (a page size of 0), or below zero is no pages at all.
39
+ const count = Number.isFinite(pageCount)
40
+ ? Math.min(Math.max(Math.ceil(pageCount), 0), Number.MAX_SAFE_INTEGER)
41
+ : 0;
42
+ // A page outside 1…pageCount (a filter shrank the list under it), or not a whole number, shows as
43
+ // the nearest one, so a page still reads as current and Previous and Next still lead somewhere.
44
+ // Choosing a page reports it whenever it differs from `page` itself.
45
+ const current = Number.isNaN(page) ? 1 : Math.min(Math.max(Math.floor(page), 1), Math.max(count, 1));
46
+ const siblings = siblingCount >= 0 ? Math.floor(siblingCount) : 1;
47
+ const pages = getPages(current, count, siblings);
48
+ const square = size === "sm" ? "min-w-(--control-h-sm) px-2" : "min-w-(--control-h) px-2.5";
49
+ const pageLabel = labels?.page ?? ((p) => `Page ${p}`);
50
+ const control = (target, content, extra) => {
51
+ const disabled = target < 1 || target > count;
52
+ const asLink = getHref && !disabled;
53
+ return (_jsx(Button, { variant: "secondary", size: size, disabled: disabled,
54
+ // Previous and Next stay focusable when they run out, so pressing Next onto the last
55
+ // page leaves keyboard focus on it instead of dropping it to the page.
56
+ focusableWhenDisabled: true, nativeButton: !asLink, render: asLink ? _jsx("a", { href: getHref(target) }) : undefined, onClick: () => !disabled && target !== page && onPageChange?.(target), className: cn(square, "font-mono text-[13px] font-normal tabular-nums"), ...extra, children: content }));
57
+ };
58
+ return (_jsxs("nav", { "aria-label": labels?.nav ?? "Pagination", "data-slot": "pagination", "data-size": size, "data-glide": glide.visible ? "" : undefined, ref: setNavRef, className: cn("group/pagination relative flex", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "pagination-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-button ring-1 ring-control-focus duration-[calc(var(--duration)*1.3)]"), style: glideStyle(glide) }), _jsxs("ul", { className: "m-0 flex list-none flex-wrap items-center gap-1.5 p-0", children: [_jsx("li", { children: control(current - 1, _jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }), {
59
+ "aria-label": labels?.previous ?? "Previous page",
60
+ }) }), pages.map((p) => typeof p === "number" ? (_jsx("li", { children: control(p, p, {
61
+ "aria-label": pageLabel(p),
62
+ "aria-current": p === current ? "page" : undefined,
63
+ "data-slot": "pagination-page",
64
+ className: cn(square, "font-mono text-[13px] font-normal tabular-nums", "aria-[current=page]:bg-control-hover aria-[current=page]:shadow-raised-current",
65
+ // The gliding indicator carries the focus edge once it is placed.
66
+ "group-data-glide/pagination:aria-[current=page]:shadow-raised"),
67
+ }) }, p)) : (_jsx("li", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("inline-flex items-center justify-center font-mono text-[13px] text-muted-foreground", square), children: "\u2026" }, p))), _jsx("li", { children: control(current + 1, _jsx(ChevronRightIcon, { className: "rtl:-scale-x-100" }), {
68
+ "aria-label": labels?.next ?? "Next page",
69
+ }) })] })] }));
70
+ }