@umituz/web-dashboard 8.0.0 → 8.1.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "Installable app skeleton for the fleet — layouts, analytics (dependency-free SVG charts), calendar, onboarding flow permissions/module registry; udb-* stylesheet on design-system tokens",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -191,12 +191,36 @@ describe("DashboardSidebar (secondaryLabel)", () => {
|
|
|
191
191
|
</Routes>
|
|
192
192
|
</MemoryRouter>
|
|
193
193
|
);
|
|
194
|
-
const toggle = document.querySelector("button.udb-sidebar__footer-btn");
|
|
194
|
+
const toggle = document.querySelector<HTMLButtonElement>("button.udb-sidebar__footer-btn");
|
|
195
195
|
toggle?.click();
|
|
196
196
|
expect(onCollapsedChange).toHaveBeenCalledWith(true);
|
|
197
197
|
});
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
+
describe("DashboardSidebar (untitled group)", () => {
|
|
201
|
+
const untitledConfig: DashboardLayoutConfig = {
|
|
202
|
+
sidebarGroups: [
|
|
203
|
+
{
|
|
204
|
+
items: [{ path: "/", label: "Home", icon: Home, end: false }],
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
title: "Main",
|
|
208
|
+
items: [{ path: "/main", label: "Main link", icon: Home, end: false }],
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
brandName: "Test",
|
|
212
|
+
defaultTitle: "Workspace",
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
it("renders items without a group toggle and keeps titled groups toggleable", () => {
|
|
216
|
+
renderAt("/", { config: untitledConfig });
|
|
217
|
+
expect(screen.getByRole("link", { name: /home/i })).toBeTruthy();
|
|
218
|
+
const toggles = document.querySelectorAll("button.udb-sidebar__group-toggle");
|
|
219
|
+
expect(toggles.length).toBe(1);
|
|
220
|
+
expect(toggles[0].textContent).toContain("Main");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
200
224
|
describe("DashboardLayout (contentFallback)", () => {
|
|
201
225
|
const NeverResolves = lazy(() => new Promise<{ default: React.ComponentType }>(() => {}));
|
|
202
226
|
|
|
@@ -89,23 +89,25 @@ export const DashboardSidebar = ({
|
|
|
89
89
|
|
|
90
90
|
<nav className="udb-sidebar__nav">
|
|
91
91
|
<div className="udb-sidebar__groups">
|
|
92
|
-
{sidebarGroups.map((group) => {
|
|
92
|
+
{sidebarGroups.map((group, groupIndex) => {
|
|
93
93
|
const filteredItems = filterSidebarItems(group.items, user);
|
|
94
94
|
|
|
95
95
|
if (filteredItems.length === 0) return null;
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const groupTitle = group.title;
|
|
98
|
+
const groupKey = groupTitle ?? `group-${groupIndex}`;
|
|
99
|
+
const isGroupCollapsed = groupTitle !== undefined && collapsedGroups[groupTitle];
|
|
98
100
|
|
|
99
101
|
return (
|
|
100
|
-
<div key={
|
|
101
|
-
{!collapsed && (
|
|
102
|
+
<div key={groupKey} className="udb-sidebar__group">
|
|
103
|
+
{!collapsed && groupTitle !== undefined && (
|
|
102
104
|
<button
|
|
103
105
|
type="button"
|
|
104
|
-
onClick={() => toggleGroup(
|
|
106
|
+
onClick={() => toggleGroup(groupTitle)}
|
|
105
107
|
className="udb-sidebar__group-toggle"
|
|
106
108
|
>
|
|
107
109
|
<span className="udb-sidebar__group-title">
|
|
108
|
-
{
|
|
110
|
+
{groupTitle}
|
|
109
111
|
</span>
|
|
110
112
|
|
|
111
113
|
<span className="udb-sidebar__group-chevron">
|