@floegence/floe-webapp-core 0.52.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.
@@ -1,9 +1,9 @@
1
- import { setAttribute as f, insert as g, createComponent as l, Portal as W, use as O, spread as G, mergeProps as J, effect as F, className as p, template as P, memo as z, delegateEvents as te } from "solid-js/web";
1
+ import { setAttribute as f, insert as g, createComponent as l, Portal as W, use as I, spread as G, mergeProps as J, effect as F, className as O, template as P, memo as z, delegateEvents as te } from "solid-js/web";
2
2
  import { createSignal as _, createMemo as ne, createEffect as Q, onCleanup as re, Show as y, Index as V } from "solid-js";
3
3
  import { cn as M } from "../../utils/cn.js";
4
4
  import { deferNonBlocking as oe } from "../../utils/defer.js";
5
5
  import { ChevronDown as ae, Check as ie, ChevronRight as ue } from "../icons/index.js";
6
- import { focusMenuItem as I, MENU_ITEM_SELECTOR as le, moveMenuFocus as U, calculateMenuPosition as se, calculateSubmenuPosition as de } from "./menuUtils.js";
6
+ import { focusMenuItem as p, MENU_ITEM_SELECTOR as le, moveMenuFocus as U, calculateMenuPosition as se, calculateSubmenuPosition as de } from "./menuUtils.js";
7
7
  import { LOCAL_INTERACTION_SURFACE_ATTR as X } from "./localInteractionSurface.js";
8
8
  import { createFloatingPresence as Y } from "./floatingPresence.js";
9
9
  import { useOverlayMask as ce } from "../../hooks/useOverlayMask.js";
@@ -42,9 +42,9 @@ function $e(e) {
42
42
  x: -9999,
43
43
  y: -9999
44
44
  });
