@admin-layout/tailwind-design-pro 12.2.4-alpha.111 → 12.2.4-alpha.115

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.
@@ -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,KAAsC,MAAM,OAAO,CAAC;AAc3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAoCnF,CAAC"}
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';/** Logout ships a full-screen `fixed` root; neutralize it when embedded so it cannot nest inside another transformed modal shell (fixed then resolves to a tiny box → horizontal “strip”). */
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
- const Inner = mod.default;
38
- if (!shouldNeutralizeOuterFixedOverlay(dialogPath)) {
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
- /** Logout returns null after cancel; keep menu `openedModalKey` in sync by closing when its DOM unmounts. */
49
- function LogoutFixedNeutralizedShell({
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
- onClose();
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
- }, [onClose]);
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] flex items-center justify-center bg-black/50 p-4",
104
+ className: "fixed inset-0 z-[120] overflow-y-auto overscroll-contain bg-black/50",
70
105
  role: "presentation",
71
- onClick: () => onClose()
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: 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":"8JAQA;AACA,SAAS,iCAAiC,CAAC,IAAY,EAAA;QACnD,CAAA,GAAO,IAAG,CAAA,OAAK,CAAA,KAAQ,EAAK,GAAE,CAAA;AAC9B,EAAA,OAAA,CAAA,CAAO,QAAE,CAAA,UAAS,CAAA,IAAW,uBAAI,CAAA,IAAwB,CAAA,CAAI,CAAC;AAClE;AAEA;;;;;AAKG;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;AAED,MAAA,SAAW,EAAA;AAEX,KAAA,EAAAA,cAAK,CAAA,aAAA,CAAA,MAAA,EAAA;AACD,MAAA,SAAO,EAAA;KACV,EAAA,YAAA,CAAA,CAAA,EAAA,QAAA,CAAA,IAAA,CAAA;AAED,EAAA;AACJ,EAAE,MAAA,KAAA,GAAA,GAAA,CAAA,OAAA;AAEF,EAAA,IAAA,CAAA,iCAAA,CAAA,UAAA,CAAA,EAAA;AACA,IAAA,gDAAuC,CAAK;AACxC,MAAA;KAEA,CAAA,EAAA,SAAa,IAAE,CAAA;AACX,EAAA;AACA,EAAA,OAAA,YAAO,CAAAA,cAAA,CAAA,aAAA,CAAA,2BAAA,EAAA;gBAAE;WACT,EAAA;AACI,GAAA,CAAA,EAAA,QAAA,CAAA,IAAO,CAAA;AACH;;AAER,SAAC,2BAAC,CAAA;AACF,EAAA,KAAA;;AAEA,CAAA,EAAA;AACJ,EAAA,MAAI,YAAU,GAAA,MAAA,CAAA,IAAA,CAAA;AAEd,EAAA,SAAO,CACH,MAAA;AAKI,IAAA,MAAA,EAAA,GAAA,YAAA,CAAA,OAAA;aAKI;AAIhB,IAAC,MAAA,WAAA,GAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"MenuDynamicDialog.js","sources":["../../../../src/components/Layout/Sidebar/MenuDynamicDialog.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"0KAQA;;;;;;;;;;;;AAYG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5B,MAAA;AACA,IAAA,CAAA;UACA,EAAA,GAAO,IAAG,gBAAY,CAAA,WAAA,CAAA;AAC1B,IAAA,EAAC,CAAE,OAAO,CAAC,EAAC,EAAA;MAEZ,SAAA,EAAA;KACA,CAAA;AACI,IAAA,OAAA,MAAQ,EAAA,CAAI;AACZ,EAAA,CAAA,EAAA,CAAA,KAAA,CAAA,CAAA;AACA,EAAA,SAAA,CAAI,MAAM;AACV,IAAA,MAAA,SAAU,GAAE,CAAA,IAAA;AACR,MAAA,IAAA,CAAA,CAAA,GAAA,KAAK,QAAM,EAAA;AACf,IAAA,CAAA;IACJ,QAAO,CAAA,gBAAA,CAAA,SAAA,EAAA,SAAA,CAAA;AAEP,IAAA,OAAA,MAAA,QAAA,CAAA,mBAAA,CAAA,SAAA,EAAA,SAAA,CAAA;;;;;AAKG,MAAA;AACH,KAAA,GAAA,QACI;UAKI,gBAAA,GAAA,IAAA,CAAA,KAAK,CAAA,QAAU;cACX,CAAA,QAAA,GAAA,QAAA;iBAOI;AAKpB,MAAC,IAAA,CAAA,KAAA,CAAA,QAAA,GAAA,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/tailwind-design-pro",
3
- "version": "12.2.4-alpha.111",
3
+ "version": "12.2.4-alpha.115",
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.111",
26
- "@admin-layout/tailwind-ui": "12.2.4-alpha.111",
25
+ "@admin-layout/client": "12.2.4-alpha.115",
26
+ "@admin-layout/tailwind-ui": "12.2.4-alpha.115",
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": "2b888cafd0b98523bdbc475a7aadf01dea9f293e",
55
+ "gitHead": "9ed590c146e5871097110b049f51799eb3834ea4",
56
56
  "typescript": {
57
57
  "definition": "lib/index.d.ts"
58
58
  }