@burdenoff/fe-libs 2026.527.3 → 2026.527.4
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/chrome/ContextSwitcher.js +90 -339
- package/dist/chrome/GlobalSearch.js +72 -456
- package/dist/chrome/NotificationCenter.js +69 -703
- package/dist/chrome/SideNavigation.js +73 -241
- package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
- package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
- package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
- package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
- package/dist/chrome/contextSwitcher/TabButton.js +9 -0
- package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
- package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
- package/dist/chrome/contextSwitcher/icons.js +58 -0
- package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
- package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
- package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
- package/dist/chrome/globalSearch/ResultsList.js +58 -0
- package/dist/chrome/globalSearch/SearchInput.js +28 -0
- package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
- package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
- package/dist/chrome/globalSearch/utils.js +22 -0
- package/dist/chrome/notificationCenter/BellButton.js +27 -0
- package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
- package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
- package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
- package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
- package/dist/chrome/notificationCenter/NotificationList.js +75 -0
- package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
- package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
- package/dist/chrome/notificationCenter/constants.js +93 -0
- package/dist/chrome/notificationCenter/gql.js +58 -0
- package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
- package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
- package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
- package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
- package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
- package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
- package/dist/chrome/sideNavigation/helpers.js +19 -0
- package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
- package/dist/shared/components/ContextConversationWidget.js +173 -767
- package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
- package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
- package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
- package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
- package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
- package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
- package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
- package/dist/shared/components/contextConversationWidget/queries.js +197 -0
- package/dist/shared/components/contextConversationWidget/types.js +10 -0
- package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
- package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
- package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
- package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
- package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
- package/dist/shared/components/contextConversationWidget/utils.js +56 -0
- package/dist/shared/pages/SearchPage.js +293 -1076
- package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
- package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
- package/dist/shared/pages/searchPage/ResultsList.js +119 -0
- package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
- package/dist/shared/pages/searchPage/SearchInput.js +31 -0
- package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
- package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
- package/dist/shared/pages/searchPage/constants.js +155 -0
- package/dist/shared/pages/searchPage/utils.js +24 -0
- package/dist/shared/providers/shell/AuthProvider.js +130 -384
- package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
- package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
- package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
- package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
- package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
- package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
- package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
- package/dist/shared/tours/TourTrigger.js +86 -262
- package/dist/shared/tours/ToursContext.js +108 -398
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
- package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
- package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
- package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
- package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
- package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
- package/dist/shared/tours/toursContext/errors.js +18 -0
- package/dist/shared/tours/toursContext/gql.js +152 -0
- package/dist/shared/tours/toursContext/route.js +20 -0
- package/dist/shared/tours/toursContext/session.js +19 -0
- package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
- package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
- package/dist/tag/TagsWidget.js +81 -226
- package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
- package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
- package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
- package/dist/tag/tagsWidget/operations.js +64 -0
- package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { COUNTS_BY_APP_QUERY as e, DELETE_NOTIFICATION_MUTATION as t, MARK_ALL_READ_MUTATION as n, MARK_READ_MUTATION as r, MY_UNREAD_COUNT_SUBSCRIPTION as i, NOTIFICATIONS_QUERY as a, UNREAD_COUNT_QUERY as o } from "./gql.js";
|
|
2
|
+
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
3
|
+
//#region src/chrome/notificationCenter/useNotificationCenter.ts
|
|
4
|
+
function d({ client: d, isOpen: f, lazy: p, filterTab: m, typeFilter: h, appFilter: g }) {
|
|
5
|
+
let [_, v] = u([]), [y, b] = u(0), [x, S] = u({}), [C, w] = u(0), [T, E] = u(!1), [D, O] = u(null), k = l(d);
|
|
6
|
+
c(() => {
|
|
7
|
+
k.current = d;
|
|
8
|
+
}, [d]);
|
|
9
|
+
let A = s(async () => {
|
|
10
|
+
try {
|
|
11
|
+
let e = (await k.current.query({
|
|
12
|
+
query: o,
|
|
13
|
+
variables: { filter: {
|
|
14
|
+
channel: "IN_APP",
|
|
15
|
+
archived: !1
|
|
16
|
+
} },
|
|
17
|
+
fetchPolicy: "network-only"
|
|
18
|
+
})).data;
|
|
19
|
+
b(e?.myUnreadNotificationCount ?? 0);
|
|
20
|
+
} catch {}
|
|
21
|
+
}, []), [j, M] = u(!1);
|
|
22
|
+
c(() => {
|
|
23
|
+
let e = () => M(!0);
|
|
24
|
+
if (typeof window < "u" && "requestIdleCallback" in window) {
|
|
25
|
+
let t = window.requestIdleCallback(e, { timeout: 2e3 });
|
|
26
|
+
return () => {
|
|
27
|
+
window.cancelIdleCallback?.(t);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
let t = setTimeout(e, 500);
|
|
31
|
+
return () => clearTimeout(t);
|
|
32
|
+
}, []), c(() => {
|
|
33
|
+
if (p || !j) return;
|
|
34
|
+
A();
|
|
35
|
+
let e = k.current.subscribe({
|
|
36
|
+
query: i,
|
|
37
|
+
variables: { filter: {
|
|
38
|
+
channel: "IN_APP",
|
|
39
|
+
archived: !1
|
|
40
|
+
} },
|
|
41
|
+
fetchPolicy: "no-cache"
|
|
42
|
+
}).subscribe({
|
|
43
|
+
next: (e) => {
|
|
44
|
+
let t = e.data;
|
|
45
|
+
typeof t?.myUnreadNotificationCountStream == "number" && b(t.myUnreadNotificationCountStream);
|
|
46
|
+
},
|
|
47
|
+
error: () => {}
|
|
48
|
+
}), t = setInterval(A, 300 * 1e3);
|
|
49
|
+
return () => {
|
|
50
|
+
e.unsubscribe(), clearInterval(t);
|
|
51
|
+
};
|
|
52
|
+
}, [
|
|
53
|
+
A,
|
|
54
|
+
p,
|
|
55
|
+
j
|
|
56
|
+
]);
|
|
57
|
+
let N = s(async () => {
|
|
58
|
+
E(!0), O(null);
|
|
59
|
+
try {
|
|
60
|
+
let e = {
|
|
61
|
+
channel: "IN_APP",
|
|
62
|
+
archived: !1
|
|
63
|
+
};
|
|
64
|
+
m === "unread" && (e.isRead = !1), m === "read" && (e.isRead = !0), h !== "ALL" && (e.type = h), g !== "ALL" && (e.appName = g);
|
|
65
|
+
let t = (await k.current.query({
|
|
66
|
+
query: a,
|
|
67
|
+
variables: {
|
|
68
|
+
filter: e,
|
|
69
|
+
limit: 20,
|
|
70
|
+
offset: 0
|
|
71
|
+
},
|
|
72
|
+
fetchPolicy: "network-only"
|
|
73
|
+
})).data?.notifications;
|
|
74
|
+
t && (v(t.items ?? []), w(t.total ?? 0));
|
|
75
|
+
} catch (e) {
|
|
76
|
+
O(e instanceof Error ? e.message : "Failed to load notifications");
|
|
77
|
+
} finally {
|
|
78
|
+
E(!1);
|
|
79
|
+
}
|
|
80
|
+
}, [
|
|
81
|
+
m,
|
|
82
|
+
h,
|
|
83
|
+
g
|
|
84
|
+
]), P = s(async () => {
|
|
85
|
+
try {
|
|
86
|
+
let t = (await k.current.query({
|
|
87
|
+
query: e,
|
|
88
|
+
fetchPolicy: "network-only"
|
|
89
|
+
})).data;
|
|
90
|
+
S(t?.myNotificationCountsByApp ?? {});
|
|
91
|
+
} catch {}
|
|
92
|
+
}, []);
|
|
93
|
+
return c(() => {
|
|
94
|
+
f && (p && A(), N(), P(), A());
|
|
95
|
+
}, [
|
|
96
|
+
f,
|
|
97
|
+
N,
|
|
98
|
+
P,
|
|
99
|
+
A,
|
|
100
|
+
p
|
|
101
|
+
]), {
|
|
102
|
+
notifications: _,
|
|
103
|
+
unreadCount: y,
|
|
104
|
+
countsByApp: x,
|
|
105
|
+
totalCount: C,
|
|
106
|
+
loading: T,
|
|
107
|
+
error: D,
|
|
108
|
+
fetchNotifications: N,
|
|
109
|
+
handleMarkAsRead: s(async (e) => {
|
|
110
|
+
try {
|
|
111
|
+
await k.current.mutate({
|
|
112
|
+
mutation: r,
|
|
113
|
+
variables: { id: e }
|
|
114
|
+
}), v((t) => t.map((t) => t.id === e ? {
|
|
115
|
+
...t,
|
|
116
|
+
isRead: !0,
|
|
117
|
+
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
118
|
+
} : t)), b((e) => Math.max(0, e - 1));
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.error("Failed to mark notification as read:", e);
|
|
121
|
+
}
|
|
122
|
+
}, []),
|
|
123
|
+
handleMarkAllAsRead: s(async () => {
|
|
124
|
+
try {
|
|
125
|
+
await k.current.mutate({ mutation: n }), v((e) => e.map((e) => ({
|
|
126
|
+
...e,
|
|
127
|
+
isRead: !0,
|
|
128
|
+
readAt: e.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
129
|
+
}))), b(0);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.error("Failed to mark all notifications as read:", e);
|
|
132
|
+
}
|
|
133
|
+
}, []),
|
|
134
|
+
handleDelete: s(async (e) => {
|
|
135
|
+
try {
|
|
136
|
+
await k.current.mutate({
|
|
137
|
+
mutation: t,
|
|
138
|
+
variables: { id: e }
|
|
139
|
+
});
|
|
140
|
+
let n = _.find((t) => t.id === e);
|
|
141
|
+
v((t) => t.filter((t) => t.id !== e)), w((e) => Math.max(0, e - 1)), n && !n.isRead && b((e) => Math.max(0, e - 1));
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.error("Failed to delete notification:", e);
|
|
144
|
+
}
|
|
145
|
+
}, [_])
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
export { d as useNotificationCenter };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
//#region src/chrome/notificationCenter/usePanelChrome.ts
|
|
3
|
+
function n() {
|
|
4
|
+
let [n, r] = t(!1);
|
|
5
|
+
return e(() => {
|
|
6
|
+
let e = window.matchMedia("(max-width: 767px)");
|
|
7
|
+
r(e.matches);
|
|
8
|
+
let t = (e) => r(e.matches);
|
|
9
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
10
|
+
}, []), { isMobile: n };
|
|
11
|
+
}
|
|
12
|
+
function r(t, n, r, i) {
|
|
13
|
+
e(() => {
|
|
14
|
+
if (!t || n) return;
|
|
15
|
+
let e = (e) => {
|
|
16
|
+
r.current && !r.current.contains(e.target) && i();
|
|
17
|
+
};
|
|
18
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
19
|
+
}, [
|
|
20
|
+
t,
|
|
21
|
+
n,
|
|
22
|
+
r,
|
|
23
|
+
i
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
function i(t, n) {
|
|
27
|
+
e(() => {
|
|
28
|
+
if (!t) return;
|
|
29
|
+
let e = (e) => {
|
|
30
|
+
e.key === "Escape" && n();
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
33
|
+
}, [t, n]);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as useEscapeClose, r as useOutsideClickClose, n as usePanelChrome };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/chrome/sideNavigation/CollapseToggle.tsx
|
|
3
|
+
var n = ({ collapsed: n, collapseLabel: r, onToggleCollapse: i }) => /* @__PURE__ */ e("div", {
|
|
4
|
+
className: `hidden md:block py-4 border-t border-border-subtle ${n ? "px-2" : "px-card-padding"}`,
|
|
5
|
+
children: /* @__PURE__ */ t("button", {
|
|
6
|
+
type: "button",
|
|
7
|
+
onClick: i,
|
|
8
|
+
className: `w-full flex items-center gap-icon-gap py-2 rounded-button text-text-secondary hover:bg-action-ghost-bg-hover hover:text-text-primary transition-colors ${n ? "justify-center px-2" : "px-card-padding"}`,
|
|
9
|
+
"aria-label": n ? "Expand sidebar" : "Collapse sidebar",
|
|
10
|
+
title: n ? "Expand sidebar" : "Collapse sidebar",
|
|
11
|
+
children: [/* @__PURE__ */ e("svg", {
|
|
12
|
+
className: `w-icon-md h-icon-md transition-transform ${n ? "rotate-180" : ""}`,
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
children: /* @__PURE__ */ e("path", {
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
strokeWidth: 2,
|
|
20
|
+
d: "M15 19l-7-7 7-7"
|
|
21
|
+
})
|
|
22
|
+
}), !n && /* @__PURE__ */ e("span", {
|
|
23
|
+
className: "text-body-sm font-medium",
|
|
24
|
+
children: r
|
|
25
|
+
})]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n as CollapseToggle };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/chrome/sideNavigation/MobileActionsBar.tsx
|
|
3
|
+
var n = ({ actions: n, collapsed: r, onToggleCollapse: i }) => /* @__PURE__ */ t("div", {
|
|
4
|
+
className: "md:hidden py-4 px-4 border-t border-border-subtle bg-bg-canvas/50",
|
|
5
|
+
children: [/* @__PURE__ */ e("p", {
|
|
6
|
+
className: "text-caption text-text-tertiary mb-3 font-medium uppercase tracking-wider",
|
|
7
|
+
children: "Quick Actions"
|
|
8
|
+
}), /* @__PURE__ */ e("div", {
|
|
9
|
+
className: "flex items-center justify-center gap-3",
|
|
10
|
+
children: n.map((t) => /* @__PURE__ */ e("button", {
|
|
11
|
+
onClick: () => {
|
|
12
|
+
t.onClick(), t.closeSidebar !== !1 && i && !r && i();
|
|
13
|
+
},
|
|
14
|
+
className: `flex items-center justify-center w-12 h-12 rounded-xl text-body-sm font-medium transition-all ${t.isToggle && t.isActive ? "bg-action-primary-bg text-action-primary-text shadow-sm" : "bg-bg-surface text-text-primary hover:bg-action-ghost-bg-hover border border-border-subtle hover:border-border-default active:scale-95"}`,
|
|
15
|
+
"aria-label": t.label,
|
|
16
|
+
title: t.label,
|
|
17
|
+
children: /* @__PURE__ */ e("span", {
|
|
18
|
+
className: "size-5",
|
|
19
|
+
children: t.icon
|
|
20
|
+
})
|
|
21
|
+
}, t.id))
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { n as MobileActionsBar };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isItemDirectlyActive as e, isItemOrChildActive as t } from "./helpers.js";
|
|
2
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
//#region src/chrome/sideNavigation/NavItemRenderer.tsx
|
|
4
|
+
var i = ({ item: a, depth: o, maxDepth: s, currentPath: c, expandedItems: l, toggleExpand: u, onItemClick: d, onToggleCollapse: f, collapsed: p }) => {
|
|
5
|
+
let m = a.children && a.children.length > 0 && o < s, h = l.has(a.id), g = t(a, c), _ = e(a, c), v = o === 0 ? "w-icon-md h-icon-md" : "w-4 h-4";
|
|
6
|
+
return /* @__PURE__ */ r("li", { children: [/* @__PURE__ */ n("div", {
|
|
7
|
+
className: "relative",
|
|
8
|
+
children: /* @__PURE__ */ r("button", {
|
|
9
|
+
type: "button",
|
|
10
|
+
onClick: () => {
|
|
11
|
+
if (p && o === 0 && m) {
|
|
12
|
+
d(a.homePath || a.children?.[0]?.path || a.path);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
m ? u(a.id) : (d(a.path), window.innerWidth < 768 && f && !p && f());
|
|
16
|
+
},
|
|
17
|
+
className: `
|
|
18
|
+
w-full flex items-center gap-icon-gap ${o === 0 ? "py-2" : "py-1.5"} rounded-button
|
|
19
|
+
transition-colors duration-200 ease-out
|
|
20
|
+
active:scale-[0.98]
|
|
21
|
+
${p && o === 0 ? "md:px-2 md:justify-center" : "px-card-padding"}
|
|
22
|
+
${_ && !m ? "bg-action-primary-bg text-action-primary-text shadow-sm" : g && !h ? "bg-action-ghost-bg-hover text-text-primary" : "text-text-secondary hover:bg-action-ghost-bg-hover hover:text-text-primary"}
|
|
23
|
+
`,
|
|
24
|
+
"aria-label": a.label,
|
|
25
|
+
children: [
|
|
26
|
+
a.icon && /* @__PURE__ */ n("div", {
|
|
27
|
+
className: `${v} flex-shrink-0 flex items-center justify-center [&>svg]:w-full [&>svg]:h-full [&>svg]:stroke-[1.75]`,
|
|
28
|
+
children: typeof a.icon == "string" ? /* @__PURE__ */ n("svg", {
|
|
29
|
+
className: "w-full h-full",
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
viewBox: "0 0 24 24",
|
|
33
|
+
children: /* @__PURE__ */ n("path", {
|
|
34
|
+
strokeLinecap: "round",
|
|
35
|
+
strokeLinejoin: "round",
|
|
36
|
+
strokeWidth: 2,
|
|
37
|
+
d: a.icon
|
|
38
|
+
})
|
|
39
|
+
}) : a.icon
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ n("span", {
|
|
42
|
+
className: `text-body-sm font-medium flex-1 text-left ${p && o === 0 ? "md:hidden" : ""}`,
|
|
43
|
+
children: a.label
|
|
44
|
+
}),
|
|
45
|
+
a.badge !== void 0 && a.badge > 0 && /* @__PURE__ */ n("span", {
|
|
46
|
+
className: `text-xs bg-status-error-bg text-status-error-text px-2 py-0.5 rounded-pill ${p && o === 0 ? "md:hidden" : ""}`,
|
|
47
|
+
children: a.badge
|
|
48
|
+
}),
|
|
49
|
+
m && !(p && o === 0) && /* @__PURE__ */ n("svg", {
|
|
50
|
+
className: `w-4 h-4 transition-transform ${h ? "rotate-90" : ""}`,
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
children: /* @__PURE__ */ n("path", {
|
|
55
|
+
strokeLinecap: "round",
|
|
56
|
+
strokeLinejoin: "round",
|
|
57
|
+
strokeWidth: 2,
|
|
58
|
+
d: "M9 5l7 7-7 7"
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
}), m && h && !p && /* @__PURE__ */ n("ul", {
|
|
64
|
+
className: "mt-1 ml-6 space-y-1 border-l border-border-subtle pl-3 animate-in fade-in-0 slide-in-from-top-2 duration-200",
|
|
65
|
+
children: a.children.map((e) => /* @__PURE__ */ n(i, {
|
|
66
|
+
item: e,
|
|
67
|
+
depth: o + 1,
|
|
68
|
+
maxDepth: s,
|
|
69
|
+
currentPath: c,
|
|
70
|
+
expandedItems: l,
|
|
71
|
+
toggleExpand: u,
|
|
72
|
+
onItemClick: d,
|
|
73
|
+
onToggleCollapse: f,
|
|
74
|
+
collapsed: p
|
|
75
|
+
}, e.id))
|
|
76
|
+
})] });
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { i as NavItemRenderer };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/chrome/sideNavigation/SidebarHeader.tsx
|
|
3
|
+
var n = ({ header: n, collapsed: r, expandedCount: i, onCollapseAll: a }) => /* @__PURE__ */ t("div", {
|
|
4
|
+
className: `py-card-padding border-b border-border-subtle ${r ? "md:px-2" : "px-card-padding"} relative`,
|
|
5
|
+
children: [/* @__PURE__ */ e("div", {
|
|
6
|
+
className: i > 0 && !r ? "mr-8" : "",
|
|
7
|
+
children: n
|
|
8
|
+
}), !r && i > 0 && /* @__PURE__ */ e("button", {
|
|
9
|
+
type: "button",
|
|
10
|
+
onClick: a,
|
|
11
|
+
className: "absolute top-1/2 -translate-y-1/2 right-3 p-1.5 rounded-button hover:bg-action-ghost-bg-hover text-text-secondary hover:text-text-primary transition-colors",
|
|
12
|
+
title: "Collapse all",
|
|
13
|
+
"aria-label": "Collapse all menu items",
|
|
14
|
+
children: /* @__PURE__ */ e("svg", {
|
|
15
|
+
className: "size-4",
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
children: /* @__PURE__ */ e("path", {
|
|
20
|
+
strokeLinecap: "round",
|
|
21
|
+
strokeLinejoin: "round",
|
|
22
|
+
strokeWidth: 2,
|
|
23
|
+
d: "M5 15l7-7 7 7"
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n as SidebarHeader };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/chrome/sideNavigation/helpers.ts
|
|
2
|
+
function e(e, t, n = !1) {
|
|
3
|
+
return e ? e === "/" ? t === "/" : n ? t === e : t === e || t.startsWith(`${e}/`) : !1;
|
|
4
|
+
}
|
|
5
|
+
function t(t, n) {
|
|
6
|
+
return e(t.path, n, t.exact) || e(t.homePath, n, t.exact);
|
|
7
|
+
}
|
|
8
|
+
var n = (e, r) => t(e, r) ? !0 : e.children ? e.children.some((e) => n(e, r)) : !1, r = (e, n, i = []) => {
|
|
9
|
+
for (let a of e) {
|
|
10
|
+
if (a.children && a.children.length > 0) {
|
|
11
|
+
let e = r(a.children, n, [...i, a.id]);
|
|
12
|
+
if (e.size > 0 || a.children.some((e) => t(e, n))) return e.add(a.id), i.forEach((t) => e.add(t)), e;
|
|
13
|
+
}
|
|
14
|
+
if (t(a, n)) return new Set(i);
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ new Set();
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { r as findAncestorIds, t as isItemDirectlyActive, n as isItemOrChildActive };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { findAncestorIds as e } from "./helpers.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/chrome/sideNavigation/useSideNavigationState.ts
|
|
4
|
+
function a({ items: a, currentPath: o, collapsed: s, onToggleCollapse: c }) {
|
|
5
|
+
let [l, u] = i(/* @__PURE__ */ new Set()), d = r(s);
|
|
6
|
+
return n(() => {
|
|
7
|
+
d.current = s;
|
|
8
|
+
}, [s]), n(() => {
|
|
9
|
+
let t = e(a, o);
|
|
10
|
+
t.size > 0 && u((e) => {
|
|
11
|
+
let n = new Set(e), r = !1;
|
|
12
|
+
return t.forEach((e) => {
|
|
13
|
+
n.has(e) || (n.add(e), r = !0);
|
|
14
|
+
}), r ? n : e;
|
|
15
|
+
});
|
|
16
|
+
}, [o, a]), n(() => {
|
|
17
|
+
if (typeof window > "u" || !c) return;
|
|
18
|
+
let e = window.innerWidth < 768, t = () => {
|
|
19
|
+
let t = window.innerWidth < 768;
|
|
20
|
+
t && (!e || !d.current) && c(), e = t;
|
|
21
|
+
};
|
|
22
|
+
return t(), window.addEventListener("resize", t), () => {
|
|
23
|
+
window.removeEventListener("resize", t);
|
|
24
|
+
};
|
|
25
|
+
}, [c]), n(() => {
|
|
26
|
+
if (s) return;
|
|
27
|
+
let e = (e) => {
|
|
28
|
+
e.key === "Escape" && c && c();
|
|
29
|
+
};
|
|
30
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
31
|
+
}, [s, c]), {
|
|
32
|
+
expandedItems: l,
|
|
33
|
+
toggleExpand: t((e) => {
|
|
34
|
+
u((t) => {
|
|
35
|
+
let n = new Set(t);
|
|
36
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
37
|
+
});
|
|
38
|
+
}, []),
|
|
39
|
+
collapseAll: t(() => {
|
|
40
|
+
u(/* @__PURE__ */ new Set());
|
|
41
|
+
}, [])
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { a as useSideNavigationState };
|