@floegence/floe-webapp-core 0.86.39 → 0.86.40
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.
- package/dist/components/ui/Tabs.js +34 -32
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { createComponent as v, spread as ue, mergeProps as fe, insert as f, effect as y, className as k, setStyleProperty as ae, memo as le, use as ie, setAttribute as p, template as w, delegateEvents as Re } from "solid-js/web";
|
|
2
|
-
import { splitProps as ve, Show as B, createSignal as L, untrack as de, createEffect as X,
|
|
2
|
+
import { splitProps as ve, Show as B, createSignal as L, untrack as de, createEffect as X, onCleanup as ce } from "solid-js";
|
|
3
3
|
import { cn as g } from "../../utils/cn.js";
|
|
4
4
|
import { deferAfterPaint as _ } from "../../utils/defer.js";
|
|
5
|
+
import { KeyedFor as Te } from "./KeyedFor.js";
|
|
5
6
|
import { createUIFirstSelection as ze } from "../../utils/uiFirstSelection.js";
|
|
6
7
|
import { useViewActivation as Ee } from "../../context/ViewActivationContext.js";
|
|
7
8
|
import { X as He, Plus as Pe, ChevronRight as De } from "../icons/index.js";
|
|
8
|
-
var Me = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6">'), _e = /* @__PURE__ */ w('<button type=button aria-label="Scroll left">'), Oe = /* @__PURE__ */ w("<div>"), We = /* @__PURE__ */ w('<button type=button aria-label="Add new tab">'), Fe = /* @__PURE__ */ w('<button type=button aria-label="Scroll right">'), je = /* @__PURE__ */ w("<div><div role=tablist data-floe-surface=inset data-floe-surface-part=tab-rail aria-orientation=horizontal>"), Ge = /* @__PURE__ */ w("<span class=flex-shrink-0>"), Ue = /* @__PURE__ */ w("<button type=button>"), Xe = /* @__PURE__ */ w('<div role=tab data-floe-surface-part=tab><span class="truncate max-w-32">'),
|
|
9
|
-
const
|
|
9
|
+
var Me = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6">'), _e = /* @__PURE__ */ w('<button type=button aria-label="Scroll left">'), Oe = /* @__PURE__ */ w("<div>"), We = /* @__PURE__ */ w('<button type=button aria-label="Add new tab">'), Fe = /* @__PURE__ */ w('<button type=button aria-label="Scroll right">'), je = /* @__PURE__ */ w("<div><div role=tablist data-floe-surface=inset data-floe-surface-part=tab-rail aria-orientation=horizontal>"), Ge = /* @__PURE__ */ w("<span class=flex-shrink-0>"), Ue = /* @__PURE__ */ w("<button type=button>"), Xe = /* @__PURE__ */ w('<div role=tab data-floe-surface-part=tab><span class="truncate max-w-32">'), Ke = /* @__PURE__ */ w("<div role=tabpanel>");
|
|
10
|
+
const K = {
|
|
10
11
|
x: 0,
|
|
11
12
|
width: 0,
|
|
12
13
|
visible: !1
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
+
function Ve(i, e, h) {
|
|
15
16
|
const d = i.filter((x) => !x.disabled);
|
|
16
17
|
if (!d.length) return null;
|
|
17
18
|
const C = d.findIndex((x) => x.id === e);
|
|
@@ -37,7 +38,7 @@ function qe(i, e, h) {
|
|
|
37
38
|
}
|
|
38
39
|
return d[b]?.id ?? null;
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function qe(i) {
|
|
41
42
|
return i === 1 || i === 2 || i === 3 || i === 4 ? i : 2;
|
|
42
43
|
}
|
|
43
44
|
function Ye(i) {
|
|
@@ -105,18 +106,18 @@ function Ze(i) {
|
|
|
105
106
|
visible: z > 0
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
-
const [e, h] = ve(i, ["items", "activeId", "defaultActiveId", "onChange", "onActiveIdChange", "onClose", "onAdd", "showAdd", "closable", "size", "features", "slotClassNames", "ariaLabel", "class"]), d = () => e.features?.indicator?.mode ?? "activeBorder", C = () =>
|
|
109
|
+
function dt(i) {
|
|
110
|
+
const [e, h] = ve(i, ["items", "activeId", "defaultActiveId", "onChange", "onActiveIdChange", "onClose", "onAdd", "showAdd", "closable", "size", "features", "slotClassNames", "ariaLabel", "class"]), d = () => e.features?.indicator?.mode ?? "activeBorder", C = () => qe(e.features?.indicator?.thicknessPx), b = () => e.features?.indicator?.colorToken ?? "primary", x = () => e.features?.indicator?.animated ?? !0, R = () => e.features?.containerBorder ?? !0, I = () => e.features?.scrollButtons ?? "auto", T = () => e.features?.closeButton?.dangerHover ?? !0, z = () => e.features?.closeButton?.enabledByDefault ?? e.closable ?? !1, he = () => e.features?.addButton?.enabled ?? e.showAdd ?? !1, V = () => Ye(C()), O = () => Je(b());
|
|
110
111
|
let u;
|
|
111
|
-
const
|
|
112
|
+
const q = (() => {
|
|
112
113
|
try {
|
|
113
114
|
return Ee();
|
|
114
115
|
} catch {
|
|
115
116
|
return null;
|
|
116
117
|
}
|
|
117
|
-
})(), S = () =>
|
|
118
|
+
})(), S = () => q ? q.active() : !0;
|
|
118
119
|
let W = !1;
|
|
119
|
-
const [E, F] = L(
|
|
120
|
+
const [E, F] = L(K), H = /* @__PURE__ */ new Map();
|
|
120
121
|
let j = !1;
|
|
121
122
|
const P = () => d() === "slider", Y = (s) => {
|
|
122
123
|
if (!u || !P()) return !1;
|
|
@@ -129,10 +130,10 @@ function it(i) {
|
|
|
129
130
|
return F(a), a.visible;
|
|
130
131
|
}, be = () => {
|
|
131
132
|
if (!P()) {
|
|
132
|
-
F(
|
|
133
|
+
F(K);
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
|
-
Y(G()) || F(
|
|
136
|
+
Y(G()) || F(K);
|
|
136
137
|
}, D = () => {
|
|
137
138
|
j || (j = !0, _(() => {
|
|
138
139
|
j = !1, de(() => {
|
|
@@ -200,7 +201,7 @@ function it(i) {
|
|
|
200
201
|
inline: "nearest"
|
|
201
202
|
});
|
|
202
203
|
}, Ae = (s, o) => {
|
|
203
|
-
const a =
|
|
204
|
+
const a = Ve(e.items, o.id, s.key);
|
|
204
205
|
a && (s.preventDefault(), Se(a));
|
|
205
206
|
}, $e = (s, o) => {
|
|
206
207
|
s.stopPropagation();
|
|
@@ -216,7 +217,7 @@ function it(i) {
|
|
|
216
217
|
const c = d();
|
|
217
218
|
return c === "none" || c === "slider" && E().visible ? "border-transparent" : O().tabBorderClass;
|
|
218
219
|
})();
|
|
219
|
-
return g(a, t, Ne[e.size ?? "md"], "rounded-t",
|
|
220
|
+
return g(a, t, Ne[e.size ?? "md"], "rounded-t", V().tabBorderClass, s ? g(r, "text-foreground bg-background", e.slotClassNames?.tabActive) : g("border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", e.slotClassNames?.tabInactive), o && "hover:bg-transparent hover:text-muted-foreground hover:border-transparent", e.slotClassNames?.tab);
|
|
220
221
|
};
|
|
221
222
|
return (() => {
|
|
222
223
|
var s = je(), o = s.firstChild;
|
|
@@ -249,7 +250,7 @@ function it(i) {
|
|
|
249
250
|
get children() {
|
|
250
251
|
var t = Oe();
|
|
251
252
|
return y((r) => {
|
|
252
|
-
var c = g("pointer-events-none absolute bottom-0 left-0 z-10",
|
|
253
|
+
var c = g("pointer-events-none absolute bottom-0 left-0 z-10", V().sliderHeightClass, O().sliderBgClass, x() ? "transition-[transform,width] duration-200 ease-out motion-reduce:transition-none" : "transition-none", "will-change-transform", e.slotClassNames?.indicator), l = `translate3d(${E().x}px, 0, 0)`, A = `${E().width}px`;
|
|
253
254
|
return c !== r.e && k(t, r.e = c), l !== r.t && ae(t, "transform", r.t = l), A !== r.a && ae(t, "width", r.a = A), r;
|
|
254
255
|
}, {
|
|
255
256
|
e: void 0,
|
|
@@ -261,36 +262,37 @@ function it(i) {
|
|
|
261
262
|
get each() {
|
|
262
263
|
return e.items;
|
|
263
264
|
},
|
|
265
|
+
by: (t) => t.id,
|
|
264
266
|
children: (t) => {
|
|
265
|
-
const r = () => t.id === G(), c = () => t.closable ?? z();
|
|
267
|
+
const r = () => t().id === G(), c = () => t().closable ?? z();
|
|
266
268
|
return (() => {
|
|
267
269
|
var l = Xe(), A = l.firstChild;
|
|
268
270
|
return l.$$keydown = (n) => {
|
|
269
271
|
if (n.key === "Enter" || n.key === " ") {
|
|
270
|
-
n.preventDefault(), U(t.id, t.disabled);
|
|
272
|
+
n.preventDefault(), U(t().id, t().disabled);
|
|
271
273
|
return;
|
|
272
274
|
}
|
|
273
|
-
Ae(n, t);
|
|
274
|
-
}, l.$$click = () => U(t.id, t.disabled), ie((n) => {
|
|
275
|
-
H.set(t.id, n), ce(() => H.delete(t.id));
|
|
275
|
+
Ae(n, t());
|
|
276
|
+
}, l.$$click = () => U(t().id, t().disabled), ie((n) => {
|
|
277
|
+
H.set(t().id, n), ce(() => H.delete(t().id));
|
|
276
278
|
}, l), f(l, v(B, {
|
|
277
279
|
get when() {
|
|
278
|
-
return t.icon;
|
|
280
|
+
return t().icon;
|
|
279
281
|
},
|
|
280
282
|
get children() {
|
|
281
283
|
var n = Ge();
|
|
282
|
-
return f(n, () => t.icon), n;
|
|
284
|
+
return f(n, () => t().icon), n;
|
|
283
285
|
}
|
|
284
|
-
}), A), f(A, () => t.label), f(l, v(B, {
|
|
286
|
+
}), A), f(A, () => t().label), f(l, v(B, {
|
|
285
287
|
get when() {
|
|
286
|
-
return le(() => !!c())() && !t.disabled;
|
|
288
|
+
return le(() => !!c())() && !t().disabled;
|
|
287
289
|
},
|
|
288
290
|
get children() {
|
|
289
291
|
var n = Ue();
|
|
290
|
-
return n.$$click = (m) => $e(m, t.id), f(n, v(He, {
|
|
292
|
+
return n.$$click = (m) => $e(m, t().id), f(n, v(He, {
|
|
291
293
|
class: "w-3 h-3"
|
|
292
294
|
})), y((m) => {
|
|
293
|
-
var $ = g("flex-shrink-0 flex items-center justify-center", "w-5 h-5 rounded cursor-pointer", "bg-transparent text-muted-foreground", T() ? "hover:bg-error hover:text-error-foreground" : "hover:bg-muted/80 hover:text-foreground", "transition-colors duration-120", "ml-1.5", e.slotClassNames?.closeButton), N = `Close ${t.label}`;
|
|
295
|
+
var $ = g("flex-shrink-0 flex items-center justify-center", "w-5 h-5 rounded cursor-pointer", "bg-transparent text-muted-foreground", T() ? "hover:bg-error hover:text-error-foreground" : "hover:bg-muted/80 hover:text-foreground", "transition-colors duration-120", "ml-1.5", e.slotClassNames?.closeButton), N = `Close ${t().label}`;
|
|
294
296
|
return $ !== m.e && k(n, m.e = $), N !== m.t && p(n, "aria-label", m.t = N), m;
|
|
295
297
|
}, {
|
|
296
298
|
e: void 0,
|
|
@@ -298,7 +300,7 @@ function it(i) {
|
|
|
298
300
|
}), n;
|
|
299
301
|
}
|
|
300
302
|
}), null), y((n) => {
|
|
301
|
-
var m = Le(r(), t.disabled), $ = t.domId, N = t.panelId, re = r() ? "raised" : "flat", oe = r(), ne = t.disabled, se = t.disabled ? -1 : r() ? 0 : -1;
|
|
303
|
+
var m = Le(r(), t().disabled), $ = t().domId, N = t().panelId, re = r() ? "raised" : "flat", oe = r(), ne = t().disabled, se = t().disabled ? -1 : r() ? 0 : -1;
|
|
302
304
|
return m !== n.e && k(l, n.e = m), $ !== n.t && p(l, "id", n.t = $), N !== n.a && p(l, "aria-controls", n.a = N), re !== n.o && p(l, "data-floe-surface", n.o = re), oe !== n.i && p(l, "aria-selected", n.i = oe), ne !== n.n && p(l, "aria-disabled", n.n = ne), se !== n.s && p(l, "tabindex", n.s = se), n;
|
|
303
305
|
}, {
|
|
304
306
|
e: void 0,
|
|
@@ -357,14 +359,14 @@ function it(i) {
|
|
|
357
359
|
}), s;
|
|
358
360
|
})();
|
|
359
361
|
}
|
|
360
|
-
function
|
|
362
|
+
function ct(i) {
|
|
361
363
|
const [e, h] = ve(i, ["active", "keepMounted", "labelledBy", "class", "children"]);
|
|
362
364
|
return v(B, {
|
|
363
365
|
get when() {
|
|
364
366
|
return e.keepMounted || e.active;
|
|
365
367
|
},
|
|
366
368
|
get children() {
|
|
367
|
-
var d =
|
|
369
|
+
var d = Ke();
|
|
368
370
|
return ue(d, fe({
|
|
369
371
|
get "aria-labelledby"() {
|
|
370
372
|
return e.labelledBy;
|
|
@@ -384,7 +386,7 @@ function dt(i) {
|
|
|
384
386
|
}
|
|
385
387
|
Re(["click", "keydown"]);
|
|
386
388
|
export {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
ct as TabPanel,
|
|
390
|
+
dt as Tabs,
|
|
391
|
+
Ve as resolveTabNavigationTargetId
|
|
390
392
|
};
|