@ignite-ember/ui-react 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +217 -2
  4. package/dist/CopySource.d.ts +4 -0
  5. package/dist/CopySource.d.ts.map +1 -0
  6. package/dist/CopySource.js +36 -0
  7. package/dist/CopySource.js.map +1 -0
  8. package/dist/DataTable.d.ts +61 -0
  9. package/dist/DataTable.d.ts.map +1 -0
  10. package/dist/DataTable.js +29 -0
  11. package/dist/DataTable.js.map +1 -0
  12. package/dist/ErrorBoundary.d.ts +68 -0
  13. package/dist/ErrorBoundary.d.ts.map +1 -0
  14. package/dist/ErrorBoundary.js +63 -0
  15. package/dist/ErrorBoundary.js.map +1 -0
  16. package/dist/LiveRegion.d.ts +35 -0
  17. package/dist/LiveRegion.d.ts.map +1 -0
  18. package/dist/LiveRegion.js +70 -0
  19. package/dist/LiveRegion.js.map +1 -0
  20. package/dist/Markdown.d.ts +18 -0
  21. package/dist/Markdown.d.ts.map +1 -0
  22. package/dist/Markdown.js +52 -0
  23. package/dist/Markdown.js.map +1 -0
  24. package/dist/MarkdownInline.d.ts +44 -0
  25. package/dist/MarkdownInline.d.ts.map +1 -0
  26. package/dist/MarkdownInline.js +144 -0
  27. package/dist/MarkdownInline.js.map +1 -0
  28. package/dist/MenuIcon.d.ts +54 -0
  29. package/dist/MenuIcon.d.ts.map +1 -0
  30. package/dist/MenuIcon.js +96 -0
  31. package/dist/MenuIcon.js.map +1 -0
  32. package/dist/Mermaid.d.ts +38 -0
  33. package/dist/Mermaid.d.ts.map +1 -0
  34. package/dist/Mermaid.js +119 -0
  35. package/dist/Mermaid.js.map +1 -0
  36. package/dist/Monogram.d.ts +42 -0
  37. package/dist/Monogram.d.ts.map +1 -0
  38. package/dist/Monogram.js +88 -0
  39. package/dist/Monogram.js.map +1 -0
  40. package/dist/OverflowMenu.d.ts +55 -0
  41. package/dist/OverflowMenu.d.ts.map +1 -0
  42. package/dist/OverflowMenu.js +141 -0
  43. package/dist/OverflowMenu.js.map +1 -0
  44. package/dist/Shell.d.ts +54 -0
  45. package/dist/Shell.d.ts.map +1 -0
  46. package/dist/Shell.js +31 -0
  47. package/dist/Shell.js.map +1 -0
  48. package/dist/Skeleton.d.ts +32 -0
  49. package/dist/Skeleton.d.ts.map +1 -0
  50. package/dist/Skeleton.js +26 -0
  51. package/dist/Skeleton.js.map +1 -0
  52. package/dist/Split.d.ts +66 -0
  53. package/dist/Split.d.ts.map +1 -0
  54. package/dist/Split.js +133 -0
  55. package/dist/Split.js.map +1 -0
  56. package/dist/Toast.d.ts +87 -0
  57. package/dist/Toast.d.ts.map +1 -0
  58. package/dist/Toast.js +118 -0
  59. package/dist/Toast.js.map +1 -0
  60. package/dist/Tooltip.d.ts +15 -0
  61. package/dist/Tooltip.d.ts.map +1 -0
  62. package/dist/Tooltip.js +144 -0
  63. package/dist/Tooltip.js.map +1 -0
  64. package/dist/cx.d.ts +3 -0
  65. package/dist/cx.d.ts.map +1 -0
  66. package/dist/cx.js +5 -0
  67. package/dist/cx.js.map +1 -0
  68. package/dist/fenceInfo.d.ts +23 -0
  69. package/dist/fenceInfo.d.ts.map +1 -0
  70. package/dist/fenceInfo.js +19 -0
  71. package/dist/fenceInfo.js.map +1 -0
  72. package/dist/index.d.ts +82 -0
  73. package/dist/index.d.ts.map +1 -0
  74. package/dist/index.js +82 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/primitives.d.ts +383 -0
  77. package/dist/primitives.d.ts.map +1 -0
  78. package/dist/primitives.js +340 -0
  79. package/dist/primitives.js.map +1 -0
  80. package/package.json +56 -4
  81. package/src/CopySource.tsx +52 -0
  82. package/src/DataTable.tsx +104 -0
  83. package/src/ErrorBoundary.tsx +102 -0
  84. package/src/LiveRegion.tsx +121 -0
  85. package/src/Markdown.tsx +71 -0
  86. package/src/MarkdownInline.tsx +164 -0
  87. package/src/MenuIcon.tsx +203 -0
  88. package/src/Mermaid.tsx +142 -0
  89. package/src/Monogram.tsx +103 -0
  90. package/src/OverflowMenu.tsx +352 -0
  91. package/src/Shell.tsx +86 -0
  92. package/src/Skeleton.tsx +68 -0
  93. package/src/Split.tsx +242 -0
  94. package/src/Toast.tsx +258 -0
  95. package/src/Tooltip.tsx +188 -0
  96. package/src/cx.ts +4 -0
  97. package/src/fenceInfo.ts +33 -0
  98. package/src/index.ts +153 -0
  99. package/src/primitives.tsx +887 -0
