@floegence/floe-webapp-core 0.90.10 → 0.90.12

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.
@@ -6,8 +6,8 @@ import { X as de } from "../icons/index.js";
6
6
  import { useResolvedFloeConfig as se } from "../../context/FloeConfigContext.js";
7
7
  import { useOverlayMask as fe } from "../../hooks/useOverlayMask.js";
8
8
  import { resolveSurfacePortalHost as ce, DIALOG_SURFACE_BOUNDARY_ATTR as S, SURFACE_PORTAL_LAYER_ATTR as ue, DIALOG_SURFACE_HOST_ATTR as ge, isSurfacePortalMode as z, projectSurfacePortalRect as me, resolveSurfacePortalBoundaryRect as he, resolveSurfacePortalMount as ve } from "./dialogSurfaceScope.js";
9
- import { LOCAL_INTERACTION_SURFACE_ATTR as ye } from "./localInteractionSurface.js";
10
- import { createFloatingPresence as be } from "./floatingPresence.js";
9
+ import { LOCAL_INTERACTION_SURFACE_ATTR as be } from "./localInteractionSurface.js";
10
+ import { createFloatingPresence as ye } from "./floatingPresence.js";
11
11
  import { observeDialogHeight as we } from "./dialogHeightMotion.js";
12
12
  import { useDialogPlacement as pe } from "./DialogPlacementContext.js";
13
13
  import { observeViewport as xe, viewportStyle as $e } from "../../viewport.js";
