@slashsuite/ui-react 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/MIGRATING.md +386 -8
  2. package/README.md +89 -44
  3. package/agent-docs/components/app-shell.md +9 -6
  4. package/agent-docs/components/article-layout.md +140 -0
  5. package/agent-docs/components/audio.md +42 -0
  6. package/agent-docs/components/badge.md +2 -1
  7. package/agent-docs/components/body-text.md +26 -15
  8. package/agent-docs/components/bottom-sheet.md +27 -17
  9. package/agent-docs/components/breadcrumbs.md +10 -6
  10. package/agent-docs/components/button.md +2 -2
  11. package/agent-docs/components/call-to-action.md +59 -0
  12. package/agent-docs/components/callout.md +4 -3
  13. package/agent-docs/components/card-grid.md +15 -7
  14. package/agent-docs/components/card.md +33 -18
  15. package/agent-docs/components/cart-button.md +63 -0
  16. package/agent-docs/components/chat-composer.md +4 -3
  17. package/agent-docs/components/checkbox.md +11 -5
  18. package/agent-docs/components/cluster.md +10 -8
  19. package/agent-docs/components/code-example.md +2 -2
  20. package/agent-docs/components/code.md +7 -5
  21. package/agent-docs/components/colour-scheme-toggle.md +12 -6
  22. package/agent-docs/components/colour-swatch.md +41 -0
  23. package/agent-docs/components/combobox.md +88 -0
  24. package/agent-docs/components/confirm-dialog.md +98 -0
  25. package/agent-docs/components/container.md +2 -1
  26. package/agent-docs/components/copy-button.md +7 -5
  27. package/agent-docs/components/copy-line.md +6 -5
  28. package/agent-docs/components/date-field.md +14 -11
  29. package/agent-docs/components/date-range-picker.md +16 -9
  30. package/agent-docs/components/date-time-field.md +73 -0
  31. package/agent-docs/components/dialog.md +22 -68
  32. package/agent-docs/components/disclosure.md +4 -0
  33. package/agent-docs/components/docs-layout.md +10 -6
  34. package/agent-docs/components/drawer.md +13 -4
  35. package/agent-docs/components/embed-frame.md +48 -0
  36. package/agent-docs/components/empty-state.md +4 -1
  37. package/agent-docs/components/field-dialog.md +6 -5
  38. package/agent-docs/components/field.md +10 -7
  39. package/agent-docs/components/fieldset.md +4 -4
  40. package/agent-docs/components/flow-diagram.md +87 -0
  41. package/agent-docs/components/form-layout.md +4 -1
  42. package/agent-docs/components/form-row.md +7 -7
  43. package/agent-docs/components/full-bleed-layout.md +0 -2
  44. package/agent-docs/components/headings.md +13 -7
  45. package/agent-docs/components/hero.md +11 -2
  46. package/agent-docs/components/icon-button.md +1 -3
  47. package/agent-docs/components/icon.md +6 -13
  48. package/agent-docs/components/image.md +24 -14
  49. package/agent-docs/components/input.md +8 -7
  50. package/agent-docs/components/key-value-list.md +4 -1
  51. package/agent-docs/components/lightbox.md +1 -1
  52. package/agent-docs/components/list-layout.md +5 -7
  53. package/agent-docs/components/list-row.md +37 -34
  54. package/agent-docs/components/loading.md +2 -2
  55. package/agent-docs/components/markdown.md +13 -13
  56. package/agent-docs/components/media-tile.md +8 -4
  57. package/agent-docs/components/menu.md +19 -12
  58. package/agent-docs/components/meta-list.md +2 -2
  59. package/agent-docs/components/morph.md +11 -5
  60. package/agent-docs/components/navigation-progress.md +2 -2
  61. package/agent-docs/components/number-field.md +75 -0
  62. package/agent-docs/components/outline-region.md +19 -8
  63. package/agent-docs/components/page-fade.md +2 -1
  64. package/agent-docs/components/pill.md +7 -6
  65. package/agent-docs/components/popover.md +63 -0
  66. package/agent-docs/components/price.md +49 -0
  67. package/agent-docs/components/product-tile.md +78 -0
  68. package/agent-docs/components/promo-banner.md +46 -0
  69. package/agent-docs/components/prose-layout.md +1 -1
  70. package/agent-docs/components/radio-group.md +9 -6
  71. package/agent-docs/components/scroll-strip.md +3 -3
  72. package/agent-docs/components/segmented-control.md +4 -2
  73. package/agent-docs/components/select.md +8 -3
  74. package/agent-docs/components/show.md +2 -2
  75. package/agent-docs/components/side-column.md +13 -9
  76. package/agent-docs/components/sidebar-layout.md +1 -1
  77. package/agent-docs/components/site-footer.md +4 -4
  78. package/agent-docs/components/site-search.md +21 -9
  79. package/agent-docs/components/slider.md +59 -0
  80. package/agent-docs/components/sortable-list.md +15 -10
  81. package/agent-docs/components/stack.md +3 -3
  82. package/agent-docs/components/stacked-bar.md +7 -4
  83. package/agent-docs/components/state-machine.md +95 -0
  84. package/agent-docs/components/status-pages.md +13 -6
  85. package/agent-docs/components/stepper.md +54 -0
  86. package/agent-docs/components/switch.md +4 -4
  87. package/agent-docs/components/table-of-contents.md +78 -0
  88. package/agent-docs/components/table.md +35 -24
  89. package/agent-docs/components/tabs.md +24 -26
  90. package/agent-docs/components/text-link.md +12 -7
  91. package/agent-docs/components/textarea.md +4 -2
  92. package/agent-docs/components/toast.md +19 -14
  93. package/agent-docs/components/video.md +7 -2
  94. package/agent-docs/llms.txt +22 -3
  95. package/dist/AppShell.d.ts +25 -9
  96. package/dist/AppShell.js +67 -33
  97. package/dist/AppShellMenu.d.ts +31 -18
  98. package/dist/AppShellMenu.js +72 -45
  99. package/dist/ArticleLayout.d.ts +36 -0
  100. package/dist/ArticleLayout.js +27 -0
  101. package/dist/Audio.d.ts +16 -0
  102. package/dist/Audio.js +11 -0
  103. package/dist/Badge.d.ts +2 -1
  104. package/dist/Badge.js +3 -2
  105. package/dist/BottomSheet.d.ts +17 -6
  106. package/dist/BottomSheet.js +62 -11
  107. package/dist/Breadcrumbs.d.ts +8 -6
  108. package/dist/Breadcrumbs.js +17 -7
  109. package/dist/Button.d.ts +4 -2
  110. package/dist/Button.js +9 -87
  111. package/dist/CallToAction.d.ts +25 -0
  112. package/dist/CallToAction.js +17 -0
  113. package/dist/Callout.d.ts +2 -2
  114. package/dist/Callout.js +2 -2
  115. package/dist/Card.d.ts +88 -31
  116. package/dist/Card.js +55 -92
  117. package/dist/CardBody.d.ts +2 -0
  118. package/dist/CardBody.js +33 -3
  119. package/dist/CardGrid.d.ts +32 -4
  120. package/dist/CardGrid.js +42 -8
  121. package/dist/CardParts.d.ts +7 -1
  122. package/dist/CardParts.js +7 -2
  123. package/dist/CartButton.d.ts +33 -0
  124. package/dist/CartButton.js +18 -0
  125. package/dist/ChatComposer.d.ts +10 -4
  126. package/dist/ChatComposer.js +35 -13
  127. package/dist/Checkbox.d.ts +21 -3
  128. package/dist/Checkbox.js +66 -20
  129. package/dist/Chevron.js +1 -1
  130. package/dist/Cluster.d.ts +28 -15
  131. package/dist/Cluster.js +21 -4
  132. package/dist/Code.d.ts +15 -3
  133. package/dist/Code.js +23 -3
  134. package/dist/CodeBlock.d.ts +4 -4
  135. package/dist/CodeBlock.js +2 -2
  136. package/dist/CodeBody.d.ts +1 -1
  137. package/dist/CodeBody.js +4 -10
  138. package/dist/CodeExample.d.ts +1 -1
  139. package/dist/CodeExample.js +3 -2
  140. package/dist/ColourSchemeToggle.d.ts +21 -5
  141. package/dist/ColourSchemeToggle.js +15 -9
  142. package/dist/ColourSwatch.d.ts +15 -0
  143. package/dist/ColourSwatch.js +14 -0
  144. package/dist/Combobox.d.ts +42 -0
  145. package/dist/Combobox.js +43 -0
  146. package/dist/ConfirmDialog.d.ts +40 -0
  147. package/dist/ConfirmDialog.js +36 -0
  148. package/dist/Container.d.ts +3 -3
  149. package/dist/Container.js +1 -1
  150. package/dist/CopyButton.d.ts +8 -2
  151. package/dist/CopyButton.js +38 -28
  152. package/dist/CopyLine.d.ts +4 -2
  153. package/dist/CopyLine.js +4 -4
  154. package/dist/DateCalendar.d.ts +2 -0
  155. package/dist/DateCalendar.js +11 -9
  156. package/dist/DateField.d.ts +52 -21
  157. package/dist/DateField.js +73 -37
  158. package/dist/DateFieldCalendar.d.ts +12 -8
  159. package/dist/DateFieldCalendar.js +37 -18
  160. package/dist/DateRangePicker.d.ts +23 -3
  161. package/dist/DateRangePicker.js +10 -8
  162. package/dist/DateTimeField.d.ts +31 -0
  163. package/dist/DateTimeField.js +19 -0
  164. package/dist/Dialog.d.ts +42 -6
  165. package/dist/Dialog.js +50 -12
  166. package/dist/Disclosure.js +9 -1
  167. package/dist/DocsLayout.d.ts +13 -5
  168. package/dist/DocsLayout.js +11 -9
  169. package/dist/Drawer.d.ts +22 -7
  170. package/dist/Drawer.js +89 -8
  171. package/dist/EmbedFrame.d.ts +36 -0
  172. package/dist/EmbedFrame.js +18 -0
  173. package/dist/Field.d.ts +41 -4
  174. package/dist/Field.js +61 -25
  175. package/dist/FieldDialog.d.ts +8 -3
  176. package/dist/FieldDialog.js +19 -9
  177. package/dist/Fieldset.d.ts +3 -3
  178. package/dist/Fieldset.js +7 -9
  179. package/dist/FileDrop.js +2 -1
  180. package/dist/FlowDiagram.d.ts +92 -0
  181. package/dist/FlowDiagram.js +100 -0
  182. package/dist/FormRow.d.ts +6 -4
  183. package/dist/FormRow.js +11 -9
  184. package/dist/Hero.d.ts +30 -7
  185. package/dist/Hero.js +23 -9
  186. package/dist/Icon.d.ts +1 -1
  187. package/dist/Icon.js +1 -1
  188. package/dist/IconButton.js +1 -1
  189. package/dist/Image.d.ts +33 -9
  190. package/dist/Image.js +61 -16
  191. package/dist/Input.d.ts +1 -1
  192. package/dist/Input.js +4 -4
  193. package/dist/InputShell.d.ts +7 -0
  194. package/dist/InputShell.js +18 -3
  195. package/dist/KeyValueList.d.ts +2 -2
  196. package/dist/Lightbox.js +5 -3
  197. package/dist/ListRow.d.ts +4 -5
  198. package/dist/ListRow.js +36 -26
  199. package/dist/Mark.d.ts +10 -0
  200. package/dist/Mark.js +9 -0
  201. package/dist/Markdown.d.ts +18 -4
  202. package/dist/Markdown.js +176 -37
  203. package/dist/MediaTile.d.ts +9 -3
  204. package/dist/MediaTile.js +8 -4
  205. package/dist/Menu.d.ts +19 -8
  206. package/dist/Menu.js +13 -11
  207. package/dist/MetaList.d.ts +4 -3
  208. package/dist/MetaList.js +12 -4
  209. package/dist/Morph.d.ts +15 -1
  210. package/dist/Morph.js +70 -22
  211. package/dist/NavigationProgress.d.ts +2 -2
  212. package/dist/NavigationProgress.js +7 -5
  213. package/dist/NumberField.d.ts +66 -0
  214. package/dist/NumberField.js +68 -0
  215. package/dist/OutlineRegion.d.ts +41 -10
  216. package/dist/OutlineRegion.js +31 -6
  217. package/dist/PageFade.d.ts +9 -5
  218. package/dist/PageFade.js +39 -8
  219. package/dist/PageLayouts.d.ts +15 -5
  220. package/dist/PageLayouts.js +3 -3
  221. package/dist/Pill.d.ts +9 -4
  222. package/dist/Pill.js +15 -6
  223. package/dist/Popover.d.ts +31 -0
  224. package/dist/Popover.js +43 -0
  225. package/dist/Price.d.ts +21 -0
  226. package/dist/Price.js +34 -0
  227. package/dist/ProductTile.d.ts +36 -0
  228. package/dist/ProductTile.js +31 -0
  229. package/dist/ProgressBar.js +4 -2
  230. package/dist/PromoBanner.d.ts +25 -0
  231. package/dist/PromoBanner.js +16 -0
  232. package/dist/RadioGroup.d.ts +18 -8
  233. package/dist/RadioGroup.js +42 -18
  234. package/dist/ScrollStrip.d.ts +1 -1
  235. package/dist/ScrollStrip.js +1 -1
  236. package/dist/SearchInput.d.ts +17 -2
  237. package/dist/SearchInput.js +72 -13
  238. package/dist/SegmentedField.d.ts +15 -0
  239. package/dist/SegmentedField.js +15 -0
  240. package/dist/Select.js +5 -4
  241. package/dist/Show.d.ts +1 -1
  242. package/dist/Show.js +1 -1
  243. package/dist/SideColumn.d.ts +42 -15
  244. package/dist/SideColumn.js +45 -19
  245. package/dist/SiteFooter.d.ts +3 -3
  246. package/dist/SiteFooter.js +4 -3
  247. package/dist/SiteSearch.d.ts +57 -27
  248. package/dist/SiteSearch.js +13 -93
  249. package/dist/Slider.d.ts +27 -0
  250. package/dist/Slider.js +58 -0
  251. package/dist/SortableList.d.ts +19 -35
  252. package/dist/SortableList.js +36 -88
  253. package/dist/Stack.d.ts +4 -4
  254. package/dist/StackedBar.d.ts +13 -4
  255. package/dist/StackedBar.js +12 -7
  256. package/dist/StateMachine.d.ts +65 -0
  257. package/dist/StateMachine.js +116 -0
  258. package/dist/StatusPages.d.ts +28 -10
  259. package/dist/StatusPages.js +10 -10
  260. package/dist/Stepper.d.ts +21 -0
  261. package/dist/Stepper.js +33 -0
  262. package/dist/Steps.js +4 -3
  263. package/dist/Switch.d.ts +3 -3
  264. package/dist/Switch.js +18 -14
  265. package/dist/Table.d.ts +32 -9
  266. package/dist/Table.js +50 -20
  267. package/dist/TableCells.d.ts +24 -21
  268. package/dist/TableCells.js +68 -27
  269. package/dist/TableEditCell.d.ts +1 -1
  270. package/dist/TableOfContents.d.ts +34 -0
  271. package/dist/TableOfContents.js +23 -0
  272. package/dist/Tabs.d.ts +31 -16
  273. package/dist/Tabs.js +97 -22
  274. package/dist/TextLink.d.ts +18 -5
  275. package/dist/TextLink.js +19 -6
  276. package/dist/Textarea.d.ts +12 -1
  277. package/dist/Textarea.js +15 -2
  278. package/dist/ToastRegion.d.ts +17 -9
  279. package/dist/ToastRegion.js +70 -13
  280. package/dist/Tooltip.d.ts +10 -2
  281. package/dist/Tooltip.js +32 -11
  282. package/dist/Video.d.ts +19 -4
  283. package/dist/Video.js +15 -5
  284. package/dist/cardContext.d.ts +7 -0
  285. package/dist/cardContext.js +14 -0
  286. package/dist/cardControl.d.ts +15 -0
  287. package/dist/cardControl.js +32 -0
  288. package/dist/cardForm.d.ts +39 -0
  289. package/dist/cardForm.js +81 -0
  290. package/dist/cardWait.js +2 -1
  291. package/dist/colourScheme.d.ts +12 -2
  292. package/dist/colourScheme.js +32 -6
  293. package/dist/control.d.ts +30 -8
  294. package/dist/control.js +74 -7
  295. package/dist/copyScript.d.ts +7 -8
  296. package/dist/copyScript.js +8 -9
  297. package/dist/core/button.d.ts +33 -0
  298. package/dist/core/button.js +89 -0
  299. package/dist/core/control.d.ts +15 -0
  300. package/dist/core/control.js +14 -0
  301. package/dist/core/fixtures/button.d.ts +26 -0
  302. package/dist/core/fixtures/button.js +52 -0
  303. package/dist/core/fixtures/types.d.ts +13 -0
  304. package/dist/core/fixtures/types.js +10 -0
  305. package/dist/core/focus.d.ts +7 -0
  306. package/dist/core/focus.js +7 -0
  307. package/dist/core/index.d.ts +12 -0
  308. package/dist/core/index.js +12 -0
  309. package/dist/core/parity.d.ts +22 -0
  310. package/dist/core/parity.js +53 -0
  311. package/dist/core/themeNative.d.ts +62 -0
  312. package/dist/core/themeNative.js +290 -0
  313. package/dist/cx.d.ts +17 -5
  314. package/dist/cx.js +18 -5
  315. package/dist/dateLocale.d.ts +17 -0
  316. package/dist/dateLocale.js +30 -0
  317. package/dist/density.d.ts +17 -3
  318. package/dist/density.js +30 -19
  319. package/dist/emptySlot.d.ts +1 -0
  320. package/dist/fieldAnnounce.d.ts +11 -0
  321. package/dist/fieldAnnounce.js +36 -0
  322. package/dist/fieldControl.d.ts +7 -2
  323. package/dist/fieldControl.js +6 -2
  324. package/dist/fieldWait.d.ts +3 -3
  325. package/dist/fieldWait.js +3 -4
  326. package/dist/flowLayout.d.ts +68 -0
  327. package/dist/flowLayout.js +105 -0
  328. package/dist/focus.d.ts +2 -0
  329. package/dist/focus.js +9 -0
  330. package/dist/fromXState.d.ts +73 -0
  331. package/dist/fromXState.js +110 -0
  332. package/dist/icons.d.ts +1 -1
  333. package/dist/icons.js +15 -0
  334. package/dist/index.d.ts +37 -11
  335. package/dist/index.js +24 -2
  336. package/dist/isoDate.d.ts +8 -1
  337. package/dist/isoDate.js +20 -1
  338. package/dist/labelWords.d.ts +16 -7
  339. package/dist/labelWords.js +14 -12
  340. package/dist/listRowProps.d.ts +17 -15
  341. package/dist/modal.d.ts +5 -0
  342. package/dist/modal.js +21 -1
  343. package/dist/navFold.js +6 -3
  344. package/dist/optionCard.d.ts +18 -0
  345. package/dist/optionCard.js +16 -0
  346. package/dist/scrollBody.d.ts +16 -0
  347. package/dist/scrollBody.js +15 -0
  348. package/dist/scrollEdges.d.ts +7 -0
  349. package/dist/scrollEdges.js +39 -5
  350. package/dist/scrollStop.d.ts +6 -2
  351. package/dist/scrollStop.js +24 -8
  352. package/dist/shownDate.d.ts +28 -10
  353. package/dist/shownDate.js +41 -22
  354. package/dist/siteSearchBody.d.ts +34 -0
  355. package/dist/siteSearchBody.js +117 -0
  356. package/dist/size.d.ts +7 -1
  357. package/dist/sortableDrop.d.ts +44 -0
  358. package/dist/sortableDrop.js +78 -0
  359. package/dist/sortableSlide.d.ts +9 -0
  360. package/dist/sortableSlide.js +70 -0
  361. package/dist/sortableTitle.d.ts +10 -0
  362. package/dist/sortableTitle.js +48 -0
  363. package/dist/stateMachineDots.d.ts +77 -0
  364. package/dist/stateMachineDots.js +188 -0
  365. package/dist/stickyColumn.d.ts +2 -2
  366. package/dist/stickyColumn.js +2 -2
  367. package/dist/switcher.d.ts +10 -5
  368. package/dist/switcher.js +7 -5
  369. package/dist/tableColumns.d.ts +17 -0
  370. package/dist/tableColumns.js +30 -2
  371. package/dist/tableEmpty.js +5 -5
  372. package/dist/tableRow.d.ts +26 -2
  373. package/dist/tableRow.js +23 -1
  374. package/dist/tableSort.d.ts +10 -5
  375. package/dist/tableSort.js +15 -4
  376. package/dist/target.d.ts +12 -0
  377. package/dist/target.js +12 -0
  378. package/dist/textBox.js +1 -1
  379. package/dist/truncated.d.ts +31 -0
  380. package/dist/truncated.js +51 -0
  381. package/dist/typography.d.ts +19 -11
  382. package/dist/typography.js +11 -13
  383. package/dist/useFlowLayout.d.ts +38 -0
  384. package/dist/useFlowLayout.js +122 -0
  385. package/package.json +5 -3
