@floegence/floe-webapp-core 0.91.5 → 0.93.0
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/PromptCard.d.ts +7 -2
- package/dist/components/ui/PromptCard.js +152 -123
- package/dist/components/ui/Select.d.ts +10 -0
- package/dist/components/ui/Select.js +294 -220
- package/dist/components/ui/floatingPresence.js +50 -45
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/floe.css +10 -11
- package/dist/full.js +294 -293
- package/dist/styles.css +1 -1
- package/dist/ui.js +148 -147
- package/package.json +1 -1
|
@@ -1,93 +1,112 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { createComponent as g, mergeProps as K, insert as s, spread as ue, memo as H, effect as E, use as G, setAttribute as v, className as se, template as y, delegateEvents as Ce } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as ke, createSignal as B, createMemo as de, createEffect as J, onCleanup as ce, onMount as Le, Show as V, For as j } from "solid-js";
|
|
3
|
+
import { cn as X } from "../../utils/cn.js";
|
|
4
|
+
import { getFocusableElements as Ve } from "../../utils/focus.js";
|
|
5
|
+
import { useFloeLocale as $e } from "../../context/LocaleContext.js";
|
|
6
|
+
import { useOverlayMask as Oe } from "../../hooks/useOverlayMask.js";
|
|
7
|
+
import { SurfaceFloatingLayer as Ee } from "./SurfaceFloatingLayer.js";
|
|
8
|
+
import { createFloatingPresence as Se } from "./floatingPresence.js";
|
|
9
|
+
import { calculateMenuPosition as De } from "./menuUtils.js";
|
|
10
|
+
import { useFormControl as Ie, joinAriaIds as Pe } from "./formFieldContext.js";
|
|
11
|
+
import { createControllableValue as Q } from "./controllable.js";
|
|
12
|
+
import { ChevronDown as Te, Check as _e } from "../icons/index.js";
|
|
13
|
+
import { resolveSurfacePortalBoundaryRect as qe, resolveSurfacePortalHost as Fe } from "./dialogSurfaceScope.js";
|
|
14
|
+
var Ae = /* @__PURE__ */ y("<input>"), Re = /* @__PURE__ */ y("<option value>"), Be = /* @__PURE__ */ y('<div class=p-1><input type=search class="floe-field w-full min-w-0 px-2 h-[var(--floe-control-height-sm)] text-[length:var(--floe-type-control)]"autocomplete=off>'), Ke = /* @__PURE__ */ y('<div role=status class="px-2 py-2 text-caption">'), Me = /* @__PURE__ */ y("<button type=button>"), ze = /* @__PURE__ */ y('<div role=alert class="p-2 text-error">'), He = /* @__PURE__ */ y('<div role=status class="p-2 text-caption">'), je = /* @__PURE__ */ y('<div data-floe-surface=floating><div role=listbox class="max-h-64 overflow-y-auto"data-floe-local-interaction-surface=true>'), Qe = /* @__PURE__ */ y('<div class="relative min-w-0"><select tabindex=-1 aria-hidden=true class="sr-only pointer-events-none">'), Ne = /* @__PURE__ */ y("<button><span class=truncate>"), Ue = /* @__PURE__ */ y("<option selected>"), We = /* @__PURE__ */ y("<option>"), Ge = /* @__PURE__ */ y('<div class="floe-select-group-label px-2 pt-2 pb-1 text-caption font-semibold text-muted-foreground">'), Je = /* @__PURE__ */ y("<div>"), Xe = /* @__PURE__ */ y('<div role=option><span class="floe-select-option-check h-3.5 w-3.5 shrink-0">');
|
|
15
|
+
function Y(e) {
|
|
16
|
+
const h = $e(), w = Ie(), k = ke(), Z = () => e.id ?? w.id ?? "select-" + k, S = "options-" + k, _ = () => e.disabled ?? w.disabled, q = () => e.readOnly ?? w.readOnly, [x, fe] = Q({
|
|
16
17
|
value: () => e.open,
|
|
17
18
|
defaultValue: e.defaultOpen ?? !1,
|
|
18
19
|
onChange: (t) => e.onOpenChange?.(t)
|
|
19
|
-
}), [M,
|
|
20
|
+
}), [M, N] = B(""), [$, D] = B(-1), [ve, ge] = B({
|
|
20
21
|
x: 0,
|
|
21
22
|
y: 0
|
|
22
|
-
}), [
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
open:
|
|
26
|
-
element: () =>
|
|
27
|
-
}), [
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
if (!e.searchable || e.filter === !1 || !M()) return e.options;
|
|
31
|
-
const t = M().toLocaleLowerCase(
|
|
32
|
-
return e.options.filter((
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
}), [he, me] = B(200);
|
|
24
|
+
let b, F, I, O, z;
|
|
25
|
+
const T = Se({
|
|
26
|
+
open: x,
|
|
27
|
+
element: () => O
|
|
28
|
+
}), [be, ye] = B("bottom");
|
|
29
|
+
let U = "", p = 0;
|
|
30
|
+
const L = de(() => {
|
|
31
|
+
if (!e.searchable && !e.search || e.filter === !1 || !M()) return e.options;
|
|
32
|
+
const t = M().toLocaleLowerCase(h.locale);
|
|
33
|
+
return e.options.filter((r) => [r.label, r.groupLabel ?? r.group ?? "", ...r.keywords ?? []].some((i) => i.toLocaleLowerCase(h.locale).includes(t)));
|
|
34
|
+
}), we = de(() => {
|
|
35
|
+
const t = [];
|
|
36
|
+
return L().forEach((r, i) => {
|
|
37
|
+
const l = r.group ?? "";
|
|
38
|
+
let a = t.at(-1);
|
|
39
|
+
(!a || a.key !== l) && (a = {
|
|
40
|
+
key: l,
|
|
41
|
+
label: r.groupLabel ?? r.group,
|
|
42
|
+
options: []
|
|
43
|
+
}, t.push(a)), a.options.push({
|
|
44
|
+
option: r,
|
|
45
|
+
index: i
|
|
46
|
+
});
|
|
47
|
+
}), t;
|
|
48
|
+
}), ee = () => e.values.map((t) => e.options.find((r) => r.value === t)?.label ?? t).join(", "), C = (t) => {
|
|
49
|
+
t && (_() || q()) || (fe(t), t ? queueMicrotask(() => {
|
|
50
|
+
x() && F?.focus({
|
|
51
|
+
preventScroll: !0
|
|
52
|
+
});
|
|
53
|
+
}) : N(""));
|
|
54
|
+
}, W = (t) => {
|
|
55
|
+
_() || q() || t.disabled || (e.onValuesChange(e.multiple ? e.values.includes(t.value) ? e.values.filter((r) => r !== t.value) : [...e.values, t.value] : [t.value]), e.multiple || C(!1), b?.focus({
|
|
37
56
|
preventScroll: !0
|
|
38
57
|
}), e.onOptionSelect?.(t));
|
|
39
|
-
},
|
|
40
|
-
const i =
|
|
58
|
+
}, te = (t, r) => {
|
|
59
|
+
const i = L().map((m, n) => m.disabled ? -1 : n).filter((m) => m >= 0);
|
|
41
60
|
if (!i.length) {
|
|
42
|
-
|
|
61
|
+
D(-1);
|
|
43
62
|
return;
|
|
44
63
|
}
|
|
45
|
-
const l = i.indexOf(
|
|
46
|
-
|
|
64
|
+
const l = i.indexOf($()), a = r === "first" ? 0 : r === "last" ? i.length - 1 : l < 0 ? t < 0 ? i.length - 1 : 0 : (l + t + i.length) % i.length;
|
|
65
|
+
D(i[a]), O?.querySelector('[id="' + S + "-" + i[a] + '"]')?.scrollIntoView({
|
|
47
66
|
block: "nearest"
|
|
48
67
|
});
|
|
49
|
-
},
|
|
50
|
-
if (!
|
|
51
|
-
const t =
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
owner:
|
|
55
|
-
})), i =
|
|
68
|
+
}, xe = () => {
|
|
69
|
+
if (!b || !O) return;
|
|
70
|
+
const t = b.getBoundingClientRect();
|
|
71
|
+
me(t.width);
|
|
72
|
+
const r = qe(Fe({
|
|
73
|
+
owner: b
|
|
74
|
+
})), i = De(
|
|
56
75
|
t,
|
|
57
76
|
// The position layer is never transformed; motion belongs to its child.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
z?.getBoundingClientRect() ?? O.getBoundingClientRect(),
|
|
78
|
+
h.direction === "rtl" ? "end" : "start",
|
|
79
|
+
r
|
|
61
80
|
);
|
|
62
|
-
|
|
81
|
+
ye(i.y < t.top ? "top" : "bottom"), ge(i);
|
|
63
82
|
};
|
|
64
|
-
|
|
65
|
-
if (!
|
|
66
|
-
const t =
|
|
67
|
-
if (t < 0 || !
|
|
68
|
-
const
|
|
69
|
-
|
|
83
|
+
J(() => {
|
|
84
|
+
if (!x()) return;
|
|
85
|
+
const t = $();
|
|
86
|
+
if (t < 0 || !L()[t] || L()[t].disabled) {
|
|
87
|
+
const r = L().findIndex((i) => !i.disabled && e.values.includes(i.value));
|
|
88
|
+
D(r >= 0 ? r : L().findIndex((i) => !i.disabled));
|
|
70
89
|
}
|
|
71
|
-
}),
|
|
72
|
-
if (!
|
|
90
|
+
}), J(() => {
|
|
91
|
+
if (!T.mounted() || T.exiting() || typeof window > "u") return;
|
|
73
92
|
let t = 0;
|
|
74
|
-
const
|
|
93
|
+
const r = () => {
|
|
75
94
|
t || (t = requestAnimationFrame(() => {
|
|
76
|
-
t = 0,
|
|
95
|
+
t = 0, xe();
|
|
77
96
|
}));
|
|
78
97
|
};
|
|
79
|
-
|
|
80
|
-
const i = new ResizeObserver(
|
|
81
|
-
|
|
82
|
-
cancelAnimationFrame(t), i.disconnect(), window.removeEventListener("resize",
|
|
98
|
+
r();
|
|
99
|
+
const i = new ResizeObserver(r);
|
|
100
|
+
b && i.observe(b), z && i.observe(z), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0), ce(() => {
|
|
101
|
+
cancelAnimationFrame(t), i.disconnect(), window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
|
|
83
102
|
});
|
|
84
|
-
}),
|
|
85
|
-
open:
|
|
86
|
-
root: () =>
|
|
87
|
-
containsTarget: (t) => t instanceof Node && !!(
|
|
88
|
-
onClose: () =>
|
|
89
|
-
onInteractOutside: () =>
|
|
90
|
-
onEscapeOutside: () =>
|
|
103
|
+
}), Oe({
|
|
104
|
+
open: x,
|
|
105
|
+
root: () => O,
|
|
106
|
+
containsTarget: (t) => t instanceof Node && !!(O?.contains(t) || b?.contains(t)),
|
|
107
|
+
onClose: () => C(!1),
|
|
108
|
+
onInteractOutside: () => C(!1),
|
|
109
|
+
onEscapeOutside: () => C(!1),
|
|
91
110
|
lockBodyScroll: !1,
|
|
92
111
|
trapFocus: !1,
|
|
93
112
|
autoFocus: !1,
|
|
@@ -95,25 +114,65 @@ function U(e) {
|
|
|
95
114
|
blockHotkeys: !1,
|
|
96
115
|
closeOnEscape: "inside",
|
|
97
116
|
escapeKeyPhase: "bubble"
|
|
98
|
-
}),
|
|
99
|
-
const t =
|
|
100
|
-
let
|
|
117
|
+
}), Le(() => {
|
|
118
|
+
const t = I?.form;
|
|
119
|
+
let r;
|
|
101
120
|
const i = (l) => {
|
|
102
|
-
clearTimeout(
|
|
103
|
-
if (!l.defaultPrevented && (e.onValuesChange([...e.resetValues]),
|
|
104
|
-
for (const
|
|
121
|
+
clearTimeout(r), r = setTimeout(() => {
|
|
122
|
+
if (!l.defaultPrevented && (e.onValuesChange([...e.resetValues]), C(!1), I))
|
|
123
|
+
for (const a of I.options) a.selected = e.values.includes(a.value);
|
|
105
124
|
});
|
|
106
125
|
};
|
|
107
|
-
t?.addEventListener("reset", i),
|
|
108
|
-
clearTimeout(
|
|
126
|
+
t?.addEventListener("reset", i), ce(() => {
|
|
127
|
+
clearTimeout(r), t?.removeEventListener("reset", i);
|
|
109
128
|
});
|
|
110
|
-
}),
|
|
129
|
+
}), J(() => {
|
|
111
130
|
const t = e.values;
|
|
112
|
-
if (e.options,
|
|
131
|
+
if (e.options, I) for (const r of I.options) r.selected = t.includes(r.value);
|
|
113
132
|
});
|
|
114
|
-
const
|
|
133
|
+
const le = (t) => {
|
|
134
|
+
if (_() || q() || t.isComposing) return;
|
|
135
|
+
const r = t.target === F || e.searchable;
|
|
136
|
+
if (t.key === "Escape" && x()) {
|
|
137
|
+
t.preventDefault(), t.stopPropagation(), C(!1), b?.focus({
|
|
138
|
+
preventScroll: !0
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (t.key === "Tab") {
|
|
143
|
+
if (t.target === F && b) {
|
|
144
|
+
const i = Ve(b.ownerDocument).filter((a) => a.tabIndex >= 0 && !O?.contains(a) && !a.closest('[inert], [hidden], [aria-hidden="true"]') && a.getClientRects().length > 0 && getComputedStyle(a).visibility !== "hidden").sort((a, m) => (a.tabIndex || 1 / 0) - (m.tabIndex || 1 / 0)), l = i[i.indexOf(b) + (t.shiftKey ? -1 : 1)];
|
|
145
|
+
C(!1), l ? (t.preventDefault(), l.focus({
|
|
146
|
+
preventScroll: !0
|
|
147
|
+
})) : b.focus({
|
|
148
|
+
preventScroll: !0
|
|
149
|
+
});
|
|
150
|
+
} else C(!1);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
154
|
+
t.preventDefault();
|
|
155
|
+
const i = x();
|
|
156
|
+
C(!0), i && te(t.key === "ArrowDown" ? 1 : -1);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (x() && (t.key === "Home" || t.key === "End") && !r) {
|
|
160
|
+
t.preventDefault(), te(0, t.key === "Home" ? "first" : "last");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (t.key === "Enter" || !r && t.key === " ") {
|
|
164
|
+
t.preventDefault(), x() && L()[$()] ? W(L()[$()]) : C(!0);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!r && t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
168
|
+
const i = Date.now();
|
|
169
|
+
U = i - p > 700 ? t.key : U + t.key, p = i;
|
|
170
|
+
const l = e.options.find((a) => !a.disabled && a.label.toLocaleLowerCase(h.locale).startsWith(U.toLocaleLowerCase(h.locale)));
|
|
171
|
+
l && (t.preventDefault(), x() ? D(L().indexOf(l)) : W(l));
|
|
172
|
+
}
|
|
173
|
+
}, re = {
|
|
115
174
|
get id() {
|
|
116
|
-
return
|
|
175
|
+
return Z();
|
|
117
176
|
},
|
|
118
177
|
get disabled() {
|
|
119
178
|
return _();
|
|
@@ -124,13 +183,13 @@ function U(e) {
|
|
|
124
183
|
role: "combobox",
|
|
125
184
|
"aria-haspopup": "listbox",
|
|
126
185
|
get "aria-expanded"() {
|
|
127
|
-
return
|
|
186
|
+
return x();
|
|
128
187
|
},
|
|
129
188
|
get "aria-controls"() {
|
|
130
|
-
return
|
|
189
|
+
return x() ? S : void 0;
|
|
131
190
|
},
|
|
132
191
|
get "aria-activedescendant"() {
|
|
133
|
-
return
|
|
192
|
+
return x() && L()[$()] ? S + "-" + $() : void 0;
|
|
134
193
|
},
|
|
135
194
|
get "aria-label"() {
|
|
136
195
|
return e.ariaLabel;
|
|
@@ -139,77 +198,46 @@ function U(e) {
|
|
|
139
198
|
return e.ariaLabelledBy;
|
|
140
199
|
},
|
|
141
200
|
get "aria-describedby"() {
|
|
142
|
-
return
|
|
201
|
+
return Pe(w["aria-describedby"], e.ariaDescribedBy);
|
|
143
202
|
},
|
|
144
203
|
get "aria-invalid"() {
|
|
145
|
-
return e.invalid ||
|
|
204
|
+
return e.invalid || w["aria-invalid"];
|
|
146
205
|
},
|
|
147
206
|
get "aria-required"() {
|
|
148
|
-
return e.required ??
|
|
207
|
+
return e.required ?? w.required;
|
|
149
208
|
},
|
|
150
209
|
"data-floe-input-surface": "true",
|
|
151
210
|
"data-floe-control": "select",
|
|
152
211
|
"data-floe-dropdown-trigger": "",
|
|
153
212
|
"data-floe-surface": "inset",
|
|
154
213
|
get class() {
|
|
155
|
-
return
|
|
156
|
-
},
|
|
157
|
-
onKeyDown: (t) => {
|
|
158
|
-
if (!(_() || q() || t.isComposing)) {
|
|
159
|
-
if (t.key === "Escape" && h()) {
|
|
160
|
-
t.preventDefault(), t.stopPropagation(), y(!1);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (t.key === "Tab") {
|
|
164
|
-
y(!1);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
168
|
-
t.preventDefault();
|
|
169
|
-
const a = h();
|
|
170
|
-
y(!0), a && Y(t.key === "ArrowDown" ? 1 : -1);
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (h() && (t.key === "Home" || t.key === "End") && !e.searchable) {
|
|
174
|
-
t.preventDefault(), Y(0, t.key === "Home" ? "first" : "last");
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (t.key === "Enter" || !e.searchable && t.key === " ") {
|
|
178
|
-
t.preventDefault(), h() && C()[L()] ? j(C()[L()]) : y(!0);
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (!e.searchable && t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
182
|
-
const a = Date.now();
|
|
183
|
-
H = a - J > 700 ? t.key : H + t.key, J = a;
|
|
184
|
-
const i = e.options.find((l) => !l.disabled && l.label.toLocaleLowerCase(u.locale).startsWith(H.toLocaleLowerCase(u.locale)));
|
|
185
|
-
i && (t.preventDefault(), h() ? E(C().indexOf(i)) : j(i));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
214
|
+
return X("floe-field flex w-full min-w-0 items-center justify-between gap-2 h-[var(--floe-control-height-md)] px-2.5 text-[length:var(--floe-type-control)]", e.class);
|
|
188
215
|
},
|
|
216
|
+
onKeyDown: le,
|
|
189
217
|
ref: (t) => {
|
|
190
|
-
|
|
218
|
+
b = t, e.ref?.(t);
|
|
191
219
|
}
|
|
192
220
|
};
|
|
193
221
|
return (() => {
|
|
194
|
-
var t =
|
|
195
|
-
|
|
222
|
+
var t = Qe(), r = t.firstChild;
|
|
223
|
+
s(t, g(V, {
|
|
196
224
|
get when() {
|
|
197
225
|
return e.searchable;
|
|
198
226
|
},
|
|
199
227
|
get fallback() {
|
|
200
228
|
return (() => {
|
|
201
|
-
var l =
|
|
202
|
-
return
|
|
229
|
+
var l = Ne(), a = l.firstChild;
|
|
230
|
+
return ue(l, K(re, {
|
|
203
231
|
type: "button",
|
|
204
|
-
onClick: () =>
|
|
205
|
-
}), !1, !0),
|
|
232
|
+
onClick: () => C(!x())
|
|
233
|
+
}), !1, !0), s(a, () => ee() || e.placeholder || h.t("selectPlaceholder")), s(l, g(Te, {
|
|
206
234
|
class: "h-3.5 w-3.5 shrink-0"
|
|
207
235
|
}), null), l;
|
|
208
236
|
})();
|
|
209
237
|
},
|
|
210
238
|
get children() {
|
|
211
|
-
var l =
|
|
212
|
-
return
|
|
239
|
+
var l = Ae();
|
|
240
|
+
return ue(l, K(re, {
|
|
213
241
|
type: "text",
|
|
214
242
|
autocomplete: "off",
|
|
215
243
|
get readOnly() {
|
|
@@ -217,141 +245,186 @@ function U(e) {
|
|
|
217
245
|
},
|
|
218
246
|
"aria-autocomplete": "list",
|
|
219
247
|
get placeholder() {
|
|
220
|
-
return e.placeholder ??
|
|
248
|
+
return e.placeholder ?? h.t("searchPlaceholder");
|
|
221
249
|
},
|
|
222
250
|
get value() {
|
|
223
|
-
return
|
|
251
|
+
return H(() => !!x())() ? M() : ee();
|
|
224
252
|
},
|
|
225
|
-
onClick: () =>
|
|
226
|
-
onInput: (
|
|
227
|
-
|
|
253
|
+
onClick: () => C(!0),
|
|
254
|
+
onInput: (a) => {
|
|
255
|
+
N(a.currentTarget.value), D(-1), C(!0), e.onQueryChange?.(a.currentTarget.value);
|
|
228
256
|
}
|
|
229
257
|
}), !1, !1), l;
|
|
230
258
|
}
|
|
231
|
-
}),
|
|
232
|
-
l.preventDefault(),
|
|
259
|
+
}), r), r.addEventListener("change", (l) => e.onValuesChange(Array.from(l.currentTarget.selectedOptions, (a) => a.value))), r.addEventListener("invalid", (l) => {
|
|
260
|
+
l.preventDefault(), b?.focus();
|
|
233
261
|
});
|
|
234
|
-
var i =
|
|
235
|
-
return typeof i == "function" ?
|
|
262
|
+
var i = I;
|
|
263
|
+
return typeof i == "function" ? G(i, r) : I = r, s(r, g(V, {
|
|
236
264
|
get when() {
|
|
237
|
-
return
|
|
265
|
+
return H(() => !e.multiple)() && !e.options.some((l) => l.value === "");
|
|
238
266
|
},
|
|
239
267
|
get children() {
|
|
240
|
-
var l =
|
|
241
|
-
return
|
|
268
|
+
var l = Re();
|
|
269
|
+
return E(() => l.selected = !e.values.length || e.values[0] === ""), l;
|
|
242
270
|
}
|
|
243
|
-
}), null),
|
|
271
|
+
}), null), s(r, g(j, {
|
|
244
272
|
get each() {
|
|
245
|
-
return e.values.filter((l) => l !== "" && !e.options.some((
|
|
273
|
+
return e.values.filter((l) => l !== "" && !e.options.some((a) => a.value === l));
|
|
246
274
|
},
|
|
247
275
|
children: (l) => (() => {
|
|
248
|
-
var
|
|
249
|
-
return
|
|
276
|
+
var a = Ue();
|
|
277
|
+
return a.value = l, s(a, l), a;
|
|
250
278
|
})()
|
|
251
|
-
}), null),
|
|
279
|
+
}), null), s(r, g(j, {
|
|
252
280
|
get each() {
|
|
253
281
|
return e.options;
|
|
254
282
|
},
|
|
255
283
|
children: (l) => (() => {
|
|
256
|
-
var
|
|
257
|
-
return
|
|
258
|
-
var n = e.values.includes(l.value),
|
|
259
|
-
return n !==
|
|
284
|
+
var a = We();
|
|
285
|
+
return s(a, () => l.label), E((m) => {
|
|
286
|
+
var n = e.values.includes(l.value), u = l.disabled;
|
|
287
|
+
return n !== m.e && (a.selected = m.e = n), u !== m.t && (a.disabled = m.t = u), m;
|
|
260
288
|
}, {
|
|
261
289
|
e: void 0,
|
|
262
290
|
t: void 0
|
|
263
|
-
}),
|
|
291
|
+
}), E(() => a.value = l.value), a;
|
|
264
292
|
})()
|
|
265
|
-
}), null),
|
|
293
|
+
}), null), s(t, g(V, {
|
|
266
294
|
get when() {
|
|
267
|
-
return
|
|
295
|
+
return T.mounted();
|
|
268
296
|
},
|
|
269
297
|
get children() {
|
|
270
|
-
return
|
|
271
|
-
owner:
|
|
298
|
+
return g(Ee, {
|
|
299
|
+
owner: b,
|
|
272
300
|
get position() {
|
|
273
|
-
return
|
|
301
|
+
return ve();
|
|
274
302
|
},
|
|
275
303
|
layerRef: (l) => {
|
|
276
|
-
|
|
304
|
+
z = l;
|
|
277
305
|
},
|
|
278
306
|
get dir() {
|
|
279
|
-
return
|
|
307
|
+
return h.direction;
|
|
280
308
|
},
|
|
281
309
|
get style() {
|
|
282
310
|
return {
|
|
283
311
|
"z-index": e.zIndex,
|
|
284
312
|
width: "max-content",
|
|
285
|
-
"min-width":
|
|
313
|
+
"min-width": he() + "px",
|
|
286
314
|
"max-width": "calc(100vw - 24px)"
|
|
287
315
|
};
|
|
288
316
|
},
|
|
289
317
|
get children() {
|
|
290
|
-
var l =
|
|
291
|
-
return typeof
|
|
318
|
+
var l = je(), a = l.firstChild, m = O;
|
|
319
|
+
return typeof m == "function" ? G(m, l) : O = l, s(l, g(V, {
|
|
320
|
+
get when() {
|
|
321
|
+
return e.search;
|
|
322
|
+
},
|
|
323
|
+
get children() {
|
|
324
|
+
var n = Be(), u = n.firstChild;
|
|
325
|
+
u.$$input = (d) => {
|
|
326
|
+
N(d.currentTarget.value), D(-1), e.onQueryChange?.(d.currentTarget.value);
|
|
327
|
+
}, u.$$keydown = le;
|
|
328
|
+
var o = F;
|
|
329
|
+
return typeof o == "function" ? G(o, u) : F = u, v(u, "aria-controls", S), E((d) => {
|
|
330
|
+
var f = e.search.label, P = L()[$()] ? S + "-" + $() : void 0, c = e.search.placeholder;
|
|
331
|
+
return f !== d.e && v(u, "aria-label", d.e = f), P !== d.t && v(u, "aria-activedescendant", d.t = P), c !== d.a && v(u, "placeholder", d.a = c), d;
|
|
332
|
+
}, {
|
|
333
|
+
e: void 0,
|
|
334
|
+
t: void 0,
|
|
335
|
+
a: void 0
|
|
336
|
+
}), E(() => u.value = M()), n;
|
|
337
|
+
}
|
|
338
|
+
}), a), s(l, g(V, {
|
|
292
339
|
get when() {
|
|
293
340
|
return e.loading;
|
|
294
341
|
},
|
|
295
342
|
get children() {
|
|
296
|
-
var n =
|
|
297
|
-
return
|
|
343
|
+
var n = Ke();
|
|
344
|
+
return s(n, () => h.t("loading")), n;
|
|
298
345
|
}
|
|
299
|
-
}),
|
|
346
|
+
}), a), s(l, g(V, {
|
|
300
347
|
get when() {
|
|
301
348
|
return e.error;
|
|
302
349
|
},
|
|
303
350
|
get children() {
|
|
304
|
-
var n =
|
|
305
|
-
return
|
|
351
|
+
var n = ze();
|
|
352
|
+
return s(n, () => e.error, null), s(n, g(V, {
|
|
306
353
|
get when() {
|
|
307
354
|
return e.onRetry;
|
|
308
355
|
},
|
|
309
356
|
get children() {
|
|
310
|
-
var
|
|
311
|
-
return
|
|
357
|
+
var u = Me();
|
|
358
|
+
return u.$$click = () => e.onRetry?.(), s(u, () => h.t("retry")), u;
|
|
312
359
|
}
|
|
313
360
|
}), null), n;
|
|
314
361
|
}
|
|
315
|
-
}),
|
|
362
|
+
}), a), v(a, "id", S), s(a, g(j, {
|
|
316
363
|
get each() {
|
|
317
|
-
return
|
|
364
|
+
return we();
|
|
318
365
|
},
|
|
319
|
-
children: (n
|
|
320
|
-
var
|
|
321
|
-
return s
|
|
366
|
+
children: (n) => (() => {
|
|
367
|
+
var u = Je();
|
|
368
|
+
return s(u, g(V, {
|
|
322
369
|
get when() {
|
|
323
|
-
return
|
|
370
|
+
return n.label;
|
|
324
371
|
},
|
|
325
372
|
get children() {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
});
|
|
373
|
+
var o = Ge();
|
|
374
|
+
return s(o, () => n.label), o;
|
|
329
375
|
}
|
|
330
|
-
})),
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
376
|
+
}), null), s(u, g(j, {
|
|
377
|
+
get each() {
|
|
378
|
+
return n.options;
|
|
379
|
+
},
|
|
380
|
+
children: ({
|
|
381
|
+
option: o,
|
|
382
|
+
index: d
|
|
383
|
+
}) => (() => {
|
|
384
|
+
var f = Xe(), P = f.firstChild;
|
|
385
|
+
return f.$$click = () => W(o), f.$$pointermove = () => !o.disabled && D(d), f.$$pointerdown = (c) => c.preventDefault(), v(f, "id", S + "-" + d), s(P, g(V, {
|
|
386
|
+
get when() {
|
|
387
|
+
return e.values.includes(o.value);
|
|
388
|
+
},
|
|
389
|
+
get children() {
|
|
390
|
+
return g(_e, {
|
|
391
|
+
class: "h-3.5 w-3.5"
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
})), s(f, (() => {
|
|
395
|
+
var c = H(() => !!e.renderOption);
|
|
396
|
+
return () => c() ? e.renderOption(o) : o.label;
|
|
397
|
+
})(), null), E((c) => {
|
|
398
|
+
var A = o.description, R = o.description ? o.label + " · " + o.description : o.label, ae = e.values.includes(o.value), ne = o.disabled || void 0, ie = e.values.includes(o.value) ? "true" : void 0, oe = X("flex min-h-[var(--floe-row-height)] items-center gap-2 rounded-sm px-2 text-[length:var(--floe-type-control)]", $() === d && "bg-accent text-accent-foreground", o.disabled ? "opacity-50" : "cursor-pointer");
|
|
399
|
+
return A !== c.e && v(f, "aria-description", c.e = A), R !== c.t && v(f, "title", c.t = R), ae !== c.a && v(f, "aria-selected", c.a = ae), ne !== c.o && v(f, "aria-disabled", c.o = ne), ie !== c.i && v(f, "data-floe-selected", c.i = ie), oe !== c.n && se(f, c.n = oe), c;
|
|
400
|
+
}, {
|
|
401
|
+
e: void 0,
|
|
402
|
+
t: void 0,
|
|
403
|
+
a: void 0,
|
|
404
|
+
o: void 0,
|
|
405
|
+
i: void 0,
|
|
406
|
+
n: void 0
|
|
407
|
+
}), f;
|
|
408
|
+
})()
|
|
409
|
+
}), null), E((o) => {
|
|
410
|
+
var d = n.label ? "group" : void 0, f = n.label;
|
|
411
|
+
return d !== o.e && v(u, "role", o.e = d), f !== o.t && v(u, "aria-label", o.t = f), o;
|
|
336
412
|
}, {
|
|
337
413
|
e: void 0,
|
|
338
|
-
t: void 0
|
|
339
|
-
|
|
340
|
-
o: void 0,
|
|
341
|
-
i: void 0
|
|
342
|
-
}), s;
|
|
414
|
+
t: void 0
|
|
415
|
+
}), u;
|
|
343
416
|
})()
|
|
344
|
-
})),
|
|
417
|
+
})), s(l, g(V, {
|
|
345
418
|
get when() {
|
|
346
|
-
return
|
|
419
|
+
return H(() => !L().length && !e.loading)() && !e.error;
|
|
347
420
|
},
|
|
348
421
|
get children() {
|
|
349
|
-
var n =
|
|
350
|
-
return
|
|
422
|
+
var n = He();
|
|
423
|
+
return s(n, () => h.t("noResults")), n;
|
|
351
424
|
}
|
|
352
|
-
}), null),
|
|
353
|
-
var
|
|
354
|
-
return
|
|
425
|
+
}), null), E((n) => {
|
|
426
|
+
var u = X("floe-floating-presence floe-floating-menu rounded-panel border border-[var(--floe-line)] bg-popover text-popover-foreground shadow-[var(--floe-elevation-float)] p-1", e.popupClass), o = T.state(), d = be(), f = T.exiting(), P = T.exiting() ? "true" : void 0, c = e.ariaLabel, A = e.ariaLabelledBy ?? (e.ariaLabel ? void 0 : Z()), R = e.multiple || void 0;
|
|
427
|
+
return u !== n.e && se(l, n.e = u), o !== n.t && v(l, "data-floating-presence", n.t = o), d !== n.a && v(l, "data-floating-side", n.a = d), f !== n.o && (l.inert = n.o = f), P !== n.i && v(l, "aria-hidden", n.i = P), c !== n.n && v(a, "aria-label", n.n = c), A !== n.s && v(a, "aria-labelledby", n.s = A), R !== n.h && v(a, "aria-multiselectable", n.h = R), n;
|
|
355
428
|
}, {
|
|
356
429
|
e: void 0,
|
|
357
430
|
t: void 0,
|
|
@@ -359,14 +432,15 @@ function U(e) {
|
|
|
359
432
|
o: void 0,
|
|
360
433
|
i: void 0,
|
|
361
434
|
n: void 0,
|
|
362
|
-
s: void 0
|
|
435
|
+
s: void 0,
|
|
436
|
+
h: void 0
|
|
363
437
|
}), l;
|
|
364
438
|
}
|
|
365
439
|
});
|
|
366
440
|
}
|
|
367
|
-
}), null),
|
|
368
|
-
var
|
|
369
|
-
return
|
|
441
|
+
}), null), E((l) => {
|
|
442
|
+
var a = h.direction, m = e.name ?? w.name, n = e.form, u = e.required ?? w.required, o = _(), d = e.multiple;
|
|
443
|
+
return a !== l.e && v(t, "dir", l.e = a), m !== l.t && v(r, "name", l.t = m), n !== l.a && v(r, "form", l.a = n), u !== l.o && (r.required = l.o = u), o !== l.i && (r.disabled = l.i = o), d !== l.n && (r.multiple = l.n = d), l;
|
|
370
444
|
}, {
|
|
371
445
|
e: void 0,
|
|
372
446
|
t: void 0,
|
|
@@ -377,59 +451,59 @@ function U(e) {
|
|
|
377
451
|
}), t;
|
|
378
452
|
})();
|
|
379
453
|
}
|
|
380
|
-
function
|
|
381
|
-
const [
|
|
454
|
+
function dt(e) {
|
|
455
|
+
const [h, w] = Q({
|
|
382
456
|
value: () => e.value,
|
|
383
457
|
defaultValue: e.defaultValue ?? "",
|
|
384
|
-
onChange: (
|
|
458
|
+
onChange: (k) => e.onChange?.(k)
|
|
385
459
|
});
|
|
386
|
-
return
|
|
460
|
+
return g(Y, K(e, {
|
|
387
461
|
get values() {
|
|
388
|
-
return [
|
|
462
|
+
return [h()];
|
|
389
463
|
},
|
|
390
464
|
get resetValues() {
|
|
391
465
|
return [e.defaultValue ?? ""];
|
|
392
466
|
},
|
|
393
|
-
onValuesChange: (
|
|
467
|
+
onValuesChange: (k) => w(k[0] ?? "")
|
|
394
468
|
}));
|
|
395
469
|
}
|
|
396
|
-
function
|
|
397
|
-
const [
|
|
470
|
+
function ct(e) {
|
|
471
|
+
const [h, w] = Q({
|
|
398
472
|
value: () => e.value,
|
|
399
473
|
defaultValue: e.defaultValue ?? "",
|
|
400
|
-
onChange: (
|
|
474
|
+
onChange: (k) => e.onChange?.(k)
|
|
401
475
|
});
|
|
402
|
-
return
|
|
476
|
+
return g(Y, K(e, {
|
|
403
477
|
searchable: !0,
|
|
404
478
|
get values() {
|
|
405
|
-
return [
|
|
479
|
+
return [h()];
|
|
406
480
|
},
|
|
407
481
|
get resetValues() {
|
|
408
482
|
return [e.defaultValue ?? ""];
|
|
409
483
|
},
|
|
410
|
-
onValuesChange: (
|
|
484
|
+
onValuesChange: (k) => w(k[0] ?? "")
|
|
411
485
|
}));
|
|
412
486
|
}
|
|
413
|
-
function
|
|
414
|
-
const [
|
|
487
|
+
function ft(e) {
|
|
488
|
+
const [h, w] = Q({
|
|
415
489
|
value: () => e.value,
|
|
416
490
|
defaultValue: e.defaultValue ?? [],
|
|
417
|
-
onChange: (
|
|
491
|
+
onChange: (k) => e.onChange?.(k)
|
|
418
492
|
});
|
|
419
|
-
return
|
|
493
|
+
return g(Y, K(e, {
|
|
420
494
|
multiple: !0,
|
|
421
495
|
get values() {
|
|
422
|
-
return
|
|
496
|
+
return h();
|
|
423
497
|
},
|
|
424
498
|
get resetValues() {
|
|
425
499
|
return e.defaultValue ?? [];
|
|
426
500
|
},
|
|
427
|
-
onValuesChange:
|
|
501
|
+
onValuesChange: w
|
|
428
502
|
}));
|
|
429
503
|
}
|
|
430
|
-
|
|
504
|
+
Ce(["keydown", "input", "click", "pointerdown", "pointermove"]);
|
|
431
505
|
export {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
506
|
+
ct as Combobox,
|
|
507
|
+
ft as MultiSelect,
|
|
508
|
+
dt as Select
|
|
435
509
|
};
|