@tensor_1/react 2.55.0 → 2.55.2
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 +2 -0
- package/dist/components/Toast.js +53 -2
- package/dist/hooks/dialog-layer.d.ts +5 -0
- package/dist/hooks/dialog-layer.js +34 -0
- package/dist/hooks/useDialog.js +4 -0
- package/dist/index.cjs +99 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -507,6 +507,8 @@ toast.dismiss(id); // or toast.dismiss() for all
|
|
|
507
507
|
- **Accessibility:** errors are `role="alert"`. Everything else is announced through the toaster's polite live region, and a loading toast that settles is announced again. Esc closes the focused toast. Tone glyphs are decorative; the text carries the meaning.
|
|
508
508
|
- **Stores:** `toast` writes to a default store that `<Toaster />` reads. `createToastApi(createToastStore())` gives a separate queue (tests, embedded apps); pass its `store` to `<Toaster store>`. The store has no React dependency.
|
|
509
509
|
- `<Toaster>` still renders hand-managed `<Toast>` children first. `Toast` gains `tone="warning"` and an `action` slot.
|
|
510
|
+
- At narrow toaster widths, the action takes a row below the message so translated failure sentences retain a readable width. The dismiss control stays beside the message; DOM and keyboard order remain unchanged.
|
|
511
|
+
- **Modal feedback (HAR-2754):** keep one `Toaster` in the shell. It moves its stable host into the most recently opened UIx modal (`Modal`, `Drawer`, `Peek`, `ConfirmDialog`) and promotes the region to a manual popover. Both are necessary: a page z-index cannot cover a modal, and a top-layer popover outside the modal remains inert. Closing a nested dialog returns the same queue to its parent; closing the last dialog returns it to its original shell location. No caller z-index or extra toaster is needed. The live [German modal-feedback specimen](../../tests/toast-top-layer/harness.html) exercises error, pending, success, retry and dismissal in a drawer and a nested modal; bundle it with `node tests/toast-top-layer/build.mjs` when serving the repository. Browser regression: `tests/a11y/toast-top-layer.spec.mjs` hit-tests toast pixels and operates its controls at desktop and 320 px in both themes.
|
|
510
512
|
### Icons (`@tensor_1/react/icons`)
|
|
511
513
|
|
|
512
514
|
The UIx icon set (HAR-996): 233 glyphs drawn in `currentColor` at the `--uix-icon-*` sizes. Icons come only from UIx
|
package/dist/components/Toast.js
CHANGED
|
@@ -7,6 +7,8 @@ import { prefersReducedMotion } from "../hooks/useReducedMotion.js";
|
|
|
7
7
|
import { tokenMs } from "../motion.js";
|
|
8
8
|
import { XIcon } from "../icons/components.js";
|
|
9
9
|
import { toast as defaultToast } from "../toast-store.js";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
import { subscribeModalLayer, topModalDialog } from "../hooks/dialog-layer.js";
|
|
10
12
|
const ToasterContext = createContext(null);
|
|
11
13
|
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
12
14
|
const SWIPE_VELOCITY = 0.11;
|
|
@@ -227,6 +229,7 @@ function useToastTimers(store, visible, paused) {
|
|
|
227
229
|
function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.store, limit = 3, position = "bottom-end", className, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyDown, ...props }) {
|
|
228
230
|
const uixLabels = useUixLabels();
|
|
229
231
|
const regionLabel = regionLabelProp ?? uixLabels.toaster?.region ?? "Notifications";
|
|
232
|
+
const [portalHost, setPortalHost] = useState(null);
|
|
230
233
|
const [announced, setAnnounced] = useState("");
|
|
231
234
|
const clearTimer = useRef(null);
|
|
232
235
|
const announce = useCallback((text) => {
|
|
@@ -237,7 +240,8 @@ function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.
|
|
|
237
240
|
useEffect(() => () => {
|
|
238
241
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
239
242
|
}, []);
|
|
240
|
-
const ctx = useMemo(() => ({ announce
|
|
243
|
+
const ctx = useMemo(() => ({ announce: portalHost ? announce : () => {
|
|
244
|
+
} }), [announce, portalHost]);
|
|
241
245
|
const records = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
242
246
|
const visible = useMemo(() => records.slice(-Math.max(1, limit)), [records, limit]);
|
|
243
247
|
const [hovered, setHovered] = useState(false);
|
|
@@ -251,6 +255,48 @@ function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.
|
|
|
251
255
|
}, []);
|
|
252
256
|
useToastTimers(store, visible, hovered || focused || hidden);
|
|
253
257
|
const regionRef = useRef(null);
|
|
258
|
+
const homeRef = useRef(null);
|
|
259
|
+
const returnFocusRef = useRef(null);
|
|
260
|
+
useIsomorphicLayoutEffect(() => {
|
|
261
|
+
const host = document.createElement("div");
|
|
262
|
+
host.dataset.uixToastHost = "";
|
|
263
|
+
host.style.display = "contents";
|
|
264
|
+
homeRef.current?.after(host);
|
|
265
|
+
setPortalHost(host);
|
|
266
|
+
return () => {
|
|
267
|
+
host.remove();
|
|
268
|
+
};
|
|
269
|
+
}, []);
|
|
270
|
+
useIsomorphicLayoutEffect(() => {
|
|
271
|
+
if (!portalHost) return;
|
|
272
|
+
const sync = () => {
|
|
273
|
+
const region = regionRef.current;
|
|
274
|
+
if (!region) return;
|
|
275
|
+
const active = document.activeElement;
|
|
276
|
+
const focusedElement = region.contains(active) ? active : null;
|
|
277
|
+
const dialog = topModalDialog();
|
|
278
|
+
if (typeof region.hidePopover === "function" && region.matches(":popover-open")) region.hidePopover();
|
|
279
|
+
if (dialog) {
|
|
280
|
+
dialog.append(portalHost);
|
|
281
|
+
} else {
|
|
282
|
+
homeRef.current?.after(portalHost);
|
|
283
|
+
}
|
|
284
|
+
if (dialog && typeof region.showPopover === "function") {
|
|
285
|
+
region.setAttribute("popover", "manual");
|
|
286
|
+
region.showPopover();
|
|
287
|
+
} else {
|
|
288
|
+
region.removeAttribute("popover");
|
|
289
|
+
}
|
|
290
|
+
focusedElement?.focus({ preventScroll: true });
|
|
291
|
+
};
|
|
292
|
+
sync();
|
|
293
|
+
return subscribeModalLayer(sync);
|
|
294
|
+
}, [portalHost]);
|
|
295
|
+
useIsomorphicLayoutEffect(() => {
|
|
296
|
+
if (focused && visible.every((record) => record.leaving) && returnFocusRef.current?.isConnected) {
|
|
297
|
+
returnFocusRef.current.focus({ preventScroll: true });
|
|
298
|
+
}
|
|
299
|
+
}, [visible, focused]);
|
|
254
300
|
const tops = useRef(/* @__PURE__ */ new Map());
|
|
255
301
|
useIsomorphicLayoutEffect(() => {
|
|
256
302
|
const region = regionRef.current;
|
|
@@ -281,7 +327,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.
|
|
|
281
327
|
event.stopPropagation();
|
|
282
328
|
store.dismiss(id, "close");
|
|
283
329
|
};
|
|
284
|
-
|
|
330
|
+
const content = /* @__PURE__ */ jsx(ToasterContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
285
331
|
"div",
|
|
286
332
|
{
|
|
287
333
|
ref: regionRef,
|
|
@@ -298,6 +344,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.
|
|
|
298
344
|
onMouseLeave?.(e);
|
|
299
345
|
},
|
|
300
346
|
onFocus: (e) => {
|
|
347
|
+
if (e.relatedTarget instanceof window.HTMLElement && !e.currentTarget.contains(e.relatedTarget)) returnFocusRef.current = e.relatedTarget;
|
|
301
348
|
setFocused(true);
|
|
302
349
|
onFocus?.(e);
|
|
303
350
|
},
|
|
@@ -314,6 +361,10 @@ function Toaster({ children, regionLabel: regionLabelProp, store = defaultToast.
|
|
|
314
361
|
]
|
|
315
362
|
}
|
|
316
363
|
) });
|
|
364
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
365
|
+
/* @__PURE__ */ jsx("span", { hidden: true, ref: homeRef }),
|
|
366
|
+
portalHost ? createPortal(content, portalHost) : content
|
|
367
|
+
] });
|
|
317
368
|
}
|
|
318
369
|
export {
|
|
319
370
|
Toast,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function topModalDialog(): HTMLDialogElement | undefined;
|
|
2
|
+
declare function subscribeModalLayer(listener: () => void): () => void;
|
|
3
|
+
declare function registerModalLayer(dialog: HTMLDialogElement): () => void;
|
|
4
|
+
|
|
5
|
+
export { registerModalLayer, subscribeModalLayer, topModalDialog };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const dialogs = [];
|
|
2
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
3
|
+
const notify = () => {
|
|
4
|
+
for (const listener of listeners) listener();
|
|
5
|
+
};
|
|
6
|
+
function topModalDialog() {
|
|
7
|
+
for (let index = dialogs.length - 1; index >= 0; index -= 1) {
|
|
8
|
+
const dialog = dialogs[index];
|
|
9
|
+
if (dialog?.open && dialog.isConnected) return dialog;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function subscribeModalLayer(listener) {
|
|
13
|
+
listeners.add(listener);
|
|
14
|
+
return () => {
|
|
15
|
+
listeners.delete(listener);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function registerModalLayer(dialog) {
|
|
19
|
+
const previous = dialogs.indexOf(dialog);
|
|
20
|
+
if (previous !== -1) dialogs.splice(previous, 1);
|
|
21
|
+
dialogs.push(dialog);
|
|
22
|
+
notify();
|
|
23
|
+
return () => {
|
|
24
|
+
const index = dialogs.indexOf(dialog);
|
|
25
|
+
if (index === -1) return;
|
|
26
|
+
dialogs.splice(index, 1);
|
|
27
|
+
notify();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
registerModalLayer,
|
|
32
|
+
subscribeModalLayer,
|
|
33
|
+
topModalDialog
|
|
34
|
+
};
|
package/dist/hooks/useDialog.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useRef, useEffect, useLayoutEffect } from "react";
|
|
3
3
|
import { markKeyOpened, watchInputModality } from "../motion.js";
|
|
4
|
+
import { registerModalLayer } from "./dialog-layer.js";
|
|
4
5
|
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
5
6
|
let lockCount = 0;
|
|
6
7
|
let saved = null;
|
|
@@ -54,6 +55,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
54
55
|
markKeyOpened(el);
|
|
55
56
|
el.showModal();
|
|
56
57
|
}
|
|
58
|
+
const leaveLayer = registerModalLayer(el);
|
|
57
59
|
lockBodyScroll();
|
|
58
60
|
let locked = true;
|
|
59
61
|
const handleClose = () => {
|
|
@@ -65,6 +67,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
65
67
|
} catch {
|
|
66
68
|
}
|
|
67
69
|
}
|
|
70
|
+
leaveLayer();
|
|
68
71
|
if (locked) {
|
|
69
72
|
locked = false;
|
|
70
73
|
unlockBodyScroll();
|
|
@@ -77,6 +80,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
77
80
|
return () => {
|
|
78
81
|
el.removeEventListener("close", handleClose);
|
|
79
82
|
el.removeEventListener("cancel", handleCancel);
|
|
83
|
+
leaveLayer();
|
|
80
84
|
if (locked) {
|
|
81
85
|
locked = false;
|
|
82
86
|
unlockBodyScroll();
|
package/dist/index.cjs
CHANGED
|
@@ -519,6 +519,37 @@ function tokenMs(name, fallback, el) {
|
|
|
519
519
|
return m[2] === "s" ? Number(m[1]) * 1e3 : Number(m[1]);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
// src/hooks/dialog-layer.ts
|
|
523
|
+
var dialogs = [];
|
|
524
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
525
|
+
var notify = () => {
|
|
526
|
+
for (const listener of listeners) listener();
|
|
527
|
+
};
|
|
528
|
+
function topModalDialog() {
|
|
529
|
+
for (let index = dialogs.length - 1; index >= 0; index -= 1) {
|
|
530
|
+
const dialog = dialogs[index];
|
|
531
|
+
if (dialog?.open && dialog.isConnected) return dialog;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function subscribeModalLayer(listener) {
|
|
535
|
+
listeners.add(listener);
|
|
536
|
+
return () => {
|
|
537
|
+
listeners.delete(listener);
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function registerModalLayer(dialog) {
|
|
541
|
+
const previous = dialogs.indexOf(dialog);
|
|
542
|
+
if (previous !== -1) dialogs.splice(previous, 1);
|
|
543
|
+
dialogs.push(dialog);
|
|
544
|
+
notify();
|
|
545
|
+
return () => {
|
|
546
|
+
const index = dialogs.indexOf(dialog);
|
|
547
|
+
if (index === -1) return;
|
|
548
|
+
dialogs.splice(index, 1);
|
|
549
|
+
notify();
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
|
|
522
553
|
// src/hooks/useDialog.ts
|
|
523
554
|
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
|
|
524
555
|
var lockCount = 0;
|
|
@@ -573,6 +604,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
573
604
|
markKeyOpened(el);
|
|
574
605
|
el.showModal();
|
|
575
606
|
}
|
|
607
|
+
const leaveLayer = registerModalLayer(el);
|
|
576
608
|
lockBodyScroll();
|
|
577
609
|
let locked = true;
|
|
578
610
|
const handleClose = () => {
|
|
@@ -584,6 +616,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
584
616
|
} catch {
|
|
585
617
|
}
|
|
586
618
|
}
|
|
619
|
+
leaveLayer();
|
|
587
620
|
if (locked) {
|
|
588
621
|
locked = false;
|
|
589
622
|
unlockBodyScroll();
|
|
@@ -596,6 +629,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
596
629
|
return () => {
|
|
597
630
|
el.removeEventListener("close", handleClose);
|
|
598
631
|
el.removeEventListener("cancel", handleCancel);
|
|
632
|
+
leaveLayer();
|
|
599
633
|
if (locked) {
|
|
600
634
|
locked = false;
|
|
601
635
|
unlockBodyScroll();
|
|
@@ -2127,15 +2161,15 @@ var DEFAULT_KEYBOARD_GRAB_LABELS = {
|
|
|
2127
2161
|
};
|
|
2128
2162
|
var grabbedId = null;
|
|
2129
2163
|
var refocusId = null;
|
|
2130
|
-
var
|
|
2164
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
2131
2165
|
var setGrabbedId = (id) => {
|
|
2132
2166
|
grabbedId = id;
|
|
2133
|
-
|
|
2167
|
+
listeners2.forEach((l) => l());
|
|
2134
2168
|
};
|
|
2135
2169
|
var subscribe2 = (l) => {
|
|
2136
|
-
|
|
2170
|
+
listeners2.add(l);
|
|
2137
2171
|
return () => {
|
|
2138
|
-
|
|
2172
|
+
listeners2.delete(l);
|
|
2139
2173
|
};
|
|
2140
2174
|
};
|
|
2141
2175
|
var DIRECTIONS = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right" };
|
|
@@ -5480,7 +5514,7 @@ function writeProxy(select, values, multiple) {
|
|
|
5480
5514
|
}
|
|
5481
5515
|
}
|
|
5482
5516
|
var watched = /* @__PURE__ */ new WeakSet();
|
|
5483
|
-
function watchWrites(el, keys, proto,
|
|
5517
|
+
function watchWrites(el, keys, proto, notify2) {
|
|
5484
5518
|
if (watched.has(el) || !proto) return;
|
|
5485
5519
|
watched.add(el);
|
|
5486
5520
|
for (const key of keys) {
|
|
@@ -5495,7 +5529,7 @@ function watchWrites(el, keys, proto, notify) {
|
|
|
5495
5529
|
},
|
|
5496
5530
|
set(v) {
|
|
5497
5531
|
set.call(this, v);
|
|
5498
|
-
|
|
5532
|
+
notify2();
|
|
5499
5533
|
}
|
|
5500
5534
|
});
|
|
5501
5535
|
}
|
|
@@ -10459,9 +10493,9 @@ var TOAST_LEAVE_MS = 110;
|
|
|
10459
10493
|
var counter = 0;
|
|
10460
10494
|
function createToastStore() {
|
|
10461
10495
|
let records = [];
|
|
10462
|
-
const
|
|
10496
|
+
const listeners3 = /* @__PURE__ */ new Set();
|
|
10463
10497
|
const emit = () => {
|
|
10464
|
-
for (const listener of
|
|
10498
|
+
for (const listener of listeners3) listener();
|
|
10465
10499
|
};
|
|
10466
10500
|
const set = (next) => {
|
|
10467
10501
|
records = next;
|
|
@@ -10509,9 +10543,9 @@ function createToastStore() {
|
|
|
10509
10543
|
update,
|
|
10510
10544
|
dismiss,
|
|
10511
10545
|
subscribe: (listener) => {
|
|
10512
|
-
|
|
10546
|
+
listeners3.add(listener);
|
|
10513
10547
|
return () => {
|
|
10514
|
-
|
|
10548
|
+
listeners3.delete(listener);
|
|
10515
10549
|
};
|
|
10516
10550
|
},
|
|
10517
10551
|
getSnapshot: () => records
|
|
@@ -10569,6 +10603,7 @@ function createToastApi(store) {
|
|
|
10569
10603
|
var toast = createToastApi(createToastStore());
|
|
10570
10604
|
|
|
10571
10605
|
// src/components/Toast.tsx
|
|
10606
|
+
var import_react_dom3 = require("react-dom");
|
|
10572
10607
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10573
10608
|
var ToasterContext = (0, import_react67.createContext)(null);
|
|
10574
10609
|
var useIsomorphicLayoutEffect18 = typeof document !== "undefined" ? import_react67.useLayoutEffect : import_react67.useEffect;
|
|
@@ -10790,6 +10825,7 @@ function useToastTimers(store, visible, paused) {
|
|
|
10790
10825
|
function Toaster({ children, regionLabel: regionLabelProp, store = toast.store, limit = 3, position = "bottom-end", className, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyDown, ...props }) {
|
|
10791
10826
|
const uixLabels = useUixLabels();
|
|
10792
10827
|
const regionLabel = regionLabelProp ?? uixLabels.toaster?.region ?? "Notifications";
|
|
10828
|
+
const [portalHost, setPortalHost] = (0, import_react67.useState)(null);
|
|
10793
10829
|
const [announced, setAnnounced] = (0, import_react67.useState)("");
|
|
10794
10830
|
const clearTimer = (0, import_react67.useRef)(null);
|
|
10795
10831
|
const announce = (0, import_react67.useCallback)((text) => {
|
|
@@ -10800,7 +10836,8 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10800
10836
|
(0, import_react67.useEffect)(() => () => {
|
|
10801
10837
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
10802
10838
|
}, []);
|
|
10803
|
-
const ctx = (0, import_react67.useMemo)(() => ({ announce
|
|
10839
|
+
const ctx = (0, import_react67.useMemo)(() => ({ announce: portalHost ? announce : () => {
|
|
10840
|
+
} }), [announce, portalHost]);
|
|
10804
10841
|
const records = (0, import_react67.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
10805
10842
|
const visible = (0, import_react67.useMemo)(() => records.slice(-Math.max(1, limit)), [records, limit]);
|
|
10806
10843
|
const [hovered, setHovered] = (0, import_react67.useState)(false);
|
|
@@ -10814,6 +10851,48 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10814
10851
|
}, []);
|
|
10815
10852
|
useToastTimers(store, visible, hovered || focused || hidden);
|
|
10816
10853
|
const regionRef = (0, import_react67.useRef)(null);
|
|
10854
|
+
const homeRef = (0, import_react67.useRef)(null);
|
|
10855
|
+
const returnFocusRef = (0, import_react67.useRef)(null);
|
|
10856
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10857
|
+
const host = document.createElement("div");
|
|
10858
|
+
host.dataset.uixToastHost = "";
|
|
10859
|
+
host.style.display = "contents";
|
|
10860
|
+
homeRef.current?.after(host);
|
|
10861
|
+
setPortalHost(host);
|
|
10862
|
+
return () => {
|
|
10863
|
+
host.remove();
|
|
10864
|
+
};
|
|
10865
|
+
}, []);
|
|
10866
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10867
|
+
if (!portalHost) return;
|
|
10868
|
+
const sync = () => {
|
|
10869
|
+
const region = regionRef.current;
|
|
10870
|
+
if (!region) return;
|
|
10871
|
+
const active = document.activeElement;
|
|
10872
|
+
const focusedElement = region.contains(active) ? active : null;
|
|
10873
|
+
const dialog = topModalDialog();
|
|
10874
|
+
if (typeof region.hidePopover === "function" && region.matches(":popover-open")) region.hidePopover();
|
|
10875
|
+
if (dialog) {
|
|
10876
|
+
dialog.append(portalHost);
|
|
10877
|
+
} else {
|
|
10878
|
+
homeRef.current?.after(portalHost);
|
|
10879
|
+
}
|
|
10880
|
+
if (dialog && typeof region.showPopover === "function") {
|
|
10881
|
+
region.setAttribute("popover", "manual");
|
|
10882
|
+
region.showPopover();
|
|
10883
|
+
} else {
|
|
10884
|
+
region.removeAttribute("popover");
|
|
10885
|
+
}
|
|
10886
|
+
focusedElement?.focus({ preventScroll: true });
|
|
10887
|
+
};
|
|
10888
|
+
sync();
|
|
10889
|
+
return subscribeModalLayer(sync);
|
|
10890
|
+
}, [portalHost]);
|
|
10891
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10892
|
+
if (focused && visible.every((record) => record.leaving) && returnFocusRef.current?.isConnected) {
|
|
10893
|
+
returnFocusRef.current.focus({ preventScroll: true });
|
|
10894
|
+
}
|
|
10895
|
+
}, [visible, focused]);
|
|
10817
10896
|
const tops = (0, import_react67.useRef)(/* @__PURE__ */ new Map());
|
|
10818
10897
|
useIsomorphicLayoutEffect18(() => {
|
|
10819
10898
|
const region = regionRef.current;
|
|
@@ -10844,7 +10923,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10844
10923
|
event.stopPropagation();
|
|
10845
10924
|
store.dismiss(id, "close");
|
|
10846
10925
|
};
|
|
10847
|
-
|
|
10926
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ToasterContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10848
10927
|
"div",
|
|
10849
10928
|
{
|
|
10850
10929
|
ref: regionRef,
|
|
@@ -10861,6 +10940,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10861
10940
|
onMouseLeave?.(e);
|
|
10862
10941
|
},
|
|
10863
10942
|
onFocus: (e) => {
|
|
10943
|
+
if (e.relatedTarget instanceof window.HTMLElement && !e.currentTarget.contains(e.relatedTarget)) returnFocusRef.current = e.relatedTarget;
|
|
10864
10944
|
setFocused(true);
|
|
10865
10945
|
onFocus?.(e);
|
|
10866
10946
|
},
|
|
@@ -10877,6 +10957,10 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10877
10957
|
]
|
|
10878
10958
|
}
|
|
10879
10959
|
) });
|
|
10960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10961
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { hidden: true, ref: homeRef }),
|
|
10962
|
+
portalHost ? (0, import_react_dom3.createPortal)(content, portalHost) : content
|
|
10963
|
+
] });
|
|
10880
10964
|
}
|
|
10881
10965
|
|
|
10882
10966
|
// src/components/Table.tsx
|
|
@@ -11942,7 +12026,7 @@ function subscribeRelativeClock(interval, listener) {
|
|
|
11942
12026
|
if (!clock.timer) {
|
|
11943
12027
|
clock.timer = window.setInterval(() => {
|
|
11944
12028
|
clock.now = Date.now();
|
|
11945
|
-
clock.listeners.forEach((
|
|
12029
|
+
clock.listeners.forEach((notify2) => notify2());
|
|
11946
12030
|
}, interval);
|
|
11947
12031
|
}
|
|
11948
12032
|
return () => {
|
|
@@ -18478,13 +18562,13 @@ var import_react98 = require("react");
|
|
|
18478
18562
|
|
|
18479
18563
|
// src/hooks/usePrinting.ts
|
|
18480
18564
|
var import_react97 = require("react");
|
|
18481
|
-
var
|
|
18565
|
+
var import_react_dom4 = require("react-dom");
|
|
18482
18566
|
function usePrinting(enabled = true) {
|
|
18483
18567
|
const [printing, setPrinting] = (0, import_react97.useState)(false);
|
|
18484
18568
|
(0, import_react97.useEffect)(() => {
|
|
18485
18569
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
18486
18570
|
const set = (next) => {
|
|
18487
|
-
(0,
|
|
18571
|
+
(0, import_react_dom4.flushSync)(() => setPrinting(next));
|
|
18488
18572
|
};
|
|
18489
18573
|
const before = () => set(true);
|
|
18490
18574
|
const after = () => set(false);
|