@ignite-ember/ui-react 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +56 -13
  3. package/dist/CopySource.d.ts.map +1 -1
  4. package/dist/CopySource.js +16 -2
  5. package/dist/CopySource.js.map +1 -1
  6. package/dist/DataTable.d.ts +17 -1
  7. package/dist/DataTable.d.ts.map +1 -1
  8. package/dist/DataTable.js +17 -1
  9. package/dist/DataTable.js.map +1 -1
  10. package/dist/Dialog.d.ts +41 -0
  11. package/dist/Dialog.d.ts.map +1 -0
  12. package/dist/Dialog.js +94 -0
  13. package/dist/Dialog.js.map +1 -0
  14. package/dist/ErrorBoundary.d.ts +31 -2
  15. package/dist/ErrorBoundary.d.ts.map +1 -1
  16. package/dist/ErrorBoundary.js +38 -4
  17. package/dist/ErrorBoundary.js.map +1 -1
  18. package/dist/LiveRegion.d.ts +7 -1
  19. package/dist/LiveRegion.d.ts.map +1 -1
  20. package/dist/LiveRegion.js +7 -1
  21. package/dist/LiveRegion.js.map +1 -1
  22. package/dist/Markdown.d.ts +4 -0
  23. package/dist/Markdown.d.ts.map +1 -1
  24. package/dist/Markdown.js +4 -0
  25. package/dist/Markdown.js.map +1 -1
  26. package/dist/MarkdownInline.d.ts +13 -4
  27. package/dist/MarkdownInline.d.ts.map +1 -1
  28. package/dist/MarkdownInline.js +20 -5
  29. package/dist/MarkdownInline.js.map +1 -1
  30. package/dist/MenuIcon.d.ts +10 -4
  31. package/dist/MenuIcon.d.ts.map +1 -1
  32. package/dist/MenuIcon.js +8 -2
  33. package/dist/MenuIcon.js.map +1 -1
  34. package/dist/Mermaid.d.ts +2 -0
  35. package/dist/Mermaid.d.ts.map +1 -1
  36. package/dist/Mermaid.js +2 -0
  37. package/dist/Mermaid.js.map +1 -1
  38. package/dist/Monogram.d.ts +7 -3
  39. package/dist/Monogram.d.ts.map +1 -1
  40. package/dist/Monogram.js +14 -6
  41. package/dist/Monogram.js.map +1 -1
  42. package/dist/OverflowMenu.d.ts +6 -1
  43. package/dist/OverflowMenu.d.ts.map +1 -1
  44. package/dist/OverflowMenu.js +10 -2
  45. package/dist/OverflowMenu.js.map +1 -1
  46. package/dist/Shell.d.ts +13 -0
  47. package/dist/Shell.d.ts.map +1 -1
  48. package/dist/Shell.js +13 -0
  49. package/dist/Shell.js.map +1 -1
  50. package/dist/Skeleton.d.ts +30 -0
  51. package/dist/Skeleton.d.ts.map +1 -1
  52. package/dist/Skeleton.js +30 -0
  53. package/dist/Skeleton.js.map +1 -1
  54. package/dist/Split.d.ts +24 -5
  55. package/dist/Split.d.ts.map +1 -1
  56. package/dist/Split.js +27 -4
  57. package/dist/Split.js.map +1 -1
  58. package/dist/Tabs.d.ts +77 -0
  59. package/dist/Tabs.d.ts.map +1 -0
  60. package/dist/Tabs.js +91 -0
  61. package/dist/Tabs.js.map +1 -0
  62. package/dist/Toast.d.ts +12 -1
  63. package/dist/Toast.d.ts.map +1 -1
  64. package/dist/Toast.js +11 -0
  65. package/dist/Toast.js.map +1 -1
  66. package/dist/Tooltip.d.ts +12 -3
  67. package/dist/Tooltip.d.ts.map +1 -1
  68. package/dist/Tooltip.js +29 -7
  69. package/dist/Tooltip.js.map +1 -1
  70. package/dist/controls.d.ts +117 -0
  71. package/dist/controls.d.ts.map +1 -0
  72. package/dist/controls.js +59 -0
  73. package/dist/controls.js.map +1 -0
  74. package/dist/fenceInfo.d.ts +4 -1
  75. package/dist/fenceInfo.d.ts.map +1 -1
  76. package/dist/fenceInfo.js +4 -1
  77. package/dist/fenceInfo.js.map +1 -1
  78. package/dist/formControls.d.ts +143 -0
  79. package/dist/formControls.d.ts.map +1 -0
  80. package/dist/formControls.js +108 -0
  81. package/dist/formControls.js.map +1 -0
  82. package/dist/index.d.ts +5 -9
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +5 -9
  85. package/dist/index.js.map +1 -1
  86. package/dist/layout.d.ts +95 -0
  87. package/dist/layout.d.ts.map +1 -0
  88. package/dist/layout.js +93 -0
  89. package/dist/layout.js.map +1 -0
  90. package/dist/primitives.d.ts +10 -360
  91. package/dist/primitives.d.ts.map +1 -1
  92. package/dist/primitives.js +31 -338
  93. package/dist/primitives.js.map +1 -1
  94. package/dist/progress.d.ts +64 -0
  95. package/dist/progress.d.ts.map +1 -0
  96. package/dist/progress.js +51 -0
  97. package/dist/progress.js.map +1 -0
  98. package/dist/text.d.ts +63 -0
  99. package/dist/text.d.ts.map +1 -0
  100. package/dist/text.js +61 -0
  101. package/dist/text.js.map +1 -0
  102. package/package.json +4 -4
  103. package/src/CopySource.tsx +17 -2
  104. package/src/DataTable.tsx +17 -1
  105. package/src/Dialog.tsx +158 -0
  106. package/src/ErrorBoundary.tsx +39 -4
  107. package/src/LiveRegion.tsx +7 -1
  108. package/src/Markdown.tsx +4 -0
  109. package/src/MarkdownInline.tsx +20 -7
  110. package/src/MenuIcon.tsx +10 -4
  111. package/src/Mermaid.tsx +2 -0
  112. package/src/Monogram.tsx +14 -5
  113. package/src/OverflowMenu.tsx +9 -2
  114. package/src/Shell.tsx +13 -0
  115. package/src/Skeleton.tsx +30 -0
  116. package/src/Split.tsx +32 -7
  117. package/src/Tabs.tsx +194 -0
  118. package/src/Toast.tsx +12 -1
  119. package/src/Tooltip.tsx +33 -8
  120. package/src/controls.tsx +159 -0
  121. package/src/fenceInfo.ts +5 -2
  122. package/src/formControls.tsx +249 -0
  123. package/src/index.ts +5 -9
  124. package/src/layout.tsx +141 -0
  125. package/src/primitives.tsx +10 -864
  126. package/src/progress.tsx +129 -0
  127. package/src/text.tsx +99 -0
