@admin-layout/tailwind-design-pro 12.2.4-alpha.109 → 12.2.4-alpha.113
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/lib/components/Layout/Sidebar/MenuDynamicDialog.d.ts +7 -0
- package/lib/components/Layout/Sidebar/MenuDynamicDialog.d.ts.map +1 -1
- package/lib/components/Layout/Sidebar/MenuDynamicDialog.js +61 -22
- package/lib/components/Layout/Sidebar/MenuDynamicDialog.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,6 +4,13 @@ import React from 'react';
|
|
|
4
4
|
* Fixes clipped “strip” modals: position:fixed inside sidebar/layout (transform,
|
|
5
5
|
* overflow, inline-block shells) uses the wrong containing block unless the tree
|
|
6
6
|
* is attached under body.
|
|
7
|
+
*
|
|
8
|
+
* Every menu modal is mounted inside {@link MenuDialogShell}. The dialog bodies
|
|
9
|
+
* themselves are page components (Login/Signup render a `relative` page root,
|
|
10
|
+
* Logout a full-screen `fixed` one), so without the shell they land in normal
|
|
11
|
+
* body flow — the login form was appended a full viewport below the fold and the
|
|
12
|
+
* menu looked dead. The shell supplies the modal chrome (backdrop, centering,
|
|
13
|
+
* dismissal) and neutralizes the page-level positioning of whatever it wraps.
|
|
7
14
|
*/
|
|
8
15
|
export declare const MenuDynamicDialog: React.FC<{
|
|
9
16
|
dialogPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuDynamicDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/MenuDynamicDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MenuDynamicDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/MenuDynamicDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAQxE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA8BnF,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import React__default,{useState,useEffect,useRef}from'react';import {createPortal}from'react-dom';import switchDialogs from'@app/dialog/WrappedDialogsSwitch';/**
|
|
2
|
-
function shouldNeutralizeOuterFixedOverlay(path) {
|
|
3
|
-
const p = path.replace(/\\/g, '/');
|
|
4
|
-
return p.includes('/Logout/') && /\/Logout\/index\.js$/i.test(p);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
1
|
+
import React__default,{useState,useEffect,useRef,useCallback}from'react';import {createPortal}from'react-dom';import switchDialogs from'@app/dialog/WrappedDialogsSwitch';/**
|
|
7
2
|
* Loads a menu modal via switchDialogs(path) and mounts it on document.body.
|
|
8
3
|
* Fixes clipped “strip” modals: position:fixed inside sidebar/layout (transform,
|
|
9
4
|
* overflow, inline-block shells) uses the wrong containing block unless the tree
|
|
10
5
|
* is attached under body.
|
|
6
|
+
*
|
|
7
|
+
* Every menu modal is mounted inside {@link MenuDialogShell}. The dialog bodies
|
|
8
|
+
* themselves are page components (Login/Signup render a `relative` page root,
|
|
9
|
+
* Logout a full-screen `fixed` one), so without the shell they land in normal
|
|
10
|
+
* body flow — the login form was appended a full viewport below the fold and the
|
|
11
|
+
* menu looked dead. The shell supplies the modal chrome (backdrop, centering,
|
|
12
|
+
* dismissal) and neutralizes the page-level positioning of whatever it wraps.
|
|
11
13
|
*/
|
|
12
14
|
const MenuDynamicDialog = ({
|
|
13
15
|
dialogPath,
|
|
@@ -34,29 +36,38 @@ const MenuDynamicDialog = ({
|
|
|
34
36
|
className: "rounded-themed-lg bg-card px-4 py-3 text-sm text-muted-foreground shadow-themed-md"
|
|
35
37
|
}, "Loading...")), document.body);
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return createPortal(React__default.createElement(Inner, {
|
|
40
|
-
onClose: onClose
|
|
41
|
-
}), document.body);
|
|
42
|
-
}
|
|
43
|
-
return createPortal(React__default.createElement(LogoutFixedNeutralizedShell, {
|
|
44
|
-
Inner: Inner,
|
|
39
|
+
return createPortal(React__default.createElement(MenuDialogShell, {
|
|
40
|
+
Inner: mod.default,
|
|
45
41
|
onClose: onClose
|
|
46
42
|
}), document.body);
|
|
47
43
|
};
|
|
48
|
-
/**
|
|
49
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Backdrop + centered host for a menu modal.
|
|
46
|
+
*
|
|
47
|
+
* `[&>*]` neutralizes the wrapped page root so it behaves as modal content:
|
|
48
|
+
* `!relative !inset-auto` defuses Logout's full-screen `fixed` root (which would
|
|
49
|
+
* otherwise resolve against the wrong containing block and collapse into a
|
|
50
|
+
* horizontal strip), `!bg-transparent` lets the backdrop show around the card,
|
|
51
|
+
* and the flex/centering keeps the card centred inside the host.
|
|
52
|
+
*/
|
|
53
|
+
function MenuDialogShell({
|
|
50
54
|
Inner,
|
|
51
55
|
onClose
|
|
52
56
|
}) {
|
|
53
57
|
const innerHostRef = useRef(null);
|
|
58
|
+
/** Menus pass a fresh arrow every render; keep the listeners/observer subscribed once. */
|
|
59
|
+
const closeRef = useRef(onClose);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
closeRef.current = onClose;
|
|
62
|
+
}, [onClose]);
|
|
63
|
+
const close = useCallback(() => closeRef.current(), []);
|
|
64
|
+
/** Dialogs that self-dismiss by rendering null (Logout cancel) must not leave a bare backdrop. */
|
|
54
65
|
useEffect(() => {
|
|
55
66
|
const el = innerHostRef.current;
|
|
56
67
|
if (!el) return;
|
|
57
68
|
const syncIfEmpty = () => {
|
|
58
69
|
if (el.childElementCount === 0) {
|
|
59
|
-
|
|
70
|
+
close();
|
|
60
71
|
}
|
|
61
72
|
};
|
|
62
73
|
const mo = new MutationObserver(syncIfEmpty);
|
|
@@ -64,16 +75,44 @@ function LogoutFixedNeutralizedShell({
|
|
|
64
75
|
childList: true
|
|
65
76
|
});
|
|
66
77
|
return () => mo.disconnect();
|
|
67
|
-
}, [
|
|
78
|
+
}, [close]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const onKeyDown = e => {
|
|
81
|
+
if (e.key === 'Escape') close();
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener('keydown', onKeyDown);
|
|
84
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
85
|
+
}, [close]);
|
|
86
|
+
/** Freeze the page behind the backdrop so wheel/touch scrolling cannot drift it. */
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const {
|
|
89
|
+
body
|
|
90
|
+
} = document;
|
|
91
|
+
const previousOverflow = body.style.overflow;
|
|
92
|
+
body.style.overflow = 'hidden';
|
|
93
|
+
return () => {
|
|
94
|
+
body.style.overflow = previousOverflow;
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
/**
|
|
98
|
+
* The backdrop is the scroller, not the dialog host: a card taller than the viewport
|
|
99
|
+
* (Signup on a short laptop screen) scrolls as a whole, keeping its own rounded corners
|
|
100
|
+
* and shadow, instead of being cut flat by a clipping host whose radius could never match
|
|
101
|
+
* every dialog's card (Login is `rounded-2xl`, Logout `rounded-themed-lg`).
|
|
102
|
+
*/
|
|
68
103
|
return React__default.createElement("div", {
|
|
69
|
-
className: "fixed inset-0 z-[120]
|
|
104
|
+
className: "fixed inset-0 z-[120] overflow-y-auto overscroll-contain bg-black/50",
|
|
70
105
|
role: "presentation",
|
|
71
|
-
onClick:
|
|
106
|
+
onClick: close
|
|
107
|
+
}, React__default.createElement("div", {
|
|
108
|
+
className: "flex min-h-full items-center justify-center p-4"
|
|
72
109
|
}, React__default.createElement("div", {
|
|
73
110
|
ref: innerHostRef,
|
|
111
|
+
role: "dialog",
|
|
112
|
+
"aria-modal": "true",
|
|
74
113
|
className: "w-full max-w-md [&>*]:!relative [&>*]:!inset-auto [&>*]:!min-h-0 [&>*]:!w-full [&>*]:!max-w-full [&>*]:!bg-transparent [&>*]:flex [&>*]:items-center [&>*]:justify-center",
|
|
75
114
|
onClick: e => e.stopPropagation()
|
|
76
115
|
}, React__default.createElement(Inner, {
|
|
77
|
-
onClose:
|
|
78
|
-
})));
|
|
116
|
+
onClose: close
|
|
117
|
+
}))));
|
|
79
118
|
}export{MenuDynamicDialog};//# sourceMappingURL=MenuDynamicDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuDynamicDialog.js","sources":["../../../../src/components/Layout/Sidebar/MenuDynamicDialog.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuDynamicDialog.js","sources":["../../../../src/components/Layout/Sidebar/MenuDynamicDialog.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"0KAQA;;;;;;;;;;;;AAYG;AACI,MAAM,iBAAiB,GAA0D,CAAC;YAC9E;;;QAIH,CAAA,GAAA,EAAM,MAAM,CAAC,GAAA,QAAA,CAAA,IAAA,CAAA;WACb,CAAA,MAAA;AACI,IAAA,IAAA,SAAK,GAAA,KAAA;gBAAW;AACpB,IAAA,aAAG,CAAA,UAAA,CAAA,CAAA,IAAA,CAAA,MAAA,IAAA;AACH,MAAA,IAAA,CAAA,SAAY,EAAA,MAAA,CAAA,MAAA,CAAA;;AAEZ,IAAA,OAAE,MAAA;AACN,MAAC,SAAG,GAAU,IAAG;AAEjB,IAAA,CAAA;AACI,EAAA,CAAA,EAAA,CAAA;MACH,OAAA,QAAA,KAAA,WAAA,EAAA;IAED,OAAK,IAAM;AACP,EAAA;YAEQ;IAMZ,OAAC,YAAA,CAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA;MAED,SAAO,EAAA;AACX,KAAE,EAAAA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAEF,MAAA,SAAA,EAAA;;;;;;;;AAQG;AACH;AACI;;AAEA;;AAEI;AACJ;AAEA;SAEA,eAAA,CAAA;OACA;AACI,EAAA;AACA,CAAA,EAAA;oBAAgB,GAAA,MAAA,CAAA,I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@@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/tailwind-design-pro",
|
|
3
|
-
"version": "12.2.4-alpha.
|
|
3
|
+
"version": "12.2.4-alpha.113",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@admin-layout/assets": "12.2.4-alpha.98",
|
|
25
|
-
"@admin-layout/client": "12.2.4-alpha.
|
|
26
|
-
"@admin-layout/tailwind-ui": "12.2.4-alpha.
|
|
25
|
+
"@admin-layout/client": "12.2.4-alpha.111",
|
|
26
|
+
"@admin-layout/tailwind-ui": "12.2.4-alpha.113",
|
|
27
27
|
"path-to-regexp": "^8.0.0",
|
|
28
28
|
"react-favicon": "^0.0.23",
|
|
29
29
|
"react-intl": "^6.1.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "58a277a3695041005254a8b55cfc5bb1624dd79c",
|
|
56
56
|
"typescript": {
|
|
57
57
|
"definition": "lib/index.d.ts"
|
|
58
58
|
}
|