@slashsuite/ui-react 0.0.0-stage → 0.12.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 (304) hide show
  1. package/LICENSE +21 -0
  2. package/MIGRATING.md +540 -0
  3. package/README.md +549 -2
  4. package/dist/AppShell.d.ts +127 -0
  5. package/dist/AppShell.js +119 -0
  6. package/dist/AppShellMenu.d.ts +26 -0
  7. package/dist/AppShellMenu.js +66 -0
  8. package/dist/Avatar.d.ts +75 -0
  9. package/dist/Avatar.js +95 -0
  10. package/dist/AvatarStack.d.ts +31 -0
  11. package/dist/AvatarStack.js +34 -0
  12. package/dist/Badge.d.ts +15 -0
  13. package/dist/Badge.js +15 -0
  14. package/dist/BottomSheet.d.ts +36 -0
  15. package/dist/BottomSheet.js +142 -0
  16. package/dist/Breadcrumbs.d.ts +27 -0
  17. package/dist/Breadcrumbs.js +29 -0
  18. package/dist/BulletList.d.ts +18 -0
  19. package/dist/BulletList.js +18 -0
  20. package/dist/Button.d.ts +121 -0
  21. package/dist/Button.js +182 -0
  22. package/dist/ButtonGroup.d.ts +15 -0
  23. package/dist/ButtonGroup.js +10 -0
  24. package/dist/Callout.d.ts +43 -0
  25. package/dist/Callout.js +45 -0
  26. package/dist/Card.d.ts +148 -0
  27. package/dist/Card.js +171 -0
  28. package/dist/CardBadge.d.ts +7 -0
  29. package/dist/CardBadge.js +12 -0
  30. package/dist/CardBody.d.ts +28 -0
  31. package/dist/CardBody.js +30 -0
  32. package/dist/CardGrid.d.ts +53 -0
  33. package/dist/CardGrid.js +52 -0
  34. package/dist/CardParts.d.ts +40 -0
  35. package/dist/CardParts.js +41 -0
  36. package/dist/ChatComposer.d.ts +35 -0
  37. package/dist/ChatComposer.js +50 -0
  38. package/dist/ChatMessage.d.ts +26 -0
  39. package/dist/ChatMessage.js +21 -0
  40. package/dist/ChatThread.d.ts +25 -0
  41. package/dist/ChatThread.js +60 -0
  42. package/dist/Checkbox.d.ts +42 -0
  43. package/dist/Checkbox.js +63 -0
  44. package/dist/Chevron.d.ts +5 -0
  45. package/dist/Chevron.js +6 -0
  46. package/dist/Cluster.d.ts +70 -0
  47. package/dist/Cluster.js +47 -0
  48. package/dist/Code.d.ts +6 -0
  49. package/dist/Code.js +5 -0
  50. package/dist/CodeBlock.d.ts +46 -0
  51. package/dist/CodeBlock.js +21 -0
  52. package/dist/CodeBody.d.ts +20 -0
  53. package/dist/CodeBody.js +38 -0
  54. package/dist/CodeExample.d.ts +25 -0
  55. package/dist/CodeExample.js +17 -0
  56. package/dist/CodeText.d.ts +11 -0
  57. package/dist/CodeText.js +64 -0
  58. package/dist/ColourSchemeToggle.d.ts +36 -0
  59. package/dist/ColourSchemeToggle.js +64 -0
  60. package/dist/Container.d.ts +22 -0
  61. package/dist/Container.js +26 -0
  62. package/dist/CopyButton.d.ts +17 -0
  63. package/dist/CopyButton.js +39 -0
  64. package/dist/CopyLine.d.ts +9 -0
  65. package/dist/CopyLine.js +7 -0
  66. package/dist/DateCalendar.d.ts +23 -0
  67. package/dist/DateCalendar.js +89 -0
  68. package/dist/DateField.d.ts +124 -0
  69. package/dist/DateField.js +111 -0
  70. package/dist/DateFieldCalendar.d.ts +24 -0
  71. package/dist/DateFieldCalendar.js +50 -0
  72. package/dist/DateRangePicker.d.ts +47 -0
  73. package/dist/DateRangePicker.js +44 -0
  74. package/dist/Dialog.d.ts +56 -0
  75. package/dist/Dialog.js +94 -0
  76. package/dist/Disclosure.d.ts +29 -0
  77. package/dist/Disclosure.js +23 -0
  78. package/dist/Divider.d.ts +4 -0
  79. package/dist/Divider.js +5 -0
  80. package/dist/DocsLayout.d.ts +69 -0
  81. package/dist/DocsLayout.js +64 -0
  82. package/dist/Drawer.d.ts +30 -0
  83. package/dist/Drawer.js +24 -0
  84. package/dist/EmptyState.d.ts +47 -0
  85. package/dist/EmptyState.js +34 -0
  86. package/dist/Field.d.ts +44 -0
  87. package/dist/Field.js +51 -0
  88. package/dist/FieldDialog.d.ts +26 -0
  89. package/dist/FieldDialog.js +31 -0
  90. package/dist/Fieldset.d.ts +21 -0
  91. package/dist/Fieldset.js +22 -0
  92. package/dist/FileDrop.d.ts +17 -0
  93. package/dist/FileDrop.js +14 -0
  94. package/dist/FormRow.d.ts +46 -0
  95. package/dist/FormRow.js +39 -0
  96. package/dist/Hero.d.ts +23 -0
  97. package/dist/Hero.js +28 -0
  98. package/dist/Icon.d.ts +40 -0
  99. package/dist/Icon.js +30 -0
  100. package/dist/IconButton.d.ts +72 -0
  101. package/dist/IconButton.js +65 -0
  102. package/dist/Image.d.ts +58 -0
  103. package/dist/Image.js +69 -0
  104. package/dist/InlineEdit.d.ts +22 -0
  105. package/dist/InlineEdit.js +60 -0
  106. package/dist/Input.d.ts +40 -0
  107. package/dist/Input.js +42 -0
  108. package/dist/InputShell.d.ts +24 -0
  109. package/dist/InputShell.js +40 -0
  110. package/dist/Kbd.d.ts +6 -0
  111. package/dist/Kbd.js +5 -0
  112. package/dist/KeyValueList.d.ts +34 -0
  113. package/dist/KeyValueList.js +35 -0
  114. package/dist/Lightbox.d.ts +45 -0
  115. package/dist/Lightbox.js +46 -0
  116. package/dist/ListRow.d.ts +26 -0
  117. package/dist/ListRow.js +151 -0
  118. package/dist/Markdown.d.ts +11 -0
  119. package/dist/Markdown.js +49 -0
  120. package/dist/MediaTile.d.ts +66 -0
  121. package/dist/MediaTile.js +50 -0
  122. package/dist/Menu.d.ts +64 -0
  123. package/dist/Menu.js +86 -0
  124. package/dist/MetaList.d.ts +23 -0
  125. package/dist/MetaList.js +20 -0
  126. package/dist/Morph.d.ts +41 -0
  127. package/dist/Morph.js +107 -0
  128. package/dist/NavigationProgress.d.ts +20 -0
  129. package/dist/NavigationProgress.js +26 -0
  130. package/dist/OutlineRegion.d.ts +60 -0
  131. package/dist/OutlineRegion.js +51 -0
  132. package/dist/PageFade.d.ts +30 -0
  133. package/dist/PageFade.js +46 -0
  134. package/dist/PageHeader.d.ts +26 -0
  135. package/dist/PageHeader.js +18 -0
  136. package/dist/PageLayouts.d.ts +100 -0
  137. package/dist/PageLayouts.js +78 -0
  138. package/dist/Pagination.d.ts +38 -0
  139. package/dist/Pagination.js +65 -0
  140. package/dist/Pill.d.ts +79 -0
  141. package/dist/Pill.js +121 -0
  142. package/dist/ProgressBar.d.ts +47 -0
  143. package/dist/ProgressBar.js +47 -0
  144. package/dist/RadioGroup.d.ts +55 -0
  145. package/dist/RadioGroup.js +53 -0
  146. package/dist/ScrollStrip.d.ts +21 -0
  147. package/dist/ScrollStrip.js +12 -0
  148. package/dist/SearchInput.d.ts +9 -0
  149. package/dist/SearchInput.js +55 -0
  150. package/dist/Section.d.ts +93 -0
  151. package/dist/Section.js +55 -0
  152. package/dist/SegmentedControl.d.ts +47 -0
  153. package/dist/SegmentedControl.js +78 -0
  154. package/dist/Select.d.ts +28 -0
  155. package/dist/Select.js +19 -0
  156. package/dist/Show.d.ts +33 -0
  157. package/dist/Show.js +27 -0
  158. package/dist/SideColumn.d.ts +50 -0
  159. package/dist/SideColumn.js +45 -0
  160. package/dist/SidebarLayout.d.ts +32 -0
  161. package/dist/SidebarLayout.js +77 -0
  162. package/dist/SiteFooter.d.ts +31 -0
  163. package/dist/SiteFooter.js +24 -0
  164. package/dist/SiteSearch.d.ts +40 -0
  165. package/dist/SiteSearch.js +150 -0
  166. package/dist/SortableList.d.ts +86 -0
  167. package/dist/SortableList.js +191 -0
  168. package/dist/SplitBar.d.ts +29 -0
  169. package/dist/SplitBar.js +22 -0
  170. package/dist/Stack.d.ts +114 -0
  171. package/dist/Stack.js +76 -0
  172. package/dist/StackedBar.d.ts +64 -0
  173. package/dist/StackedBar.js +58 -0
  174. package/dist/StatTile.d.ts +33 -0
  175. package/dist/StatTile.js +44 -0
  176. package/dist/StatusPages.d.ts +49 -0
  177. package/dist/StatusPages.js +63 -0
  178. package/dist/Steps.d.ts +29 -0
  179. package/dist/Steps.js +43 -0
  180. package/dist/StickyBar.d.ts +12 -0
  181. package/dist/StickyBar.js +10 -0
  182. package/dist/Switch.d.ts +56 -0
  183. package/dist/Switch.js +91 -0
  184. package/dist/Table.d.ts +92 -0
  185. package/dist/Table.js +92 -0
  186. package/dist/TableCells.d.ts +97 -0
  187. package/dist/TableCells.js +104 -0
  188. package/dist/TableEditCell.d.ts +31 -0
  189. package/dist/TableEditCell.js +17 -0
  190. package/dist/TableExpandCell.d.ts +25 -0
  191. package/dist/TableExpandCell.js +15 -0
  192. package/dist/Tabs.d.ts +38 -0
  193. package/dist/Tabs.js +46 -0
  194. package/dist/TextLink.d.ts +51 -0
  195. package/dist/TextLink.js +38 -0
  196. package/dist/Textarea.d.ts +11 -0
  197. package/dist/Textarea.js +11 -0
  198. package/dist/Timeline.d.ts +31 -0
  199. package/dist/Timeline.js +38 -0
  200. package/dist/ToastRegion.d.ts +44 -0
  201. package/dist/ToastRegion.js +37 -0
  202. package/dist/Tooltip.d.ts +46 -0
  203. package/dist/Tooltip.js +181 -0
  204. package/dist/TrendChart.d.ts +36 -0
  205. package/dist/TrendChart.js +58 -0
  206. package/dist/Video.d.ts +13 -0
  207. package/dist/Video.js +9 -0
  208. package/dist/blocked.d.ts +31 -0
  209. package/dist/blocked.js +31 -0
  210. package/dist/cardContext.d.ts +8 -0
  211. package/dist/cardContext.js +14 -0
  212. package/dist/cardWait.d.ts +13 -0
  213. package/dist/cardWait.js +16 -0
  214. package/dist/colourScheme.d.ts +22 -0
  215. package/dist/colourScheme.js +53 -0
  216. package/dist/control.d.ts +29 -0
  217. package/dist/control.js +37 -0
  218. package/dist/copyScript.d.ts +13 -0
  219. package/dist/copyScript.js +13 -0
  220. package/dist/cx.d.ts +19 -0
  221. package/dist/cx.js +21 -0
  222. package/dist/density.d.ts +38 -0
  223. package/dist/density.js +77 -0
  224. package/dist/emptySlot.d.ts +11 -0
  225. package/dist/emptySlot.js +16 -0
  226. package/dist/fieldControl.d.ts +23 -0
  227. package/dist/fieldControl.js +24 -0
  228. package/dist/fieldWait.d.ts +30 -0
  229. package/dist/fieldWait.js +27 -0
  230. package/dist/foldedColumn.d.ts +18 -0
  231. package/dist/foldedColumn.js +51 -0
  232. package/dist/headingLevel.d.ts +10 -0
  233. package/dist/headingLevel.js +18 -0
  234. package/dist/highlight.d.ts +18 -0
  235. package/dist/highlight.js +306 -0
  236. package/dist/highlightConsole.d.ts +9 -0
  237. package/dist/highlightConsole.js +42 -0
  238. package/dist/highlightHtml.d.ts +7 -0
  239. package/dist/highlightHtml.js +132 -0
  240. package/dist/highlightKit.d.ts +16 -0
  241. package/dist/highlightKit.js +23 -0
  242. package/dist/highlightYaml.d.ts +3 -0
  243. package/dist/highlightYaml.js +143 -0
  244. package/dist/icons.d.ts +16 -0
  245. package/dist/icons.js +108 -0
  246. package/dist/index.d.ts +99 -0
  247. package/dist/index.js +92 -0
  248. package/dist/isoDate.d.ts +5 -0
  249. package/dist/isoDate.js +16 -0
  250. package/dist/labelWords.d.ts +20 -0
  251. package/dist/labelWords.js +28 -0
  252. package/dist/layoutWait.d.ts +15 -0
  253. package/dist/layoutWait.js +18 -0
  254. package/dist/link.d.ts +82 -0
  255. package/dist/link.js +68 -0
  256. package/dist/listRowProps.d.ts +108 -0
  257. package/dist/listRowProps.js +1 -0
  258. package/dist/listRowWait.d.ts +6 -0
  259. package/dist/listRowWait.js +14 -0
  260. package/dist/modal.d.ts +25 -0
  261. package/dist/modal.js +61 -0
  262. package/dist/navFold.d.ts +15 -0
  263. package/dist/navFold.js +46 -0
  264. package/dist/pillTip.d.ts +8 -0
  265. package/dist/pillTip.js +25 -0
  266. package/dist/props.d.ts +26 -0
  267. package/dist/props.js +14 -0
  268. package/dist/scrollEdges.d.ts +12 -0
  269. package/dist/scrollEdges.js +40 -0
  270. package/dist/scrollStop.d.ts +32 -0
  271. package/dist/scrollStop.js +79 -0
  272. package/dist/sheetSnap.d.ts +27 -0
  273. package/dist/sheetSnap.js +45 -0
  274. package/dist/shownDate.d.ts +88 -0
  275. package/dist/shownDate.js +186 -0
  276. package/dist/size.d.ts +45 -0
  277. package/dist/size.js +12 -0
  278. package/dist/skeleton.d.ts +83 -0
  279. package/dist/skeleton.js +88 -0
  280. package/dist/stackGap.d.ts +9 -0
  281. package/dist/stackGap.js +16 -0
  282. package/dist/stickyColumn.d.ts +38 -0
  283. package/dist/stickyColumn.js +38 -0
  284. package/dist/switcher.d.ts +93 -0
  285. package/dist/switcher.js +78 -0
  286. package/dist/tableColumns.d.ts +31 -0
  287. package/dist/tableColumns.js +72 -0
  288. package/dist/tableEmpty.d.ts +15 -0
  289. package/dist/tableEmpty.js +26 -0
  290. package/dist/tableRow.d.ts +67 -0
  291. package/dist/tableRow.js +49 -0
  292. package/dist/tableSort.d.ts +22 -0
  293. package/dist/tableSort.js +19 -0
  294. package/dist/textBox.d.ts +10 -0
  295. package/dist/textBox.js +23 -0
  296. package/dist/tone.d.ts +11 -0
  297. package/dist/tone.js +1 -0
  298. package/dist/trend.d.ts +26 -0
  299. package/dist/trend.js +64 -0
  300. package/dist/typography.d.ts +203 -0
  301. package/dist/typography.js +242 -0
  302. package/dist/useImageFailed.d.ts +19 -0
  303. package/dist/useImageFailed.js +21 -0
  304. package/package.json +84 -4