@@ -41,7 +41,7 @@ function Ie(e) {
41
41
  le(() => B(xe(window, W)));
42
42
  const f = ie(), F = () => `dialog-${f}-title`, L = () => `dialog-${f}-description`;
43
43
  let A;
44
- const [O, Y] = T(null), [N, X] = T(0), [J, Q] = T(0), C = () => e.presentation === "side-drawer", h = () => e.presentation === "bottom-drawer", i = be({
44
+ const [O, Y] = T(null), [N, X] = T(0), [J, Q] = T(0), C = () => e.presentation === "side-drawer", h = () => e.presentation === "bottom-drawer", i = ye({
45
45
  open: () => e.open && !!O() && N() > 0,
46
46
  element: () => A
47
47
  }), v = () => i.mounted() && !!O() && N() > 0;
@@ -67,19 +67,19 @@ function Ie(e) {
67
67
  const t = R();
68
68
  if (!v() || !a() || typeof window > "u")
69
69
  return;
70
- let l = !1, y = null, d = Z(I(t));
71
- const b = () => {
70
+ let l = !1, b = null, d = Z(I(t));
71
+ const y = () => {
72
72
  if (l || !z(t))
73
73
  return;
74
74
  const o = Z(I(t));
75
75
  o !== d && (d = o, Q((w) => w + 1));
76
76
  }, k = () => {
77
- l || (y = Be(() => {
78
- b(), k();
77
+ l || (b = Be(() => {
78
+ y(), k();
79
79
  }));
80
80
  };
81
81
  k(), B(() => {
82
- l = !0, y !== null && Fe(y);
82
+ l = !0, b !== null && Fe(b);
83
83
  });
84
84
  }), fe({
85
85
  open: v,
@@ -108,7 +108,7 @@ function Ie(e) {
108
108
  return te();
109
109
  },
110
110
  get children() {
111
- var t = Re(), l = t.firstChild, y = l.nextSibling, d = y.firstChild, b = d.firstChild;
111
+ var t = Re(), l = t.firstChild, b = l.nextSibling, d = b.firstChild, y = d.firstChild;
112
112
  c(t, "data-floe-dialog-overlay-root", f), E(t, M({
113
113
  get "data-floe-dialog-mode"() {
114
114
  return a() ? "surface" : "global";
@@ -123,7 +123,7 @@ function Ie(e) {
123
123
  return i.exiting() ? "true" : void 0;
124
124
  }
125
125
  }, {
126
- [ye]: "true"
126
+ [be]: "true"
127
127
  }, () => ({
128
128
  [ue]: "true",
129
129
  [S]: _()
@@ -247,7 +247,7 @@ function Ie(e) {
247
247
  }
248
248
  });
249
249
  }
250
- }), b), s(b, r(u, {
250
+ }), y), s(y, r(u, {
251
251
  get when() {
252
252
  return e.bodyDescription;
253
253
  },
@@ -255,7 +255,7 @@ function Ie(e) {
255
255
  var o = Se();
256
256
  return s(o, () => e.bodyDescription), P(() => c(o, "id", L())), o;
257
257
  }
258
- }), null), s(b, () => e.children, null), s(d, r(u, {
258
+ }), null), s(y, () => e.children, null), s(d, r(u, {
259
259
  get when() {
260
260
  return e.footer;
261
261
  },
@@ -264,8 +264,8 @@ function Ie(e) {
264
264
  return s(o, () => e.footer), o;
265
265
  }
266
266
  }), null), P((o) => {
267
- var w = g("pointer-events-none relative z-[1] flex h-full w-full", C() ? e.drawerSide === "left" ? "items-stretch justify-start" : "items-stretch justify-end" : h() ? "items-end justify-center" : "items-center justify-center"), p = g("min-h-0 flex-1 overflow-auto overscroll-contain px-[var(--floe-pad-group)] py-[var(--floe-pad-group)]", e.contentClass);
268
- return w !== o.e && K(y, o.e = w), p !== o.t && K(b, o.t = p), o;
267
+ var w = g("pointer-events-none relative z-[1] flex h-full w-full", C() ? e.drawerSide === "left" ? "items-stretch justify-start" : "items-stretch justify-end" : h() ? "items-end justify-center" : "items-center justify-center"), p = g("min-h-0 flex-1 overflow-auto overscroll-contain px-[var(--floe-pad-group)] py-[var(--floe-pad-group)] [&.overflow-auto]:[scrollbar-gutter:stable]", e.contentClass);
268
+ return w !== o.e && K(b, o.e = w), p !== o.t && K(y, o.t = p), o;
269
269
  }, {
270
270
  e: void 0,
271
271
  t: void 0
@@ -1,8 +1,8 @@
1
- import { spread as C, mergeProps as w, insert as i, createComponent as g, memo as z, effect as _, setAttribute as m, className as $, template as p, delegateEvents as S } from "solid-js/web";
2
- import { splitProps as P, For as A } from "solid-js";
3
- import { cn as b } from "../../utils/cn.js";
4
- var D = /* @__PURE__ */ p("<div role=group data-floe-surface=inset data-floe-surface-part=rail>"), E = /* @__PURE__ */ p('<button type=button role=radio data-floe-surface-part=segment data-floe-interactive=item><span class="inline-flex items-center gap-1.5">');
5
- const F = {
1
+ import { use as $, spread as V, mergeProps as q, insert as k, createComponent as W, memo as B, effect as j, setAttribute as p, className as A, setStyleProperty as x, template as H, delegateEvents as G } from "solid-js/web";
2
+ import { splitProps as I, createSignal as J, createEffect as K, onMount as Q, onCleanup as D, For as U, untrack as X } from "solid-js";
3
+ import { cn as z } from "../../utils/cn.js";
4
+ var Y = /* @__PURE__ */ H("<div role=group data-floe-surface=inset data-floe-surface-part=rail><span aria-hidden=true>"), Z = /* @__PURE__ */ H('<button type=button role=radio data-floe-surface-part=segment data-floe-interactive=item><span class="inline-flex items-center gap-1.5"><span class=floe-segmented-control__label>');
5
+ const ee = {
6
6
  sm: {
7
7
  container: "p-0.5 gap-0.5",
8
8
  button: "h-[var(--floe-control-height-xs)] px-[var(--floe-control-padding-sm)] rounded-sm",
@@ -19,46 +19,113 @@ const F = {
19
19
  icon: "w-4 h-4"
20
20
  }
21
21
  };
22
- function B(h) {
23
- const [o, x] = P(h, ["value", "onChange", "options", "size", "disabled", "class"]), y = () => o.size ?? "md", a = () => F[y()], k = (n, r) => {
24
- o.disabled || r || n !== o.value && o.onChange(n);
22
+ function ne(L) {
23
+ const [r, N] = I(L, ["value", "onChange", "options", "size", "disabled", "class"]);
24
+ let d, c;
25
+ const b = /* @__PURE__ */ new Map(), [s, S] = J();
26
+ let f, u, h;
27
+ const y = () => {
28
+ const o = b.get(r.value);
29
+ if (!d || !o) {
30
+ u?.cancel(), S(void 0), h = void 0;
31
+ return;
32
+ }
33
+ if (!o.offsetWidth || !d.getClientRects().length) return;
34
+ const n = {
35
+ x: o.offsetLeft,
36
+ y: o.offsetTop,
37
+ width: o.offsetWidth,
38
+ height: o.offsetHeight
39
+ }, v = X(s);
40
+ if (v && Object.keys(n).every((a) => n[a] === v[a]) && h === r.value) return;
41
+ const e = v && h !== r.value && c && !window.matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active)").matches ? getComputedStyle(c) : void 0, l = e ? {
42
+ transform: e.transform,
43
+ width: e.width
44
+ } : void 0;
45
+ if (u?.cancel(), S(n), h = r.value, l && c) {
46
+ const a = getComputedStyle(d);
47
+ u = c.animate([l, {
48
+ transform: `translate(${n.x}px, ${n.y}px)`,
49
+ width: `${n.width}px`
50
+ }], {
51
+ duration: parseFloat(a.getPropertyValue("--floe-duration-base")) || 200,
52
+ easing: a.getPropertyValue("--floe-ease-out").trim() || "ease-out"
53
+ }), u.id = "floe-segmented-selection";
54
+ }
55
+ };
56
+ K(() => {
57
+ r.value, r.options, r.size, y();
58
+ }), Q(() => {
59
+ if (typeof ResizeObserver < "u") {
60
+ f = new ResizeObserver(y), f.observe(d);
61
+ for (const o of b.values()) f.observe(o);
62
+ }
63
+ y();
64
+ }), D(() => {
65
+ f?.disconnect(), u?.cancel();
66
+ });
67
+ const P = () => r.size ?? "md", w = () => ee[P()], T = (o, n) => {
68
+ r.disabled || n || o !== r.value && r.onChange(o);
25
69
  };
26
70
  return (() => {
27
- var n = D();
28
- return C(n, w({
71
+ var o = Y(), n = o.firstChild, v = d;
72
+ typeof v == "function" ? $(v, o) : d = o, V(o, q({
73
+ get "data-floe-segmented-pill"() {
74
+ return s() ? "true" : void 0;
75
+ },
76
+ get "data-floe-segmented-motion"() {
77
+ return s() ? "ready" : void 0;
78
+ },
29
79
  get class() {
30
- return b("floe-segmented-control inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", a().container, o.disabled && "opacity-50 pointer-events-none", o.class);
80
+ return z("floe-segmented-control relative inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", w().container, r.disabled && "opacity-50 pointer-events-none", r.class);
31
81
  }
32
- }, x), !1, !0), i(n, g(A, {
82
+ }, N), !1, !0);
83
+ var C = c;
84
+ return typeof C == "function" ? $(C, n) : c = n, k(o, W(U, {
33
85
  get each() {
34
- return o.options;
86
+ return r.options;
35
87
  },
36
- children: (r) => {
37
- const l = () => o.value === r.value, s = () => o.disabled || r.disabled;
88
+ children: (e) => {
89
+ const l = () => r.value === e.value, a = () => r.disabled || e.disabled;
38
90
  return (() => {
39
- var t = E(), c = t.firstChild;
40
- return t.$$click = () => k(r.value, r.disabled), i(c, (() => {
41
- var e = z(() => !!r.icon);
42
- return () => e() && g(r.icon, {
91
+ var i = Z(), g = i.firstChild, m = g.firstChild;
92
+ return i.$$click = () => T(e.value, e.disabled), $((t) => {
93
+ b.set(e.value, t), f?.observe(t), D(() => {
94
+ f?.unobserve(t), b.delete(e.value);
95
+ });
96
+ }, i), k(g, (() => {
97
+ var t = B(() => !!e.icon);
98
+ return () => t() && W(e.icon, {
43
99
  get class() {
44
- return a().icon;
100
+ return w().icon;
45
101
  }
46
102
  });
47
- })(), null), i(c, () => r.label, null), _((e) => {
48
- var d = l() ? "raised" : "flat", f = l(), u = s(), v = b("floe-segmented-control__item font-medium cursor-pointer border", "transition-[background-color,border-color,color,box-shadow] duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--floe-plane)]", a().button, l() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", s() && "cursor-not-allowed opacity-50");
49
- return d !== e.e && m(t, "data-floe-surface", e.e = d), f !== e.t && m(t, "aria-checked", e.t = f), u !== e.a && (t.disabled = e.a = u), v !== e.o && $(t, e.o = v), e;
103
+ })(), m), k(m, () => e.label), j((t) => {
104
+ var _ = e.label, M = e.label, O = l() ? "raised" : "flat", R = l(), E = a(), F = z("floe-segmented-control__item relative font-medium cursor-pointer border", "transition-[background-color,border-color,color,box-shadow] duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--floe-plane)]", w().button, l() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", a() && "cursor-not-allowed opacity-50");
105
+ return _ !== t.e && p(i, "aria-label", t.e = _), M !== t.t && p(i, "title", t.t = M), O !== t.a && p(i, "data-floe-surface", t.a = O), R !== t.o && p(i, "aria-checked", t.o = R), E !== t.i && (i.disabled = t.i = E), F !== t.n && A(i, t.n = F), t;
50
106
  }, {
51
107
  e: void 0,
52
108
  t: void 0,
53
109
  a: void 0,
54
- o: void 0
55
- }), t;
110
+ o: void 0,
111
+ i: void 0,
112
+ n: void 0
113
+ }), i;
56
114
  })();
57
115
  }
58
- })), n;
116
+ }), null), j((e) => {
117
+ var l = z("floe-segmented-control__pill", P() === "lg" ? "rounded-md" : "rounded-sm"), a = s() ? "visible" : "hidden", i = `translate(${s()?.x ?? 0}px, ${s()?.y ?? 0}px)`, g = `${s()?.width ?? 0}px`, m = `${s()?.height ?? 0}px`;
118
+ return l !== e.e && A(n, e.e = l), a !== e.t && x(n, "visibility", e.t = a), i !== e.a && x(n, "transform", e.a = i), g !== e.o && x(n, "width", e.o = g), m !== e.i && x(n, "height", e.i = m), e;
119
+ }, {
120
+ e: void 0,
121
+ t: void 0,
122
+ a: void 0,
123
+ o: void 0,
124
+ i: void 0
125
+ }), o;
59
126
  })();
60
127
  }
61
- S(["click"]);
128
+ G(["click"]);
62
129
  export {
63
- B as SegmentedControl
130
+ ne as SegmentedControl
64
131
  };