@slashsuite/ui-react 0.12.1 → 0.13.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 (367) 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 +1 -0
  110. package/dist/Button.js +4 -3
  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 +113 -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/cx.d.ts +22 -3
  298. package/dist/cx.js +22 -3
  299. package/dist/dateLocale.d.ts +17 -0
  300. package/dist/dateLocale.js +30 -0
  301. package/dist/density.d.ts +15 -1
  302. package/dist/density.js +27 -8
  303. package/dist/emptySlot.d.ts +1 -0
  304. package/dist/fieldAnnounce.d.ts +11 -0
  305. package/dist/fieldAnnounce.js +36 -0
  306. package/dist/fieldControl.d.ts +7 -2
  307. package/dist/fieldControl.js +6 -2
  308. package/dist/fieldWait.d.ts +3 -3
  309. package/dist/fieldWait.js +3 -4
  310. package/dist/flowLayout.d.ts +68 -0
  311. package/dist/flowLayout.js +105 -0
  312. package/dist/fromXState.d.ts +73 -0
  313. package/dist/fromXState.js +110 -0
  314. package/dist/icons.d.ts +1 -1
  315. package/dist/icons.js +15 -0
  316. package/dist/index.d.ts +37 -11
  317. package/dist/index.js +24 -2
  318. package/dist/isoDate.d.ts +8 -1
  319. package/dist/isoDate.js +20 -1
  320. package/dist/labelWords.d.ts +16 -7
  321. package/dist/labelWords.js +14 -12
  322. package/dist/listRowProps.d.ts +17 -15
  323. package/dist/modal.d.ts +5 -0
  324. package/dist/modal.js +21 -1
  325. package/dist/navFold.js +6 -3
  326. package/dist/optionCard.d.ts +18 -0
  327. package/dist/optionCard.js +16 -0
  328. package/dist/scrollBody.d.ts +16 -0
  329. package/dist/scrollBody.js +15 -0
  330. package/dist/scrollEdges.d.ts +7 -0
  331. package/dist/scrollEdges.js +39 -5
  332. package/dist/scrollStop.d.ts +6 -2
  333. package/dist/scrollStop.js +24 -8
  334. package/dist/shownDate.d.ts +28 -10
  335. package/dist/shownDate.js +41 -22
  336. package/dist/siteSearchBody.d.ts +34 -0
  337. package/dist/siteSearchBody.js +117 -0
  338. package/dist/size.d.ts +7 -1
  339. package/dist/sortableDrop.d.ts +44 -0
  340. package/dist/sortableDrop.js +78 -0
  341. package/dist/sortableSlide.d.ts +9 -0
  342. package/dist/sortableSlide.js +70 -0
  343. package/dist/sortableTitle.d.ts +10 -0
  344. package/dist/sortableTitle.js +48 -0
  345. package/dist/stateMachineDots.d.ts +45 -0
  346. package/dist/stateMachineDots.js +162 -0
  347. package/dist/stickyColumn.d.ts +2 -2
  348. package/dist/stickyColumn.js +2 -2
  349. package/dist/switcher.d.ts +10 -5
  350. package/dist/switcher.js +7 -5
  351. package/dist/tableColumns.d.ts +17 -0
  352. package/dist/tableColumns.js +30 -2
  353. package/dist/tableEmpty.js +5 -5
  354. package/dist/tableRow.d.ts +26 -2
  355. package/dist/tableRow.js +23 -1
  356. package/dist/tableSort.d.ts +10 -5
  357. package/dist/tableSort.js +15 -4
  358. package/dist/target.d.ts +12 -0
  359. package/dist/target.js +12 -0
  360. package/dist/textBox.js +1 -1
  361. package/dist/truncated.d.ts +31 -0
  362. package/dist/truncated.js +51 -0
  363. package/dist/typography.d.ts +19 -11
  364. package/dist/typography.js +11 -13
  365. package/dist/useFlowLayout.d.ts +27 -0
  366. package/dist/useFlowLayout.js +119 -0
  367. package/package.json +3 -2
package/dist/Hero.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "./cx.js";
3
+ import { Icon } from "./Icon.js";
2
4
  import { Display, Overline } from "./typography.js";
3
5
  /** The one keyframes name the glow drifts on; a consumer's own CSS never needs it. */
4
6
  export const HERO_DRIFT = "hc-hero-tide";
@@ -6,23 +8,35 @@ export const HERO_DRIFT = "hc-hero-tide";
6
8
  // so no ribbon ends in a hard line where the layer clips it) and the drift. The drift is a slow
7
9
  // sideways sway and stretch, like light on water, each ribbon on its own period so the three never
8
10
  // line up; it runs only under `prefers-reduced-motion: no-preference`, so a visitor who asks for less
9
- // motion sees the ribbons standing at their resting place. It sets no colour (the mask's black and
10
- // transparent only set how much shows): the theme paints the ribbons.
11
+ // motion sees the ribbons standing at their resting place. The pause control holds the ribbons where
12
+ // they are while it is checked, and is not drawn under reduced motion, where nothing moves. It sets
13
+ // no colour (the mask's black and transparent only set how much shows): the theme paints the ribbons.
11
14
  const css = `[data-hero-glow]{mask-image:linear-gradient(to bottom,transparent,black 22%,black 78%,transparent),linear-gradient(to right,transparent,black 8%,black 92%,transparent);mask-composite:intersect}
12
15
  @media (prefers-reduced-motion:no-preference){[data-hero-glow] span{animation:${HERO_DRIFT} 41s ease-in-out -7s infinite alternate}[data-hero-glow] span:nth-child(2){animation-duration:53s;animation-delay:-29s}[data-hero-glow] span:nth-child(3){animation-duration:67s;animation-delay:-43s;animation-direction:alternate-reverse}}
16
+ @media (prefers-reduced-motion:reduce){[data-hero-pause]{display:none}}
17
+ [data-hero-text]:has([data-hero-pause] input:checked) [data-hero-glow] span{animation-play-state:paused}
13
18
  @keyframes ${HERO_DRIFT}{0%{translate:-7% 0;scale:1 1}50%{translate:5% 10%;scale:1.14 .86}100%{translate:12% -6%;scale:.92 1.1}}`;
14
19
  /** Every ribbon: an ellipse, blurred soft. Its place, size, tilt and colour follow. */
15
20
  const RIBBON = "absolute rounded-[50%] blur-[56px]";
