udp-react-enterprise-component-library 26.7.0-beta.2 → 26.7.0-beta.4
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/dist/.tsbuildinfo +1 -1
- package/dist/providers/UdpAppProvider.d.ts.map +1 -1
- package/dist/providers/UdpAppProvider.js +90 -2
- package/dist/providers/UdpAppProvider.js.map +1 -1
- package/dist/providers/UdpAppProvider.mjs +111 -16
- package/dist/providers/UdpAppProvider.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UdpAppProvider.d.ts","sourceRoot":"","sources":["../../src/providers/UdpAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"UdpAppProvider.d.ts","sourceRoot":"","sources":["../../src/providers/UdpAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAoB,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAIpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAM9E,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF;;OAEG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AA2FD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4BxD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { SnackbarProvider } from 'notistack';
|
|
3
3
|
import { ThemeProvider } from '../utilities/theme';
|
|
4
4
|
import { AuthProvider } from '../utilities/auth/AuthProvider';
|
|
@@ -7,6 +7,91 @@ import { storeInitialPath } from '../utilities/redirect';
|
|
|
7
7
|
import { storeInitialTenant } from '../utilities/storage';
|
|
8
8
|
import { BrowserRouter } from 'react-router-dom';
|
|
9
9
|
import { QueryProvider } from './QueryProvider';
|
|
10
|
+
/**
|
|
11
|
+
* Strip the popover UA box entirely: notistack's own container is
|
|
12
|
+
* position: fixed and does all the positioning, so the host is a zero-size
|
|
13
|
+
* anchor that must not paint, size, or clip anything.
|
|
14
|
+
*/
|
|
15
|
+
const SNACKBAR_HOST_STYLE = 'position:fixed;inset:auto;width:0;height:0;margin:0;padding:0;border:0;background:none;overflow:visible';
|
|
16
|
+
const createSnackbarHost = () => {
|
|
17
|
+
if (typeof document === 'undefined')
|
|
18
|
+
return undefined;
|
|
19
|
+
if (typeof HTMLElement.prototype.showPopover !== 'function')
|
|
20
|
+
return undefined;
|
|
21
|
+
const el = document.createElement('div');
|
|
22
|
+
el.setAttribute('popover', 'manual');
|
|
23
|
+
el.style.cssText = SNACKBAR_HOST_STYLE;
|
|
24
|
+
return el;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates the DOM element notistack portals its snackbar container into, and
|
|
28
|
+
* keeps it in the browser's **top layer**.
|
|
29
|
+
*
|
|
30
|
+
* Why this exists: `UdpDrawer` and `UdpDialog` open a native `<dialog>` with
|
|
31
|
+
* `showModal()`, which promotes them to the top layer. Top-layer elements paint
|
|
32
|
+
* above every element in ordinary DOM regardless of `z-index`, so notistack's
|
|
33
|
+
* container — a plain `position: fixed` element at `zIndex.snackbar` — is hidden
|
|
34
|
+
* behind an open drawer or dialog. No z-index can fix that; the container has to
|
|
35
|
+
* be in the top layer too, which the Popover API provides.
|
|
36
|
+
*
|
|
37
|
+
* Paint order inside the top layer is promotion order, so the host is
|
|
38
|
+
* re-promoted (`hidePopover()` then `showPopover()`, synchronously, so nothing
|
|
39
|
+
* paints in between) whenever a snackbar is added. That keeps it above whichever
|
|
40
|
+
* drawer or dialog opened most recently.
|
|
41
|
+
*
|
|
42
|
+
* Two consequences worth knowing:
|
|
43
|
+
* - While a modal drawer or dialog is open, everything outside it is inert, so a
|
|
44
|
+
* snackbar `action` button is visible but not clickable. Auto-dismiss is
|
|
45
|
+
* unaffected. Anything the user must act on belongs in a `UdpMessageBar`
|
|
46
|
+
* inside the drawer, not a toast.
|
|
47
|
+
* - If a drawer opens while a snackbar is already showing, the drawer is
|
|
48
|
+
* promoted last and covers it until the next snackbar arrives.
|
|
49
|
+
*
|
|
50
|
+
* Returns `undefined` when the browser has no Popover API, which leaves
|
|
51
|
+
* notistack rendering inline exactly as it did before.
|
|
52
|
+
*/
|
|
53
|
+
const useSnackbarTopLayerHost = () => {
|
|
54
|
+
const [host] = useState(createSnackbarHost);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!host)
|
|
57
|
+
return undefined;
|
|
58
|
+
document.body.appendChild(host);
|
|
59
|
+
let scheduled = false;
|
|
60
|
+
const promote = () => {
|
|
61
|
+
if (scheduled)
|
|
62
|
+
return;
|
|
63
|
+
scheduled = true;
|
|
64
|
+
// Coalesce to one promotion per React commit.
|
|
65
|
+
queueMicrotask(() => {
|
|
66
|
+
scheduled = false;
|
|
67
|
+
if (!host.isConnected)
|
|
68
|
+
return;
|
|
69
|
+
try {
|
|
70
|
+
if (host.matches(':popover-open'))
|
|
71
|
+
host.hidePopover();
|
|
72
|
+
host.showPopover();
|
|
73
|
+
}
|
|
74
|
+
catch (_a) {
|
|
75
|
+
// Popover refused: fall back to a plain element so snackbars still
|
|
76
|
+
// render, just without top-layer promotion.
|
|
77
|
+
host.removeAttribute('popover');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
// Only additions matter — a snackbar leaving cannot change what sits above it.
|
|
82
|
+
const observer = new MutationObserver((records) => {
|
|
83
|
+
if (records.some((record) => record.addedNodes.length > 0))
|
|
84
|
+
promote();
|
|
85
|
+
});
|
|
86
|
+
observer.observe(host, { childList: true, subtree: true });
|
|
87
|
+
promote();
|
|
88
|
+
return () => {
|
|
89
|
+
observer.disconnect();
|
|
90
|
+
host.remove();
|
|
91
|
+
};
|
|
92
|
+
}, [host]);
|
|
93
|
+
return host;
|
|
94
|
+
};
|
|
10
95
|
/**
|
|
11
96
|
* Bundles the core UDP providers (theme, snackbar, auth) and ensures the shared
|
|
12
97
|
* i18n instance is initialised exactly once. Intended to be rendered beneath a
|
|
@@ -16,8 +101,11 @@ export const UdpAppProvider = ({ children, snackbarProps, authProps, i18nOptions
|
|
|
16
101
|
useEffect(() => {
|
|
17
102
|
initializeUnityI18n(i18nOptions);
|
|
18
103
|
}, [i18nOptions]);
|
|
104
|
+
// Snackbars have to live in the browser top layer or the modal <dialog>
|
|
105
|
+
// behind UdpDrawer / UdpDialog paints over them. See useSnackbarTopLayerHost.
|
|
106
|
+
const snackbarHost = useSnackbarTopLayerHost();
|
|
19
107
|
storeInitialPath();
|
|
20
108
|
storeInitialTenant();
|
|
21
|
-
return (React.createElement(ThemeProvider, null, React.createElement(QueryProvider, { showDevTools: devTools === null || devTools === void 0 ? void 0 : devTools.query }, React.createElement(AuthProvider, Object.assign({}, authProps), React.createElement(BrowserRouter, null, React.createElement(SnackbarProvider, Object.assign({ maxSnack: 3 }, snackbarProps), children))))));
|
|
109
|
+
return (React.createElement(ThemeProvider, null, React.createElement(QueryProvider, { showDevTools: devTools === null || devTools === void 0 ? void 0 : devTools.query }, React.createElement(AuthProvider, Object.assign({}, authProps), React.createElement(BrowserRouter, null, React.createElement(SnackbarProvider, Object.assign({ maxSnack: 3, domRoot: snackbarHost }, snackbarProps), children))))));
|
|
22
110
|
};
|
|
23
111
|
//# sourceMappingURL=UdpAppProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UdpAppProvider.js","sourceRoot":"","sources":["../../src/providers/UdpAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UdpAppProvider.js","sourceRoot":"","sources":["../../src/providers/UdpAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA6BhD;;;;GAIG;AACH,MAAM,mBAAmB,GACvB,yGAAyG,CAAC;AAE5G,MAAM,kBAAkB,GAAG,GAA4B,EAAE,CAAC;IACxD,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,OAAO,WAAW,CAAC,SAAS,CAAC,WAAW,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC;IAE9E,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrC,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,mBAAmB,CAAC;IACv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AAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAE3D,OAAO,EAAE,CAAC;QAEV,OAAO,GAAG,EAAE,CAAC;YACX,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,EAAE,CAAC;QAAA,CACf,CAAC;IAAA,CACH,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,IAAI,CAAC;AAAA,CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC5D,QAAQ,EACR,aAAa,EACb,SAAS,EACT,WAAW,EACX,QAAQ,GACT,EAAE,EAAE,CAAC;IACJ,SAAS,CAAC,GAAG,EAAE,CAAC;QACd,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAAA,CAClC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAClB,wEAAwE;IACxE,8EAA8E;IAC9E,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC;IAC/C,gBAAgB,EAAE,CAAC;IACnB,kBAAkB,EAAE,CAAC;IACrB,OAAO,CACL,oBAAC,aAAa,QACZ,oBAAC,aAAa,IAAC,YAAY,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,IAC1C,oBAAC,YAAY,oBAAK,SAAS,GACzB,oBAAC,aAAa,QACZ,oBAAC,gBAAgB,kBAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,IAAM,aAAa,GACpE,QAAQ,CACQ,CACL,CACH,CACD,CACF,CACjB,CAAC;AAAA,CACH,CAAC"}
|
|
@@ -5,17 +5,106 @@ import { storeInitialPath } from "../utilities/redirect/LocalRedirectUrlStorage.
|
|
|
5
5
|
import { initializeUnityI18n } from "../utilities/i18n/initializeI18n.mjs";
|
|
6
6
|
import { AuthProvider } from "../utilities/auth/AuthProvider.mjs";
|
|
7
7
|
import { QueryProvider } from "./QueryProvider.mjs";
|
|
8
|
-
import React, { useEffect } from "react";
|
|
8
|
+
import React, { useEffect, useState } from "react";
|
|
9
9
|
import { SnackbarProvider } from "notistack";
|
|
10
10
|
import { BrowserRouter } from "react-router-dom";
|
|
11
11
|
//#region src/providers/UdpAppProvider.tsx
|
|
12
12
|
/**
|
|
13
|
+
* Strip the popover UA box entirely: notistack's own container is
|
|
14
|
+
* position: fixed and does all the positioning, so the host is a zero-size
|
|
15
|
+
* anchor that must not paint, size, or clip anything.
|
|
16
|
+
*/
|
|
17
|
+
const SNACKBAR_HOST_STYLE = "position:fixed;inset:auto;width:0;height:0;margin:0;padding:0;border:0;background:none;overflow:visible";
|
|
18
|
+
const createSnackbarHost = () => {
|
|
19
|
+
if (typeof document === "undefined") return void 0;
|
|
20
|
+
if (typeof HTMLElement.prototype.showPopover !== "function") return void 0;
|
|
21
|
+
const el = document.createElement("div");
|
|
22
|
+
el.setAttribute("popover", "manual");
|
|
23
|
+
el.style.cssText = SNACKBAR_HOST_STYLE;
|
|
24
|
+
return el;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates the DOM element notistack portals its snackbar container into, and
|
|
28
|
+
* keeps it in the browser's **top layer**.
|
|
29
|
+
*
|
|
30
|
+
* Why this exists: `UdpDrawer` and `UdpDialog` open a native `<dialog>` with
|
|
31
|
+
* `showModal()`, which promotes them to the top layer. Top-layer elements paint
|
|
32
|
+
* above every element in ordinary DOM regardless of `z-index`, so notistack's
|
|
33
|
+
* container — a plain `position: fixed` element at `zIndex.snackbar` — is hidden
|
|
34
|
+
* behind an open drawer or dialog. No z-index can fix that; the container has to
|
|
35
|
+
* be in the top layer too, which the Popover API provides.
|
|
36
|
+
*
|
|
37
|
+
* Paint order inside the top layer is promotion order, so the host is
|
|
38
|
+
* re-promoted (`hidePopover()` then `showPopover()`, synchronously, so nothing
|
|
39
|
+
* paints in between) whenever a snackbar is added. That keeps it above whichever
|
|
40
|
+
* drawer or dialog opened most recently.
|
|
41
|
+
*
|
|
42
|
+
* Two consequences worth knowing:
|
|
43
|
+
* - While a modal drawer or dialog is open, everything outside it is inert, so a
|
|
44
|
+
* snackbar `action` button is visible but not clickable. Auto-dismiss is
|
|
45
|
+
* unaffected. Anything the user must act on belongs in a `UdpMessageBar`
|
|
46
|
+
* inside the drawer, not a toast.
|
|
47
|
+
* - If a drawer opens while a snackbar is already showing, the drawer is
|
|
48
|
+
* promoted last and covers it until the next snackbar arrives.
|
|
49
|
+
*
|
|
50
|
+
* Returns `undefined` when the browser has no Popover API, which leaves
|
|
51
|
+
* notistack rendering inline exactly as it did before.
|
|
52
|
+
*/
|
|
53
|
+
const useSnackbarTopLayerHost = () => {
|
|
54
|
+
const $ = c(3);
|
|
55
|
+
const [host] = useState(createSnackbarHost);
|
|
56
|
+
let t0;
|
|
57
|
+
let t1;
|
|
58
|
+
if ($[0] !== host) {
|
|
59
|
+
t0 = () => {
|
|
60
|
+
if (!host) return;
|
|
61
|
+
document.body.appendChild(host);
|
|
62
|
+
let scheduled = false;
|
|
63
|
+
const promote = () => {
|
|
64
|
+
if (scheduled) return;
|
|
65
|
+
scheduled = true;
|
|
66
|
+
queueMicrotask(() => {
|
|
67
|
+
scheduled = false;
|
|
68
|
+
if (!host.isConnected) return;
|
|
69
|
+
try {
|
|
70
|
+
if (host.matches(":popover-open")) host.hidePopover();
|
|
71
|
+
host.showPopover();
|
|
72
|
+
} catch {
|
|
73
|
+
host.removeAttribute("popover");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const observer = new MutationObserver((records) => {
|
|
78
|
+
if (records.some(_temp)) promote();
|
|
79
|
+
});
|
|
80
|
+
observer.observe(host, {
|
|
81
|
+
childList: true,
|
|
82
|
+
subtree: true
|
|
83
|
+
});
|
|
84
|
+
promote();
|
|
85
|
+
return () => {
|
|
86
|
+
observer.disconnect();
|
|
87
|
+
host.remove();
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
t1 = [host];
|
|
91
|
+
$[0] = host;
|
|
92
|
+
$[1] = t0;
|
|
93
|
+
$[2] = t1;
|
|
94
|
+
} else {
|
|
95
|
+
t0 = $[1];
|
|
96
|
+
t1 = $[2];
|
|
97
|
+
}
|
|
98
|
+
useEffect(t0, t1);
|
|
99
|
+
return host;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
13
102
|
* Bundles the core UDP providers (theme, snackbar, auth) and ensures the shared
|
|
14
103
|
* i18n instance is initialised exactly once. Intended to be rendered beneath a
|
|
15
104
|
* react-router <Router /> so the auth provider has access to history.
|
|
16
105
|
*/
|
|
17
106
|
const UdpAppProvider = (t0) => {
|
|
18
|
-
const $ = c(
|
|
107
|
+
const $ = c(13);
|
|
19
108
|
const { children, snackbarProps, authProps, i18nOptions, devTools } = t0;
|
|
20
109
|
let t1;
|
|
21
110
|
let t2;
|
|
@@ -32,35 +121,41 @@ const UdpAppProvider = (t0) => {
|
|
|
32
121
|
t2 = $[2];
|
|
33
122
|
}
|
|
34
123
|
useEffect(t1, t2);
|
|
124
|
+
const snackbarHost = useSnackbarTopLayerHost();
|
|
35
125
|
storeInitialPath();
|
|
36
126
|
storeInitialTenant();
|
|
37
127
|
const t3 = devTools?.query;
|
|
38
128
|
let t4;
|
|
39
|
-
if ($[3] !== children || $[4] !== snackbarProps) {
|
|
129
|
+
if ($[3] !== children || $[4] !== snackbarHost || $[5] !== snackbarProps) {
|
|
40
130
|
t4 = /* @__PURE__ */ React.createElement(BrowserRouter, null, /* @__PURE__ */ React.createElement(SnackbarProvider, {
|
|
41
131
|
maxSnack: 3,
|
|
132
|
+
domRoot: snackbarHost,
|
|
42
133
|
...snackbarProps
|
|
43
134
|
}, children));
|
|
44
135
|
$[3] = children;
|
|
45
|
-
$[4] =
|
|
46
|
-
$[5] =
|
|
47
|
-
|
|
136
|
+
$[4] = snackbarHost;
|
|
137
|
+
$[5] = snackbarProps;
|
|
138
|
+
$[6] = t4;
|
|
139
|
+
} else t4 = $[6];
|
|
48
140
|
let t5;
|
|
49
|
-
if ($[
|
|
141
|
+
if ($[7] !== authProps || $[8] !== t4) {
|
|
50
142
|
t5 = /* @__PURE__ */ React.createElement(AuthProvider, authProps, t4);
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
} else t5 = $[
|
|
143
|
+
$[7] = authProps;
|
|
144
|
+
$[8] = t4;
|
|
145
|
+
$[9] = t5;
|
|
146
|
+
} else t5 = $[9];
|
|
55
147
|
let t6;
|
|
56
|
-
if ($[
|
|
148
|
+
if ($[10] !== t3 || $[11] !== t5) {
|
|
57
149
|
t6 = /* @__PURE__ */ React.createElement(ThemeProvider, null, /* @__PURE__ */ React.createElement(QueryProvider, { showDevTools: t3 }, t5));
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
} else t6 = $[
|
|
150
|
+
$[10] = t3;
|
|
151
|
+
$[11] = t5;
|
|
152
|
+
$[12] = t6;
|
|
153
|
+
} else t6 = $[12];
|
|
62
154
|
return t6;
|
|
63
155
|
};
|
|
156
|
+
function _temp(record) {
|
|
157
|
+
return record.addedNodes.length > 0;
|
|
158
|
+
}
|
|
64
159
|
//#endregion
|
|
65
160
|
export { UdpAppProvider };
|
|
66
161
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UdpAppProvider.mjs","names":["React","ReactNode","useEffect","SnackbarProvider","SnackbarProviderProps","ThemeProvider","AuthProvider","initializeUnityI18n","InitializeI18nOptions","storeInitialPath","storeInitialTenant","BrowserRouter","QueryProvider","UdpDevToolsOptions","query","UdpAppProviderProps","children","snackbarProps","authProps","doNotWaitForTenant","i18nOptions","devTools","
|
|
1
|
+
{"version":3,"file":"UdpAppProvider.mjs","names":["React","ReactNode","useEffect","useState","SnackbarProvider","SnackbarProviderProps","ThemeProvider","AuthProvider","initializeUnityI18n","InitializeI18nOptions","storeInitialPath","storeInitialTenant","BrowserRouter","QueryProvider","UdpDevToolsOptions","query","UdpAppProviderProps","children","snackbarProps","authProps","doNotWaitForTenant","i18nOptions","devTools","SNACKBAR_HOST_STYLE","createSnackbarHost","HTMLElement","document","undefined","prototype","showPopover","el","createElement","setAttribute","style","cssText","useSnackbarTopLayerHost","$","_c","host","t0","t1","body","appendChild","scheduled","promote","queueMicrotask","isConnected","matches","hidePopover","removeAttribute","observer","MutationObserver","records","some","_temp","observe","childList","subtree","disconnect","remove","UdpAppProvider","FC","t2","snackbarHost","t3","t4","t5","t6","record","addedNodes","length"],"sources":["../../src/providers/UdpAppProvider.tsx"],"sourcesContent":["import React, { ReactNode, useEffect, useState } from 'react';\nimport { SnackbarProvider, SnackbarProviderProps } from 'notistack';\nimport { ThemeProvider } from '../utilities/theme';\nimport { AuthProvider } from '../utilities/auth/AuthProvider';\nimport { initializeUnityI18n } from '../utilities/i18n/initializeI18n';\nimport type { InitializeI18nOptions } from '../utilities/i18n/initializeI18n';\nimport { storeInitialPath } from '../utilities/redirect';\nimport { storeInitialTenant } from '../utilities/storage';\nimport { BrowserRouter } from 'react-router-dom';\nimport { QueryProvider } from './QueryProvider';\n\nexport interface UdpDevToolsOptions {\n /** Show the React Query DevTools panel. Defaults to false. */\n query?: boolean;\n}\n\nexport interface UdpAppProviderProps {\n children: ReactNode;\n /**\n * Props forwarded to the SnackbarProvider from notistack.\n */\n snackbarProps?: SnackbarProviderProps;\n /**\n * Props forwarded to the AuthProviderWrapper.\n */\n authProps?: {\n doNotWaitForTenant?: boolean;\n };\n /**\n * Optional configuration overrides for the shared i18n instance.\n */\n i18nOptions?: InitializeI18nOptions;\n /**\n * Enable developer tools for debugging. All options default to false.\n */\n devTools?: UdpDevToolsOptions;\n}\n\n/**\n * Strip the popover UA box entirely: notistack's own container is\n * position: fixed and does all the positioning, so the host is a zero-size\n * anchor that must not paint, size, or clip anything.\n */\nconst SNACKBAR_HOST_STYLE =\n 'position:fixed;inset:auto;width:0;height:0;margin:0;padding:0;border:0;background:none;overflow:visible';\n\nconst createSnackbarHost = (): HTMLElement | undefined => {\n if (typeof document === 'undefined') return undefined;\n if (typeof HTMLElement.prototype.showPopover !== 'function') return undefined;\n\n const el = document.createElement('div');\n el.setAttribute('popover', 'manual');\n el.style.cssText = SNACKBAR_HOST_STYLE;\n return el;\n};\n\n/**\n * Creates the DOM element notistack portals its snackbar container into, and\n * keeps it in the browser's **top layer**.\n *\n * Why this exists: `UdpDrawer` and `UdpDialog` open a native `<dialog>` with\n * `showModal()`, which promotes them to the top layer. Top-layer elements paint\n * above every element in ordinary DOM regardless of `z-index`, so notistack's\n * container — a plain `position: fixed` element at `zIndex.snackbar` — is hidden\n * behind an open drawer or dialog. No z-index can fix that; the container has to\n * be in the top layer too, which the Popover API provides.\n *\n * Paint order inside the top layer is promotion order, so the host is\n * re-promoted (`hidePopover()` then `showPopover()`, synchronously, so nothing\n * paints in between) whenever a snackbar is added. That keeps it above whichever\n * drawer or dialog opened most recently.\n *\n * Two consequences worth knowing:\n * - While a modal drawer or dialog is open, everything outside it is inert, so a\n * snackbar `action` button is visible but not clickable. Auto-dismiss is\n * unaffected. Anything the user must act on belongs in a `UdpMessageBar`\n * inside the drawer, not a toast.\n * - If a drawer opens while a snackbar is already showing, the drawer is\n * promoted last and covers it until the next snackbar arrives.\n *\n * Returns `undefined` when the browser has no Popover API, which leaves\n * notistack rendering inline exactly as it did before.\n */\nconst useSnackbarTopLayerHost = (): HTMLElement | undefined => {\n const [host] = useState(createSnackbarHost);\n\n useEffect(() => {\n if (!host) return undefined;\n\n document.body.appendChild(host);\n\n let scheduled = false;\n const promote = () => {\n if (scheduled) return;\n scheduled = true;\n // Coalesce to one promotion per React commit.\n queueMicrotask(() => {\n scheduled = false;\n if (!host.isConnected) return;\n try {\n if (host.matches(':popover-open')) host.hidePopover();\n host.showPopover();\n } catch {\n // Popover refused: fall back to a plain element so snackbars still\n // render, just without top-layer promotion.\n host.removeAttribute('popover');\n }\n });\n };\n\n // Only additions matter — a snackbar leaving cannot change what sits above it.\n const observer = new MutationObserver((records) => {\n if (records.some((record) => record.addedNodes.length > 0)) promote();\n });\n observer.observe(host, { childList: true, subtree: true });\n\n promote();\n\n return () => {\n observer.disconnect();\n host.remove();\n };\n }, [host]);\n\n return host;\n};\n\n/**\n * Bundles the core UDP providers (theme, snackbar, auth) and ensures the shared\n * i18n instance is initialised exactly once. Intended to be rendered beneath a\n * react-router <Router /> so the auth provider has access to history.\n */\nexport const UdpAppProvider: React.FC<UdpAppProviderProps> = ({\n children,\n snackbarProps,\n authProps,\n i18nOptions,\n devTools,\n}) => {\n useEffect(() => {\n initializeUnityI18n(i18nOptions);\n }, [i18nOptions]);\n // Snackbars have to live in the browser top layer or the modal <dialog>\n // behind UdpDrawer / UdpDialog paints over them. See useSnackbarTopLayerHost.\n const snackbarHost = useSnackbarTopLayerHost();\n storeInitialPath();\n storeInitialTenant();\n return (\n <ThemeProvider>\n <QueryProvider showDevTools={devTools?.query}>\n <AuthProvider {...authProps}>\n <BrowserRouter>\n <SnackbarProvider maxSnack={3} domRoot={snackbarHost} {...snackbarProps}>\n {children}\n </SnackbarProvider>\n </BrowserRouter>\n </AuthProvider>\n </QueryProvider>\n </ThemeProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,MAAMuB,sBACJ;AAEF,MAAMC,2BAAoD;AACxD,KAAI,OAAOE,aAAa,YAAa,QAAOC,KAAAA;AAC5C,KAAI,OAAOF,YAAYG,UAAUC,gBAAgB,WAAY,QAAOF,KAAAA;CAEpE,MAAMG,KAAKJ,SAASK,cAAc,MAAM;AACxCD,IAAGE,aAAa,WAAW,SAAS;AACpCF,IAAGG,MAAMC,UAAUX;AACnB,QAAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BT,MAAMK,gCAA0B;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAC9B,MAAA,CAAAC,QAAenC,SAASqB,mBAAmB;CAAC,IAAAe;CAAA,IAAAC;AAAA,KAAAJ,EAAA,OAAAE,MAAA;AAElCC,aAAA;AACR,OAAI,CAACD,KAAI;AAETZ,YAAQe,KAAKC,YAAaJ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AAnB,YAAAmB,EAAA,OAAA2B,gBAAA3B,EAAA,OAAAlB,eAAA;AAExC+C,OAAA,sBAAA,cAAC,eAAA,MACC,sBAAA,cAAC,kBAAD;GAA4B,UAAA;GAAYF,SAAAA;GAAY,GAAM7C;GAG5D,EAFKD,SAEL,CAAgB;AAAAmB,IAAA,KAAAnB;AAAAmB,IAAA,KAAA2B;AAAA3B,IAAA,KAAAlB;AAAAkB,IAAA,KAAA6B;OAAAA,MAAA7B,EAAA;CAAA,IAAA8B;AAAA,KAAA9B,EAAA,OAAAjB,aAAAiB,EAAA,OAAA6B,IAAA;AALlBC,OAAA,sBAAA,cAAC,cAAiB/C,WAChB8C,GAKa;AAAA7B,IAAA,KAAAjB;AAAAiB,IAAA,KAAA6B;AAAA7B,IAAA,KAAA8B;OAAAA,MAAA9B,EAAA;CAAA,IAAA+B;AAAA,KAAA/B,EAAA,QAAA4B,MAAA5B,EAAA,QAAA8B,IAAA;AARnBC,OAAA,sBAAA,cAAC,eAAA,MACC,sBAAA,cAAC,eAAD,EAA6B,cAAAH,IAS/B,EARIE,GAQJ,CAAgB;AAAA9B,IAAA,MAAA4B;AAAA5B,IAAA,MAAA8B;AAAA9B,IAAA,MAAA+B;OAAAA,MAAA/B,EAAA;AAAA,QAVhB+B;;AAjE4B,SAAAb,MAAAc,QAAA;AAAA,QA6BGA,OAAMC,WAAWC,SAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "udp-react-enterprise-component-library",
|
|
3
|
-
"version": "26.7.0-beta.
|
|
3
|
+
"version": "26.7.0-beta.4",
|
|
4
4
|
"description": "React-based UI component library implementing Fluent UI design for Univerus internal projects",
|
|
5
5
|
"author": "Univerus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -3907,8 +3907,8 @@
|
|
|
3907
3907
|
"@microlink/react-json-view": "^1.31.20",
|
|
3908
3908
|
"@tanstack/react-query": "^5",
|
|
3909
3909
|
"@tanstack/react-query-devtools": "^5",
|
|
3910
|
-
"udp-react-stencil-component-library": "26.7.0-beta.
|
|
3911
|
-
"udp-stencil-component-library": "26.7.0-beta.
|
|
3910
|
+
"udp-react-stencil-component-library": "26.7.0-beta.3",
|
|
3911
|
+
"udp-stencil-component-library": "26.7.0-beta.3",
|
|
3912
3912
|
"axios": "^0.31.1",
|
|
3913
3913
|
"axios-hooks": "^2.1.0",
|
|
3914
3914
|
"broadcast-channel": "^4.17.0",
|