@umituz/web-dashboard 6.11.0 → 7.0.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.
Files changed (92) hide show
  1. package/package.json +2 -3
  2. package/src/domains/analytics/components/AnalyticsCard.tsx +11 -0
  3. package/src/domains/analytics/components/AnalyticsChart.tsx +24 -5
  4. package/src/domains/analytics/components/AnalyticsLayout.tsx +26 -26
  5. package/src/domains/analytics/components/MetricCard.tsx +2 -5
  6. package/src/domains/analytics/hooks/useAnalytics.ts +1 -7
  7. package/src/domains/analytics/index.ts +0 -1
  8. package/src/domains/analytics/types/analytics.ts +11 -0
  9. package/src/domains/analytics/utils/analytics.ts +2 -115
  10. package/src/domains/analytics/utils/index.ts +0 -1
  11. package/src/domains/calendar/services/CalendarService.ts +2 -25
  12. package/src/domains/charts/components.test.tsx +1 -0
  13. package/src/domains/charts/components.tsx +65 -0
  14. package/src/domains/layouts/components/BrandLogo.tsx +1 -0
  15. package/src/domains/layouts/components/DashboardHeader.tsx +56 -20
  16. package/src/domains/layouts/components/DashboardLayout.test.tsx +39 -21
  17. package/src/domains/layouts/components/DashboardLayout.tsx +21 -25
  18. package/src/domains/layouts/components/DashboardSidebar.tsx +33 -32
  19. package/src/domains/layouts/components/FilterBar.test.tsx +3 -0
  20. package/src/domains/layouts/components/FilterBar.tsx +5 -9
  21. package/src/domains/layouts/components/FilterSelect.test.tsx +28 -0
  22. package/src/domains/layouts/components/FilterSelect.tsx +47 -0
  23. package/src/domains/layouts/components/PageHeader.test.tsx +3 -0
  24. package/src/domains/layouts/components/PageHeader.tsx +11 -2
  25. package/src/domains/layouts/components/SectionHeader.tsx +7 -4
  26. package/src/domains/layouts/components/index.ts +2 -0
  27. package/src/domains/layouts/hooks/dashboard.ts +4 -7
  28. package/src/domains/layouts/types/index.ts +12 -1
  29. package/src/domains/layouts/types/layout.ts +72 -63
  30. package/src/domains/layouts/types/sidebar.ts +0 -8
  31. package/src/domains/layouts/utils/dashboard.test.ts +2 -2
  32. package/src/domains/layouts/utils/dashboard.ts +15 -11
  33. package/src/domains/layouts/utils/index.ts +2 -1
  34. package/src/domains/modules/build.test.tsx +4 -0
  35. package/src/domains/modules/build.tsx +1 -0
  36. package/src/domains/onboarding/calc/slider-value-bounds.ts +1 -1
  37. package/src/domains/onboarding/components/AnimationWrapper.tsx +3 -0
  38. package/src/domains/onboarding/components/OnboardingErrorBoundary.tsx +6 -0
  39. package/src/domains/onboarding/components/OnboardingFlow.test.tsx +48 -27
  40. package/src/domains/onboarding/components/OnboardingFlow.tsx +10 -2
  41. package/src/domains/onboarding/components/OnboardingIntl.tsx +7 -65
  42. package/src/domains/onboarding/components/PrimaryButton.tsx +3 -0
  43. package/src/domains/onboarding/components/ProgressBar.tsx +5 -1
  44. package/src/domains/onboarding/components/QuestionWrapper.tsx +5 -0
  45. package/src/domains/onboarding/components/ScreenContainer.tsx +4 -0
  46. package/src/domains/onboarding/components/SwipeCard.test.tsx +43 -1
  47. package/src/domains/onboarding/components/SwipeCard.tsx +7 -0
  48. package/src/domains/onboarding/components/screens/AccountGateScreen.tsx +7 -0
  49. package/src/domains/onboarding/components/screens/AppDemoScreen.tsx +4 -0
  50. package/src/domains/onboarding/components/screens/ComparisonScreen.tsx +9 -0
  51. package/src/domains/onboarding/components/screens/GoalQuestionScreen.tsx +3 -0
  52. package/src/domains/onboarding/components/screens/PainPointsScreen.tsx +3 -0
  53. package/src/domains/onboarding/components/screens/PaywallScreen.tsx +17 -0
  54. package/src/domains/onboarding/components/screens/PermissionPrimingScreen.tsx +10 -0
  55. package/src/domains/onboarding/components/screens/PersonalizedSolutionScreen.tsx +9 -0
  56. package/src/domains/onboarding/components/screens/PreferencesScreen.tsx +15 -0
  57. package/src/domains/onboarding/components/screens/ProcessingScreen.tsx +8 -0
  58. package/src/domains/onboarding/components/screens/SocialProofScreen.tsx +17 -0
  59. package/src/domains/onboarding/components/screens/TinderCardsScreen.tsx +12 -0
  60. package/src/domains/onboarding/components/screens/ValueDeliveryScreen.tsx +9 -0
  61. package/src/domains/onboarding/components/screens/WelcomeScreen.tsx +7 -0
  62. package/src/domains/onboarding/hooks/useOnboardingProgress.test.tsx +4 -5
  63. package/src/domains/onboarding/index.ts +0 -12
  64. package/src/domains/onboarding/predicates/predicates.test.ts +1 -1
  65. package/src/domains/onboarding/types/config.ts +1 -1
  66. package/src/domains/onboarding/types/labels.ts +1 -0
  67. package/src/domains/onboarding/utils/analytics-dispatch.ts +2 -2
  68. package/src/domains/onboarding/utils/local-storage-bridge.ts +1 -1
  69. package/src/domains/onboarding/validation/validation.test.ts +2 -2
  70. package/src/domains/permissions/PermissionsContext.tsx +6 -18
  71. package/src/domains/permissions/index.ts +0 -1
  72. package/src/domains/search/searchItems.test.ts +1 -1
  73. package/src/domains/search/searchItems.ts +0 -3
  74. package/src/domains/settings/components/AuditLogList.tsx +14 -7
  75. package/src/domains/settings/components/PermissionMatrixScreen.tsx +10 -0
  76. package/src/domains/settings/components/SettingsLayout.tsx +20 -3
  77. package/src/domains/settings/components/SettingsSection.tsx +12 -6
  78. package/src/domains/settings/components/UserManagementTable.tsx +16 -9
  79. package/src/domains/settings/types/settings.ts +7 -1
  80. package/src/domains/settings/utils/index.ts +0 -1
  81. package/src/domains/timing/hooks/useCountdown.test.ts +1 -2
  82. package/src/domains/timing/hooks/useCountdown.ts +0 -4
  83. package/src/internal/formatPattern.ts +8 -0
  84. package/src/domains/analytics/utils/i18nKeys.ts +0 -31
  85. package/src/domains/onboarding/templates/TemplateDemoFallback.tsx +0 -92
  86. package/src/domains/onboarding/templates/art-onboarding.ts +0 -71
  87. package/src/domains/onboarding/templates/health-onboarding.ts +0 -92
  88. package/src/domains/onboarding/templates/index.ts +0 -6
  89. package/src/domains/onboarding/templates/platform-onboarding.ts +0 -201
  90. package/src/domains/onboarding/templates/video-onboarding.ts +0 -95
  91. package/src/domains/permissions/utils/i18nKeys.ts +0 -6
  92. package/src/domains/settings/utils/i18nKeys.ts +0 -12