21
+ /** The pause control: a round ghost button's look on a checkbox's label, so it works with no script. */
22
+ const PAUSE = "absolute top-0 right-0 inline-flex size-8 cursor-pointer items-center justify-center rounded-full text-slate-600 hover:bg-slate-100 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-violet-600";
16
23
  /**
17
24
  * A landing page's top block: an overline, the display title (the page's `h1`) and the lede under
18
25
  * it, over a soft glow of three tilted ribbons that drift slowly behind the text. The glow is always
19
26
  * there and its colours and strength are the theme's (the palette's `glow` role), so a paper theme
20
- * keeps it faint. It is anchored to the text's own column (`max-w-3xl`, at the parent's start edge),
21
- * never the viewport, and clipped to it, so nothing scrolls sideways on a phone. It is
22
- * `aria-hidden`, and the text sits above it. Under `prefers-reduced-motion: reduce` it stands still.
23
- * Pure markup and one inline stylesheet: it works rendered on the server with no script.
24
- * One per page, on a landing page; every other page opens with a `PageHeader`.
27
+ * keeps it faint. It is anchored to the text's own column (`max-w-3xl`, at the parent's start edge,
28
+ * or in its middle with `align="center"`), never the viewport, and clipped to it, so nothing scrolls
29
+ * sideways on a phone. It is `aria-hidden`, and the text sits above it. `media` puts a picture
30
+ * beside the words from `md` up. A small checkbox in the top corner holds the drift still, since it
31
+ * never ends on its own; under `prefers-reduced-motion: reduce` the glow stands still and the
32
+ * checkbox is not drawn. Pure markup and one inline stylesheet: it works rendered on the server with
33
+ * no script. One per page, on a landing page; every other page opens with a `PageHeader`.
25
34
  */
26
- export function Hero({ overline, title, children, ...rest }) {
27
- return (_jsxs("div", { ...rest, className: "relative isolate max-w-3xl", children: [_jsx("style", { children: css }), _jsxs("div", { "aria-hidden": "true", "data-hero-glow": "", className: "pointer-events-none absolute inset-x-0 -inset-y-14 -z-10 overflow-hidden", children: [_jsx("span", { className: `${RIBBON} top-[14%] left-[-6%] h-[34%] w-[78%] -rotate-[7deg] bg-indigo-400/25` }), _jsx("span", { className: `${RIBBON} top-[34%] left-[28%] h-[30%] w-[70%] rotate-[4deg] bg-teal-400/25` }), _jsx("span", { className: `${RIBBON} top-[56%] left-[6%] h-[26%] w-[58%] -rotate-[2deg] bg-rose-400/25` })] }), _jsxs("div", { className: "relative flex flex-col gap-4", children: [_jsxs("header", { children: [overline != null && overline !== false && _jsx(Overline, { mono: true, children: overline }), _jsx(Display, { children: title })] }), children] })] }));
35
+ export function Hero({ overline, title, children, media, align = "start", pauseLabel = "Pause the background motion", ...rest }) {
36
+ const centre = align === "center";
37
+ const words = (_jsxs("div", { "data-hero-text": "", className: cx("relative isolate max-w-3xl", centre && "mx-auto text-center"), children: [_jsxs("div", { "aria-hidden": "true", "data-hero-glow": "", className: "pointer-events-none absolute inset-x-0 -inset-y-14 -z-10 overflow-hidden", children: [_jsx("span", { className: `${RIBBON} top-[14%] left-[-6%] h-[34%] w-[78%] -rotate-[7deg] bg-indigo-400/25` }), _jsx("span", { className: `${RIBBON} top-[34%] left-[28%] h-[30%] w-[70%] rotate-[4deg] bg-teal-400/25` }), _jsx("span", { className: `${RIBBON} top-[56%] left-[6%] h-[26%] w-[58%] -rotate-[2deg] bg-rose-400/25` })] }), _jsxs("div", { className: "relative flex flex-col gap-4", children: [_jsxs("header", { className: centre ? "px-10" : "pe-10", children: [overline != null && overline !== false && _jsx(Overline, { mono: true, children: overline }), _jsx(Display, { children: title })] }), children] }), _jsxs("label", { "data-hero-pause": "", className: PAUSE, children: [_jsx("input", { type: "checkbox", className: "peer sr-only" }), _jsx("span", { className: "sr-only", children: pauseLabel }), _jsx("span", { className: "inline-flex peer-checked:hidden", children: _jsx(Icon, { name: "pause" }) }), _jsx("span", { className: "hidden peer-checked:inline-flex", children: _jsx(Icon, { name: "play" }) })] })] }));
38
+ if (media === undefined) {
39
+ return (_jsxs("div", { ...rest, children: [_jsx("style", { children: css }), words] }));
40
+ }
41
+ return (_jsxs("div", { ...rest, className: "grid items-center gap-8 md:grid-cols-2 md:gap-12", children: [_jsx("style", { children: css }), words, _jsx("div", { className: "min-w-0", children: media })] }));
28
42
  }
package/dist/Icon.d.ts CHANGED
@@ -22,7 +22,7 @@ type IconProps = Passthrough & {
22
22
  * picks one of the library's own icons, all drawn on one grid with one stroke: feature ideas
23
23
  * (`diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`,
24
24
  * `speed`, `search`) and UI glyphs (`chevron-right`, `chevron-down`, `close`, `external-link`,
25
- * `settings`, `bell`, `check`, `plus`, `more`) and the ideas the docs sections stand for (`grid`, `window`,
25
+ * `settings`, `bell`, `check`, `alert`, `plus`, `more`) and the ideas the docs sections stand for (`grid`, `window`,
26
26
  * `type`, `card`, `pointer`, `field`, `table`, `compass`, `page`, `briefcase`);
27
27
  * without a name, a bare `<svg>` child fills the box. It is decorative (`aria-hidden`) by
28
28
  * default; a `label` makes it an image with that name, for an icon that carries meaning no text
package/dist/Icon.js CHANGED
@@ -19,7 +19,7 @@ export const iconSizeTables = { box: BOX, boxMd: BOX_MD };
19
19
  * picks one of the library's own icons, all drawn on one grid with one stroke: feature ideas
20
20
  * (`diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`,
21
21
  * `speed`, `search`) and UI glyphs (`chevron-right`, `chevron-down`, `close`, `external-link`,
22
- * `settings`, `bell`, `check`, `plus`, `more`) and the ideas the docs sections stand for (`grid`, `window`,
22
+ * `settings`, `bell`, `check`, `alert`, `plus`, `more`) and the ideas the docs sections stand for (`grid`, `window`,
23
23
  * `type`, `card`, `pointer`, `field`, `table`, `compass`, `page`, `briefcase`);
24
24
  * without a name, a bare `<svg>` child fills the box. It is decorative (`aria-hidden`) by
25
25
  * default; a `label` makes it an image with that name, for an icon that carries meaning no text
@@ -7,7 +7,7 @@ import { renderLink } from "./link.js";
7
7
  import { blockedProps, hasReason } from "./blocked.js";
8
8
  import { Tipped } from "./Tooltip.js";
9
9
  import { sizeClass } from "./size.js";
10
- const BASE = `relative inline-flex items-center justify-center rounded-lg border transition disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 ${focusRing}`;
10
+ const BASE = `relative inline-flex cursor-pointer items-center justify-center rounded-lg border transition disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 ${focusRing}`;
11
11
  /** The same heights as a `Button` of the size: 26px, 38px and 46px. */
12
12
  const SIZE = { sm: "size-6.5", md: "size-9.5", lg: "size-11.5" };
13
13
  /** `SIZE` from the `md` breakpoint up, for a responsive size. */
package/dist/Image.d.ts CHANGED
@@ -6,9 +6,11 @@ import type { Size } from "./size.js";
6
6
  * The shapes an image is cropped or letterboxed to, or `natural`: no shape of its own, so the
7
7
  * picture keeps its own proportions.
8
8
  */
9
- export type ImageAspect = "square" | "4:3" | "3:2" | "16:9" | "3:4" | "9:16" | "natural";
10
- /** How wide an image is: `full` fills its parent; the others are 96, 160 or 256px, capped at the parent's width. */
11
- export type ImageWidth = Size | "full";
9
+ export type ImageAspect = "square" | "4:3" | "3:2" | "16:10" | "16:9" | "3:4" | "9:16" | "natural";
10
+ /** How wide an image is: `full` fills its parent; the others are 96, 160, 256 or 448px, capped at the parent's width. */
11
+ export type ImageWidth = Size | "xl" | "full";
12
+ /** The class that reserves each shape. `Video` takes the same names, all but `natural`. */
13
+ export declare const ASPECT: Record<ImageAspect, string>;
12
14
  /**
13
15
  * `full` is the parent's width; a size is a real width that a narrower parent still caps. It is
14
16
  * a width and not a `max-width`, so it holds inside a shrink-to-fit parent, where a placeholder
@@ -37,22 +39,44 @@ export type ImageProps = {
37
39
  */
38
40
  fit?: "cover" | "contain" | undefined;
39
41
  /**
40
- * `sm` 96px, `md` 160px and `lg` 256px set the width, capped at the parent's; `full` fills the parent.
42
+ * `sm` 96px, `md` 160px, `lg` 256px and `xl` 448px set the width, capped at the parent's; `full`
43
+ * fills the parent.
41
44
  * @default full
42
45
  */
43
46
  width?: ImageWidth | undefined;
44
47
  /**
45
- * Sets the picture on a white mat with padding, always white, in every theme: a QR code is
46
- * scanned off a dark page. It shows the whole picture, as `fit="contain"`, whatever `fit` says.
48
+ * Where `fit="cover"` crops from: `center` keeps the middle of the picture, `top` keeps its top
49
+ * edge, for a screenshot whose header is the part to see.
50
+ * @default center
47
51
  */
48
- framed?: boolean | undefined;
52
+ crop?: "center" | "top" | undefined;
53
+ /**
54
+ * Sets the picture on a padded mat and shows the whole of it, as `fit="contain"`, whatever `fit`
55
+ * says. `white` is white in every theme, dark ones included, so a QR code, a barcode or a logo
56
+ * reads off a dark page. `page` is a ground a step below the page in each theme, for a
57
+ * screenshot. Left out, there is no mat.
58
+ */
59
+ mat?: "white" | "page" | undefined;
60
+ /**
61
+ * Makes the picture a link to its full size, opened in a new tab (`target="_blank"`,
62
+ * `rel="noreferrer"`), named by `alt`.
63
+ */
64
+ href?: string | undefined;
65
+ /**
66
+ * Marks the picture that is the page's largest one in the first view (its LCP): it loads at once
67
+ * with a high fetch priority. Every other picture loads lazily, when it nears the viewport.
68
+ * @default false
69
+ */
70
+ priority?: boolean | undefined;
49
71
  } & LoadingProps & Passthrough;
50
72
  /**
51
73
  * A picture in a fixed shape: `aspect` reserves the space before it loads, so the page does not
52
74
  * jump, and `fit` crops it to the shape or shows all of it. The corners are rounded and the frame
53
75
  * has a hairline. If the picture is missing or fails to load, a same-sized placeholder with a
54
- * picture mark stands in, still named by `alt`. `framed` mats a code or a logo in white. A user's photo is an `Avatar`; a clickable
76
+ * picture mark stands in, still named by `alt`. `mat` sets it on a padded mat: `white` for a code
77
+ * or a logo, `page` for a screenshot. `href` links it to its full size in a new tab. It loads
78
+ * lazily unless it is the `priority` picture. A user's photo is an `Avatar`; a clickable
55
79
  * thumbnail with a label is a `MediaTile`. While `loading` with no `src` yet it is a bone of the same
56
80
  * shape, not the placeholder, which means there is no picture.
57
81
  */
58
- export declare function Image({ src, alt, aspect, fit, width, framed, loading, loadingLabel, ...rest }: ImageProps): ReactElement;
82
+ export declare function Image({ src, alt, aspect, fit, width, crop, mat, href, priority, loading, loadingLabel, ...rest }: ImageProps): ReactElement;
package/dist/Image.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cx } from "./cx.js";
2
+ import { cx, focusRing } from "./cx.js";
3
3
  import { Icon } from "./Icon.js";
