@floegence/floe-webapp-core 0.50.1 → 0.50.3
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.
|
@@ -5,6 +5,13 @@ export interface DialogProps {
|
|
|
5
5
|
/** Dialog title - can be a string or JSX element for custom headers */
|
|
6
6
|
title?: string | JSX.Element;
|
|
7
7
|
description?: string;
|
|
8
|
+
/** Localized accessible name for the close button. */
|
|
9
|
+
closeLabel?: string;
|
|
10
|
+
/** Whether clicking the backdrop requests dismissal. Defaults to true. */
|
|
11
|
+
closeOnBackdropClick?: boolean;
|
|
12
|
+
/** Bubble lets nested inputs consume Escape before the dialog handles it. */
|
|
13
|
+
escapeKeyPhase?: 'capture' | 'bubble';
|
|
14
|
+
onKeyDown?: JSX.EventHandler<HTMLDivElement, KeyboardEvent>;
|
|
8
15
|
children: JSX.Element;
|
|
9
16
|
footer?: JSX.Element;
|
|
10
17
|
class?: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createUniqueId as J, createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
1
|
+
import { createComponent as o, use as E, setAttribute as f, style as Y, Portal as X, spread as P, mergeProps as R, memo as B, insert as a, effect as N, template as s } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as J, createSignal as S, createMemo as H, createEffect as Q, onCleanup as ee, Show as b, untrack as te } from "solid-js";
|
|
3
|
+
import { cn as O } from "../../utils/cn.js";
|
|
4
|
+
import { Button as D } from "./Button.js";
|
|
5
5
|
import { X as ne } from "../icons/index.js";
|
|
6
6
|
import { useResolvedFloeConfig as re } from "../../context/FloeConfigContext.js";
|
|
7
7
|
import { useOverlayMask as oe } from "../../hooks/useOverlayMask.js";
|
|
8
|
-
import { resolveSurfacePortalHost as ie, DIALOG_SURFACE_BOUNDARY_ATTR as
|
|
9
|
-
import { LOCAL_INTERACTION_SURFACE_ATTR as
|
|
10
|
-
import { createFloatingPresence as
|
|
11
|
-
import { useDialogPlacement as
|
|
12
|
-
var fe = /* @__PURE__ */
|
|
13
|
-
const
|
|
8
|
+
import { resolveSurfacePortalHost as ie, DIALOG_SURFACE_BOUNDARY_ATTR as k, isSurfacePortalMode as j, projectSurfacePortalRect as le, resolveSurfacePortalBoundaryRect as ae, resolveSurfacePortalMount as ce } from "./dialogSurfaceScope.js";
|
|
9
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as de } from "./localInteractionSurface.js";
|
|
10
|
+
import { createFloatingPresence as se } from "./floatingPresence.js";
|
|
11
|
+
import { useDialogPlacement as ue } from "./DialogPlacementContext.js";
|
|
12
|
+
var fe = /* @__PURE__ */ s("<span aria-hidden=true>"), ge = /* @__PURE__ */ s('<h2 class="text-sm font-semibold">'), me = /* @__PURE__ */ s('<p class="mt-0.5 text-xs text-muted-foreground">'), he = /* @__PURE__ */ s('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), be = /* @__PURE__ */ s('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), we = /* @__PURE__ */ s('<div><div></div><div class="pointer-events-none relative z-[1] flex h-full w-full items-center justify-center"><div><div class="flex-1 overflow-auto overscroll-contain p-3">'), ye = /* @__PURE__ */ s("<div>");
|
|
13
|
+
const ve = {
|
|
14
14
|
display: "none"
|
|
15
15
|
};
|
|
16
16
|
function xe(e) {
|
|
@@ -33,50 +33,51 @@ function $e(e) {
|
|
|
33
33
|
}
|
|
34
34
|
window.clearTimeout(e);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const g =
|
|
38
|
-
let
|
|
39
|
-
const [
|
|
40
|
-
open: () => e.open && !!
|
|
36
|
+
function Ce(e) {
|
|
37
|
+
const g = ue(), c = J(), I = () => `dialog-${c}-title`, F = () => `dialog-${c}-description`;
|
|
38
|
+
let w;
|
|
39
|
+
const [y, G] = S(null), [M, K] = S(0), [L, z] = S(0), u = se({
|
|
40
|
+
open: () => e.open && !!y() && M() > 0,
|
|
41
41
|
exitDurationMs: 120
|
|
42
|
-
}),
|
|
42
|
+
}), v = () => u.mounted() && !!y() && M() > 0, Z = (t) => {
|
|
43
43
|
G(t), xe(() => {
|
|
44
|
-
te(
|
|
44
|
+
te(y) === t && K((l) => l + 1);
|
|
45
45
|
});
|
|
46
|
-
}, x = H(() =>
|
|
47
|
-
owner:
|
|
46
|
+
}, x = H(() => v() ? ie({
|
|
47
|
+
owner: y()
|
|
48
48
|
}) : {
|
|
49
49
|
host: null,
|
|
50
50
|
boundaryHost: null,
|
|
51
51
|
mountHost: null,
|
|
52
52
|
mode: "global"
|
|
53
|
-
}), p = () => `dialog-boundary-${
|
|
53
|
+
}), p = () => `dialog-boundary-${c}`, n = () => g.mode() === "auto" && j(x()), U = () => n() ? ce(x()) : void 0, T = () => e.globalZIndex ?? g.globalZIndex(), A = (t) => le(ae(t), t), V = () => A(x()), $ = H(() => (L(), V())), W = (t) => typeof Element < "u" && t instanceof Element ? !!t.closest(`[${k}="${p()}"]`) : typeof Node < "u" && t instanceof Node ? !!t.parentElement?.closest(`[${k}="${p()}"]`) : !1;
|
|
54
54
|
return Q(() => {
|
|
55
55
|
const t = x();
|
|
56
|
-
if (!
|
|
56
|
+
if (!v() || !n() || typeof window > "u")
|
|
57
57
|
return;
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
58
|
+
let l = !1, m = null, i = q(A(t));
|
|
59
|
+
const C = () => {
|
|
60
|
+
if (l || !j(t))
|
|
61
61
|
return;
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const r = q(A(t));
|
|
63
|
+
r !== i && (i = r, z((_) => _ + 1));
|
|
64
64
|
}, h = () => {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
l || (m = pe(() => {
|
|
66
|
+
C(), h();
|
|
67
67
|
}));
|
|
68
68
|
};
|
|
69
69
|
h(), ee(() => {
|
|
70
|
-
|
|
70
|
+
l = !0, m !== null && $e(m);
|
|
71
71
|
});
|
|
72
72
|
}), oe({
|
|
73
|
-
open:
|
|
74
|
-
root: () =>
|
|
75
|
-
containsTarget: (t) => n() ? W(t) : typeof Node < "u" && t instanceof Node ? !!
|
|
73
|
+
open: v,
|
|
74
|
+
root: () => w,
|
|
75
|
+
containsTarget: (t) => n() ? W(t) : typeof Node < "u" && t instanceof Node ? !!w?.contains(t) : !1,
|
|
76
76
|
onClose: () => e.onOpenChange(!1),
|
|
77
77
|
lockBodyScroll: () => !n(),
|
|
78
78
|
trapFocus: !0,
|
|
79
79
|
closeOnEscape: () => n() ? "inside" : !0,
|
|
80
|
+
escapeKeyPhase: () => e.escapeKeyPhase ?? "capture",
|
|
80
81
|
blockHotkeys: !0,
|
|
81
82
|
// Block scroll bleed outside the dialog while keeping the dialog content scrollable.
|
|
82
83
|
blockWheel: () => n() ? "none" : "outside",
|
|
@@ -84,36 +85,36 @@ function _e(e) {
|
|
|
84
85
|
restoreFocus: !0
|
|
85
86
|
}), [(() => {
|
|
86
87
|
var t = fe();
|
|
87
|
-
return E(
|
|
88
|
-
})(),
|
|
88
|
+
return E(Z, t), f(t, "data-floe-dialog-owner-anchor", c), Y(t, ve), t;
|
|
89
|
+
})(), o(b, {
|
|
89
90
|
get when() {
|
|
90
|
-
return
|
|
91
|
+
return v();
|
|
91
92
|
},
|
|
92
93
|
get children() {
|
|
93
|
-
return
|
|
94
|
+
return o(X, {
|
|
94
95
|
get mount() {
|
|
95
|
-
return
|
|
96
|
+
return U();
|
|
96
97
|
},
|
|
97
98
|
get children() {
|
|
98
|
-
var t =
|
|
99
|
-
f(t, "data-floe-dialog-overlay-root",
|
|
99
|
+
var t = we(), l = t.firstChild, m = l.nextSibling, i = m.firstChild, C = i.firstChild;
|
|
100
|
+
f(t, "data-floe-dialog-overlay-root", c), P(t, R({
|
|
100
101
|
get "data-floe-dialog-mode"() {
|
|
101
102
|
return n() ? "surface" : "global";
|
|
102
103
|
},
|
|
103
104
|
get "data-floating-presence"() {
|
|
104
|
-
return
|
|
105
|
+
return u.state();
|
|
105
106
|
},
|
|
106
107
|
get "aria-hidden"() {
|
|
107
|
-
return
|
|
108
|
+
return u.exiting() ? "true" : void 0;
|
|
108
109
|
}
|
|
109
110
|
}, () => ({
|
|
110
|
-
[
|
|
111
|
+
[de]: n() ? "true" : void 0
|
|
111
112
|
}), {
|
|
112
113
|
get class() {
|
|
113
|
-
return
|
|
114
|
+
return O(n() ? "absolute z-20 box-border p-3" : O("fixed inset-0 box-border p-4", T() === void 0 && "z-50"), u.exiting() && "pointer-events-none");
|
|
114
115
|
},
|
|
115
116
|
get style() {
|
|
116
|
-
return
|
|
117
|
+
return B(() => !!n())() ? {
|
|
117
118
|
left: `${$().left}px`,
|
|
118
119
|
top: `${$().top}px`,
|
|
119
120
|
width: `${$().width}px`,
|
|
@@ -122,80 +123,85 @@ function _e(e) {
|
|
|
122
123
|
"z-index": T()
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
|
-
}), !1, !0), f(
|
|
126
|
-
[
|
|
126
|
+
}), !1, !0), f(l, "data-floe-dialog-backdrop", c), P(l, R(() => ({
|
|
127
|
+
[k]: p()
|
|
127
128
|
}), {
|
|
128
129
|
get "data-floating-presence"() {
|
|
129
|
-
return
|
|
130
|
+
return u.state();
|
|
130
131
|
},
|
|
131
132
|
get class() {
|
|
132
|
-
return
|
|
133
|
+
return O("absolute inset-0 floe-floating-presence floe-floating-backdrop", e.closeOnBackdropClick === !1 ? "cursor-default" : "cursor-pointer", n() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
|
|
133
134
|
},
|
|
134
|
-
onClick: () =>
|
|
135
|
+
onClick: () => {
|
|
136
|
+
e.closeOnBackdropClick !== !1 && e.onOpenChange(!1);
|
|
137
|
+
}
|
|
135
138
|
}), !1, !1);
|
|
136
|
-
var h =
|
|
137
|
-
return typeof h == "function" ? E(h,
|
|
138
|
-
[
|
|
139
|
+
var h = w;
|
|
140
|
+
return typeof h == "function" ? E(h, i) : w = i, f(i, "data-floe-dialog-panel", c), P(i, R(() => ({
|
|
141
|
+
[k]: p()
|
|
139
142
|
}), {
|
|
140
143
|
get class() {
|
|
141
|
-
return
|
|
144
|
+
return O(n() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md max-h-[85vh]", "bg-card text-card-foreground rounded-md shadow-lg", "border border-border", "floe-floating-presence floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
|
|
142
145
|
},
|
|
143
146
|
get "data-floating-presence"() {
|
|
144
|
-
return
|
|
147
|
+
return u.state();
|
|
145
148
|
},
|
|
146
149
|
role: "dialog",
|
|
147
150
|
get "aria-modal"() {
|
|
148
151
|
return n() ? void 0 : "true";
|
|
149
152
|
},
|
|
150
153
|
get "aria-labelledby"() {
|
|
151
|
-
return
|
|
154
|
+
return B(() => !!e.title)() ? I() : void 0;
|
|
152
155
|
},
|
|
153
156
|
get "aria-describedby"() {
|
|
154
|
-
return
|
|
157
|
+
return B(() => !!e.description)() ? F() : void 0;
|
|
155
158
|
},
|
|
159
|
+
onKeyDown: (r) => e.onKeyDown?.(r),
|
|
156
160
|
tabIndex: -1
|
|
157
|
-
}), !1, !0), a(
|
|
161
|
+
}), !1, !0), a(i, o(b, {
|
|
158
162
|
get when() {
|
|
159
163
|
return e.title || e.description;
|
|
160
164
|
},
|
|
161
165
|
get children() {
|
|
162
|
-
var
|
|
163
|
-
return a(
|
|
166
|
+
var r = he(), _ = r.firstChild;
|
|
167
|
+
return a(_, o(b, {
|
|
164
168
|
get when() {
|
|
165
169
|
return e.title;
|
|
166
170
|
},
|
|
167
171
|
get children() {
|
|
168
|
-
var
|
|
169
|
-
return a(
|
|
172
|
+
var d = ge();
|
|
173
|
+
return a(d, () => e.title), N(() => f(d, "id", I())), d;
|
|
170
174
|
}
|
|
171
|
-
}), null), a(
|
|
175
|
+
}), null), a(_, o(b, {
|
|
172
176
|
get when() {
|
|
173
177
|
return e.description;
|
|
174
178
|
},
|
|
175
179
|
get children() {
|
|
176
|
-
var
|
|
177
|
-
return a(
|
|
180
|
+
var d = me();
|
|
181
|
+
return a(d, () => e.description), N(() => f(d, "id", F())), d;
|
|
178
182
|
}
|
|
179
|
-
}), null), a(
|
|
183
|
+
}), null), a(r, o(D, {
|
|
180
184
|
variant: "ghost-destructive",
|
|
181
185
|
size: "icon",
|
|
182
186
|
class: "-my-2 -mr-2 h-[46px] w-[46px] shrink-0 sm:my-0 sm:-mr-1 sm:h-6 sm:w-6",
|
|
183
187
|
onClick: () => e.onOpenChange(!1),
|
|
184
|
-
"aria-label"
|
|
188
|
+
get "aria-label"() {
|
|
189
|
+
return e.closeLabel ?? "Close";
|
|
190
|
+
},
|
|
185
191
|
get children() {
|
|
186
|
-
return
|
|
192
|
+
return o(ne, {
|
|
187
193
|
class: "w-3.5 h-3.5"
|
|
188
194
|
});
|
|
189
195
|
}
|
|
190
|
-
}), null),
|
|
196
|
+
}), null), r;
|
|
191
197
|
}
|
|
192
|
-
}),
|
|
198
|
+
}), C), a(C, () => e.children), a(i, o(b, {
|
|
193
199
|
get when() {
|
|
194
200
|
return e.footer;
|
|
195
201
|
},
|
|
196
202
|
get children() {
|
|
197
|
-
var
|
|
198
|
-
return a(
|
|
203
|
+
var r = be();
|
|
204
|
+
return a(r, () => e.footer), r;
|
|
199
205
|
}
|
|
200
206
|
}), null), t;
|
|
201
207
|
}
|
|
@@ -205,7 +211,7 @@ function _e(e) {
|
|
|
205
211
|
}
|
|
206
212
|
function Te(e) {
|
|
207
213
|
const g = re();
|
|
208
|
-
return
|
|
214
|
+
return o(Ce, {
|
|
209
215
|
get open() {
|
|
210
216
|
return e.open;
|
|
211
217
|
},
|
|
@@ -222,7 +228,7 @@ function Te(e) {
|
|
|
222
228
|
return e.globalZIndex;
|
|
223
229
|
},
|
|
224
230
|
get footer() {
|
|
225
|
-
return [
|
|
231
|
+
return [o(D, {
|
|
226
232
|
variant: "ghost",
|
|
227
233
|
onClick: () => e.onOpenChange(!1),
|
|
228
234
|
get disabled() {
|
|
@@ -231,7 +237,7 @@ function Te(e) {
|
|
|
231
237
|
get children() {
|
|
232
238
|
return e.cancelText ?? g.config.strings.confirmDialog.cancel;
|
|
233
239
|
}
|
|
234
|
-
}),
|
|
240
|
+
}), o(D, {
|
|
235
241
|
get variant() {
|
|
236
242
|
return e.variant === "destructive" ? "destructive" : "primary";
|
|
237
243
|
},
|
|
@@ -247,11 +253,11 @@ function Te(e) {
|
|
|
247
253
|
})];
|
|
248
254
|
},
|
|
249
255
|
get children() {
|
|
250
|
-
return e.children ??
|
|
256
|
+
return e.children ?? ye();
|
|
251
257
|
}
|
|
252
258
|
});
|
|
253
259
|
}
|
|
254
260
|
export {
|
|
255
261
|
Te as ConfirmDialog,
|
|
256
|
-
|
|
262
|
+
Ce as Dialog
|
|
257
263
|
};
|
|
@@ -20,6 +20,8 @@ export interface UseOverlayMaskOptions {
|
|
|
20
20
|
trapFocus?: MaybeAccessor<boolean | undefined>;
|
|
21
21
|
/** Close on Escape and never leak to underlying window handlers (default: always). */
|
|
22
22
|
closeOnEscape?: MaybeAccessor<boolean | OverlayEscapeCloseMode | undefined>;
|
|
23
|
+
/** Opt into bubbling so nested controls can consume Escape; capture preserves existing callers. */
|
|
24
|
+
escapeKeyPhase?: MaybeAccessor<'capture' | 'bubble' | undefined>;
|
|
23
25
|
/** Stop bubbling keydown events to window-level hotkeys (default: true). */
|
|
24
26
|
blockHotkeys?: MaybeAccessor<boolean | undefined>;
|
|
25
27
|
/**
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
import { matchKeybind as
|
|
6
|
-
function
|
|
1
|
+
import { createEffect as N, onCleanup as q } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as j } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as M } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as x, getFirstFocusableElement as z } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as R } from "../utils/keybind.js";
|
|
6
|
+
function C(e) {
|
|
7
7
|
return typeof Node < "u" && e instanceof Node;
|
|
8
8
|
}
|
|
9
9
|
function h(e, o, r) {
|
|
10
|
-
return r ? r(o) : !e || !
|
|
10
|
+
return r ? r(o) : !e || !C(o) ? !1 : e.contains(o);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function O(e, o, r, s) {
|
|
13
13
|
return r === "none" ? !1 : r === "all" ? !0 : !h(e, o, s);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function V(e) {
|
|
16
16
|
return typeof e == "function" ? e() ?? [] : e ?? [];
|
|
17
17
|
}
|
|
18
18
|
function c(e, o) {
|
|
19
19
|
return typeof e == "function" ? e() ?? o : e ?? o;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
for (const r of
|
|
21
|
+
function G(e, o) {
|
|
22
|
+
for (const r of V(o)) {
|
|
23
23
|
const s = r.trim();
|
|
24
|
-
if (s &&
|
|
24
|
+
if (s && R(e, s))
|
|
25
25
|
return !0;
|
|
26
26
|
}
|
|
27
27
|
return !1;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _(e) {
|
|
30
30
|
const o = () => c(e.lockBodyScroll, !0), r = () => c(e.trapFocus, !0), s = () => {
|
|
31
|
-
const a = c(
|
|
31
|
+
const a = c(
|
|
32
|
+
e.closeOnEscape,
|
|
33
|
+
!0
|
|
34
|
+
);
|
|
32
35
|
return a === !1 ? "none" : a === "inside" ? "inside" : a === "none" ? "none" : "always";
|
|
33
|
-
},
|
|
34
|
-
|
|
36
|
+
}, P = () => c(e.blockHotkeys, !0), D = () => c(e.restoreFocus, !0), S = () => c(e.blockWheel, "none"), H = () => c(e.blockTouchMove, "none"), K = () => c(e.autoFocus, !0);
|
|
37
|
+
N(() => {
|
|
35
38
|
if (!e.open() || typeof document > "u") return;
|
|
36
|
-
const a = o(),
|
|
37
|
-
|
|
39
|
+
const a = o(), E = r(), l = s(), f = c(e.escapeKeyPhase, "capture"), W = P(), A = D(), m = S(), v = H(), y = K(), p = document.activeElement instanceof HTMLElement ? document.activeElement : null, I = a ? j({ overflow: "hidden" }) : null;
|
|
40
|
+
M(() => {
|
|
38
41
|
const t = e.root();
|
|
39
|
-
if (!t ||
|
|
40
|
-
const n = typeof
|
|
42
|
+
if (!t || y === !1) return;
|
|
43
|
+
const n = typeof y == "object" ? y.selector : void 0, i = (n ? t.querySelector(n) : null) ?? t.querySelector("[data-floe-autofocus]") ?? z(t) ?? t;
|
|
41
44
|
try {
|
|
42
|
-
|
|
45
|
+
i.focus();
|
|
43
46
|
} catch {
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
|
-
const
|
|
49
|
+
const k = (t) => {
|
|
47
50
|
if (t.key !== "Tab") return;
|
|
48
51
|
const n = e.root();
|
|
49
52
|
if (!n) return;
|
|
50
|
-
const u =
|
|
53
|
+
const u = x(n);
|
|
51
54
|
if (!u.length) {
|
|
52
55
|
t.preventDefault();
|
|
53
56
|
try {
|
|
@@ -56,25 +59,29 @@ function Y(e) {
|
|
|
56
59
|
}
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
|
-
const
|
|
62
|
+
const i = u[0], F = u[u.length - 1], d = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
60
63
|
if (t.shiftKey) {
|
|
61
|
-
if (
|
|
64
|
+
if (d === i || !d || !n.contains(d)) {
|
|
62
65
|
t.preventDefault();
|
|
63
66
|
try {
|
|
64
|
-
|
|
67
|
+
F.focus();
|
|
65
68
|
} catch {
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
} else if (
|
|
71
|
+
} else if (d === F) {
|
|
69
72
|
t.preventDefault();
|
|
70
73
|
try {
|
|
71
|
-
|
|
74
|
+
i.focus();
|
|
72
75
|
} catch {
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
},
|
|
76
|
-
if (t.key !== "Escape" || l === "none") return;
|
|
77
|
-
const n = e.root(), u = h(
|
|
78
|
+
}, b = (t) => {
|
|
79
|
+
if (t.key !== "Escape" || f === "bubble" && (t.defaultPrevented || t.isComposing) || l === "none") return;
|
|
80
|
+
const n = e.root(), u = h(
|
|
81
|
+
n,
|
|
82
|
+
C(t.target) ? t.target : document.activeElement,
|
|
83
|
+
e.containsTarget
|
|
84
|
+
);
|
|
78
85
|
if (l === "inside") {
|
|
79
86
|
if (u) {
|
|
80
87
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
@@ -84,25 +91,38 @@ function Y(e) {
|
|
|
84
91
|
return;
|
|
85
92
|
}
|
|
86
93
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
87
|
-
},
|
|
94
|
+
}, g = (t) => {
|
|
88
95
|
const n = e.root();
|
|
89
|
-
n &&
|
|
96
|
+
n && W && h(n, t.target, e.containsTarget) && (G(t, e.allowHotkeys) || t.stopPropagation());
|
|
90
97
|
}, w = (t) => {
|
|
91
98
|
const n = e.root();
|
|
92
|
-
|
|
93
|
-
}, g = (t) => {
|
|
94
|
-
t.stopPropagation();
|
|
99
|
+
O(n, t.target, m, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
95
100
|
}, L = (t) => {
|
|
101
|
+
t.stopPropagation();
|
|
102
|
+
}, T = (t) => {
|
|
96
103
|
const n = e.root();
|
|
97
|
-
|
|
104
|
+
O(n, t.target, v, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
98
105
|
};
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
E && document.addEventListener("keydown", k, !0);
|
|
107
|
+
const B = f === "capture" ? window : document;
|
|
108
|
+
l !== "none" && B.addEventListener(
|
|
109
|
+
"keydown",
|
|
110
|
+
b,
|
|
111
|
+
f === "capture"
|
|
112
|
+
), document.addEventListener("keydown", g), m !== "none" && (document.addEventListener("wheel", w, { capture: !0, passive: !1 }), document.addEventListener("wheel", L)), v !== "none" && document.addEventListener("touchmove", T, {
|
|
113
|
+
capture: !0,
|
|
114
|
+
passive: !1
|
|
115
|
+
}), q(() => {
|
|
116
|
+
E && document.removeEventListener("keydown", k, !0), l !== "none" && B.removeEventListener(
|
|
117
|
+
"keydown",
|
|
118
|
+
b,
|
|
119
|
+
f === "capture"
|
|
120
|
+
), document.removeEventListener("keydown", g), m !== "none" && (document.removeEventListener("wheel", w, !0), document.removeEventListener("wheel", L)), v !== "none" && document.removeEventListener("touchmove", T, !0), I?.(), A && p && p.isConnected && M(() => {
|
|
101
121
|
if (typeof document > "u") return;
|
|
102
122
|
const t = document.activeElement;
|
|
103
123
|
if (!(t && t !== document.body && t !== document.documentElement))
|
|
104
124
|
try {
|
|
105
|
-
|
|
125
|
+
p.focus();
|
|
106
126
|
} catch {
|
|
107
127
|
}
|
|
108
128
|
});
|
|
@@ -110,5 +130,5 @@ function Y(e) {
|
|
|
110
130
|
});
|
|
111
131
|
}
|
|
112
132
|
export {
|
|
113
|
-
|
|
133
|
+
_ as useOverlayMask
|
|
114
134
|
};
|