@umituz/web-dashboard 11.12.0 → 11.14.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 (41) hide show
  1. package/package.json +17 -1
  2. package/src/domains/activity/activity.css +229 -0
  3. package/src/domains/activity/components/ActivityFeed.test.tsx +61 -0
  4. package/src/domains/activity/components/ActivityFeed.tsx +132 -0
  5. package/src/domains/activity/components/ActivityTimeline.tsx +127 -0
  6. package/src/domains/activity/components/index.ts +2 -0
  7. package/src/domains/activity/index.ts +3 -0
  8. package/src/domains/activity/types.ts +59 -0
  9. package/src/domains/activity/utils.ts +73 -0
  10. package/src/domains/admin/admin.css +187 -0
  11. package/src/domains/admin/components/AdminGate.test.tsx +44 -0
  12. package/src/domains/admin/components/AdminGate.tsx +41 -0
  13. package/src/domains/admin/components/AdminHealthCard.test.tsx +42 -0
  14. package/src/domains/admin/components/AdminHealthCard.tsx +108 -0
  15. package/src/domains/admin/components/AdminOverview.test.tsx +44 -0
  16. package/src/domains/admin/components/AdminOverview.tsx +133 -0
  17. package/src/domains/admin/components/AdminShell.test.tsx +59 -0
  18. package/src/domains/admin/components/AdminShell.tsx +80 -0
  19. package/src/domains/admin/components/AdminUsersTable.test.tsx +79 -0
  20. package/src/domains/admin/components/AdminUsersTable.tsx +239 -0
  21. package/src/domains/admin/components/index.ts +5 -0
  22. package/src/domains/admin/index.ts +2 -0
  23. package/src/domains/admin/types.ts +66 -0
  24. package/src/domains/filters/components/DataToolbar.test.tsx +65 -0
  25. package/src/domains/filters/components/DataToolbar.tsx +119 -0
  26. package/src/domains/filters/components/index.ts +1 -0
  27. package/src/domains/filters/filters.css +128 -0
  28. package/src/domains/filters/index.ts +2 -0
  29. package/src/domains/filters/types.ts +48 -0
  30. package/src/domains/pages/components/DetailPage.test.tsx +96 -0
  31. package/src/domains/pages/components/DetailPage.tsx +227 -0
  32. package/src/domains/pages/components/index.ts +1 -0
  33. package/src/domains/pages/types.ts +60 -0
  34. package/src/domains/stepper/components/Stepper.test.tsx +71 -0
  35. package/src/domains/stepper/components/Stepper.tsx +79 -0
  36. package/src/domains/stepper/components/Wizard.tsx +84 -0
  37. package/src/domains/stepper/components/index.ts +2 -0
  38. package/src/domains/stepper/index.ts +2 -0
  39. package/src/domains/stepper/stepper.css +145 -0
  40. package/src/domains/stepper/types.ts +40 -0
  41. package/src/index.ts +4 -0
