framepexls-ui-lib 0.1.31 → 0.1.32
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/Dialog.js +7 -7
- package/dist/Dialog.mjs +7 -7
- package/package.json +1 -1
package/dist/Dialog.js
CHANGED
|
@@ -100,16 +100,16 @@ function useLockBodyScroll(open) {
|
|
|
100
100
|
};
|
|
101
101
|
}, [open]);
|
|
102
102
|
}
|
|
103
|
-
function useEscToClose(open, onClose, disabled,
|
|
103
|
+
function useEscToClose(open, onClose, disabled, onlyTop) {
|
|
104
104
|
(0, import_react.useEffect)(() => {
|
|
105
105
|
if (!open || disabled) return;
|
|
106
|
-
if (
|
|
106
|
+
if (onlyTop === false) return;
|
|
107
107
|
const onKey = (e) => {
|
|
108
108
|
if (e.key === "Escape") onClose();
|
|
109
109
|
};
|
|
110
110
|
window.addEventListener("keydown", onKey);
|
|
111
111
|
return () => window.removeEventListener("keydown", onKey);
|
|
112
|
-
}, [open, onClose, disabled,
|
|
112
|
+
}, [open, onClose, disabled, onlyTop]);
|
|
113
113
|
}
|
|
114
114
|
function cx(...a) {
|
|
115
115
|
return a.filter(Boolean).join(" ");
|
|
@@ -134,7 +134,7 @@ function DialogBase({
|
|
|
134
134
|
const lastFocusedRef = (0, import_react.useRef)(null);
|
|
135
135
|
const [zIndexBase, setZIndexBase] = (0, import_react.useState)(null);
|
|
136
136
|
useLockBodyScroll(open);
|
|
137
|
-
useEscToClose(open, onClose, disableEscClose,
|
|
137
|
+
useEscToClose(open, onClose, disableEscClose, zManager.isTop(zIndexBase));
|
|
138
138
|
(0, import_react.useEffect)(() => {
|
|
139
139
|
if (open) {
|
|
140
140
|
const z = zManager.acquire();
|
|
@@ -162,13 +162,13 @@ function DialogBase({
|
|
|
162
162
|
if (!dismissibleBackdrop) return;
|
|
163
163
|
if (e.target === e.currentTarget) onClose();
|
|
164
164
|
};
|
|
165
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: open && typeof document !== "undefined" &&
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: open && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
166
166
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
167
167
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
168
|
import_framer_motion.motion.div,
|
|
169
169
|
{
|
|
170
170
|
className: "fixed inset-0 bg-black/45 backdrop-blur-sm",
|
|
171
|
-
style: { zIndex: zIndexBase },
|
|
171
|
+
style: { zIndex: zIndexBase != null ? zIndexBase : 1e3 },
|
|
172
172
|
initial: { opacity: 0 },
|
|
173
173
|
animate: { opacity: 1 },
|
|
174
174
|
exit: { opacity: 0 }
|
|
@@ -182,7 +182,7 @@ function DialogBase({
|
|
|
182
182
|
"aria-labelledby": title ? "dialog-title" : void 0,
|
|
183
183
|
"aria-describedby": description ? "dialog-desc" : void 0,
|
|
184
184
|
className: "fixed inset-0 grid place-items-center p-4",
|
|
185
|
-
style: { zIndex: zIndexBase + 1 },
|
|
185
|
+
style: { zIndex: (zIndexBase != null ? zIndexBase : 1e3) + 1 },
|
|
186
186
|
initial: { opacity: 0, scale: 0.98, y: 8 },
|
|
187
187
|
animate: { opacity: 1, scale: 1, y: 0 },
|
|
188
188
|
exit: { opacity: 0, scale: 0.98, y: 8 },
|
package/dist/Dialog.mjs
CHANGED
|
@@ -60,16 +60,16 @@ function useLockBodyScroll(open) {
|
|
|
60
60
|
};
|
|
61
61
|
}, [open]);
|
|
62
62
|
}
|
|
63
|
-
function useEscToClose(open, onClose, disabled,
|
|
63
|
+
function useEscToClose(open, onClose, disabled, onlyTop) {
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if (!open || disabled) return;
|
|
66
|
-
if (
|
|
66
|
+
if (onlyTop === false) return;
|
|
67
67
|
const onKey = (e) => {
|
|
68
68
|
if (e.key === "Escape") onClose();
|
|
69
69
|
};
|
|
70
70
|
window.addEventListener("keydown", onKey);
|
|
71
71
|
return () => window.removeEventListener("keydown", onKey);
|
|
72
|
-
}, [open, onClose, disabled,
|
|
72
|
+
}, [open, onClose, disabled, onlyTop]);
|
|
73
73
|
}
|
|
74
74
|
function cx(...a) {
|
|
75
75
|
return a.filter(Boolean).join(" ");
|
|
@@ -94,7 +94,7 @@ function DialogBase({
|
|
|
94
94
|
const lastFocusedRef = useRef(null);
|
|
95
95
|
const [zIndexBase, setZIndexBase] = useState(null);
|
|
96
96
|
useLockBodyScroll(open);
|
|
97
|
-
useEscToClose(open, onClose, disableEscClose,
|
|
97
|
+
useEscToClose(open, onClose, disableEscClose, zManager.isTop(zIndexBase));
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
if (open) {
|
|
100
100
|
const z = zManager.acquire();
|
|
@@ -122,13 +122,13 @@ function DialogBase({
|
|
|
122
122
|
if (!dismissibleBackdrop) return;
|
|
123
123
|
if (e.target === e.currentTarget) onClose();
|
|
124
124
|
};
|
|
125
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && typeof document !== "undefined" &&
|
|
125
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && typeof document !== "undefined" && createPortal(
|
|
126
126
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
127
127
|
/* @__PURE__ */ jsx(
|
|
128
128
|
motion.div,
|
|
129
129
|
{
|
|
130
130
|
className: "fixed inset-0 bg-black/45 backdrop-blur-sm",
|
|
131
|
-
style: { zIndex: zIndexBase },
|
|
131
|
+
style: { zIndex: zIndexBase != null ? zIndexBase : 1e3 },
|
|
132
132
|
initial: { opacity: 0 },
|
|
133
133
|
animate: { opacity: 1 },
|
|
134
134
|
exit: { opacity: 0 }
|
|
@@ -142,7 +142,7 @@ function DialogBase({
|
|
|
142
142
|
"aria-labelledby": title ? "dialog-title" : void 0,
|
|
143
143
|
"aria-describedby": description ? "dialog-desc" : void 0,
|
|
144
144
|
className: "fixed inset-0 grid place-items-center p-4",
|
|
145
|
-
style: { zIndex: zIndexBase + 1 },
|
|
145
|
+
style: { zIndex: (zIndexBase != null ? zIndexBase : 1e3) + 1 },
|
|
146
146
|
initial: { opacity: 0, scale: 0.98, y: 8 },
|
|
147
147
|
animate: { opacity: 1, scale: 1, y: 0 },
|
|
148
148
|
exit: { opacity: 0, scale: 0.98, y: 8 },
|