@floegence/floe-webapp-core 0.101.14 → 0.101.16

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.
@@ -126,10 +126,11 @@ function ue(t) {
126
126
  }), C(() => {
127
127
  S();
128
128
  }), C(() => {
129
- o && o.updateOptions({
129
+ const e = {
130
130
  ...w,
131
131
  ...t.options ?? {}
132
- });
132
+ };
133
+ o?.updateOptions(e);
133
134
  }), C(() => {
134
135
  t.path, t.language, t.value, b();
135
136
  }), C(() => {
@@ -1,7 +1,7 @@
1
- import { use as T, spread as X, mergeProps as Y, insert as p, createComponent as W, memo as V, effect as M, setAttribute as z, setStyleProperty as c, className as q, template as j, delegateEvents as Z } from "solid-js/web";
2
- import { splitProps as ee, createSignal as B, createEffect as te, onMount as oe, onCleanup as G, For as I, untrack as re } from "solid-js";
3
- import { cn as R } from "../../utils/cn.js";
4
- var ne = /* @__PURE__ */ j("<div role=group data-floe-surface=inset data-floe-surface-part=rail><span aria-hidden=true><span class=floe-segmented-control__ink>"), ie = /* @__PURE__ */ j('<span class=floe-segmented-control__ink-label><span class="inline-flex items-center gap-1.5"><span>'), ae = /* @__PURE__ */ j('<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>');
1
+ import { use as P, spread as Q, mergeProps as U, insert as y, createComponent as W, effect as j, setAttribute as S, setStyleProperty as c, className as D, template as F, memo as X, delegateEvents as Y } from "solid-js/web";
2
+ import { splitProps as Z, createSignal as V, createEffect as ee, onMount as te, onCleanup as q, For as B, untrack as oe } from "solid-js";
3
+ import { cn as E } from "../../utils/cn.js";
4
+ var re = /* @__PURE__ */ F('<span class="inline-flex items-center gap-1.5"><span class=floe-segmented-control__label>'), ne = /* @__PURE__ */ F("<div role=group data-floe-surface=inset data-floe-surface-part=rail><span aria-hidden=true><span class=floe-segmented-control__ink>"), ie = /* @__PURE__ */ F("<span class=floe-segmented-control__ink-label>"), ae = /* @__PURE__ */ F("<button type=button role=radio data-floe-surface-part=segment data-floe-interactive=item>");
5
5
  const le = {
6
6
  sm: {
7
7
  container: "p-0.5 gap-0.5",
@@ -19,70 +19,80 @@ const le = {
19
19
  icon: "w-4 h-4"
20
20
  }
21
21
  };
22
- function fe(J) {
23
- const [l, K] = ee(J, ["value", "onChange", "options", "size", "disabled", "class"]);
24
- let u, m, g;
25
- const [P, Q] = B({}), y = /* @__PURE__ */ new Map(), [d, A] = B();
26
- let h, b, w, F;
27
- const E = () => {
28
- const a = y.get(l.value);
29
- if (!u || !a) {
30
- b?.cancel(), w?.cancel(), A(void 0), F = void 0;
22
+ function fe(G) {
23
+ const [l, I] = Z(G, ["value", "onChange", "options", "size", "disabled", "class"]);
24
+ let m, g, h;
25
+ const [_, J] = V({}), w = /* @__PURE__ */ new Map(), [d, M] = V();
26
+ let b, x, $, z;
27
+ const O = () => {
28
+ const n = w.get(l.value);
29
+ if (!m || !n) {
30
+ x?.cancel(), $?.cancel(), M(void 0), z = void 0;
31
31
  return;
32
32
  }
33
- if (!a.offsetWidth || !u.getClientRects().length) return;
34
- const r = {
35
- x: a.offsetLeft,
36
- y: a.offsetTop,
37
- width: a.offsetWidth,
38
- height: a.offsetHeight
33
+ if (!n.offsetWidth || !m.getClientRects().length) return;
34
+ const o = {
35
+ x: n.offsetLeft,
36
+ y: n.offsetTop,
37
+ width: n.offsetWidth,
38
+ height: n.offsetHeight
39
39
  };
40
- Q(Object.fromEntries([...y].map(([o, s]) => [o, {
41
- x: s.offsetLeft,
42
- y: s.offsetTop,
43
- width: s.offsetWidth,
44
- height: s.offsetHeight
40
+ J(Object.fromEntries([...w].map(([i, t]) => [i, {
41
+ x: t.offsetLeft,
42
+ y: t.offsetTop,
43
+ width: t.offsetWidth,
44
+ height: t.offsetHeight
45
45
  }])));
46
- const f = re(d);
47
- if (f && Object.keys(r).every((o) => r[o] === f[o]) && F === l.value) return;
48
- const $ = f && F !== l.value && m && !window.matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active)").matches, x = $ ? getComputedStyle(m) : void 0, C = x ? {
49
- transform: x.transform,
50
- width: x.width
51
- } : void 0, e = $ && g ? getComputedStyle(g).transform : void 0;
52
- if (b?.cancel(), w?.cancel(), A(r), F = l.value, C && m) {
53
- const o = getComputedStyle(u), s = o.getPropertyValue("--floe-duration-slow").trim(), n = parseFloat(s) * (s.endsWith("ms") ? 1 : 1e3);
54
- b = m.animate([C, {
55
- transform: `translate(${r.x}px, ${r.y}px)`,
56
- width: `${r.width}px`
46
+ const s = oe(d);
47
+ if (s && Object.keys(o).every((i) => o[i] === s[i]) && z === l.value) return;
48
+ const u = s && z !== l.value && g && !window.matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active)").matches, p = u ? getComputedStyle(g) : void 0, k = p ? {
49
+ transform: p.transform,
50
+ width: p.width
51
+ } : void 0, e = u && h ? getComputedStyle(h).transform : void 0;
52
+ if (x?.cancel(), $?.cancel(), M(o), z = l.value, k && g) {
53
+ const i = getComputedStyle(m), t = i.getPropertyValue("--floe-duration-slow").trim(), a = parseFloat(t) * (t.endsWith("ms") ? 1 : 1e3);
54
+ x = g.animate([k, {
55
+ transform: `translate(${o.x}px, ${o.y}px)`,
56
+ width: `${o.width}px`
57
57
  }], {
58
58
  // Position changes need visible travel: the fast entrance curve
59
59
  // covers almost 90% of this short rail in its first 60ms.
60
- duration: Number.isFinite(n) ? n : 280,
61
- easing: o.getPropertyValue("--floe-ease-in-out").trim() || "ease-in-out"
62
- }), b.id = "floe-segmented-selection", g && e && (w = g.animate([{
60
+ duration: Number.isFinite(a) ? a : 280,
61
+ easing: i.getPropertyValue("--floe-ease-in-out").trim() || "ease-in-out"
62
+ }), x.id = "floe-segmented-selection", h && e && ($ = h.animate([{
63
63
  transform: e
64
64
  }, {
65
- transform: `translate(${-r.x}px, ${-r.y}px)`
66
- }], b.effect.getTiming()), w.id = "floe-segmented-ink");
65
+ transform: `translate(${-o.x}px, ${-o.y}px)`
66
+ }], x.effect.getTiming()), $.id = "floe-segmented-ink");
67
67
  }
68
68
  };
69
- te(() => {
70
- l.value, l.options, l.size, E();
71
- }), oe(() => {
69
+ ee(() => {
70
+ l.value, l.options, l.size, O();
71
+ }), te(() => {
72
72
  if (typeof ResizeObserver < "u") {
73
- h = new ResizeObserver(E), h.observe(u);
74
- for (const a of y.values()) h.observe(a);
73
+ b = new ResizeObserver(O), b.observe(m);
74
+ for (const n of w.values()) b.observe(n);
75
75
  }
76
- E();
77
- }), G(() => {
78
- h?.disconnect(), b?.cancel(), w?.cancel();
76
+ O();
77
+ }), q(() => {
78
+ b?.disconnect(), x?.cancel(), $?.cancel();
79
79
  });
80
- const H = () => l.size ?? "md", O = () => le[H()], U = (a, r) => {
81
- l.disabled || r || a !== l.value && l.onChange(a);
80
+ const R = () => l.size ?? "md", T = () => le[R()], A = (n) => (() => {
81
+ var o = re(), s = o.firstChild;
82
+ return y(o, (() => {
83
+ var u = X(() => !!n.icon);
84
+ return () => u() && W(n.icon, {
85
+ get class() {
86
+ return T().icon;
87
+ }
88
+ });
89
+ })(), s), y(s, () => n.label), o;
90
+ })(), K = (n, o) => {
91
+ l.disabled || o || n !== l.value && l.onChange(n);
82
92
  };
83
93
  return (() => {
84
- var a = ne(), r = a.firstChild, f = r.firstChild, $ = u;
85
- typeof $ == "function" ? T($, a) : u = a, X(a, Y({
94
+ var n = ne(), o = n.firstChild, s = o.firstChild, u = m;
95
+ typeof u == "function" ? P(u, n) : m = n, Q(n, U({
86
96
  get "data-floe-segmented-pill"() {
87
97
  return d() ? "true" : void 0;
88
98
  },
@@ -90,58 +100,44 @@ function fe(J) {
90
100
  return d() ? "ready" : void 0;
91
101
  },
92
102
  get class() {
93
- return R("floe-segmented-control relative inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", O().container, l.disabled && "opacity-50 pointer-events-none", l.class);
103
+ return E("floe-segmented-control relative inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", T().container, l.disabled && "opacity-50 pointer-events-none", l.class);
94
104
  }
95
- }, K), !1, !0);
96
- var x = m;
97
- typeof x == "function" ? T(x, r) : m = r;
98
- var C = g;
99
- return typeof C == "function" ? T(C, f) : g = f, p(f, W(I, {
105
+ }, I), !1, !0);
106
+ var p = g;
107
+ typeof p == "function" ? P(p, o) : g = o;
108
+ var k = h;
109
+ return typeof k == "function" ? P(k, s) : h = s, y(s, W(B, {
100
110
  get each() {
101
111
  return l.options;
102
112
  },
103
113
  children: (e) => (() => {
104
- var o = ie(), s = o.firstChild, n = s.firstChild;
105
- return p(s, (() => {
106
- var i = V(() => !!e.icon);
107
- return () => i() && W(e.icon, {
108
- get class() {
109
- return O().icon;
110
- }
111
- });
112
- })(), n), p(n, () => e.label), M((i) => {
113
- var v = e.value, t = `${P()[e.value]?.x ?? 0}px`, k = `${P()[e.value]?.y ?? 0}px`, _ = `${P()[e.value]?.width ?? 0}px`, S = `${P()[e.value]?.height ?? 0}px`;
114
- return v !== i.e && z(o, "data-segmented-label", i.e = v), t !== i.t && c(o, "left", i.t = t), k !== i.a && c(o, "top", i.a = k), _ !== i.o && c(o, "width", i.o = _), S !== i.i && c(o, "height", i.i = S), i;
114
+ var i = ie();
115
+ return y(i, () => A(e)), j((t) => {
116
+ var a = e.value, r = `${_()[e.value]?.x ?? 0}px`, f = `${_()[e.value]?.y ?? 0}px`, v = `${_()[e.value]?.width ?? 0}px`, C = `${_()[e.value]?.height ?? 0}px`;
117
+ return a !== t.e && S(i, "data-segmented-label", t.e = a), r !== t.t && c(i, "left", t.t = r), f !== t.a && c(i, "top", t.a = f), v !== t.o && c(i, "width", t.o = v), C !== t.i && c(i, "height", t.i = C), t;
115
118
  }, {
116
119
  e: void 0,
117
120
  t: void 0,
118
121
  a: void 0,
119
122
  o: void 0,
120
123
  i: void 0
121
- }), o;
124
+ }), i;
122
125
  })()
123
- })), p(a, W(I, {
126
+ })), y(n, W(B, {
124
127
  get each() {
125
128
  return l.options;
126
129
  },
127
130
  children: (e) => {
128
- const o = () => l.value === e.value, s = () => l.disabled || e.disabled;
131
+ const i = () => l.value === e.value, t = () => l.disabled || e.disabled;
129
132
  return (() => {
130
- var n = ae(), i = n.firstChild, v = i.firstChild;
131
- return n.$$click = () => U(e.value, e.disabled), T((t) => {
132
- y.set(e.value, t), h?.observe(t), G(() => {
133
- h?.unobserve(t), y.delete(e.value);
133
+ var a = ae();
134
+ return a.$$click = () => K(e.value, e.disabled), P((r) => {
135
+ w.set(e.value, r), b?.observe(r), q(() => {
136
+ b?.unobserve(r), w.delete(e.value);
134
137
  });
135
- }, n), p(i, (() => {
136
- var t = V(() => !!e.icon);
137
- return () => t() && W(e.icon, {
138
- get class() {
139
- return O().icon;
140
- }
141
- });
142
- })(), v), p(v, () => e.label), M((t) => {
143
- var k = e.label, _ = e.label, S = o() ? "raised" : "flat", L = o(), N = s(), D = R("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)]", O().button, o() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", s() && "cursor-not-allowed opacity-50");
144
- return k !== t.e && z(n, "aria-label", t.e = k), _ !== t.t && z(n, "title", t.t = _), S !== t.a && z(n, "data-floe-surface", t.a = S), L !== t.o && z(n, "aria-checked", t.o = L), N !== t.i && (n.disabled = t.i = N), D !== t.n && q(n, t.n = D), t;
138
+ }, a), y(a, () => A(e)), j((r) => {
139
+ var f = e.label, v = e.label, C = i() ? "raised" : "flat", H = i(), L = t(), N = E("floe-segmented-control__item relative inline-flex items-center justify-center 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)]", T().button, i() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", t() && "cursor-not-allowed opacity-50");
140
+ return f !== r.e && S(a, "aria-label", r.e = f), v !== r.t && S(a, "title", r.t = v), C !== r.a && S(a, "data-floe-surface", r.a = C), H !== r.o && S(a, "aria-checked", r.o = H), L !== r.i && (a.disabled = r.i = L), N !== r.n && D(a, r.n = N), r;
145
141
  }, {
146
142
  e: void 0,
147
143
  t: void 0,
@@ -149,12 +145,12 @@ function fe(J) {
149
145
  o: void 0,
150
146
  i: void 0,
151
147
  n: void 0
152
- }), n;
148
+ }), a;
153
149
  })();
154
150
  }
155
- }), null), M((e) => {
156
- var o = R("floe-segmented-control__pill", H() === "lg" ? "rounded-md" : "rounded-sm"), s = d() ? "visible" : "hidden", n = `translate(${d()?.x ?? 0}px, ${d()?.y ?? 0}px)`, i = `${d()?.width ?? 0}px`, v = `${d()?.height ?? 0}px`, t = `translate(${-(d()?.x ?? 0)}px, ${-(d()?.y ?? 0)}px)`;
157
- return o !== e.e && q(r, e.e = o), s !== e.t && c(r, "visibility", e.t = s), n !== e.a && c(r, "transform", e.a = n), i !== e.o && c(r, "width", e.o = i), v !== e.i && c(r, "height", e.i = v), t !== e.n && c(f, "transform", e.n = t), e;
151
+ }), null), j((e) => {
152
+ var i = E("floe-segmented-control__pill", R() === "lg" ? "rounded-md" : "rounded-sm"), t = d() ? "visible" : "hidden", a = `translate(${d()?.x ?? 0}px, ${d()?.y ?? 0}px)`, r = `${d()?.width ?? 0}px`, f = `${d()?.height ?? 0}px`, v = `translate(${-(d()?.x ?? 0)}px, ${-(d()?.y ?? 0)}px)`;
153
+ return i !== e.e && D(o, e.e = i), t !== e.t && c(o, "visibility", e.t = t), a !== e.a && c(o, "transform", e.a = a), r !== e.o && c(o, "width", e.o = r), f !== e.i && c(o, "height", e.i = f), v !== e.n && c(s, "transform", e.n = v), e;
158
154
  }, {
159
155
  e: void 0,
160
156
  t: void 0,
@@ -162,10 +158,10 @@ function fe(J) {
162
158
  o: void 0,
163
159
  i: void 0,
164
160
  n: void 0
165
- }), a;
161
+ }), n;
166
162
  })();
167
163
  }
168
- Z(["click"]);
164
+ Y(["click"]);
169
165
  export {
170
166
  fe as SegmentedControl
171
167
  };