@floegence/floe-webapp-core 0.39.6 → 0.39.7
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.
|
@@ -8,6 +8,14 @@ export interface ActivityBarItem {
|
|
|
8
8
|
label: string;
|
|
9
9
|
badge?: number | string | (() => number | string | undefined);
|
|
10
10
|
onClick?: () => void;
|
|
11
|
+
/** Receives the concrete trigger button for anchored product surfaces. */
|
|
12
|
+
buttonRef?: (button: HTMLButtonElement | null) => void;
|
|
13
|
+
/** ARIA disclosure state for a surface controlled by this item. */
|
|
14
|
+
ariaExpanded?: boolean | (() => boolean | undefined);
|
|
15
|
+
/** ID of the surface controlled by this item. */
|
|
16
|
+
ariaControls?: string;
|
|
17
|
+
/** Semantic kind of popup opened by this item. */
|
|
18
|
+
ariaHasPopup?: 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean;
|
|
11
19
|
/**
|
|
12
20
|
* How this item should affect the sidebar collapsed state when clicked.
|
|
13
21
|
*
|
|
@@ -1,110 +1,116 @@
|
|
|
1
|
-
import { insert as c, createComponent as
|
|
2
|
-
import { createMemo as
|
|
1
|
+
import { insert as c, createComponent as r, effect as g, className as h, setAttribute as u, template as s, use as I, Dynamic as B, memo as $, delegateEvents as E } from "solid-js/web";
|
|
2
|
+
import { createMemo as m, For as k, Show as x, onMount as S, onCleanup as _ } from "solid-js";
|
|
3
3
|
import { cn as y } from "../../utils/cn.js";
|
|
4
|
-
import { deferNonBlocking as
|
|
5
|
-
import { Tooltip as
|
|
6
|
-
import { resolveActivityBarClick as
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
|
|
4
|
+
import { deferNonBlocking as j } from "../../utils/defer.js";
|
|
5
|
+
import { Tooltip as R } from "../ui/Tooltip.js";
|
|
6
|
+
import { resolveActivityBarClick as M } from "./activityBarBehavior.js";
|
|
7
|
+
var N = /* @__PURE__ */ s('<div class="flex flex-col">'), q = /* @__PURE__ */ s('<nav data-floe-shell-slot=activity-bar style=border-right-color:var(--activity-bar-border)><div class="flex flex-col">'), D = /* @__PURE__ */ s('<div class="absolute left-0 top-0 w-1 h-full bg-primary rounded-r">'), F = /* @__PURE__ */ s("<span>"), H = /* @__PURE__ */ s("<button type=button>");
|
|
8
|
+
function J(t) {
|
|
9
|
+
const l = m(() => t.activeId), d = m(() => t.collapsed ?? !1), b = m(() => t.onActiveChange), i = m(() => t.onCollapsedChange), v = (e) => {
|
|
10
|
+
if (e.onClick) {
|
|
11
|
+
j(() => e.onClick());
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
clickedId:
|
|
16
|
-
activeId:
|
|
17
|
-
collapsed:
|
|
18
|
-
behavior:
|
|
14
|
+
const a = M({
|
|
15
|
+
clickedId: e.id,
|
|
16
|
+
activeId: l(),
|
|
17
|
+
collapsed: d(),
|
|
18
|
+
behavior: e.collapseBehavior
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
openSidebar:
|
|
22
|
-
}) :
|
|
20
|
+
a.nextActiveId !== l() && (typeof a.openSidebar == "boolean" ? b()(a.nextActiveId, {
|
|
21
|
+
openSidebar: a.openSidebar
|
|
22
|
+
}) : b()(a.nextActiveId)), typeof a.nextCollapsed == "boolean" && i()?.(a.nextCollapsed);
|
|
23
23
|
};
|
|
24
24
|
return (() => {
|
|
25
|
-
var
|
|
26
|
-
return c(
|
|
25
|
+
var e = q(), a = e.firstChild;
|
|
26
|
+
return c(a, r(k, {
|
|
27
27
|
get each() {
|
|
28
|
-
return
|
|
28
|
+
return t.items;
|
|
29
29
|
},
|
|
30
|
-
children: (
|
|
31
|
-
item:
|
|
30
|
+
children: (n) => r(w, {
|
|
31
|
+
item: n,
|
|
32
32
|
get isActive() {
|
|
33
|
-
return
|
|
33
|
+
return l() === n.id;
|
|
34
34
|
},
|
|
35
|
-
onClick: () => v(
|
|
35
|
+
onClick: () => v(n)
|
|
36
36
|
})
|
|
37
|
-
})), c(
|
|
37
|
+
})), c(e, r(x, {
|
|
38
38
|
get when() {
|
|
39
|
-
return
|
|
39
|
+
return t.bottomItems?.length;
|
|
40
40
|
},
|
|
41
41
|
get children() {
|
|
42
|
-
var
|
|
43
|
-
return c(
|
|
42
|
+
var n = N();
|
|
43
|
+
return c(n, r(k, {
|
|
44
44
|
get each() {
|
|
45
|
-
return
|
|
45
|
+
return t.bottomItems;
|
|
46
46
|
},
|
|
47
|
-
children: (
|
|
48
|
-
item:
|
|
47
|
+
children: (o) => r(w, {
|
|
48
|
+
item: o,
|
|
49
49
|
isActive: !1,
|
|
50
|
-
onClick: () => v(
|
|
50
|
+
onClick: () => v(o)
|
|
51
51
|
})
|
|
52
|
-
})),
|
|
52
|
+
})), n;
|
|
53
53
|
}
|
|
54
|
-
}), null),
|
|
55
|
-
var
|
|
56
|
-
return
|
|
54
|
+
}), null), g((n) => {
|
|
55
|
+
var o = y("w-10 md:w-12 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-border", t.class), f = t.ariaLabel;
|
|
56
|
+
return o !== n.e && h(e, n.e = o), f !== n.t && u(e, "aria-label", n.t = f), n;
|
|
57
57
|
}, {
|
|
58
58
|
e: void 0,
|
|
59
59
|
t: void 0
|
|
60
|
-
}),
|
|
60
|
+
}), e;
|
|
61
61
|
})();
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
function w(t) {
|
|
64
|
+
let l;
|
|
65
|
+
const d = () => typeof t.item.badge == "function" ? t.item.badge() : t.item.badge, b = () => typeof t.item.ariaExpanded == "function" ? t.item.ariaExpanded() : t.item.ariaExpanded;
|
|
66
|
+
return S(() => t.item.buttonRef?.(l ?? null)), _(() => t.item.buttonRef?.(null)), r(R, {
|
|
66
67
|
get content() {
|
|
67
|
-
return
|
|
68
|
+
return t.item.label;
|
|
68
69
|
},
|
|
69
70
|
placement: "right",
|
|
70
71
|
delay: 0,
|
|
71
72
|
get children() {
|
|
72
|
-
var
|
|
73
|
-
|
|
73
|
+
var i = H();
|
|
74
|
+
i.$$click = () => t.onClick();
|
|
75
|
+
var v = l;
|
|
76
|
+
return typeof v == "function" ? I(v, i) : l = i, c(i, r(x, {
|
|
74
77
|
get when() {
|
|
75
|
-
return
|
|
78
|
+
return t.isActive;
|
|
76
79
|
},
|
|
77
80
|
get children() {
|
|
78
|
-
return
|
|
81
|
+
return D();
|
|
79
82
|
}
|
|
80
|
-
}), null), c(
|
|
83
|
+
}), null), c(i, r(B, {
|
|
81
84
|
get component() {
|
|
82
|
-
return
|
|
85
|
+
return t.item.icon;
|
|
83
86
|
},
|
|
84
87
|
class: "w-5 h-5"
|
|
85
|
-
}), null), c(
|
|
88
|
+
}), null), c(i, r(x, {
|
|
86
89
|
get when() {
|
|
87
|
-
return
|
|
90
|
+
return d();
|
|
88
91
|
},
|
|
89
92
|
get children() {
|
|
90
|
-
var
|
|
91
|
-
return c(
|
|
92
|
-
var
|
|
93
|
-
return () =>
|
|
94
|
-
})()),
|
|
93
|
+
var e = F();
|
|
94
|
+
return c(e, (() => {
|
|
95
|
+
var a = $(() => typeof d() == "number" && d() > 99);
|
|
96
|
+
return () => a() ? "99+" : d();
|
|
97
|
+
})()), g(() => h(e, y("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[9px] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), e;
|
|
95
98
|
}
|
|
96
|
-
}), null),
|
|
97
|
-
var
|
|
98
|
-
return
|
|
99
|
+
}), null), g((e) => {
|
|
100
|
+
var a = y("relative w-full aspect-square flex items-center justify-center cursor-pointer", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", t.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground transition-[color,background-color] duration-100 hover:text-activity-bar-foreground-active hover:bg-accent/40"), n = t.item.label, o = t.isActive, f = b(), C = t.item.ariaControls, A = t.item.ariaHasPopup;
|
|
101
|
+
return a !== e.e && h(i, e.e = a), n !== e.t && u(i, "aria-label", e.t = n), o !== e.a && u(i, "aria-pressed", e.a = o), f !== e.o && u(i, "aria-expanded", e.o = f), C !== e.i && u(i, "aria-controls", e.i = C), A !== e.n && u(i, "aria-haspopup", e.n = A), e;
|
|
99
102
|
}, {
|
|
100
103
|
e: void 0,
|
|
101
104
|
t: void 0,
|
|
102
|
-
a: void 0
|
|
103
|
-
|
|
105
|
+
a: void 0,
|
|
106
|
+
o: void 0,
|
|
107
|
+
i: void 0,
|
|
108
|
+
n: void 0
|
|
109
|
+
}), i;
|
|
104
110
|
}
|
|
105
111
|
});
|
|
106
112
|
}
|
|
107
|
-
|
|
113
|
+
E(["click"]);
|
|
108
114
|
export {
|
|
109
|
-
|
|
115
|
+
J as ActivityBar
|
|
110
116
|
};
|