klun-ui 0.2.2 → 0.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.
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
+ import { C as ChipColor } from '../Chip-DiCYJmnv.js';
3
4
 
4
5
  interface SidebarUser {
5
6
  name: string;
@@ -45,28 +46,87 @@ declare function SettingsTemplate(): react.JSX.Element;
45
46
 
46
47
  interface MetronicNavChild {
47
48
  key: string;
48
- label: string;
49
+ /** Optional override — otherwise resolved from the demo dictionary. */
50
+ label?: string;
49
51
  }
50
52
  interface MetronicNavItem {
51
53
  key: string;
52
- label: string;
54
+ label?: string;
53
55
  /** Remix Icon class, e.g. `ri-dashboard-line`. */
54
56
  icon: string;
55
57
  badge?: string;
56
58
  children?: MetronicNavChild[];
59
+ /** Render a hairline above this item (section break). */
60
+ dividerBefore?: boolean;
61
+ /** The current role can't open this screen — shown with a lock and routed to a 403. */
62
+ locked?: boolean;
57
63
  }
58
64
  interface MetronicSidebarProps {
59
65
  /** Active item key. */
60
66
  active: string;
61
67
  onNavigate: (key: string) => void;
68
+ /** Live badges overriding the static ones, e.g. `{ messages: "3" }`. */
69
+ badges?: Record<string, string | number | undefined>;
70
+ /** Keys the current role can't access — rendered with a lock. */
71
+ lockedKeys?: string[];
72
+ /** Icon-only rail. */
73
+ collapsed?: boolean;
74
+ onToggleCollapsed?: () => void;
75
+ /** Role shown in the user card. */
76
+ roleLabel?: string;
62
77
  }
63
- declare function MetronicSidebar({ active, onNavigate }: MetronicSidebarProps): react.JSX.Element;
78
+ declare function MetronicSidebar({ active, onNavigate, badges, lockedKeys, collapsed, onToggleCollapsed, roleLabel }: MetronicSidebarProps): react.JSX.Element;
64
79
 
65
- declare function MetronicTopBar(): react.JSX.Element;
80
+ /** Accent skins shipped by the design system (`data-mode`). */
81
+ declare const DEMO_SKINS: readonly ["metronic", "blue", "purple", "orange", "green", "slate"];
82
+ type DemoSkin = (typeof DEMO_SKINS)[number];
83
+ interface DemoNotification {
84
+ id: string;
85
+ title: string;
86
+ body: string;
87
+ /** ISO timestamp. */
88
+ time: string;
89
+ icon: string;
90
+ tone: "primary" | "success" | "warning" | "error";
91
+ read: boolean;
92
+ }
93
+ interface MetronicTopBarProps {
94
+ /** Open the ⌘K command palette (the search box does this too). */
95
+ onOpenPalette?: () => void;
96
+ /** Platform hint rendered in the search box. */
97
+ paletteHint?: string;
98
+ theme: "light" | "dark";
99
+ onThemeChange?: (theme: "light" | "dark") => void;
100
+ density: "default" | "compact";
101
+ onDensityChange?: (density: "default" | "compact") => void;
102
+ skin: DemoSkin;
103
+ onSkinChange?: (skin: DemoSkin) => void;
104
+ /** Active BCP-47 locale code (`en-US`, `zh-CN`, …). */
105
+ localeCode?: string;
106
+ onLocaleChange?: (code: string) => void;
107
+ notifications?: DemoNotification[];
108
+ onNotificationClick?: (notification: DemoNotification) => void;
109
+ onMarkAllRead?: () => void;
110
+ /** Navigate to another screen. */
111
+ onNavigate?: (key: string) => void;
112
+ /** Opens the create-order dialog. */
113
+ onNewOrder?: () => void;
114
+ /** Sign out (the demo just shows a toast). */
115
+ onSignOut?: () => void;
116
+ }
117
+ declare function MetronicTopBar({ onOpenPalette, paletteHint, theme, onThemeChange, density, onDensityChange, skin, onSkinChange, localeCode, onLocaleChange, notifications, onNotificationClick, onMarkAllRead, onNavigate, onNewOrder, onSignOut, }: MetronicTopBarProps): react.JSX.Element;
66
118
 
67
- declare function DashboardScreen(): react.JSX.Element;
119
+ interface DashboardScreenProps {
120
+ /** Jump to the orders screen — fired by “View all” and by clicking a recent order. */
121
+ onViewAllOrders?: (orderId?: string) => void;
122
+ }
123
+ declare function DashboardScreen({ onViewAllOrders }?: DashboardScreenProps): react.JSX.Element;
68
124
 
69
- declare function OrdersScreen(): react.JSX.Element;
125
+ interface OrdersScreenProps {
126
+ /** Bump this counter to pop the create dialog (used by the shell's top bar). */
127
+ createRequest?: number;
128
+ }
129
+ declare function OrdersScreen({ createRequest }: OrdersScreenProps): react.JSX.Element;
70
130
 
71
131
  declare function ProductsScreen(): react.JSX.Element;
72
132
 
@@ -104,7 +164,17 @@ declare function ProductWizardPage({ mode, initial, onCancel, onSave }: ProductW
104
164
 
105
165
  declare function CustomersScreen(): react.JSX.Element;
106
166
 
107
- declare function UsersScreen(): react.JSX.Element;
167
+ interface UsersScreenProps {
168
+ /** Pre-filter the list by department (used by the departments screen). */
169
+ initialDepartment?: string;
170
+ /** Open the audit log filtered by this member. */
171
+ onOpenAudit?: (actor: string) => void;
172
+ /** Jump to the roles & permissions matrix. */
173
+ onOpenRoles?: () => void;
174
+ /** Jump to the departments tree. */
175
+ onOpenDepartments?: () => void;
176
+ }
177
+ declare function UsersScreen({ initialDepartment, onOpenAudit, onOpenRoles, onOpenDepartments }?: UsersScreenProps): react.JSX.Element;
108
178
 
109
179
  declare function RolesScreen(): react.JSX.Element;
110
180
 
@@ -113,6 +183,246 @@ declare function ReportsScreen({ view }: {
113
183
  view?: ReportsView;
114
184
  }): react.JSX.Element;
115
185
 
186
+ interface DepartmentsScreenProps {
187
+ /** Jump to the team page (the drawer links to members), focused on a department. */
188
+ onOpenTeam?: (departmentName?: string) => void;
189
+ }
190
+ declare function DepartmentsScreen({ onOpenTeam }?: DepartmentsScreenProps): react.JSX.Element;
191
+
192
+ interface RoleTreeScreenProps {
193
+ /** Jump to the roles & permissions matrix. */
194
+ onOpenRoles?: () => void;
195
+ }
196
+ declare function RoleTreeScreen({ onOpenRoles }?: RoleTreeScreenProps): react.JSX.Element;
197
+
198
+ declare function TasksScreen(): react.JSX.Element;
199
+
200
+ interface AuditScreenProps {
201
+ /** Pre-filter the trail by actor (set from the user detail drawer). */
202
+ initialActor?: string;
203
+ }
204
+ declare function AuditScreen({ initialActor }?: AuditScreenProps): react.JSX.Element;
205
+
206
+ interface MessagesScreenProps {
207
+ /** Total unread in the inbox — drives the sidebar badge. */
208
+ onUnreadChange?: (unread: number) => void;
209
+ }
210
+ declare function MessagesScreen({ onUnreadChange }?: MessagesScreenProps): react.JSX.Element;
211
+
212
+ interface ApprovalsScreenProps {
213
+ /** Jump to the audit log filtered by the requester of the decision. */
214
+ onOpenAudit?: (requester: string) => void;
215
+ }
216
+ declare function ApprovalsScreen({ onOpenAudit }?: ApprovalsScreenProps): react.JSX.Element;
217
+
218
+ interface TicketsScreenProps {
219
+ /** Quick jump into the audit log for this requester. */
220
+ onOpenAudit?: (actor: string) => void;
221
+ }
222
+ declare function TicketsScreen({ onOpenAudit }?: TicketsScreenProps): react.JSX.Element;
223
+
224
+ declare function CalendarScreen(): react.JSX.Element;
225
+
226
+ interface SearchScreenProps {
227
+ /** Jump to the screen owning a hit. */
228
+ onNavigate?: (key: string) => void;
229
+ }
230
+ declare function SearchScreen({ onNavigate }?: SearchScreenProps): react.JSX.Element;
231
+
232
+ interface WorkspaceSecurityScreenProps {
233
+ /** Forward the admin to the audit log filtered by this actor. */
234
+ onOpenAudit?: (actor: string) => void;
235
+ }
236
+ declare function WorkspaceSecurityScreen({ onOpenAudit }?: WorkspaceSecurityScreenProps): react.JSX.Element;
237
+
238
+ interface IntegrationsScreenProps {
239
+ onOpenAudit?: (actor: string) => void;
240
+ }
241
+ declare function IntegrationsScreen({ onOpenAudit }?: IntegrationsScreenProps): react.JSX.Element;
242
+
243
+ declare function FeatureFlagsScreen(): react.JSX.Element;
244
+
245
+ declare function TemplatesScreen(): react.JSX.Element;
246
+
247
+ declare function ImportExportScreen(): react.JSX.Element;
248
+
249
+ type MailFolder = "inbox" | "sent" | "drafts" | "archived";
250
+ type MailView = MailFolder | "starred";
251
+ declare const FOLDER_LABELS: Record<MailFolder, string>;
252
+ declare const FOLDER_ICONS: Record<MailFolder, string>;
253
+ declare const MAIL_LABELS: readonly ["Finance", "Design", "Support", "Engineering", "Alerts", "Product"];
254
+ type MailLabel = (typeof MAIL_LABELS)[number];
255
+ declare const LABEL_COLOR: Record<MailLabel, "blue" | "purple" | "orange" | "teal" | "red" | "green">;
256
+ interface MailAttachment {
257
+ id: string;
258
+ name: string;
259
+ size: string;
260
+ icon: string;
261
+ }
262
+ interface MailMessage {
263
+ id: string;
264
+ /** Sender display name — `"You"` for the signed-in user. */
265
+ from: string;
266
+ to: string[];
267
+ cc?: string[];
268
+ at: string;
269
+ body: string;
270
+ attachments?: MailAttachment[];
271
+ }
272
+ interface MailThread {
273
+ id: string;
274
+ subject: string;
275
+ folder: MailFolder;
276
+ labels: MailLabel[];
277
+ starred: boolean;
278
+ priority: "normal" | "high";
279
+ updatedAt: string;
280
+ /** Unread messages for the signed-in user. */
281
+ unread: number;
282
+ messages: MailMessage[];
283
+ }
284
+ /** Teammates you can write to (everyone except yourself). */
285
+ declare const RECIPIENTS: {
286
+ name: string;
287
+ email: string;
288
+ title: string;
289
+ department: string;
290
+ }[];
291
+ declare const INITIAL_THREADS: MailThread[];
292
+ declare const totalUnread: (threads: MailThread[]) => number;
293
+
294
+ type UserStatus = "Active" | "Invited" | "Suspended" | "Locked";
295
+ type RoleId = "Owner" | "Admin" | "Manager" | "Editor" | "Viewer" | "Support";
296
+ interface UserSession {
297
+ id: string;
298
+ device: string;
299
+ icon: string;
300
+ browser: string;
301
+ ip: string;
302
+ location: string;
303
+ lastActive: string;
304
+ current?: boolean;
305
+ }
306
+ interface UserActivity {
307
+ id: string;
308
+ at: string;
309
+ action: "create" | "update" | "delete" | "login" | "export" | "permission";
310
+ target: string;
311
+ ip: string;
312
+ result: "success" | "failed" | "blocked";
313
+ }
314
+ interface PermissionOverride {
315
+ id: string;
316
+ permission: string;
317
+ /** Allow grants a permission the roles don't; deny removes one they grant. */
318
+ effect: "allow" | "deny";
319
+ }
320
+ interface DemoUser {
321
+ id: string;
322
+ name: string;
323
+ email: string;
324
+ title: string;
325
+ avatarColor: "blue" | "purple" | "green" | "orange" | "gray";
326
+ /** Department id — see DEPARTMENTS. */
327
+ department: string;
328
+ manager: string;
329
+ location: string;
330
+ timezone: string;
331
+ roles: RoleId[];
332
+ status: UserStatus;
333
+ twoFA: boolean;
334
+ forcePasswordChange: boolean;
335
+ failedLogins: number;
336
+ lastActive: string;
337
+ createdAt: string;
338
+ passwordChangedAt: string;
339
+ overrides: PermissionOverride[];
340
+ sessions: UserSession[];
341
+ activity: UserActivity[];
342
+ }
343
+ interface DepartmentOption {
344
+ id: string;
345
+ name: string;
346
+ path: string;
347
+ }
348
+ declare const DEPARTMENTS: DepartmentOption[];
349
+ declare const departmentPath: (id: string) => string;
350
+ declare const departmentName: (id: string) => string;
351
+ /** A department plus every descendant — picking a parent filters the whole branch. */
352
+ declare const departmentIdsWithChildren: (id: string) => string[];
353
+ /** Depth of a department in the tree (0 = root). */
354
+ declare const departmentDepth: (id: string) => number;
355
+ /** Direct children of a department (or the roots when `id` is null). */
356
+ declare const departmentChildren: (id: string | null) => DepartmentOption[];
357
+ declare const ROLE_IDS: RoleId[];
358
+ /** Permissions granted by each role (children inherit their parents'). */
359
+ declare const ROLE_PERMISSIONS: Record<RoleId, string[]>;
360
+ declare const ROLE_COLOR: Record<RoleId, ChipColor>;
361
+ /** Every permission the workspace knows about. */
362
+ declare const ALL_PERMISSIONS: string[];
363
+ /** Permissions granted by the user's roles (before overrides). */
364
+ declare const rolePermissions: (roles: RoleId[]) => string[];
365
+ /** Final permission set = role grants + allow overrides − deny overrides. */
366
+ declare const effectivePermissions: (user: DemoUser) => string[];
367
+ declare const USER_STATUS_COLOR: Record<UserStatus, "green" | "blue" | "gray" | "red">;
368
+ declare const USER_STATUSES: UserStatus[];
369
+ declare const INITIAL_USERS: DemoUser[];
370
+
371
+ interface UserDetailDrawerProps {
372
+ user: DemoUser | null;
373
+ onClose: () => void;
374
+ /** Persist changes back into the list. */
375
+ onChange: (user: DemoUser) => void;
376
+ /** Jump to the audit log filtered by this user. */
377
+ onOpenAudit?: (actor: string) => void;
378
+ /** Jump to the roles & permissions matrix. */
379
+ onOpenRoles?: () => void;
380
+ /** Jump to the departments tree. */
381
+ onOpenDepartments?: () => void;
382
+ }
383
+ declare function UserDetailDrawer({ user, onClose, onChange, onOpenAudit, onOpenRoles, onOpenDepartments }: UserDetailDrawerProps): react.JSX.Element;
384
+
385
+ interface DepartmentFilterProps {
386
+ /** Active department id, or `"all"`. */
387
+ value: string;
388
+ onChange: (id: string) => void;
389
+ /** Members used for the per-branch counters. */
390
+ users: DemoUser[];
391
+ }
392
+ declare function DepartmentFilter({ value, onChange, users }: DepartmentFilterProps): react.JSX.Element;
393
+
394
+ /** Every locale the design system ships, as a menu-friendly list. */
395
+ declare const LOCALE_OPTIONS: {
396
+ code: string;
397
+ label: string;
398
+ }[];
399
+ /** Right-to-left locales — the provider flips the whole layout. */
400
+ declare const RTL_LOCALES: string[];
401
+ interface DemoPageCopy {
402
+ title: string;
403
+ subtitle: string;
404
+ }
405
+ interface DemoText {
406
+ nav: Record<string, string>;
407
+ shell: Record<string, string>;
408
+ common: Record<string, string>;
409
+ pages: Record<string, DemoPageCopy>;
410
+ }
411
+ /** Demo copy — add a language by copying a block and translating the strings. */
412
+ declare const DEMO_TEXT: Record<string, DemoText>;
413
+ /** Demo copy for a locale code — falls back to English. */
414
+ declare const demoTextFor: (code: string) => DemoText;
415
+ /** Active demo copy — falls back to English for locales without a dictionary. */
416
+ declare function useDemoText(): DemoText;
417
+ interface PageHeaderProps {
418
+ /** Key into `pages`. */
419
+ page: string;
420
+ /** Right-aligned slot for page actions. */
421
+ extra?: ReactNode;
422
+ }
423
+ /** Localised `<h1>` + subtitle used at the top of every demo screen. */
424
+ declare function PageHeader({ page, extra }: PageHeaderProps): react.JSX.Element;
425
+
116
426
  /** Semantic tone → chart color. */
117
427
  type ChartTone = "primary" | "success" | "danger" | "info" | "warning" | "feature";
118
428
  interface SparklineProps {
@@ -181,6 +491,46 @@ declare function MiniStat({ label, value, hint, tone }: MiniStatProps): react.JS
181
491
 
182
492
  declare function MetronicDashboardTemplate(): react.JSX.Element;
183
493
 
184
- declare function MetronicSettingsTemplate(): react.JSX.Element;
494
+ /** Tabs of the settings page. */
495
+ type SettingsSectionKey = "profile" | "account" | "notifications" | "billing" | "api";
496
+ interface SettingsNavItem {
497
+ key: SettingsSectionKey;
498
+ label: string;
499
+ /** Remix Icon class. */
500
+ icon: string;
501
+ /** One-liner used by the page header. */
502
+ description: string;
503
+ }
504
+ declare const SETTINGS_NAV: SettingsNavItem[];
505
+
506
+ interface ProfileSectionProps {
507
+ /** Fired whenever the amount of unsaved work changes. */
508
+ onDirtyChange?: (dirty: boolean) => void;
509
+ }
510
+ declare function ProfileSection({ onDirtyChange }: ProfileSectionProps): react.JSX.Element;
511
+
512
+ declare function AccountSection(): react.JSX.Element;
513
+
514
+ interface NotificationsSectionProps {
515
+ /** Fired whenever the amount of unsaved work changes. */
516
+ onDirtyChange?: (dirty: boolean) => void;
517
+ }
518
+ declare function NotificationsSection({ onDirtyChange }: NotificationsSectionProps): react.JSX.Element;
519
+
520
+ declare function BillingSection(): react.JSX.Element;
521
+
522
+ declare function ApiKeysSection(): react.JSX.Element;
523
+
524
+ interface MetronicSettingsTemplateProps {
525
+ /** Controlled active tab. */
526
+ section?: SettingsSectionKey;
527
+ /** Initial tab in uncontrolled mode. Default `"profile"`. */
528
+ defaultSection?: SettingsSectionKey;
529
+ /** Fired when the user picks another tab (controlled mode). */
530
+ onSectionChange?: (section: SettingsSectionKey) => void;
531
+ /** Cap the page column — `"none"` (default) fills the host width. */
532
+ maxWidth?: number | string;
533
+ }
534
+ declare function MetronicSettingsTemplate({ section, defaultSection, onSectionChange, maxWidth, }?: MetronicSettingsTemplateProps): react.JSX.Element;
185
535
 
186
- export { AIAssistantTemplate, AgentChatTemplate, AreaChart, type AreaChartProps, BarChart, type BarChartProps, CATEGORIES, CalendarTemplate, type ChartTone, CryptoTemplate, CustomersScreen, DashboardScreen, DashboardTemplate, DonutChart, type DonutChartProps, Kpi, type KpiProps, MarketingTemplate, MetronicDashboardTemplate, type MetronicNavChild, type MetronicNavItem, MetronicSettingsTemplate, MetronicSidebar, type MetronicSidebarProps, MetronicTopBar, MiniStat, type MiniStatProps, OrdersScreen, OverviewScreen, PricingTemplate, type Product, type ProductDraft, type ProductStatus, ProductWizardPage, type ProductWizardPageProps, ProductsScreen, ReportsScreen, type ReportsView, RolesScreen, STATUS_COLOR, SettingsScreen, SettingsTemplate, Sidebar, type SidebarProps, type SidebarUser, Sparkline, type SparklineProps, TopBar, type TopBarProps, UsersScreen, deriveStatus, emptyDraft };
536
+ export { AIAssistantTemplate, ALL_PERMISSIONS, AccountSection, AgentChatTemplate, ApiKeysSection, ApprovalsScreen, type ApprovalsScreenProps, AreaChart, type AreaChartProps, AuditScreen, type AuditScreenProps, BarChart, type BarChartProps, BillingSection, CATEGORIES, CalendarScreen, CalendarTemplate, type ChartTone, CryptoTemplate, CustomersScreen, DEMO_SKINS, DEMO_TEXT, DEPARTMENTS, DashboardScreen, type DashboardScreenProps, DashboardTemplate, type DemoNotification, type DemoPageCopy, type DemoSkin, type DemoText, type DemoUser, DepartmentFilter, type DepartmentFilterProps, type DepartmentOption, DepartmentsScreen, type DepartmentsScreenProps, DonutChart, type DonutChartProps, FOLDER_ICONS, FOLDER_LABELS, FeatureFlagsScreen, INITIAL_THREADS, INITIAL_USERS, ImportExportScreen, IntegrationsScreen, type IntegrationsScreenProps, Kpi, type KpiProps, LABEL_COLOR, LOCALE_OPTIONS, MAIL_LABELS, type MailAttachment, type MailFolder, type MailLabel, type MailMessage, type MailThread, type MailView, MarketingTemplate, MessagesScreen, type MessagesScreenProps, MetronicDashboardTemplate, type MetronicNavChild, type MetronicNavItem, MetronicSettingsTemplate, type MetronicSettingsTemplateProps, MetronicSidebar, type MetronicSidebarProps, MetronicTopBar, type MetronicTopBarProps, MiniStat, type MiniStatProps, NotificationsSection, type NotificationsSectionProps, OrdersScreen, type OrdersScreenProps, OverviewScreen, PageHeader, type PageHeaderProps, type PermissionOverride, PricingTemplate, type Product, type ProductDraft, type ProductStatus, ProductWizardPage, type ProductWizardPageProps, ProductsScreen, ProfileSection, type ProfileSectionProps, RECIPIENTS, ROLE_COLOR, ROLE_IDS, ROLE_PERMISSIONS, RTL_LOCALES, ReportsScreen, type ReportsView, type RoleId, RoleTreeScreen, type RoleTreeScreenProps, RolesScreen, SETTINGS_NAV, STATUS_COLOR, SearchScreen, type SearchScreenProps, type SettingsNavItem, SettingsScreen, type SettingsSectionKey, SettingsTemplate, Sidebar, type SidebarProps, type SidebarUser, Sparkline, type SparklineProps, TasksScreen, TemplatesScreen, TicketsScreen, type TicketsScreenProps, TopBar, type TopBarProps, USER_STATUSES, USER_STATUS_COLOR, type UserActivity, UserDetailDrawer, type UserDetailDrawerProps, type UserSession, type UserStatus, UsersScreen, WorkspaceSecurityScreen, type WorkspaceSecurityScreenProps, demoTextFor, departmentChildren, departmentDepth, departmentIdsWithChildren, departmentName, departmentPath, deriveStatus, effectivePermissions, emptyDraft, rolePermissions, totalUnread, useDemoText };