@wickermoney/ui-kit 0.6.1 → 0.8.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.
- package/README.md +119 -4
- package/dist/Alert.d.ts +7 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +7 -1
- package/dist/Alert.js.map +1 -1
- package/dist/Button.d.ts +8 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +3 -2
- package/dist/Button.js.map +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +4 -2
- package/dist/Dialog.js.map +1 -1
- package/dist/Field.d.ts +8 -2
- package/dist/Field.d.ts.map +1 -1
- package/dist/Field.js +2 -2
- package/dist/Field.js.map +1 -1
- package/dist/IconButton.d.ts +4 -2
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/IconButton.js +4 -2
- package/dist/IconButton.js.map +1 -1
- package/dist/SelectField.d.ts +6 -1
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/SelectField.js +3 -2
- package/dist/SelectField.js.map +1 -1
- package/dist/Table.d.ts +14 -2
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +24 -2
- package/dist/Table.js.map +1 -1
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +275 -0
- package/dist/Toast.js.map +1 -0
- package/dist/busy.d.ts +25 -0
- package/dist/busy.d.ts.map +1 -0
- package/dist/busy.js +71 -0
- package/dist/busy.js.map +1 -0
- package/dist/components.css +45 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/dist/useToast.d.ts +71 -0
- package/dist/useToast.d.ts.map +1 -0
- package/dist/useToast.js +22 -0
- package/dist/useToast.js.map +1 -0
- package/package.json +3 -3
package/dist/Toast.js
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
3
|
+
import { registerAnnouncer } from './busy.js';
|
|
4
|
+
import { ToastApiContext, ToastViewContext, } from './useToast.js';
|
|
5
|
+
/** Three toasts on screen, two on a phone. Nothing is evicted: the rest wait. */
|
|
6
|
+
const LIMIT_DESKTOP = 3;
|
|
7
|
+
const LIMIT_PHONE = 2;
|
|
8
|
+
const PHONE_QUERY = '(max-width: 560px)';
|
|
9
|
+
/** The announcer is emptied this long after it is filled, so it is not read twice in browse mode. */
|
|
10
|
+
const ANNOUNCER_CLEAR_MS = 1500;
|
|
11
|
+
/** A toast raised while a modal is open waits at most this long for the modal to close. */
|
|
12
|
+
const MODAL_HOLD_MS = 2000;
|
|
13
|
+
const ADVISED_LENGTH = 200;
|
|
14
|
+
function subscribePhone(onChange) {
|
|
15
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
16
|
+
return () => undefined;
|
|
17
|
+
const query = window.matchMedia(PHONE_QUERY);
|
|
18
|
+
query.addEventListener('change', onChange);
|
|
19
|
+
return () => { query.removeEventListener('change', onChange); };
|
|
20
|
+
}
|
|
21
|
+
const phoneLimit = () => (typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(PHONE_QUERY).matches
|
|
22
|
+
? LIMIT_PHONE : LIMIT_DESKTOP);
|
|
23
|
+
function modalIsOpen() {
|
|
24
|
+
if (document.querySelector('[aria-modal="true"]') !== null)
|
|
25
|
+
return true;
|
|
26
|
+
try {
|
|
27
|
+
return document.querySelector('dialog:modal') !== null;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const announcedText = (t) => (t.kind === 'error' ? `Error: ${t.message}` : t.kind === 'warning' ? `Warning: ${t.message}` : t.message);
|
|
34
|
+
/** Adds delivered toasts to the list: the same id replaces in place, an error goes ahead of the waiting queue. */
|
|
35
|
+
function merge(list, batch, limit) {
|
|
36
|
+
const next = [...list];
|
|
37
|
+
for (const item of batch) {
|
|
38
|
+
const at = next.findIndex((t) => t.id === item.id);
|
|
39
|
+
if (at >= 0) {
|
|
40
|
+
next[at] = { ...item, rev: next[at].rev + 1 };
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (item.kind === 'error' && next.length >= limit) {
|
|
44
|
+
let i = limit;
|
|
45
|
+
while (next[i]?.kind === 'error')
|
|
46
|
+
i += 1;
|
|
47
|
+
next.splice(i, 0, item);
|
|
48
|
+
}
|
|
49
|
+
else
|
|
50
|
+
next.push(item);
|
|
51
|
+
}
|
|
52
|
+
return next;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Owns the toast queue and the screen-reader announcer. Mount it once, above
|
|
56
|
+
* the routes, and place a {@link ToastViewport} where the stack should draw.
|
|
57
|
+
*
|
|
58
|
+
* - The announcer is one always-mounted, visually hidden `role="status"`
|
|
59
|
+
* region, separate from the visible stack. Nothing here moves focus.
|
|
60
|
+
* - Nothing dismisses itself. A toast stays until it is closed (its button,
|
|
61
|
+
* or Escape) or the same `key` replaces it.
|
|
62
|
+
* - A burst of `show()` calls in one animation frame is announced once.
|
|
63
|
+
* - While a modal is open (`dialog:modal` or `aria-modal="true"`) delivery is
|
|
64
|
+
* held, up to two seconds. Close the dialog first, then call `show()`.
|
|
65
|
+
*
|
|
66
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
67
|
+
*/
|
|
68
|
+
export function ToastProvider({ children, routeKey }) {
|
|
69
|
+
const [list, setList] = useState([]);
|
|
70
|
+
const limit = useSyncExternalStore(subscribePhone, phoneLimit, () => LIMIT_DESKTOP);
|
|
71
|
+
const limitRef = useRef(limit);
|
|
72
|
+
limitRef.current = limit;
|
|
73
|
+
const pending = useRef([]);
|
|
74
|
+
const frame = useRef(null);
|
|
75
|
+
const heldSince = useRef(null);
|
|
76
|
+
const alive = useRef(false);
|
|
77
|
+
const counter = useRef(0);
|
|
78
|
+
const announcer = useRef(null);
|
|
79
|
+
const clearTimer = useRef(null);
|
|
80
|
+
const announced = useRef(new Set());
|
|
81
|
+
const originRef = useRef(null);
|
|
82
|
+
const groupRef = useRef(null);
|
|
83
|
+
const listRef = useRef(list);
|
|
84
|
+
listRef.current = list;
|
|
85
|
+
// A new route clears everything but errors. Adjusting state while rendering is
|
|
86
|
+
// the documented way to react to a changed prop without an extra commit.
|
|
87
|
+
const [lastRouteKey, setLastRouteKey] = useState(routeKey);
|
|
88
|
+
if (routeKey !== lastRouteKey) {
|
|
89
|
+
setLastRouteKey(routeKey);
|
|
90
|
+
if (list.some((t) => t.kind !== 'error'))
|
|
91
|
+
setList(list.filter((t) => t.kind === 'error'));
|
|
92
|
+
}
|
|
93
|
+
const announce = useCallback((text) => {
|
|
94
|
+
const el = announcer.current;
|
|
95
|
+
if (el === null)
|
|
96
|
+
return;
|
|
97
|
+
// A fresh node each time, so identical text twice is announced twice.
|
|
98
|
+
const span = document.createElement('span');
|
|
99
|
+
span.textContent = text;
|
|
100
|
+
el.replaceChildren(span);
|
|
101
|
+
if (clearTimer.current !== null)
|
|
102
|
+
clearTimeout(clearTimer.current);
|
|
103
|
+
clearTimer.current = setTimeout(() => { clearTimer.current = null; el.replaceChildren(); }, ANNOUNCER_CLEAR_MS);
|
|
104
|
+
}, []);
|
|
105
|
+
// Busy controls (`guardBusy`) speak through this region too, so there is one announcer in the host.
|
|
106
|
+
useEffect(() => registerAnnouncer(announce), [announce]);
|
|
107
|
+
const tick = useCallback(() => {
|
|
108
|
+
frame.current = null;
|
|
109
|
+
if (!alive.current || pending.current.length === 0) {
|
|
110
|
+
heldSince.current = null;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (modalIsOpen()) {
|
|
114
|
+
heldSince.current ??= Date.now();
|
|
115
|
+
if (Date.now() - heldSince.current < MODAL_HOLD_MS) {
|
|
116
|
+
frame.current = requestAnimationFrame(tick);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
heldSince.current = null;
|
|
121
|
+
const batch = pending.current;
|
|
122
|
+
pending.current = [];
|
|
123
|
+
setList((prev) => merge(prev, batch, limitRef.current));
|
|
124
|
+
}, []);
|
|
125
|
+
const schedule = useCallback(() => {
|
|
126
|
+
if (alive.current && frame.current === null)
|
|
127
|
+
frame.current = requestAnimationFrame(tick);
|
|
128
|
+
}, [tick]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
alive.current = true;
|
|
131
|
+
if (pending.current.length > 0)
|
|
132
|
+
schedule();
|
|
133
|
+
return () => {
|
|
134
|
+
alive.current = false;
|
|
135
|
+
if (frame.current !== null) {
|
|
136
|
+
cancelAnimationFrame(frame.current);
|
|
137
|
+
frame.current = null;
|
|
138
|
+
}
|
|
139
|
+
if (clearTimer.current !== null) {
|
|
140
|
+
clearTimeout(clearTimer.current);
|
|
141
|
+
clearTimer.current = null;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}, [schedule]);
|
|
145
|
+
// Announce what has just become visible: a new toast, a replaced one, or one
|
|
146
|
+
// promoted from the queue. One update covers everything that appeared together.
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
const fresh = [];
|
|
149
|
+
const keep = new Set();
|
|
150
|
+
list.forEach((t, i) => {
|
|
151
|
+
const token = `${t.id}:${t.rev}`;
|
|
152
|
+
if (i >= limit)
|
|
153
|
+
return;
|
|
154
|
+
keep.add(token);
|
|
155
|
+
if (!announced.current.has(token))
|
|
156
|
+
fresh.push(t);
|
|
157
|
+
});
|
|
158
|
+
announced.current = keep;
|
|
159
|
+
if (fresh.length > 0)
|
|
160
|
+
announce(fresh.map(announcedText).join('. '));
|
|
161
|
+
}, [list, limit, announce]);
|
|
162
|
+
const removeIds = useCallback((ids) => {
|
|
163
|
+
// If focus is on a toast that is going away, give it back before it does.
|
|
164
|
+
const active = document.activeElement;
|
|
165
|
+
const holder = active instanceof Element ? active.closest('[data-toast-id]') : null;
|
|
166
|
+
if (holder !== null && groupRef.current?.contains(holder) === true && ids.includes(holder.dataset['toastId'] ?? '')) {
|
|
167
|
+
const origin = originRef.current;
|
|
168
|
+
const target = origin !== null && origin.isConnected && !groupRef.current.contains(origin)
|
|
169
|
+
? origin : document.querySelector('main');
|
|
170
|
+
target?.focus({ preventScroll: true });
|
|
171
|
+
}
|
|
172
|
+
pending.current = pending.current.filter((t) => !ids.includes(t.id));
|
|
173
|
+
setList((prev) => (prev.some((t) => ids.includes(t.id)) ? prev.filter((t) => !ids.includes(t.id)) : prev));
|
|
174
|
+
}, []);
|
|
175
|
+
const api = useMemo(() => ({
|
|
176
|
+
show(message, options) {
|
|
177
|
+
const kind = options?.kind ?? 'info';
|
|
178
|
+
const key = options?.key;
|
|
179
|
+
counter.current += 1;
|
|
180
|
+
const id = key !== undefined ? `key:${key}` : `toast:${counter.current}`;
|
|
181
|
+
if (message.length > ADVISED_LENGTH) {
|
|
182
|
+
const env = globalThis.process?.env;
|
|
183
|
+
if (env?.['NODE_ENV'] !== 'production') {
|
|
184
|
+
console.warn(`useToast().show: a message of ${message.length} characters is long; keep toasts under ${ADVISED_LENGTH}.`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const item = { id, message, kind, rev: 0 };
|
|
188
|
+
const at = pending.current.findIndex((t) => t.id === id);
|
|
189
|
+
if (at >= 0)
|
|
190
|
+
pending.current[at] = item;
|
|
191
|
+
else
|
|
192
|
+
pending.current.push(item);
|
|
193
|
+
schedule();
|
|
194
|
+
return id;
|
|
195
|
+
},
|
|
196
|
+
dismiss(id) { removeIds([id]); },
|
|
197
|
+
}), [schedule, removeIds]);
|
|
198
|
+
const visible = useMemo(() => list.slice(0, limit).reverse(), [list, limit]);
|
|
199
|
+
const view = useMemo(() => ({ visible, dismissMany: removeIds, originRef, groupRef }), [visible, removeIds]);
|
|
200
|
+
return (_jsx(ToastApiContext.Provider, { value: api, children: _jsxs(ToastViewContext.Provider, { value: view, children: [children, _jsx("div", { ref: announcer, className: "wm-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true" })] }) }));
|
|
201
|
+
}
|
|
202
|
+
const GLYPH = { success: '✓', info: 'i', warning: '!', error: '✕' };
|
|
203
|
+
const WORD = { success: '', info: '', warning: 'Warning: ', error: 'Error: ' };
|
|
204
|
+
function ToastCard({ item, onDismiss }) {
|
|
205
|
+
const textId = useId();
|
|
206
|
+
const onKeyDown = (e) => {
|
|
207
|
+
if (e.key !== 'Escape')
|
|
208
|
+
return;
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
onDismiss(item.id);
|
|
211
|
+
};
|
|
212
|
+
return (_jsxs("div", { className: `wm-toast wm-toast--${item.kind}`, "data-toast-id": item.id, onKeyDown: onKeyDown, children: [_jsx("span", { className: "wm-toast__icon", "aria-hidden": "true", children: GLYPH[item.kind] }), _jsxs("p", { className: "wm-toast__text", id: textId, children: [WORD[item.kind] === '' ? null : _jsx("span", { className: "wm-visually-hidden", children: WORD[item.kind] }), item.message] }), _jsx("button", { type: "button", className: "wm-btn wm-toast__close", "aria-label": "Dismiss notification", "aria-describedby": textId, onClick: () => { onDismiss(item.id); }, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }));
|
|
213
|
+
}
|
|
214
|
+
/** The custom property {@link ToastViewport} publishes: the banner's height in px, absent while no toast shows. */
|
|
215
|
+
const TOAST_HEIGHT_PROPERTY = '--wm-toast-height';
|
|
216
|
+
/**
|
|
217
|
+
* Publishes the banner's height as `--wm-toast-height` on the element that holds
|
|
218
|
+
* it, for as long as the banner is in the page, and removes it with the banner.
|
|
219
|
+
*
|
|
220
|
+
* It is the one place that measures the banner. Anything below it in the page can
|
|
221
|
+
* use the value in CSS instead of observing the banner itself, for example
|
|
222
|
+
* `scroll-margin-top: calc(var(--wm-toast-offset-top, 0px) + var(--wm-toast-height, 0px))`
|
|
223
|
+
* so a control scrolled into view is not left behind it.
|
|
224
|
+
*/
|
|
225
|
+
function usePublishHeight(banner) {
|
|
226
|
+
useLayoutEffect(() => {
|
|
227
|
+
const element = banner.current;
|
|
228
|
+
const host = element?.parentElement;
|
|
229
|
+
if (element === null || element === undefined || host === null || host === undefined)
|
|
230
|
+
return undefined;
|
|
231
|
+
const publish = () => { host.style.setProperty(TOAST_HEIGHT_PROPERTY, `${Math.ceil(element.getBoundingClientRect().height)}px`); };
|
|
232
|
+
publish();
|
|
233
|
+
const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(publish);
|
|
234
|
+
observer?.observe(element);
|
|
235
|
+
return () => {
|
|
236
|
+
observer?.disconnect();
|
|
237
|
+
host.style.removeProperty(TOAST_HEIGHT_PROPERTY);
|
|
238
|
+
};
|
|
239
|
+
}, [banner]);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Draws the toasts as an in-flow banner that sticks to the top of the page
|
|
243
|
+
* while it scrolls. Place it as the first child of `<main>`.
|
|
244
|
+
*
|
|
245
|
+
* It sticks at `top: var(--wm-toast-offset-top, 0px)`; set that custom
|
|
246
|
+
* property (on `<main>` or any ancestor) to the bottom edge of anything fixed
|
|
247
|
+
* to the top of the viewport. While the banner shows, it sets
|
|
248
|
+
* `--wm-toast-height` (its height in px, rounded up) on its parent element, so
|
|
249
|
+
* styles for the content below it can keep a focused or scrolled-to control
|
|
250
|
+
* clear of the banner; the property is absent, and a `var(--wm-toast-height, 0px)`
|
|
251
|
+
* fallback applies, when no toast shows. It takes no props, is not a live region (the
|
|
252
|
+
* provider's announcer speaks), holds no tab stop when empty, and renders
|
|
253
|
+
* nothing outside a {@link ToastProvider}.
|
|
254
|
+
*
|
|
255
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
256
|
+
*/
|
|
257
|
+
export function ToastViewport() {
|
|
258
|
+
const view = useContext(ToastViewContext);
|
|
259
|
+
if (view === null || view.visible.length === 0)
|
|
260
|
+
return null;
|
|
261
|
+
return _jsx(ToastBanner, { view: view });
|
|
262
|
+
}
|
|
263
|
+
function ToastBanner({ view }) {
|
|
264
|
+
const { visible, dismissMany, originRef, groupRef } = view;
|
|
265
|
+
usePublishHeight(groupRef);
|
|
266
|
+
return (_jsxs("div", { ref: groupRef, className: "wm-toast-viewport", role: "group", "aria-label": "Notifications", onFocus: (e) => {
|
|
267
|
+
// Remember where focus came from, so closing a focused toast can return it.
|
|
268
|
+
const from = e.relatedTarget;
|
|
269
|
+
if (from instanceof HTMLElement && !e.currentTarget.contains(from))
|
|
270
|
+
originRef.current = from;
|
|
271
|
+
else if (!(from instanceof HTMLElement))
|
|
272
|
+
originRef.current = null;
|
|
273
|
+
}, children: [visible.map((t) => _jsx(ToastCard, { item: t, onDismiss: (id) => { dismissMany([id]); } }, t.id)), visible.length >= 2 ? (_jsx("div", { className: "wm-toast-viewport__all", children: _jsx("button", { type: "button", className: "wm-btn", onClick: () => { dismissMany(visible.map((t) => t.id)); }, children: "Dismiss all" }) })) : null] }));
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAE5G,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EACL,eAAe,EAAE,gBAAgB,GAElC,MAAM,eAAe,CAAA;AAYtB,iFAAiF;AACjF,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,qGAAqG;AACrG,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,2FAA2F;AAC3F,MAA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,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,CAAC,4BAExF,GACL,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC"}
|
package/dist/busy.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
|
+
type Announcer = (text: string) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Makes the toast provider's always-mounted live region the one busy messages go through.
|
|
5
|
+
*
|
|
6
|
+
* Internal to the package. Returns the function that withdraws it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerAnnouncer(announcer: Announcer): () => void;
|
|
9
|
+
/**
|
|
10
|
+
* The handler for a control that stays focusable while a request runs.
|
|
11
|
+
*
|
|
12
|
+
* A `disabled` control loses keyboard focus, and a screen reader's cursor with it, the moment it is set, which
|
|
13
|
+
* sends the person back to the top of the page after every save. A busy control is `aria-disabled="true"`
|
|
14
|
+
* instead, keeps focus, and ignores the activation: this returns the handler to put on it. While `busy` is
|
|
15
|
+
* `false` it returns `handler` unchanged. While `busy` is `true` it returns one that cancels the event (so a
|
|
16
|
+
* submit button submits nothing and a checkbox does not toggle), keeps it from reaching a parent, and announces
|
|
17
|
+
* "Still working. Try again in a moment." Pair it with `aria-disabled={busy || undefined}` on a plain element;
|
|
18
|
+
* `Button`, `IconButton`, `Field` and `SelectField` do both when given `busy`.
|
|
19
|
+
*
|
|
20
|
+
* @param busy - Whether the control should ignore activation.
|
|
21
|
+
* @param handler - What to run when it is not busy.
|
|
22
|
+
*/
|
|
23
|
+
export declare function guardBusy<E extends SyntheticEvent>(busy: boolean | undefined, handler?: (event: E) => void): ((event: E) => void) | undefined;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=busy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"busy.d.ts","sourceRoot":"","sources":["../src/busy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAO3C,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAMvC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,IAAI,CAGlE;AAoCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAChD,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAC3B,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAElC"}
|
package/dist/busy.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** What is announced when someone activates a control that is busy. */
|
|
2
|
+
const BUSY_MESSAGE = 'Still working. Try again in a moment.';
|
|
3
|
+
/** The fallback region is emptied this long after it is filled, so it is not read twice in browse mode. */
|
|
4
|
+
const CLEAR_MS = 1500;
|
|
5
|
+
let registered = null;
|
|
6
|
+
let fallback = null;
|
|
7
|
+
let fallbackTimer;
|
|
8
|
+
/**
|
|
9
|
+
* Makes the toast provider's always-mounted live region the one busy messages go through.
|
|
10
|
+
*
|
|
11
|
+
* Internal to the package. Returns the function that withdraws it.
|
|
12
|
+
*/
|
|
13
|
+
export function registerAnnouncer(announcer) {
|
|
14
|
+
registered = announcer;
|
|
15
|
+
return () => { if (registered === announcer)
|
|
16
|
+
registered = null; };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Speaks a short message politely.
|
|
20
|
+
*
|
|
21
|
+
* The toast provider's region when one is mounted in this document (the host). Without one, as in a plugin
|
|
22
|
+
* frame, a visually hidden `role="status"` element in `document.body`, created on first use.
|
|
23
|
+
*/
|
|
24
|
+
function announce(text) {
|
|
25
|
+
if (registered !== null) {
|
|
26
|
+
registered(text);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (typeof document === 'undefined')
|
|
30
|
+
return;
|
|
31
|
+
if (fallback === null || !fallback.isConnected) {
|
|
32
|
+
const el = document.createElement('div');
|
|
33
|
+
el.className = 'wm-visually-hidden';
|
|
34
|
+
el.setAttribute('role', 'status');
|
|
35
|
+
el.setAttribute('aria-live', 'polite');
|
|
36
|
+
el.setAttribute('aria-atomic', 'true');
|
|
37
|
+
document.body.append(el);
|
|
38
|
+
fallback = el;
|
|
39
|
+
}
|
|
40
|
+
const el = fallback;
|
|
41
|
+
// A fresh node each time, so the same text twice is announced twice.
|
|
42
|
+
const span = document.createElement('span');
|
|
43
|
+
span.textContent = text;
|
|
44
|
+
el.replaceChildren(span);
|
|
45
|
+
clearTimeout(fallbackTimer);
|
|
46
|
+
fallbackTimer = setTimeout(() => { el.replaceChildren(); }, CLEAR_MS);
|
|
47
|
+
}
|
|
48
|
+
function ignoreWhileBusy(event) {
|
|
49
|
+
// Same as a disabled control: no click reaches a parent, nothing submits, a checkbox does not flip.
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
announce(BUSY_MESSAGE);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The handler for a control that stays focusable while a request runs.
|
|
56
|
+
*
|
|
57
|
+
* A `disabled` control loses keyboard focus, and a screen reader's cursor with it, the moment it is set, which
|
|
58
|
+
* sends the person back to the top of the page after every save. A busy control is `aria-disabled="true"`
|
|
59
|
+
* instead, keeps focus, and ignores the activation: this returns the handler to put on it. While `busy` is
|
|
60
|
+
* `false` it returns `handler` unchanged. While `busy` is `true` it returns one that cancels the event (so a
|
|
61
|
+
* submit button submits nothing and a checkbox does not toggle), keeps it from reaching a parent, and announces
|
|
62
|
+
* "Still working. Try again in a moment." Pair it with `aria-disabled={busy || undefined}` on a plain element;
|
|
63
|
+
* `Button`, `IconButton`, `Field` and `SelectField` do both when given `busy`.
|
|
64
|
+
*
|
|
65
|
+
* @param busy - Whether the control should ignore activation.
|
|
66
|
+
* @param handler - What to run when it is not busy.
|
|
67
|
+
*/
|
|
68
|
+
export function guardBusy(busy, handler) {
|
|
69
|
+
return busy === true ? ignoreWhileBusy : handler;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=busy.js.map
|
package/dist/busy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"busy.js","sourceRoot":"","sources":["../src/busy.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,YAAY,GAAG,uCAAuC,CAAA;AAC5D,2GAA2G;AAC3G,MAAM,QAAQ,GAAG,IAAI,CAAA;AAIrB,IAAI,UAAU,GAAqB,IAAI,CAAA;AACvC,IAAI,QAAQ,GAAuB,IAAI,CAAA;AACvC,IAAI,aAAwD,CAAA;AAE5D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,UAAU,GAAG,SAAS,CAAA;IACtB,OAAO,GAAG,EAAE,GAAG,IAAI,UAAU,KAAK,SAAS;QAAE,UAAU,GAAG,IAAI,CAAA,CAAC,CAAC,CAAA;AAClE,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAAC,OAAM;IAAC,CAAC;IACrD,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAM;IAC3C,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC/C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACxC,EAAE,CAAC,SAAS,GAAG,oBAAoB,CAAA;QACnC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACjC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;QACtC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QACtC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACxB,QAAQ,GAAG,EAAE,CAAA;IACf,CAAC;IACD,MAAM,EAAE,GAAG,QAAQ,CAAA;IACnB,qEAAqE;IACrE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;IACvB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IACxB,YAAY,CAAC,aAAa,CAAC,CAAA;IAC3B,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,eAAe,EAAE,CAAA,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;AACtE,CAAC;AAED,SAAS,eAAe,CAAC,KAAqB;IAC5C,oGAAoG;IACpG,KAAK,CAAC,cAAc,EAAE,CAAA;IACtB,KAAK,CAAC,eAAe,EAAE,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CACvB,IAAyB,EACzB,OAA4B;IAE5B,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAA;AAClD,CAAC"}
|
package/dist/components.css
CHANGED
|
@@ -22,10 +22,18 @@
|
|
|
22
22
|
}
|
|
23
23
|
.wm-btn:hover:not(:disabled) { background: var(--wm-surface-alt); }
|
|
24
24
|
.wm-btn:disabled { opacity: .55; cursor: not-allowed; }
|
|
25
|
+
.wm-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
|
|
26
|
+
/* A busy button keeps focus (so it is not `:disabled`) and must not react to the pointer either. These two
|
|
27
|
+
come after the hover rules above and have the same specificity, so they win. */
|
|
28
|
+
.wm-btn[aria-disabled="true"]:hover { background: var(--wm-surface); }
|
|
25
29
|
.wm-btn--primary {
|
|
26
30
|
background: var(--wm-accent); border-color: var(--wm-accent); color: var(--wm-accent-text);
|
|
27
31
|
}
|
|
28
|
-
|
|
32
|
+
/* Must restate the background: `.wm-btn:hover:not(:disabled)` above has three classes' worth of
|
|
33
|
+
specificity to the variant's one, so without it a hovered primary button turns light grey under
|
|
34
|
+
its light text. Same specificity as that rule and later, so this one wins. */
|
|
35
|
+
.wm-btn--primary:hover:not(:disabled) { background: var(--wm-accent); filter: brightness(1.08); }
|
|
36
|
+
.wm-btn--primary[aria-disabled="true"]:hover { background: var(--wm-accent); filter: none; }
|
|
29
37
|
.wm-btn--danger { color: var(--wm-negative); }
|
|
30
38
|
/* Icon-only buttons: square and fixed, so a column of them lines up whatever the row holds. */
|
|
31
39
|
.wm-icon-btn, .wm-icon-slot { flex: none; width: 32px; height: 32px; padding: 0; }
|
|
@@ -45,6 +53,8 @@
|
|
|
45
53
|
.wm-field__error { font-size: 12px; color: var(--wm-negative); }
|
|
46
54
|
.wm-field__hint { font-size: 12px; color: var(--wm-text-muted); }
|
|
47
55
|
.wm-field__control[aria-invalid="true"] { border-color: var(--wm-negative); }
|
|
56
|
+
/* A field that is busy (a request is running) keeps focus; it looks disabled. */
|
|
57
|
+
.wm-field__control[aria-disabled="true"], .wm-field__control[readonly] { opacity: .55; cursor: progress; }
|
|
48
58
|
/* A form's own error, beside its submit action. Focusable so the form can move
|
|
49
59
|
focus (and the viewport) to it; the outline is the focus ring, not a border. */
|
|
50
60
|
.wm-form-error {
|
|
@@ -58,6 +68,7 @@
|
|
|
58
68
|
.wm-table th, .wm-table td {
|
|
59
69
|
text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--wm-border);
|
|
60
70
|
}
|
|
71
|
+
.wm-table__row--open > td { border-bottom-color: transparent; }
|
|
61
72
|
.wm-table th { font-size: 12px; color: var(--wm-text-muted); font-weight: 600; }
|
|
62
73
|
.wm-table td.wm-num, .wm-table th.wm-num { text-align: right; font-family: var(--wm-mono); }
|
|
63
74
|
/* Positioned so that the visually hidden "Actions" header label (position:
|
|
@@ -65,6 +76,7 @@
|
|
|
65
76
|
the rest of the table. Without it the label sat past the scroller's edge and
|
|
66
77
|
made the whole page scroll sideways whenever a table was wider than its room. */
|
|
67
78
|
.wm-table__scroll { overflow-x: auto; position: relative; }
|
|
79
|
+
.wm-table__scroll:focus-visible { outline: 2px solid var(--wm-accent); outline-offset: -2px; }
|
|
68
80
|
|
|
69
81
|
.wm-stat__label { font-size: 12px; color: var(--wm-text-muted); }
|
|
70
82
|
.wm-stat__value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
@@ -123,3 +135,35 @@ body:has(.wm-dialog[open]) { overflow: hidden; }
|
|
|
123
135
|
@media (max-width: 560px) {
|
|
124
136
|
.wm-dialog { width: 100vw; border-left: 0; }
|
|
125
137
|
}
|
|
138
|
+
|
|
139
|
+
/* Toast: an in-flow banner that sticks under whatever is fixed to the top.
|
|
140
|
+
The shell sets --wm-toast-offset-top to the bottom edge of the phone bar. */
|
|
141
|
+
.wm-toast-viewport {
|
|
142
|
+
position: sticky; top: var(--wm-toast-offset-top, 0px); z-index: 15;
|
|
143
|
+
display: flex; flex-direction: column; gap: var(--wm-gap-sm); margin-bottom: 12px;
|
|
144
|
+
}
|
|
145
|
+
.wm-toast {
|
|
146
|
+
--wm-toast-kind: var(--wm-accent);
|
|
147
|
+
display: flex; align-items: flex-start; gap: 10px;
|
|
148
|
+
padding: 10px 6px 10px 12px; font-size: 13px;
|
|
149
|
+
background: var(--wm-surface); color: var(--wm-text);
|
|
150
|
+
border: 1px solid var(--wm-border); border-left: 4px solid var(--wm-toast-kind);
|
|
151
|
+
border-radius: var(--wm-radius-sm); box-shadow: var(--wm-shadow-raised);
|
|
152
|
+
animation: wm-toast-in 150ms ease-out;
|
|
153
|
+
}
|
|
154
|
+
.wm-toast--success { --wm-toast-kind: var(--wm-positive); }
|
|
155
|
+
.wm-toast--warning { --wm-toast-kind: var(--wm-warning); }
|
|
156
|
+
.wm-toast--error { --wm-toast-kind: var(--wm-negative); }
|
|
157
|
+
.wm-toast__icon {
|
|
158
|
+
flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px;
|
|
159
|
+
font-size: 12px; font-weight: 700; line-height: 1; color: var(--wm-toast-kind);
|
|
160
|
+
border: 1.5px solid var(--wm-toast-kind); border-radius: 50%;
|
|
161
|
+
}
|
|
162
|
+
.wm-toast__text { flex: 1 1 auto; min-width: 0; margin: 0; padding-top: 2px; overflow-wrap: anywhere; }
|
|
163
|
+
.wm-toast__close { flex: none; min-width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--wm-accent); font-size: 18px; line-height: 1; }
|
|
164
|
+
.wm-toast__close:hover:not(:disabled) { background: var(--wm-surface-alt); }
|
|
165
|
+
.wm-toast-viewport__all { display: flex; justify-content: flex-end; }
|
|
166
|
+
.wm-toast-viewport__all .wm-btn { background: var(--wm-surface); color: var(--wm-accent); box-shadow: var(--wm-shadow-raised); }
|
|
167
|
+
@keyframes wm-toast-in { from { opacity: 0; } to { opacity: 1; } }
|
|
168
|
+
@media (prefers-reduced-motion: reduce) { .wm-toast { animation: none; } }
|
|
169
|
+
@media (max-width: 560px) { .wm-toast__close { min-width: 40px; height: 40px; } }
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { Dialog } from './Dialog.js';
|
|
|
6
6
|
export type { DialogProps } from './Dialog.js';
|
|
7
7
|
export { Button } from './Button.js';
|
|
8
8
|
export type { ButtonProps } from './Button.js';
|
|
9
|
+
export { guardBusy } from './busy.js';
|
|
9
10
|
export { IconButton } from './IconButton.js';
|
|
10
11
|
export type { IconButtonProps, IconName } from './IconButton.js';
|
|
11
12
|
export { Field } from './Field.js';
|
|
@@ -39,4 +40,8 @@ export { Spinner } from './Spinner.js';
|
|
|
39
40
|
export type { SpinnerProps } from './Spinner.js';
|
|
40
41
|
export { useFocusTrap } from './useFocusTrap.js';
|
|
41
42
|
export type { FocusTrapOptions } from './useFocusTrap.js';
|
|
43
|
+
export { ToastProvider, ToastViewport } from './Toast.js';
|
|
44
|
+
export type { ToastProviderProps } from './Toast.js';
|
|
45
|
+
export { useToast } from './useToast.js';
|
|
46
|
+
export type { ToastApi, ToastKind, ToastOptions } from './useToast.js';
|
|
42
47
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AACrB,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,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';
|
|
|
3
3
|
export { Surface } from './Surface.js';
|
|
4
4
|
export { Dialog } from './Dialog.js';
|
|
5
5
|
export { Button } from './Button.js';
|
|
6
|
+
export { guardBusy } from './busy.js';
|
|
6
7
|
export { IconButton } from './IconButton.js';
|
|
7
8
|
export { Field } from './Field.js';
|
|
8
9
|
export { FormError } from './FormError.js';
|
|
@@ -19,4 +20,6 @@ export { Alert } from './Alert.js';
|
|
|
19
20
|
export { EmptyState } from './EmptyState.js';
|
|
20
21
|
export { Spinner } from './Spinner.js';
|
|
21
22
|
export { useFocusTrap } from './useFocusTrap.js';
|
|
23
|
+
export { ToastProvider, ToastViewport } from './Toast.js';
|
|
24
|
+
export { useToast } from './useToast.js';
|
|
22
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AACrB,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,KAAK,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E,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/tokens.css
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--wm-gap: 16px;
|
|
56
56
|
--wm-gap-sm: 8px;
|
|
57
57
|
--wm-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 4%);
|
|
58
|
+
--wm-shadow-raised: 0 4px 12px rgb(16 24 40 / 14%), 0 1px 3px rgb(16 24 40 / 10%);
|
|
58
59
|
--wm-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
59
60
|
--wm-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
|
|
60
61
|
}
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
--wm-chart-other: #4e4d49;
|
|
88
89
|
--wm-chart-grid: #2b323c;
|
|
89
90
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
91
|
+
--wm-shadow-raised: 0 4px 14px rgb(0 0 0 / 55%), 0 0 0 1px rgb(255 255 255 / 5%);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
@@ -112,6 +114,7 @@
|
|
|
112
114
|
--wm-chart-other: #4e4d49;
|
|
113
115
|
--wm-chart-grid: #2b323c;
|
|
114
116
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
117
|
+
--wm-shadow-raised: 0 4px 14px rgb(0 0 0 / 55%), 0 0 0 1px rgb(255 255 255 / 5%);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
body {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a toast looks and is announced.
|
|
3
|
+
*
|
|
4
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
5
|
+
*/
|
|
6
|
+
export type ToastKind = 'success' | 'info' | 'warning' | 'error';
|
|
7
|
+
/**
|
|
8
|
+
* Options for {@link ToastApi.show}.
|
|
9
|
+
*
|
|
10
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
11
|
+
*/
|
|
12
|
+
export interface ToastOptions {
|
|
13
|
+
/** Defaults to `'info'`. `warning` and `error` are announced with a "Warning: " or "Error: " prefix. */
|
|
14
|
+
readonly kind?: ToastKind;
|
|
15
|
+
/**
|
|
16
|
+
* A toast with the same key replaces the earlier one in place (visible or
|
|
17
|
+
* waiting) and is announced again. Use it for repeated actions of one kind,
|
|
18
|
+
* so they do not stack.
|
|
19
|
+
*/
|
|
20
|
+
readonly key?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What {@link useToast} returns. Both members keep the same identity for the
|
|
24
|
+
* life of the provider.
|
|
25
|
+
*
|
|
26
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
27
|
+
*/
|
|
28
|
+
export interface ToastApi {
|
|
29
|
+
/**
|
|
30
|
+
* Shows a plain-text message and returns its id. The message is delivered on
|
|
31
|
+
* the next animation frame (or after an open modal closes, see
|
|
32
|
+
* {@link ToastProvider}). Nothing dismisses a toast but the person or the same `key`.
|
|
33
|
+
*/
|
|
34
|
+
readonly show: (message: string, options?: ToastOptions) => string;
|
|
35
|
+
/** Removes a visible, waiting or not yet delivered toast. An unknown id is ignored. */
|
|
36
|
+
readonly dismiss: (id: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/** One toast as the provider holds it. Internal. */
|
|
39
|
+
export interface ToastItem {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
readonly kind: ToastKind;
|
|
43
|
+
/** Incremented when the same key replaces it, so the replacement is announced again. */
|
|
44
|
+
readonly rev: number;
|
|
45
|
+
}
|
|
46
|
+
/** What the viewport reads. Internal: not exported from the package. */
|
|
47
|
+
export interface ToastView {
|
|
48
|
+
/** The toasts on screen, newest first. */
|
|
49
|
+
readonly visible: readonly ToastItem[];
|
|
50
|
+
readonly dismissMany: (ids: readonly string[]) => void;
|
|
51
|
+
/** Where focus was before it entered the stack, so closing a focused toast can give it back. */
|
|
52
|
+
readonly originRef: {
|
|
53
|
+
current: HTMLElement | null;
|
|
54
|
+
};
|
|
55
|
+
readonly groupRef: {
|
|
56
|
+
current: HTMLDivElement | null;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export declare const ToastApiContext: import("react").Context<ToastApi | null>;
|
|
60
|
+
export declare const ToastViewContext: import("react").Context<ToastView | null>;
|
|
61
|
+
/**
|
|
62
|
+
* The toast API, for use in event handlers and effects.
|
|
63
|
+
*
|
|
64
|
+
* Throws outside a {@link ToastProvider}. Plugins cannot use it: a plugin's
|
|
65
|
+
* copy of this package has no provider, and a way for plugins to notify
|
|
66
|
+
* (`ctx.notify`) is planned for a later release.
|
|
67
|
+
*
|
|
68
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useToast(): ToastApi;
|
|
71
|
+
//# sourceMappingURL=useToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../src/useToast.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,wGAAwG;IACxG,QAAQ,CAAC,IAAI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