@@ -3,7 +3,26 @@ 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 type { DashboardLayoutConfig } from "../types/layout";
6
+ import type { DashboardLayoutConfig, DashboardLayoutLabels } from "../types/layout";
7
+
8
+ const labels: DashboardLayoutLabels = {
9
+ skipToContent: "Skip to content",
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
+ };
7
26
 
8
27
  const config: DashboardLayoutConfig = {
9
28
  sidebarGroups: [
@@ -16,15 +35,16 @@ const config: DashboardLayoutConfig = {
16
35
  defaultTitle: "Workspace",
17
36
  };
18
37
 
19
- function renderAt(path: string, mainId?: string, configOverride?: DashboardLayoutConfig) {
38
+ function renderAt(path: string, overrides: { config?: DashboardLayoutConfig; mainId?: string } = {}) {
39
+ const { config: cfg = config, mainId } = overrides;
20
40
  return render(
21
41
  <MemoryRouter initialEntries={[path]}>
22
42
  <Routes>
23
43
  <Route
24
44
  path="*"
25
45
  element={
26
- <DashboardLayout config={configOverride ?? config} mainId={mainId}>
27
- {/* children are ignored — the layout renders an Outlet */}
46
+ <DashboardLayout config={cfg} labels={labels} mainId={mainId}>
47
+ {}
28
48
  </DashboardLayout>
29
49
  }
30
50
  >
@@ -44,7 +64,7 @@ describe("DashboardLayout (shell a11y)", () => {
44
64
  });
45
65
 
46
66
  it("honours a custom mainId on both the link and the landmark", () => {
47
- renderAt("/", "main-content");
67
+ renderAt("/", { mainId: "main-content" });
48
68
  expect(screen.getByRole("link", { name: /skip to content/i }).getAttribute("href")).toBe("#main-content");
49
69
  expect(document.getElementById("main-content")).not.toBeNull();
50
70
  });
@@ -67,14 +87,14 @@ describe("DashboardLayout (command palette)", () => {
67
87
  });
68
88
 
69
89
  it("renders the palette's search button in the header and opens it on click", async () => {
70
- renderAt("/", undefined, paletteConfig());
90
+ renderAt("/", { config: paletteConfig() });
71
91
  fireEvent.click(screen.getByRole("button", { name: /search commands/i }));
72
92
  expect(await screen.findByRole("dialog")).toBeTruthy();
73
93
  expect(await screen.findByRole("option", { name: "Home" })).toBeTruthy();
74
94
  });
75
95
 
76
96
  it("toggles the palette with ⌘K / Ctrl+K", async () => {
77
- renderAt("/", undefined, paletteConfig());
97
+ renderAt("/", { config: paletteConfig() });
78
98
  expect(screen.queryByRole("dialog")).toBeNull();
79
99
  fireEvent.keyDown(window, { key: "k", metaKey: true });
80
100
  expect(await screen.findByRole("dialog")).toBeTruthy();
@@ -83,42 +103,40 @@ describe("DashboardLayout (command palette)", () => {
83
103
  });
84
104
 
85
105
  it("does not bind the shortcut when shortcut: false", () => {
86
- renderAt("/", undefined, {
87
- ...config,
88
- commandPalette: { groups: [], shortcut: false },
89
- });
106
+ renderAt("/", { config: { ...config, commandPalette: { groups: [], shortcut: false } } });
90
107
  fireEvent.keyDown(window, { key: "k", ctrlKey: true });
91
108
  expect(screen.queryByRole("dialog")).toBeNull();
92
109
  });
93
110
 
94
111
  it("keeps an explicit searchAction.onActivate over the palette takeover", () => {
95
112
  const onActivate = vi.fn();
96
- renderAt("/", undefined, paletteConfig({ searchAction: { placeholder: "Go search", onActivate } }));
113
+ renderAt("/", { config: paletteConfig({ searchAction: { placeholder: "Go search", onActivate } }) });
97
114
  fireEvent.click(screen.getByRole("button", { name: /go search/i }));
98
115
  expect(onActivate).toHaveBeenCalledTimes(1);
99
116
  expect(screen.queryByRole("dialog")).toBeNull();
100
117
  });
101
118
 
102
119
  it("derives navigation groups from the sidebar when includeSidebar is set", async () => {
103
- renderAt("/", undefined, {
104
- ...config,
105
- commandPalette: {
106
- includeSidebar: true,
107
- groups: [{ heading: "Quick", items: [{ id: "q", label: "Quick action", onSelect: () => {} }] }],
120
+ renderAt("/", {
121
+ config: {
122
+ ...config,
123
+ commandPalette: {
124
+ includeSidebar: true,
125
+ groups: [{ heading: "Quick", items: [{ id: "q", label: "Quick action", onSelect: () => {} }] }],
126
+ },
108
127
  },
109
128
  });
110
129
  fireEvent.keyDown(window, { key: "k", metaKey: true });
111
130
  expect(await screen.findByRole("option", { name: "Quick action" })).toBeTruthy();
112
- // The custom group has no "Home" — the one present is derived from the sidebar,
113
- // carrying the path as its hint (accessible name "Home /").
131
+
114
132
  const derived = screen.getByRole("option", { name: /home/i });
115
133
  expect(derived.textContent).toContain("/");
116
134
  });
117
135
 
118
136
  it("omits sidebar-derived items from the palette by default", async () => {
119
- renderAt("/", undefined, paletteConfig());
137
+ renderAt("/", { config: paletteConfig() });
120
138
  fireEvent.keyDown(window, { key: "k", metaKey: true });
121
- // Only the palette's own "Home" (no path hint) — nothing derived from the sidebar.
139
+
122
140
  const own = await screen.findByRole("option", { name: "Home" });
123
141
  expect(own.textContent).toBe("Home");
124
142
  });
@@ -1,17 +1,17 @@
1
1
  import { useState, useEffect, useRef, type ReactNode } from "react";
2
2
  import { useLocation, useNavigate, Outlet, Navigate } from "react-router";
3
- import { useT } from "@umituz/web-localization/react";
4
3
  import { Skeleton } from "@umituz/web-design-system/atoms";
5
4
  import { CommandPalette, type CommandGroup, type CommandItem } from "@umituz/web-design-system/organisms";
6
5
  import { DashboardSidebar } from "./DashboardSidebar";
7
6
  import { DashboardHeader } from "./DashboardHeader";
8
7
  import { getActiveSidebarItem } from "../utils/dashboard";
9
- import type { DashboardLayoutConfig } from "../types/layout";
8
+ import type { DashboardLayoutConfig, DashboardLayoutLabels } from "../types/layout";
10
9
  import type { DashboardNotification } from "../types/notification";
11
10
  import type { DashboardUser } from "../types/user";
12
11
 
13
12
  interface DashboardLayoutProps {
14
13
  config: DashboardLayoutConfig;
14
+ labels: DashboardLayoutLabels;
15
15
  user?: DashboardUser;
16
16
  authLoading?: boolean;
17
17
  isAuthenticated?: boolean;
@@ -23,14 +23,10 @@ interface DashboardLayoutProps {
23
23
  theme?: "light" | "dark";
24
24
  onToggleTheme?: () => void;
25
25
  routeTransitionMs?: number;
26
- /** Persists the sidebar collapse state under this localStorage key ('1'/'0'). */
27
26
  collapsedStorageKey?: string;
28
- /** Optional page footer rendered under the outlet column. */
29
27
  footer?: ReactNode;
30
- /** id of the main landmark — also the skip-link target. */
31
28
  mainId?: string;
32
- /** Skip-link label (a11y); defaults to the localized "Skip to content". */
33
- skipToContentLabel?: string;
29
+ formatNotificationTime?: (createdAt: Date | string | number) => string;
34
30
  }
35
31
 
36
32
  const readCollapsed = (key?: string): boolean => {
@@ -44,6 +40,7 @@ const readCollapsed = (key?: string): boolean => {
44
40
 
45
41
  export const DashboardLayout = ({
46
42
  config,
43
+ labels,
47
44
  user,
48
45
  authLoading = false,
49
46
  isAuthenticated = true,
@@ -58,11 +55,10 @@ export const DashboardLayout = ({
58
55
  collapsedStorageKey,
59
56
  footer,
60
57
  mainId = "udb-main",
61
- skipToContentLabel,
58
+ formatNotificationTime,
62
59
  }: DashboardLayoutProps) => {
63
60
  const location = useLocation();
64
61
  const navigate = useNavigate();
65
- const t = useT();
66
62
  const [collapsed, setCollapsed] = useState(() => readCollapsed(collapsedStorageKey));
67
63
  const [mobileOpen, setMobileOpen] = useState(false);
68
64
  const [loading, setLoading] = useState(routeTransitionMs > 0);
@@ -78,7 +74,6 @@ export const DashboardLayout = ({
78
74
  try {
79
75
  window.localStorage.setItem(collapsedStorageKey, collapsed ? "1" : "0");
80
76
  } catch {
81
- /* storage unavailable — state stays in-memory only */
82
77
  }
83
78
  }, [collapsed, collapsedStorageKey]);
84
79
 
@@ -153,22 +148,15 @@ export const DashboardLayout = ({
153
148
 
154
149
  const activeItem = getActiveSidebarItem(location.pathname, config.sidebarGroups);
155
150
 
156
- const getTitle = () => {
157
- if (activeItem) return activeItem.raw ? activeItem.label : t(activeItem.label);
158
- const extraTitle = config.extraTitleMap?.[location.pathname];
159
- if (extraTitle) return t(extraTitle);
160
- return config.defaultTitle ?? "Dashboard";
161
- };
162
-
163
- const currentTitle = getTitle();
151
+ const currentTitle =
152
+ (activeItem?.label ?? config.extraTitleMap?.[location.pathname] ?? config.defaultTitle) || "";
164
153
 
165
154
  const searchGroup: CommandGroup | null =
166
155
  paletteSearch && searchItems.length > 0
167
- ? { heading: palette?.searchResultsHeading ?? t("Search results"), items: searchItems }
156
+ ? { heading: palette?.searchResultsHeading ?? labels.searchResults, items: searchItems }
168
157
  : null;
169
158
  const basePaletteGroups = searchGroup ? [searchGroup, ...(palette?.groups ?? [])] : (palette?.groups ?? []);
170
159
 
171
- // Sidebar-derived navigation groups — one nav definition feeds both chrome surfaces.
172
160
  const paletteGroups = palette?.includeSidebar
173
161
  ? [
174
162
  ...basePaletteGroups,
@@ -176,7 +164,7 @@ export const DashboardLayout = ({
176
164
  heading: group.title,
177
165
  items: group.items.map((item) => ({
178
166
  id: `nav-${item.path}`,
179
- label: item.raw ? item.label : t(item.label),
167
+ label: item.label,
180
168
  icon: <item.icon size={16} aria-hidden="true" />,
181
169
  hint: item.path,
182
170
  onSelect: () => navigate(item.path),
@@ -193,12 +181,13 @@ export const DashboardLayout = ({
193
181
  sidebarAction: config.sidebarAction,
194
182
  sidebarFooter: config.sidebarFooter,
195
183
  user,
184
+ labels: config.sidebarLabels ?? labels.sidebar,
196
185
  };
197
186
 
198
187
  return (
199
188
  <div className="udb-root udb-layout">
200
189
  <a href={`#${mainId}`} className="udb-skip-link">
201
- {skipToContentLabel ?? t("Skip to content")}
190
+ {labels.skipToContent}
202
191
  </a>
203
192
 
204
193
  <aside
@@ -218,7 +207,7 @@ export const DashboardLayout = ({
218
207
  className="udb-layout__mobile-sidebar"
219
208
  role="dialog"
220
209
  aria-modal="true"
221
- aria-label={config.brandName ? `${config.brandName} — ${t("Navigation")}` : t("Navigation")}
210
+ aria-label={config.brandName ? `${config.brandName} — ${labels.navigation}` : labels.navigation}
222
211
  >
223
212
  <DashboardSidebar
224
213
  collapsed={false}
@@ -226,7 +215,9 @@ export const DashboardLayout = ({
226
215
  {...sidebarProps}
227
216
  />
228
217
  </aside>
218
+
229
219
  </div>
220
+
230
221
  )}
231
222
 
232
223
  <div className="udb-layout__main">
@@ -235,6 +226,7 @@ export const DashboardLayout = ({
235
226
  setCollapsed={setCollapsed}
236
227
  setMobileOpen={setMobileOpen}
237
228
  title={currentTitle}
229
+ labels={labels.header}
238
230
  theme={theme}
239
231
  onToggleTheme={onToggleTheme}
240
232
  user={user}
@@ -243,10 +235,10 @@ export const DashboardLayout = ({
243
235
  onMarkAllRead={onMarkAllRead}
244
236
  onDismissNotification={onDismissNotification}
245
237
  loginRoute={loginRoute}
238
+ formatNotificationTime={formatNotificationTime}
246
239
  searchAction={
247
240
  palette
248
- ? // The palette owns the header search unless the app gave an explicit action.
249
- { placeholder: palette.placeholder, shortcut: "⌘K", ...config.searchAction, onActivate: config.searchAction?.onActivate ?? (() => setPaletteOpen(true)) }
241
+ ? { placeholder: palette.placeholder, shortcut: "⌘K", ...config.searchAction, onActivate: config.searchAction?.onActivate ?? (() => setPaletteOpen(true)) }
250
242
  : config.searchAction
251
243
  }
252
244
  headerExtra={config.headerExtra}
@@ -264,14 +256,17 @@ export const DashboardLayout = ({
264
256
  <Skeleton key={i} className="udb-skeleton--card" />
265
257
  ))}
266
258
  </div>
259
+
267
260
  <Skeleton className="udb-skeleton--section" />
268
261
  </div>
262
+
269
263
  ) : (
270
264
  <Outlet />
271
265
  )}
272
266
  </main>
273
267
 
274
268
  {footer && <footer className="udb-layout__footer">{footer}</footer>}
269
+
275
270
  </div>
276
271
 
277
272
  {palette && (
@@ -286,6 +281,7 @@ export const DashboardLayout = ({
286
281
  />
287
282
  )}
288
283
  </div>
284
+
289
285
  );
290
286
  };
291
287
 
@@ -1,12 +1,11 @@
1
1
  import { useState, type ReactNode } from "react";
2
2
  import { Link, useLocation } from "react-router";
3
- import { useT } from "@umituz/web-localization/react";
4
3
 
5
4
  import { Button } from "@umituz/web-design-system/atoms";
6
5
  import { cn } from "@umituz/web-design-system/utils/cn";
7
6
  import { BrandLogo } from "./BrandLogo";
8
7
  import { isPathActive } from "../utils/dashboard";
9
- import { PenTool, Menu, ChevronLeft, ChevronDown, ChevronRight } from "lucide-react";
8
+ import { Menu, ChevronLeft, ChevronDown, ChevronRight } from "lucide-react";
10
9
  import type { DashboardSidebarProps, SidebarAction } from "../types/layout";
11
10
  import type { DashboardUser } from "../types/user";
12
11
  import type { SidebarGroup } from "../types/sidebar";
@@ -16,14 +15,9 @@ interface DashboardSidebarPropsExtended extends DashboardSidebarProps {
16
15
  sidebarGroups: SidebarGroup[];
17
16
  brandName?: string;
18
17
  brandTagline?: string;
19
- /** Custom brand mark — replaces the built-in logo (text block still follows brandName). */
20
18
  brand?: ReactNode;
21
- /** Generic primary action — replaces the legacy create-post button. */
22
19
  sidebarAction?: SidebarAction;
23
- /** Extra node above the collapse button in the footer (hidden while collapsed). */
24
20
  sidebarFooter?: ReactNode;
25
- createPostRoute?: string;
26
- showCreatePost?: boolean;
27
21
  user?: DashboardUser;
28
22
  }
29
23
 
@@ -31,17 +25,15 @@ export const DashboardSidebar = ({
31
25
  collapsed,
32
26
  setCollapsed,
33
27
  sidebarGroups,
34
- brandName = "App",
35
- brandTagline = "grow smarter",
28
+ brandName,
29
+ brandTagline,
36
30
  brand,
37
31
  sidebarAction,
38
32
  sidebarFooter,
39
- createPostRoute = "/dashboard/create",
40
- showCreatePost = true,
33
+ labels,
41
34
  user,
42
35
  }: DashboardSidebarPropsExtended) => {
43
36
  const location = useLocation();
44
- const t = useT();
45
37
  const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
46
38
 
47
39
  const toggleGroup = (title: string) => {
@@ -61,24 +53,30 @@ export const DashboardSidebar = ({
61
53
  >
62
54
  {icon}
63
55
  {!collapsed && <span className="udb-sidebar__create-label">{label}</span>}
56
+
64
57
  </Button>
58
+
65
59
  );
66
60
  return linkProps ? <Link to={linkProps.to}>{button}</Link> : button;
61
+
67
62
  };
68
63
 
69
64
  return (
70
65
  <div className={cn("udb-sidebar", collapsed && "udb-sidebar--collapsed")}>
71
66
  <div className="udb-sidebar__brand">
72
67
  {brand ?? <BrandLogo size={32} />}
73
- {!collapsed && brandName !== "" && (
68
+ {!collapsed && (brandName || brandTagline) && (
74
69
  <div className="udb-sidebar__brand-text">
75
- <span className="udb-sidebar__brand-name">{brandName || "App"}</span>
70
+ <span className="udb-sidebar__brand-name">{brandName}</span>
71
+
76
72
  <span className="udb-sidebar__brand-tagline">{brandTagline}</span>
73
+
77
74
  </div>
75
+
78
76
  )}
79
77
  </div>
80
78
 
81
- {sidebarAction ? (
79
+ {sidebarAction && (
82
80
  <div className="udb-sidebar__create">
83
81
  {renderAction(
84
82
  sidebarAction.label,
@@ -86,16 +84,7 @@ export const DashboardSidebar = ({
86
84
  sidebarAction.to ? { to: sidebarAction.to } : undefined
87
85
  )}
88
86
  </div>
89
- ) : (
90
- showCreatePost && createPostRoute && (
91
- <div className="udb-sidebar__create">
92
- {renderAction(
93
- t('sidebar.createPost'),
94
- <PenTool className="udb-sidebar__create-icon" />,
95
- { to: createPostRoute }
96
- )}
97
- </div>
98
- )
87
+
99
88
  )}
100
89
 
101
90
  <nav className="udb-sidebar__nav">
@@ -116,8 +105,9 @@ export const DashboardSidebar = ({
116
105
  className="udb-sidebar__group-toggle"
117
106
  >
118
107
  <span className="udb-sidebar__group-title">
119
- {t(group.title, { brand: brandName })}
108
+ {group.title}
120
109
  </span>
110
+
121
111
  <span className="udb-sidebar__group-chevron">
122
112
  {isGroupCollapsed ? (
123
113
  <ChevronRight className="udb-sidebar__chevron-icon" />
@@ -125,16 +115,17 @@ export const DashboardSidebar = ({
125
115
  <ChevronDown className="udb-sidebar__chevron-icon" />
126
116
  )}
127
117
  </span>
118
+
128
119
  </button>
120
+
129
121
  )}
130
122
 
131
123
  {(!isGroupCollapsed || collapsed) && filteredItems.map((item) => {
132
124
  const active = isPathActive(location.pathname, item.path, item.end);
133
- const labelText = item.raw ? item.label : t(item.label);
134
125
  const collapsedTitle =
135
126
  item.badge !== undefined && item.badge !== ""
136
- ? `${labelText} (${item.badge})`
137
- : labelText;
127
+ ? `${item.label} (${item.badge})`
128
+ : item.label;
138
129
  return (
139
130
  <Link
140
131
  key={item.path}
@@ -143,30 +134,40 @@ export const DashboardSidebar = ({
143
134
  title={collapsed ? collapsedTitle : undefined}
144
135
  >
145
136
  <item.icon className="udb-sidebar__item-icon" />
146
- {!collapsed && <span>{labelText}</span>}
137
+ {!collapsed && <span>{item.label}</span>}
138
+
147
139
  {!collapsed && item.badge !== undefined && item.badge !== "" && (
148
140
  <span className="udb-sidebar__item-badge">{item.badge}</span>
141
+
149
142
  )}
150
143
  </Link>
144
+
151
145
  );
152
146
  })}
153
147
  </div>
148
+
154
149
  );
155
150
  })}
156
151
  </div>
152
+
157
153
  </nav>
158
154
 
159
155
  <div className="udb-sidebar__footer">
160
156
  {sidebarFooter && <div className="udb-sidebar__footer-slot">{sidebarFooter}</div>}
161
- {!collapsed && (
157
+
158
+ {!collapsed && labels?.system && (
162
159
  <p className="udb-sidebar__footer-label">
163
- {t('sidebar.system')}
160
+ {labels.system}
164
161
  </p>
162
+
165
163
  )}
166
164
  <Button variant="ghost" size="icon" onClick={() => setCollapsed(!collapsed)} className="udb-sidebar__footer-btn">
167
165
  {collapsed ? <Menu className="udb-sidebar__footer-icon" /> : <ChevronLeft className="udb-sidebar__footer-icon" />}
168
166
  </Button>
167
+
169
168
  </div>
169
+
170
170
  </div>
171
+
171
172
  );
172
173
  };
@@ -8,9 +8,12 @@ describe("FilterBar", () => {
8
8
  <FilterBar
9
9
  search={{ value: "", onChange: () => {}, placeholder: "Find…" }}
10
10
  actions={<button type="button">Sort</button>}
11
+
11
12
  >
12
13
  <span>a chip</span>
14
+
13
15
  </FilterBar>
16
+
14
17
  );
15
18
  expect(html).toContain("udb-filter-bar");
16
19
  expect(html).toContain("udb-filter-bar__search");
@@ -1,8 +1,3 @@
1
- /**
2
- * FilterBar Component (Layout)
3
- * @description Horizontal filter strip: search box + chip row + trailing actions
4
- */
5
-
6
1
  import type { ReactNode } from "react";
7
2
  import { SearchBox } from "@umituz/web-design-system/molecules";
8
3
  import { cn } from "@umituz/web-design-system/utils/cn";
@@ -16,10 +11,8 @@ export interface FilterBarSearch {
16
11
 
17
12
  export interface FilterBarProps extends BaseProps {
18
13
  search?: FilterBarSearch;
19
- /** Chip row / selects — anything that filters the page content. */
20
- children?: ReactNode;
21
- /** Trailing controls (sort, primary buttons…). */
22
- actions?: ReactNode;
14
+ children?: ReactNode;
15
+ actions?: ReactNode;
23
16
  }
24
17
 
25
18
  export const FilterBar = ({ search, children, actions, className, ...props }: FilterBarProps) => {
@@ -34,8 +27,11 @@ export const FilterBar = ({ search, children, actions, className, ...props }: Fi
34
27
  />
35
28
  )}
36
29
  {children && <div className="udb-filter-bar__fields">{children}</div>}
30
+
37
31
  {actions && <div className="udb-filter-bar__actions">{actions}</div>}
32
+
38
33
  </div>
34
+
39
35
  );
40
36
  };
41
37
 
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { renderToString } from "react-dom/server";
3
+ import { FilterSelect } from "./FilterSelect";
4
+
5
+ describe("FilterSelect", () => {
6
+ const options = [
7
+ { value: "open", label: "Open" },
8
+ { value: "closed", label: "Closed" },
9
+ ];
10
+
11
+ it("renders the all-entry plus options and reports the chosen value", () => {
12
+ const chosen: string[] = [];
13
+ const html = renderToString(
14
+ <FilterSelect
15
+ value="open"
16
+ options={options}
17
+ ariaLabel="Filter by status"
18
+ allLabel="Any status"
19
+ onChange={(v) => chosen.push(v)}
20
+ />,
21
+ );
22
+ expect(html).toContain('aria-label="Filter by status"');
23
+ expect(html).toContain("Any status");
24
+ expect(html).toContain("Open");
25
+ expect(html).toContain("Closed");
26
+ expect(chosen).toEqual([]);
27
+ });
28
+ });
@@ -0,0 +1,47 @@
1
+ import type { SelectHTMLAttributes } from "react";
2
+
3
+ export interface FilterSelectOption {
4
+ value: string;
5
+ label: string;
6
+ }
7
+
8
+ export interface FilterSelectProps
9
+ extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "onChange" | "value" | "size"> {
10
+ value: string;
11
+ onChange: (value: string) => void;
12
+ options: readonly FilterSelectOption[];
13
+ ariaLabel: string;
14
+ allLabel: string;
15
+ }
16
+
17
+ export const FilterSelect = ({
18
+ value,
19
+ onChange,
20
+ options,
21
+ ariaLabel,
22
+ allLabel,
23
+ className,
24
+ ...props
25
+ }: FilterSelectProps) => {
26
+ return (
27
+ <select
28
+ aria-label={ariaLabel}
29
+ className={className ? `udb-filter-select ${className}` : "udb-filter-select"}
30
+ value={value}
31
+ onChange={(event) => onChange(event.target.value)}
32
+ {...props}
33
+ >
34
+ <option value="">{allLabel}</option>
35
+
36
+ {options.map((option) => (
37
+ <option key={option.value} value={option.value}>
38
+ {option.label}
39
+ </option>
40
+
41
+ ))}
42
+ </select>
43
+
44
+ );
45
+ };
46
+
47
+ FilterSelect.displayName = "FilterSelect";
@@ -24,7 +24,9 @@ describe('PageHeader markup smoke', () => {
24
24
  <PageHeader
25
25
  title="Claims"
26
26
  breadcrumbs={<a href="/policies">Policies</a>}
27
+
27
28
  actions={<button type="button">New claim</button>}
29
+
28
30
  />,
29
31
  );
30
32
  expect(html).toContain('udb-pageheader__breadcrumbs');
@@ -40,6 +42,7 @@ describe('PageHeader markup smoke', () => {
40
42
  breadcrumbs={[{ label: 'Policies', to: '/policies' }, { label: 'Claim 92' }]}
41
43
  />
42
44
  </MemoryRouter>,
45
+
43
46
  );
44
47
  expect(container.querySelectorAll("a[href='/policies']")).toHaveLength(1);
45
48
  expect(container.querySelector('.udb-pageheader__crumb a')?.textContent).toBe('Policies');
@@ -11,8 +11,7 @@ export interface PageHeaderProps {
11
11
  title?: ReactNode;
12
12
  subtitle?: ReactNode;
13
13
  description?: ReactNode;
14
- /** Small facts row (dates, counts, IDs…) under the title block. */
15
- meta?: ReactNode;
14
+ meta?: ReactNode;
16
15
  breadcrumbs?: ReactNode | readonly PageHeaderCrumb[];
17
16
  actions?: ReactNode;
18
17
  className?: string;
@@ -38,21 +37,31 @@ export const PageHeader = ({
38
37
  ? breadcrumbs.map((crumb, index) => (
39
38
  <span key={`${crumb.label}-${index}`} className="udb-pageheader__crumb">
40
39
  {crumb.to !== undefined ? <Link to={crumb.to}>{crumb.label}</Link> : crumb.label}
40
+
41
41
  </span>
42
+
42
43
  ))
43
44
  : breadcrumbs;
44
45
  return (
45
46
  <div className={`udb-pageheader${className ? ` ${className}` : ""}`}>
46
47
  {crumbNode !== undefined && <div className="udb-pageheader__breadcrumbs">{crumbNode}</div>}
48
+
47
49
  <div className="udb-pageheader__main">
48
50
  {kicker !== undefined && <p className="udb-pageheader__kicker">{kicker}</p>}
51
+
49
52
  {title !== undefined && <h1 className="udb-pageheader__title">{title}</h1>}
53
+
50
54
  {(subtitle ?? description) !== undefined && (
51
55
  <p className="udb-pageheader__subtitle">{subtitle ?? description}</p>
56
+
52
57
  )}
53
58
  {meta !== undefined && <div className="udb-pageheader__meta">{meta}</div>}
59
+
54
60
  </div>
61
+
55
62
  {actions !== undefined && <div className="udb-pageheader__actions">{actions}</div>}
63
+
56
64
  </div>
65
+
57
66
  );
58
67
  };