package/NOTICE CHANGED
@@ -2,4 +2,4 @@ igni
2
2
  Copyright 2026 Ignite Ember
3
3
 
4
4
  This product includes software developed at Ignite Ember
5
- (https://ignite-ember.sh/).
5
+ (https://igni.sh/).
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # `@ignite-ember/ui-react`
2
2
 
3
- **Full documentation:** [ignite-ember.sh/docs/sdk/ui-react](https://ignite-ember.sh/docs/sdk/ui-react) — guides and the complete API reference, a page per topic.
3
+ **Full documentation:** [igni.sh/docs/sdk/ui-react](https://igni.sh/docs/sdk/ui-react) — guides and the complete API reference, a page per topic.
4
4
 
5
5
  The React components an igni extension is allowed to build on.
6
6
  Everything exported here is under the compatibility floor: removing
7
7
  one, renaming it, or changing a prop's meaning is a breaking change
8
- under `docs/EXTENSIBILITY.md` §8.
8
+ under [`docs/EXTENSIBILITY.md`](https://github.com/ignite-ember/igni-core/blob/main/docs/EXTENSIBILITY.md) §8.
9
9
 
10
10
  From npm, with the stylesheet it is drawn with:
11
11
 
@@ -24,15 +24,21 @@ A page that fills its frame, with a toolbar, a scrolling list and a
24
24
  footer:
25
25
 
26
26
  ```tsx
27
+ import { createRoot } from "react-dom/client";
27
28
  import { AppShell, Scroll, Toolbar, Button, Text, Empty } from "@ignite-ember/ui-react";
28
29
  import { connect } from "@ignite-ember/extension-bridge";
29
30
  import "@ignite-ember/ui-css";
30
31
 
32
+ interface Note {
33
+ id: string;
34
+ title: string;
35
+ }
36
+
31
37
  async function main() {
32
38
  const bridge = await connect();
33
39
  const notes = await bridge.rpc<Note[]>("ext.example.teamnotes.list");
34
40
 
35
- return (
41
+ createRoot(document.getElementById("root")!).render(
36
42
  <AppShell
37
43
  header={<Toolbar>Notes</Toolbar>}
38
44
  footer={<Button variant="primary">New note</Button>}
@@ -46,11 +52,32 @@ async function main() {
46
52
  ))
47
53
  )}
48
54
  </Scroll>
49
- </AppShell>
55
+ </AppShell>,
50
56
  );
51
57
  }
58
+
59
+ void main();
60
+ ```
61
+
62
+ The page's `index.html` gives its body the `igni-root` class, holds
63
+ `<div id="root"></div>` and loads the built script from a file (an
64
+ extension's page may not run inline script):
65
+
66
+ ```html
67
+ <!doctype html>
68
+ <html>
69
+ <body class="igni-root">
70
+ <div id="root"></div>
71
+ <script type="module" src="./main.js"></script>
72
+ </body>
73
+ </html>
52
74
  ```
53
75
 
76
+ `igni-root` is what puts the stylesheet's background, font and spacing on
77
+ the page; neither `connect()` nor `AppShell` adds it. Without it the page
78
+ renders unstyled — a transparent background, the browser's serif font, and
79
+ its 8px body margin, so the frame scrolls by 8px.
80
+
54
81
  Three things to know before you write more:
55
82
 
56
83
  - **Every component here is a thin wrapper over a class.** `Button` with
@@ -79,10 +106,8 @@ they point in opposite directions:
79
106
  in a way we would have to warn you about.
80
107
 
81
108
  The list is deliberately short. It is not "everything an extension might
82
- want" — it is what the first two extensions actually import, measured
83
- rather than estimated. `CodeIndex` needs none of it; its only app
84
- dependency is the client type. `Artifacts` is 7,737 lines and imports
85
- exactly seven of the app's components.
109
+ want" — it is what the extensions actually import, measured rather
110
+ than estimated.
86
111
 
87
112
  Two rules decide whether something joins the floor, and both are checked
88
113
  by tests:
@@ -116,15 +141,17 @@ questions.
116
141
  `Dialog`, `Tabs`, `TabPanel`, `Heading`, `Text`, `Code`, `Divider`,
117
142
  `Spinner`, `Progress`. They are thin, they hold no state, and they make
118
143
  no decisions. Reach for one of these first — it is the thing that will
119
- still be here next release.
144
+ still be here next release. `Chip` and `Badge` take a `tone` of
145
+ `"neutral"`, `"success"`, `"warning"` or `"danger"`.
120
146
 
121
147
  **The composites** are the parts of a page that have to be a page:
122
148
  `AppShell` and `Scroll` (the frame), `DataTable`'s `SortableTh` and
123
- `Status` (a table with a sortable header and a status cell), `Toast` and
124
- `ToastHost` and `useToast` (saying something), `LiveRegion` and
149
+ `Status` (a table with a sortable header and a status cell), `ToastHost`
150
+ and `useToast` (saying something) and `Banner` (a condition that is still
151
+ true), `LiveRegion` and
125
152
  `useAnnounce` (announcing it), `ErrorBoundary` (catching what falls
126
153
  over), `Markdown` and `MarkdownInline` and `MermaidBlock` (reading what
127
- igni said).
154
+ igni said), with `fenceInfo` and `loadMermaid` for the pieces beneath them.
128
155
 
129
156
  **The utilities** are the small pieces: `Split`, `MenuIcon`,
130
157
  `Monogram`, `OverflowMenu`, `Skeleton`, `Tooltip`.
@@ -162,7 +189,23 @@ Two things follow from sharing the stylesheet:
162
189
  ## Peer dependencies
163
190
 
164
191
  You already have `react` and `react-dom`. `react-markdown` and
165
- `remark-gfm` come with `MarkdownInline`.
192
+ `remark-gfm` are peers too, and not optional: `Markdown` and
193
+ `MarkdownInline` import them, and the package's entry exports both, so
194
+ every import from `@ignite-ember/ui-react` reaches them. npm 7 and later
195
+ (and pnpm) install them with the package; with another installer, add
196
+ them yourself. (They were optional peers, and a
197
+ Vite build without them succeeded and then threw `Could not resolve
198
+ "react-markdown"` when the page loaded, before anything rendered.)
199
+
200
+ Type-checking a page takes three more, as dev dependencies:
201
+ `typescript`, `@types/react` and `@types/react-dom`. The package's
202
+ declarations import React's types, and without `@types/react` `tsc`
203
+ stops in them with `TS7016: Could not find a declaration file for module
204
+ 'react'`, then reports every component's props as missing:
205
+
206
+ ```bash
207
+ npm install --save-dev typescript @types/react @types/react-dom
208
+ ```
166
209
 
167
210
  `mermaid` is **optional** and loaded on demand — a page with no
168
211
  diagram in it never downloads the 700KB, and an extension that never
@@ -1 +1 @@
1
- {"version":3,"file":"CopySource.d.ts","sourceRoot":"","sources":["../src/CopySource.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,+BAyBxD"}
1
+ {"version":3,"file":"CopySource.d.ts","sourceRoot":"","sources":["../src/CopySource.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,+BAwCxD"}
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  * appears to work and leaves nothing to paste is worse than one
11
11
  * that admits it failed.
12
12
  */
13
- import { useState } from "react";
13
+ import { useEffect, useRef, useState } from "react";
14
14
  import { MenuIcon } from "./MenuIcon.js";
15
15
  /** How long "Copied" or "Copy failed" stays before the button resets. */
16
16
  const FEEDBACK_MS = 1300;
@@ -21,6 +21,17 @@ const LABEL = {
21
21
  };
22
22
  export function CopySource({ source }) {
23
23
  const [state, setState] = useState("idle");
24
+ const timer = useRef(undefined);
25
+ // A pending reset must not outlive the button, nor cut a later
26
+ // click's feedback short.
27
+ const alive = useRef(true);
28
+ useEffect(() => {
29
+ alive.current = true;
30
+ return () => {
31
+ alive.current = false;
32
+ window.clearTimeout(timer.current);
33
+ };
34
+ }, []);
24
35
  const copy = async () => {
25
36
  try {
26
37
  await navigator.clipboard.writeText(source);
@@ -29,7 +40,10 @@ export function CopySource({ source }) {
29
40
  catch {
30
41
  setState("failed");
31
42
  }
32
- window.setTimeout(() => setState("idle"), FEEDBACK_MS);
43
+ if (!alive.current)
44
+ return;
45
+ window.clearTimeout(timer.current);
46
+ timer.current = window.setTimeout(() => setState("idle"), FEEDBACK_MS);
33
47
  };
34
48
  return (_jsx("button", { type: "button", className: "diagram-copy", "data-state": state, title: LABEL[state], "aria-label": LABEL[state], onClick: () => void copy(), children: _jsx(MenuIcon, { name: state === "copied" ? "check" : "copy" }) }));
35
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CopySource.js","sourceRoot":"","sources":["../src/CopySource.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,yEAAyE;AACzE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,KAAK,GAA8B;IACvC,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,wCAAwC;CACjD,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,EAAE,MAAM,EAAsB;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAY,MAAM,CAAC,CAAC;IAEtD,MAAM,IAAI,GAAG,KAAK,I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LAttributes<HTMLTableCellElem
41
41
  *
42
42
  * The button fills the cell so the whole heading is the target
43
43
  * rather than a word inside it.
44
+ *
45
+ * @param children — the heading.
46
+ * @param direction — how this column is currently sorted, or
47
+ * `undefined` when the table is sorted by another column.
48
+ * @param onSort — asked to sort by this column; it gets the direction
49
+ * to go to.
50
+ * @param numeric — right-align the column and use tabular figures.
51
+ * @param className — added to the element's classes, beside the one the
52
+ * theme gives it.
53
+ * @param rest — the remaining props, spread onto the `th`.
44
54
  */
45
55
  export declare function SortableTh({ children, direction, onSort, numeric, className, ...rest }: SortableThProps): import("react").JSX.Element;
46
56
  /** What a {@link Status} takes. */
@@ -56,6 +66,12 @@ export interface StatusProps {
56
66
  */
57
67
  children?: ReactNode;
58
68
  }
59
- /** A state, as a coloured dot and the word it stands for. */
69
+ /**
70
+ * A state, as a coloured dot and the word it stands for.
71
+ *
72
+ * @param state — the four states the health contract defines.
73
+ * @param children — what to show beside the dot; it defaults to the
74
+ * state itself.
75
+ */
60
76
  export declare function Status({ state, children }: StatusProps): import("react").JSX.Element;
61
77
  //# sourceMappingURL=DataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAMzD,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAEvD,uCAAuC;AACvC,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC7E,mBAAmB;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,iEAAiE;IACjE,MAAM,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAC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AAED,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;IACrD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,+BAMtD"}
package/dist/DataTable.js CHANGED
@@ -13,6 +13,16 @@ function cx(...parts) {
13
13
  *
14
14
  * The button fills the cell so the whole heading is the target
15
15
  * rather than a word inside it.
16
+ *
17
+ * @param children — the heading.
18
+ * @param direction — how this column is currently sorted, or
19
+ * `undefined` when the table is sorted by another column.
20
+ * @param onSort — asked to sort by this column; it gets the direction
21
+ * to go to.
22
+ * @param numeric — right-align the column and use tabular figures.
23
+ * @param className — added to the element's classes, beside the one the
24
+ * theme gives it.
25
+ * @param rest — the remaining props, spread onto the `th`.
16
26
  */
17
27
  export function SortableTh({ children, direction, onSort, numeric = false, className, ...rest }) {
18
28
  // Clicking the sorted column reverses it; clicking any other
@@ -22,7 +32,13 @@ export function SortableTh({ children, direction, onSort, numeric = false, class
22
32
  const next = direction === "ascending" ? "descending" : "ascending";
23
33
  return (_jsx("th", { ...rest, scope: "col", "aria-sort": direction ?? "none", className: cx(numeric && "ui-num", className), children: _jsxs("button", { type: "button", className: "ui-th-sort", onClick: () => onSort(next), children: [children, _jsx("span", { className: "ui-th-arrow", "aria-hidden": "true", children: direction === "descending" ? "▾" : "▴" })] }) }));
24
34
  }
25
- /** A state, as a coloured dot and the word it stands for. */
35
+ /**
36
+ * A state, as a coloured dot and the word it stands for.
37
+ *
38
+ * @param state — the four states the health contract defines.
39
+ * @param children — what to show beside the dot; it defaults to the
40
+ * state itself.
41
+ */
26
42
  export function Status({ state, children }) {
27
43
  return (_jsx("span", { className: "ui-status", "data-state": state, children: children ?? state }));
28
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":";AAiBA,SAAS,EAAE,CAAC,GAAG,KAA4C;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAqBD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,IAAI,EACS;IAChB,6DAA6D;IAC7D,iEAAiE;IACjE,iEAAiE;IACjE,iBAAiB;IACjB,MAAM,IAAI,GAAkB,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;IACnF,OAAO,CACL,gBACM,IAAI,EACR,KAAK,EAAC,KAAK,eACA,SAAS,IAAI,MAAM,EAC9B,SAAS,EAAE,EAAE,CAAC,OAAO,IAAI,QAAQ,EAAE,SAAS,CAAC,YAE7C,kBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,aACrE,QAAQ,EACT,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,YAC7C,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAClC,IACA,GACN,CACN,CAAC;AACJ,CAAC;AAgBD,6DAA6D;AAC7D,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAe;IACrD,OAAO,CACL,eAAM,SAAS,EAAC,WAAW,gBAAa,KAAK,YAC1C,QAAQ,IAAI,KAAK,GACb,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":";AAiBA,SAAS,EAAE,CAAC,GAAG,KAA4C;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAqBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,IAAI,EACS;IAChB,6DAA6D;IAC7D,iEAAiE;IACjE,iEAAiE;IACjE,iBAAiB;IACjB,MAAM,IAAI,GAAkB,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;IACnF,OAAO,CACL,gBACM,IAAI,EACR,KAAK,EAAC,KAAK,eACA,SAAS,IAAI,MAAM,EAC9B,SAAS,EAAE,EAAE,CAAC,OAAO,IAAI,QAAQ,EAAE,SAAS,CAAC,YAE7C,kBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,aACrE,QAAQ,EACT,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,YAC7C,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAClC,IACA,GACN,CACN,CAAC;AACJ,CAAC;AAgBD;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAe;IACrD,OAAO,CACL,eAAM,SAAS,EAAC,WAAW,gBAAa,KAAK,YAC1C,QAAQ,IAAI,KAAK,GACb,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The dialog: the one primitive that is behaviour rather than a box.
3
+ *
4
+ * Part of the primitives; see `primitives.tsx`. **Under the
5
+ * compatibility floor.**
6
+ */
7
+ import type { HTMLAttributes, ReactNode } from "react";
8
+ /** What a {@link Dialog} takes. */
9
+ export interface DialogProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
10
+ /** Its title. Also the accessible name of the dialog. */
11
+ title: ReactNode;
12
+ /** Shown under the title. A sentence, not a paragraph. */
13
+ sub?: ReactNode;
14
+ /** The body. */
15
+ children?: ReactNode;
16
+ /** The buttons. Rendered in an `Actions` row at the foot. */
17
+ actions?: ReactNode;
18
+ /** Escape, or a click on the backdrop. */
19
+ onClose: () => void;
20
+ }
21
+ /**
22
+ * The one primitive here that is behaviour rather than a box.
23
+ *
24
+ * A dialog has to trap focus, close on Escape, restore focus to
25
+ * whatever opened it, and not let a click inside the panel count as a
26
+ * click on the backdrop. Every extension that built its own would get
27
+ * some of that wrong, and the ones they get wrong are the ones only
28
+ * keyboard and screen-reader users notice.
29
+ *
30
+ * @param title — its title, also the accessible name of the dialog.
31
+ * @param sub — shown under the title: a sentence, not a paragraph.
32
+ * @param children — the body.
33
+ * @param actions — the buttons, rendered in an `Actions` row at the
34
+ * foot.
35
+ * @param onClose — escape, or a click on the backdrop.
36
+ * @param className — added to the element's classes, beside the one the
37
+ * theme gives it.
38
+ * @param rest — the remaining props, spread onto the dialog panel.
39
+ */
40
+ export declare function Dialog({ title, sub, children, actions, onClose, className, ...rest }: DialogProps): import("react").JSX.Element;
41
+ //# sourceMappingURL=Dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAMtE,mCAAmC;AACnC,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,cAAc,CAAC,cAAc,CAAC,EAC9B,OAAO,CACR;IACC,yDAAyD;IACzD,KAAK,EAAE,SAAS,CAAC;IACjB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACR,EAAE,WAAW,+BAoGb"}
package/dist/Dialog.js ADDED
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useId, useRef } from "react";
3
+ import { cx } from "./cx.js";
4
+ import { Actions } from "./layout.js";
5
+ /**
6
+ * The one primitive here that is behaviour rather than a box.
7
+ *
8
+ * A dialog has to trap focus, close on Escape, restore focus to
9
+ * whatever opened it, and not let a click inside the panel count as a
10
+ * click on the backdrop. Every extension that built its own would get
11
+ * some of that wrong, and the ones they get wrong are the ones only
12
+ * keyboard and screen-reader users notice.
13
+ *
14
+ * @param title — its title, also the accessible name of the dialog.
15
+ * @param sub — shown under the title: a sentence, not a paragraph.
16
+ * @param children — the body.
17
+ * @param actions — the buttons, rendered in an `Actions` row at the
18
+ * foot.
19
+ * @param onClose — escape, or a click on the backdrop.
20
+ * @param className — added to the element's classes, beside the one the
21
+ * theme gives it.
22
+ * @param rest — the remaining props, spread onto the dialog panel.
23
+ */
24
+ export function Dialog({ title, sub, children, actions, onClose, className, ...rest }) {
25
+ const panel = useRef(null);
26
+ const opener = useRef(null);
27
+ const titleId = useId();
28
+ useEffect(() => {
29
+ opener.current = document.activeElement;
30
+ // Focus the panel itself rather than the first control: reading
31
+ // the title before the buttons is the point of having one.
32
+ panel.current?.focus();
33
+ return () => {
34
+ // Only if it is still in the document: an opener that has
35
+ // unmounted drops focus to <body> silently, which is worse than
36
+ // leaving it where the closing action put it.
37
+ const back = opener.current;
38
+ if (back instanceof HTMLElement && back.isConnected)
39
+ back.focus();
40
+ };
41
+ }, []);
42
+ const onKeyDown = useCallback((event) => {
43
+ if (event.key === "Escape") {
44
+ event.stopPropagation();
45
+ onClose();
46
+ return;
47
+ }
48
+ if (event.key !== "Tab")
49
+ return;
50
+ // `:not([disabled])` matters more than it looks: a modal whose
51
+ // confirm button is disabled until a field is typed is the
52
+ // commonest pattern there is, and without this the wrap targets
53
+ // a disabled element, preventDefault fires, focus() is a no-op
54
+ // and Tab appears dead. Dead Tab is worse than escaping Tab.
55
+ // `iframe` is here because an extension *is* one.
56
+ const focusable = panel.current?.querySelectorAll([
57
+ "button:not([disabled])",
58
+ "a[href]",
59
+ "input:not([disabled]):not([type=hidden])",
60
+ "select:not([disabled])",
61
+ "textarea:not([disabled])",
62
+ "iframe",
63
+ "summary",
64
+ "[contenteditable]",
65
+ '[tabindex]:not([tabindex="-1"])',
66
+ ].join(", "));
67
+ if (!focusable || focusable.length === 0) {
68
+ // Nothing to move to, so hold the focus here rather than let
69
+ // Tab walk into the page behind a modal with no way back.
70
+ event.preventDefault();
71
+ return;
72
+ }
73
+ const first = focusable[0];
74
+ const last = focusable[focusable.length - 1];
75
+ if (event.shiftKey && document.activeElement === first) {
76
+ event.preventDefault();
77
+ last.focus();
78
+ }
79
+ else if (!event.shiftKey && document.activeElement === last) {
80
+ event.preventDefault();
81
+ first.focus();
82
+ }
83
+ }, [onClose]);
84
+ return (_jsx("div", { className: "overlay", onMouseDown: (e) => {
85
+ // Primary button only, and only on the backdrop itself, so a
86
+ // right-click raising a context menu leaves the modal open.
87
+ if (e.button === 0 && e.target === e.currentTarget)
88
+ onClose();
89
+ }, children: _jsxs("div", { ...rest, ref: panel, className: cx("dialog", className), role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: onKeyDown,
90
+ // Without this a drag that starts inside and ends outside
91
+ // closes the dialog, which eats a selection.
92
+ onMouseDown: (e) => e.stopPropagation(), children: [_jsx("h2", { className: "dialog-title", id: titleId, children: title }), sub ? _jsx("p", { className: "dialog-sub", children: sub }) : null, children, actions ? (_jsx(Actions, { className: "dialog-actions", children: actions })) : null] }) }));
93
+ }
94
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAmBtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,KAAK,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACK;IACZ,MAAM,KAAK,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IAExB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC;QACxC,gEAAgE;QAChE,2DAA2D;QAC3D,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QACvB,OAAO,GAAG,EAAE;YACV,0DAA0D;YAC1D,gEAAgE;YAChE,8CAA8C;YAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;YAC5B,IAAI,IAAI,YAAY,WAAW,IAAI,IAAI,CAAC,WAAW;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACpE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,KAAoB,EAAE,EAAE;QACvB,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC3B,KAAK,CAAC,e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,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa;gBAAE,OAAO,EAAE,CAAC;QAChE,CAAC,YAED,kBACM,IAAI,EACR,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClC,IAAI,EAAC,QAAQ,gBACF,MAAM,qBAGA,OAAO,EACxB,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,SAAS;YACpB,0DAA0D;YAC1D,6CAA6C;YAC7C,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,aAEvC,aAAI,SAAS,EAAC,cAAc,EAAC,EAAE,EAAE,OAAO,YACrC,KAAK,GACH,EACJ,GAAG,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,YAAY,YAAE,GAAG,GAAK,CAAC,CAAC,CAAC,IAAI,EAChD,QAAQ,EACR,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,OAAO,IAAC,SAAS,EAAC,gBAAgB,YAAE,OAAO,GAAW,CACxD,CAAC,CAAC,CAAC,IAAI,IACJ,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -53,15 +53,44 @@ interface State {
53
53
  /**
54
54
  * What is shown where a subtree threw.
55
55
  *
56
- * See the note at the top of this file: it catches less than people
57
- * expect, and the default fallback shows the message on purpose.
56
+ * It catches less than people expect: render, lifecycle and
57
+ * constructor throws in the subtree below it, and not event handlers,
58
+ * `setTimeout`, promise rejections or anything during SSR. The default
59
+ * fallback shows the error's message on purpose.
58
60
  */
59
61
  export declare class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
62
+ /**
63
+ * The error the subtree threw, or null while nothing has thrown.
64
+ */
60
65
  state: State;
66
+ /**
67
+ * The state the boundary holds after a throw.
68
+ *
69
+ * @param error — the error the subtree threw.
70
+ */
61
71
  static getDerivedStateFromError(error: Error): State;
72
+ /**
73
+ * Reports the error to whoever asked for it.
74
+ *
75
+ * @param error — the error the subtree threw.
76
+ * @param info — React's account of where it was thrown: the component
77
+ * stack.
78
+ */
62
79
  componentDidCatch(error: Error, info: ErrorInfo): void;
80
+ /**
81
+ * Clears the boundary when the reset keys change.
82
+ *
83
+ * @param previous — the props from the previous render, whose
84
+ * `resetKeys` are compared with the new ones.
85
+ */
63
86
  componentDidUpdate(previous: ErrorBoundaryProps): void;
87
+ /**
88
+ * Clears the error and renders the children again.
89
+ */
64
90
  reset: () => void;
91
+ /**
92
+ * The children, or the error page when the subtree threw.
93
+ */
65
94
  render(): ReactNode;
66
95
  }
67
96
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../src/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;IAC1D,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAChC;AAED,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAMD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC;IACrE,KAAK,EAAE,KAAK,CAAmB;IAE/B,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KA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ACH,KAAK,QAAO,IAAI,CAEd;IAEF;;OAEG;IACH,MAAM,IAAI,SAAS;CAcpB"}
@@ -23,23 +23,51 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
23
  * `ScannerClient` is what that looks like.
24
24
  */
25
25
  import { Component } from "react";
26
+ // Anything can be thrown. The fallback and `onError` are typed to get an
27
+ // Error, and `null` held as the error would read as "nothing thrown".
28
+ function toError(thrown) {
29
+ return thrown instanceof Error ? thrown : new Error(String(thrown));
30
+ }
26
31
  function changed(a, b) {
27
32
  return a.length !== b.length || a.some((value, i) => !Object.is(value, b[i]));
28
33
  }
29
34
  /**
30
35
  * What is shown where a subtree threw.
31
36
  *
32
- * See the note at the top of this file: it catches less than people
33
- * expect, and the default fallback shows the message on purpose.
37
+ * It catches less than people expect: render, lifecycle and
38
+ * constructor throws in the subtree below it, and not event handlers,
39
+ * `setTimeout`, promise rejections or anything during SSR. The default
40
+ * fallback shows the error's message on purpose.
34
41
  */
35
42
  export class ErrorBoundary extends Component {
43
+ /**
44
+ * The error the subtree threw, or null while nothing has thrown.
45
+ */
36
46
  state = { error: null };
47
+ /**
48
+ * The state the boundary holds after a throw.
49
+ *
50
+ * @param error — the error the subtree threw.
51
+ */
37
52
  static getDerivedStateFromError(error) {
38
- return { error };
53
+ return { error: toError(error) };
39
54
  }
55
+ /**
56
+ * Reports the error to whoever asked for it.
57
+ *
58
+ * @param error — the error the subtree threw.
59
+ * @param info — React's account of where it was thrown: the component
60
+ * stack.
61
+ */
40
62
  componentDidCatch(error, info) {
41
- this.props.onError?.(error, info);
63
+ this.props.onError?.(toError(error), info);
42
64
  }
65
+ /**
66
+ * Clears the boundary when the reset keys change.
67
+ *
68
+ * @param previous — the props from the previous render, whose
69
+ * `resetKeys` are compared with the new ones.
70
+ */
43
71
  componentDidUpdate(previous) {
44
72
  if (this.state.error === null)
45
73
  return;
@@ -48,9 +76,15 @@ export class ErrorBoundary extends Component {
48
76
  if (changed(before, now))
49
77
  this.reset();
50
78
  }
79
+ /**
80
+ * Clears the error and renders the children again.
81
+ */
51
82
  reset = () => {
52
83
  this.setState({ error: null });
53
84
  };
85
+ /**
86
+ * The children, or the error page when the subtree threw.
87
+ */
54
88
  render() {
55
89
  const { error } = this.state;
56
90
  if (error === null)
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../src/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAgClE,SAAS,OAAO,CAAC,CAAqB,EAAE,CAAqB;IAC3D,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAoC;IACrE,KAAK,GAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAE/B,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,IAAe;QAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,kBAAkB,CAAC,QAA4B;QAC7C,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;YAAE,OAAO;QACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;QACvC,IAAI,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;YAAE,I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AC,KAAK,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,aACpC,YAAG,SAAS,EAAC,SAAS,wDAA4C,EAClE,cAAK,SAAS,EAAC,iBAAiB,YAAE,KAAK,CAAC,OAAO,GAAO,EACtD,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK,0BAEhD,IACL,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -29,7 +29,13 @@ export interface LiveRegionProps {
29
29
  *
30
30
  * `<LiveRegion>{`${n} results`}</LiveRegion>` is the whole usage.
31
31
  * Mounted empty on the first render so the region exists before it
32
- * has anything to say — see note 1 above.
32
+ * has anything to say: a live region added to the page with its
33
+ * message already in it is frequently not announced.
34
+ *
35
+ * @param children — what to say; changing it announces, and clearing it
36
+ * says nothing.
37
+ * @param urgency — how insistently it is announced: politely, or
38
+ * assertively.
33
39
  */
34
40
  export declare function LiveRegion({ children, urgency }: LiveRegionProps): import("react").JSX.Element;
35
41
  //# sourceMappingURL=LiveRegion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LiveRegion.d.ts","sourceRoot":"","sources":["../src/LiveRegion.tsx"],"names":[],"mappings":"AA2BA,2BAA2B;AAC3B,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7C,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,mEAAmE;IACnE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAyCvC;AAED,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAa,EAAE,OAAkB,EAAE,EAAE,eAAe,+BAehF"}
1
+ {"version":3,"file":"LiveRegion.d.ts","sourceRoot":"","sources":["../src/LiveRegion.tsx"],"names":[],"mappings":"AA2BA,2BAA2B;AAC3B,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7C,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,mEAAmE;IACnE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAyCvC;AAED,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAa,EAAE,OAAkB,EAAE,EAAE,eAAe,+BAehF"}
@@ -58,7 +58,13 @@ export function useAnnounce() {
58
58
  *
59
59
  * `<LiveRegion>{`${n} results`}</LiveRegion>` is the whole usage.
60
60
  * Mounted empty on the first render so the region exists before it
61
- * has anything to say — see note 1 above.
61
+ * has anything to say: a live region added to the page with its
62
+ * message already in it is frequently not announced.
63
+ *
64
+ * @param children — what to say; changing it announces, and clearing it
65
+ * says nothing.
66
+ * @param urgency — how insistently it is announced: politely, or
67
+ * assertively.
62
68
  */
63
69
  export function LiveRegion({ children = "", urgency = "polite"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ownProps {
13
13
  * enabled and will not be — `rehype-raw` in a surface that renders
14
14
  * text somebody else wrote is a script tag waiting to happen, and an
15
15
  * extension's frame has a CSP precisely so that it cannot.
16
+ *
17
+ * @param children — the source; rendered as a document, not flattened.
18
+ * @param className — added to the element's classes, beside the one the
19
+ * theme gives it.
16
20
  */
17
21
  export declare function Markdown({ children, className }: MarkdownProps): import("react").JSX.Element;
18
22
  //# sourceMappingURL=Markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../src/Markdown.tsx"],"names":[],"mappings":"AA6CA,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,aAAa,+BAQ9D"}
1
+ {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../src/Markdown.tsx"],"names":[],"mappings":"AA6CA,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,aAAa,+BAQ9D"}
package/dist/Markdown.js CHANGED
@@ -45,6 +45,10 @@ const COMPONENTS = {
45
45
  * enabled and will not be — `rehype-raw` in a surface that renders
46
46
  * text somebody else wrote is a script tag waiting to happen, and an
47
47
  * extension's frame has a CSP precisely so that it cannot.
48
+ *
49
+ * @param children — the source; rendered as a document, not flattened.
50
+ * @param className — added to the element's classes, beside the one the
51
+ * theme gives it.
48
52
  */
49
53
  export function Markdown({ children, className }) {
50
54
  return (_jsx("div", { className: cx("ui-prose", className), children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], components: COMPONENTS, children: children }) }));