@@ -0,0 +1,119 @@
1
+ import { FilterSelect } from '@umituz/web-design-system/molecules';
2
+ import { cn } from '@umituz/web-design-system/utils';
3
+ import type { DataToolbarProps } from '../types';
4
+
5
+ export function DataToolbar({
6
+ search,
7
+ filters,
8
+ activeFilters,
9
+ onClearAllFilters,
10
+ count,
11
+ viewSwitcher,
12
+ actions,
13
+ children,
14
+ className,
15
+ }: DataToolbarProps) {
16
+ const countLabel = (() => {
17
+ if (count === undefined) return null;
18
+ if (typeof count === 'number') return `${count}`;
19
+ if (count.total !== undefined) return `${count.shown} of ${count.total}`;
20
+ return `${count.shown}`;
21
+ })();
22
+
23
+ return (
24
+ <div className={cn('udb-data-toolbar', className)}>
25
+ <div className="udb-data-toolbar__main">
26
+ {search && (
27
+ <div className="udb-data-toolbar__search">
28
+ <input
29
+ type="search"
30
+ value={search.value}
31
+ onChange={(e) => search.onChange(e.target.value)}
32
+ placeholder={search.placeholder ?? 'Search…'}
33
+ className="w-full h-8 px-3 text-xs rounded-md border border-line-border bg-surface text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"
34
+ />
35
+ </div>
36
+ )}
37
+
38
+ {filters && filters.length > 0 && (
39
+ <div className="udb-data-toolbar__filters">
40
+ {filters.map((f) => (
41
+ <FilterSelect
42
+ key={f.id}
43
+ value={f.value}
44
+ onChange={f.onChange}
45
+ options={f.options}
46
+ ariaLabel={f.label}
47
+ allLabel={f.allLabel ?? 'All'}
48
+ />
49
+ ))}
50
+ </div>
51
+ )}
52
+
53
+ {children}
54
+
55
+ <div className="udb-data-toolbar__right">
56
+ {actions}
57
+
58
+ {viewSwitcher && (
59
+ <div className="udb-data-toolbar__view-switcher" role="radiogroup" aria-label="View mode">
60
+ {viewSwitcher.options.map((opt) => {
61
+ const isActive = opt.id === viewSwitcher.current;
62
+ return (
63
+ <button
64
+ key={opt.id}
65
+ type="button"
66
+ role="radio"
67
+ aria-checked={isActive}
68
+ onClick={() => viewSwitcher.onChange(opt.id)}
69
+ className={cn(
70
+ 'udb-data-toolbar__view-button',
71
+ isActive && 'udb-data-toolbar__view-button--active',
72
+ )}
73
+ >
74
+ {opt.icon}
75
+ <span>{opt.label}</span>
76
+ </button>
77
+ );
78
+ })}
79
+ </div>
80
+ )}
81
+
82
+ {countLabel && (
83
+ <span className="udb-data-toolbar__count" data-testid="data-toolbar-count">
84
+ {countLabel}
85
+ </span>
86
+ )}
87
+ </div>
88
+ </div>
89
+
90
+ {activeFilters && activeFilters.length > 0 && (
91
+ <div className="udb-data-toolbar__chips">
92
+ {activeFilters.map((chip) => (
93
+ <span key={chip.id} className="udb-data-toolbar__chip">
94
+ <span className="text-muted-foreground">{chip.label}:</span>
95
+ <strong className="font-medium text-foreground">{chip.valueLabel}</strong>
96
+ <button
97
+ type="button"
98
+ onClick={chip.onRemove}
99
+ className="udb-data-toolbar__chip-remove"
100
+ aria-label={`Remove filter ${chip.label}`}
101
+ >
102
+ ×
103
+ </button>
104
+ </span>
105
+ ))}
106
+ {onClearAllFilters && (
107
+ <button
108
+ type="button"
109
+ onClick={onClearAllFilters}
110
+ className="udb-data-toolbar__clear-all"
111
+ >
112
+ Clear all
113
+ </button>
114
+ )}
115
+ </div>
116
+ )}
117
+ </div>
118
+ );
119
+ }
@@ -0,0 +1 @@
1
+ export { DataToolbar } from './DataToolbar';
@@ -0,0 +1,128 @@
1
+ .udb-data-toolbar {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 8px;
5
+ width: 100%;
6
+ }
7
+
8
+ .udb-data-toolbar__main {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: 12px;
12
+ flex-wrap: wrap;
13
+ width: 100%;
14
+ }
15
+
16
+ .udb-data-toolbar__search {
17
+ flex: 0 1 240px;
18
+ min-width: 180px;
19
+ }
20
+
21
+ .udb-data-toolbar__filters {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 8px;
25
+ flex-wrap: wrap;
26
+ }
27
+
28
+ .udb-data-toolbar__right {
29
+ display: flex;
30
+ align-items: center;
31
+ gap: 12px;
32
+ margin-left: auto;
33
+ }
34
+
35
+ .udb-data-toolbar__count {
36
+ font-size: 13px;
37
+ color: var(--text-tertiary, #94a3b8);
38
+ font-variant-numeric: tabular-nums;
39
+ white-space: nowrap;
40
+ }
41
+
42
+ .udb-data-toolbar__chips {
43
+ display: flex;
44
+ align-items: center;
45
+ gap: 6px;
46
+ flex-wrap: wrap;
47
+ padding-top: 4px;
48
+ }
49
+
50
+ .udb-data-toolbar__chip {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ gap: 6px;
54
+ padding: 2px 8px;
55
+ border-radius: 9999px;
56
+ font-size: 12px;
57
+ background: var(--surface-secondary, rgba(0, 0, 0, 0.05));
58
+ color: var(--text-secondary, #475569);
59
+ border: 1px solid var(--line-border, rgba(0, 0, 0, 0.08));
60
+ }
61
+
62
+ .udb-data-toolbar__chip-remove {
63
+ display: inline-flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ width: 14px;
67
+ height: 14px;
68
+ border-radius: 9999px;
69
+ border: none;
70
+ background: transparent;
71
+ color: var(--text-tertiary, #94a3b8);
72
+ cursor: pointer;
73
+ padding: 0;
74
+ font-size: 12px;
75
+ line-height: 1;
76
+ }
77
+
78
+ .udb-data-toolbar__chip-remove:hover {
79
+ color: var(--text-primary, #0f172a);
80
+ }
81
+
82
+ .udb-data-toolbar__clear-all {
83
+ font-size: 12px;
84
+ color: var(--signal-600, #3b82f6);
85
+ background: transparent;
86
+ border: none;
87
+ cursor: pointer;
88
+ padding: 2px 6px;
89
+ font-weight: 500;
90
+ }
91
+
92
+ .udb-data-toolbar__clear-all:hover {
93
+ text-decoration: underline;
94
+ }
95
+
96
+ .udb-data-toolbar__view-switcher {
97
+ display: inline-flex;
98
+ align-items: center;
99
+ padding: 2px;
100
+ border-radius: 8px;
101
+ background: var(--surface-secondary, rgba(0, 0, 0, 0.05));
102
+ border: 1px solid var(--line-border, rgba(0, 0, 0, 0.08));
103
+ gap: 2px;
104
+ }
105
+
106
+ .udb-data-toolbar__view-button {
107
+ display: inline-flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ padding: 4px 8px;
111
+ border-radius: 6px;
112
+ border: none;
113
+ background: transparent;
114
+ color: var(--text-tertiary, #94a3b8);
115
+ font-size: 12px;
116
+ cursor: pointer;
117
+ transition: all 0.15s ease;
118
+ }
119
+
120
+ .udb-data-toolbar__view-button:hover {
121
+ color: var(--text-primary, #0f172a);
122
+ }
123
+
124
+ .udb-data-toolbar__view-button--active {
125
+ background: var(--surface, #ffffff);
126
+ color: var(--text-primary, #0f172a);
127
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
128
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './components';
@@ -0,0 +1,48 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface DataToolbarFilterOption {
4
+ readonly value: string;
5
+ readonly label: string;
6
+ }
7
+
8
+ export interface DataToolbarFilter {
9
+ readonly id: string;
10
+ readonly label: string;
11
+ readonly value: string;
12
+ readonly options: readonly DataToolbarFilterOption[];
13
+ readonly onChange: (value: string) => void;
14
+ readonly allLabel?: string;
15
+ }
16
+
17
+ export interface ActiveFilterChip {
18
+ readonly id: string;
19
+ readonly label: string;
20
+ readonly valueLabel: string;
21
+ readonly onRemove: () => void;
22
+ }
23
+
24
+ export interface ViewSwitcherOption {
25
+ readonly id: string;
26
+ readonly label: string;
27
+ readonly icon?: ReactNode;
28
+ }
29
+
30
+ export interface DataToolbarProps {
31
+ readonly search?: {
32
+ readonly value: string;
33
+ readonly onChange: (value: string) => void;
34
+ readonly placeholder?: string;
35
+ };
36
+ readonly filters?: readonly DataToolbarFilter[];
37
+ readonly activeFilters?: readonly ActiveFilterChip[];
38
+ readonly onClearAllFilters?: () => void;
39
+ readonly count?: number | { readonly shown: number; readonly total?: number };
40
+ readonly viewSwitcher?: {
41
+ readonly current: string;
42
+ readonly options: readonly ViewSwitcherOption[];
43
+ readonly onChange: (viewId: string) => void;
44
+ };
45
+ readonly actions?: ReactNode;
46
+ readonly children?: ReactNode;
47
+ readonly className?: string;
48
+ }
@@ -0,0 +1,96 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import { MemoryRouter } from 'react-router';
4
+ import { DetailPage } from './DetailPage';
5
+
6
+ describe('DetailPage', () => {
7
+ it('renders notFound empty state when notFound is true', () => {
8
+ render(
9
+ <MemoryRouter>
10
+ <DetailPage
11
+ title="Not Found"
12
+ notFound={{ title: 'Client not found', description: 'Could not find client.' }}
13
+ />
14
+ </MemoryRouter>,
15
+ );
16
+ expect(screen.getByText('Client not found')).toBeTruthy();
17
+ expect(screen.getByText('Could not find client.')).toBeTruthy();
18
+ });
19
+
20
+ it('renders title, description, badge, and back button', () => {
21
+ render(
22
+ <MemoryRouter>
23
+ <DetailPage
24
+ backTo={{ href: '/clients', label: 'All clients' }}
25
+ title="Acme Corp"
26
+ badge={<span>Active</span>}
27
+ description="Enterprise legal client since 2024"
28
+ >
29
+ <div>Main Details</div>
30
+ </DetailPage>
31
+ </MemoryRouter>,
32
+ );
33
+ expect(screen.getByText('Acme Corp')).toBeTruthy();
34
+ expect(screen.getByText('All clients')).toBeTruthy();
35
+ expect(screen.getByText('Active')).toBeTruthy();
36
+ expect(screen.getByText('Enterprise legal client since 2024')).toBeTruthy();
37
+ expect(screen.getByText('Main Details')).toBeTruthy();
38
+ });
39
+
40
+ it('renders tabs and switches active tab on click', () => {
41
+ const handleTabChange = vi.fn();
42
+ render(
43
+ <MemoryRouter>
44
+ <DetailPage
45
+ title="Acme Corp"
46
+ tabs={[
47
+ { id: 'overview', label: 'Overview', content: <div>Overview Content</div> },
48
+ { id: 'cases', label: 'Cases', count: 5, content: <div>Cases Content</div> },
49
+ ]}
50
+ onTabChange={handleTabChange}
51
+ />
52
+ </MemoryRouter>,
53
+ );
54
+ expect(screen.getByText('Overview Content')).toBeTruthy();
55
+ expect(screen.getByText('Cases')).toBeTruthy();
56
+ expect(screen.getByText('5')).toBeTruthy();
57
+
58
+ fireEvent.click(screen.getByText('Cases'));
59
+ expect(handleTabChange).toHaveBeenCalledWith('cases');
60
+ expect(screen.getByText('Cases Content')).toBeTruthy();
61
+ });
62
+
63
+ it('renders sidebar layout when sidebar prop is provided', () => {
64
+ render(
65
+ <MemoryRouter>
66
+ <DetailPage
67
+ title="Acme Corp"
68
+ sidebar={<div>Sidebar Information</div>}
69
+ >
70
+ <div>Body Information</div>
71
+ </DetailPage>
72
+ </MemoryRouter>,
73
+ );
74
+ expect(screen.getByText('Sidebar Information')).toBeTruthy();
75
+ expect(screen.getByText('Body Information')).toBeTruthy();
76
+ });
77
+
78
+ it('renders KPI metrics when provided', () => {
79
+ render(
80
+ <MemoryRouter>
81
+ <DetailPage
82
+ title="Acme Corp"
83
+ kpis={[
84
+ { label: 'Active Matters', value: '12', delta: { value: '+3', direction: 'up' } },
85
+ { label: 'Total Billed', value: '$45,000' },
86
+ ]}
87
+ />
88
+ </MemoryRouter>,
89
+ );
90
+ expect(screen.getByText('Active Matters')).toBeTruthy();
91
+ expect(screen.getByText('12')).toBeTruthy();
92
+ expect(screen.getByText('+3')).toBeTruthy();
93
+ expect(screen.getByText('Total Billed')).toBeTruthy();
94
+ expect(screen.getByText('$45,000')).toBeTruthy();
95
+ });
96
+ });
@@ -0,0 +1,227 @@
1
+ import { useState } from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import { ArrowLeft } from 'lucide-react';
4
+ import { Link } from 'react-router';
5
+ import { Button } from '@umituz/web-design-system/atoms';
6
+ import { EmptyState } from '@umituz/web-design-system/organisms';
7
+ import { cn } from '@umituz/web-design-system/utils';
8
+ import type {
9
+ DetailPageKpi,
10
+ DetailPageMetaItem,
11
+ DetailPageNotFoundConfig,
12
+ DetailPageProps,
13
+ DetailPageTab,
14
+ } from '../types';
15
+
16
+ function SafeBackLink({ href, label = 'Back' }: { href: string; label?: string }) {
17
+ try {
18
+ return (
19
+ <Link
20
+ to={href}
21
+ className="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-3"
22
+ >
23
+ <ArrowLeft size={13} aria-hidden="true" />
24
+ <span>{label}</span>
25
+ </Link>
26
+ );
27
+ } catch {
28
+ return (
29
+ <a
30
+ href={href}
31
+ className="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-3"
32
+ >
33
+ <ArrowLeft size={13} aria-hidden="true" />
34
+ <span>{label}</span>
35
+ </a>
36
+ );
37
+ }
38
+ }
39
+
40
+ function renderMetaItem(item: DetailPageMetaItem | ReactNode, index: number) {
41
+ if (item && typeof item === 'object' && 'value' in item && !('type' in (item as object))) {
42
+ const m = item as DetailPageMetaItem;
43
+ return (
44
+ <span key={index} className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
45
+ {m.icon && <span aria-hidden="true">{m.icon}</span>}
46
+ {m.label && <span>{m.label}:</span>}
47
+ <strong className="font-semibold text-foreground">{m.value}</strong>
48
+ </span>
49
+ );
50
+ }
51
+ return (
52
+ <span key={index} className="text-xs text-muted-foreground">
53
+ {item as ReactNode}
54
+ </span>
55
+ );
56
+ }
57
+
58
+ function renderKpi(kpi: DetailPageKpi, index: number) {
59
+ return (
60
+ <div
61
+ key={index}
62
+ className="flex flex-col gap-1 p-4 rounded-xl border border-line-border bg-card"
63
+ >
64
+ <span className="text-xs text-muted-foreground font-medium">{kpi.label}</span>
65
+ <div className="flex items-baseline gap-2">
66
+ <span className="text-2xl font-bold tracking-tight text-foreground">{kpi.value}</span>
67
+ {kpi.delta && (
68
+ <span
69
+ className={cn(
70
+ 'text-xs font-semibold',
71
+ kpi.delta.direction === 'up' && 'text-emerald-600',
72
+ kpi.delta.direction === 'down' && 'text-rose-600',
73
+ kpi.delta.direction === 'flat' && 'text-muted-foreground',
74
+ )}
75
+ >
76
+ {kpi.delta.value}
77
+ </span>
78
+ )}
79
+ </div>
80
+ {kpi.hint && <span className="text-2xs text-muted-foreground">{kpi.hint}</span>}
81
+ </div>
82
+ );
83
+ }
84
+
85
+ export function DetailPage<T = unknown>({
86
+ backTo,
87
+ title,
88
+ kicker,
89
+ badge,
90
+ description,
91
+ meta,
92
+ actions,
93
+ notice,
94
+ kpis,
95
+ tabs,
96
+ activeTab,
97
+ defaultTab,
98
+ onTabChange,
99
+ sidebar,
100
+ children,
101
+ notFound,
102
+ className,
103
+ }: DetailPageProps<T>) {
104
+ const [internalTab, setInternalTab] = useState<string>(() => {
105
+ if (activeTab !== undefined) return activeTab;
106
+ if (defaultTab !== undefined) return defaultTab;
107
+ return tabs?.[0]?.id ?? '';
108
+ });
109
+
110
+ if (notFound) {
111
+ const conf: DetailPageNotFoundConfig = typeof notFound === 'object' ? notFound : {};
112
+ return (
113
+ <div className={cn('flex w-full flex-col gap-6', className)}>
114
+ {backTo && <SafeBackLink href={backTo.href} label={backTo.label} />}
115
+ <EmptyState
116
+ title={conf.title ?? 'Record not found'}
117
+ description={conf.description ?? "This item doesn't exist or may have been deleted."}
118
+ action={
119
+ conf.backHref ? (
120
+ <Button to={conf.backHref} variant="secondary">
121
+ {conf.backLabel ?? 'Back'}
122
+ </Button>
123
+ ) : backTo ? (
124
+ <Button to={backTo.href} variant="secondary">
125
+ {backTo.label ?? 'Back'}
126
+ </Button>
127
+ ) : undefined
128
+ }
129
+ />
130
+ </div>
131
+ );
132
+ }
133
+
134
+ const currentTabId = activeTab !== undefined ? activeTab : internalTab;
135
+
136
+ function handleTabSelect(id: string) {
137
+ if (activeTab === undefined) {
138
+ setInternalTab(id);
139
+ }
140
+ onTabChange?.(id);
141
+ }
142
+
143
+ const activeTabObj = tabs?.find((t) => t.id === currentTabId);
144
+ const mainContent = activeTabObj?.content ?? children;
145
+
146
+ return (
147
+ <div className={cn('flex w-full flex-col gap-6', className)}>
148
+ {backTo && <SafeBackLink href={backTo.href} label={backTo.label} />}
149
+
150
+ <header className="flex flex-col gap-3">
151
+ {kicker && <div className="text-xs font-semibold tracking-wider uppercase text-muted-foreground">{kicker}</div>}
152
+
153
+ <div className="flex flex-wrap items-start justify-between gap-4">
154
+ <div className="flex flex-wrap items-center gap-3">
155
+ <h1 className="text-2xl font-bold tracking-tight text-foreground">{title}</h1>
156
+ {badge}
157
+ </div>
158
+ {actions && <div className="flex flex-wrap items-center gap-2">{actions}</div>}
159
+ </div>
160
+
161
+ {description && <p className="text-sm text-muted-foreground leading-relaxed max-w-3xl">{description}</p>}
162
+
163
+ {meta && meta.length > 0 && (
164
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2 pt-1 border-t border-line-border/60">
165
+ {meta.map(renderMetaItem)}
166
+ </div>
167
+ )}
168
+ </header>
169
+
170
+ {notice}
171
+
172
+ {kpis && kpis.length > 0 && (
173
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
174
+ {kpis.map(renderKpi)}
175
+ </div>
176
+ )}
177
+
178
+ {tabs && tabs.length > 0 && (
179
+ <nav className="flex gap-2 border-b border-line-border pb-px" role="tablist">
180
+ {tabs.map((tab: DetailPageTab) => {
181
+ const isSelected = tab.id === currentTabId;
182
+ return (
183
+ <button
184
+ key={tab.id}
185
+ type="button"
186
+ role="tab"
187
+ aria-selected={isSelected}
188
+ disabled={tab.disabled}
189
+ onClick={() => handleTabSelect(tab.id)}
190
+ className={cn(
191
+ 'inline-flex items-center gap-2 px-3.5 py-2 text-sm font-medium border-b-2 -mb-px transition-colors',
192
+ isSelected
193
+ ? 'border-primary text-foreground'
194
+ : 'border-transparent text-muted-foreground hover:text-foreground hover:border-line-border',
195
+ tab.disabled && 'opacity-50 cursor-not-allowed',
196
+ )}
197
+ >
198
+ {tab.icon && <span aria-hidden="true">{tab.icon}</span>}
199
+ <span>{tab.label}</span>
200
+ {tab.count !== undefined && (
201
+ <span
202
+ className={cn(
203
+ 'px-1.5 py-0.5 text-2xs font-semibold rounded-full',
204
+ isSelected ? 'bg-primary/10 text-primary' : 'bg-muted text-muted-foreground',
205
+ )}
206
+ >
207
+ {tab.count}
208
+ </span>
209
+ )}
210
+ {tab.badge}
211
+ </button>
212
+ );
213
+ })}
214
+ </nav>
215
+ )}
216
+
217
+ {sidebar ? (
218
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-6 items-start">
219
+ <div className="lg:col-span-2 flex flex-col gap-6">{mainContent}</div>
220
+ <aside className="flex flex-col gap-6">{sidebar}</aside>
221
+ </div>
222
+ ) : (
223
+ <div className="flex flex-col gap-6">{mainContent}</div>
224
+ )}
225
+ </div>
226
+ );
227
+ }
@@ -1 +1,2 @@
1
1
  export { ListPage } from './ListPage';
2
+ export { DetailPage } from './DetailPage';
@@ -47,3 +47,63 @@ export const defaultListPageLabels: ListPageLabels = {
47
47
  filterAll: 'All',
48
48
  countShown: (shown, total) => `${shown} of ${total}`,
49
49
  };
50
+
51
+ export interface DetailPageKpi {
52
+ readonly label: string;
53
+ readonly value: ReactNode;
54
+ readonly hint?: ReactNode;
55
+ readonly delta?: {
56
+ readonly value: ReactNode;
57
+ readonly direction?: 'up' | 'down' | 'flat';
58
+ };
59
+ readonly tone?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
60
+ }
61
+
62
+ export interface DetailPageTab {
63
+ readonly id: string;
64
+ readonly label: ReactNode;
65
+ readonly count?: number;
66
+ readonly badge?: ReactNode;
67
+ readonly icon?: ReactNode;
68
+ readonly content?: ReactNode;
69
+ readonly disabled?: boolean;
70
+ }
71
+
72
+ export interface DetailPageMetaItem {
73
+ readonly label?: ReactNode;
74
+ readonly value: ReactNode;
75
+ readonly icon?: ReactNode;
76
+ }
77
+
78
+ export interface DetailPageBackTo {
79
+ readonly href: string;
80
+ readonly label?: string;
81
+ }
82
+
83
+ export interface DetailPageNotFoundConfig {
84
+ readonly title?: string;
85
+ readonly description?: string;
86
+ readonly backHref?: string;
87
+ readonly backLabel?: string;
88
+ }
89
+
90
+ export interface DetailPageProps<T = unknown> {
91
+ readonly backTo?: DetailPageBackTo;
92
+ readonly title: ReactNode;
93
+ readonly kicker?: ReactNode;
94
+ readonly badge?: ReactNode;
95
+ readonly description?: ReactNode;
96
+ readonly meta?: readonly (DetailPageMetaItem | ReactNode)[];
97
+ readonly actions?: ReactNode;
98
+ readonly notice?: ReactNode;
99
+ readonly kpis?: readonly DetailPageKpi[];
100
+ readonly tabs?: readonly DetailPageTab[];
101
+ readonly activeTab?: string;
102
+ readonly defaultTab?: string;
103
+ readonly onTabChange?: (tabId: string) => void;
104
+ readonly sidebar?: ReactNode;
105
+ readonly children?: ReactNode;
106
+ readonly notFound?: boolean | DetailPageNotFoundConfig;
107
+ readonly payload?: T;
108
+ readonly className?: string;
109
+ }