@umituz/web-dashboard 11.2.0 → 11.4.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": "11.2.0",
3
+ "version": "11.4.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",
@@ -217,7 +217,7 @@ describe("DashboardSidebar (untitled group)", () => {
217
217
  expect(screen.getByRole("link", { name: /home/i })).toBeTruthy();
218
218
  const toggles = document.querySelectorAll("button.udb-sidebar__group-toggle");
219
219
  expect(toggles.length).toBe(1);
220
- expect(toggles[0].textContent).toContain("Main");
220
+ expect(toggles[0]?.textContent).toContain("Main");
221
221
  });
222
222
  });
223
223
 
@@ -70,8 +70,8 @@ describe("buildNav", () => {
70
70
  "nav.commercial",
71
71
  "nav.insight",
72
72
  ]);
73
- expect(nav[0].items.map((item) => item.label)).toEqual(["nav.dashboard"]);
74
- expect(nav[2].items.map((item) => item.label)).toEqual(["nav.reports"]);
73
+ expect(nav[0]?.items.map((item) => item.label)).toEqual(["nav.dashboard"]);
74
+ expect(nav[2]?.items.map((item) => item.label)).toEqual(["nav.reports"]);
75
75
  });
76
76
 
77
77
  it("hides detail routes (inNav: false)", () => {
@@ -104,8 +104,8 @@ describe('slider-value-bounds (§22.4)', () => {
104
104
  try {
105
105
  expect(clampValueToBounds(50, 100, 10, 'mood')).toBe(50);
106
106
  expect(errorSpy).toHaveBeenCalledTimes(1);
107
- expect(errorSpy.mock.calls[0][0]).toContain('mood');
108
- expect(errorSpy.mock.calls[0][0]).toContain('min > max');
107
+ expect(errorSpy.mock.calls[0]?.[0]).toContain('mood');
108
+ expect(errorSpy.mock.calls[0]?.[0]).toContain('min > max');
109
109
  } finally {
110
110
  errorSpy.mockRestore();
111
111
  }
@@ -82,7 +82,7 @@ export function PreferencesScreen({ config, onNext }: PreferencesScreenProps) {
82
82
 
83
83
  interface PreferenceRowProps {
84
84
  item: PreferenceItem;
85
- value: PrefValue;
85
+ value: PrefValue | undefined;
86
86
  onChange: (value: PrefValue) => void;
87
87
  }
88
88
 
@@ -18,6 +18,10 @@ export function SocialProofScreen({ config, onNext }: SocialProofScreenProps) {
18
18
  const total = config.testimonials.length;
19
19
  const current = config.testimonials[index];
20
20
 
21
+ if (!current) {
22
+ return null;
23
+ }
24
+
21
25
  function go(delta: number) {
22
26
  setIndex((i) => (i + delta + total) % total);
23
27
  }
@@ -32,7 +32,10 @@ export function TinderCardsScreen({ config, onNext }: TinderCardsScreenProps) {
32
32
  const handleDecision = useCallback(
33
33
  (likedStatement: boolean) => {
34
34
  if (likedStatement) {
35
- setLiked((prev) => [...prev, config.statements[indexRef.current].id]);
35
+ const statement = config.statements[indexRef.current];
36
+ if (statement) {
37
+ setLiked((prev) => [...prev, statement.id]);
38
+ }
36
39
  }
37
40
  setIndex((i) => i + 1);
38
41
  },
@@ -93,5 +93,5 @@ export function doesIconNameResolve(name: string | undefined): boolean {
93
93
 
94
94
  export function resolveIconByName(name: string | undefined): LucideIcon | null {
95
95
  if (!doesIconNameResolve(name)) return null;
96
- return ICON_REGISTRY[name as string];
96
+ return ICON_REGISTRY[name as string] ?? null;
97
97
  }
@@ -26,7 +26,7 @@ describe('analytics-dispatch — the "never throws" contract', () => {
26
26
  const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
27
27
  expect(() => dispatchAnalyticsEvent(event, 'custom', undefined)).not.toThrow();
28
28
  expect(warn).toHaveBeenCalledTimes(1);
29
- expect(warn.mock.calls[0][0]).toContain('customTracker');
29
+ expect(warn.mock.calls[0]?.[0]).toContain('customTracker');
30
30
  });
31
31
 
32
32
  it('never throws when the custom tracker itself throws', () => {
@@ -36,7 +36,7 @@ describe('analytics-dispatch — the "never throws" contract', () => {
36
36
  };
37
37
  expect(() => dispatchAnalyticsEvent(event, 'custom', tracker)).not.toThrow();
38
38
  expect(error).toHaveBeenCalledTimes(1);
39
- expect(error.mock.calls[0][0]).toContain('dropped');
39
+ expect(error.mock.calls[0]?.[0]).toContain('dropped');
40
40
  });
41
41
 
42
42
  it('is a no-op without a provider', () => {
@@ -129,6 +129,11 @@ describe('ListPage', () => {
129
129
  expect(screen.queryByText('Lobby Camera')).toBeNull();
130
130
  });
131
131
 
132
+ it('renders the notice slot between header and toolbar', () => {
133
+ mount({ notice: <div role="alert">offline note</div> });
134
+ expect(screen.getByRole('alert').textContent).toBe('offline note');
135
+ });
136
+
132
137
  it('honours label overrides', () => {
133
138
  mount({
134
139
  search: { terms: (row) => row.name },
@@ -22,6 +22,7 @@ export function ListPage<T>({
22
22
  kicker,
23
23
  meta,
24
24
  actions,
25
+ notice,
25
26
  data,
26
27
  columns,
27
28
  search,
@@ -67,6 +68,8 @@ export function ListPage<T>({
67
68
  actions={actions}
68
69
  />
69
70
 
71
+ {notice}
72
+
70
73
  {hasToolbar && (
71
74
  <FilterBar
72
75
  search={
@@ -29,6 +29,7 @@ export interface ListPageProps<T> {
29
29
  kicker?: ReactNode;
30
30
  meta?: ReactNode;
31
31
  actions?: ReactNode;
32
+ notice?: ReactNode;
32
33
  data: readonly T[];
33
34
  columns: readonly Column<T>[];
34
35
  search?: ListPageSearchConfig<T>;
@@ -56,7 +56,7 @@ describe("dashboard stylesheet contract", () => {
56
56
  "utf8",
57
57
  );
58
58
  const dsDefined = new Set([...dsCss.matchAll(/(--[a-z][a-z0-9-]*)\s*:/g)].map((m) => m[1]));
59
- const read = new Set([...sheet.matchAll(/var\((--[a-z][a-z0-9-]*)[,)]/g)].map((m) => m[1]));
59
+ const read = new Set([...sheet.matchAll(/var\((--[a-z][a-z0-9-]*)[,)]/g)].map((m) => m[1] ?? ''));
60
60
  const missing = [...read].filter(
61
61
  (v) => !v.startsWith("--udb-") && !dsDefined.has(v) && !optional.has(v),
62
62
  );