@@ -0,0 +1,32 @@
1
+ import type { CSSProperties } from "react";
2
+ /**
3
+ * Animated placeholder block. Render at the same approximate size
4
+ * and rhythm as the eventual content so the layout doesn't jump
5
+ * when async data lands.
6
+ *
7
+ * Usage:
8
+ * <Skeleton.Line width="60%" />
9
+ * <Skeleton.Block height={64} />
10
+ * <Skeleton.Circle size={48} />
11
+ */
12
+ export declare const Skeleton: {
13
+ Line({ width, height, style, }: {
14
+ width?: number | string;
15
+ height?: number | string;
16
+ style?: CSSProperties;
17
+ }): import("react").JSX.Element;
18
+ Block({ height, width, style, }: {
19
+ height?: number | string;
20
+ width?: number | string;
21
+ style?: CSSProperties;
22
+ }): import("react").JSX.Element;
23
+ Circle({ size, style }: {
24
+ size?: number;
25
+ style?: CSSProperties;
26
+ }): import("react").JSX.Element;
27
+ Rows({ count, style }: {
28
+ count?: number;
29
+ style?: CSSProperties;
30
+ }): import("react").JSX.Element;
31
+ };
32
+ //# sourceMappingURL=Skeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;oCAKhB;QACD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,aAAa,CAAC;KACvB;qCAYE;QACD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,aAAa,CAAC;KACvB;4BAQ4B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAE;2BAQ1C;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAE;CAcrE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Animated placeholder block. Render at the same approximate size
4
+ * and rhythm as the eventual content so the layout doesn't jump
5
+ * when async data lands.
6
+ *
7
+ * Usage:
8
+ * <Skeleton.Line width="60%" />
9
+ * <Skeleton.Block height={64} />
10
+ * <Skeleton.Circle size={48} />
11
+ */
12
+ export const Skeleton = {
13
+ Line({ width = "100%", height = 12, style, }) {
14
+ return (_jsx("span", { className: "skeleton skeleton-text", style: { display: "block", width, height, ...style } }));
15
+ },
16
+ Block({ height = 64, width = "100%", style, }) {
17
+ return (_jsx("span", { className: "skeleton skeleton-block", style: { display: "block", height, width, ...style } }));
18
+ },
19
+ Circle({ size = 24, style }) {
20
+ return (_jsx("span", { className: "skeleton skeleton-circle", style: { display: "inline-block", width: size, height: size, ...style } }));
21
+ },
22
+ Rows({ count = 4, style }) {
23
+ return (_jsx("div", { style: { display: "flex", flexDirection: "column", gap: 12, ...style }, children: Array.from({ length: count }).map((_, i) => (_jsxs("div", { children: [_jsx(Skeleton.Line, { width: "40%", height: 11 }), _jsx(Skeleton.Line, { width: "100%" })] }, i))) }));
24
+ },
25
+ };
26
+ //# sourceMappingURL=Skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../src/Skeleton.t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AAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,KAFtB,CAAC,CAGL,CACP,CAAC,GACE,CACP,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Two panes and a rule you can move.
3
+ *
4
+ * Both extensions built against this floor wanted one and neither
5
+ * could have it: `ColumnHandle` is 180 lines in the app, does exactly
6
+ * this, and was not published. `examples/release-notes` hand-rolls
7
+ * the grid, the pointer capture, the clamping and the separator, and
8
+ * says so in its README. Every two-pane extension would write that
9
+ * again, differently — which is how two panels in one product end up
10
+ * resizing differently.
11
+ *
12
+ * **It drives a CSS variable, not React state.** A `pointermove`
13
+ * handler that re-rendered would re-render the whole document on
14
+ * every frame of the drag, and would stutter on exactly the documents
15
+ * busy enough to be worth resizing. Writing the variable lets the
16
+ * browser reflow and leaves the tree alone.
17
+ *
18
+ * **It does not remember the width**, and that is the deliberate
19
+ * difference from the app's version. An extension is served from an
20
+ * ephemeral port, a port is part of an origin, so its `localStorage`
21
+ * is wiped whenever the backend restarts — persisting there would be
22
+ * a promise this cannot keep. `onResize` hands the width back
23
+ * instead, and an extension that wants it remembered puts it
24
+ * somewhere that survives: `bridge.setLocation`, or its own backend.
25
+ *
26
+ * The other difference is `aria-valuenow`. A focusable `separator`
27
+ * that never says where it is tells a screen-reader user that
28
+ * something is adjustable and not what it is adjusted to.
29
+ */
30
+ import { type HTMLAttributes, type ReactNode } from "react";
31
+ /** What a {@link Split} takes. */
32
+ export interface SplitProps extends Omit<HTMLAttributes<HTMLDivElement>, "onResize"> {
33
+ /** The fixed-width pane. */
34
+ aside: ReactNode;
35
+ /** The pane that takes what is left. */
36
+ children: ReactNode;
37
+ /** Which side `aside` is on. Defaults to the left. */
38
+ side?: "start" | "end";
39
+ /** Starting width of `aside`, in pixels. */
40
+ defaultWidth?: number;
41
+ /** The narrowest `aside` may be, in pixels. */
42
+ min?: number;
43
+ /** The widest `aside` may be, in pixels — and never more than 60% of the window. */
44
+ max?: number;
45
+ /**
46
+ * Said to a screen reader, and shown on hover.
47
+ *
48
+ * Required: "separator" is what the role already announces, and a
49
+ * page with two of them needs to say which is which.
50
+ */
51
+ label: string;
52
+ /**
53
+ * The width changed. Called on release and on each keypress, not
54
+ * on every pointer move — a handler that fires sixty times a second
55
+ * is a handler somebody writes a round trip into.
56
+ */
57
+ onResize?: (width: number) => void;
58
+ }
59
+ /**
60
+ * Two panes and a rule you can move.
61
+ *
62
+ * See the note at the top of this file: it drives a CSS variable
63
+ * rather than React state, and it does not remember the width.
64
+ */
65
+ export declare function Split({ aside, children, side, defaultWidth, min, max, label, onResize, className, ...rest }: SplitProps): import("react").JSX.Element;
66
+ //# sourceMappingURL=Split.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Split.d.ts","sourceRoot":"","sources":["../src/Split.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAML,KAAK,cAAc,EAGnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiBf,kCAAkC;AAClC,MAAM,WAAW,UAAW,SAAQ,IAAI,CACtC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,CACX;IACC,4BAA4B;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACvB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,IAAc,EACd,YAAkB,EAClB,GAAS,EACT,GAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,UAAU,+BAwIZ"}
package/dist/Split.js ADDED
@@ -0,0 +1,133 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Two panes and a rule you can move.
4
+ *
5
+ * Both extensions built against this floor wanted one and neither
6
+ * could have it: `ColumnHandle` is 180 lines in the app, does exactly
7
+ * this, and was not published. `examples/release-notes` hand-rolls
8
+ * the grid, the pointer capture, the clamping and the separator, and
9
+ * says so in its README. Every two-pane extension would write that
10
+ * again, differently — which is how two panels in one product end up
11
+ * resizing differently.
12
+ *
13
+ * **It drives a CSS variable, not React state.** A `pointermove`
14
+ * handler that re-rendered would re-render the whole document on
15
+ * every frame of the drag, and would stutter on exactly the documents
16
+ * busy enough to be worth resizing. Writing the variable lets the
17
+ * browser reflow and leaves the tree alone.
18
+ *
19
+ * **It does not remember the width**, and that is the deliberate
20
+ * difference from the app's version. An extension is served from an
21
+ * ephemeral port, a port is part of an origin, so its `localStorage`
22
+ * is wiped whenever the backend restarts — persisting there would be
23
+ * a promise this cannot keep. `onResize` hands the width back
24
+ * instead, and an extension that wants it remembered puts it
25
+ * somewhere that survives: `bridge.setLocation`, or its own backend.
26
+ *
27
+ * The other difference is `aria-valuenow`. A focusable `separator`
28
+ * that never says where it is tells a screen-reader user that
29
+ * something is adjustable and not what it is adjusted to.
30
+ */
31
+ import { useCallback, useId, useRef, useState, } from "react";
32
+ import { cx } from "./cx.js";
33
+ /** Keyboard step, and the larger one with Shift held. */
34
+ const STEP = 12;
35
+ const BIG_STEP = 48;
36
+ /**
37
+ * How much of the window one pane may take, whatever `max` says.
38
+ *
39
+ * A pane dragged wide on a narrow laptop otherwise leaves the other
40
+ * a few characters across — a state the reader has to drag their way
41
+ * back out of.
42
+ */
43
+ const MOST_OF_WINDOW = 0.6;
44
+ /**
45
+ * Two panes and a rule you can move.
46
+ *
47
+ * See the note at the top of this file: it drives a CSS variable
48
+ * rather than React state, and it does not remember the width.
49
+ */
50
+ export function Split({ aside, children, side = "start", defaultWidth = 280, min = 160, max = 640, label, onResize, className, ...rest }) {
51
+ // Scoped to this instance, so two splits on one page do not fight
52
+ // over one custom property.
53
+ const variable = `--ui-split-${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
54
+ const root = useRef(null);
55
+ // The aside itself, not "the first child": with `side="end"` the
56
+ // first child is the main pane.
57
+ const asidePane = useRef(null);
58
+ const drag = useRef(null);
59
+ // Mirrored into state only so `aria-valuenow` is right. The layout
60
+ // itself never reads this.
61
+ const [announced, setAnnounced] = useState(defaultWidth);
62
+ const clamp = useCallback((px) => {
63
+ const ceiling = Math.min(max, Math.round((typeof window === "undefined" ? max : window.innerWidth) *
64
+ MOST_OF_WINDOW));
65
+ // `min` wins over the ceiling on a very narrow window: a pane
66
+ // below its minimum is unreadable, and unreadable is worse
67
+ // than wide.
68
+ return Math.round(Math.max(min, Math.min(px, Math.max(min, ceiling))));
69
+ }, [min, max]);
70
+ const apply = useCallback((px) => {
71
+ const width = clamp(px);
72
+ root.current?.style.setProperty(variable, `${width}px`);
73
+ setAnnounced(width);
74
+ return width;
75
+ }, [clamp, variable]);
76
+ const currentWidth = () => asidePane.current?.getBoundingClientRect().width ?? defaultWidth;
77
+ const onPointerDown = (event) => {
78
+ event.preventDefault();
79
+ event.currentTarget.setPointerCapture(event.pointerId);
80
+ drag.current = { startX: event.clientX, startWidth: currentWidth() };
81
+ // On the root rather than the strip, so it survives the pointer
82
+ // leaving — which it does on any drag faster than the reflow.
83
+ root.current?.classList.add("ui-split-resizing");
84
+ };
85
+ const onPointerMove = (event) => {
86
+ const from = drag.current;
87
+ if (from === null)
88
+ return;
89
+ const travelled = event.clientX - from.startX;
90
+ apply(from.startWidth + (side === "start" ? travelled : -travelled));
91
+ };
92
+ const finish = (event) => {
93
+ if (drag.current === null)
94
+ return;
95
+ drag.current = null;
96
+ root.current?.classList.remove("ui-split-resizing");
97
+ event.currentTarget.releasePointerCapture?.(event.pointerId);
98
+ onResize?.(clamp(currentWidth()));
99
+ };
100
+ const onKeyDown = (event) => {
101
+ // A 5px strip is a hard target with a trackpad and an impossible
102
+ // one without a pointer, and this is the only way to move a pane
103
+ // that is otherwise fixed.
104
+ const step = event.shiftKey ? BIG_STEP : STEP;
105
+ const wider = side === "start" ? "ArrowRight" : "ArrowLeft";
106
+ const narrower = side === "start" ? "ArrowLeft" : "ArrowRight";
107
+ let next = null;
108
+ if (event.key === wider)
109
+ next = currentWidth() + step;
110
+ else if (event.key === narrower)
111
+ next = currentWidth() - step;
112
+ else if (event.key === "Home")
113
+ next = min;
114
+ else if (event.key === "End")
115
+ next = max;
116
+ if (next === null)
117
+ return;
118
+ event.preventDefault();
119
+ onResize?.(apply(next));
120
+ };
121
+ const handle = (_jsx("div", { className: "ui-split-handle", role: "separator", "aria-orientation": "vertical", "aria-label": label, title: label, "aria-valuenow": announced, "aria-valuemin": min, "aria-valuemax": max, tabIndex: 0, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: finish, onPointerCancel: finish, onKeyDown: onKeyDown,
122
+ // Back to where it started. A pane dragged somewhere silly is
123
+ // otherwise a slow drag back to a width nobody remembers.
124
+ onDoubleClick: () => onResize?.(apply(defaultWidth)) }, "handle"));
125
+ const asideElement = (_jsx("div", { ref: asidePane, className: "ui-split-aside", children: aside }, "aside"));
126
+ const mainElement = (_jsx("div", { className: "ui-split-main", children: children }, "main"));
127
+ // Keyed, so flipping `side` reorders the panes instead of remounting them.
128
+ const panes = side === "start"
129
+ ? [asideElement, handle, mainElement]
130
+ : [mainElement, handle, asideElement];
131
+ return (_jsx("div", { ...rest, ref: root, className: cx("ui-split", side === "end" && "ui-split-end", className), style: { [variable]: `${defaultWidth}px`, ...rest.style }, "data-split-var": variable, children: panes }));
132
+ }
133
+ //# sourceMappingURL=Split.js.map
@@ -0,0 +1 @@
1
+ {"version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AC,CAAC;IAE1C,OAAO,CACL,iBACM,IAAI,EACR,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,IAAI,cAAc,EAAE,SAAS,CAAC,EACtE,KAAK,EACH,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,YAAY,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAmB,oBAErD,QAAQ,YAEvB,KAAK,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * "It saved." — the message every extension needs and none had.
3
+ *
4
+ * EXTENSIBILITY §5 names `notify` in the list of bridge APIs that do
5
+ * not exist. A specified-and-absent API is worse than a missing one,
6
+ * because a partner designs against it and finds out on demo day.
7
+ *
8
+ * This is the in-frame half: an extension's own toasts, in its own
9
+ * frame. It is not `bridge.notify` — that would put a message in
10
+ * igni's chrome, outside the frame, and needs a host envelope that
11
+ * does not exist yet. The distinction matters because they are not
12
+ * interchangeable: a toast about something inside this panel belongs
13
+ * inside this panel, and only something the user must see after
14
+ * navigating away belongs to the host.
15
+ *
16
+ * **Announced, not just drawn.** The stack is a polite live region,
17
+ * so a toast reaches somebody who is not looking at that corner. A
18
+ * `danger` toast is assertive instead: it is the one case where
19
+ * interrupting is correct.
20
+ *
21
+ * Toasts do not stack indefinitely and do not auto-dismiss when they
22
+ * carry an action — a message that disappears while you are reaching
23
+ * for its button is a message that was never actionable.
24
+ */
25
+ import { type HTMLAttributes, type ReactNode } from "react";
26
+ import type { Tone } from "./primitives.js";
27
+ /** What a toast says and how long it stays. */
28
+ export interface ToastOptions {
29
+ /** How loud it is. `danger` interrupts; the rest wait for a pause. */
30
+ tone?: Tone;
31
+ /**
32
+ * Milliseconds before it goes. `null` keeps it until dismissed,
33
+ * which is the default when there is an `action`.
34
+ */
35
+ duration?: number | null;
36
+ /** One thing to do about it. Keeps the toast until dismissed. */
37
+ action?: ReactNode;
38
+ }
39
+ /** A toast that is on screen. */
40
+ export interface Toast extends ToastOptions {
41
+ /** Its id, so it can be dismissed early. */
42
+ id: string;
43
+ /** What it says. */
44
+ message: ReactNode;
45
+ }
46
+ /** How to raise and dismiss toasts. */
47
+ export interface ToastApi {
48
+ /** Show one. Returns its id, so it can be dismissed early. */
49
+ show: (message: ReactNode, options?: ToastOptions) => string;
50
+ /** Take one away before its time is up. */
51
+ dismiss: (id: string) => void;
52
+ /** Take every one away. */
53
+ clear: () => void;
54
+ }
55
+ /**
56
+ * Wrap the part of the app that raises toasts.
57
+ *
58
+ * Renders the stack itself, so there is nothing to place and no way
59
+ * to forget to place it.
60
+ */
61
+ export declare function ToastHost({ children }: {
62
+ children: ReactNode;
63
+ }): import("react").JSX.Element;
64
+ /**
65
+ * Raise a toast.
66
+ *
67
+ * Throws outside a {@link ToastHost} rather than returning a no-op.
68
+ * A silent no-op here means a save that reports success by showing
69
+ * nothing, which looks exactly like a save that did not happen.
70
+ */
71
+ export declare function useToast(): ToastApi;
72
+ /** What a {@link Banner} takes. */
73
+ export interface BannerProps extends HTMLAttributes<HTMLDivElement> {
74
+ /** How loud it is. */
75
+ tone?: Tone;
76
+ /** A dismiss affordance appears when this is given. */
77
+ onDismiss?: () => void;
78
+ }
79
+ /**
80
+ * A condition that is still true.
81
+ *
82
+ * Not a toast: a toast is about something that just happened and
83
+ * goes away, a banner is about a state — offline, read-only, licence
84
+ * expiring — and stays until the state does not.
85
+ */
86
+ export declare function Banner({ tone, onDismiss, children, className, ...rest }: BannerProps): import("react").JSX.Element;
87
+ //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA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the message every extension needs and none had.
4
+ *
5
+ * EXTENSIBILITY §5 names `notify` in the list of bridge APIs that do
6
+ * not exist. A specified-and-absent API is worse than a missing one,
7
+ * because a partner designs against it and finds out on demo day.
8
+ *
9
+ * This is the in-frame half: an extension's own toasts, in its own
10
+ * frame. It is not `bridge.notify` — that would put a message in
11
+ * igni's chrome, outside the frame, and needs a host envelope that
12
+ * does not exist yet. The distinction matters because they are not
13
+ * interchangeable: a toast about something inside this panel belongs
14
+ * inside this panel, and only something the user must see after
15
+ * navigating away belongs to the host.
16
+ *
17
+ * **Announced, not just drawn.** The stack is a polite live region,
18
+ * so a toast reaches somebody who is not looking at that corner. A
19
+ * `danger` toast is assertive instead: it is the one case where
20
+ * interrupting is correct.
21
+ *
22
+ * Toasts do not stack indefinitely and do not auto-dismiss when they
23
+ * carry an action — a message that disappears while you are reaching
24
+ * for its button is a message that was never actionable.
25
+ */
26
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
27
+ function cx(...parts) {
28
+ return parts.filter(Boolean).join(" ");
29
+ }
30
+ /** How long a toast stays, when it stays at all. */
31
+ const DEFAULT_MS = 5_000;
32
+ /** Beyond this, the oldest goes. A wall of toasts is not a message. */
33
+ const MAX_VISIBLE = 4;
34
+ const ToastContext = createContext(null);
35
+ let counter = 0;
36
+ /**
37
+ * Wrap the part of the app that raises toasts.
38
+ *
39
+ * Renders the stack itself, so there is nothing to place and no way
40
+ * to forget to place it.
41
+ */
42
+ export function ToastHost({ children }) {
43
+ const [toasts, setToasts] = useState([]);
44
+ const timers = useRef(new Map());
45
+ const dismiss = useCallback((id) => {
46
+ const timer = timers.current.get(id);
47
+ if (timer !== undefined) {
48
+ clearTimeout(timer);
49
+ timers.current.delete(id);
50
+ }
51
+ setToasts((current) => current.filter((t) => t.id !== id));
52
+ }, []);
53
+ const show = useCallback((message, options = {}) => {
54
+ const id = `toast-${++counter}`;
55
+ // A toast with something to do stays until it is dealt with.
56
+ // Auto-dismissing it means the button can vanish mid-reach.
57
+ const duration = options.duration !== undefined
58
+ ? options.duration
59
+ : options.action !== undefined
60
+ ? null
61
+ : DEFAULT_MS;
62
+ setToasts((current) => [...current, { ...options, id, message }].slice(-MAX_VISIBLE));
63
+ if (duration !== null) {
64
+ timers.current.set(id, setTimeout(() => dismiss(id), duration));
65
+ }
66
+ return id;
67
+ }, [dismiss]);
68
+ const clear = useCallback(() => {
69
+ for (const timer of timers.current.values())
70
+ clearTimeout(timer);
71
+ timers.current.clear();
72
+ setToasts([]);
73
+ }, []);
74
+ // Timers outlive the component otherwise, and fire `setToasts` on
75
+ // something unmounted.
76
+ useEffect(() => {
77
+ const pending = timers.current;
78
+ return () => {
79
+ for (const timer of pending.values())
80
+ clearTimeout(timer);
81
+ pending.clear();
82
+ };
83
+ }, []);
84
+ const api = useMemo(() => ({ show, dismiss, clear }), [show, dismiss, clear]);
85
+ return (_jsxs(ToastContext.Provider, { value: api, children: [children, _jsx(ToastList, { toasts: toasts, onDismiss: dismiss })] }));
86
+ }
87
+ function ToastList({ toasts, onDismiss, }) {
88
+ return (_jsx("div", { className: "ui-toasts", children: toasts.map((toast) => (_jsxs("div", { className: "ui-toast", "data-tone": toast.tone ?? "neutral",
89
+ // A failure interrupts; everything else waits for a pause.
90
+ role: toast.tone === "danger" ? "alert" : "status", "aria-live": toast.tone === "danger" ? "assertive" : "polite", children: [_jsxs("div", { className: "ui-toast-body", children: [toast.message, toast.action] }), _jsx("button", { type: "button", className: "ui-toast-dismiss", "aria-label": "Dismiss notification", onClick: () => onDismiss(toast.id), children: "\u00D7" })] }, toast.id))) }));
91
+ }
92
+ /**
93
+ * Raise a toast.
94
+ *
95
+ * Throws outside a {@link ToastHost} rather than returning a no-op.
96
+ * A silent no-op here means a save that reports success by showing
97
+ * nothing, which looks exactly like a save that did not happen.
98
+ */
99
+ export function useToast() {
100
+ const api = useContext(ToastContext);
101
+ if (api === null) {
102
+ throw new Error("useToast was called outside a <ToastHost>. Wrap your app in one — " +
103
+ "without it a toast would be silently dropped, which looks the " +
104
+ "same as the action never happening.");
105
+ }
106
+ return api;
107
+ }
108
+ /**
109
+ * A condition that is still true.
110
+ *
111
+ * Not a toast: a toast is about something that just happened and
112
+ * goes away, a banner is about a state — offline, read-only, licence
113
+ * expiring — and stays until the state does not.
114
+ */
115
+ export function Banner({ tone = "neutral", onDismiss, children, className, ...rest }) {
116
+ return (_jsxs("div", { ...rest, className: cx("ui-banner", className), "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [_jsx("div", { className: "ui-banner-body", children: children }), onDismiss === undefined ? null : (_jsx("button", { type: "button", className: "ui-toast-dismiss", "aria-label": "Dismiss message", onClick: onDismiss, children: "\u00D7" }))] }));
117
+ }
118
+ //# sourceMappingURL=Toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.js","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AAIf,SAAS,EAAE,CAAC,GAAG,KAA4C;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,GAAG,KAAK,CAAC;AAEzB,uEAAuE;AACvE,MAAM,WAAW,GAAG,CAAC,CAAC;AAiCtB,MAAM,YAAY,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAC;AAE1D,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,QAAQ,EAA2B;IAC7D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,EAAE,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,EAAyC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AAkB,gBACjB,iBAAiB,EAC5B,OAAO,EAAE,SAAS,uBAGX,CACV,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** What a {@link Tooltip} takes. */
2
+ export interface TooltipProps {
3
+ /** The word. Nothing is rendered when it is empty. */
4
+ text: string;
5
+ /** The control the word is about. */
6
+ children: React.ReactNode;
7
+ }
8
+ /**
9
+ * What an icon means, on hover and on focus.
10
+ *
11
+ * See the note at the top of this file. It replaces the browser's own
12
+ * `title` rather than sitting beside it.
13
+ */
14
+ export declare function Tooltip({ text, children }: TooltipProps): import("react").JSX.Element;
15
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAsCA,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,YAAY,+BAuIvD"}