@floegence/floe-webapp-core 0.51.0 → 0.52.1
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/components/ui/Dialog.d.ts +7 -0
- package/dist/components/ui/Dialog.js +160 -114
- package/dist/components/ui/Dropdown.js +192 -172
- package/dist/floe.css +31 -0
- package/dist/hooks/useOverlayMask.js +95 -83
- package/dist/styles.css +1 -1
- package/dist/surface.css +2 -2
- package/package.json +1 -1
package/dist/floe.css
CHANGED
|
@@ -490,6 +490,37 @@
|
|
|
490
490
|
--floe-floating-exit-scale: 0.985;
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
+
.floe-bottom-drawer-overlay {
|
|
494
|
+
padding: max(1.25rem, env(safe-area-inset-top, 0px))
|
|
495
|
+
max(1.5rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px))
|
|
496
|
+
max(1.5rem, env(safe-area-inset-left, 0px));
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.floe-bottom-drawer-backdrop {
|
|
500
|
+
background: color-mix(in srgb, var(--foreground) 8%, transparent);
|
|
501
|
+
--floe-floating-enter-duration: 240ms;
|
|
502
|
+
--floe-floating-exit-duration: 180ms;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.floe-bottom-drawer-panel {
|
|
506
|
+
--floe-floating-enter-duration: 240ms;
|
|
507
|
+
--floe-floating-exit-duration: 180ms;
|
|
508
|
+
--floe-floating-enter-y: calc(100% + 1.25rem);
|
|
509
|
+
--floe-floating-exit-y: calc(100% + 1.25rem);
|
|
510
|
+
--floe-floating-enter-scale: 1;
|
|
511
|
+
--floe-floating-exit-scale: 1;
|
|
512
|
+
border-radius: 1rem;
|
|
513
|
+
overflow: hidden;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
@media (max-width: 639px) {
|
|
517
|
+
.floe-bottom-drawer-overlay {
|
|
518
|
+
padding: max(0.75rem, env(safe-area-inset-top, 0px))
|
|
519
|
+
max(0.75rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px))
|
|
520
|
+
max(0.75rem, env(safe-area-inset-left, 0px));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
493
524
|
.floe-floating-menu {
|
|
494
525
|
--floe-floating-enter-duration: 120ms;
|
|
495
526
|
--floe-floating-exit-duration: 100ms;
|
|
@@ -1,128 +1,140 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
import { matchKeybind as
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createEffect as R, onCleanup as V } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as G } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as D } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as J, getFirstFocusableElement as Q } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as U } from "../utils/keybind.js";
|
|
6
|
+
const S = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function K(t) {
|
|
8
|
+
return typeof Node < "u" && t instanceof Node;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
return r ? r(o) : !
|
|
10
|
+
function p(t, o, r) {
|
|
11
|
+
return r ? r(o) : !t || !K(o) ? !1 : t.contains(o);
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
return r === "none" ? !1 : r === "all" ? !0 : !
|
|
13
|
+
function H(t, o, r, a) {
|
|
14
|
+
return r === "none" ? !1 : r === "all" ? !0 : !p(t, o, a);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
return typeof
|
|
16
|
+
function X(t) {
|
|
17
|
+
return typeof t == "function" ? t() ?? [] : t ?? [];
|
|
17
18
|
}
|
|
18
|
-
function c(
|
|
19
|
-
return typeof
|
|
19
|
+
function c(t, o) {
|
|
20
|
+
return typeof t == "function" ? t() ?? o : t ?? o;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
for (const r of
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
22
|
+
function Y(t, o) {
|
|
23
|
+
for (const r of X(o)) {
|
|
24
|
+
const a = r.trim();
|
|
25
|
+
if (a && U(t, a))
|
|
25
26
|
return !0;
|
|
26
27
|
}
|
|
27
28
|
return !1;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
const o = () => c(
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
function oe(t) {
|
|
31
|
+
const o = () => c(t.lockBodyScroll, !0), r = () => c(t.trapFocus, !0), a = () => {
|
|
32
|
+
const i = c(
|
|
33
|
+
t.closeOnEscape,
|
|
33
34
|
!0
|
|
34
35
|
);
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
if (!
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
return i === !1 ? "none" : i === "inside" ? "inside" : i === "none" ? "none" : "always";
|
|
37
|
+
}, W = () => c(t.blockHotkeys, !0), A = () => c(t.restoreFocus, !0), x = () => c(t.blockWheel, "none"), I = () => c(t.blockTouchMove, "none"), N = () => c(t.autoFocus, !0);
|
|
38
|
+
R(() => {
|
|
39
|
+
if (!t.open() || typeof document > "u") return;
|
|
40
|
+
const i = o(), b = r(), d = a(), m = c(t.escapeKeyPhase, "capture"), q = W(), j = A(), h = x(), k = I(), E = N(), l = S.get(document) ?? [];
|
|
41
|
+
S.set(document, l);
|
|
42
|
+
const v = {
|
|
43
|
+
global: i || d === "always",
|
|
44
|
+
contains: (e) => p(t.root(), e, t.containsTarget)
|
|
45
|
+
};
|
|
46
|
+
l.push(v);
|
|
47
|
+
let w = !0;
|
|
48
|
+
const u = (e) => w && !l.slice(l.indexOf(v) + 1).some((n) => n.global || n.contains(e)), g = document.activeElement instanceof HTMLElement ? document.activeElement : null, z = i ? G({ overflow: "hidden" }) : null;
|
|
49
|
+
D(() => {
|
|
50
|
+
const e = t.root();
|
|
51
|
+
if (!e?.isConnected || !u(e) || E === !1 || v.contains(document.activeElement)) return;
|
|
52
|
+
const n = typeof E == "object" ? E.selector : void 0, y = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? Q(e) ?? e;
|
|
44
53
|
try {
|
|
45
|
-
|
|
54
|
+
y.focus();
|
|
46
55
|
} catch {
|
|
47
56
|
}
|
|
48
57
|
});
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const n =
|
|
58
|
+
const T = (e) => {
|
|
59
|
+
if (e.key !== "Tab" || !u(e.target)) return;
|
|
60
|
+
const n = t.root();
|
|
52
61
|
if (!n) return;
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
|
|
62
|
+
const s = J(n);
|
|
63
|
+
if (!s.length) {
|
|
64
|
+
e.preventDefault();
|
|
56
65
|
try {
|
|
57
66
|
n.focus();
|
|
58
67
|
} catch {
|
|
59
68
|
}
|
|
60
69
|
return;
|
|
61
70
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
65
|
-
|
|
71
|
+
const y = s[0], P = s[s.length - 1], f = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
72
|
+
if (e.shiftKey) {
|
|
73
|
+
if (f === y || !f || !n.contains(f)) {
|
|
74
|
+
e.preventDefault();
|
|
66
75
|
try {
|
|
67
|
-
|
|
76
|
+
P.focus();
|
|
68
77
|
} catch {
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
|
-
} else if (
|
|
72
|
-
|
|
80
|
+
} else if (f === P || !f || !n.contains(f)) {
|
|
81
|
+
e.preventDefault();
|
|
73
82
|
try {
|
|
74
|
-
|
|
83
|
+
y.focus();
|
|
75
84
|
} catch {
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
80
|
-
const n =
|
|
87
|
+
}, L = (e) => {
|
|
88
|
+
if (e.key !== "Escape" || !u(e.target) || m === "bubble" && (e.defaultPrevented || e.isComposing) || d === "none") return;
|
|
89
|
+
const n = t.root(), s = p(
|
|
81
90
|
n,
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
K(e.target) ? e.target : document.activeElement,
|
|
92
|
+
t.containsTarget
|
|
84
93
|
);
|
|
85
|
-
if (
|
|
86
|
-
if (
|
|
87
|
-
|
|
94
|
+
if (d === "inside") {
|
|
95
|
+
if (s) {
|
|
96
|
+
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
88
97
|
return;
|
|
89
98
|
}
|
|
90
|
-
|
|
99
|
+
t.onEscapeOutside && (e.preventDefault(), e.stopImmediatePropagation(), t.onEscapeOutside());
|
|
91
100
|
return;
|
|
92
101
|
}
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
t.
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
103
|
+
}, M = (e) => {
|
|
104
|
+
if (!u(e.target)) return;
|
|
105
|
+
const n = t.root();
|
|
106
|
+
n && q && p(n, e.target, t.containsTarget) && (Y(e, t.allowHotkeys) || e.stopPropagation());
|
|
107
|
+
}, O = (e) => {
|
|
108
|
+
if (!u(e.target)) return;
|
|
109
|
+
const n = t.root();
|
|
110
|
+
H(n, e.target, h, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
111
|
+
}, B = (e) => {
|
|
112
|
+
u(e.target) && e.stopPropagation();
|
|
113
|
+
}, F = (e) => {
|
|
114
|
+
if (!u(e.target)) return;
|
|
115
|
+
const n = t.root();
|
|
116
|
+
H(n, e.target, k, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
105
117
|
};
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
118
|
+
b && document.addEventListener("keydown", T, !0);
|
|
119
|
+
const C = m === "capture" ? window : document;
|
|
120
|
+
d !== "none" && C.addEventListener(
|
|
109
121
|
"keydown",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
), document.addEventListener("keydown",
|
|
122
|
+
L,
|
|
123
|
+
m === "capture"
|
|
124
|
+
), document.addEventListener("keydown", M), h !== "none" && (document.addEventListener("wheel", O, { capture: !0, passive: !1 }), document.addEventListener("wheel", B)), k !== "none" && document.addEventListener("touchmove", F, {
|
|
113
125
|
capture: !0,
|
|
114
126
|
passive: !1
|
|
115
|
-
}),
|
|
116
|
-
|
|
127
|
+
}), V(() => {
|
|
128
|
+
w = !1, l.splice(l.indexOf(v), 1), b && document.removeEventListener("keydown", T, !0), d !== "none" && C.removeEventListener(
|
|
117
129
|
"keydown",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
), document.removeEventListener("keydown",
|
|
130
|
+
L,
|
|
131
|
+
m === "capture"
|
|
132
|
+
), document.removeEventListener("keydown", M), h !== "none" && (document.removeEventListener("wheel", O, !0), document.removeEventListener("wheel", B)), k !== "none" && document.removeEventListener("touchmove", F, !0), z?.(), j && g && g.isConnected && D(() => {
|
|
121
133
|
if (typeof document > "u") return;
|
|
122
|
-
const
|
|
123
|
-
if (!(
|
|
134
|
+
const e = document.activeElement;
|
|
135
|
+
if (!(e && e !== document.body && e !== document.documentElement))
|
|
124
136
|
try {
|
|
125
|
-
|
|
137
|
+
g.focus();
|
|
126
138
|
} catch {
|
|
127
139
|
}
|
|
128
140
|
});
|
|
@@ -130,5 +142,5 @@ function _(e) {
|
|
|
130
142
|
});
|
|
131
143
|
}
|
|
132
144
|
export {
|
|
133
|
-
|
|
145
|
+
oe as useOverlayMask
|
|
134
146
|
};
|