4
+ import { renderLink } from "./link.js";
4
5
  import { useLoading, WaitingBone } from "./skeleton.js";
5
6
  import { useImageFailed } from "./useImageFailed.js";
6
- const ASPECT = {
7
+ /** The class that reserves each shape. `Video` takes the same names, all but `natural`. */
8
+ export const ASPECT = {
7
9
  square: "aspect-square",
8
10
  "4:3": "aspect-[4/3]",
9
11
  "3:2": "aspect-[3/2]",
12
+ "16:10": "aspect-[16/10]",
10
13
  "16:9": "aspect-video",
11
14
  "3:4": "aspect-[3/4]",
12
15
  "9:16": "aspect-[9/16]",
@@ -23,23 +26,30 @@ export const IMAGE_WIDTH = {
23
26
  sm: "w-24 max-w-full",
24
27
  md: "w-40 max-w-full",
25
28
  lg: "w-64 max-w-full",
29
+ xl: "w-112 max-w-full",
26
30
  full: "w-full",
27
31
  };
28
32
  /** Every image sits on the inset surface with a hairline, so a letterbox or a pale picture has an edge. */
29
33
  const FRAME = "block rounded-lg border border-slate-200";
30
34
  const INSET = "bg-slate-100";
31
35
  /**
32
- * The white mat of `framed`. `bg-white/100` is the palette's media-matte role: a plain `bg-white` is
33
- * the surface, which a dark theme darkens, and a scanner needs the code on white. Every theme keeps
34
- * this one white, as it keeps the Lightbox scrim black.
36
+ * `white` is `bg-white/100`, the palette's media-matte role: a plain `bg-white` is the surface,
37
+ * which a dark theme darkens, and a scanner needs the code on white. Every theme keeps this one
38
+ * white, as it keeps the Lightbox scrim black. `page` is `bg-zinc-50`, the media-mat role, which
39
+ * each theme paints as a ground a step below its page: white in a light theme, dark in a dark one.
35
40
  */
36
- const MATTE = "bg-white/100 p-3";
41
+ const MAT = {
42
+ white: "bg-white/100 p-3",
43
+ page: "bg-zinc-50 p-3",
44
+ };
37
45
  const PICTURE = "M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.22a.75.75 0 0 0-1.06 0l-1.91 1.91.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.09a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z";
38
- /** The fill and the fit of a picture: `framed` is a white mat around all of it. */
39
- function pictureLook(fit, framed) {
40
- if (framed)
41
- return cx(MATTE, "object-contain");
42
- return cx(INSET, fit === "cover" ? "object-cover" : "object-contain");
46
+ /** The fill and the fit of a picture: a `mat` is padded around all of it. */
47
+ function pictureLook({ fit = "cover", crop = "center", mat, }) {
48
+ if (mat)
49
+ return cx(MAT[mat], "object-contain");
50
+ if (fit === "contain")
51
+ return cx(INSET, "object-contain");
52
+ return cx(INSET, "object-cover", crop === "top" && "object-top");
43
53
  }
44
54
  /** The shape a picture's stand-in reserves: its aspect, or 4:3 for a `natural` one. */
45
55
  const reservedAspect = (aspect) => aspect === "natural" ? PLACEHOLDER_ASPECT : ASPECT[aspect];
@@ -51,19 +61,54 @@ function ImageBone({ own, label, aspect, width, alt, attrs, }) {
51
61
  * A picture in a fixed shape: `aspect` reserves the space before it loads, so the page does not
52
62
  * jump, and `fit` crops it to the shape or shows all of it. The corners are rounded and the frame
53
63
  * has a hairline. If the picture is missing or fails to load, a same-sized placeholder with a
54
- * picture mark stands in, still named by `alt`. `framed` mats a code or a logo in white. A user's photo is an `Avatar`; a clickable
64
+ * picture mark stands in, still named by `alt`. `mat` sets it on a padded mat: `white` for a code
65
+ * or a logo, `page` for a screenshot. `href` links it to its full size in a new tab. It loads
66
+ * lazily unless it is the `priority` picture. A user's photo is an `Avatar`; a clickable
55
67
  * thumbnail with a label is a `MediaTile`. While `loading` with no `src` yet it is a bone of the same
56
68
  * shape, not the placeholder, which means there is no picture.
57
69
  */
58
- export function Image({ src, alt, aspect = "4:3", fit = "cover", width = "full", framed = false, loading, loadingLabel, ...rest }) {
70
+ export function Image({ src, alt, aspect = "4:3", fit, width = "full", crop, mat, href, priority, loading, loadingLabel, ...rest }) {
59
71
  const { ref, failed, markFailed } = useImageFailed(src);
60
72
  const waiting = useLoading(loading).loading;
61
73
  if (waiting && !src) {
62
74
  return (_jsx(ImageBone, { own: loading, label: loadingLabel, aspect: aspect, width: width, alt: alt, attrs: rest }));
63
75
  }
64
- const box = cx(FRAME, IMAGE_WIDTH[width]);
65
76
  if (src && !failed) {
66
- return (_jsx("img", { ...rest, ref: ref, src: src, alt: alt, className: cx(box, ASPECT[aspect], pictureLook(fit, framed)), onError: markFailed }));
77
+ const [onLink, onImg] = href === undefined ? [{}, rest] : splitLinkAttrs(rest);
78
+ const picture = (_jsx("img", { ...onImg, ref: ref, src: src, alt: alt, ...nativeLoading(priority), className: cx(FRAME, href === undefined ? IMAGE_WIDTH[width] : "w-full", ASPECT[aspect], pictureLook({ fit, crop, mat })), onError: markFailed }));
79
+ return linkedPicture(href, width, picture, onLink);
80
+ }
81
+ return _jsx(ImagePlaceholder, { alt: alt, aspect: aspect, width: width, attrs: rest });
82
+ }
83
+ /** How the browser fetches the `<img>`: lazily, or at once and first for the `priority` picture. */
84
+ function nativeLoading(priority = false) {
85
+ return priority
86
+ ? { loading: "eager", decoding: "async", fetchPriority: "high" }
87
+ : { loading: "lazy", decoding: "async" };
88
+ }
89
+ /** A linked picture's `id`, `data-*` and `aria-*`, which belong on the link (its root), and the rest, for the `<img>`. */
90
+ function splitLinkAttrs(attrs) {
91
+ const link = {};
92
+ const img = {};
93
+ for (const [key, value] of Object.entries(attrs)) {
94
+ const onLink = key === "id" || key.startsWith("data-") || key.startsWith("aria-");
95
+ (onLink ? link : img)[key] = value;
67
96
  }
68
- return (_jsx("span", { ...rest, ...(alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true }), className: cx(box, reservedAspect(aspect), INSET, "grid place-items-center text-slate-400"), children: _jsx(Icon, { size: "lg", children: _jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { d: PICTURE }) }) }) }));
97
+ return [link, img];
98
+ }
99
+ /** A picture with `href`: a link to its full size in a new tab, carrying the width and the focus ring. Without one, the picture alone. */
100
+ function linkedPicture(href, width, picture, attrs) {
101
+ if (href === undefined)
102
+ return picture;
103
+ return renderLink({
104
+ ...attrs,
105
+ href,
106
+ external: true,
107
+ className: cx("block rounded-lg", IMAGE_WIDTH[width], focusRing),
108
+ children: picture,
109
+ });
110
+ }
111
+ /** A picture that is missing or broken: a same-sized box with a picture mark, still named by `alt`. */
112
+ function ImagePlaceholder({ alt, aspect, width, attrs, }) {
113
+ return (_jsx("span", { ...attrs, ...(alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true }), className: cx(FRAME, IMAGE_WIDTH[width], reservedAspect(aspect), INSET, "grid place-items-center text-slate-400"), children: _jsx(Icon, { size: "lg", children: _jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { d: PICTURE }) }) }) }));
69
114
  }
