@floegence/floe-webapp-core 0.36.12 → 0.36.13
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/file-browser/FileContextMenu.js +263 -225
- package/dist/components/ui/Dialog.js +44 -44
- package/dist/components/ui/Dropdown.js +207 -169
- package/dist/components/ui/dialogSurfaceScope.d.ts +26 -1
- package/dist/components/ui/dialogSurfaceScope.js +81 -28
- package/dist/components/ui/menuUtils.d.ts +21 -2
- package/dist/components/ui/menuUtils.js +73 -43
- package/dist/components/ui/surfacePortalScope.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { setAttribute as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferNonBlocking as
|
|
5
|
-
import { ChevronDown as
|
|
6
|
-
import { focusMenuItem as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { setAttribute as v, insert as f, createComponent as u, Portal as z, use as R, spread as U, mergeProps as H, effect as I, className as E, template as $, memo as K, delegateEvents as V } from "solid-js/web";
|
|
2
|
+
import { createSignal as O, createMemo as X, createEffect as Y, onCleanup as Z, Show as y, Index as W } from "solid-js";
|
|
3
|
+
import { cn as S } from "../../utils/cn.js";
|
|
4
|
+
import { deferNonBlocking as ee } from "../../utils/defer.js";
|
|
5
|
+
import { ChevronDown as te, Check as ne, ChevronRight as re } from "../icons/index.js";
|
|
6
|
+
import { focusMenuItem as P, MENU_ITEM_SELECTOR as oe, moveMenuFocus as N, calculateMenuPosition as ie, calculateSubmenuPosition as ae } from "./menuUtils.js";
|
|
7
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as G } from "./localInteractionSurface.js";
|
|
8
|
+
import { resolveSurfacePortalHost as ue, projectSurfacePortalPosition as le, resolveSurfacePortalBoundaryRect as de, isSurfacePortalMode as ce, resolveSurfacePortalMount as se } from "./dialogSurfaceScope.js";
|
|
9
|
+
var F = /* @__PURE__ */ $("<div>"), fe = /* @__PURE__ */ $("<div><div role=button aria-haspopup=menu data-floe-dropdown-trigger>"), J = /* @__PURE__ */ $('<div class="my-1 h-px bg-border"role=separator>'), me = /* @__PURE__ */ $('<button type=button role=menuitem><span class="w-3.5 h-3.5 flex items-center justify-center"></span><span class="flex-1 text-left">'), ge = /* @__PURE__ */ $("<div class=relative>"), ve = /* @__PURE__ */ $('<span class="w-3.5 h-3.5 flex items-center justify-center">'), be = /* @__PURE__ */ $("<span>");
|
|
10
|
+
let he = 0, we = 0;
|
|
11
|
+
function ye(e, d) {
|
|
10
12
|
switch (e) {
|
|
11
13
|
case "Enter":
|
|
12
14
|
case " ":
|
|
13
|
-
return
|
|
15
|
+
return d.open ? {
|
|
14
16
|
nextOpen: !1
|
|
15
17
|
} : {
|
|
16
18
|
nextOpen: !0,
|
|
17
|
-
focusMode:
|
|
19
|
+
focusMode: d.hasSelection ? "selected" : "first"
|
|
18
20
|
};
|
|
19
21
|
case "ArrowDown":
|
|
20
22
|
return {
|
|
21
23
|
nextOpen: !0,
|
|
22
|
-
focusMode:
|
|
24
|
+
focusMode: d.hasSelection ? "selected" : "first"
|
|
23
25
|
};
|
|
24
26
|
case "ArrowUp":
|
|
25
27
|
return {
|
|
@@ -30,140 +32,159 @@ function fe(e, s) {
|
|
|
30
32
|
return null;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const [
|
|
35
|
+
function xe(e) {
|
|
36
|
+
const [d, c] = O(!1), [s, A] = O({
|
|
35
37
|
x: -9999,
|
|
36
38
|
y: -9999
|
|
37
39
|
});
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
let b, h;
|
|
41
|
+
const m = `floe-dropdown-${he += 1}`, w = `${m}-menu`, k = X(() => d() ? ue() : {
|
|
42
|
+
host: null,
|
|
43
|
+
mode: "global"
|
|
44
|
+
}), a = {
|
|
45
|
+
mount: () => se(k()),
|
|
46
|
+
isSurfaceMode: () => ce(k()),
|
|
47
|
+
boundaryRect: () => de(k()),
|
|
48
|
+
projectPosition: (r) => le(r, k())
|
|
49
|
+
}, M = () => {
|
|
50
|
+
if (!b || !h) return;
|
|
51
|
+
const r = b.getBoundingClientRect(), n = h.getBoundingClientRect(), i = ie(r, n, e.align ?? "start", a.boundaryRect());
|
|
52
|
+
A(i);
|
|
43
53
|
};
|
|
44
|
-
|
|
45
|
-
if (!
|
|
46
|
-
|
|
54
|
+
Y(() => {
|
|
55
|
+
if (!d()) {
|
|
56
|
+
A({
|
|
47
57
|
x: -9999,
|
|
48
58
|
y: -9999
|
|
49
59
|
});
|
|
50
60
|
return;
|
|
51
61
|
}
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
62
|
+
const r = (i) => {
|
|
63
|
+
const t = i.target;
|
|
64
|
+
t && typeof t.closest == "function" && t.closest(`[data-floe-dropdown="${m}"]`) || c(!1);
|
|
65
|
+
}, n = (i) => {
|
|
66
|
+
i.key === "Escape" && (c(!1), requestAnimationFrame(() => b?.focus()));
|
|
57
67
|
};
|
|
58
|
-
document.addEventListener("mousedown",
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
document.removeEventListener("mousedown",
|
|
68
|
+
document.addEventListener("mousedown", r), document.addEventListener("keydown", n), requestAnimationFrame(() => {
|
|
69
|
+
M(), P(h, e.value ? "selected" : "first");
|
|
70
|
+
}), Z(() => {
|
|
71
|
+
document.removeEventListener("mousedown", r), document.removeEventListener("keydown", n);
|
|
62
72
|
});
|
|
63
73
|
});
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
e.disabled || (
|
|
69
|
-
|
|
74
|
+
const _ = (r) => {
|
|
75
|
+
const n = e.onSelect;
|
|
76
|
+
r.keepOpen || c(!1), ee(() => n(r.id));
|
|
77
|
+
}, p = (r, n = "first") => {
|
|
78
|
+
e.disabled || (c(r), requestAnimationFrame(() => {
|
|
79
|
+
M(), P(h, n);
|
|
70
80
|
}));
|
|
71
|
-
},
|
|
81
|
+
}, D = (r) => {
|
|
72
82
|
if (e.disabled) return;
|
|
73
|
-
const
|
|
74
|
-
open:
|
|
83
|
+
const n = ye(r.key, {
|
|
84
|
+
open: d(),
|
|
75
85
|
hasSelection: !!e.value
|
|
76
86
|
});
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
|
|
87
|
+
if (n) {
|
|
88
|
+
if (r.preventDefault(), !n.nextOpen) {
|
|
89
|
+
c(!1);
|
|
80
90
|
return;
|
|
81
91
|
}
|
|
82
|
-
|
|
92
|
+
p(!0, n.focusMode ?? "first");
|
|
83
93
|
}
|
|
84
|
-
}, T = (
|
|
85
|
-
const
|
|
86
|
-
switch (
|
|
94
|
+
}, T = (r) => {
|
|
95
|
+
const n = r.target, i = n?.closest('[role="menu"]'), t = n?.closest(oe);
|
|
96
|
+
switch (r.key) {
|
|
87
97
|
case "ArrowDown":
|
|
88
|
-
|
|
98
|
+
r.preventDefault(), N(i, t, 1);
|
|
89
99
|
return;
|
|
90
100
|
case "ArrowUp":
|
|
91
|
-
|
|
101
|
+
r.preventDefault(), N(i, t, -1);
|
|
92
102
|
return;
|
|
93
103
|
case "Home":
|
|
94
|
-
|
|
104
|
+
r.preventDefault(), P(i, "first");
|
|
95
105
|
return;
|
|
96
106
|
case "End":
|
|
97
|
-
|
|
107
|
+
r.preventDefault(), P(i, "last");
|
|
98
108
|
return;
|
|
99
109
|
case "Tab":
|
|
100
|
-
|
|
110
|
+
c(!1);
|
|
101
111
|
return;
|
|
102
112
|
default:
|
|
103
113
|
return;
|
|
104
114
|
}
|
|
105
115
|
};
|
|
106
116
|
return (() => {
|
|
107
|
-
var
|
|
108
|
-
|
|
117
|
+
var r = fe(), n = r.firstChild;
|
|
118
|
+
v(r, "data-floe-dropdown", m), n.$$keydown = D, n.$$click = () => {
|
|
109
119
|
if (!e.disabled) {
|
|
110
|
-
if (
|
|
111
|
-
|
|
120
|
+
if (d()) {
|
|
121
|
+
c(!1);
|
|
112
122
|
return;
|
|
113
123
|
}
|
|
114
|
-
|
|
124
|
+
p(!0, e.value ? "selected" : "first");
|
|
115
125
|
}
|
|
116
126
|
};
|
|
117
|
-
var
|
|
118
|
-
return typeof
|
|
127
|
+
var i = b;
|
|
128
|
+
return typeof i == "function" ? R(i, n) : b = n, v(n, "aria-controls", w), f(n, () => e.trigger), f(r, u(y, {
|
|
119
129
|
get when() {
|
|
120
|
-
return
|
|
130
|
+
return d();
|
|
121
131
|
},
|
|
122
132
|
get children() {
|
|
123
|
-
return
|
|
133
|
+
return u(z, {
|
|
134
|
+
get mount() {
|
|
135
|
+
return a.mount();
|
|
136
|
+
},
|
|
124
137
|
get children() {
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
var t = F(), g = h;
|
|
139
|
+
return typeof g == "function" ? R(g, t) : h = t, v(t, "data-floe-dropdown", m), U(t, H({
|
|
140
|
+
get class() {
|
|
141
|
+
return S(a.isSurfaceMode() ? "absolute z-20 min-w-36 py-0.5" : "fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-top-2");
|
|
142
|
+
}
|
|
143
|
+
}, () => ({
|
|
144
|
+
[G]: a.isSurfaceMode() ? "true" : void 0
|
|
145
|
+
}), {
|
|
146
|
+
get style() {
|
|
147
|
+
return {
|
|
148
|
+
left: `${a.projectPosition(s()).x}px`,
|
|
149
|
+
top: `${a.projectPosition(s()).y}px`
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
role: "menu",
|
|
153
|
+
id: w,
|
|
154
|
+
onKeyDown: T
|
|
155
|
+
}), !1, !0), f(t, u(W, {
|
|
129
156
|
get each() {
|
|
130
157
|
return e.items;
|
|
131
158
|
},
|
|
132
|
-
children: (
|
|
159
|
+
children: (l) => u(y, {
|
|
133
160
|
get when() {
|
|
134
|
-
return !
|
|
161
|
+
return !l().separator;
|
|
135
162
|
},
|
|
136
163
|
get fallback() {
|
|
137
|
-
return
|
|
164
|
+
return J();
|
|
138
165
|
},
|
|
139
166
|
get children() {
|
|
140
|
-
return
|
|
167
|
+
return u(Q, {
|
|
141
168
|
get item() {
|
|
142
|
-
return
|
|
169
|
+
return l();
|
|
143
170
|
},
|
|
144
171
|
get selected() {
|
|
145
|
-
return e.value ===
|
|
172
|
+
return e.value === l().id;
|
|
146
173
|
},
|
|
147
|
-
onSelect:
|
|
148
|
-
onCloseMenu: () =>
|
|
149
|
-
dropdownId:
|
|
174
|
+
onSelect: _,
|
|
175
|
+
onCloseMenu: () => c(!1),
|
|
176
|
+
dropdownId: m,
|
|
177
|
+
portalLayout: a
|
|
150
178
|
});
|
|
151
179
|
}
|
|
152
180
|
})
|
|
153
|
-
})),
|
|
154
|
-
var w = C("fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-top-2"), i = `${c().x}px`, b = `${c().y}px`;
|
|
155
|
-
return w !== t.e && M(n, t.e = w), i !== t.t && q(n, "left", t.t = i), b !== t.a && q(n, "top", t.a = b), t;
|
|
156
|
-
}, {
|
|
157
|
-
e: void 0,
|
|
158
|
-
t: void 0,
|
|
159
|
-
a: void 0
|
|
160
|
-
}), n;
|
|
181
|
+
})), t;
|
|
161
182
|
}
|
|
162
183
|
});
|
|
163
184
|
}
|
|
164
|
-
}), null),
|
|
165
|
-
var g =
|
|
166
|
-
return g !==
|
|
185
|
+
}), null), I((t) => {
|
|
186
|
+
var g = S("relative inline-block", e.class), l = S("cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", e.triggerClass, e.disabled && "pointer-events-none opacity-50"), C = e.disabled ? -1 : 0, o = d(), x = e.triggerAriaLabel, L = e.disabled ? "true" : void 0;
|
|
187
|
+
return g !== t.e && E(r, t.e = g), l !== t.t && E(n, t.t = l), C !== t.a && v(n, "tabindex", t.a = C), o !== t.o && v(n, "aria-expanded", t.o = o), x !== t.i && v(n, "aria-label", t.i = x), L !== t.n && v(n, "aria-disabled", t.n = L), t;
|
|
167
188
|
}, {
|
|
168
189
|
e: void 0,
|
|
169
190
|
t: void 0,
|
|
@@ -171,94 +192,94 @@ function me(e) {
|
|
|
171
192
|
o: void 0,
|
|
172
193
|
i: void 0,
|
|
173
194
|
n: void 0
|
|
174
|
-
}),
|
|
195
|
+
}), r;
|
|
175
196
|
})();
|
|
176
197
|
}
|
|
177
|
-
function
|
|
178
|
-
const [
|
|
198
|
+
function Q(e) {
|
|
199
|
+
const [d, c] = O(!1), [s, A] = O({
|
|
179
200
|
x: -9999,
|
|
180
201
|
y: -9999
|
|
181
202
|
});
|
|
182
|
-
let
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
185
|
-
const n =
|
|
186
|
-
|
|
203
|
+
let b, h, m, w;
|
|
204
|
+
const k = `floe-dropdown-item-${we += 1}`, a = () => e.item.children && e.item.children.length > 0, M = () => {
|
|
205
|
+
if (!b || !m) return;
|
|
206
|
+
const n = b.getBoundingClientRect(), i = m.getBoundingClientRect(), t = ae(n, i, e.portalLayout.boundaryRect());
|
|
207
|
+
A(t);
|
|
187
208
|
}, _ = () => {
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
a() && (clearTimeout(w), w = setTimeout(() => {
|
|
210
|
+
c(!0), requestAnimationFrame(M);
|
|
190
211
|
}, 100));
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
|
|
212
|
+
}, p = () => {
|
|
213
|
+
a() && (clearTimeout(w), w = void 0, !e.item.keepOpen && (w = setTimeout(() => {
|
|
214
|
+
c(!1);
|
|
194
215
|
}, 150)));
|
|
195
|
-
},
|
|
216
|
+
}, D = (n) => {
|
|
196
217
|
if (!e.item.disabled) {
|
|
197
218
|
if (e.item.content && e.item.keepOpen) {
|
|
198
219
|
n.stopPropagation();
|
|
199
220
|
return;
|
|
200
221
|
}
|
|
201
|
-
|
|
222
|
+
a() ? (c((i) => !i), requestAnimationFrame(M)) : e.item.content || e.onSelect(e.item);
|
|
202
223
|
}
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
224
|
+
}, T = (n = "first") => {
|
|
225
|
+
a() && (c(!0), requestAnimationFrame(() => {
|
|
226
|
+
M(), P(m, n);
|
|
206
227
|
}));
|
|
207
|
-
},
|
|
208
|
-
|
|
228
|
+
}, r = () => {
|
|
229
|
+
c(!1), requestAnimationFrame(() => h?.focus());
|
|
209
230
|
};
|
|
210
231
|
return (() => {
|
|
211
|
-
var n =
|
|
212
|
-
n.addEventListener("mouseleave",
|
|
213
|
-
var
|
|
214
|
-
return typeof
|
|
232
|
+
var n = ge();
|
|
233
|
+
n.addEventListener("mouseleave", p), n.addEventListener("mouseenter", _);
|
|
234
|
+
var i = b;
|
|
235
|
+
return typeof i == "function" ? R(i, n) : b = n, f(n, u(y, {
|
|
215
236
|
get when() {
|
|
216
237
|
return e.item.content;
|
|
217
238
|
},
|
|
218
239
|
get children() {
|
|
219
|
-
var t =
|
|
220
|
-
return t.$$click =
|
|
240
|
+
var t = F();
|
|
241
|
+
return t.$$click = D, f(t, e.item.content), I(() => E(t, S("w-full px-2 py-1.5", e.item.disabled && "opacity-50 pointer-events-none"))), t;
|
|
221
242
|
}
|
|
222
|
-
}), null), f(n,
|
|
243
|
+
}), null), f(n, u(y, {
|
|
223
244
|
get when() {
|
|
224
245
|
return !e.item.content;
|
|
225
246
|
},
|
|
226
247
|
get children() {
|
|
227
|
-
var t =
|
|
228
|
-
t.$$keydown = (
|
|
229
|
-
e.item.disabled ||
|
|
230
|
-
}, t.$$click =
|
|
231
|
-
var
|
|
232
|
-
return typeof
|
|
248
|
+
var t = me(), g = t.firstChild, l = g.nextSibling;
|
|
249
|
+
t.$$keydown = (o) => {
|
|
250
|
+
e.item.disabled || a() && ((o.key === "ArrowRight" || o.key === "Enter" || o.key === " ") && (o.preventDefault(), T("first")), o.key === "ArrowLeft" && (o.preventDefault(), r()));
|
|
251
|
+
}, t.$$click = D;
|
|
252
|
+
var C = h;
|
|
253
|
+
return typeof C == "function" ? R(C, t) : h = t, v(t, "id", k), f(g, u(y, {
|
|
233
254
|
get when() {
|
|
234
|
-
return K(() => !!e.selected)() && !
|
|
255
|
+
return K(() => !!e.selected)() && !a();
|
|
235
256
|
},
|
|
236
257
|
get children() {
|
|
237
|
-
return
|
|
258
|
+
return u(ne, {
|
|
238
259
|
class: "w-3 h-3"
|
|
239
260
|
});
|
|
240
261
|
}
|
|
241
|
-
})), f(t,
|
|
262
|
+
})), f(t, u(y, {
|
|
242
263
|
get when() {
|
|
243
264
|
return e.item.icon;
|
|
244
265
|
},
|
|
245
266
|
keyed: !0,
|
|
246
|
-
children: (
|
|
247
|
-
var
|
|
248
|
-
return f(
|
|
267
|
+
children: (o) => (() => {
|
|
268
|
+
var x = ve();
|
|
269
|
+
return f(x, o), x;
|
|
249
270
|
})()
|
|
250
|
-
}),
|
|
271
|
+
}), l), f(l, () => e.item.label), f(t, u(y, {
|
|
251
272
|
get when() {
|
|
252
|
-
return
|
|
273
|
+
return a();
|
|
253
274
|
},
|
|
254
275
|
get children() {
|
|
255
|
-
return
|
|
276
|
+
return u(re, {
|
|
256
277
|
class: "w-3 h-3 text-muted-foreground"
|
|
257
278
|
});
|
|
258
279
|
}
|
|
259
|
-
}), null),
|
|
260
|
-
var
|
|
261
|
-
return
|
|
280
|
+
}), null), I((o) => {
|
|
281
|
+
var x = S("w-full flex items-center gap-1.5 px-2 py-1 text-xs", "transition-colors duration-75", "focus:outline-none focus:bg-accent", e.item.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-accent cursor-pointer"), L = e.item.disabled, j = a() ? "menu" : void 0, q = a() ? d() : void 0, B = e.selected && !a() ? "true" : void 0;
|
|
282
|
+
return x !== o.e && E(t, o.e = x), L !== o.t && (t.disabled = o.t = L), j !== o.a && v(t, "aria-haspopup", o.a = j), q !== o.o && v(t, "aria-expanded", o.o = q), B !== o.i && v(t, "data-floe-selected", o.i = B), o;
|
|
262
283
|
}, {
|
|
263
284
|
e: void 0,
|
|
264
285
|
t: void 0,
|
|
@@ -267,35 +288,57 @@ function G(e) {
|
|
|
267
288
|
i: void 0
|
|
268
289
|
}), t;
|
|
269
290
|
}
|
|
270
|
-
}), null), f(n,
|
|
291
|
+
}), null), f(n, u(y, {
|
|
271
292
|
get when() {
|
|
272
|
-
return K(() => !!
|
|
293
|
+
return K(() => !!d())() && a();
|
|
273
294
|
},
|
|
274
295
|
get children() {
|
|
275
|
-
return
|
|
296
|
+
return u(z, {
|
|
297
|
+
get mount() {
|
|
298
|
+
return e.portalLayout.mount();
|
|
299
|
+
},
|
|
276
300
|
get children() {
|
|
277
|
-
var t =
|
|
278
|
-
t
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
301
|
+
var t = F(), g = m;
|
|
302
|
+
return typeof g == "function" ? R(g, t) : m = t, U(t, H({
|
|
303
|
+
get class() {
|
|
304
|
+
return S(e.portalLayout.isSurfaceMode() ? "absolute z-20 min-w-36 py-0.5" : "fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-left-1");
|
|
305
|
+
},
|
|
306
|
+
get "data-floe-dropdown"() {
|
|
307
|
+
return e.dropdownId;
|
|
308
|
+
}
|
|
309
|
+
}, () => ({
|
|
310
|
+
[G]: e.portalLayout.isSurfaceMode() ? "true" : void 0
|
|
311
|
+
}), {
|
|
312
|
+
get style() {
|
|
313
|
+
return {
|
|
314
|
+
left: `${e.portalLayout.projectPosition(s()).x}px`,
|
|
315
|
+
top: `${e.portalLayout.projectPosition(s()).y}px`
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
role: "menu",
|
|
319
|
+
"aria-labelledby": k,
|
|
320
|
+
onMouseEnter: () => {
|
|
321
|
+
clearTimeout(w);
|
|
322
|
+
},
|
|
323
|
+
onMouseLeave: p,
|
|
324
|
+
onKeyDown: (l) => {
|
|
325
|
+
l.key !== "ArrowLeft" && l.key !== "Escape" || (l.preventDefault(), l.stopPropagation(), r());
|
|
326
|
+
}
|
|
327
|
+
}), !1, !0), f(t, u(W, {
|
|
285
328
|
get each() {
|
|
286
329
|
return e.item.children;
|
|
287
330
|
},
|
|
288
|
-
children: (
|
|
331
|
+
children: (l) => u(y, {
|
|
289
332
|
get when() {
|
|
290
|
-
return !
|
|
333
|
+
return !l().separator;
|
|
291
334
|
},
|
|
292
335
|
get fallback() {
|
|
293
|
-
return
|
|
336
|
+
return J();
|
|
294
337
|
},
|
|
295
338
|
get children() {
|
|
296
|
-
return
|
|
339
|
+
return u(Q, {
|
|
297
340
|
get item() {
|
|
298
|
-
return
|
|
341
|
+
return l();
|
|
299
342
|
},
|
|
300
343
|
selected: !1,
|
|
301
344
|
get onSelect() {
|
|
@@ -306,44 +349,39 @@ function G(e) {
|
|
|
306
349
|
},
|
|
307
350
|
get dropdownId() {
|
|
308
351
|
return e.dropdownId;
|
|
352
|
+
},
|
|
353
|
+
get portalLayout() {
|
|
354
|
+
return e.portalLayout;
|
|
309
355
|
}
|
|
310
356
|
});
|
|
311
357
|
}
|
|
312
358
|
})
|
|
313
|
-
})),
|
|
314
|
-
var b = C("fixed z-50 min-w-36 py-0.5", "bg-popover text-popover-foreground", "rounded border border-border shadow-md", "animate-in fade-in slide-in-from-left-1"), a = e.dropdownId, S = `${c().x}px`, I = `${c().y}px`;
|
|
315
|
-
return b !== i.e && M(t, i.e = b), a !== i.t && m(t, "data-floe-dropdown", i.t = a), S !== i.a && q(t, "left", i.a = S), I !== i.o && q(t, "top", i.o = I), i;
|
|
316
|
-
}, {
|
|
317
|
-
e: void 0,
|
|
318
|
-
t: void 0,
|
|
319
|
-
a: void 0,
|
|
320
|
-
o: void 0
|
|
321
|
-
}), t;
|
|
359
|
+
})), t;
|
|
322
360
|
}
|
|
323
361
|
});
|
|
324
362
|
}
|
|
325
363
|
}), null), n;
|
|
326
364
|
})();
|
|
327
365
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
id:
|
|
331
|
-
label:
|
|
366
|
+
function Re(e) {
|
|
367
|
+
const d = () => e.options.find((s) => s.value === e.value), c = () => e.options.map((s) => ({
|
|
368
|
+
id: s.value,
|
|
369
|
+
label: s.label
|
|
332
370
|
}));
|
|
333
|
-
return
|
|
371
|
+
return u(xe, {
|
|
334
372
|
get triggerClass() {
|
|
335
|
-
return
|
|
373
|
+
return S("flex items-center justify-between gap-2 h-8 px-2.5 w-full", "rounded border border-input bg-background text-xs shadow-sm", "transition-colors duration-100", e.class);
|
|
336
374
|
},
|
|
337
375
|
get trigger() {
|
|
338
376
|
return [(() => {
|
|
339
|
-
var
|
|
340
|
-
return f(
|
|
341
|
-
})(),
|
|
377
|
+
var s = be();
|
|
378
|
+
return f(s, () => d()?.label ?? e.placeholder ?? "Select..."), I(() => E(s, S("truncate", !d() && "text-muted-foreground"))), s;
|
|
379
|
+
})(), u(te, {
|
|
342
380
|
class: "w-3.5 h-3.5 text-muted-foreground"
|
|
343
381
|
})];
|
|
344
382
|
},
|
|
345
383
|
get items() {
|
|
346
|
-
return
|
|
384
|
+
return c();
|
|
347
385
|
},
|
|
348
386
|
get value() {
|
|
349
387
|
return e.value;
|
|
@@ -356,9 +394,9 @@ function xe(e) {
|
|
|
356
394
|
}
|
|
357
395
|
});
|
|
358
396
|
}
|
|
359
|
-
|
|
397
|
+
V(["click", "keydown"]);
|
|
360
398
|
export {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
399
|
+
xe as Dropdown,
|
|
400
|
+
Re as Select,
|
|
401
|
+
ye as resolveDropdownTriggerKeyAction
|
|
364
402
|
};
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
export declare const DIALOG_SURFACE_HOST_ATTR = "data-floe-dialog-surface-host";
|
|
2
|
+
export declare const SURFACE_PORTAL_HOST_ATTR = "data-floe-dialog-surface-host";
|
|
2
3
|
export declare const DIALOG_SURFACE_BOUNDARY_ATTR = "data-floe-dialog-surface-boundary";
|
|
3
4
|
export type DialogSurfaceInteractionSnapshot = Readonly<{
|
|
4
5
|
target: Element | null;
|
|
5
6
|
activeElement: Element | null;
|
|
6
7
|
recordedAt: number;
|
|
7
8
|
}>;
|
|
9
|
+
export type SurfacePortalInteractionSnapshot = DialogSurfaceInteractionSnapshot;
|
|
10
|
+
export type SurfacePortalMode = 'global' | 'surface';
|
|
8
11
|
export type ResolvedDialogSurfaceHost = Readonly<{
|
|
9
12
|
host: HTMLElement | null;
|
|
10
|
-
mode:
|
|
13
|
+
mode: SurfacePortalMode;
|
|
14
|
+
}>;
|
|
15
|
+
export type ResolvedSurfacePortalHost = ResolvedDialogSurfaceHost;
|
|
16
|
+
export type SurfacePortalBoundaryRect = Readonly<{
|
|
17
|
+
left: number;
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
11
23
|
}>;
|
|
12
24
|
export declare function ensureDialogSurfaceInteractionTracking(): void;
|
|
25
|
+
export declare function ensureSurfacePortalInteractionTracking(): void;
|
|
13
26
|
export declare function resolveDialogSurfaceHost(): ResolvedDialogSurfaceHost;
|
|
27
|
+
export declare function resolveSurfacePortalHost(): ResolvedSurfacePortalHost;
|
|
28
|
+
export declare function isSurfacePortalMode(surfaceHost: ResolvedSurfacePortalHost): boolean;
|
|
29
|
+
export declare function resolveSurfacePortalMount(surfaceHost: ResolvedSurfacePortalHost): HTMLElement | undefined;
|
|
30
|
+
export declare function resolveSurfacePortalBoundaryRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
31
|
+
export declare function projectSurfacePortalPosition(position: Readonly<{
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}>, surfaceHost: ResolvedSurfacePortalHost): Readonly<{
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
}>;
|
|
14
38
|
export declare function __resetDialogSurfaceScopeForTests(): void;
|
|
39
|
+
export declare function __resetSurfacePortalScopeForTests(): void;
|