@@ -0,0 +1,16 @@
1
+ import { CalendarDate } from "@internationalized/date";
2
+ const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
3
+ /** `"1990-05-17"` for `CalendarDate(1990, 5, 17)`; `""` for no date, so it drops into a form field. */
4
+ export function toISODate(date) {
5
+ return date ? date.toString() : "";
6
+ }
7
+ /** The `CalendarDate` of a `"YYYY-MM-DD"` string; `null` for an empty, malformed or impossible one. */
8
+ export function fromISODate(iso) {
9
+ const match = ISO_DATE.exec(iso ?? "");
10
+ if (!match)
11
+ return null;
12
+ const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
13
+ const date = new CalendarDate(year, month, day);
14
+ // CalendarDate constrains 1990-02-31 to 1990-02-28; a string that does not survive is impossible.
15
+ return date.toString() === iso ? date : null;
16
+ }
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * The label, with its note under it when there is one: the error (`role="alert"`, red) when set,
4
+ * else the muted hint.
5
+ */
6
+ export declare function Words({ label, hint, error, id, }: {
7
+ label: ReactNode;
8
+ hint: ReactNode;
9
+ error: ReactNode;
10
+ id: string | undefined;
11
+ }): ReactNode;
12
+ /**
13
+ * The note's id (none without a hint or an error), the control's whole `aria-describedby`, and
14
+ * whether it is invalid (an error is set). The error replaces the hint, as in a `Field`.
15
+ */
16
+ export declare function useNote(hint: ReactNode, error: ReactNode, describedBy: string | undefined): {
17
+ noteId: string | undefined;
18
+ describedIds: string;
19
+ invalid: boolean;
20
+ };
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ /** Whether a note is set: `null`, `undefined`, `false` and `""` draw nothing. */
4
+ const given = (note) => note != null && note !== false && note !== "";
5
+ /**
6
+ * The label, with its note under it when there is one: the error (`role="alert"`, red) when set,
7
+ * else the muted hint.
8
+ */
9
+ export function Words({ label, hint, error, id, }) {
10
+ if (id === undefined)
11
+ return label;
12
+ const failed = given(error);
13
+ return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: label }), _jsx("span", { id: id, role: failed ? "alert" : undefined, className: failed ? "text-xs text-red-700" : "text-xs text-slate-500", children: failed ? error : hint })] }));
14
+ }
15
+ /**
16
+ * The note's id (none without a hint or an error), the control's whole `aria-describedby`, and
17
+ * whether it is invalid (an error is set). The error replaces the hint, as in a `Field`.
18
+ */
19
+ export function useNote(hint, error, describedBy) {
20
+ const generatedId = useId();
21
+ const invalid = given(error);
22
+ const noteId = invalid || given(hint) ? generatedId : undefined;
23
+ return {
24
+ noteId,
25
+ describedIds: [describedBy, noteId].filter(Boolean).join(" "),
26
+ invalid,
27
+ };
28
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactElement } from "react";
2
+ /**
3
+ * A page layout's or header's wait: whether it is loading (its own `loading`, else its
4
+ * ancestors'), the owner's `aria-busy` for the element that takes its other props, and the owner's
5
+ * one hidden label to put inside that element. The layout passes `loading` to everything inside it
6
+ * with a `LoadingScope`.
7
+ */
8
+ export declare function useWait(own: boolean | undefined, label: string | undefined): {
9
+ loading: boolean;
10
+ owner: boolean;
11
+ attrs: {
12
+ "aria-busy"?: true;
13
+ };
14
+ label: ReactElement;
15
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BusyLabel, busy, useLoading } from "./skeleton.js";
3
+ /**
4
+ * A page layout's or header's wait: whether it is loading (its own `loading`, else its
5
+ * ancestors'), the owner's `aria-busy` for the element that takes its other props, and the owner's
6
+ * one hidden label to put inside that element. The layout passes `loading` to everything inside it
7
+ * with a `LoadingScope`.
8
+ */
9
+ export function useWait(own, label) {
10
+ const { loading, owner } = useLoading(own);
11
+ return {
12
+ loading,
13
+ // Owning a wait that is under way: what draws the owner's label.
14
+ owner: owner && loading,
15
+ attrs: busy(owner, loading),
16
+ label: _jsx(BusyLabel, { owner: owner, loading: loading, label: label }),
17
+ };
18
+ }
package/dist/link.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ import { type ComponentPropsWithoutRef, type ReactElement, type ReactNode, type Ref } from "react";
2
+ type AriaCurrent = NonNullable<ComponentPropsWithoutRef<"a">["aria-current"]>;
3
+ /**
4
+ * What the app's `LinkAdapter` receives to draw an in-app link with its router's `<Link>`: the
5
+ * destination as `href` (search and hash included), the component's classes, its label as
6
+ * `children`, and (for a tab that is current, or an option with a tooltip) `aria-current`, `target`,
7
+ * `rel` and `title`. `@slashsuite/ui-react` has no router dependency.
8
+ *
9
+ * An optional field is `?: T`, never `?: T | undefined`, and a key that has no value is left out
10
+ * rather than set to `undefined`. A router's `<Link>` declares its props that way, so under
11
+ * `exactOptionalPropertyTypes` the spread compiles. Any other anchor prop the caller gave the
12
+ * component (`id`, `data-*`, `download`, a handler) arrives too, untyped here, and `<Link>`
13
+ * takes it as its own.
14
+ */
15
+ export type LinkAdapterProps = {
16
+ href: string;
17
+ className: string;
18
+ children: ReactNode;
19
+ "aria-current"?: AriaCurrent;
20
+ target?: string;
21
+ rel?: string;
22
+ title?: string;
23
+ };
24
+ /** Draws one in-app link: the app's router `<Link>`, handed `LinkAdapterProps`. */
25
+ export type LinkAdapter = (props: LinkAdapterProps) => ReactNode;
26
+ /**
27
+ * Names the app's router link once, so every part that links (`Button`, `IconButton`, `TextLink`,
28
+ * `Pill`, `Card`, `ListRow`, `Breadcrumbs`, `Tabs`, `SegmentedControl`, `AppShellBrand`,
29
+ * `SiteSearch`, `MediaTile`, `Avatar` and the status pages) takes a plain `href` and draws an in-app
30
+ * one (a path from the root, `/quotes?page=2#top`) through the router. It renders no element.
31
+ *
32
+ * - TanStack Router: `createRouter({ routeTree, InnerWrap: ({ children }) => <LinkProvider link={(p) => <Link to="." {...p} />}>{children}</LinkProvider> })`,
33
+ * which also reaches the router's not-found and error components. A registered router's `Link`
34
+ * requires `to`; `to="."` satisfies it, and the `href` wins.
35
+ * - React Router: `<LinkProvider link={({ href, ...p }) => <Link to={href} {...p} />}>` inside the router.
36
+ * - Astro, or no router: no provider; every link is a plain `<a>`.
37
+ *
38
+ * An `external` link, a full URL (`https:`, `mailto:`, `tel:`), a `//` URL, a `#hash` or a relative
39
+ * path never reaches the adapter: the library draws those as a plain `<a>`.
40
+ *
41
+ * `home` is where every status page's "Back to home" goes, `/` by default: the one place an app
42
+ * says it, never a page. A full URL (a home on another site) is a plain `<a>` in the same tab. A
43
+ * provider inside another keeps what it does not set, so `<LinkProvider home="/app">` within the
44
+ * router's provider still draws through the router's link.
45
+ */
46
+ export declare function LinkProvider({ link, home, children, }: {
47
+ /** The app's router link, handed `LinkAdapterProps`. Left out, links are plain `<a>` (or the outer provider's). */
48
+ link?: LinkAdapter | undefined;
49
+ /**
50
+ * Where the status pages' "Back to home" goes: an in-app path or a full URL.
51
+ * @default "/"
52
+ */
53
+ home?: string | undefined;
54
+ children: ReactNode;
55
+ }): ReactElement;
56
+ /** Where "Back to home" goes: the nearest `LinkProvider`'s `home`, or `/` with none. Internal. */
57
+ export declare function useHome(): string;
58
+ /** Whether `href` is an in-app path the router draws: one that starts with a single `/`. */
59
+ export declare function isAppHref(href: string): boolean;
60
+ type AppLinkProps = {
61
+ className: string;
62
+ children: ReactNode;
63
+ href: string;
64
+ "aria-current"?: AriaCurrent | undefined;
65
+ target?: string | undefined;
66
+ rel?: string | undefined;
67
+ title?: string | undefined;
68
+ external?: boolean | undefined;
69
+ ref?: Ref<HTMLAnchorElement> | undefined;
70
+ } & Omit<ComponentPropsWithoutRef<"a">, "href" | "className" | "children" | "aria-current">;
71
+ /** Draws one link through `AppLink`, so a part can return it from a branch. Internal. */
72
+ export declare function renderLink(props: AppLinkProps): ReactElement;
73
+ /**
74
+ * The `data-*` attributes an item may carry onto its button or link, so a caller keeps its test
75
+ * ids on a tab. Only `data-*`: there is no `className` or `style`.
76
+ */
77
+ export type DataAttributes = {
78
+ [name: `data-${string}`]: string | number | boolean | undefined;
79
+ };
80
+ /** The `data-*` entries of `item`, ready to spread on the element it draws. */
81
+ export declare function dataAttributes(item: object): DataAttributes;
82
+ export {};
package/dist/link.js ADDED
@@ -0,0 +1,68 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, } from "react";
3
+ const LinkContext = createContext({ link: undefined, home: "/" });
4
+ /**
5
+ * Names the app's router link once, so every part that links (`Button`, `IconButton`, `TextLink`,
6
+ * `Pill`, `Card`, `ListRow`, `Breadcrumbs`, `Tabs`, `SegmentedControl`, `AppShellBrand`,
7
+ * `SiteSearch`, `MediaTile`, `Avatar` and the status pages) takes a plain `href` and draws an in-app
8
+ * one (a path from the root, `/quotes?page=2#top`) through the router. It renders no element.
9
+ *
10
+ * - TanStack Router: `createRouter({ routeTree, InnerWrap: ({ children }) => <LinkProvider link={(p) => <Link to="." {...p} />}>{children}</LinkProvider> })`,
11
+ * which also reaches the router's not-found and error components. A registered router's `Link`
12
+ * requires `to`; `to="."` satisfies it, and the `href` wins.
13
+ * - React Router: `<LinkProvider link={({ href, ...p }) => <Link to={href} {...p} />}>` inside the router.
14
+ * - Astro, or no router: no provider; every link is a plain `<a>`.
15
+ *
16
+ * An `external` link, a full URL (`https:`, `mailto:`, `tel:`), a `//` URL, a `#hash` or a relative
17
+ * path never reaches the adapter: the library draws those as a plain `<a>`.
18
+ *
19
+ * `home` is where every status page's "Back to home" goes, `/` by default: the one place an app
20
+ * says it, never a page. A full URL (a home on another site) is a plain `<a>` in the same tab. A
21
+ * provider inside another keeps what it does not set, so `<LinkProvider home="/app">` within the
22
+ * router's provider still draws through the router's link.
23
+ */
24
+ export function LinkProvider({ link, home, children, }) {
25
+ const outer = useContext(LinkContext);
26
+ const value = useMemo(() => ({ link: link ?? outer.link, home: home ?? outer.home }), [link, home, outer]);
27
+ return _jsx(LinkContext.Provider, { value: value, children: children });
28
+ }
29
+ /** Where "Back to home" goes: the nearest `LinkProvider`'s `home`, or `/` with none. Internal. */
30
+ export function useHome() {
31
+ return useContext(LinkContext).home;
32
+ }
33
+ /** Whether `href` is an in-app path the router draws: one that starts with a single `/`. */
34
+ export function isAppHref(href) {
35
+ return href.startsWith("/") && !href.startsWith("//");
36
+ }
37
+ /**
38
+ * The one link part every component draws through. `external` is a plain `<a>` that opens a new
39
+ * tab (`target="_blank"`, `rel="noreferrer"`, unless the caller passes its own); an in-app `href`
40
+ * goes to the app's `LinkAdapter` when a `LinkProvider` is above; anything else is a plain `<a>`.
41
+ * Internal: not exported from the package.
42
+ */
43
+ function AppLink({ href, external = false, className, children, "aria-current": current, target, rel, title, ...rest }) {
44
+ const { link } = useContext(LinkContext);
45
+ const opened = external ? { target: "_blank", rel: "noreferrer" } : {};
46
+ const all = {
47
+ ...rest,
48
+ href,
49
+ className,
50
+ children,
51
+ ...(current === undefined ? {} : { "aria-current": current }),
52
+ ...opened,
53
+ ...(target === undefined ? {} : { target }),
54
+ ...(rel === undefined ? {} : { rel }),
55
+ ...(title === undefined ? {} : { title }),
56
+ };
57
+ if (link && !external && isAppHref(href))
58
+ return _jsx(_Fragment, { children: link(all) });
59
+ return _jsx("a", { ...all });
60
+ }
61
+ /** Draws one link through `AppLink`, so a part can return it from a branch. Internal. */
62
+ export function renderLink(props) {
63
+ return _jsx(AppLink, { ...props });
64
+ }
65
+ /** The `data-*` entries of `item`, ready to spread on the element it draws. */
66
+ export function dataAttributes(item) {
67
+ return Object.fromEntries(Object.entries(item).filter(([name]) => name.startsWith("data-")));
68
+ }
@@ -0,0 +1,108 @@
1
+ import type { ComponentPropsWithoutRef, MouseEventHandler, PointerEventHandler, ReactNode } from "react";
2
+ import type { Unstyled } from "./props.js";
3
+ import type { Size } from "./size.js";
4
+ import type { LoadingProps } from "./skeleton.js";
5
+ type Shared = LoadingProps & {
6
+ /**
7
+ * `sm` is dense padding, `lg` one step roomier than `md`. A `Button`, `IconButton` or `Pill` in a
8
+ * `sm` row with no `size` of its own is `sm` too.
9
+ * @default md
10
+ */
11
+ size?: Size | undefined;
12
+ /** A hairline above the row: set it on every row after the first. */
13
+ divided?: boolean | undefined;
14
+ /** Content before the label: an Avatar, a thumbnail, an icon. */
15
+ leading?: ReactNode | undefined;
16
+ /** A second, muted line under the label (a date, a note), like `TableCell`'s `secondary`. */
17
+ secondary?: ReactNode | undefined;
18
+ /** Content at the far end of the row: a value, a count, a Pill. */
19
+ trailing?: ReactNode | undefined;
20
+ /**
21
+ * Marks the row in view, the one whose detail is open: an accent fill and `aria-current="true"`.
22
+ * Set it on one row of a list.
23
+ */
24
+ selected?: boolean | undefined;
25
+ /**
26
+ * Marks the row the keyboard cursor is on, for a list moved with the arrow keys or `j`/`k` while
27
+ * focus stays on the list: the focus ring, drawn inside the row. It says nothing to a screen
28
+ * reader (move real focus for that) and combines with `selected`.
29
+ */
30
+ focused?: boolean | undefined;
31
+ /**
32
+ * Marks the row a list follows with the pointer and the keyboard alike (set it from
33
+ * `onPointerEnter` and `onFocus`): a fill one step deeper than hover, so it shows on a white card
34
+ * and on a tinted panel alike. On a static row it shows the fill without `revealOnHover`, and
35
+ * shows `actions` that `revealOnHover` hides. `selected` wins.
36
+ *
37
+ * Clear it from `onPointerLeave`.
38
+ */
39
+ highlighted?: boolean | undefined;
40
+ /**
41
+ * A fixed width for `leading`, for a thumbnail (an `<img>` fills it), so the labels of rows with
42
+ * and without a picture still line up. Without it `leading` is as wide as its content.
43
+ *
44
+ * For a row that shows a screenshot.
45
+ */
46
+ leadingWidth?: "thumbnail" | undefined;
47
+ children: ReactNode;
48
+ };
49
+ type NotStatic = {
50
+ actions?: undefined;
51
+ revealOnHover?: undefined;
52
+ panel?: undefined;
53
+ };
54
+ export type ListRowButtonProps = Shared & NotStatic & {
55
+ /**
56
+ * Makes the row a collapsible header: sets `aria-expanded` and shows a chevron that turns down
57
+ * when open. The caller owns the state and the section; pass `aria-controls` to name it.
58
+ */
59
+ expanded?: boolean | undefined;
60
+ /** What the row does when pressed: it makes the row a button. */
61
+ onClick: MouseEventHandler<HTMLButtonElement>;
62
+ /** Why the row cannot be pressed: it fades, `aria-disabled` and focusable, the reason its tooltip. */
63
+ disabledReason?: string | undefined;
64
+ href?: undefined;
65
+ /** On the row, not its link or button, so a link or button in the row does not count as entering it. */
66
+ onPointerEnter?: PointerEventHandler<HTMLDivElement> | undefined;
67
+ /** On the row, not its link or button, so a link or button in the row does not count as leaving it. */
68
+ onPointerLeave?: PointerEventHandler<HTMLDivElement> | undefined;
69
+ } & Unstyled<Omit<ComponentPropsWithoutRef<"button">, "children" | "onClick" | "onPointerEnter" | "onPointerLeave">>;
70
+ export type ListRowLinkProps = Shared & NotStatic & {
71
+ /** Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`. */
72
+ external?: boolean | undefined;
73
+ expanded?: undefined;
74
+ disabledReason?: undefined;
75
+ /** On the row, not its link or button, so a link or button in the row does not count as entering it. */
76
+ onPointerEnter?: PointerEventHandler<HTMLDivElement> | undefined;
77
+ /** On the row, not its link or button, so a link or button in the row does not count as leaving it. */
78
+ onPointerLeave?: PointerEventHandler<HTMLDivElement> | undefined;
79
+ } & Unstyled<Omit<ComponentPropsWithoutRef<"a">, "href" | "children" | "onPointerEnter" | "onPointerLeave">> & {
80
+ /** Makes the row a link to this URL; an in-app path goes through the app's `LinkProvider`. */
81
+ href: string;
82
+ };
83
+ /**
84
+ * A row with no `href` and no `onClick`: a `<div>` with no click target and no hover fill (unless
85
+ * `revealOnHover`), for one that holds its own controls, taking `actions` as well.
86
+ */
87
+ export type ListRowStaticProps = Shared & {
88
+ /** Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`. */
89
+ actions?: ReactNode | undefined;
90
+ /**
91
+ * Hides `actions` until the row is hovered or something in it has focus, so a long list is not a
92
+ * wall of buttons. A touch screen has no hover, so they are always shown there.
93
+ */
94
+ revealOnHover?: boolean | undefined;
95
+ /**
96
+ * Content under the row, lined up with the label rather than the row's edge (past `leading`): the
97
+ * panel of a row that opens in place, such as a conversation under its chat. It sits inside the
98
+ * row, so `divided`, the fill and `revealOnHover` cover it too. Only a row that is neither a
99
+ * button nor a link takes it.
100
+ */
101
+ panel?: ReactNode | undefined;
102
+ expanded?: undefined;
103
+ onClick?: undefined;
104
+ disabledReason?: undefined;
105
+ href?: undefined;
106
+ } & Unstyled<Omit<ComponentPropsWithoutRef<"div">, "children" | "onClick">>;
107
+ export type ListRowProps = ListRowButtonProps | ListRowLinkProps | ListRowStaticProps;
108
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { ListRowProps } from "./listRowProps.js";
2
+ /**
3
+ * A row's props as it draws them: without `loading` and `loadingLabel`, the owner's `aria-busy`,
4
+ * and a label that is a bone while it waits with none, followed by the owner's hidden label.
5
+ */
6
+ export declare function waitingRow(props: ListRowProps, loading: boolean, owner: boolean): ListRowProps;
@@ -0,0 +1,14 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BoneLines, BusyLabel, busy, isEmptySlot } from "./skeleton.js";
3
+ /**
4
+ * A row's props as it draws them: without `loading` and `loadingLabel`, the owner's `aria-busy`,
5
+ * and a label that is a bone while it waits with none, followed by the owner's hidden label.
6
+ */
7
+ export function waitingRow(props, loading, owner) {
8
+ const { loading: _own, loadingLabel, children, ...rest } = props;
9
+ return {
10
+ ...rest,
11
+ ...busy(owner, loading),
12
+ children: (_jsxs(_Fragment, { children: [loading && isEmptySlot(children) ? _jsx(BoneLines, { count: 1, width: "1/2" }) : children, _jsx(BusyLabel, { owner: owner, loading: loading, label: loadingLabel })] })),
13
+ };
14
+ }
@@ -0,0 +1,25 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
4
+ * (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
5
+ * when the parent unmounts the dialog, and keeps StrictMode's second mount from reopening an open one.
6
+ *
7
+ * Returns the handler for the dialog's `close` event. A closed `<dialog>` fades or slides out with
8
+ * a transition, but only while it is still in the DOM, so the handler calls `onClose` once the exit
9
+ * transition has ended and the parent can then unmount it without cutting the animation short.
10
+ */
11
+ export declare function useModal(dialog: RefObject<HTMLDialogElement | null>, onClose: () => void): () => void;
12
+ /**
13
+ * The backdrop press that closes a modal: a click whose press both began and ended on the
14
+ * `<dialog>` element itself (its backdrop), not on its contents. A press that began on a control
15
+ * inside does not count when its click lands on the `<dialog>`: a `Menu` opens on the press and
16
+ * makes the rest of the dialog inert under it, so the browser hands that click to the `<dialog>`.
17
+ */
18
+ export declare function useBackdropClose(dialog: RefObject<HTMLDialogElement | null>): {
19
+ onPointerDown: (event: {
20
+ target: EventTarget;
21
+ }) => void;
22
+ onClick: (event: {
23
+ target: EventTarget;
24
+ }) => void;
25
+ };
package/dist/modal.js ADDED
@@ -0,0 +1,61 @@
1
+ import { useLayoutEffect, useRef } from "react";
2
+ /** Resolves when the transitions running on the dialog (and its backdrop) have ended. */
3
+ async function exitTransitions(dialog) {
4
+ // A browser without the Web Animations API (or jsdom) has nothing to wait for.
5
+ if (typeof dialog.getAnimations !== "function")
6
+ return;
7
+ const running = dialog.getAnimations({ subtree: true }).filter((a) => "transitionProperty" in a);
8
+ await Promise.allSettled(running.map((a) => a.finished));
9
+ }
10
+ /**
11
+ * Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
12
+ * (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
13
+ * when the parent unmounts the dialog, and keeps StrictMode's second mount from reopening an open one.
14
+ *
15
+ * Returns the handler for the dialog's `close` event. A closed `<dialog>` fades or slides out with
16
+ * a transition, but only while it is still in the DOM, so the handler calls `onClose` once the exit
17
+ * transition has ended and the parent can then unmount it without cutting the animation short.
18
+ */
19
+ export function useModal(dialog, onClose) {
20
+ const mounted = useRef(false);
21
+ useLayoutEffect(() => {
22
+ const el = dialog.current;
23
+ mounted.current = true;
24
+ el?.showModal();
25
+ return () => {
26
+ mounted.current = false;
27
+ el?.close();
28
+ };
29
+ }, [dialog]);
30
+ return () => {
31
+ const el = dialog.current;
32
+ if (!el)
33
+ return;
34
+ void exitTransitions(el).then(() => {
35
+ // Skip a close that an unmount caused, and the one StrictMode's remount leaves behind (the
36
+ // dialog is open again by the time its event fires).
37
+ if (mounted.current && !el.open)
38
+ onClose();
39
+ });
40
+ };
41
+ }
42
+ /**
43
+ * The backdrop press that closes a modal: a click whose press both began and ended on the
44
+ * `<dialog>` element itself (its backdrop), not on its contents. A press that began on a control
45
+ * inside does not count when its click lands on the `<dialog>`: a `Menu` opens on the press and
46
+ * makes the rest of the dialog inert under it, so the browser hands that click to the `<dialog>`.
47
+ */
48
+ export function useBackdropClose(dialog) {
49
+ const pressedBackdrop = useRef(false);
50
+ return {
51
+ onPointerDown: (event) => {
52
+ pressedBackdrop.current = event.target === dialog.current;
53
+ },
54
+ onClick: (event) => {
55
+ const began = pressedBackdrop.current;
56
+ pressedBackdrop.current = false;
57
+ if (began && event.target === dialog.current)
58
+ dialog.current?.close();
59
+ },
60
+ };
61
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Whether the header row's nav is folded into the Menu: from `md`, true while the row with the nav
3
+ * in it is wider than its box. `row` is the header row once mounted (null before, and before
4
+ * hydration, so the header is then as it is with no script).
5
+ *
6
+ * Driven by the row's and its slots' sizes alone, with no timer: while unfolded, a row that overflows folds and its
7
+ * full width is remembered; while folded, it unfolds once the row is at least that wide. Remembering
8
+ * the width is what stops it flipping back and forth. A browser with no `ResizeObserver` (jsdom)
9
+ * never folds.
10
+ *
11
+ * The effect runs after every render on purpose (as `useScrollEdges` does): a slot that mounts
12
+ * later (a control shown once the viewer is known) is observed too. The fold state lives in a ref,
13
+ * so a rerun keeps it.
14
+ */
15
+ export declare function useNavFold(row: HTMLElement | null, enabled: boolean): boolean;
@@ -0,0 +1,46 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ // AppShell's `md` step: below it the nav is always in the Menu, so nothing is measured there.
3
+ const WIDE = "(width >= 48rem)";
4
+ /**
5
+ * Whether the header row's nav is folded into the Menu: from `md`, true while the row with the nav
6
+ * in it is wider than its box. `row` is the header row once mounted (null before, and before
7
+ * hydration, so the header is then as it is with no script).
8
+ *
9
+ * Driven by the row's and its slots' sizes alone, with no timer: while unfolded, a row that overflows folds and its
10
+ * full width is remembered; while folded, it unfolds once the row is at least that wide. Remembering
11
+ * the width is what stops it flipping back and forth. A browser with no `ResizeObserver` (jsdom)
12
+ * never folds.
13
+ *
14
+ * The effect runs after every render on purpose (as `useScrollEdges` does): a slot that mounts
15
+ * later (a control shown once the viewer is known) is observed too. The fold state lives in a ref,
16
+ * so a rerun keeps it.
17
+ */
18
+ export function useNavFold(row, enabled) {
19
+ const [folded, setFolded] = useState(false);
20
+ const state = useRef({ folded: false, need: 0 });
21
+ useEffect(() => {
22
+ if (!row || !enabled || typeof ResizeObserver === "undefined")
23
+ return undefined;
24
+ const wide = window.matchMedia(WIDE);
25
+ const check = () => {
26
+ if (!wide.matches)
27
+ return;
28
+ const now = state.current;
29
+ if (!now.folded && row.scrollWidth > row.clientWidth + 1) {
30
+ state.current = { folded: true, need: row.scrollWidth };
31
+ }
32
+ else if (now.folded && row.clientWidth >= now.need) {
33
+ state.current = { folded: false, need: 0 };
34
+ }
35
+ setFolded(state.current.folded);
36
+ };
37
+ const observer = new ResizeObserver(check);
38
+ // The row is the header's width, so it resizes only with the screen; its slots resize with
39
+ // their content (a font swap, a label that changes), so they are watched too.
40
+ observer.observe(row);
41
+ for (const slot of row.children)
42
+ observer.observe(slot);
43
+ return () => observer.disconnect();
44
+ });
45
+ return enabled && folded;
46
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A removable plain pill's attributes, split: the tooltip's wiring goes on its text, so the x's own
3
+ * focus and hover never reach it, and the rest stays on the shell, once.
4
+ */
5
+ export declare function splitTip(attrs: Record<string, unknown>): {
6
+ wiring: Record<string, unknown>;
7
+ rest: Record<string, unknown>;
8
+ };
@@ -0,0 +1,25 @@
1
+ /* The tooltip wiring of a removable plain pill. Internal to `Pill`. */
2
+ /** The keys the tooltip owns on its trigger, with the tab stop it needs. */
3
+ const TIP_KEYS = new Set([
4
+ "title",
5
+ "aria-describedby",
6
+ "style",
7
+ "tabIndex",
8
+ "onPointerEnter",
9
+ "onPointerLeave",
10
+ "onPointerDown",
11
+ "onFocus",
12
+ "onBlur",
13
+ "onKeyDown",
14
+ ]);
15
+ /**
16
+ * A removable plain pill's attributes, split: the tooltip's wiring goes on its text, so the x's own
17
+ * focus and hover never reach it, and the rest stays on the shell, once.
18
+ */
19
+ export function splitTip(attrs) {
20
+ const entries = Object.entries(attrs);
21
+ return {
22
+ wiring: Object.fromEntries(entries.filter(([key]) => TIP_KEYS.has(key))),
23
+ rest: Object.fromEntries(entries.filter(([key]) => !TIP_KEYS.has(key))),
24
+ };
25
+ }
@@ -0,0 +1,26 @@
1
+ import type { AriaAttributes } from "react";
2
+ import type { DataAttributes } from "./link.js";
3
+ /**
4
+ * Drops the two props that would let a consumer restyle a component. Components take no
5
+ * `className` or `style`: a look is a prop or a variant, never a class. Wrap any HTML or ARIA prop
6
+ * type a component spreads in this one.
7
+ */
8
+ export type Unstyled<T> = Omit<T, "className" | "style">;
9
+ /**
10
+ * What every component takes through to its root: an `id` (an anchor, a `for` or an
11
+ * `aria-describedby` target), `data-*` (an e2e hook, `data-testid`) and `aria-*`. Nothing else, so
12
+ * no handler or `role` the component would have to merge with its own. Only a native control
13
+ * (`Input`, `Select`, `Textarea`, `Button`) spreads its element's own props.
14
+ */
15
+ export type Passthrough = AriaAttributes & DataAttributes & {
16
+ /** The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`. */
17
+ id?: string | undefined;
18
+ };
19
+ /**
20
+ * `props` without its `undefined` entries, for handing passthrough props to a react-aria-components
21
+ * part, whose types take a value or nothing (`exactOptionalPropertyTypes`). A wrapper of a native
22
+ * element spreads its props as they are.
23
+ */
24
+ export declare function definedProps<T extends object>(props: T): {
25
+ [K in keyof T]?: T[K] & ({} | null);
26
+ };
package/dist/props.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `props` without its `undefined` entries, for handing passthrough props to a react-aria-components
3
+ * part, whose types take a value or nothing (`exactOptionalPropertyTypes`). A wrapper of a native
4
+ * element spreads its props as they are.
5
+ */
6
+ export function definedProps(props) {
7
+ const out = {};
8
+ for (const key in props) {
9
+ const value = props[key];
10
+ if (value !== undefined)
11
+ out[key] = value;
12
+ }
13
+ return out;
14
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Marks a box that scrolls with which of its edges still has content past it, so the layout can fade
3
+ * them: `data-more-start` (scrolled away from the start), `data-more-end` (more to scroll to) and
4
+ * `data-more` for either. `axis` is the way it scrolls: `x` (a row) or `y` (a column). A box that
5
+ * fits carries none. The attributes only carry state; a class turns them into a `mask-image`, so the
6
+ * fade follows any theme. `element` is the box once it is mounted (null before, and then nothing
7
+ * happens).
8
+ *
9
+ * The effect runs after every render on purpose: the box's children may have changed, and each one
10
+ * needs observing so a change in its size is noticed.
11
+ */
12
+ export declare function useScrollEdges(element: HTMLElement | null, axis: "x" | "y"): void;