package/dist/Input.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { Unstyled } from "./props.js";
10
10
  * value in tabular figures and brings up the phone's number keypad (`inputMode="decimal"` unless
11
11
  * you pass your own), and stays a text field, so "1 250" is kept as typed; never use
12
12
  * `type="number"` for a figure a person types. `type="search"` drops the browser's own search look and shows a clear button at the
13
- * trailing edge while the field has a value, named by `clearLabel`. The `ref` reaches the `<input>`.
13
+ * trailing edge while the field has a value, named by `clearLabel`, and Escape clears it. The `ref` reaches the `<input>`.
14
14
  */
15
15
  export declare function Input({ icon, prefix, size, width, numeric, clearLabel, ...own }: ({
16
16
  /** A leading icon inside the field, by name (`search`). Not with `prefix`. */
package/dist/Input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CONTROL_PAD, controlClass, NUMERIC_VALUE } from "./control.js";
2
+ import { controlClass, controlPad, NUMERIC_VALUE } from "./control.js";
3
3
  import { cx } from "./cx.js";
4
4
  import { useTypeStep } from "./density.js";
5
5
  import { Icon } from "./Icon.js";
@@ -14,7 +14,7 @@ import { useFieldControl } from "./fieldControl.js";
14
14
  * value in tabular figures and brings up the phone's number keypad (`inputMode="decimal"` unless
15
15
  * you pass your own), and stays a text field, so "1 250" is kept as typed; never use
16
16
  * `type="number"` for a figure a person types. `type="search"` drops the browser's own search look and shows a clear button at the
17
- * trailing edge while the field has a value, named by `clearLabel`. The `ref` reaches the `<input>`.
17
+ * trailing edge while the field has a value, named by `clearLabel`, and Escape clears it. The `ref` reaches the `<input>`.
18
18
  */
19
19
  export function Input({ icon, prefix, size = "md", width = "full", numeric, clearLabel, ...own }) {
20
20
  const step = useTypeStep();
@@ -27,9 +27,9 @@ export function Input({ icon, prefix, size = "md", width = "full", numeric, clea
27
27
  return (_jsx(PrefixShell, { prefix: prefix, size: size, width: width, disabled: rest.disabled, children: _jsx("input", { ...rest, className: cx("min-w-0 flex-1 bg-transparent px-1 text-ellipsis outline-none placeholder:text-slate-400", value) }) }));
28
28
  }
29
29
  if (glyph === undefined) {
30
- return (_jsx("input", { ...rest, className: cx(controlClass(size, width, step), CONTROL_PAD[size].x, value) }));
30
+ return (_jsx("input", { ...rest, className: cx(controlClass(size, width, step), controlPad(size), value) }));
31
31
  }
32
- return (_jsx(InputShell, { icon: glyph, size: size, width: width, children: _jsx("input", { ...rest, className: cx(controlClass(size, width === "auto" ? "auto" : "full", step), CONTROL_PAD[size].icon, value) }) }));
32
+ return (_jsx(InputShell, { icon: glyph, size: size, width: width, children: _jsx("input", { ...rest, className: cx(controlClass(size, width === "auto" ? "auto" : "full", step), controlPad(size, true), value) }) }));
33
33
  }
34
34
  /**
35
35
  * A `numeric` field's props and value class: the decimal keypad unless the caller chose one, and
@@ -1,5 +1,12 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
2
  import { type ControlProps } from "./control.js";
3
+ /** The shells' size tables and their `md:` twins, for the data test. */
4
+ export declare const shellSizeTables: {
5
+ icon: Record<import("./size.js").Size, string>;
6
+ iconMd: Record<import("./size.js").Size, string>;
7
+ prefix: Record<import("./size.js").Size, string>;
8
+ prefixMd: Record<import("./size.js").Size, string>;
9
+ };
3
10
  /**
4
11
  * The relative wrapper of an `Input` that holds more than the field: a leading `icon` and, for search, the clear button. Not exported from the package.
5
12
  *
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CONTROL_WIDTH, controlClass } from "./control.js";
2
+ import { CONTROL_WIDTH, controlClass, INVALID_EDGE_WITHIN, } from "./control.js";
3
3
  import { cx } from "./cx.js";
4
4
  import { useTypeStep } from "./density.js";
5
+ import { sizeClass } from "./size.js";
5
6
  /**
6
7
  * Where a leading icon sits, and its size, by the control's size. The wrapper is a flex box centred
7
8
  * on the field, so the icon's own box centres too, and its one child is sized whether it is a bare
@@ -12,12 +13,26 @@ const ICON = {
12
13
  md: "left-3 [&>*]:size-4",
13
14
  lg: "left-4 [&>*]:size-5",
14
15
  };
16
+ /** `ICON` from the `md` breakpoint up, for a responsive size. */
17
+ const ICON_MD = {
18
+ sm: "md:left-2 md:[&>*]:size-3.5",
19
+ md: "md:left-3 md:[&>*]:size-4",
20
+ lg: "md:left-4 md:[&>*]:size-5",
21
+ };
15
22
  /** The prefix text's inset and size, by the control's size. */
16
23
  const PREFIX = {
17
24
  sm: "pl-2 text-xs",
18
25
  md: "pl-3 text-sm",
19
26
  lg: "pl-4 text-base",
20
27
  };
28
+ /** `PREFIX` from the `md` breakpoint up. */
29
+ const PREFIX_MD = {
30
+ sm: "md:pl-2 md:text-xs",
31
+ md: "md:pl-3 md:text-sm",
32
+ lg: "md:pl-4 md:text-base",
33
+ };
34
+ /** The shells' size tables and their `md:` twins, for the data test. */
35
+ export const shellSizeTables = { icon: ICON, iconMd: ICON_MD, prefix: PREFIX, prefixMd: PREFIX_MD };
21
36
  /**
22
37
  * The relative wrapper of an `Input` that holds more than the field: a leading `icon` and, for search, the clear button. Not exported from the package.
23
38
  *
@@ -28,7 +43,7 @@ const PREFIX = {
28
43
  * already sits above it.
29
44
  */
30
45
  export function InputShell({ icon, size = "md", width = "full", children, }) {
31
- return (_jsxs("div", { className: cx("relative", width === "auto" && "inline-block", width !== "full" && CONTROL_WIDTH[width]), children: [icon !== undefined && (_jsx("span", { "aria-hidden": "true", className: cx("pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center leading-none text-slate-400 in-[.isolate]:z-20", ICON[size]), children: icon })), children] }));
46
+ return (_jsxs("div", { className: cx("relative", width === "auto" && "inline-block", width !== "full" && CONTROL_WIDTH[width]), children: [icon !== undefined && (_jsx("span", { "aria-hidden": "true", className: cx("pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center leading-none text-slate-400 in-[.isolate]:z-20", sizeClass(ICON, ICON_MD, size)), children: icon })), children] }));
32
47
  }
33
48
  /**
34
49
  * The field box of an `Input` with a `prefix`: the control look and the focus ring sit on the
@@ -36,5 +51,5 @@ export function InputShell({ icon, size = "md", width = "full", children, }) {
36
51
  */
37
52
  export function PrefixShell({ prefix, size = "md", width = "full", disabled, children, }) {
38
53
  const step = useTypeStep();
39
- return (_jsxs("div", { className: cx(controlClass(size, width, step), "flex items-center has-aria-invalid:border-red-200 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-violet-600", width === "auto" && "inline-flex", disabled && "opacity-50"), children: [_jsx("span", { className: cx("shrink-0 select-none text-slate-500", PREFIX[size]), children: prefix }), children] }));
54
+ return (_jsxs("div", { className: cx(controlClass(size, width, step), "flex items-center has-autofill:shadow-[inset_3px_0_0_0_currentColor] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-violet-600", INVALID_EDGE_WITHIN, width === "auto" && "inline-flex", disabled && "opacity-50"), children: [_jsx("span", { className: cx("shrink-0 select-none text-slate-500", sizeClass(PREFIX, PREFIX_MD, size)), children: prefix }), children] }));
40
55
  }
@@ -2,7 +2,8 @@ import { type ReactElement, type ReactNode } from "react";
2
2
  import type { Passthrough } from "./props.js";
3
3
  import { type LoadingProps } from "./skeleton.js";
4
4
  import { type TextTone } from "./typography.js";
5
- type KeyValueAlign = "end" | "start";
5
+ /** Where a `KeyValueList`'s values sit: `end`, across from their labels, or `start`, under them. */
6
+ export type KeyValueAlign = "end" | "start";
6
7
  /**
7
8
  * A definition list of label/value rows. By default each label is on the left and its value
8
9
  * right-aligned. `align="start"` puts every value left-aligned in one column beside the labels,
@@ -31,4 +32,3 @@ export declare function KeyValue({ label, total, tone, loading: ownLoading, load
31
32
  tone?: TextTone | undefined;
32
33
  children?: ReactNode;
33
34
  } & LoadingProps & Passthrough): ReactElement;
34
- export {};
package/dist/Lightbox.js CHANGED
@@ -5,11 +5,13 @@ import { useModal } from "./modal.js";
5
5
  import { Tipped } from "./Tooltip.js";
6
6
  /**
7
7
  * The full-screen viewer, painted with its own scrim: `bg-black/90` and the light text on it are the
8
- * palette's media-scrim role, which every theme keeps near-black, light themes included.
8
+ * palette's media-scrim role, which every theme keeps near-black, light themes included. Its colour
9
+ * scheme is dark in every theme, so a `<video>`'s native controls match the scrim. A scroll on it
10
+ * never carries on to the page behind.
9
11
  */
10
- const VIEWER = "fixed inset-0 m-0 size-full max-h-none max-w-none flex-col border-0 bg-black/90 p-0 text-white opacity-0 transition-[opacity,overlay,display] transition-discrete duration-200 open:flex open:opacity-100 starting:open:opacity-0 motion-reduce:transition-none";
12
+ const VIEWER = "fixed inset-0 m-0 size-full max-h-none max-w-none flex-col overflow-hidden overscroll-contain border-0 bg-black/90 scheme-dark p-0 text-white opacity-0 transition-[opacity,overlay,display] transition-discrete duration-200 open:flex open:opacity-100 starting:open:opacity-0 motion-reduce:transition-none";
11
13
  /** A round control on the scrim, with a light focus ring: the accent is too dark on near-black in a light theme. */
12
- const CONTROL = "inline-flex size-11 shrink-0 items-center justify-center rounded-full text-white transition hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white";
14
+ const CONTROL = "inline-flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-full text-white transition hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white";
13
15
  /** The cross glyph on a 20px grid; `MediaTile`'s remove button draws the same one. */
14
16
  export const CLOSE = "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";
15
17
  const PREVIOUS = "M12.78 4.22a.75.75 0 0 1 0 1.06L8.06 10l4.72 4.72a.75.75 0 1 1-1.06 1.06l-5.25-5.25a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z";
package/dist/ListRow.d.ts CHANGED
@@ -7,8 +7,8 @@ export type { ListRowProps } from "./listRowProps.js";
7
7
  * `<button>` or link stretched over it, so a tap anywhere on the row runs it; a `TextLink`,
8
8
  * `Button` or `Checkbox` in the row (in `trailing`, say a "View" link on a row that selects) sits
9
9
  * above it and is clickable on its own. A button row's button is named by the label alone. With `expanded` it is the header of a
10
- * collapsible section: `aria-expanded` and a chevron. Rows sit in a `Card flush`; `divided` draws
11
- * the line between them, on each row after the first.
10
+ * collapsible section: `aria-expanded` and a chevron. Rows sit in a `Card flush`, in a
11
+ * `Stack divided` that draws the line between them.
12
12
  *
13
13
  * `secondary` is a second, muted line under the label. `leading` is content before the label (`leadingWidth="thumbnail"` gives it a fixed picture width),
14
14
  * `selected` marks the row in view, `focused` the one the keyboard cursor is on and `highlighted` fills
@@ -16,10 +16,9 @@ export type { ListRowProps } from "./listRowProps.js";
16
16
  * every form; on a button or linked row the pointer handlers go on the row itself). The label is a
17
17
  * `<div>`, so it can hold block content (a name over a path). A row with no `href` and no
18
18
  * `onClick` is a plain `<div>` with no action of its own, for one that holds its own buttons:
19
- * `actions` follow `trailing`, and `revealOnHover` shows them only on hover or focus. Such a row
19
+ * `actions` follow `trailing`, always shown, so a touch, a keyboard and a pointer find them alike. Such a row
20
20
  * also takes a `panel`, content under the row that starts where the label does (a conversation
21
- * that opens under its chat); `divided` draws the line above the whole row, panel included, so a
22
- * list of them is `divided={index > 0}` on each. Inside a row a `Stack` is `xs` apart, and a `sm`
21
+ * that opens under its chat); in a `Stack divided` the line sits above the whole row, panel included. Inside a row a `Stack` is `xs` apart, and a `sm`
23
22
  * row makes the buttons in it `sm`. While `loading` an empty label is a bone, and what the row holds
