@umituz/web-dashboard 6.10.0 → 6.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-dashboard",
3
- "version": "6.10.0",
3
+ "version": "6.11.0",
4
4
  "description": "Installable app skeleton for the fleet — layouts, analytics (dependency-free SVG charts), calendar, onboarding flow, i18n via @umituz/web-localization, permissions/module registry; udb-* stylesheet on design-system tokens",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -59,10 +59,10 @@
59
59
  "version:major": "npm version major -m 'chore: release v%s'"
60
60
  },
61
61
  "peerDependencies": {
62
+ "framer-motion": "^12.0.0",
62
63
  "react": "^18.0.0 || ^19.0.0",
63
64
  "react-dom": "^18.0.0 || ^19.0.0",
64
- "react-router-dom": "^6.0.0 || ^7.0.0",
65
- "framer-motion": "^12.0.0"
65
+ "react-router": "^6.0.0 || ^7.0.0"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "framer-motion": {
@@ -70,24 +70,24 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "@umituz/web-design-system": "^4.19.0",
74
- "lucide-react": "^0.577.0",
75
- "@umituz/web-localization": "^1.2.1"
73
+ "@umituz/web-localization": "^1.2.1",
74
+ "lucide-react": "^0.577.0"
76
75
  },
77
76
  "devDependencies": {
77
+ "@testing-library/dom": "^10.4.2",
78
+ "@testing-library/react": "^16.3.3",
78
79
  "@types/node": "^22.20.5",
79
80
  "@types/react": "^19.2.14",
80
81
  "@types/react-dom": "^19.2.3",
81
82
  "@typescript-eslint/eslint-plugin": "^8.57.2",
82
83
  "@typescript-eslint/parser": "^8.57.2",
84
+ "@umituz/web-design-system": "^4.21.0",
83
85
  "eslint": "^10.0.2",
84
86
  "framer-motion": "^12.23.12",
85
- "react-router-dom": "^7.13.1",
87
+ "jsdom": "^29.1.1",
88
+ "react-router": "^7.13.1",
86
89
  "typescript": "^5.9.3",
87
- "vitest": "^5.0.1",
88
- "@testing-library/dom": "^10.4.2",
89
- "@testing-library/react": "^16.3.3",
90
- "jsdom": "^29.1.1"
90
+ "vitest": "^5.0.1"
91
91
  },
92
92
  "keywords": [
93
93
  "dashboard",
@@ -8,7 +8,7 @@ import {
8
8
  DropdownMenu, DropdownMenuTrigger, DropdownMenuContent,
9
9
  DropdownMenuItem, DropdownMenuSeparator
10
10
  } from "@umituz/web-design-system/organisms";
11
- import { useNavigate } from "react-router-dom";
11
+ import { useNavigate } from "react-router";
12
12
  import { useT } from "@umituz/web-localization/react";
13
13
  import type { ReactNode } from "react";
14
14
  import type {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
2
  import { render, screen, fireEvent } from "@testing-library/react";
3
- import { MemoryRouter, Routes, Route } from "react-router-dom";
3
+ import { MemoryRouter, Routes, Route } from "react-router";
4
4
  import { Home } from "lucide-react";
5
5
  import { DashboardLayout } from "./DashboardLayout";
6
6
  import type { DashboardLayoutConfig } from "../types/layout";
@@ -1,8 +1,8 @@
1
- import { useState, useEffect, type ReactNode } from "react";
2
- import { useLocation, useNavigate, Outlet, Navigate } from "react-router-dom";
1
+ import { useState, useEffect, useRef, type ReactNode } from "react";
2
+ import { useLocation, useNavigate, Outlet, Navigate } from "react-router";
3
3
  import { useT } from "@umituz/web-localization/react";
4
4
  import { Skeleton } from "@umituz/web-design-system/atoms";
5
- import { CommandPalette } from "@umituz/web-design-system/organisms";
5
+ import { CommandPalette, type CommandGroup, type CommandItem } from "@umituz/web-design-system/organisms";
6
6
  import { DashboardSidebar } from "./DashboardSidebar";
7
7
  import { DashboardHeader } from "./DashboardHeader";
8
8
  import { getActiveSidebarItem } from "../utils/dashboard";
@@ -67,7 +67,11 @@ export const DashboardLayout = ({
67
67
  const [mobileOpen, setMobileOpen] = useState(false);
68
68
  const [loading, setLoading] = useState(routeTransitionMs > 0);
69
69
  const [paletteOpen, setPaletteOpen] = useState(false);
70
+ const [searchItems, setSearchItems] = useState<CommandItem[]>([]);
71
+ const searchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
72
+ const searchSeq = useRef(0);
70
73
  const palette = config.commandPalette;
74
+ const paletteSearch = palette?.search;
71
75
 
72
76
  useEffect(() => {
73
77
  if (!collapsedStorageKey || typeof window === "undefined") return;
@@ -113,6 +117,31 @@ export const DashboardLayout = ({
113
117
  return () => window.removeEventListener("keydown", onKeyDown);
114
118
  }, [mobileOpen]);
115
119
 
120
+ useEffect(
121
+ () => () => {
122
+ if (searchTimer.current) clearTimeout(searchTimer.current);
123
+ },
124
+ []
125
+ );
126
+
127
+ const handlePaletteQuery = (q: string) => {
128
+ if (searchTimer.current) clearTimeout(searchTimer.current);
129
+ const seq = ++searchSeq.current;
130
+ if (!paletteSearch || q.trim() === "") {
131
+ setSearchItems([]);
132
+ return;
133
+ }
134
+ searchTimer.current = setTimeout(() => {
135
+ paletteSearch(q)
136
+ .then((items) => {
137
+ if (seq === searchSeq.current) setSearchItems(items);
138
+ })
139
+ .catch(() => {
140
+ if (seq === searchSeq.current) setSearchItems([]);
141
+ });
142
+ }, 180);
143
+ };
144
+
116
145
  useEffect(() => {
117
146
  if (typeof document === "undefined") return;
118
147
  document.documentElement.classList.toggle("udb-scroll-lock", mobileOpen);
@@ -133,10 +162,16 @@ export const DashboardLayout = ({
133
162
 
134
163
  const currentTitle = getTitle();
135
164
 
165
+ const searchGroup: CommandGroup | null =
166
+ paletteSearch && searchItems.length > 0
167
+ ? { heading: palette?.searchResultsHeading ?? t("Search results"), items: searchItems }
168
+ : null;
169
+ const basePaletteGroups = searchGroup ? [searchGroup, ...(palette?.groups ?? [])] : (palette?.groups ?? []);
170
+
136
171
  // Sidebar-derived navigation groups — one nav definition feeds both chrome surfaces.
137
172
  const paletteGroups = palette?.includeSidebar
138
173
  ? [
139
- ...palette.groups,
174
+ ...basePaletteGroups,
140
175
  ...config.sidebarGroups.map((group) => ({
141
176
  heading: group.title,
142
177
  items: group.items.map((item) => ({
@@ -243,10 +278,11 @@ export const DashboardLayout = ({
243
278
  <CommandPalette
244
279
  open={paletteOpen}
245
280
  onOpenChange={setPaletteOpen}
246
- groups={paletteGroups ?? palette.groups}
281
+ groups={paletteGroups ?? basePaletteGroups}
247
282
  placeholder={palette.placeholder}
248
283
  emptyLabel={palette.emptyLabel}
249
284
  label={palette.label}
285
+ onQueryChange={paletteSearch ? handlePaletteQuery : undefined}
250
286
  />
251
287
  )}
252
288
  </div>
@@ -1,5 +1,5 @@
1
1
  import { useState, type ReactNode } from "react";
2
- import { Link, useLocation } from "react-router-dom";
2
+ import { Link, useLocation } from "react-router";
3
3
  import { useT } from "@umituz/web-localization/react";
4
4
 
5
5
  import { Button } from "@umituz/web-design-system/atoms";
@@ -1,5 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { renderToString } from 'react-dom/server';
3
+ import { render } from '@testing-library/react';
4
+ import { MemoryRouter } from 'react-router';
3
5
  import { PageHeader } from './PageHeader';
4
6
 
5
7
  describe('PageHeader markup smoke', () => {
@@ -30,6 +32,19 @@ describe('PageHeader markup smoke', () => {
30
32
  expect(html).toContain('New claim');
31
33
  });
32
34
 
35
+ it('renders crumb lists as in-app links', () => {
36
+ const { container } = render(
37
+ <MemoryRouter>
38
+ <PageHeader
39
+ title="Claim 92"
40
+ breadcrumbs={[{ label: 'Policies', to: '/policies' }, { label: 'Claim 92' }]}
41
+ />
42
+ </MemoryRouter>,
43
+ );
44
+ expect(container.querySelectorAll("a[href='/policies']")).toHaveLength(1);
45
+ expect(container.querySelector('.udb-pageheader__crumb a')?.textContent).toBe('Policies');
46
+ });
47
+
33
48
  it('renders meta under the title block and omits it when undefined', () => {
34
49
  const html = renderToString(
35
50
  <PageHeader title="Policy AC-123" meta={<span>Renews 2027-01-15</span>} />,
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import { Link } from "react-router";
2
3
 
3
4
  export interface PageHeaderCrumb {
4
5
  label: string;
@@ -36,7 +37,7 @@ export const PageHeader = ({
36
37
  : isCrumbList(breadcrumbs)
37
38
  ? breadcrumbs.map((crumb, index) => (
38
39
  <span key={`${crumb.label}-${index}`} className="udb-pageheader__crumb">
39
- {crumb.to !== undefined ? <a href={crumb.to}>{crumb.label}</a> : crumb.label}
40
+ {crumb.to !== undefined ? <Link to={crumb.to}>{crumb.label}</Link> : crumb.label}
40
41
  </span>
41
42
  ))
42
43
  : breadcrumbs;
@@ -45,6 +45,11 @@ export interface CommandPaletteConfig {
45
45
  /** Append the sidebar groups as navigation groups — derived from
46
46
  * sidebarGroups and routed internally, so apps never map their nav twice. */
47
47
  includeSidebar?: boolean;
48
+ /** Async search — typed queries are debounced and the results render as a
49
+ * dedicated group above the static ones (items carry their own onSelect). */
50
+ search?: (q: string) => Promise<import("@umituz/web-design-system/organisms").CommandItem[]>;
51
+ /** Heading for the async search result group. */
52
+ searchResultsHeading?: string;
48
53
  }
49
54
 
50
55
  export interface DashboardSidebarProps {
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import { Outlet, useLocation, useNavigate } from "react-router-dom";
2
+ import { Outlet, useLocation, useNavigate } from "react-router";
3
3
  import { Skeleton, Button } from "@umituz/web-design-system/atoms";
4
4
  import { ChevronLeft, Menu } from "lucide-react";
5
5
  import { SettingsSection } from "./SettingsSection";
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from "react";
2
- import { Link } from "react-router-dom";
2
+ import { Link } from "react-router";
3
3
  import { ChevronRight } from "lucide-react";
4
4
  import { cn } from "@umituz/web-design-system/utils/cn";
5
5
  import type { SettingsSection as SettingsSectionType } from "../types/settings";