@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.
@@ -1,93 +1,112 @@
1
- import { createComponent as c, mergeProps as I, insert as o, spread as te, memo as z, effect as P, use as le, setAttribute as m, className as ve, template as w, delegateEvents as ge } from "solid-js/web";
2
- import { createUniqueId as me, createSignal as B, createMemo as he, createEffect as N, untrack as be, onCleanup as ae, onMount as ye, Show as V, For as Q } from "solid-js";
3
- import { cn as ne } from "../../utils/cn.js";
4
- import { useFloeLocale as we } from "../../context/LocaleContext.js";
5
- import { useOverlayMask as Ce } from "../../hooks/useOverlayMask.js";
6
- import { SurfaceFloatingLayer as xe } from "./SurfaceFloatingLayer.js";
7
- import { createFloatingPresence as ke } from "./floatingPresence.js";
8
- import { calculateMenuPosition as Ve } from "./menuUtils.js";
9
- import { useFormControl as Le, joinAriaIds as Oe } from "./formFieldContext.js";
10
- import { createControllableValue as K } from "./controllable.js";
11
- import { ChevronDown as $e, Check as Ee } from "../icons/index.js";
12
- import { resolveSurfacePortalBoundaryRect as De, resolveSurfacePortalHost as Pe } from "./dialogSurfaceScope.js";
13
- var Se = /* @__PURE__ */ w("<input>"), _e = /* @__PURE__ */ w("<option value>"), qe = /* @__PURE__ */ w('<div role=status class="px-2 py-2 text-caption">'), Ae = /* @__PURE__ */ w("<button type=button>"), Fe = /* @__PURE__ */ w('<div role=alert class="p-2 text-error">'), Te = /* @__PURE__ */ w('<div role=status class="p-2 text-caption">'), Be = /* @__PURE__ */ w('<div class="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"data-floe-surface=floating><div role=listbox class="max-h-64 overflow-y-auto"data-floe-local-interaction-surface=true>'), Ie = /* @__PURE__ */ w('<div class="relative min-w-0"><select tabindex=-1 aria-hidden=true class="sr-only pointer-events-none">'), Re = /* @__PURE__ */ w("<button><span class=truncate>"), ze = /* @__PURE__ */ w("<option selected>"), Ke = /* @__PURE__ */ w("<option>"), Me = /* @__PURE__ */ w('<div role=option><span class="h-3.5 w-3.5 shrink-0">');
14
- function U(e) {
15
- const u = we(), g = Le(), b = me(), W = () => e.id ?? g.id ?? "select-" + b, S = "options-" + b, _ = () => e.disabled ?? g.disabled, q = () => e.readOnly ?? g.readOnly, [h, re] = K({
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, G] = B(""), [L, E] = B(-1), [ie, oe] = B({
20
+ }), [M, N] = B(""), [$, D] = B(-1), [ve, ge] = B({
20
21
  x: 0,
21
22
  y: 0
22
- }), [ue, de] = B(200);
23
- let x, O, k, R;
24
- const D = ke({
25
- open: h,
26
- element: () => k
27
- }), [se, ce] = B("bottom");
28
- let H = "", J = 0;
29
- const C = he(() => {
30
- if (!e.searchable || e.filter === !1 || !M()) return e.options;
31
- const t = M().toLocaleLowerCase(u.locale);
32
- return e.options.filter((a) => [a.label, ...a.keywords ?? []].some((i) => i.toLocaleLowerCase(u.locale).includes(t)));
33
- }), X = () => e.values.map((t) => e.options.find((a) => a.value === t)?.label ?? t).join(", "), y = (t) => {
34
- t && (_() || q()) || (re(t), t || G(""));
35
- }, j = (t) => {
36
- _() || q() || t.disabled || (e.onValuesChange(e.multiple ? e.values.includes(t.value) ? e.values.filter((a) => a !== t.value) : [...e.values, t.value] : [t.value]), e.multiple || y(!1), x?.focus({
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
- }, Y = (t, a) => {
40
- const i = C().map((v, n) => v.disabled ? -1 : n).filter((v) => v >= 0);
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
- E(-1);
61
+ D(-1);
43
62
  return;
44
63
  }
45
- const l = i.indexOf(L()), r = a === "first" ? 0 : a === "last" ? i.length - 1 : l < 0 ? t < 0 ? i.length - 1 : 0 : (l + t + i.length) % i.length;
46
- E(i[r]), k?.querySelector('[id="' + S + "-" + i[r] + '"]')?.scrollIntoView({
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
- }, fe = () => {
50
- if (!x || !k) return;
51
- const t = x.getBoundingClientRect();
52
- de(t.width);
53
- const a = De(Pe({
54
- owner: x
55
- })), i = Ve(
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
- R?.getBoundingClientRect() ?? k.getBoundingClientRect(),
59
- u.direction === "rtl" ? "end" : "start",
60
- a
77
+ z?.getBoundingClientRect() ?? O.getBoundingClientRect(),
78
+ h.direction === "rtl" ? "end" : "start",
79
+ r
61
80
  );
62
- ce(i.y < t.top ? "top" : "bottom"), oe(i);
81
+ ye(i.y < t.top ? "top" : "bottom"), ge(i);
63
82
  };
64
- N(() => {
65
- if (!h()) return;
66
- const t = be(L);
67
- if (t < 0 || !C()[t] || C()[t].disabled) {
68
- const a = C().findIndex((i) => !i.disabled && e.values.includes(i.value));
69
- E(a >= 0 ? a : C().findIndex((i) => !i.disabled));
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
- }), N(() => {
72
- if (!D.mounted() || D.exiting() || typeof window > "u") return;
90
+ }), J(() => {
91
+ if (!T.mounted() || T.exiting() || typeof window > "u") return;
73
92
  let t = 0;
74
- const a = () => {
93
+ const r = () => {
75
94
  t || (t = requestAnimationFrame(() => {
76
- t = 0, fe();
95
+ t = 0, xe();
77
96
  }));
78
97
  };
79
- a();
80
- const i = new ResizeObserver(a);
81
- x && i.observe(x), R && i.observe(R), window.addEventListener("resize", a), window.addEventListener("scroll", a, !0), ae(() => {
82
- cancelAnimationFrame(t), i.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0);
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
- }), Ce({
85
- open: h,
86
- root: () => k,
87
- containsTarget: (t) => t instanceof Node && !!(k?.contains(t) || x?.contains(t)),
88
- onClose: () => y(!1),
89
- onInteractOutside: () => y(!1),
90
- onEscapeOutside: () => y(!1),
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
- }), ye(() => {
99
- const t = O?.form;
100
- let a;
117
+ }), Le(() => {
118
+ const t = I?.form;
119
+ let r;
101
120
  const i = (l) => {
102
- clearTimeout(a), a = setTimeout(() => {
103
- if (!l.defaultPrevented && (e.onValuesChange([...e.resetValues]), y(!1), O))
104
- for (const r of O.options) r.selected = e.values.includes(r.value);
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), ae(() => {
108
- clearTimeout(a), t?.removeEventListener("reset", i);
126
+ t?.addEventListener("reset", i), ce(() => {
127
+ clearTimeout(r), t?.removeEventListener("reset", i);
109
128
  });
110
- }), N(() => {
129
+ }), J(() => {
111
130
  const t = e.values;
112
- if (e.options, O) for (const a of O.options) a.selected = t.includes(a.value);
131
+ if (e.options, I) for (const r of I.options) r.selected = t.includes(r.value);
113
132
  });
114
- const Z = {
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 W();
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 h();
186
+ return x();
128
187
  },
129
188
  get "aria-controls"() {
130
- return h() ? S : void 0;
189
+ return x() ? S : void 0;
131
190
  },
132
191
  get "aria-activedescendant"() {
133
- return h() && C()[L()] ? S + "-" + L() : void 0;
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 Oe(g["aria-describedby"], e.ariaDescribedBy);
201
+ return Pe(w["aria-describedby"], e.ariaDescribedBy);
143
202
  },
144
203
  get "aria-invalid"() {
145
- return e.invalid || g["aria-invalid"];
204
+ return e.invalid || w["aria-invalid"];
146
205
  },
147
206
  get "aria-required"() {
148
- return e.required ?? g.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 ne("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);
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
- x = t, e.ref?.(t);
218
+ b = t, e.ref?.(t);
191
219
  }
192
220
  };
193
221
  return (() => {
194
- var t = Ie(), a = t.firstChild;
195
- o(t, c(V, {
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 = Re(), r = l.firstChild;
202
- return te(l, I(Z, {
229
+ var l = Ne(), a = l.firstChild;
230
+ return ue(l, K(re, {
203
231
  type: "button",
204
- onClick: () => y(!h())
205
- }), !1, !0), o(r, () => X() || e.placeholder || u.t("selectPlaceholder")), o(l, c($e, {
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 = Se();
212
- return te(l, I(Z, {
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 ?? u.t("searchPlaceholder");
248
+ return e.placeholder ?? h.t("searchPlaceholder");
221
249
  },
222
250
  get value() {
223
- return z(() => !!h())() ? M() : X();
251
+ return H(() => !!x())() ? M() : ee();
224
252
  },
225
- onClick: () => y(!0),
226
- onInput: (r) => {
227
- G(r.currentTarget.value), E(-1), y(!0), e.onQueryChange?.(r.currentTarget.value);
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
- }), a), a.addEventListener("change", (l) => e.onValuesChange(Array.from(l.currentTarget.selectedOptions, (r) => r.value))), a.addEventListener("invalid", (l) => {
232
- l.preventDefault(), x?.focus();
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 = O;
235
- return typeof i == "function" ? le(i, a) : O = a, o(a, c(V, {
262
+ var i = I;
263
+ return typeof i == "function" ? G(i, r) : I = r, s(r, g(V, {
236
264
  get when() {
237
- return z(() => !e.multiple)() && !e.options.some((l) => l.value === "");
265
+ return H(() => !e.multiple)() && !e.options.some((l) => l.value === "");
238
266
  },
239
267
  get children() {
240
- var l = _e();
241
- return P(() => l.selected = !e.values.length || e.values[0] === ""), l;
268
+ var l = Re();
269
+ return E(() => l.selected = !e.values.length || e.values[0] === ""), l;
242
270
  }
243
- }), null), o(a, c(Q, {
271
+ }), null), s(r, g(j, {
244
272
  get each() {
245
- return e.values.filter((l) => l !== "" && !e.options.some((r) => r.value === l));
273
+ return e.values.filter((l) => l !== "" && !e.options.some((a) => a.value === l));
246
274
  },
247
275
  children: (l) => (() => {
248
- var r = ze();
249
- return r.value = l, o(r, l), r;
276
+ var a = Ue();
277
+ return a.value = l, s(a, l), a;
250
278
  })()
251
- }), null), o(a, c(Q, {
279
+ }), null), s(r, g(j, {
252
280
  get each() {
253
281
  return e.options;
254
282
  },
255
283
  children: (l) => (() => {
256
- var r = Ke();
257
- return o(r, () => l.label), P((v) => {
258
- var n = e.values.includes(l.value), f = l.disabled;
259
- return n !== v.e && (r.selected = v.e = n), f !== v.t && (r.disabled = v.t = f), v;
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
- }), P(() => r.value = l.value), r;
291
+ }), E(() => a.value = l.value), a;
264
292
  })()
265
- }), null), o(t, c(V, {
293
+ }), null), s(t, g(V, {
266
294
  get when() {
267
- return D.mounted();
295
+ return T.mounted();
268
296
  },
269
297
  get children() {
270
- return c(xe, {
271
- owner: x,
298
+ return g(Ee, {
299
+ owner: b,
272
300
  get position() {
273
- return ie();
301
+ return ve();
274
302
  },
275
303
  layerRef: (l) => {
276
- R = l;
304
+ z = l;
277
305
  },
278
306
  get dir() {
279
- return u.direction;
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": ue() + "px",
313
+ "min-width": he() + "px",
286
314
  "max-width": "calc(100vw - 24px)"
287
315
  };
288
316
  },
289
317
  get children() {
290
- var l = Be(), r = l.firstChild, v = k;
291
- return typeof v == "function" ? le(v, l) : k = l, o(l, c(V, {
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 = qe();
297
- return o(n, () => u.t("loading")), n;
343
+ var n = Ke();
344
+ return s(n, () => h.t("loading")), n;
298
345
  }
299
- }), r), o(l, c(V, {
346
+ }), a), s(l, g(V, {
300
347
  get when() {
301
348
  return e.error;
302
349
  },
303
350
  get children() {
304
- var n = Fe();
305
- return o(n, () => e.error, null), o(n, c(V, {
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 f = Ae();
311
- return f.$$click = () => e.onRetry?.(), o(f, () => u.t("retry")), f;
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
- }), r), m(r, "id", S), o(r, c(Q, {
362
+ }), a), v(a, "id", S), s(a, g(j, {
316
363
  get each() {
317
- return C();
364
+ return we();
318
365
  },
319
- children: (n, f) => (() => {
320
- var s = Me(), $ = s.firstChild;
321
- return s.$$click = () => j(n), s.$$pointermove = () => !n.disabled && E(f()), s.$$pointerdown = (d) => d.preventDefault(), o($, c(V, {
366
+ children: (n) => (() => {
367
+ var u = Je();
368
+ return s(u, g(V, {
322
369
  get when() {
323
- return e.values.includes(n.value);
370
+ return n.label;
324
371
  },
325
372
  get children() {
326
- return c(Ee, {
327
- class: "h-3.5 w-3.5"
328
- });
373
+ var o = Ge();
374
+ return s(o, () => n.label), o;
329
375
  }
330
- })), o(s, (() => {
331
- var d = z(() => !!e.renderOption);
332
- return () => d() ? e.renderOption(n) : n.label;
333
- })(), null), P((d) => {
334
- var A = S + "-" + f(), F = e.values.includes(n.value), T = n.disabled || void 0, p = e.values.includes(n.value) ? "true" : void 0, ee = ne("flex min-h-[var(--floe-row-height)] items-center gap-2 rounded-sm px-2 text-[length:var(--floe-type-control)]", L() === f() && "bg-accent text-accent-foreground", n.disabled ? "opacity-50" : "cursor-pointer");
335
- return A !== d.e && m(s, "id", d.e = A), F !== d.t && m(s, "aria-selected", d.t = F), T !== d.a && m(s, "aria-disabled", d.a = T), p !== d.o && m(s, "data-floe-selected", d.o = p), ee !== d.i && ve(s, d.i = ee), d;
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
- a: void 0,
340
- o: void 0,
341
- i: void 0
342
- }), s;
414
+ t: void 0
415
+ }), u;
343
416
  })()
344
- })), o(l, c(V, {
417
+ })), s(l, g(V, {
345
418
  get when() {
346
- return z(() => !C().length && !e.loading)() && !e.error;
419
+ return H(() => !L().length && !e.loading)() && !e.error;
347
420
  },
348
421
  get children() {
349
- var n = Te();
350
- return o(n, () => u.t("noResults")), n;
422
+ var n = He();
423
+ return s(n, () => h.t("noResults")), n;
351
424
  }
352
- }), null), P((n) => {
353
- var f = D.state(), s = se(), $ = D.exiting(), d = D.exiting() ? "true" : void 0, A = e.ariaLabel, F = e.ariaLabelledBy ?? (e.ariaLabel ? void 0 : W()), T = e.multiple || void 0;
354
- return f !== n.e && m(l, "data-floating-presence", n.e = f), s !== n.t && m(l, "data-floating-side", n.t = s), $ !== n.a && (l.inert = n.a = $), d !== n.o && m(l, "aria-hidden", n.o = d), A !== n.i && m(r, "aria-label", n.i = A), F !== n.n && m(r, "aria-labelledby", n.n = F), T !== n.s && m(r, "aria-multiselectable", n.s = T), n;
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), P((l) => {
368
- var r = u.direction, v = e.name ?? g.name, n = e.form, f = e.required ?? g.required, s = _(), $ = e.multiple;
369
- return r !== l.e && m(t, "dir", l.e = r), v !== l.t && m(a, "name", l.t = v), n !== l.a && m(a, "form", l.a = n), f !== l.o && (a.required = l.o = f), s !== l.i && (a.disabled = l.i = s), $ !== l.n && (a.multiple = l.n = $), l;
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 tt(e) {
381
- const [u, g] = K({
454
+ function dt(e) {
455
+ const [h, w] = Q({
382
456
  value: () => e.value,
383
457
  defaultValue: e.defaultValue ?? "",
384
- onChange: (b) => e.onChange?.(b)
458
+ onChange: (k) => e.onChange?.(k)
385
459
  });
386
- return c(U, I(e, {
460
+ return g(Y, K(e, {
387
461
  get values() {
388
- return [u()];
462
+ return [h()];
389
463
  },
390
464
  get resetValues() {
391
465
  return [e.defaultValue ?? ""];
392
466
  },
393
- onValuesChange: (b) => g(b[0] ?? "")
467
+ onValuesChange: (k) => w(k[0] ?? "")
394
468
  }));
395
469
  }
396
- function lt(e) {
397
- const [u, g] = K({
470
+ function ct(e) {
471
+ const [h, w] = Q({
398
472
  value: () => e.value,
399
473
  defaultValue: e.defaultValue ?? "",
400
- onChange: (b) => e.onChange?.(b)
474
+ onChange: (k) => e.onChange?.(k)
401
475
  });
402
- return c(U, I(e, {
476
+ return g(Y, K(e, {
403
477
  searchable: !0,
404
478
  get values() {
405
- return [u()];
479
+ return [h()];
406
480
  },
407
481
  get resetValues() {
408
482
  return [e.defaultValue ?? ""];
409
483
  },
410
- onValuesChange: (b) => g(b[0] ?? "")
484
+ onValuesChange: (k) => w(k[0] ?? "")
411
485
  }));
412
486
  }
413
- function at(e) {
414
- const [u, g] = K({
487
+ function ft(e) {
488
+ const [h, w] = Q({
415
489
  value: () => e.value,
416
490
  defaultValue: e.defaultValue ?? [],
417
- onChange: (b) => e.onChange?.(b)
491
+ onChange: (k) => e.onChange?.(k)
418
492
  });
419
- return c(U, I(e, {
493
+ return g(Y, K(e, {
420
494
  multiple: !0,
421
495
  get values() {
422
- return u();
496
+ return h();
423
497
  },
424
498
  get resetValues() {
425
499
  return e.defaultValue ?? [];
426
500
  },
427
- onValuesChange: g
501
+ onValuesChange: w
428
502
  }));
429
503
  }
430
- ge(["click", "pointerdown", "pointermove"]);
504
+ Ce(["keydown", "input", "click", "pointerdown", "pointermove"]);
431
505
  export {
432
- lt as Combobox,
433
- at as MultiSelect,
434
- tt as Select
506
+ ct as Combobox,
507
+ ft as MultiSelect,
508
+ dt as Select
435
509
  };