24
23
  * waits with it.
25
24
  */
package/dist/ListRow.js CHANGED
@@ -7,7 +7,8 @@ import { renderLink } from "./link.js";
7
7
  import { GapProvider } from "./stackGap.js";
8
8
  import { LoadingScope, useLoading } from "./skeleton.js";
9
9
  import { waitingRow } from "./listRowWait.js";
10
- import { SELECTED } from "./tableRow.js";
10
+ import { SELECTED, STRIPE } from "./tableRow.js";
11
+ import { TEXT_TONE } from "./typography.js";
11
12
  import { hasReason, useBlocked } from "./blocked.js";
12
13
  const ROW_LOOK = "flex w-full items-center gap-3 text-left text-sm text-slate-900";
13
14
  const INSET_RING = `${focusRing} focus-visible:-outline-offset-2`;
@@ -37,20 +38,20 @@ const FILL = "hover:bg-slate-50";
37
38
  const HIGHLIGHTED = "bg-slate-100";
38
39
  /** The keyboard cursor: the focus ring, drawn inside the row, on a row that does not hold DOM focus. */
39
40
  const FOCUSED = "outline-2 -outline-offset-2 outline-violet-600";
40
- /** A thumbnail's width. A direct-child image fills it. */
41
- const THUMBNAIL = "block w-32 [&>img]:block [&>img]:h-auto [&>img]:w-full";
42
41
  /**
43
- * Hidden until the row is hovered or has focus inside it; always shown where any pointer is coarse
44
- * (a touch screen, hybrids included), and while a `Menu` in it is open, since its menu takes the
45
- * focus out of the row.
42
+ * A thumbnail's width, a step narrower on a screen narrower than `sm` (a phone), so the label keeps
43
+ * its room. A direct-child image fills it. A viewport query, not a container query: a container has
44
+ * no width of its own, so a row in a box that sizes to its content would collapse to nothing.
46
45
  */
