@umituz/web-dashboard 10.0.0 → 10.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.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/src/domains/calendar/utils/index.ts +0 -3
  3. package/src/domains/layouts/components/DashboardLayout.test.tsx +37 -0
  4. package/src/domains/layouts/components/DashboardSidebar.tsx +19 -11
  5. package/src/domains/layouts/components/FilterPanel.tsx +0 -3
  6. package/src/domains/layouts/components/TabNav.tsx +0 -2
  7. package/src/domains/layouts/components/labels.ts +0 -5
  8. package/src/domains/layouts/types/layout.ts +0 -1
  9. package/src/domains/notifications/NotificationsContext.tsx +0 -5
  10. package/src/domains/notifications/components/NotificationCenter.tsx +0 -6
  11. package/src/domains/notifications/components/NotificationItem.tsx +0 -2
  12. package/src/domains/notifications/components/NotificationsPage.tsx +0 -3
  13. package/src/domains/notifications/time.ts +0 -2
  14. package/src/domains/notifications/types.ts +0 -6
  15. package/src/domains/onboarding/components/screens/OrganizationDetailsScreen.tsx +0 -1
  16. package/src/domains/onboarding/types/screens.ts +0 -1
  17. package/src/domains/onboarding/validation/validation.test.ts +2 -4
  18. package/src/domains/organization/OrganizationContext.tsx +0 -4
  19. package/src/domains/organization/components/OrganizationCard.tsx +0 -1
  20. package/src/domains/organization/components/OrganizationMembersPanel.tsx +0 -5
  21. package/src/domains/organization/components/OrganizationSwitcher.tsx +0 -5
  22. package/src/domains/organization/types.ts +0 -28
  23. package/src/domains/organization/vocab.ts +0 -12
  24. package/src/domains/permissions/PermissionsContext.tsx +0 -14
  25. package/src/domains/settings/components/UserManagementTable.tsx +0 -6
  26. package/src/domains/tour/tour.css +0 -3
  27. package/src/domains/tour/tourEngine.ts +0 -15
  28. package/src/domains/tour/types.ts +1 -41
  29. package/src/styles/chrome.css +0 -8
  30. package/src/styles/dashboard.contract.test.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-dashboard",
3
- "version": "10.0.0",
3
+ "version": "10.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",
@@ -4,9 +4,6 @@ export { mapCalendarDocument, mapPostDocument } from './contentItemMapper';
4
4
  export * from './layout';
5
5
  export type { FirestoreDocument } from './contentItemMapper';
6
6
 
7
- /** Always seven consecutive days starting at the week anchor — the tuple
8
- * type states that guarantee, so index access stays `Date` (not
9
- * `Date | undefined`) under consumer `noUncheckedIndexedAccess`. */
10
7
  export function getWeekDates(
11
8
  date: Date,
12
9
  startOfWeek: number = 0,
@@ -221,6 +221,43 @@ describe("DashboardSidebar (untitled group)", () => {
221
221
  });
222
222
  });
223
223
 