45
- let b, h;
46
- const v = `floe-dropdown-${Me += 1}`, $ = `${v}-menu`, w = ne(() => o.mounted() ? fe({
47
- owner: b
45
+ let v, h;
46
+ const b = `floe-dropdown-${Me += 1}`, $ = `${b}-menu`, w = ne(() => o.mounted() ? fe({
47
+ owner: v
48
48
  }) : {
49
49
  host: null,
50
50
  boundaryHost: null,
@@ -56,12 +56,12 @@ function $e(e) {
56
56
  boundaryRect: () => ge(w()),
57
57
  projectPosition: (r) => me(r, w())
58
58
  }, A = () => {
59
- d(!1), requestAnimationFrame(() => b?.focus());
59
+ d(!1), requestAnimationFrame(() => v?.focus());
60
60
  };
61
61
  ce({
62
62
  open: o.mounted,
63
63
  root: () => h,
64
- containsTarget: (r) => !!(r instanceof Element ? r : document.activeElement)?.closest(`[data-floe-dropdown="${v}"]`),
64
+ containsTarget: (r) => !!(r instanceof Element ? r : document.activeElement)?.closest(`[data-floe-dropdown="${b}"]`),
65
65
  onClose: A,
66
66
  onEscapeOutside: A,
67
67
  lockBodyScroll: !1,
@@ -73,8 +73,8 @@ function $e(e) {
73
73
  escapeKeyPhase: "bubble"
74
74
  });
75
75
  const C = () => {
76
- if (!b || !h) return;
77
- const r = b.getBoundingClientRect(), n = h.getBoundingClientRect(), i = se(r, n, e.align ?? "start", m.boundaryRect());
76
+ if (!v || !h) return;
77
+ const r = v.getBoundingClientRect(), n = h.getBoundingClientRect(), i = se(r, n, e.align ?? "start", m.boundaryRect());
78
78
  k(i);
79
79
  };
80
80
  Q(() => {
@@ -88,20 +88,22 @@ function $e(e) {
88
88
  if (!c()) return;
89
89
  const r = (n) => {
90
90
  const i = n.target;
91
- i && typeof i.closest == "function" && i.closest(`[data-floe-dropdown="${v}"]`) || d(!1);
91
+ i && typeof i.closest == "function" && i.closest(`[data-floe-dropdown="${b}"]`) || d(!1);
92
92
  };
93
93
  document.addEventListener("pointerdown", r, !0), requestAnimationFrame(() => {
94
- C(), I(h, e.value ? "selected" : "first");
94
+ C(), p(h, e.value ? "selected" : "first");
95
95
  }), re(() => {
96
96
  document.removeEventListener("pointerdown", r, !0);
97
97
  });
98
98
  });
99
99
  const j = (r) => {
100
100
  const n = e.onSelect;
101
- r.keepOpen || d(!1), oe(() => n(r.id));
101
+ r.keepOpen || (d(!1), v?.focus({
102
+ preventScroll: !0
103
+ })), oe(() => n(r.id));
102
104
  }, R = (r, n = "first") => {
103
105
  e.disabled || (d(r), requestAnimationFrame(() => {
104
- C(), I(h, n);
106
+ C(), p(h, n);
105
107
  }));
106
108
  }, T = (r) => {
107
109
  if (e.disabled) return;
@@ -126,13 +128,13 @@ function $e(e) {
126
128
  r.preventDefault(), U(i, t, -1);
127
129
  return;
128
130
  case "Home":
129
- r.preventDefault(), I(i, "first");
131
+ r.preventDefault(), p(i, "first");
130
132
  return;
131
133
  case "End":
132
- r.preventDefault(), I(i, "last");
134
+ r.preventDefault(), p(i, "last");
133
135
  return;
134
136
  case "Tab":
135
- r.preventDefault(), d(!1), b?.focus();
137
+ r.preventDefault(), d(!1), v?.focus();
136
138
  return;
137
139
  default:
138
140
  return;
@@ -140,7 +142,7 @@ function $e(e) {
140
142
  };
141
143
  return (() => {
142
144
  var r = he(), n = r.firstChild;
143
- f(r, "data-floe-dropdown", v), n.$$keydown = T, n.$$click = () => {
145
+ f(r, "data-floe-dropdown", b), n.$$keydown = T, n.$$click = () => {
144
146
  if (!e.disabled) {
145
147
  if (c()) {
146
148
  d(!1);
@@ -149,8 +151,8 @@ function $e(e) {
149
151
  R(!0, e.value ? "selected" : "first");
150
152
  }
151
153
  };
152
- var i = b;
153
- return typeof i == "function" ? O(i, n) : b = n, f(n, "aria-controls", $), g(n, () => e.trigger), g(r, l(y, {
154
+ var i = v;
155
+ return typeof i == "function" ? I(i, n) : v = n, f(n, "aria-controls", $), g(n, () => e.trigger), g(r, l(y, {
154
156
  get when() {
155
157
  return o.mounted();
156
158
  },
@@ -161,7 +163,7 @@ function $e(e) {
161
163
  },
162
164
  get children() {
163
165
  var t = H(), s = h;
164
- return typeof s == "function" ? O(s, t) : h = t, f(t, "data-floe-dropdown", v), G(t, J({
166
+ return typeof s == "function" ? I(s, t) : h = t, f(t, "data-floe-dropdown", b), G(t, J({
165
167
  get class() {
166
168
  return M(m.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", "floe-floating-presence floe-floating-menu");
167
169
  },
@@ -205,7 +207,7 @@ function $e(e) {
205
207
  },
206
208
  onSelect: j,
207
209
  onCloseMenu: () => d(!1),
208
- dropdownId: v,
210
+ dropdownId: b,
209
211
  portalLayout: m
210
212
  });
211
213
  }
@@ -216,7 +218,7 @@ function $e(e) {
216
218
  }
217
219
  }), null), F((t) => {
218
220
  var s = M("relative inline-block", e.class), u = M("cursor-pointer", e.triggerClass, e.disabled && "pointer-events-none opacity-50"), x = e.disabled ? -1 : 0, a = c(), S = e.triggerAriaLabel, E = e.disabled ? "true" : void 0, D = e.triggerInputSurface ? "true" : void 0, L = e.triggerInputSurface ? "inset" : void 0;
219
- return s !== t.e && p(r, t.e = s), u !== t.t && p(n, t.t = u), x !== t.a && f(n, "tabindex", t.a = x), a !== t.o && f(n, "aria-expanded", t.o = a), S !== t.i && f(n, "aria-label", t.i = S), E !== t.n && f(n, "aria-disabled", t.n = E), D !== t.s && f(n, "data-floe-input-surface", t.s = D), L !== t.h && f(n, "data-floe-surface", t.h = L), t;
221
+ return s !== t.e && O(r, t.e = s), u !== t.t && O(n, t.t = u), x !== t.a && f(n, "tabindex", t.a = x), a !== t.o && f(n, "aria-expanded", t.o = a), S !== t.i && f(n, "aria-label", t.i = S), E !== t.n && f(n, "aria-disabled", t.n = E), D !== t.s && f(n, "data-floe-input-surface", t.s = D), L !== t.h && f(n, "data-floe-surface", t.h = L), t;
220
222
  }, {
221
223
  e: void 0,
222
224
  t: void 0,
@@ -233,11 +235,11 @@ function ee(e) {
233
235
  const [c, d] = _(!1), o = () => e.item.children && e.item.children.length > 0, k = Y({
234
236
  open: () => !!(c() && o()),
235
237
  exitDurationMs: 100
236
- }), [b, h] = _({
238
+ }), [v, h] = _({
237
239
  x: -9999,
238
240
  y: -9999
239
241
  });
240
- let v, $, w, m;
242
+ let b, $, w, m;
241
243
  const A = `floe-dropdown-item-${ke += 1}`;
242
244
  Q(() => {
243
245
  k.mounted() || h({
@@ -246,8 +248,8 @@ function ee(e) {
246
248
  });
247
249
  });
248
250
  const C = () => {
249
- if (!v || !w) return;
250
- const n = v.getBoundingClientRect(), i = w.getBoundingClientRect(), t = de(n, i, e.portalLayout.boundaryRect());
251
+ if (!b || !w) return;
252
+ const n = b.getBoundingClientRect(), i = w.getBoundingClientRect(), t = de(n, i, e.portalLayout.boundaryRect());
251
253
  h(t);
252
254
  }, j = () => {
253
255
  o() && (clearTimeout(m), m = setTimeout(() => {
@@ -267,7 +269,7 @@ function ee(e) {
267
269
  }
268
270
  }, q = (n = "first") => {
269
271
  o() && (d(!0), requestAnimationFrame(() => {
270
- C(), I(w, n);
272
+ C(), p(w, n);
271
273
  }));
272
274
  }, r = () => {
273
275
  d(!1), requestAnimationFrame(() => $?.focus());
@@ -275,8 +277,8 @@ function ee(e) {
275
277
  return (() => {
276
278
  var n = ye();
277
279
  n.addEventListener("mouseleave", R), n.addEventListener("mouseenter", j);
278
- var i = v;
279
- return typeof i == "function" ? O(i, n) : v = n, g(n, l(y, {
280
+ var i = b;
281
+ return typeof i == "function" ? I(i, n) : b = n, g(n, l(y, {
280
282
  get when() {
281
283
  return e.item.content;
282
284
  },
@@ -284,7 +286,7 @@ function ee(e) {
284
286
  var t = H();
285
287
  return t.$$click = T, g(t, e.item.content), F((s) => {
286
288
  var u = M("w-full px-2 py-1.5", e.item.tone === "danger" && "text-destructive", e.item.disabled && "opacity-50 pointer-events-none"), x = e.item.tone ?? "default";
287
- return u !== s.e && p(t, s.e = u), x !== s.t && f(t, "data-tone", s.t = x), s;
289
+ return u !== s.e && O(t, s.e = u), x !== s.t && f(t, "data-tone", s.t = x), s;
288
290
  }, {
289
291
  e: void 0,
290
292
  t: void 0
@@ -300,7 +302,7 @@ function ee(e) {
300
302
  e.item.disabled || o() && ((a.key === "ArrowRight" || a.key === "Enter" || a.key === " ") && (a.preventDefault(), q("first")), a.key === "ArrowLeft" && (a.preventDefault(), r()));
301
303
  }, t.$$click = T;
302
304
  var x = $;
303
- return typeof x == "function" ? O(x, t) : $ = t, f(t, "id", A), g(s, l(y, {
305
+ return typeof x == "function" ? I(x, t) : $ = t, f(t, "id", A), g(s, l(y, {
304
306
  get when() {
305
307
  return z(() => !!e.selected)() && !o();
306
308
  },
@@ -329,7 +331,7 @@ function ee(e) {
329
331
  }
330
332
  }), null), F((a) => {
331
333
  var S = M("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.tone === "danger" && "text-destructive", e.item.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-accent cursor-pointer"), E = e.item.disabled, D = o() ? "menu" : void 0, L = o() ? c() : void 0, K = e.selected && !o() ? "true" : void 0, N = e.item.tone ?? "default";
332
- return S !== a.e && p(t, a.e = S), E !== a.t && (t.disabled = a.t = E), D !== a.a && f(t, "aria-haspopup", a.a = D), L !== a.o && f(t, "aria-expanded", a.o = L), K !== a.i && f(t, "data-floe-selected", a.i = K), N !== a.n && f(t, "data-tone", a.n = N), a;
334
+ return S !== a.e && O(t, a.e = S), E !== a.t && (t.disabled = a.t = E), D !== a.a && f(t, "aria-haspopup", a.a = D), L !== a.o && f(t, "aria-expanded", a.o = L), K !== a.i && f(t, "data-floe-selected", a.i = K), N !== a.n && f(t, "data-tone", a.n = N), a;
333
335
  }, {
334
336
  e: void 0,
335
337
  t: void 0,
@@ -350,7 +352,7 @@ function ee(e) {
350
352
  },
351
353
  get children() {
352
354
  var t = H(), s = w;
353
- return typeof s == "function" ? O(s, t) : w = t, G(t, J({
355
+ return typeof s == "function" ? I(s, t) : w = t, G(t, J({
354
356
  get class() {
355
357
  return M(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", "floe-floating-presence floe-floating-menu floe-floating-submenu");
356
358
  },
@@ -368,8 +370,8 @@ function ee(e) {
368
370
  }), {
369
371
  get style() {
370
372
  return {
371
- left: `${e.portalLayout.projectPosition(b()).x}px`,
372
- top: `${e.portalLayout.projectPosition(b()).y}px`
373
+ left: `${e.portalLayout.projectPosition(v()).x}px`,
374
+ top: `${e.portalLayout.projectPosition(v()).y}px`
373
375
  };
374
376
  },
375
377
  role: "menu",
@@ -434,7 +436,7 @@ function Fe(e) {
434
436
  get trigger() {
435
437
  return [(() => {
436
438
  var o = Se();
437
- return g(o, () => c()?.label ?? e.placeholder ?? "Select..."), F(() => p(o, M("truncate", !c() && "text-muted-foreground"))), o;
439
+ return g(o, () => c()?.label ?? e.placeholder ?? "Select..."), F(() => O(o, M("truncate", !c() && "text-muted-foreground"))), o;
438
440
  })(), l(ae, {
439
441
  class: "w-3.5 h-3.5 text-muted-foreground"
440
442
  })];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.52.0",
3
+ "version": "0.52.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",