47
- const REVEAL = "opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 any-pointer-coarse:opacity-100 has-[[aria-expanded=true]]:opacity-100";
46
+ const THUMBNAIL = "block w-32 max-sm:w-24 [&>img]:block [&>img]:h-auto [&>img]:w-full";
47
+ /** A thumbnail row's label and `trailing`: side by side, and `trailing` under the label on a phone. */
48
+ const THUMBNAIL_LINES = "flex min-w-0 flex-1 items-center gap-3 max-sm:flex-col max-sm:items-start max-sm:gap-1";
48
49
  const PAD = { sm: "px-3 py-2", md: "px-4 py-3", lg: "px-5 py-4" };
49
50
  /** A row with no `href` and no `onClick` is static: it does nothing of its own. */
50
51
  function isStatic(props) {
51
52
  return props.href === undefined && props.onClick === undefined;
52
53
  }
53
- /** The row's background: the selected fill, else the hover fill unless a plain static row has none. */
54
+ /** The row's background: the selected fill, else the hover fill; a static row has none. */
54
55
  function fillOf(props) {
55
56
  if (props.selected)
56
57
  return SELECTED;
@@ -58,7 +59,7 @@ function fillOf(props) {
58
59
  return HIGHLIGHTED;
59
60
  if (isDisabled(props))
60
61
  return undefined;
61
- return isStatic(props) && !props.revealOnHover ? undefined : FILL;
62
+ return isStatic(props) ? undefined : FILL;
62
63
  }
63
64
  /** A button row with `disabled` or `disabledReason`: it fades and takes no hover fill. */
64
65
  function isDisabled(props) {
@@ -66,6 +67,12 @@ function isDisabled(props) {
66
67
  return true;
67
68
  return !isStatic(props) && "disabled" in props && props.disabled === true;
68
69
  }
70
+ /** The row's status stripe on its leading edge, in the tone's ink: drawn, so read by no one. */
71
+ function StripeMark({ tone }) {
72
+ if (tone === undefined)
73
+ return null;
74
+ return (_jsx("span", { "aria-hidden": "true", className: cx("pointer-events-none absolute inset-y-0 left-0 w-1", TEXT_TONE[tone], STRIPE) }));
75
+ }
69
76
  /** `panel={open && <Panel />}` is a common way to write it, so `false` is as empty as `null`. */
70
77
  function hasPanel(panel) {
71
78
  return panel != null && panel !== false;
@@ -76,23 +83,23 @@ function rowBase(props) {
76
83
  return hasPanel(props.panel) ? STATIC_PANEL : STATIC;
77
84
  }
78
85
  function look(props) {
79
- const { size = "md", divided = false, focused = false } = props;
80
- return cx(rowBase(props), PAD[size], divided && "border-t border-slate-200/70", fillOf(props), isDisabled(props) && DISABLED, focused && FOCUSED);
86
+ const { size = "md", focused = false } = props;
87
+ return cx(rowBase(props), props.stripe !== undefined && "relative", PAD[size], fillOf(props), isDisabled(props) && DISABLED, focused && FOCUSED);
81
88
  }
82
89
  function StaticRow(props) {
83
- const { leading: _l, secondary: _sec, leadingWidth: _lw, trailing: _t, focused: _f, highlighted = false, selected, size: _s, divided: _d, actions, revealOnHover = false, panel, expanded: _e, onClick: _o, href: _h, start, label, end, ...rest } = props;
84
- const buttons = actions != null && (_jsx("span", { className: cx("flex shrink-0 items-center gap-2", revealOnHover && !highlighted && REVEAL), children: actions }));
90
+ const { leading: _l, secondary: _sec, leadingWidth: _lw, stripe, trailing: _t, focused: _f, highlighted: _hl, selected, size: _s, actions, panel, expanded: _e, onClick: _o, href: _h, start, label, end, ...rest } = props;
91
+ const buttons = actions != null && (_jsx("span", { className: "flex shrink-0 items-center gap-2", children: actions }));
85
92
  const withPanel = hasPanel(panel);
86
- return (_jsx("div", { ...rest, ...(selected ? { "aria-current": "true" } : {}), className: cx(look(props), withPanel && PANEL_COLUMNS[start ? "withLeading" : "alone"]), children: withPanel ? (_jsxs(PanelLines, { start: start, panel: panel, children: [label, end, buttons] })) : (_jsxs(_Fragment, { children: [start, label, end, buttons] })) }));
93
+ return (_jsxs("div", { ...rest, ...(selected ? { "aria-current": "true" } : {}), className: cx(look(props), withPanel && PANEL_COLUMNS[start ? "withLeading" : "alone"]), children: [_jsx(StripeMark, { tone: stripe }), withPanel ? (_jsxs(PanelLines, { start: start, panel: panel, children: [label, end, buttons] })) : (_jsxs(_Fragment, { children: [start, label, end, buttons] }))] }));
87
94
  }
88
95
  /** The cells of a static row with a `panel`: `start` beside the row's line (its children), over the panel in the label's column. */
89
96
  function PanelLines({ start, panel, children, }) {
90
97
  return (_jsxs(_Fragment, { children: [start, _jsx("div", { className: "flex min-w-0 items-center gap-3", children: children }), _jsx("div", { className: cx("min-w-0", Boolean(start) && "col-start-2"), children: panel })] }));
91
98
  }
92
99
  function LinkRow(props) {
93
- const { leading: _l, secondary: _sec, leadingWidth: _lw, trailing: _t, focused: _f, highlighted: _hl, selected, expanded: _e, size: _s, divided: _d, actions: _a, revealOnHover: _rh, panel: _p, start, label, end, onPointerEnter, onPointerLeave, ...rest } = props;
100
+ const { leading: _l, secondary: _sec, leadingWidth: _lw, stripe, trailing: _t, focused: _f, highlighted: _hl, selected, expanded: _e, size: _s, actions: _a, panel: _p, start, label, end, onPointerEnter, onPointerLeave, ...rest } = props;
94
101
  const rowId = useId();
95
- return (_jsxs("div", { id: rowId, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, className: look(props), children: [renderLink({
102
+ return (_jsxs("div", { id: rowId, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, className: look(props), children: [_jsx(StripeMark, { tone: stripe }), renderLink({
96
103
  ...(rest["aria-label"] === undefined ? { "aria-labelledby": rowId } : {}),
97
104
  ...rest,
98
105
  ...(selected ? { "aria-current": "true" } : {}),
@@ -101,9 +108,9 @@ function LinkRow(props) {
101
108
  }), start, label, end] }));
102
109
  }
103
110
  function ButtonRow(props) {
104
- const { leading: _l, secondary: _sec, leadingWidth: _lw, trailing: _t, focused: _f, highlighted: _hl, selected, expanded, size: _s, divided: _d, actions: _a, revealOnHover: _rh, panel: _p, href: _h, start, label, end, labelId, children: _c, onPointerEnter, onPointerLeave, disabledReason, ...rest } = props;
111
+ const { leading: _l, secondary: _sec, leadingWidth: _lw, stripe, trailing: _t, focused: _f, highlighted: _hl, selected, expanded, size: _s, actions: _a, panel: _p, href: _h, start, label, end, labelId, children: _c, onPointerEnter, onPointerLeave, disabledReason, ...rest } = props;
105
112
  const { props: guard, tooltip, blocked } = useBlocked(disabledReason, rest);
106
- return (_jsxs("div", { onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, className: look(props), children: [_jsx("button", { type: "button", ...(rest["aria-label"] === undefined ? { "aria-labelledby": labelId } : {}), ...rest, ...guard, ...(selected ? { "aria-current": "true" } : {}), ...(expanded === undefined ? {} : { "aria-expanded": expanded }), className: cx(OVERLAY, blocked && "cursor-not-allowed") }), tooltip, expanded !== undefined && _jsx(Chevron, { open: expanded }), start, label, end] }));
113
+ return (_jsxs("div", { onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, className: look(props), children: [_jsx(StripeMark, { tone: stripe }), _jsx("button", { type: "button", ...(rest["aria-label"] === undefined ? { "aria-labelledby": labelId } : {}), ...rest, ...guard, ...(selected ? { "aria-current": "true" } : {}), ...(expanded === undefined ? {} : { "aria-expanded": expanded }), className: cx(OVERLAY, blocked ? "cursor-not-allowed" : "cursor-pointer") }), tooltip, expanded !== undefined && _jsx(Chevron, { open: expanded }), start, label, end] }));
107
114
  }
108
115
  /**
109
116
  * A full-width row that runs `onClick` (or, with `href`, opens a link) with a hover
@@ -111,8 +118,8 @@ function ButtonRow(props) {
111
118
  * `<button>` or link stretched over it, so a tap anywhere on the row runs it; a `TextLink`,
112
119
  * `Button` or `Checkbox` in the row (in `trailing`, say a "View" link on a row that selects) sits
113
120
  * above it and is clickable on its own. A button row's button is named by the label alone. With `expanded` it is the header of a
114
- * collapsible section: `aria-expanded` and a chevron. Rows sit in a `Card flush`; `divided` draws
115
- * the line between them, on each row after the first.
121
+ * collapsible section: `aria-expanded` and a chevron. Rows sit in a `Card flush`, in a
122
+ * `Stack divided` that draws the line between them.
116
123
  *
117
124
  * `secondary` is a second, muted line under the label. `leading` is content before the label (`leadingWidth="thumbnail"` gives it a fixed picture width),
118
125
  * `selected` marks the row in view, `focused` the one the keyboard cursor is on and `highlighted` fills
@@ -120,10 +127,9 @@ function ButtonRow(props) {
120
127
  * every form; on a button or linked row the pointer handlers go on the row itself). The label is a
121
128
  * `<div>`, so it can hold block content (a name over a path). A row with no `href` and no
122
129
  * `onClick` is a plain `<div>` with no action of its own, for one that holds its own buttons:
123
- * `actions` follow `trailing`, and `revealOnHover` shows them only on hover or focus. Such a row
130
+ * `actions` follow `trailing`, always shown, so a touch, a keyboard and a pointer find them alike. Such a row
124
131
  * also takes a `panel`, content under the row that starts where the label does (a conversation
125
- * that opens under its chat); `divided` draws the line above the whole row, panel included, so a
126
- * list of them is `divided={index > 0}` on each. Inside a row a `Stack` is `xs` apart, and a `sm`
132
+ * that opens under its chat); in a `Stack divided` the line sits above the whole row, panel included. Inside a row a `Stack` is `xs` apart, and a `sm`
127
133
  * row makes the buttons in it `sm`. While `loading` an empty label is a bone, and what the row holds
128
134
  * waits with it.
129
135
  */
@@ -143,9 +149,13 @@ function rowOf(props, labelId) {
143
149
  /** The row's cells. `labelId` names the label, for a button row's button to be labelled by it. */
144
150
  function piecesOf(props, labelId) {
145
151
  const { leading, leadingWidth, trailing, secondary, children } = props;
152
+ const label = (_jsxs("div", { id: labelId, className: "min-w-0 flex-1", children: [children, secondary != null && secondary !== false && (_jsx("div", { className: "text-xs font-normal text-slate-500", children: secondary }))] }));
153
+ const end = trailing != null && (_jsx("span", { className: "shrink-0 tabular-nums text-slate-500", children: trailing }));
154
+ const thumbnail = leadingWidth === "thumbnail";
146
155
  return {
147
- start: leading != null && (_jsx("span", { className: cx("shrink-0", leadingWidth === "thumbnail" && THUMBNAIL), children: leading })),
148
- label: (_jsxs("div", { id: labelId, className: "min-w-0 flex-1", children: [children, secondary != null && secondary !== false && (_jsx("div", { className: "text-xs font-normal text-slate-500", children: secondary }))] })),
149
- end: trailing != null && (_jsx("span", { className: "shrink-0 tabular-nums text-slate-500", children: trailing })),
156
+ start: leading != null && (_jsx("span", { className: cx("shrink-0", thumbnail && THUMBNAIL), children: leading })),
157
+ // Beside a thumbnail, a narrow row puts `trailing` under the label, or the label is squeezed to a word.
158
+ label: thumbnail && end ? (_jsxs("div", { className: THUMBNAIL_LINES, children: [label, end] })) : (label),
159
+ end: thumbnail ? null : end,
150
160
  };
151
161
  }
package/dist/Mark.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import type { Passthrough } from "./props.js";
3
+ /**
4
+ * A highlighted run inside text: a `<mark>`, on the warn tint, such as the words a search matched
5
+ * in a result. It takes the surrounding size and weight. Mark the words that matter to what the
6
+ * reader is doing, not emphasis: that is `Text strong`.
7
+ */
8
+ export declare function Mark({ children, ...rest }: {
9
+ children: ReactNode;
10
+ } & Passthrough): ReactElement;