224
+ describe("DashboardSidebar (exclusive accordion)", () => {
225
+ const accordionConfig: DashboardLayoutConfig = {
226
+ sidebarGroups: [
227
+ {
228
+ title: "Alpha",
229
+ items: [{ path: "/alpha", label: "Alpha page", icon: Home, end: false }],
230
+ },
231
+ {
232
+ title: "Beta",
233
+ items: [{ path: "/beta", label: "Beta page", icon: Home, end: false }],
234
+ },
235
+ ],
236
+ brandName: "Test",
237
+ defaultTitle: "Workspace",
238
+ };
239
+
240
+ it("opens only the group containing the active route", () => {
241
+ renderAt("/alpha", { config: accordionConfig });
242
+ expect(screen.getByRole("link", { name: /alpha page/i })).toBeTruthy();
243
+ expect(screen.queryByRole("link", { name: /beta page/i })).toBeNull();
244
+ });
245
+
246
+ it("switches to the clicked group and closes the previous one", () => {
247
+ renderAt("/alpha", { config: accordionConfig });
248
+ fireEvent.click(screen.getByRole("button", { name: /beta/i }));
249
+ expect(screen.getByRole("link", { name: /beta page/i })).toBeTruthy();
250
+ expect(screen.queryByRole("link", { name: /alpha page/i })).toBeNull();
251
+ });
252
+
253
+ it("closes the open group on a second click", () => {
254
+ renderAt("/alpha", { config: accordionConfig });
255
+ const alpha = screen.getByRole("button", { name: /alpha/i });
256
+ fireEvent.click(alpha);
257
+ expect(screen.queryByRole("link", { name: /alpha page/i })).toBeNull();
258
+ });
259
+ });
260
+
224
261
  describe("DashboardLayout (contentFallback)", () => {
225
262
  const NeverResolves = lazy(() => new Promise<{ default: React.ComponentType }>(() => {}));
226
263
 
@@ -1,4 +1,4 @@
1
- import { useState, type ReactNode } from "react";
1
+ import { useEffect, useState, type ReactNode } from "react";
2
2
  import { Link, useLocation } from "react-router";
3
3
 
4
4
  import { Button } from "@umituz/web-design-system/atoms";
@@ -33,13 +33,21 @@ export const DashboardSidebar = ({
33
33
  user,
34
34
  }: DashboardSidebarPropsExtended) => {
35
35
  const location = useLocation();
36
- const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
36
+ const activeGroupTitle = () =>
37
+ sidebarGroups.find(group =>
38
+ group.items.some(item => isPathActive(location.pathname, item.path, item.end))
39
+ )?.title ?? null;
40
+ const [openGroup, setOpenGroup] = useState<string | null>(activeGroupTitle);
41
+
42
+ useEffect(() => {
43
+ setOpenGroup(prev => {
44
+ const next = activeGroupTitle();
45
+ return next === null ? prev : next;
46
+ });
47
+ }, [location.pathname]);
37
48
 
38
49
  const toggleGroup = (title: string) => {
39
- setCollapsedGroups(prev => ({
40
- ...prev,
41
- [title]: !prev[title]
42
- }));
50
+ setOpenGroup(prev => (prev === title ? null : title));
43
51
  };
44
52
 
45
53
  const renderAction = (label: string, icon: ReactNode, linkProps?: { to: string }) => {
@@ -95,7 +103,7 @@ export const DashboardSidebar = ({
95
103
 
96
104
  const groupTitle = group.title;
97
105
  const groupKey = groupTitle ?? `group-${groupIndex}`;
98
- const isGroupCollapsed = groupTitle !== undefined && collapsedGroups[groupTitle];
106
+ const isGroupOpen = groupTitle !== undefined && openGroup === groupTitle;
99
107
 
100
108
  return (
101
109
  <div key={groupKey} className="udb-sidebar__group">
@@ -110,10 +118,10 @@ export const DashboardSidebar = ({
110
118
  </span>
111
119
 
112
120
  <span className="udb-sidebar__group-chevron">
113
- {isGroupCollapsed ? (
114
- <ChevronRight className="udb-sidebar__chevron-icon" />
115
- ) : (
121
+ {isGroupOpen ? (
116
122
  <ChevronDown className="udb-sidebar__chevron-icon" />
123
+ ) : (
124
+ <ChevronRight className="udb-sidebar__chevron-icon" />
117
125
  )}
118
126
  </span>
119
127
 
@@ -121,7 +129,7 @@ export const DashboardSidebar = ({
121
129
 
122
130
  )}
123
131
 
124
- {(!isGroupCollapsed || collapsed) && filteredItems.map((item) => {
132
+ {(groupTitle === undefined || isGroupOpen || collapsed) && filteredItems.map((item) => {
125
133
  const active = isPathActive(location.pathname, item.path, item.end);
126
134
  const collapsedTitle =
127
135
  item.badge !== undefined && item.badge !== ""
@@ -10,7 +10,6 @@ export interface FilterPanelProps {
10
10
  className?: string;
11
11
  }
12
12
 
13
- /** Sidebar container for a set of filter sections. */
14
13
  export function FilterPanel({
15
14
  title = 'Filters',
16
15
  onClear,
@@ -58,7 +57,6 @@ export interface CheckFilterListProps {
58
57
  options: readonly FilterListOption[];
59
58
  selected: readonly string[];
60
59
  onToggle: (value: string) => void;
61
- /** Limit visible options; hidden-but-selected ones stay visible with a "+N more" note. */
62
60
  maxVisible?: number;
63
61
  }
64
62
 
@@ -103,7 +101,6 @@ export interface SingleSelectFilterListProps {
103
101
  onChange: (value: string | null) => void;
104
102
  }
105
103
 
106
- /** Radio-style list where one option (or none) is active. */
107
104
  export function SingleSelectFilterList({ options, value, onChange }: SingleSelectFilterListProps) {
108
105
  return (
109
106
  <ul className="udb-check-filter" role="group">
@@ -3,7 +3,6 @@ import { NavLink } from 'react-router';
3
3
  export interface TabNavItem {
4
4
  to: string;
5
5
  label: string;
6
- /** Should the route match only exactly (e.g. the index tab). */
7
6
  end?: boolean;
8
7
  }
9
8
 
@@ -12,7 +11,6 @@ export interface TabNavProps {
12
11
  className?: string;
13
12
  }
14
13
 
15
- /** Route-connected section tabs with an active underline. */
16
14
  export function TabNav({ items, className }: TabNavProps) {
17
15
  return (
18
16
  <nav className={className !== undefined ? `udb-tabnav ${className}` : 'udb-tabnav'} aria-label="Section tabs">
@@ -1,10 +1,5 @@
1
1
  import type { DashboardLayoutLabels } from '../types/layout';
2
2
 
3
- /**
4
- * English shell labels — the reference text for `DashboardLayout`.
5
- * Hosts rendering English pass this constant instead of re-declaring the
6
- * strings; localized hosts build their own object from the same shape.
7
- */
8
3
  export const defaultLayoutLabels: DashboardLayoutLabels = {
9
4
  skipToContent: 'Skip to content',
10
5
  navigation: 'Navigation',
@@ -63,7 +63,6 @@ export interface HeaderSearchAction {
63
63
  }
64
64
 
65
65
  export interface CommandPaletteConfig {
66
- /** Static entry groups; palettes driven purely by `search` may omit them. */
67
66
  groups?: import("@umituz/web-design-system/organisms").CommandGroup[];
68
67
  placeholder?: string;
69
68
  emptyLabel?: string;
@@ -13,9 +13,7 @@ export interface NotificationsContextValue {
13
13
  }
14
14
 
15
15
  export interface NotificationsProviderProps {
16
- /** The host's current feed — a new array reference re-seeds the local copy. */
17
16
  notifications: readonly NotificationRecord[];
18
- /** False while the host is still fetching; pages can render their own loading row. */
19
17
  loaded?: boolean;
20
18
  onMarkAllRead?: () => void;
21
19
  onMarkRead?: (id: string) => void;
@@ -25,7 +23,6 @@ export interface NotificationsProviderProps {
25
23
 
26
24
  const NotificationsContext = createContext<NotificationsContextValue | null>(null);
27
25
 
28
- /** Shared feed state so the header bell and the page stay in sync. */
29
26
  export function NotificationsProvider({
30
27
  notifications,
31
28
  loaded = true,
@@ -34,8 +31,6 @@ export function NotificationsProvider({
34
31
  onDismiss,
35
32
  children,
36
33
  }: NotificationsProviderProps) {
37
- // Optimistic local copy: reads/dismisses land instantly while the host
38
- // persists through the callbacks; a fresh array from the host re-seeds it.
39
34
  const [items, setItems] = useState<NotificationRecord[]>(() => [...notifications]);
40
35
 
41
36
  useEffect(() => {
@@ -14,9 +14,7 @@ export interface NotificationCenterLabels extends NotificationListLabels {
14
14
  title: string;
15
15
  markAllLabel: string;
16
16
  viewAllLabel: string;
17
- /** "{n} more" hint under a truncated popover list. */
18
17
  morePattern: string;
19
- /** "{n} unread" — the bell's accessible name when the badge has a count. */
20
18
  bellPattern: string;
21
19
  }
22
20
 
@@ -35,18 +33,14 @@ const DEFAULT_LABELS: NotificationCenterLabels = {
35
33
  };
36
34
 
37
35
  export interface NotificationCenterProps {
38
- /** `popover` anchors under the bell; `drawer` opens the design-system Drawer. */
39
36
  variant?: "popover" | "drawer";
40
- /** Rows shown before the popover truncates into the "more" hint. */
41
37
  itemLimit?: number;
42
- /** Page path for the "View all" link; omit to hide the footer link. */
43
38
  viewAllTo?: string;
44
39
  typeMeta?: NotificationTypeMeta;
45
40
  timeFormatter?: (iso: string) => string;
46
41
  labels?: Partial<NotificationCenterLabels>;
47
42
  }
48
43
 
49
- /** Header bell + unread badge + feed surface; reads the NotificationsProvider. */
50
44
  export const NotificationCenter = ({
51
45
  variant = "popover",
52
46
  itemLimit = 8,
@@ -28,12 +28,10 @@ export interface NotificationItemProps {
28
28
  typeMeta?: NotificationTypeMeta;
29
29
  onMarkRead?: (id: string) => void;
30
30
  onDismiss?: (id: string) => void;
31
- /** Overrides the relative-time renderer; defaults to `timeAgo`. */
32
31
  timeFormatter?: (iso: string) => string;
33
32
  labels?: Partial<NotificationItemLabels>;
34
33
  }
35
34
 
36
- /** One feed row; navigates when the record carries a link and marks read on the way. */
37
35
  export const NotificationItem = ({
38
36
  notification,
39
37
  typeMeta,
@@ -40,9 +40,7 @@ const DEFAULT_LABELS: NotificationsPageLabels = {
40
40
  };
41
41
 
42
42
  export interface NotificationsPageProps {
43
- /** Adds one segment per type; types with zero records stay hidden. */
44
43
  typeMeta?: NotificationTypeMeta;
45
- /** When set, adds a segment for warning/danger records (e.g. "Needs attention"). */
46
44
  attentionLabel?: string;
47
45
  timeFormatter?: (iso: string) => string;
48
46
  labels?: Partial<NotificationsPageLabels>;
@@ -50,7 +48,6 @@ export interface NotificationsPageProps {
50
48
 
51
49
  const needsAttention = (severity: string): boolean => severity === "warning" || severity === "danger";
52
50
 
53
- /** Full-page feed skeleton: filter segments, mark-all-read, and the shared list. */
54
51
  export const NotificationsPage = ({ typeMeta, attentionLabel, timeFormatter, labels }: NotificationsPageProps) => {
55
52
  const text = { ...DEFAULT_LABELS, ...labels };
56
53
  const { notifications, unreadCount, loaded, markAllAsRead, markRead, dismiss, canDismiss } =
@@ -20,7 +20,6 @@ export const DEFAULT_TIME_AGO_LABELS: TimeAgoLabels = {
20
20
 
21
21
  const fill = (pattern: string, value: number): string => pattern.replace("{n}", String(value));
22
22
 
23
- /** Relative time for feeds; beyond a week it falls back to the locale date. */
24
23
  export function timeAgo(
25
24
  iso: string,
26
25
  labels: Partial<TimeAgoLabels> = {},
@@ -37,7 +36,6 @@ export function timeAgo(
37
36
  return new Date(time).toLocaleDateString();
38
37
  }
39
38
 
40
- /** The feed tables stamp whichever column they have; `at` wins over `createdAt`. */
41
39
  export function timestampOf(record: NotificationRecord): string | undefined {
42
40
  return record.at ?? record.createdAt;
43
41
  }
@@ -1,32 +1,26 @@
1
1
  import type { LucideIcon } from "lucide-react";
2
2
 
3
- /** Severity buckets the fleet converges on; hosts writing `critical` get `danger`. */
4
3
  export type NotificationSeverity = "info" | "success" | "warning" | "danger";
5
4
 
6
5
  export type NotificationSeverityInput = NotificationSeverity | "critical";
7
6
 
8
7
  export interface NotificationRecord {
9
8
  id: string;
10
- /** Domain-specific kind — drives the page segments and row icons through typeMeta. */
11
9
  type: string;
12
10
  title?: string;
13
11
  body?: string;
14
12
  read?: boolean;
15
- /** Either timestamp column is accepted; `at` wins when both are present. */
16
13
  at?: string;
17
14
  createdAt?: string;
18
15
  severity?: NotificationSeverityInput;
19
- /** Router path — rows navigate (and mark read) when present. */
20
16
  link?: string;
21
17
  }
22
18
 
23
19
  export interface NotificationTypeMetaEntry {
24
- /** Segment label on the page; also the row fallback when a record has no title. */
25
20
  label: string;
26
21
  icon?: LucideIcon;
27
22
  }
28
23
 
29
- /** Optional per-type registry; segments hide types with zero matching records. */
30
24
  export type NotificationTypeMeta = Record<string, NotificationTypeMetaEntry>;
31
25
 
32
26
  export interface NotificationItemLabels {
@@ -11,7 +11,6 @@ import type {
11
11
  export interface OrganizationDetailsScreenProps {
12
12
  config: OrganizationDetailsScreenConfig;
13
13
  onNext: (data: OrganizationDetailsData) => void;
14
- /** Previously collected answer, restored when the user navigates back. */
15
14
  initial?: OrganizationDetailsData;
16
15
  }
17
16
 
@@ -140,7 +140,6 @@ export interface OrganizationDetailsData {
140
140
 
141
141
  export type OrganizationDetailsScreenConfig = BaseScreen<'organization-details', OrganizationDetailsData> & {
142
142
  namePlaceholder?: string;
143
- /** Omit to skip the team-size question; otherwise ids map to host labels. */
144
143
  teamSizeOptions?: ReadonlyArray<OnboardingOption>;
145
144
  };
146
145
 
@@ -40,10 +40,8 @@ describe('flow-structure-check (§23.1)', () => {
40
40
 
41
41
  describe('screen-config-check (§23.2)', () => {
42
42
  it('rejects malformed screens', () => {
43
- // @ts-expect-error deliberately malformed input
44
- expect(checkScreenConfig(null).ok).toBe(false);
45
- // @ts-expect-error deliberately malformed input
46
- expect(checkScreenConfig({ type: 'welcome' }).ok).toBe(false);
43
+ expect(checkScreenConfig(null as unknown as OnboardingScreen).ok).toBe(false);
44
+ expect(checkScreenConfig({ type: 'welcome' } as unknown as OnboardingScreen).ok).toBe(false);
47
45
  expect(checkScreenConfig({ id: '', type: 'welcome' } as OnboardingScreen).ok).toBe(false);
48
46
  expect(
49
47
  checkScreenConfig({ id: 'x', type: 'unknown' } as unknown as OnboardingScreen).ok,
@@ -9,13 +9,9 @@ import type {
9
9
 
10
10
  export interface OrganizationProviderProps {
11
11
  organization: OrganizationRecord;
12
- /** Omit when membership lives outside this provider's scope. */
13
12
  members?: readonly OrgMember[];
14
- /** Resolves `currentMember` from the member list by id. */
15
13
  currentUserId?: string;
16
- /** Optional permission bridge; without it `can` always resolves false. */
17
14
  permissions?: OrganizationPermissionBridge;
18
- /** Multi-organization support: pass the full org list to enable switching. */
19
15
  organizations?: readonly OrganizationRecord[];
20
16
  activeOrganizationId?: string;
21
17
  onSwitchOrganization?: (organizationId: string) => void;
@@ -13,7 +13,6 @@ export interface OrganizationCardLabels {
13
13
  export interface OrganizationCardProps {
14
14
  organization: OrganizationRecord;
15
15
  memberCount?: number;
16
- /** Shows the "invite your team" hint + CTA when memberCount is 1. */
17
16
  onInvite?: () => void;
18
17
  labels?: Partial<OrganizationCardLabels>;
19
18
  onClick?: () => void;
@@ -34,17 +34,12 @@ export interface OrganizationMembersPanelLabels {
34
34
  export interface OrganizationMembersPanelProps {
35
35
  members: readonly OrgMember[];
36
36
  roles: readonly RoleInfo[];
37
- /** Self rows are always locked; owner rows lock by default. */
38
37
  currentMemberId?: string;
39
- /** Outstanding invitations, rendered in their own section. */
40
38
  invitations?: readonly OrgInvitation[];
41
- /** Blocks the invite form once members reach the seat limit. */
42
39
  seatLimit?: number;
43
40
  onRoleChange?: (memberId: string, role: RoleKey) => void;
44
41
  onRemove?: (memberId: string) => void;
45
- /** Atomic backend transfer is the host's job; the old owner usually drops to admin. */
46
42
  onTransferOwnership?: (memberId: string) => void;
47
- /** Self-service exit; hide it for owners — the last owner cannot leave. */
48
43
  onLeave?: () => void;
49
44
  onInvite?: (input: OrgInviteInput) => void;
50
45
  onRevokeInvitation?: (invitationId: string) => void;
@@ -2,7 +2,6 @@ import { NativeSelect } from "@umituz/web-design-system/atoms";
2
2
  import type { OrganizationRecord } from "../types";
3
3
 
4
4
  export interface PersonalWorkspace {
5
- /** Stable id the host uses to scope data outside any organization. */
6
5
  id: string;
7
6
  label: string;
8
7
  }
@@ -12,10 +11,6 @@ export interface OrganizationSwitcherProps {
12
11
  activeOrganizationId?: string;
13
12
  onSwitch: (organizationId: string) => void;
14
13
  label?: string;
15
- /**
16
- * Side-by-side architecture (Clerk/GitHub style): the personal workspace
17
- * stays intact next to team organizations and leads the switcher.
18
- */
19
14
  personalWorkspace?: PersonalWorkspace;
20
15
  }
21
16
 
@@ -1,11 +1,5 @@
1
1
  import type { PermissionMatrix, RoleKey } from "../permissions/types";
2
2
 
3
- /**
4
- * Organization record — the tenant entity a signed-in user belongs to.
5
- * Field set follows the fleet consensus (id/name/legalName/plan/status +
6
- * locale trio); every field beyond id/name is optional so single-person
7
- * organizations and partially-provisioned tenants stay representable.
8
- */
9
3
  export interface OrganizationRecord {
10
4
  id: string;
11
5
  name: string;
@@ -18,21 +12,10 @@ export interface OrganizationRecord {
18
12
  timezone?: string;
19
13
  }
20
14
 
21
- /** Fleet-wide membership vocabulary (invite flow: invited -> active -> suspended). */
22
15
  export type MemberStatus = "invited" | "active" | "suspended";
23
16
 
24
- /**
25
- * Invitation lifecycle — the industry state machine
26
- * (pending -> accepted | revoked | expired | declined). Invitations are
27
- * first-class records, separate from memberships: they key on email, carry
28
- * an expiry, and can be revoked or resent while pending.
29
- */
30
17
  export type InvitationStatus = "pending" | "accepted" | "revoked" | "expired" | "declined";
31
18
 
32
- /**
33
- * An outstanding (or settled) invitation. The host owns the backend record
34
- * (token, redemption route); the panel renders and emits revoke/resend.
35
- */
36
19
  export interface OrgInvitation {
37
20
  id: string;
38
21
  email: string;
@@ -44,13 +27,6 @@ export interface OrgInvitation {
44
27
  expiresAt?: string;
45
28
  }
46
29
 
47
- /**
48
- * A member row as the organization module consumes it. `role` is a RoleKey
49
- * resolved against the host's RoleInfo list; owners carry `isOwner` so UIs
50
- * can protect the last owner from removal/role changes. By convention `id`
51
- * is the member's user id — pre-acceptance people belong in `OrgInvitation`,
52
- * not here.
53
- */
54
30
  export interface OrgMember {
55
31
  id: string;
56
32
  name: string;
@@ -61,19 +37,15 @@ export interface OrgMember {
61
37
  joinedAt?: string;
62
38
  }
63
39
 
64
- /** Payload handed to the host when InviteForm validates. */
65
40
  export interface OrgInviteInput {
66
41
  name?: string;
67
42
  email: string;
68
43
  role: RoleKey;
69
44
  }
70
45
 
71
- /** Permission bridge — ties membership role to a 7.6.0 permission matrix. */
72
46
  export interface OrganizationPermissionBridge {
73
47
  matrix: PermissionMatrix;
74
- /** Defaults to the current member's role when omitted. */
75
48
  role?: RoleKey;
76
- /** Extra grant/revoke applied on top of the matrix (visora-style overrides). */
77
49
  overrides?: {
78
50
  grant?: readonly string[];
79
51
  revoke?: readonly string[];
@@ -1,10 +1,6 @@
1
1
  import { statusVocab, type StatusVocab } from "@umituz/web-design-system/organisms";
2
2
  import type { InvitationStatus, MemberStatus } from "./types";
3
3
 
4
- /**
5
- * Up to two leading initials from a display name ("Northwind Labs" -> "NL",
6
- * "madeline" -> "M"). Used wherever an avatar block needs stable letters.
7
- */
8
4
  export const initialsOf = (name: string): string =>
9
5
  name
10
6
  .trim()
@@ -26,10 +22,6 @@ const MEMBER_STATUS_TONES: Record<MemberStatus, "info" | "success" | "warning">
26
22
  suspended: "warning",
27
23
  };
28
24
 
29
- /**
30
- * Status vocab for membership rows — label overrides merge over the
31
- * fleet-wide defaults (invited/active/suspended).
32
- */
33
25
  export const memberStatusVocab = (
34
26
  labelOverrides?: Partial<Record<MemberStatus, string>>,
35
27
  ): StatusVocab =>
@@ -57,10 +49,6 @@ const INVITATION_STATUS_TONES: Record<
57
49
  declined: "neutral",
58
50
  };
59
51
 
60
- /**
61
- * Status vocab for invitation rows — label overrides merge over the
62
- * industry lifecycle defaults (pending/accepted/revoked/expired/declined).
63
- */
64
52
  export const invitationStatusVocab = (
65
53
  labelOverrides?: Partial<Record<InvitationStatus, string>>,
66
54
  ): StatusVocab =>
@@ -108,14 +108,6 @@ export const Can = ({
108
108
  return allowed ? <>{children}</> : <>{fallback}</>;
109
109
  };
110
110
 
111
- /**
112
- * Convenience hook that checks whether the current user has a specific permission.
113
- *
114
- * Example:
115
- * ```tsx
116
- * const canCreateProject = usePermission("projects.create");
117
- * ```
118
- */
119
111
  export const usePermission = (permission: Permission): boolean => {
120
112
  const { can } = usePermissions();
121
113
  return can(permission);
@@ -130,12 +122,6 @@ export interface ProtectedRouteProps {
130
122
  accessDeniedProps?: AccessDeniedProps;
131
123
  }
132
124
 
133
- /**
134
- * Route-level permission guard. If the user lacks the permission:
135
- * - Renders `fallback` if provided
136
- * - Redirects to `redirectTo` if provided
137
- * - Otherwise displays `<AccessDenied {...accessDeniedProps} />`
138
- */
139
125
  export const ProtectedRoute = ({
140
126
  permission,
141
127
  anyOf,
@@ -9,7 +9,6 @@ export interface ManagedUser {
9
9
  email: string;
10
10
  role: RoleKey;
11
11
  status?: string;
12
- /** Owner rows are shielded from removal/role changes when `isRowLocked` is not overridden. */
13
12
  isOwner?: boolean;
14
13
  }
15
14
 
@@ -20,7 +19,6 @@ export interface UserManagementTableLabels {
20
19
  empty: string;
21
20
  statusColumn?: string;
22
21
  actionsColumn?: string;
23
- /** @deprecated use actionsColumn — the column now hosts every row action. */
24
22
  removeColumn?: string;
25
23
  removeLabel?: string;
26
24
  }
@@ -30,13 +28,9 @@ export interface UserManagementTableProps {
30
28
  roles: RoleInfo[];
31
29
  labels: UserManagementTableLabels;
32
30
  onRoleChange?: (userId: string, role: RoleKey) => void;
33
- /** Renders a status column with badges when provided. */
34
31
  statusVocab?: StatusVocab;
35
- /** Renders a remove action column when provided; guarded rows stay hidden. */
36
32
  onRemove?: (userId: string) => void;
37
- /** Extra row-level actions (e.g. "Make owner"), rendered before Remove. */
38
33
  rowActions?: (user: ManagedUser) => ReactNode;
39
- /** Rows that must never be removed or role-changed; defaults to owner rows. */
40
34
  isRowLocked?: (user: ManagedUser) => boolean;
41
35
  }
42
36
 
@@ -1,8 +1,5 @@
1
1
  @import "driver.js/dist/driver.css";
2
2
 
3
- /* ==========================================================================
4
- Driver.js Popover Styling — Design System Token Integration
5
- ========================================================================== */
6
3
 
7
4
  .driver-popover {
8
5
  background-color: var(--color-surface, #ffffff);
@@ -9,9 +9,6 @@ function getStorageKey(tourId: string, userId?: string): string {
9
9
  return userId ? `${STORAGE_PREFIX}${userId}_${tourId}` : `${STORAGE_PREFIX}${tourId}`;
10
10
  }
11
11
 
12
- /**
13
- * Checks whether a given tour has been completed or dismissed by the user.
14
- */
15
12
  export function isTourCompleted(tourId: string, userId?: string): boolean {
16
13
  const key = getStorageKey(tourId, userId);
17
14
  if (typeof window === "undefined" || !window.localStorage) {
@@ -24,9 +21,6 @@ export function isTourCompleted(tourId: string, userId?: string): boolean {
24
21
  }
25
22
  }
26
23
 
27
- /**
28
- * Marks a tour as completed in localStorage (with in-memory fallback).
29
- */
30
24
  export function markTourCompleted(tourId: string, userId?: string): void {
31
25
  const key = getStorageKey(tourId, userId);
32
26
  memoryTourStore.set(key, "completed");
@@ -34,13 +28,9 @@ export function markTourCompleted(tourId: string, userId?: string): void {
34
28
  try {
35
29
  window.localStorage.setItem(key, "completed");
36
30
  } catch {
37
- // ignore storage errors
38
31
  }
39
32
  }
40
33
 
41
- /**
42
- * Resets the tour completion state so it can be re-run.
43
- */
44
34
  export function resetTourCompletion(tourId: string, userId?: string): void {
45
35
  const key = getStorageKey(tourId, userId);
46
36
  memoryTourStore.delete(key);
@@ -48,15 +38,11 @@ export function resetTourCompletion(tourId: string, userId?: string): void {
48
38
  try {
49
39
  window.localStorage.removeItem(key);
50
40
  } catch {
51
- // ignore storage errors
52
41
  }
53
42
  }
54
43
 
55
44
  let activeDriverInstance: Driver | null = null;
56
45
 
57
- /**
58
- * Instantiates and returns a TourEngineInstance wrapping driver.js.
59
- */
60
46
  export function createProductTour(config: TourConfig): TourEngineInstance {
61
47
  const {
62
48
  tourId,
@@ -152,7 +138,6 @@ export function createProductTour(config: TourConfig): TourEngineInstance {
152
138
  try {
153
139
  activeDriverInstance.destroy();
154
140
  } catch {
155
- // ignore
156
141
  }
157
142
  }
158
143
  activeDriverInstance = driverObj;
@@ -2,30 +2,11 @@ export type TourPlacement = "top" | "right" | "bottom" | "left" | "center";
2
2
  export type TourAlign = "start" | "center" | "end";
3
3
 
4
4
  export interface TourStep {
5
- /**
6
- * DOM selector to attach popover to (e.g. `[data-tour="search-bar"]` or `header`).
7
- * When omitted or set to `'body'`, the step centers as a modal.
8
- */
9
5
  target?: string;
10
- /**
11
- * Step title displayed in bold in the popover header.
12
- */
13
6
  title: string;
14
- /**
15
- * Step description or HTML body.
16
- */
17
7
  description: string;
18
- /**
19
- * Optional placement side. Defaults to `'center'` if target is omitted, otherwise auto/bottom.
20
- */
21
8
  placement?: TourPlacement;
22
- /**
23
- * Alignment along the side (start, center, end).
24
- */
25
9
  align?: TourAlign;
26
- /**
27
- * Optional small badge text displayed before the title (e.g. "New", "Step 1").
28
- */
29
10
  badge?: string;
30
11
  }
31
12
 
@@ -34,18 +15,12 @@ export interface TourLabels {
34
15
  prev?: string;
35
16
  done?: string;
36
17
  skip?: string;
37
- progress?: string; // e.g. "{{current}} / {{total}}"
18
+ progress?: string;
38
19
  }
39
20
 
40
21
  export interface TourConfig {
41
22
  tourId: string;
42
- /**
43
- * Optional user ID to isolate completion status per user on the same client.
44
- */
45
23
  userId?: string;
46
- /**
47
- * Optional external completion flag (e.g. from backend/database).
48
- */
49
24
  isCompleted?: boolean;
50
25
  steps: TourStep[];
51
26
  labels?: TourLabels;
@@ -71,25 +46,10 @@ export interface TourEngineInstance {
71
46
  }
72
47
 
73
48
  export interface UseProductTourOptions extends Omit<TourConfig, "onComplete" | "onSkip" | "onStepChange"> {
74
- /**
75
- * If true, starts the tour automatically on mount when not yet completed.
76
- */
77
49
  autoStart?: boolean;
78
- /**
79
- * Delay in milliseconds before auto-starting the tour (default: 600ms).
80
- */
81
50
  autoStartDelayMs?: number;
82
- /**
83
- * Optional callback when completed.
84
- */
85
51
  onComplete?: () => void;
86
- /**
87
- * Optional callback when skipped/closed.
88
- */
89
52
  onSkip?: () => void;
90
- /**
91
- * Optional callback when step changes.
92
- */
93
53
  onStepChange?: (index: number, step: TourStep) => void;
94
54
  }
95
55
 
@@ -2446,7 +2446,6 @@
2446
2446
  font-size: var(--udb-font-size-sm);
2447
2447
  }
2448
2448
 
2449
- /* ------------------------------------------------------------- tab nav */
2450
2449
 
2451
2450
  .udb-tabnav {
2452
2451
  display: flex;
@@ -2484,7 +2483,6 @@
2484
2483
  background: var(--color-primary);
2485
2484
  }
2486
2485
 
2487
- /* --------------------------------------------------------- filter panel */
2488
2486
 
2489
2487
  .udb-filter-panel {
2490
2488
  background: var(--color-card);
@@ -2538,7 +2536,6 @@
2538
2536
  gap: var(--udb-space-2);
2539
2537
  }
2540
2538
 
2541
- /* --------------------------------------------------------- check list */
2542
2539
 
2543
2540
  .udb-check-filter {
2544
2541
  list-style: none;
@@ -2617,9 +2614,6 @@
2617
2614
  color: var(--color-muted-foreground);
2618
2615
  }
2619
2616
 
2620
- /* ------------------------------------------------------------------ */
2621
- /* Notifications (udb-notif-*) */
2622
- /* ------------------------------------------------------------------ */
2623
2617
  .udb-notif-list {
2624
2618
  list-style: none;
2625
2619
  margin: 0;
@@ -2715,7 +2709,6 @@
2715
2709
  flex: none;
2716
2710
  }
2717
2711
 
2718
- /* Bell + popover */
2719
2712
  .udb-notif-center {
2720
2713
  position: relative;
2721
2714
  }
@@ -2804,7 +2797,6 @@
2804
2797
  text-decoration: underline;
2805
2798
  }
2806
2799
 
2807
- /* Page skeleton */
2808
2800
  .udb-notif-page {
2809
2801
  display: flex;
2810
2802
  flex-direction: column;
@@ -1,4 +1,3 @@
1
- // @vitest-environment node
2
1
  import { readFileSync } from "node:fs";
3
2
  import { describe, expect, it } from "vitest";
4
3