@floegence/floe-webapp-core 0.101.30 → 0.101.33

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,31 +1,32 @@
1
- import { setAttribute as d, insert as c, createComponent as u, Portal as Q, use as F, spread as X, mergeProps as Y, effect as z, className as _, template as L, memo as G, delegateEvents as ie } from "solid-js/web";
2
- import { createControllableValue as ae } from "./controllable.js";
3
- import { useFloeLocale as le } from "../../context/LocaleContext.js";
4
- import { createSignal as q, createMemo as ue, createEffect as Z, onCleanup as de, Show as b, Index as ee } from "solid-js";
1
+ import { setAttribute as d, insert as c, createComponent as u, Portal as X, use as F, spread as Y, mergeProps as Z, effect as z, className as _, template as L, memo as G, delegateEvents as ie } from "solid-js/web";
2
+ import { createControllableValue as le } from "./controllable.js";
3
+ import { useFloeLocale as ue } from "../../context/LocaleContext.js";
4
+ import { createSignal as q, createMemo as de, createEffect as ee, onCleanup as se, Show as b, Index as te } from "solid-js";
5
+ import { composedClosest as J, composedEventTarget as ce } from "../../utils/domScope.js";
5
6
  import { cn as A } from "../../utils/cn.js";
6
- import { deferNonBlocking as se } from "../../utils/defer.js";
7
- import { Check as ce, ChevronRight as fe } from "../icons/index.js";
8
- import { focusMenuItem as T, calculateMenuPosition as me, MENU_ITEM_SELECTOR as ge, moveMenuFocus as J, calculateSubmenuPosition as ve } from "./menuUtils.js";
9
- import { LOCAL_INTERACTION_SURFACE_ATTR as te } from "./localInteractionSurface.js";
10
- import { createFloatingPresence as ne } from "./floatingPresence.js";
11
- import { useOverlayMask as he } from "../../hooks/useOverlayMask.js";
12
- import { resolveSurfacePortalHost as be, projectSurfacePortalPosition as ye, resolveSurfacePortalBoundaryRect as we, isSurfacePortalMode as Se, resolveSurfacePortalMount as xe } from "./dialogSurfaceScope.js";
13
- var U = /* @__PURE__ */ L("<div>"), ke = /* @__PURE__ */ L("<div><div role=button aria-haspopup=menu data-floe-dropdown-trigger>"), re = /* @__PURE__ */ L('<div class="my-1 h-px bg-border"role=separator>'), Me = /* @__PURE__ */ L('<button type=button data-floe-interactive=item role=menuitem><span class="w-3.5 h-3.5 flex items-center justify-center"></span><span class="flex-1 text-left">'), Ce = /* @__PURE__ */ L("<div class=relative>"), Pe = /* @__PURE__ */ L('<span class="w-3.5 h-3.5 flex items-center justify-center">');
14
- let Ae = 0, Le = 0;
15
- function Re(e, y) {
7
+ import { deferNonBlocking as fe } from "../../utils/defer.js";
8
+ import { Check as me, ChevronRight as ge } from "../icons/index.js";
9
+ import { focusMenuItem as T, calculateMenuPosition as ve, MENU_ITEM_SELECTOR as he, moveMenuFocus as Q, calculateSubmenuPosition as be } from "./menuUtils.js";
10
+ import { LOCAL_INTERACTION_SURFACE_ATTR as ne } from "./localInteractionSurface.js";
11
+ import { createFloatingPresence as re } from "./floatingPresence.js";
12
+ import { useOverlayMask as we } from "../../hooks/useOverlayMask.js";
13
+ import { resolveSurfacePortalHost as ye, projectSurfacePortalPosition as Se, resolveSurfacePortalBoundaryRect as xe, isSurfacePortalMode as ke, resolveSurfacePortalMount as Me } from "./dialogSurfaceScope.js";
14
+ var U = /* @__PURE__ */ L("<div>"), Ce = /* @__PURE__ */ L("<div><div role=button aria-haspopup=menu data-floe-dropdown-trigger>"), oe = /* @__PURE__ */ L('<div class="my-1 h-px bg-border"role=separator>'), Pe = /* @__PURE__ */ L('<button type=button data-floe-interactive=item role=menuitem><span class="w-3.5 h-3.5 flex items-center justify-center"></span><span class="flex-1 text-left">'), Ae = /* @__PURE__ */ L("<div class=relative>"), Le = /* @__PURE__ */ L('<span class="w-3.5 h-3.5 flex items-center justify-center">');
15
+ let Re = 0, Ee = 0;
16
+ function Oe(e, w) {
16
17
  switch (e) {
17
18
  case "Enter":
18
19
  case " ":
19
- return y.open ? {
20
+ return w.open ? {
20
21
  nextOpen: !1
21
22
  } : {
22
23
  nextOpen: !0,
23
- focusMode: y.hasSelection ? "selected" : "first"
24
+ focusMode: w.hasSelection ? "selected" : "first"
24
25
  };
25
26
  case "ArrowDown":
26
27
  return {
27
28
  nextOpen: !0,
28
- focusMode: y.hasSelection ? "selected" : "first"
29
+ focusMode: w.hasSelection ? "selected" : "first"
29
30
  };
30
31
  case "ArrowUp":
31
32
  return {
@@ -36,12 +37,12 @@ function Re(e, y) {
36
37
  return null;
37
38
  }
38
39
  }
39
- function Ke(e) {
40
- const y = le(), [g, a] = ae({
40
+ function ze(e) {
41
+ const w = ue(), [g, i] = le({
41
42
  value: () => e.open,
42
43
  defaultValue: e.defaultOpen ?? !1,
43
44
  onChange: (n) => e.onOpenChange?.(n)
44
- }), k = ne({
45
+ }), k = re({
45
46
  open: g,
46
47
  element: () => f
47
48
  }), [M, R] = q({
@@ -49,7 +50,7 @@ function Ke(e) {
49
50
  y: -9999
50
51
  }), [B, N] = q("bottom");
51
52
  let v, f;
52
- const h = `floe-dropdown-${Ae += 1}`, w = `${h}-menu`, S = () => typeof e.items == "function" ? e.items() : e.items, C = ue(() => k.mounted() ? be({
53
+ const h = `floe-dropdown-${Re += 1}`, y = `${h}-menu`, S = () => typeof e.items == "function" ? e.items() : e.items, C = de(() => k.mounted() ? ye({
53
54
  owner: v
54
55
  }) : {
55
56
  host: null,
@@ -57,19 +58,19 @@ function Ke(e) {
57
58
  mountHost: null,
58
59
  mode: "global"
59
60
  }), m = {
60
- mount: () => xe(C()),
61
- isSurfaceMode: () => Se(C()),
62
- boundaryRect: () => we(C()),
63
- projectPosition: (n) => ye(n, C())
64
- }, j = () => {
65
- a(!1), requestAnimationFrame(() => v?.focus());
61
+ mount: () => Me(C()),
62
+ isSurfaceMode: () => ke(C()),
63
+ boundaryRect: () => xe(C()),
64
+ projectPosition: (n) => Se(n, C())
65
+ }, p = () => {
66
+ i(!1), requestAnimationFrame(() => v?.focus());
66
67
  };
67
- he({
68
+ we({
68
69
  open: k.mounted,
69
70
  root: () => f,
70
- containsTarget: (n) => !!(n instanceof Element ? n : document.activeElement)?.closest(`[data-floe-dropdown="${h}"]`),
71
- onClose: j,
72
- onEscapeOutside: j,
71
+ containsTarget: (n) => !!J(n, `[data-floe-dropdown="${h}"]`),
72
+ onClose: p,
73
+ onEscapeOutside: p,
73
74
  lockBodyScroll: !1,
74
75
  trapFocus: !1,
75
76
  autoFocus: !1,
@@ -80,10 +81,10 @@ function Ke(e) {
80
81
  });
81
82
  const P = () => {
82
83
  if (!v || !f) return;
83
- const n = v.getBoundingClientRect(), t = f.getBoundingClientRect(), o = me(n, t, y.direction === "rtl" ? e.align === "end" ? "start" : e.align === "center" ? "center" : "end" : e.align ?? "start", m.boundaryRect());
84
+ const n = v.getBoundingClientRect(), t = f.getBoundingClientRect(), o = ve(n, t, w.direction === "rtl" ? e.align === "end" ? "start" : e.align === "center" ? "center" : "end" : e.align ?? "start", m.boundaryRect());
84
85
  N(o.y < n.top ? "top" : "bottom"), R(o);
85
86
  };
86
- Z(() => {
87
+ ee(() => {
87
88
  if (!k.mounted()) {
88
89
  R({
89
90
  x: -9999,
@@ -93,45 +94,44 @@ function Ke(e) {
93
94
  }
94
95
  if (!g()) return;
95
96
  const n = (t) => {
96
- const o = t.target;
97
- o && typeof o.closest == "function" && o.closest(`[data-floe-dropdown="${h}"]`) || a(!1);
97
+ J(ce(t), `[data-floe-dropdown="${h}"]`) || i(!1);
98
98
  };
99
99
  document.addEventListener("pointerdown", n, !0), requestAnimationFrame(() => {
100
100
  P(), T(f, e.value ? "selected" : "first");
101
- }), de(() => {
101
+ }), se(() => {
102
102
  document.removeEventListener("pointerdown", n, !0);
103
103
  });
104
104
  });
105
- const p = (n) => {
105
+ const j = (n) => {
106
106
  const t = e.onSelect;
107
- n.keepOpen || (a(!1), v?.focus({
107
+ n.keepOpen || (i(!1), v?.focus({
108
108
  preventScroll: !0
109
- })), se(() => t(n.id));
109
+ })), fe(() => t(n.id));
110
110
  }, H = (n, t = "first") => {
111
- e.disabled || (a(n), requestAnimationFrame(() => {
111
+ e.disabled || (i(n), requestAnimationFrame(() => {
112
112
  P(), T(f, t);
113
113
  }));
114
114
  }, K = (n) => {
115
115
  if (e.disabled) return;
116
- const t = Re(n.key, {
116
+ const t = Oe(n.key, {
117
117
  open: g(),
118
118
  hasSelection: !!e.value
119
119
  });
120
120
  if (t) {
121
121
  if (n.preventDefault(), !t.nextOpen) {
122
- a(!1);
122
+ i(!1);
123
123
  return;
124
124
  }
125
125
  H(!0, t.focusMode ?? "first");
126
126
  }
127
127
  }, l = (n) => {
128
- const t = n.target, o = t?.closest('[role="menu"]'), r = t?.closest(ge);
128
+ const t = n.target, o = t?.closest('[role="menu"]'), r = t?.closest(he);
129
129
  switch (n.key) {
130
130
  case "ArrowDown":
131
- n.preventDefault(), J(o, r, 1);
131
+ n.preventDefault(), Q(o, r, 1);
132
132
  return;
133
133
  case "ArrowUp":
134
- n.preventDefault(), J(o, r, -1);
134
+ n.preventDefault(), Q(o, r, -1);
135
135
  return;
136
136
  case "Home":
137
137
  n.preventDefault(), T(o, "first");
@@ -140,30 +140,30 @@ function Ke(e) {
140
140
  n.preventDefault(), T(o, "last");
141
141
  return;
142
142
  case "Tab":
143
- n.preventDefault(), a(!1), v?.focus();
143
+ n.preventDefault(), i(!1), v?.focus();
144
144
  return;
145
145
  default:
146
146
  return;
147
147
  }
148
148
  };
149
149
  return (() => {
150
- var n = ke(), t = n.firstChild;
150
+ var n = Ce(), t = n.firstChild;
151
151
  d(n, "data-floe-dropdown", h), t.$$keydown = K, t.$$click = () => {
152
152
  if (!e.disabled) {
153
153
  if (g()) {
154
- a(!1);
154
+ i(!1);
155
155
  return;
156
156
  }
157
157
  H(!0, e.value ? "selected" : "first");
158
158
  }
159
159
  };
160
160
  var o = v;
161
- return typeof o == "function" ? F(o, t) : v = t, d(t, "aria-controls", w), c(t, () => e.trigger), c(n, u(b, {
161
+ return typeof o == "function" ? F(o, t) : v = t, d(t, "aria-controls", y), c(t, () => e.trigger), c(n, u(b, {
162
162
  get when() {
163
163
  return k.mounted();
164
164
  },
165
165
  get children() {
166
- return u(Q, {
166
+ return u(X, {
167
167
  get mount() {
168
168
  return m.mount();
169
169
  },
@@ -173,7 +173,7 @@ function Ke(e) {
173
173
  f = s, queueMicrotask(() => {
174
174
  s.isConnected && P();
175
175
  });
176
- }, r), d(r, "data-floe-dropdown", h), X(r, Y({
176
+ }, r), d(r, "data-floe-dropdown", h), Y(r, Z({
177
177
  get class() {
178
178
  return A(m.isSurfaceMode() ? "absolute z-20 min-w-36" : "fixed z-50 min-w-36", "bg-popover text-popover-foreground p-1", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-elevation-float)]", "floe-floating-presence floe-floating-menu");
179
179
  },
@@ -187,7 +187,7 @@ function Ke(e) {
187
187
  return k.exiting() ? "true" : void 0;
188
188
  }
189
189
  }, () => ({
190
- [te]: m.isSurfaceMode() ? "true" : void 0
190
+ [ne]: m.isSurfaceMode() ? "true" : void 0
191
191
  }), {
192
192
  get style() {
193
193
  return {
@@ -197,9 +197,9 @@ function Ke(e) {
197
197
  },
198
198
  role: "menu",
199
199
  "data-floe-surface": "floating",
200
- id: w,
200
+ id: y,
201
201
  onKeyDown: l
202
- }), !1, !0), c(r, u(ee, {
202
+ }), !1, !0), c(r, u(te, {
203
203
  get each() {
204
204
  return S();
205
205
  },
@@ -208,18 +208,18 @@ function Ke(e) {
208
208
  return !s().separator;
209
209
  },
210
210
  get fallback() {
211
- return re();
211
+ return oe();
212
212
  },
213
213
  get children() {
214
- return u(oe, {
214
+ return u(ae, {
215
215
  get item() {
216
216
  return s();
217
217
  },
218
218
  get selected() {
219
219
  return e.value === s().id;
220
220
  },
221
- onSelect: p,
222
- onCloseMenu: () => a(!1),
221
+ onSelect: j,
222
+ onCloseMenu: () => i(!1),
223
223
  dropdownId: h,
224
224
  portalLayout: m
225
225
  });
@@ -230,8 +230,8 @@ function Ke(e) {
230
230
  });
231
231
  }
232
232
  }), null), z((r) => {
233
- var s = A("relative inline-block", e.class), i = A("cursor-pointer", e.triggerClass, e.disabled && "pointer-events-none opacity-50"), x = e.disabled ? -1 : 0, E = g(), O = e.triggerAriaLabel, $ = e.triggerAriaLabelledBy, D = e.triggerAriaDescribedBy, I = e.disabled ? "true" : void 0, V = e.triggerInputSurface ? "true" : void 0, W = e.triggerInputSurface ? "inset" : void 0;
234
- return s !== r.e && _(n, r.e = s), i !== r.t && _(t, r.t = i), x !== r.a && d(t, "tabindex", r.a = x), E !== r.o && d(t, "aria-expanded", r.o = E), O !== r.i && d(t, "aria-label", r.i = O), $ !== r.n && d(t, "aria-labelledby", r.n = $), D !== r.s && d(t, "aria-describedby", r.s = D), I !== r.h && d(t, "aria-disabled", r.h = I), V !== r.r && d(t, "data-floe-input-surface", r.r = V), W !== r.d && d(t, "data-floe-surface", r.d = W), r;
233
+ var s = A("relative inline-block", e.class), a = A("cursor-pointer", e.triggerClass, e.disabled && "pointer-events-none opacity-50"), x = e.disabled ? -1 : 0, E = g(), O = e.triggerAriaLabel, $ = e.triggerAriaLabelledBy, D = e.triggerAriaDescribedBy, I = e.disabled ? "true" : void 0, V = e.triggerInputSurface ? "true" : void 0, W = e.triggerInputSurface ? "inset" : void 0;
234
+ return s !== r.e && _(n, r.e = s), a !== r.t && _(t, r.t = a), x !== r.a && d(t, "tabindex", r.a = x), E !== r.o && d(t, "aria-expanded", r.o = E), O !== r.i && d(t, "aria-label", r.i = O), $ !== r.n && d(t, "aria-labelledby", r.n = $), D !== r.s && d(t, "aria-describedby", r.s = D), I !== r.h && d(t, "aria-disabled", r.h = I), V !== r.r && d(t, "data-floe-input-surface", r.r = V), W !== r.d && d(t, "data-floe-surface", r.d = W), r;
235
235
  }, {
236
236
  e: void 0,
237
237
  t: void 0,
@@ -246,52 +246,52 @@ function Ke(e) {
246
246
  }), n;
247
247
  })();
248
248
  }
249
- function oe(e) {
250
- const [y, g] = q(!1), a = () => e.item.children && e.item.children.length > 0, M = ne({
251
- open: () => !!(y() && a()),
252
- element: () => w
249
+ function ae(e) {
250
+ const [w, g] = q(!1), i = () => e.item.children && e.item.children.length > 0, M = re({
251
+ open: () => !!(w() && i()),
252
+ element: () => y
253
253
  }), [R, B] = q({
254
254
  x: -9999,
255
255
  y: -9999
256
256
  }), [N, v] = q("right");
257
- let f, h, w, S;
258
- const C = `floe-dropdown-item-${Le += 1}`;
259
- Z(() => {
257
+ let f, h, y, S;
258
+ const C = `floe-dropdown-item-${Ee += 1}`;
259
+ ee(() => {
260
260
  M.mounted() || B({
261
261
  x: -9999,
262
262
  y: -9999
263
263
  });
264
264
  });
265
265
  const m = () => {
266
- if (!f || !w) return;
267
- const l = f.getBoundingClientRect(), n = w.getBoundingClientRect(), t = ve(l, n, e.portalLayout.boundaryRect());
266
+ if (!f || !y) return;
267
+ const l = f.getBoundingClientRect(), n = y.getBoundingClientRect(), t = be(l, n, e.portalLayout.boundaryRect());
268
268
  v(t.x < l.left ? "left" : "right"), B(t);
269
- }, j = () => {
270
- a() && (clearTimeout(S), S = setTimeout(() => {
269
+ }, p = () => {
270
+ i() && (clearTimeout(S), S = setTimeout(() => {
271
271
  g(!0), requestAnimationFrame(m);
272
272
  }, 100));
273
273
  }, P = () => {
274
- a() && (clearTimeout(S), S = void 0, !e.item.keepOpen && (S = setTimeout(() => {
274
+ i() && (clearTimeout(S), S = void 0, !e.item.keepOpen && (S = setTimeout(() => {
275
275
  g(!1);
276
276
  }, 150)));
277
- }, p = (l) => {
277
+ }, j = (l) => {
278
278
  if (!e.item.disabled) {
279
279
  if (e.item.content && e.item.keepOpen) {
280
280
  l.stopPropagation();
281
281
  return;
282
282
  }
283
- a() ? (g((n) => !n), requestAnimationFrame(m)) : e.item.content || e.onSelect(e.item);
283
+ i() ? (g((n) => !n), requestAnimationFrame(m)) : e.item.content || e.onSelect(e.item);
284
284
  }
285
285
  }, H = (l = "first") => {
286
- a() && (g(!0), requestAnimationFrame(() => {
287
- m(), T(w, l);
286
+ i() && (g(!0), requestAnimationFrame(() => {
287
+ m(), T(y, l);
288
288
  }));
289
289
  }, K = () => {
290
290
  g(!1), requestAnimationFrame(() => h?.focus());
291
291
  };
292
292
  return (() => {
293
- var l = Ce();
294
- l.addEventListener("mouseleave", P), l.addEventListener("mouseenter", j);
293
+ var l = Ae();
294
+ l.addEventListener("mouseleave", P), l.addEventListener("mouseenter", p);
295
295
  var n = f;
296
296
  return typeof n == "function" ? F(n, l) : f = l, c(l, u(b, {
297
297
  get when() {
@@ -299,7 +299,7 @@ function oe(e) {
299
299
  },
300
300
  get children() {
301
301
  var t = U();
302
- return t.$$click = p, c(t, e.item.content), z((o) => {
302
+ return t.$$click = j, c(t, e.item.content), z((o) => {
303
303
  var r = A("w-full px-2 py-1.5", e.item.tone === "danger" && "text-error", e.item.disabled && "opacity-50 pointer-events-none"), s = e.item.tone ?? "default";
304
304
  return r !== o.e && _(t, o.e = r), s !== o.t && d(t, "data-tone", o.t = s), o;
305
305
  }, {
@@ -312,17 +312,17 @@ function oe(e) {
312
312
  return !e.item.content;
313
313
  },
314
314
  get children() {
315
- var t = Me(), o = t.firstChild, r = o.nextSibling;
316
- t.$$keydown = (i) => {
317
- e.item.disabled || a() && ((i.key === "ArrowRight" || i.key === "Enter" || i.key === " ") && (i.preventDefault(), H("first")), i.key === "ArrowLeft" && (i.preventDefault(), K()));
318
- }, t.$$click = p;
315
+ var t = Pe(), o = t.firstChild, r = o.nextSibling;
316
+ t.$$keydown = (a) => {
317
+ e.item.disabled || i() && ((a.key === "ArrowRight" || a.key === "Enter" || a.key === " ") && (a.preventDefault(), H("first")), a.key === "ArrowLeft" && (a.preventDefault(), K()));
318
+ }, t.$$click = j;
319
319
  var s = h;
320
320
  return typeof s == "function" ? F(s, t) : h = t, d(t, "id", C), c(o, u(b, {
321
321
  get when() {
322
- return G(() => !!e.selected)() && !a();
322
+ return G(() => !!e.selected)() && !i();
323
323
  },
324
324
  get children() {
325
- return u(ce, {
325
+ return u(me, {
326
326
  class: "w-3 h-3"
327
327
  });
328
328
  }
@@ -331,22 +331,22 @@ function oe(e) {
331
331
  return e.item.icon;
332
332
  },
333
333
  keyed: !0,
334
- children: (i) => (() => {
335
- var x = Pe();
336
- return c(x, i), x;
334
+ children: (a) => (() => {
335
+ var x = Le();
336
+ return c(x, a), x;
337
337
  })()
338
338
  }), r), c(r, () => e.item.label), c(t, u(b, {
339
339
  get when() {
340
- return a();
340
+ return i();
341
341
  },
342
342
  get children() {
343
- return u(fe, {
343
+ return u(ge, {
344
344
  class: "w-3 h-3 text-[var(--floe-ink-quiet)]"
345
345
  });
346
346
  }
347
- }), null), z((i) => {
348
- var x = A("w-full flex items-center gap-2 px-2", "min-h-[var(--floe-row-height)] rounded-sm", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", "focus:outline-none", e.item.tone === "danger" ? "text-error" : "text-[var(--floe-ink-soft)]", e.item.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), E = e.item.disabled, O = a() ? "menu" : void 0, $ = a() ? y() : void 0, D = e.selected && !a() ? "true" : void 0, I = e.item.tone ?? "default";
349
- return x !== i.e && _(t, i.e = x), E !== i.t && (t.disabled = i.t = E), O !== i.a && d(t, "aria-haspopup", i.a = O), $ !== i.o && d(t, "aria-expanded", i.o = $), D !== i.i && d(t, "data-floe-selected", i.i = D), I !== i.n && d(t, "data-tone", i.n = I), i;
347
+ }), null), z((a) => {
348
+ var x = A("w-full flex items-center gap-2 px-2", "min-h-[var(--floe-row-height)] rounded-sm", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", "focus:outline-none", e.item.tone === "danger" ? "text-error" : "text-[var(--floe-ink-soft)]", e.item.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), E = e.item.disabled, O = i() ? "menu" : void 0, $ = i() ? w() : void 0, D = e.selected && !i() ? "true" : void 0, I = e.item.tone ?? "default";
349
+ return x !== a.e && _(t, a.e = x), E !== a.t && (t.disabled = a.t = E), O !== a.a && d(t, "aria-haspopup", a.a = O), $ !== a.o && d(t, "aria-expanded", a.o = $), D !== a.i && d(t, "data-floe-selected", a.i = D), I !== a.n && d(t, "data-tone", a.n = I), a;
350
350
  }, {
351
351
  e: void 0,
352
352
  t: void 0,
@@ -358,20 +358,20 @@ function oe(e) {
358
358
  }
359
359
  }), null), c(l, u(b, {
360
360
  get when() {
361
- return G(() => !!M.mounted())() && a();
361
+ return G(() => !!M.mounted())() && i();
362
362
  },
363
363
  get children() {
364
- return u(Q, {
364
+ return u(X, {
365
365
  get mount() {
366
366
  return e.portalLayout.mount();
367
367
  },
368
368
  get children() {
369
369
  var t = U();
370
370
  return F((o) => {
371
- w = o, queueMicrotask(() => {
371
+ y = o, queueMicrotask(() => {
372
372
  o.isConnected && m();
373
373
  });
374
- }, t), X(t, Y({
374
+ }, t), Y(t, Z({
375
375
  get class() {
376
376
  return A(e.portalLayout.isSurfaceMode() ? "absolute z-20 min-w-36" : "fixed z-50 min-w-36", "bg-popover text-popover-foreground p-1", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-elevation-float)]", "floe-floating-presence floe-floating-menu floe-floating-submenu");
377
377
  },
@@ -388,7 +388,7 @@ function oe(e) {
388
388
  return M.exiting() ? "true" : void 0;
389
389
  }
390
390
  }, () => ({
391
- [te]: e.portalLayout.isSurfaceMode() ? "true" : void 0
391
+ [ne]: e.portalLayout.isSurfaceMode() ? "true" : void 0
392
392
  }), {
393
393
  get style() {
394
394
  return {
@@ -406,7 +406,7 @@ function oe(e) {
406
406
  onKeyDown: (o) => {
407
407
  o.key !== "ArrowLeft" && o.key !== "Escape" || (o.preventDefault(), o.stopPropagation(), K());
408
408
  }
409
- }), !1, !0), c(t, u(ee, {
409
+ }), !1, !0), c(t, u(te, {
410
410
  get each() {
411
411
  return e.item.children;
412
412
  },
@@ -415,10 +415,10 @@ function oe(e) {
415
415
  return !o().separator;
416
416
  },
417
417
  get fallback() {
418
- return re();
418
+ return oe();
419
419
  },
420
420
  get children() {
421
- return u(oe, {
421
+ return u(ae, {
422
422
  get item() {
423
423
  return o();
424
424
  },
@@ -447,6 +447,6 @@ function oe(e) {
447
447
  }
448
448
  ie(["click", "keydown"]);
449
449
  export {
450
- Ke as Dropdown,
451
- Re as resolveDropdownTriggerKeyAction
450
+ ze as Dropdown,
451
+ Oe as resolveDropdownTriggerKeyAction
452
452
  };
@@ -5,6 +5,9 @@ export interface TooltipProps {
5
5
  placement?: 'top' | 'bottom' | 'left' | 'right';
6
6
  delay?: number;
7
7
  class?: string;
8
+ triggerClass?: string;
9
+ /** Escape a scrolling navigation rail while retaining viewport anchoring. */
10
+ portalScope?: 'surface' | 'viewport';
8
11
  }
9
12
  /**
10
13
  * Simple tooltip component
@@ -1,60 +1,99 @@
1
- import { insert as s, createComponent as S, effect as k, className as g, setAttribute as h, template as x, use as C, delegateEvents as E } from "solid-js/web";
2
- import { createSignal as L, onCleanup as P, Show as _ } from "solid-js";
3
- import { cn as y } from "../../utils/cn.js";
4
- import { createFloatingPresence as z } from "./floatingPresence.js";
5
- var A = /* @__PURE__ */ x("<div role=tooltip data-floe-surface=floating><div>"), F = /* @__PURE__ */ x('<div class="relative inline-block">');
6
- function q(l) {
7
- const [w, a] = L(!1), n = z({
8
- open: w,
9
- element: () => i
1
+ import { insert as a, createComponent as i, memo as C, effect as d, className as p, template as T, setAttribute as x, use as S, delegateEvents as E } from "solid-js/web";
2
+ import { createSignal as L, onCleanup as z, Show as m } from "solid-js";
3
+ import { cn as v } from "../../utils/cn.js";
4
+ import { createFloatingPresence as P } from "./floatingPresence.js";
5
+ import { SurfaceAnchoredLayer as R } from "./SurfaceAnchoredLayer.js";
6
+ var $ = /* @__PURE__ */ T("<div>"), D = /* @__PURE__ */ T("<div role=tooltip data-floe-surface=floating>");
7
+ function B(t) {
8
+ const [k, c] = L(!1), f = P({
9
+ open: k,
10
+ element: () => s
10
11
  });
11
- let i, t;
12
- P(() => {
13
- t && (clearTimeout(t), t = void 0);
12
+ let u, s, o;
13
+ z(() => {
14
+ o && (clearTimeout(o), o = void 0);
14
15
  });
15
- const f = () => {
16
- t && clearTimeout(t);
17
- const e = l.delay ?? 300;
16
+ const g = () => {
17
+ o && clearTimeout(o);
18
+ const e = t.delay ?? 300;
18
19
  if (e <= 0) {
19
- a(!0);
20
+ c(!0);
20
21
  return;
21
22
  }
22
- t = setTimeout(() => a(!0), e);
23
- }, d = () => {
24
- t && (clearTimeout(t), t = void 0), a(!1);
25
- }, $ = {
23
+ o = setTimeout(() => c(!0), e);
24
+ }, l = () => {
25
+ o && (clearTimeout(o), o = void 0), c(!1);
26
+ }, _ = {
26
27
  top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
27
28
  bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
28
29
  left: "right-full top-1/2 -translate-y-1/2 mr-2",
29
30
  right: "left-full top-1/2 -translate-y-1/2 ml-2"
30
- }, T = {
31
+ }, A = {
31
32
  top: "top-full left-1/2 -translate-x-1/2 border-t-popover border-x-transparent border-b-transparent",
32
33
  bottom: "bottom-full left-1/2 -translate-x-1/2 border-b-popover border-x-transparent border-t-transparent",
33
34
  left: "left-full top-1/2 -translate-y-1/2 border-l-popover border-y-transparent border-r-transparent",
34
35
  right: "right-full top-1/2 -translate-y-1/2 border-r-popover border-y-transparent border-l-transparent"
35
- };
36
+ }, b = () => (() => {
37
+ var e = D(), n = s;
38
+ return typeof n == "function" ? S(n, e) : s = e, a(e, () => t.content, null), a(e, i(m, {
39
+ get when() {
40
+ return !t.portalScope;
41
+ },
42
+ get children() {
43
+ var r = $();
44
+ return d(() => p(r, v("absolute w-0 h-0 border-4", A[t.placement ?? "top"]))), r;
45
+ }
46
+ }), null), d((r) => {
47
+ var h = v("z-50 px-2.5 py-1.5", !t.portalScope && "absolute", "bg-popover text-popover-foreground text-[length:var(--floe-type-caption)]", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-elevation-float)]", "tracking-[var(--floe-tracking-normal)]", "whitespace-nowrap", "floe-floating-presence floe-floating-tooltip", !t.portalScope && _[t.placement ?? "top"], t.class), y = f.state(), w = f.exiting() ? "true" : void 0;
48
+ return h !== r.e && p(e, r.e = h), y !== r.t && x(e, "data-floating-presence", r.t = y), w !== r.a && x(e, "aria-hidden", r.a = w), r;
49
+ }, {
50
+ e: void 0,
51
+ t: void 0,
52
+ a: void 0
53
+ }), e;
54
+ })();
36
55
  return (() => {
37
- var e = F();
38
- return e.$$focusout = d, e.$$focusin = f, e.addEventListener("mouseleave", d), e.addEventListener("mouseenter", f), s(e, () => l.children, null), s(e, S(_, {
56
+ var e = $();
57
+ e.$$pointerdown = l, e.$$focusout = l, e.$$focusin = g, e.addEventListener("mouseleave", l), e.addEventListener("mouseenter", g);
58
+ var n = u;
59
+ return typeof n == "function" ? S(n, e) : u = e, a(e, () => t.children, null), a(e, i(m, {
39
60
  get when() {
40
- return n.mounted();
61
+ return f.mounted();
41
62
  },
42
63
  get children() {
43
- var o = A(), u = o.firstChild, p = i;
44
- return typeof p == "function" ? C(p, o) : i = o, s(o, () => l.content, u), k((r) => {
45
- var c = y("absolute z-50 px-2.5 py-1.5", "bg-popover text-popover-foreground text-[length:var(--floe-type-caption)]", "rounded-panel border border-[var(--floe-line)]", "shadow-[var(--floe-elevation-float)]", "tracking-[var(--floe-tracking-normal)]", "whitespace-nowrap", "floe-floating-presence floe-floating-tooltip", $[l.placement ?? "top"], l.class), v = n.state(), m = n.exiting() ? "true" : void 0, b = y("absolute w-0 h-0 border-4", T[l.placement ?? "top"]);
46
- return c !== r.e && g(o, r.e = c), v !== r.t && h(o, "data-floating-presence", r.t = v), m !== r.a && h(o, "aria-hidden", r.a = m), b !== r.o && g(u, r.o = b), r;
47
- }, {
48
- e: void 0,
49
- t: void 0,
50
- a: void 0,
51
- o: void 0
52
- }), o;
64
+ return i(m, {
65
+ get when() {
66
+ return t.portalScope;
67
+ },
68
+ get fallback() {
69
+ return b();
70
+ },
71
+ get children() {
72
+ return i(R, {
73
+ anchor: u,
74
+ get portalScope() {
75
+ return t.portalScope;
76
+ },
77
+ get placement() {
78
+ return C(() => t.placement === "left" || t.placement === "right")() ? t.placement : "auto";
79
+ },
80
+ gap: 8,
81
+ style: {
82
+ "z-index": 50,
83
+ "pointer-events": "none"
84
+ },
85
+ onAnchorDisconnect: l,
86
+ get children() {
87
+ return b();
88
+ }
89
+ });
90
+ }
91
+ });
53
92
  }
54
- }), null), e;
93
+ }), null), d(() => p(e, v("relative inline-block", t.triggerClass))), e;
55
94
  })();
56
95
  }
57
- E(["focusin", "focusout"]);
96
+ E(["focusin", "focusout", "pointerdown"]);
58
97
  export {
59
- q as Tooltip
98
+ B as Tooltip
60
99
  };