@@ -4,22 +4,62 @@ import { controlClass } from "./control.js";
4
4
  import { cx, focusRing } from "./cx.js";
5
5
  import { useTypeStep } from "./density.js";
6
6
  import { InputShell } from "./InputShell.js";
7
+ import { sizeClass } from "./size.js";
7
8
  import { Tipped } from "./Tooltip.js";
8
9
  /** The browser's own search look is reset: no `searchfield` appearance, no cancel button or decoration. The clear button below replaces them. */
9
10
  const SEARCH_RESET = "appearance-none [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden";
10
11
  /** A search field's padding: the leading side as a plain field or with an icon, the trailing side clear of the clear button. */
11
12
  const SEARCH_PAD = {
12
- sm: { plain: "pl-2 pr-7", icon: "pl-7 pr-7" },
13
- md: { plain: "pl-3 pr-9", icon: "pl-9 pr-9" },
14
- lg: { plain: "pl-4 pr-11", icon: "pl-11 pr-11" },
13
+ sm: "pl-2 pr-7",
14
+ md: "pl-3 pr-9",
15
+ lg: "pl-4 pr-11",
15
16
  };
16
- /** The clear button's place and box, and its icon, by the field's size. */
17
- const CLEAR_SIZE = {
18
- sm: { box: "right-1 h-5 w-5", icon: "h-3 w-3" },
19
- md: { box: "right-2 h-6 w-6", icon: "h-3.5 w-3.5" },
20
- lg: { box: "right-2.5 h-7 w-7", icon: "h-4 w-4" },
17
+ const SEARCH_PAD_MD = {
18
+ sm: "md:pl-2 md:pr-7",
19
+ md: "md:pl-3 md:pr-9",
20
+ lg: "md:pl-4 md:pr-11",
21
21
  };
22
- const CLEAR_BUTTON = `absolute top-1/2 -translate-y-1/2 inline-flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 ${focusRing}`;
22
+ /** With a leading icon. */
23
+ const SEARCH_PAD_ICON = {
24
+ sm: "pl-7 pr-7",
25
+ md: "pl-9 pr-9",
26
+ lg: "pl-11 pr-11",
27
+ };
28
+ const SEARCH_PAD_ICON_MD = {
29
+ sm: "md:pl-7 md:pr-7",
30
+ md: "md:pl-9 md:pr-9",
31
+ lg: "md:pl-11 md:pr-11",
32
+ };
33
+ /** The clear button's place and box, by the field's size. */
34
+ const CLEAR_BOX = {
35
+ sm: "right-1 h-5 w-5",
36
+ md: "right-2 h-6 w-6",
37
+ lg: "right-2.5 h-7 w-7",
38
+ };
39
+ const CLEAR_BOX_MD = {
40
+ sm: "md:right-1 md:h-5 md:w-5",
41
+ md: "md:right-2 md:h-6 md:w-6",
42
+ lg: "md:right-2.5 md:h-7 md:w-7",
43
+ };
44
+ /** The clear button's icon, by the field's size. */
45
+ const CLEAR_ICON = { sm: "h-3 w-3", md: "h-3.5 w-3.5", lg: "h-4 w-4" };
46
+ const CLEAR_ICON_MD = {
47
+ sm: "md:h-3 md:w-3",
48
+ md: "md:h-3.5 md:w-3.5",
49
+ lg: "md:h-4 md:w-4",
50
+ };
51
+ /** A search field's size tables and their `md:` twins (each `_MD` is its table from the `md` breakpoint up), for the data test. */
52
+ export const searchSizeTables = {
53
+ pad: SEARCH_PAD,
54
+ padMd: SEARCH_PAD_MD,
55
+ padIcon: SEARCH_PAD_ICON,
56
+ padIconMd: SEARCH_PAD_ICON_MD,
57
+ clearBox: CLEAR_BOX,
58
+ clearBoxMd: CLEAR_BOX_MD,
59
+ clearIcon: CLEAR_ICON,
60
+ clearIconMd: CLEAR_ICON_MD,
61
+ };
62
+ const CLEAR_BUTTON = `absolute top-1/2 -translate-y-1/2 inline-flex cursor-pointer items-center justify-center rounded text-slate-500 hover:bg-slate-100 ${focusRing}`;
23
63
  /** Set `value` the way a keystroke does (past React's value tracker), so `onChange` fires for a controlled and an uncontrolled field alike. */
24
64
  function clearValue(input) {
25
65
  const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
@@ -27,8 +67,12 @@ function clearValue(input) {
27
67
  input.dispatchEvent(new Event("input", { bubbles: true }));
28
68
  input.focus();
29
69
  }
70
+ /** Whether Escape has something to clear: a value, in a field the person can edit. */
71
+ function clearable(input) {
72
+ return input.value !== "" && !input.readOnly && !input.disabled;
73
+ }
30
74
  function ClearButton({ size, label, onClear, }) {
31
- return (_jsx(Tipped, { text: label, describes: false, own: {}, children: (tip) => (_jsx("button", { type: "button", "aria-label": label, ...tip, onClick: onClear, className: cx(CLEAR_BUTTON, CLEAR_SIZE[size].box), children: _jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", className: CLEAR_SIZE[size].icon, children: _jsx("path", { d: "M5.28 4.22a.75.75 0 0 0-1.06 1.06L8.94 10l-4.72 4.72a.75.75 0 1 0 1.06 1.06L10 11.06l4.72 4.72a.75.75 0 1 0 1.06-1.06L11.06 10l4.72-4.72a.75.75 0 0 0-1.06-1.06L10 8.94 5.28 4.22Z" }) }) })) }));
75
+ return (_jsx(Tipped, { text: label, describes: false, own: {}, children: (tip) => (_jsx("button", { type: "button", "aria-label": label, ...tip, onClick: onClear, className: cx(CLEAR_BUTTON, sizeClass(CLEAR_BOX, CLEAR_BOX_MD, size)), children: _jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", className: sizeClass(CLEAR_ICON, CLEAR_ICON_MD, size), children: _jsx("path", { d: "M5.28 4.22a.75.75 0 0 0-1.06 1.06L8.94 10l-4.72 4.72a.75.75 0 1 0 1.06 1.06L10 11.06l4.72 4.72a.75.75 0 1 0 1.06-1.06L11.06 10l4.72-4.72a.75.75 0 0 0-1.06-1.06L10 8.94 5.28 4.22Z" }) }) })) }));
32
76
  }
33
77
  /** Sets both the field's own ref and the consumer's. */
34
78
  function bothRefs(own, theirs) {
@@ -40,8 +84,12 @@ function bothRefs(own, theirs) {
40
84
  theirs.current = el;
41
85
  };
42
86
  }
43
- /** `Input` for `type="search"`: native search look reset, and a clear button named `clearLabel` at the trailing edge while the field has a value. */
44
- export function SearchInput({ icon, size = "md", width = "full", clearLabel, onChange, ref, ...rest }) {
87
+ /**
88
+ * `Input` for `type="search"`: native search look reset, and a clear button named `clearLabel` at the
89
+ * trailing edge while the field has a value. Escape in a field with a value clears it and goes no
90
+ * further, so a dialog around it stays open; Escape in an empty field passes on and closes it.
91
+ */
92
+ export function SearchInput({ icon, size = "md", width = "full", clearLabel, onChange, onKeyDown, ref, ...rest }) {
45
93
  const step = useTypeStep();
46
94
  const inputRef = useRef(null);
47
95
  // One callback for the life of the ref, so a caller's function ref is not called on every keystroke.
@@ -51,5 +99,16 @@ export function SearchInput({ icon, size = "md", width = "full", clearLabel, onC
51
99
  return (_jsxs(InputShell, { icon: icon, size: size, width: width, children: [_jsx("input", { ...rest, ref: attach, onChange: (event) => {
52
100
  setTyped(event.currentTarget.value !== "");
53
101
  onChange?.(event);
54
- }, className: cx(controlClass(size, width === "auto" ? "auto" : "full", step), SEARCH_PAD[size][icon === undefined ? "plain" : "icon"], SEARCH_RESET) }), filled && !rest.disabled && !rest.readOnly && (_jsx(ClearButton, { size: size, label: clearLabel, onClear: () => inputRef.current && clearValue(inputRef.current) }))] }));
102
+ }, onKeyDown: (event) => {
103
+ onKeyDown?.(event);
104
+ if (event.key !== "Escape" || event.defaultPrevented)
105
+ return;
106
+ if (!clearable(event.currentTarget))
107
+ return;
108
+ event.preventDefault();
109
+ event.stopPropagation();
110
+ clearValue(event.currentTarget);
111
+ }, className: cx(controlClass(size, width === "auto" ? "auto" : "full", step), icon === undefined
112
+ ? sizeClass(SEARCH_PAD, SEARCH_PAD_MD, size)
113
+ : sizeClass(SEARCH_PAD_ICON, SEARCH_PAD_ICON_MD, size), SEARCH_RESET) }), filled && !rest.disabled && !rest.readOnly && (_jsx(ClearButton, { size: size, label: clearLabel, onClear: () => inputRef.current && clearValue(inputRef.current) }))] }));
55
114
  }
@@ -0,0 +1,15 @@
1
+ import type { CalendarDate, CalendarDateTime, DateValue } from "@internationalized/date";
2
+ import type { ReactElement } from "react";
3
+ import { type FieldProps } from "./DateField.js";
4
+ import { type Kind } from "./shownDate.js";
5
+ /** A typed field's props: a `DateField`'s, with the value props of its value type and its `kind`. */
6
+ export type SegmentedProps<T extends CalendarDate | CalendarDateTime> = Omit<FieldProps, "value" | "defaultValue" | "onChange" | "minValue" | "maxValue"> & {
7
+ value?: T | null | undefined;
8
+ defaultValue?: T | null | undefined;
9
+ onChange?: ((value: T | null) => void) | undefined;
10
+ minValue?: DateValue | null | undefined;
11
+ maxValue?: DateValue | null | undefined;
12
+ kind: Kind<T>;
13
+ };
14
+ /** The typed field without a calendar: a `DateField`, or a `DateTimeField` with its time segments. */
15
+ export declare function SegmentedField<T extends CalendarDate | CalendarDateTime>({ kind, label, hint, error, disabled, required, value, defaultValue, onChange, name, locale, size, ...rest }: SegmentedProps<T>): ReactElement;
@@ -0,0 +1,15 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DateField as AriaDateField, DateInput } from "react-aria-components";
3
+ import { cx } from "./cx.js";
4
+ import { fieldPad, FieldLabel, FieldSegment, fieldFlags, forcedInvalid, frameClass, Notes, } from "./DateField.js";
5
+ import { DateLocale } from "./dateLocale.js";
6
+ import { controlText, useTypeStep } from "./density.js";
7
+ import { definedProps } from "./props.js";
8
+ import { ShownInput, useShownDate } from "./shownDate.js";
9
+ /** The typed field without a calendar: a `DateField`, or a `DateTimeField` with its time segments. */
10
+ export function SegmentedField({ kind, label, hint, error, disabled, required, value, defaultValue, onChange, name, locale, size = "md", ...rest }) {
11
+ const step = useTypeStep();
12
+ const bounds = { minValue: rest.minValue, maxValue: rest.maxValue };
13
+ const { inner, setInner, shown, impossible, onRead, validate, leaving, onBlurCapture, onLeft } = useShownDate({ value, defaultValue, onChange, ...bounds, isRequired: required }, kind);
14
+ return (_jsx(DateLocale, { locale: locale, children: _jsx(AriaDateField, { ...definedProps(rest), ...fieldFlags(disabled, required), value: inner, onChange: (next) => setInner(kind.narrow(next)), validate: validate, ...forcedInvalid({ impossible, error }), isReadOnly: leaving, onBlur: onLeft, granularity: kind.granularity, shouldForceLeadingZeros: true, className: "flex flex-col gap-1.5", children: () => (_jsxs(_Fragment, { children: [_jsx(FieldLabel, { label: label, required: required }), _jsx("div", { className: "contents", onBlurCapture: onBlurCapture, children: _jsx(DateInput, { className: (state) => cx(frameClass(state), fieldPad(size), controlText(size, step, true)), children: (segment) => (_jsx(FieldSegment, { segment: segment, ...(segment.type === "day" ? { onRead } : {}) })) }) }), _jsx(ShownInput, { name: name, shown: shown, isDisabled: disabled }), _jsx(Notes, { hint: hint, error: error, impossible: impossible, bounds: bounds, time: kind.granularity === "minute" })] })) }) }));
15
+ }
package/dist/Select.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
- import { CONTROL_PAD, controlClass } from "./control.js";
3
+ import { controlClass, controlHeight, controlPad } from "./control.js";
4
4
  import { cx } from "./cx.js";
5
5
  import { useTypeStep } from "./density.js";
6
6
  import { FieldContext, useFieldControl } from "./fieldControl.js";
7
- /** The height of a `Select` by `size`, the `Input`'s 26px, 38px and 46px: a native `<select>` sizes its text from the font and ignores the line height, so padding alone falls short at `md` and `lg`. */
8
- const SELECT_HEIGHT = { sm: "h-6.5", md: "h-9.5", lg: "h-11.5" };
9
7
  /**
10
8
  * A native `<select>` styled like `Input`, keeping the browser's own arrow, over its `items`. Takes
11
9
  * `size` and `width` too: inside a `Field` it fills the row, and on its own it is as wide as its
@@ -15,5 +13,8 @@ export function Select({ items, size = "md", width, ...own }) {
15
13
  const step = useTypeStep();
16
14
  const inField = useContext(FieldContext) !== undefined;
17
15
  const field = useFieldControl(own);
18
- return (_jsx("select", { ...own, ...field, className: cx(controlClass(size, width ?? (inField ? "full" : "auto"), step), SELECT_HEIGHT[size], CONTROL_PAD[size].x), children: items.map((item) => (_jsx("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))) }));
16
+ return (_jsx("select", { ...own, ...field, className: cx(controlClass(size, width ?? (inField ? "full" : "auto"), step),
17
+ // A native `<select>` sizes its text from the font and ignores the line height, so padding
18
+ // alone falls short at `md` and `lg`: it takes the `Input`'s height outright.
19
+ controlHeight(size), controlPad(size), "cursor-pointer disabled:cursor-not-allowed"), children: items.map((item) => (_jsx("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))) }));
19
20
  }
package/dist/Show.d.ts CHANGED
@@ -20,7 +20,7 @@ type ShowWhen = {
20
20
  * Content that only fits a wide screen is in a `Show from`; its narrow-screen form is in a
21
21
  * `Show below` at the same breakpoint. Hidden content stays mounted, so two `Show`s of the same
22
22
  * content mount it twice: a stateful panel shown at every width with a fold is a
23
- * `SideColumn asideLabel`. `as="span"` is for phrasing content (inside a `<p>` or a button row).
23
+ * `SideColumn fold`. `as="span"` is for phrasing content (inside a `<p>` or a button row).
24
24
  */
25
25
  export declare function Show({ from, below, as: Tag, children, ...rest }: ShowWhen & {
26
26
  /**
package/dist/Show.js CHANGED
@@ -20,7 +20,7 @@ const BELOW = {
20
20
  * Content that only fits a wide screen is in a `Show from`; its narrow-screen form is in a
21
21
  * `Show below` at the same breakpoint. Hidden content stays mounted, so two `Show`s of the same
22
22
  * content mount it twice: a stateful panel shown at every width with a fold is a
23
- * `SideColumn asideLabel`. `as="span"` is for phrasing content (inside a `<p>` or a button row).
23
+ * `SideColumn fold`. `as="span"` is for phrasing content (inside a `<p>` or a button row).
24
24
  */
25
25
  export function Show({ from, below, as: Tag = "div", children, ...rest }) {
26
26
  return (_jsx(Tag, { ...rest, className: from ? FROM[from] : BELOW[below ?? "sm"], children: children }));
@@ -1,33 +1,42 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
2
  import type { Passthrough } from "./props.js";
3
- /** How wide a `SideColumn`'s aside is from `lg`: `sm` 18rem, `md` 24rem, or `third` a third of the row. */
4
- export type SideColumnWidth = "sm" | "md" | "third";
3
+ /** How wide a `SideColumn`'s aside is from `lg`: `xs` 12rem, `sm` 18rem, `md` 24rem, or `third` a third of the row. */
4
+ export type SideColumnWidth = "xs" | "sm" | "md" | "third";
5
+ /** Which side of the main area a `SideColumn`'s aside sits on from `lg`: `end` (the right) or `start` (the left). */
6
+ export type SideColumnSide = "end" | "start";
5
7
  /**
6
8
  * A main area beside a side column, in the Container the page already has: from `lg` the `aside`
7
9
  * is `asideWidth` on the right and `children` take the room left; below `lg` the aside stacks under
8
10
  * `children`. It sets no page width, padding or header of its own, so it sits inside a layout, a
9
- * `Card` or a panel. `asideWidth` is `sm` (18rem), `md` (24rem) or `third` (one third of the row,
10
- * the main area two thirds: the split `DetailLayout` draws). A rail of links on the left is
11
- * `SidebarLayout`.
11
+ * `Card` or a panel. `asideWidth` is `xs` (12rem), `sm` (18rem), `md` (24rem) or `third` (one
12
+ * third of the row, the main area two thirds: the split `DetailLayout` draws). A rail of links on
13
+ * the left is `SidebarLayout`.
12
14
  *
13
- * `asideLabel` is for an aside that should not take the phone's screen: below `lg` it folds,
14
- * closed, behind a native disclosure of that name, and from `lg` it is the same column, always
15
- * shown. The aside stays mounted while folded, so a conversation or a draft inside it is kept.
15
+ * `side="start"` puts the aside on the left from `lg`, and first in reading order, so below `lg`
16
+ * it stacks above `children`.
17
+ *
18
+ * `asideLabel` names the `<aside>` landmark. `fold` is for an aside that should not take the
19
+ * phone's screen: below `lg` it folds, closed, behind a native disclosure named by `asideLabel`,
20
+ * and from `lg` it is the same column, always shown. The aside stays mounted while folded, so a
21
+ * conversation or a draft inside it is kept.
16
22
  *
17
23
  * `sticky` keeps the aside in view from `lg` as a long page scrolls: it sticks under AppShell's
18
24
  * header and, if it is taller than the room left, scrolls itself (a tab stop named by `asideLabel`)
19
25
  * so its end stays reachable.
20
26
  */
21
- export declare function SideColumn({ asideLabel, ...props }: {
22
- /** The side column: `asideWidth` wide on the right from `lg`, under `children` below it. */
27
+ export declare function SideColumn({ asideLabel, fold, ...props }: {
28
+ /** The side column: `asideWidth` wide on `side` from `lg`, stacked with `children` below it. */
23
29
  aside: ReactNode;
24
30
  /**
25
- * The aside's width from `lg`: `sm` 18rem, `md` 24rem, or `third`, one third of the row.
31
+ * The aside's width from `lg`: `xs` 12rem, `sm` 18rem, `md` 24rem, or `third`, one third of the row.
26
32
  * @default md
27
33
  */
28
34
  asideWidth?: SideColumnWidth | undefined;
29
- /** Folds the aside behind a disclosure with this name below `lg`, and names the `<aside>` landmark. Left out, the aside is always shown and unnamed. */
30
- asideLabel?: string | undefined;
35
+ /**
36
+ * The aside's side from `lg`: `end` (the right) or `start` (the left, and first in reading order).
37
+ * @default end
38
+ */
39
+ side?: SideColumnSide | undefined;
31
40
  /**
32
41
  * From `lg`, keeps the aside in view under the header as the page scrolls; an aside taller than
33
42
  * the screen scrolls inside itself.
@@ -35,16 +44,34 @@ export declare function SideColumn({ asideLabel, ...props }: {
35
44
  */
36
45
  sticky?: boolean | undefined;
37
46
  children: ReactNode;
38
- } & Passthrough): ReactElement;
47
+ } & SideColumnFold & Passthrough): ReactElement;
48
+ /**
49
+ * A `SideColumn`'s name and fold: `asideLabel` names the `<aside>` landmark, and `fold` folds the
50
+ * aside below `lg` behind a disclosure of that name, so `fold` needs `asideLabel`.
51
+ */
52
+ type SideColumnFold = {
53
+ /** Names the `<aside>` landmark, and the disclosure when `fold` is set. Left out, the aside is unnamed. */
54
+ asideLabel?: string | undefined;
55
+ /**
56
+ * Folds the aside, closed, behind a disclosure named by `asideLabel` below `lg`.
57
+ * @default false
58
+ */
59
+ fold?: false | undefined;
60
+ } | {
61
+ asideLabel: string;
62
+ fold: true;
63
+ };
39
64
  /**
40
65
  * The one two-column split: `SideColumn`, and `DetailLayout`'s columns, whose `asideLabel` names
41
66
  * the aside without folding it. Internal.
42
67
  */
43
- export declare function SplitColumns({ aside, asideWidth, label, fold, sticky, children, ...rest }: {
68
+ export declare function SplitColumns({ aside, asideWidth, side, label, fold, sticky, children, ...rest }: {
44
69
  aside: ReactNode;
45
70
  asideWidth?: SideColumnWidth | undefined;
71
+ side?: SideColumnSide | undefined;
46
72
  label: string | undefined;
47
73
  fold: boolean;
48
74
  sticky?: boolean | undefined;
49
75
  children: ReactNode;
50
76
  } & Passthrough): ReactElement;
77
+ export {};
@@ -5,41 +5,67 @@ import { useScrollEdges } from "./scrollEdges.js";
5
5
  import { scrollStopProps, useScrollStop } from "./scrollStop.js";
6
6
  import { STICKY_ASIDE_LG, STICKY_FADE_LG, STICKY_SCROLL_LG } from "./stickyColumn.js";
7
7
  /**
8
- * The grid from `lg`, and the main area's share of it: `sm` and `md` give the aside exactly that
9
- * width and the main area the room left; `third` gives the aside one third and the main area two.
8
+ * The grid from `lg`, and the main area's share of it, for each side: `xs`, `sm` and `md` give the
9
+ * aside exactly that width and the main area the room left; `third` gives the aside one third and
10
+ * the main area two.
10
11
  */
11
12
  const COLUMNS = {
12
- sm: { grid: "lg:grid-cols-[minmax(0,1fr)_18rem]", main: "" },
13
- md: { grid: "lg:grid-cols-[minmax(0,1fr)_24rem]", main: "" },
14
- third: { grid: "lg:grid-cols-3", main: "lg:col-span-2" },
13
+ end: {
14
+ xs: { grid: "lg:grid-cols-[minmax(0,1fr)_12rem]", main: "" },
15
+ sm: { grid: "lg:grid-cols-[minmax(0,1fr)_18rem]", main: "" },
16
+ md: { grid: "lg:grid-cols-[minmax(0,1fr)_24rem]", main: "" },
17
+ third: { grid: "lg:grid-cols-3", main: "lg:col-span-2" },
18
+ },
19
+ start: {
20
+ xs: { grid: "lg:grid-cols-[12rem_minmax(0,1fr)]", main: "" },
21
+ sm: { grid: "lg:grid-cols-[18rem_minmax(0,1fr)]", main: "" },
22
+ md: { grid: "lg:grid-cols-[24rem_minmax(0,1fr)]", main: "" },
23
+ third: { grid: "lg:grid-cols-3", main: "lg:col-span-2" },
24
+ },
15
25
  };
16
26
  /**
17
27
  * A main area beside a side column, in the Container the page already has: from `lg` the `aside`
18
28
  * is `asideWidth` on the right and `children` take the room left; below `lg` the aside stacks under
19
29
  * `children`. It sets no page width, padding or header of its own, so it sits inside a layout, a
20
- * `Card` or a panel. `asideWidth` is `sm` (18rem), `md` (24rem) or `third` (one third of the row,
21
- * the main area two thirds: the split `DetailLayout` draws). A rail of links on the left is
22
- * `SidebarLayout`.
30
+ * `Card` or a panel. `asideWidth` is `xs` (12rem), `sm` (18rem), `md` (24rem) or `third` (one
31
+ * third of the row, the main area two thirds: the split `DetailLayout` draws). A rail of links on
32
+ * the left is `SidebarLayout`.
23
33
  *
24
- * `asideLabel` is for an aside that should not take the phone's screen: below `lg` it folds,
25
- * closed, behind a native disclosure of that name, and from `lg` it is the same column, always
26
- * shown. The aside stays mounted while folded, so a conversation or a draft inside it is kept.
34
+ * `side="start"` puts the aside on the left from `lg`, and first in reading order, so below `lg`
35
+ * it stacks above `children`.
36
+ *
37
+ * `asideLabel` names the `<aside>` landmark. `fold` is for an aside that should not take the
38
+ * phone's screen: below `lg` it folds, closed, behind a native disclosure named by `asideLabel`,
39
+ * and from `lg` it is the same column, always shown. The aside stays mounted while folded, so a
40
+ * conversation or a draft inside it is kept.
27
41
  *
28
42
  * `sticky` keeps the aside in view from `lg` as a long page scrolls: it sticks under AppShell's
29
43
  * header and, if it is taller than the room left, scrolls itself (a tab stop named by `asideLabel`)
30
44
  * so its end stays reachable.
31
45
  */
32
- export function SideColumn({ asideLabel, ...props }) {
33
- return _jsx(SplitColumns, { ...props, label: asideLabel, fold: asideLabel !== undefined });
46
+ export function SideColumn({ asideLabel, fold = false, ...props }) {
47
+ return _jsx(SplitColumns, { ...props, label: asideLabel, fold: fold });
48
+ }
49
+ /** The aside's content: folded behind a disclosure below `lg` when `fold` and a label are set. */
50
+ function AsideContent({ aside, label, fold, }) {
51
+ if (!fold || label === undefined)
52
+ return aside;
53
+ return (_jsx(FoldedColumn, { from: "lg", label: label, children: aside }));
54
+ }
55
+ /** The `<aside>`: when `sticky`, it stays under the header from `lg` and scrolls itself, with a scroll stop when it overflows. */
56
+ function Aside({ label, sticky, children, }) {
57
+ const { element, attach, stop } = useScrollStop();
58
+ useScrollEdges(element, "y");
59
+ const { props, ring } = scrollStopProps(sticky && stop, { label });
60
+ return (_jsx("aside", { className: cx("min-w-0", sticky && STICKY_ASIDE_LG), "aria-label": label, children: _jsx("div", { ref: sticky ? attach : undefined, ...props, className: sticky ? cx(STICKY_SCROLL_LG, STICKY_FADE_LG, ring) : undefined, children: children }) }));
34
61
  }
35
62
  /**
36
63
  * The one two-column split: `SideColumn`, and `DetailLayout`'s columns, whose `asideLabel` names
37
64
  * the aside without folding it. Internal.
38
65
  */
39
- export function SplitColumns({ aside, asideWidth = "md", label, fold, sticky = false, children, ...rest }) {
40
- const { element, attach, stop } = useScrollStop();
41
- useScrollEdges(element, "y");
42
- const { props, ring } = scrollStopProps(sticky && stop, { label });
43
- const columns = COLUMNS[asideWidth];
44
- return (_jsxs("div", { ...rest, className: cx("grid grid-cols-1 gap-6", columns.grid), children: [_jsx("div", { className: cx("min-w-0", columns.main), children: children }), _jsx("aside", { className: cx("min-w-0", sticky && STICKY_ASIDE_LG), "aria-label": label, children: _jsx("div", { ref: sticky ? attach : undefined, ...props, className: sticky ? cx(STICKY_SCROLL_LG, STICKY_FADE_LG, ring) : undefined, children: fold && label !== undefined ? (_jsx(FoldedColumn, { from: "lg", label: label, children: aside })) : (aside) }) })] }));
66
+ export function SplitColumns({ aside, asideWidth = "md", side = "end", label, fold, sticky = false, children, ...rest }) {
67
+ const columns = COLUMNS[side][asideWidth];
68
+ const main = _jsx("div", { className: cx("min-w-0", columns.main), children: children });
69
+ const column = (_jsx(Aside, { label: label, sticky: sticky, children: _jsx(AsideContent, { aside: aside, label: label, fold: fold }) }));
70
+ return (_jsxs("div", { ...rest, className: cx("grid grid-cols-1 gap-6", columns.grid), children: [side === "start" ? column : null, main, side === "end" ? column : null] }));
45
71
  }
@@ -17,15 +17,15 @@ export declare function SiteFooter({ brand, brandHref, brandLabel, links, notes,
17
17
  brand?: ReactNode;
18
18
  /**
19
19
  * Where the brand links. Needs `brand`.
20
- * @default "/"
20
+ * @default the nearest `LinkProvider`'s `home`, else "/"
21
21
  */
22
22
  brandHref?: string | undefined;
23
23
  /** Names the brand link for assistive tech ("PixelSlash home"). Needs `brand`. */
24
24
  brandLabel?: string | undefined;
25
25
  /** The site's own links (Privacy, Terms, GitHub, a mail address), one wrapping row. */
26
- links?: SiteFooterLink[] | undefined;
26
+ links?: readonly SiteFooterLink[] | undefined;
27
27
  /** Lines of fine print under the links (a licence, a trademark, a credit), one paragraph each. */
28
- notes?: ReactNode[] | undefined;
28
+ notes?: readonly ReactNode[] | undefined;
29
29
  /** A sentence at body size beside the brand: the contact line ("Email hello@..."). */
30
30
  children?: ReactNode;
31
31
  } & Passthrough): ReactElement;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Cluster } from "./Cluster.js";
3
3
  import { cx, focusRing } from "./cx.js";
4
- import { renderLink } from "./link.js";
4
+ import { renderLink, useHome } from "./link.js";
5
5
  import { MetaList } from "./MetaList.js";
6
6
  import { Stack } from "./Stack.js";
7
7
  import { TextLink } from "./TextLink.js";
@@ -12,11 +12,12 @@ import { Caption } from "./typography.js";
12
12
  * It is not a `<footer>`: the shell draws the one `contentinfo` landmark around its slot. No link
13
13
  * columns, newsletter form or social icons: a site footer is this and nothing else.
14
14
  */
15
- export function SiteFooter({ brand, brandHref = "/", brandLabel, links = [], notes = [], children, ...rest }) {
15
+ export function SiteFooter({ brand, brandHref, brandLabel, links = [], notes = [], children, ...rest }) {
16
+ const home = useHome();
16
17
  const top = brand != null || children != null;
17
18
  return (_jsxs(Stack, { ...rest, gap: "sm", children: [top && (_jsxs(Cluster, { gap: "md", children: [brand != null &&
18
19
  renderLink({
19
- href: brandHref,
20
+ href: brandHref ?? home,
20
21
  "aria-label": brandLabel,
21
22
  className: cx("rounded text-slate-900", focusRing),
22
23
  children: brand,
@@ -1,35 +1,14 @@
1
1
  import { type ReactElement } from "react";
2
2
  import type { Passthrough } from "./props.js";
3
- /** One page the search can find. */
4
- export type SiteSearchItem = {
5
- /** The page's name: the row's label and the first thing matched. */
6
- label: string;
7
- /** A muted line under the label, matched last. */
8
- description?: string | undefined;
9
- /** Where the row goes. */
10
- href: string;
11
- /** Other names the page answers to (the exports it documents), matched like the label but not shown. */
12
- keywords?: string[] | undefined;
13
- };
14
- /**
15
- * The items that match `text`, best first: the label starts with it, then the label contains it,
16
- * then a keyword contains it, then the description does. Case is ignored, and items of the same
17
- * rank keep their order in `items`. Empty text matches nothing.
18
- */
19
- export declare function rankSiteSearch(items: readonly SiteSearchItem[], text: string): SiteSearchItem[];
20
- /**
21
- * The site's search: a header button that opens a dialog with a search field over a list of links
22
- * to the pages that match. Put it in `AppShell`'s `controls` and pass every page as `items`. Ctrl+K
23
- * (⌘ K on a Mac) opens it from anywhere on the page, and the button shows that key. Typing filters
24
- * by name, then by `keywords`, then by description; Enter opens the first result, the arrow keys
25
- * move through them, and Esc closes it and puts focus back where it was. Render it once per page.
26
- */
27
- export declare function SiteSearch({ items, label, resultsLabel, ...rest }: {
3
+ import { type SiteSearchItem } from "./siteSearchBody.js";
4
+ import type { Size } from "./size.js";
5
+ export { rankSiteSearch, type SiteSearchItem } from "./siteSearchBody.js";
6
+ type SiteSearchProps = {
28
7
  /** Every page to search, in the order ties are listed (the rail's order). */
29
8
  items: readonly SiteSearchItem[];
30
9
  /**
31
10
  * The dialog's title and the phone's icon button's accessible name: "Search components". The wide
32
- * button is named by its own text, "Search".
11
+ * button is named by its own text, `buttonLabel`.
33
12
  */
34
13
  label: string;
35
14
  /**
@@ -37,4 +16,55 @@ export declare function SiteSearch({ items, label, resultsLabel, ...rest }: {
37
16
  * @default Results
38
17
  */
39
18
  resultsLabel?: string | undefined;
40
- } & Passthrough): ReactElement;
19
+ /**
20
+ * The wide button's text, which is also its accessible name.
21
+ * @default Search
22
+ */
23
+ buttonLabel?: string | undefined;
24
+ /**
25
+ * The search field's placeholder.
26
+ * @default Search
27
+ */
28
+ placeholder?: string | undefined;
29
+ /**
30
+ * The muted line under the field before anything is typed.
31
+ * @default Type a name
32
+ */
33
+ hintLabel?: string | undefined;
34
+ /**
35
+ * The muted line when nothing matches; the typed text follows it: "No results for tabel".
36
+ * @default No results for
37
+ */
38
+ noResultsLabel?: string | undefined;
39
+ /**
40
+ * What a screen reader hears for the number of matches once something is typed.
41
+ * @default `No results`, `1 result`, `4 results`
42
+ */
43
+ countLabel?: ((count: number) => string) | undefined;
44
+ /**
45
+ * The site's full results page for a query, built from the typed text (trimmed):
46
+ * `(query) => "/search?q=" + encodeURIComponent(query)`. Given, a link to it is the last row
47
+ * once something is typed, matches or not, and Enter in the field goes there.
48
+ */
49
+ resultsHref?: ((query: string) => string) | undefined;
50
+ /**
51
+ * The full results link's text; the typed text follows it: "See all results for tabel".
52
+ * @default See all results for
53
+ */
54
+ allResultsLabel?: string | undefined;
55
+ /**
56
+ * The trigger's height and text, on the scale of a `Button` and an `IconButton`, so it lines up
57
+ * with the other controls in a header row.
58
+ * @default sm
59
+ */
60
+ size?: Size | undefined;
61
+ } & Passthrough;
62
+ /**
63
+ * The site's search: a header button that opens a dialog with a search field over a list of links
64
+ * to the pages that match. Put it in `AppShell`'s `controls` and pass every page as `items`. Ctrl+K
65
+ * (⌘ K on a Mac) opens it from anywhere on the page, and the button shows that key. Typing filters
66
+ * by name, then by `keywords`, then by description; Enter opens the first result (or, with
67
+ * `resultsHref`, the full results page), the arrow keys move through them, and Esc closes it and
68
+ * puts focus back where it was. The field is a `<search>` landmark. Render it once per page.
69
+ */
70
+ export declare function SiteSearch({ items, label, buttonLabel, resultsHref, size, ...props }: SiteSearchProps): ReactElement;