@umituz/web-dashboard 7.0.0 → 7.2.0
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 +1 -1
- package/src/domains/layouts/components/DashboardLayout.test.tsx +55 -20
- package/src/domains/layouts/components/DashboardSidebar.tsx +4 -0
- package/src/domains/layouts/components/index.ts +1 -0
- package/src/domains/layouts/components/labels.ts +26 -0
- package/src/domains/layouts/types/layout.ts +2 -1
- package/src/domains/layouts/types/sidebar.ts +1 -0
- package/src/styles/chrome.css +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
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",
|
|
@@ -3,26 +3,10 @@ import { render, screen, fireEvent } from "@testing-library/react";
|
|
|
3
3
|
import { MemoryRouter, Routes, Route } from "react-router";
|
|
4
4
|
import { Home } from "lucide-react";
|
|
5
5
|
import { DashboardLayout } from "./DashboardLayout";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
navigation: "Navigation",
|
|
11
|
-
searchResults: "Search results",
|
|
12
|
-
header: {
|
|
13
|
-
switchToLight: "Switch to light",
|
|
14
|
-
switchToDark: "Switch to dark",
|
|
15
|
-
notificationsTitle: "Notifications",
|
|
16
|
-
markAllRead: "Mark all read",
|
|
17
|
-
dismissNotification: "Dismiss",
|
|
18
|
-
noNotifications: "No notifications",
|
|
19
|
-
profile: "Profile",
|
|
20
|
-
settings: "Settings",
|
|
21
|
-
logout: "Log out",
|
|
22
|
-
guestName: "Guest",
|
|
23
|
-
},
|
|
24
|
-
sidebar: { system: "System" },
|
|
25
|
-
};
|
|
6
|
+
import { defaultLayoutLabels } from "./labels";
|
|
7
|
+
import type { DashboardLayoutConfig } from "../types/layout";
|
|
8
|
+
|
|
9
|
+
const labels = defaultLayoutLabels;
|
|
26
10
|
|
|
27
11
|
const config: DashboardLayoutConfig = {
|
|
28
12
|
sidebarGroups: [
|
|
@@ -140,4 +124,55 @@ describe("DashboardLayout (command palette)", () => {
|
|
|
140
124
|
const own = await screen.findByRole("option", { name: "Home" });
|
|
141
125
|
expect(own.textContent).toBe("Home");
|
|
142
126
|
});
|
|
127
|
+
|
|
128
|
+
it("supports a search-only palette without static groups (7.1)", async () => {
|
|
129
|
+
renderAt("/", {
|
|
130
|
+
config: {
|
|
131
|
+
...config,
|
|
132
|
+
commandPalette: { includeSidebar: false, search: async () => [] },
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
fireEvent.keyDown(window, { key: "k", metaKey: true });
|
|
136
|
+
expect(await screen.findByRole("dialog")).toBeTruthy();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe("DashboardSidebar (secondaryLabel)", () => {
|
|
141
|
+
const secondaryConfig: DashboardLayoutConfig = {
|
|
142
|
+
sidebarGroups: [
|
|
143
|
+
{
|
|
144
|
+
title: "Main",
|
|
145
|
+
items: [{ path: "/", label: "Home", icon: Home, end: false, secondaryLabel: "오늘" }],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
brandName: "Test",
|
|
149
|
+
defaultTitle: "Workspace",
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
it("renders the secondary label next to the item label", () => {
|
|
153
|
+
renderAt("/", { config: secondaryConfig });
|
|
154
|
+
const link = screen.getByRole("link", { name: /home/i });
|
|
155
|
+
expect(link.textContent).toContain("오늘");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("hides the secondary label when the sidebar is collapsed", () => {
|
|
159
|
+
window.localStorage.setItem("udb-collapsed-test", "1");
|
|
160
|
+
render(
|
|
161
|
+
<MemoryRouter initialEntries={["/"]}>
|
|
162
|
+
<Routes>
|
|
163
|
+
<Route
|
|
164
|
+
path="*"
|
|
165
|
+
element={
|
|
166
|
+
<DashboardLayout config={secondaryConfig} labels={labels} collapsedStorageKey="udb-collapsed-test" />
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
<Route path="*" element={<div>outlet-content</div>} />
|
|
170
|
+
</Route>
|
|
171
|
+
</Routes>
|
|
172
|
+
</MemoryRouter>
|
|
173
|
+
);
|
|
174
|
+
const link = screen.getByRole("link", { name: /home/i });
|
|
175
|
+
expect(link.textContent).not.toContain("오늘");
|
|
176
|
+
window.localStorage.removeItem("udb-collapsed-test");
|
|
177
|
+
});
|
|
143
178
|
});
|
|
@@ -136,6 +136,10 @@ export const DashboardSidebar = ({
|
|
|
136
136
|
<item.icon className="udb-sidebar__item-icon" />
|
|
137
137
|
{!collapsed && <span>{item.label}</span>}
|
|
138
138
|
|
|
139
|
+
{!collapsed && item.secondaryLabel && (
|
|
140
|
+
<span className="udb-sidebar__item-secondary">{item.secondaryLabel}</span>
|
|
141
|
+
)}
|
|
142
|
+
|
|
139
143
|
{!collapsed && item.badge !== undefined && item.badge !== "" && (
|
|
140
144
|
<span className="udb-sidebar__item-badge">{item.badge}</span>
|
|
141
145
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DashboardLayoutLabels } from '../types/layout';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* English shell labels — the reference text for `DashboardLayout`.
|
|
5
|
+
* Hosts rendering English pass this constant instead of re-declaring the
|
|
6
|
+
* thirteen strings; localized hosts build their own object from the same
|
|
7
|
+
* shape.
|
|
8
|
+
*/
|
|
9
|
+
export const defaultLayoutLabels: DashboardLayoutLabels = {
|
|
10
|
+
skipToContent: 'Skip to content',
|
|
11
|
+
navigation: 'Navigation',
|
|
12
|
+
searchResults: 'Search results',
|
|
13
|
+
header: {
|
|
14
|
+
switchToLight: 'Switch to light',
|
|
15
|
+
switchToDark: 'Switch to dark',
|
|
16
|
+
notificationsTitle: 'Notifications',
|
|
17
|
+
markAllRead: 'Mark all read',
|
|
18
|
+
dismissNotification: 'Dismiss',
|
|
19
|
+
noNotifications: 'No notifications',
|
|
20
|
+
profile: 'Profile',
|
|
21
|
+
settings: 'Settings',
|
|
22
|
+
logout: 'Log out',
|
|
23
|
+
guestName: 'Guest',
|
|
24
|
+
},
|
|
25
|
+
sidebar: { system: 'System' },
|
|
26
|
+
};
|
|
@@ -57,7 +57,8 @@ export interface HeaderSearchAction {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export interface CommandPaletteConfig {
|
|
60
|
-
groups
|
|
60
|
+
/** Static entry groups; palettes driven purely by `search` may omit them. */
|
|
61
|
+
groups?: import("@umituz/web-design-system/organisms").CommandGroup[];
|
|
61
62
|
placeholder?: string;
|
|
62
63
|
emptyLabel?: string;
|
|
63
64
|
label?: string;
|
package/src/styles/chrome.css
CHANGED
|
@@ -458,12 +458,20 @@
|
|
|
458
458
|
z-index: 50;
|
|
459
459
|
animation: udb-pop 0.18s ease;
|
|
460
460
|
}
|
|
461
|
-
/* Radix-portal variant: positioning/animation come from the dropdown primitive. */
|
|
462
461
|
.udb-menu--pop {
|
|
463
462
|
top: auto;
|
|
464
463
|
right: auto;
|
|
465
464
|
animation: none;
|
|
466
465
|
}
|
|
466
|
+
.udb-sidebar__item-secondary {
|
|
467
|
+
margin-left: auto;
|
|
468
|
+
font-size: 11px;
|
|
469
|
+
font-weight: var(--font-weight-normal);
|
|
470
|
+
color: var(--udb-sidebar-muted);
|
|
471
|
+
}
|
|
472
|
+
.udb-sidebar__item-secondary + .udb-sidebar__item-badge {
|
|
473
|
+
margin-left: var(--udb-space-2);
|
|
474
|
+
}
|
|
467
475
|
.udb-sidebar__item-badge {
|
|
468
476
|
margin-left: auto;
|
|
469
477
|
padding: 1px var(--udb-space-2);
|
|
@@ -529,8 +537,6 @@
|
|
|
529
537
|
color: var(--color-muted-foreground);
|
|
530
538
|
font-size: var(--udb-font-size-sm);
|
|
531
539
|
}
|
|
532
|
-
|
|
533
|
-
/* — Skip link: first focusable element, visible only when focused — */
|
|
534
540
|
.udb-skip-link {
|
|
535
541
|
position: fixed;
|
|
536
542
|
top: var(--udb-space-2);
|
|
@@ -549,12 +555,9 @@
|
|
|
549
555
|
.udb-skip-link:focus {
|
|
550
556
|
transform: translateY(0);
|
|
551
557
|
}
|
|
552
|
-
/* Programmatic focus (skip target) shows no ring — the jump itself is the cue. */
|
|
553
558
|
.udb-layout__content:focus {
|
|
554
559
|
outline: none;
|
|
555
560
|
}
|
|
556
|
-
|
|
557
|
-
/* Scroll lock applied to <html> while the mobile drawer is open. */
|
|
558
561
|
.udb-scroll-lock {
|
|
559
562
|
overflow: hidden;
|
|
560
563
|
}
|