@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
|
-
|
|
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
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
var ne = /* @__PURE__ */
|
|
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(
|
|
23
|
-
const [l,
|
|
24
|
-
let
|
|
25
|
-
const [
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
|
|
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 (!
|
|
34
|
-
const
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
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
|
-
|
|
41
|
-
x:
|
|
42
|
-
y:
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
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
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
transform:
|
|
50
|
-
width:
|
|
51
|
-
} : void 0, e =
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
transform: `translate(${
|
|
56
|
-
width: `${
|
|
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(
|
|
61
|
-
easing:
|
|
62
|
-
}),
|
|
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(${-
|
|
66
|
-
}],
|
|
65
|
+
transform: `translate(${-o.x}px, ${-o.y}px)`
|
|
66
|
+
}], x.effect.getTiming()), $.id = "floe-segmented-ink");
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
l.value, l.options, l.size,
|
|
71
|
-
}),
|
|
69
|
+
ee(() => {
|
|
70
|
+
l.value, l.options, l.size, O();
|
|
71
|
+
}), te(() => {
|
|
72
72
|
if (typeof ResizeObserver < "u") {
|
|
73
|
-
|
|
74
|
-
for (const
|
|
73
|
+
b = new ResizeObserver(O), b.observe(m);
|
|
74
|
+
for (const n of w.values()) b.observe(n);
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
}),
|
|
78
|
-
|
|
76
|
+
O();
|
|
77
|
+
}), q(() => {
|
|
78
|
+
b?.disconnect(), x?.cancel(), $?.cancel();
|
|
79
79
|
});
|
|
80
|
-
const
|
|
81
|
-
|
|
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
|
|
85
|
-
typeof
|
|
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
|
|
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
|
-
},
|
|
96
|
-
var
|
|
97
|
-
typeof
|
|
98
|
-
var
|
|
99
|
-
return typeof
|
|
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
|
|
105
|
-
return
|
|
106
|
-
var
|
|
107
|
-
return ()
|
|
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
|
-
}),
|
|
124
|
+
}), i;
|
|
122
125
|
})()
|
|
123
|
-
})),
|
|
126
|
+
})), y(n, W(B, {
|
|
124
127
|
get each() {
|
|
125
128
|
return l.options;
|
|
126
129
|
},
|
|
127
130
|
children: (e) => {
|
|
128
|
-
const
|
|
131
|
+
const i = () => l.value === e.value, t = () => l.disabled || e.disabled;
|
|
129
132
|
return (() => {
|
|
130
|
-
var
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
},
|
|
136
|
-
var t =
|
|
137
|
-
return ()
|
|
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
|
-
}),
|
|
148
|
+
}), a;
|
|
153
149
|
})();
|
|
154
150
|
}
|
|
155
|
-
}), null),
|
|
156
|
-
var
|
|
157
|
-
return
|
|
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
|
-
}),
|
|
161
|
+
}), n;
|
|
166
162
|
})();
|
|
167
163
|
}
|
|
168
|
-
|
|
164
|
+
Y(["click"]);
|
|
169
165
|
export {
|
|
170
166
|
fe as SegmentedControl
|
|
171
167
|
};
|