@nubitio/admin 1.1.1 → 1.2.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/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
1
  import React$1, { ReactNode } from "react";
2
- import { FeatureGateProps as FeatureGateProps$1 } from "@nubitio/ui";
2
+ import { FeatureGateProps as FeatureGateProps$1, ThemeProviderProps } from "@nubitio/ui";
3
3
  import { CoreRuntime } from "@nubitio/core";
4
4
  import { QueryClient } from "@tanstack/react-query";
5
-
6
5
  //#region packages/admin/FeatureHubLayout.d.ts
7
6
  interface FeatureHubTab {
8
7
  key: string;
@@ -33,17 +32,7 @@ interface FeatureHubLayoutProps {
33
32
  density?: FeatureHubDensity;
34
33
  className?: string;
35
34
  }
36
- declare function FeatureHubLayout({
37
- title,
38
- subtitle,
39
- tabs,
40
- basePath,
41
- defaultPath,
42
- banner,
43
- tabsAriaLabel,
44
- density,
45
- className
46
- }: FeatureHubLayoutProps): import("react").JSX.Element;
35
+ declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
47
36
  //#endregion
48
37
  //#region packages/admin/AdminHeader.d.ts
49
38
  interface AdminHeaderAction {
@@ -63,20 +52,14 @@ interface AdminHeaderProps {
63
52
  toggleMenu?: (e: React$1.MouseEvent<HTMLButtonElement>) => void;
64
53
  className?: string;
65
54
  actions?: AdminHeaderAction[];
55
+ /** Search, command trigger or other application-owned header content. */
56
+ content?: React$1.ReactNode;
66
57
  renderUserMenu?: (props: {
67
58
  close: () => void;
68
59
  }) => React$1.ReactNode;
69
60
  renderThemeSwitcher?: () => React$1.ReactNode;
70
61
  }
71
- declare const AdminHeader: ({
72
- title,
73
- menuToggleEnabled,
74
- toggleMenu,
75
- className,
76
- actions,
77
- renderUserMenu,
78
- renderThemeSwitcher
79
- }: AdminHeaderProps) => React$1.JSX.Element;
62
+ declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, content, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
80
63
  //#endregion
81
64
  //#region packages/admin/AdminSidebarMenu.d.ts
82
65
  interface AdminMenuSubItem {
@@ -100,14 +83,10 @@ interface AdminSidebarMenuProps {
100
83
  selectedItemChanged: (e: AdminSidebarMenuSelectEvent) => void;
101
84
  openMenu?: (e: React$1.PointerEvent) => void;
102
85
  footer?: React$1.ReactNode;
86
+ brand?: React$1.ReactNode;
87
+ context?: React$1.ReactNode;
103
88
  }
104
- declare const AdminSidebarMenu: ({
105
- items,
106
- compactMode,
107
- selectedItemChanged,
108
- openMenu,
109
- footer
110
- }: AdminSidebarMenuProps) => React$1.JSX.Element;
89
+ declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer, brand, context }: AdminSidebarMenuProps) => React$1.JSX.Element;
111
90
  //#endregion
112
91
  //#region packages/admin/AdminShell.d.ts
113
92
  interface AdminShellProps {
@@ -119,17 +98,31 @@ interface AdminShellProps {
119
98
  }) => React$1.ReactNode;
120
99
  renderThemeSwitcher?: () => React$1.ReactNode;
121
100
  footer?: React$1.ReactNode;
101
+ /** Workspace places the sidebar alongside the header on large screens. */
102
+ variant?: 'default' | 'workspace';
103
+ brand?: React$1.ReactNode;
104
+ headerContent?: React$1.ReactNode;
105
+ /** Application owns context selection (e.g. company/branch); the shell only hosts it. */
106
+ sidebarContext?: React$1.ReactNode;
107
+ /** Rendered below content on extra-small screens, without covering the scroll area. */
108
+ bottomNavigation?: React$1.ReactNode;
122
109
  children: React$1.ReactNode;
123
110
  }
124
- declare const AdminShell: ({
125
- title,
126
- menuItems,
127
- headerActions,
128
- renderUserMenu,
129
- renderThemeSwitcher,
130
- footer,
131
- children
132
- }: AdminShellProps) => React$1.JSX.Element;
111
+ declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant, brand, headerContent, sidebarContext, bottomNavigation, children }: AdminShellProps) => React$1.JSX.Element;
112
+ //#endregion
113
+ //#region packages/admin/AdminBottomNavigation.d.ts
114
+ interface AdminBottomNavigationItem {
115
+ text: string;
116
+ path: string;
117
+ icon?: string;
118
+ badge?: ReactNode;
119
+ }
120
+ interface AdminBottomNavigationProps {
121
+ /** Pass only destinations this user may access; authorization stays in the app/API. */
122
+ items: AdminBottomNavigationItem[];
123
+ label?: string;
124
+ }
125
+ declare function AdminBottomNavigation({ items, label }: AdminBottomNavigationProps): import("react").JSX.Element;
133
126
  //#endregion
134
127
  //#region packages/admin/useScreenSize.d.ts
135
128
  declare const useScreenSize: () => {
@@ -158,12 +151,16 @@ type SessionPermissionLimit = {
158
151
  };
159
152
  type SessionProfile = {
160
153
  username: string;
161
- roles: string[]; /** Present when the backend runs nubitio/admin-bundle ≥ 0.1 session contract. */
154
+ roles: string[];
155
+ /** Present when the backend runs nubitio/admin-bundle ≥ 0.1 session contract. */
162
156
  appProfile?: AppProfile;
163
157
  tenant?: SessionTenant;
164
- features?: Record<string, SessionFeatureEntitlement>; /** Effective `resource.action` names when the authorization module is on. */
165
- permissions?: string[]; /** Permission name → amount cap, as `/api/me` publishes it. */
166
- limits?: Record<string, SessionPermissionLimit>; /** IANA zone the UI must render timestamps in. Storage is always UTC. */
158
+ features?: Record<string, SessionFeatureEntitlement>;
159
+ /** Effective `resource.action` names when the authorization module is on. */
160
+ permissions?: string[];
161
+ /** Permission name → amount cap, as `/api/me` publishes it. */
162
+ limits?: Record<string, SessionPermissionLimit>;
163
+ /** IANA zone the UI must render timestamps in. Storage is always UTC. */
167
164
  timeZone?: string;
168
165
  };
169
166
  type SessionState = {
@@ -189,20 +186,12 @@ interface SessionContextValue {
189
186
  roles: string[];
190
187
  username: string | null;
191
188
  }
192
- declare function SessionProvider({
193
- apiBaseUrl,
194
- mePath,
195
- logoutPath,
196
- children
197
- }: SessionProviderConfig & {
189
+ declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
198
190
  children: React$1.ReactNode;
199
191
  }): React$1.JSX.Element;
200
192
  declare function useSession(): SessionContextValue;
201
193
  /** Seeds session state from a known profile (e.g. after a custom /api/me fetch). */
202
- declare function StaticSessionProvider({
203
- profile,
204
- children
205
- }: {
194
+ declare function StaticSessionProvider({ profile, children }: {
206
195
  profile: SessionProfile;
207
196
  children: React$1.ReactNode;
208
197
  }): React$1.JSX.Element;
@@ -213,10 +202,7 @@ declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
213
202
  //#endregion
214
203
  //#region packages/admin/features/FeatureGate.d.ts
215
204
  type FeatureGateProps = Omit<FeatureGateProps$1, 'enabled'>;
216
- declare function FeatureGate({
217
- featureKey,
218
- ...props
219
- }: FeatureGateProps): React$1.JSX.Element;
205
+ declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
220
206
  //#endregion
221
207
  //#region packages/admin/quota/QuotaUsageBanner.d.ts
222
208
  interface QuotaUsageBannerProps {
@@ -231,18 +217,7 @@ interface QuotaUsageBannerProps {
231
217
  upgradeLabel?: string;
232
218
  className?: string;
233
219
  }
234
- declare function QuotaUsageBanner({
235
- count,
236
- max,
237
- unitLabel,
238
- planLabel,
239
- atLimitMessage,
240
- nearLimitMessage,
241
- defaultMessage,
242
- upgradeHref,
243
- upgradeLabel,
244
- className
245
- }: QuotaUsageBannerProps): import("react").JSX.Element | null;
220
+ declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
246
221
  declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
247
222
  //#endregion
248
223
  //#region packages/admin/billing/PlanPanel.d.ts
@@ -272,16 +247,7 @@ interface PlanPanelProps {
272
247
  labels?: PlanPanelLabels;
273
248
  className?: string;
274
249
  }
275
- declare function PlanPanel({
276
- plans,
277
- currentPlanId,
278
- subscriptionStatus,
279
- trialEndsAt,
280
- onSelectPlan,
281
- selectingPlanId,
282
- labels,
283
- className
284
- }: PlanPanelProps): import("react").JSX.Element;
250
+ declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
285
251
  //#endregion
286
252
  //#region packages/admin/quota/parseQuotaError.d.ts
287
253
  interface ParsedQuotaError {
@@ -299,11 +265,7 @@ interface UseQuotaUsageOptions {
299
265
  collectionPath: string;
300
266
  staleTimeMs?: number;
301
267
  }
302
- declare function useQuotaUsage({
303
- featureKey,
304
- collectionPath,
305
- staleTimeMs
306
- }: UseQuotaUsageOptions): {
268
+ declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
307
269
  count: number;
308
270
  max: number;
309
271
  atLimit: boolean;
@@ -325,15 +287,12 @@ interface UseNotificationsOptions {
325
287
  staleTimeMs?: number;
326
288
  }
327
289
  /** Fetches the current user's notifications and keeps them live via Mercure — see InAppNotificationChannel on the backend. */
328
- declare function useNotifications({
329
- apiUrl,
330
- staleTimeMs
331
- }?: UseNotificationsOptions): {
290
+ declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
332
291
  items: NotificationItem[];
333
292
  unreadCount: number;
334
293
  loading: boolean;
335
294
  markAsRead: (id: NotificationItem["id"]) => void;
336
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<NotificationItem[]>, Error>>;
295
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NotificationItem[], Error>>;
337
296
  };
338
297
  //#endregion
339
298
  //#region packages/admin/notifications/NotificationPanel.d.ts
@@ -343,12 +302,7 @@ interface NotificationPanelProps extends UseNotificationsOptions {
343
302
  markAllReadLabel?: string;
344
303
  }
345
304
  /** Renders inside an AdminHeaderAction.renderPanel — see AdminHeader's `actions` prop. */
346
- declare function NotificationPanel({
347
- title,
348
- emptyTitle,
349
- markAllReadLabel,
350
- ...options
351
- }: NotificationPanelProps): React$1.JSX.Element;
305
+ declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
352
306
  //#endregion
353
307
  //#region packages/admin/auth/LoginPage.d.ts
354
308
  interface LoginOidcProvider {
@@ -365,48 +319,31 @@ interface LoginPageProps {
365
319
  oidcProviders?: LoginOidcProvider[];
366
320
  forgotPasswordTo?: string;
367
321
  }
368
- declare function LoginPage({
369
- onLoggedIn,
370
- apiBaseUrl,
371
- loginPath,
372
- title,
373
- hint,
374
- defaultUsername,
375
- oidcProviders,
376
- forgotPasswordTo
377
- }: LoginPageProps): import("react").JSX.Element;
322
+ declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
378
323
  //#endregion
379
324
  //#region packages/admin/auth/ForgotPasswordPage.d.ts
380
325
  interface ForgotPasswordPageProps {
381
326
  apiBaseUrl?: string;
382
327
  }
383
- declare function ForgotPasswordPage({
384
- apiBaseUrl
385
- }: ForgotPasswordPageProps): import("react").JSX.Element;
328
+ declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
386
329
  //#endregion
387
330
  //#region packages/admin/auth/ResetPasswordPage.d.ts
388
331
  interface ResetPasswordPageProps {
389
332
  apiBaseUrl?: string;
390
333
  }
391
- declare function ResetPasswordPage({
392
- apiBaseUrl
393
- }: ResetPasswordPageProps): import("react").JSX.Element;
334
+ declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
394
335
  //#endregion
395
336
  //#region packages/admin/auth/AcceptInvitationPage.d.ts
396
337
  interface AcceptInvitationPageProps {
397
338
  apiBaseUrl?: string;
398
339
  }
399
- declare function AcceptInvitationPage({
400
- apiBaseUrl
401
- }: AcceptInvitationPageProps): import("react").JSX.Element;
340
+ declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
402
341
  //#endregion
403
342
  //#region packages/admin/auth/AccountPage.d.ts
404
343
  interface AccountPageProps {
405
344
  apiBaseUrl?: string;
406
345
  }
407
- declare function AccountPage({
408
- apiBaseUrl
409
- }: AccountPageProps): import("react").JSX.Element;
346
+ declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
410
347
  //#endregion
411
348
  //#region packages/admin/auth/RegisterPage.d.ts
412
349
  type RegisterFieldType = 'text' | 'email' | 'password' | 'select';
@@ -443,18 +380,7 @@ interface RegisterPageProps {
443
380
  };
444
381
  loginPrompt?: string;
445
382
  }
446
- declare function RegisterPage({
447
- fields,
448
- onRegistered,
449
- apiBaseUrl,
450
- registerPath,
451
- title,
452
- hint,
453
- submitLabel,
454
- busyLabel,
455
- loginLink,
456
- loginPrompt
457
- }: RegisterPageProps): import("react").JSX.Element;
383
+ declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
458
384
  //#endregion
459
385
  //#region packages/admin/runtime/useAppRuntime.d.ts
460
386
  type NotificationType = 'success' | 'error' | 'warning' | 'info';
@@ -490,11 +416,7 @@ interface UseRuntimeConfigOptions {
490
416
  /** When false, skips the fetch (e.g. endpoint not enabled). @default true */
491
417
  enabled?: boolean;
492
418
  }
493
- declare function useRuntimeConfig({
494
- apiBaseUrl,
495
- path,
496
- enabled
497
- }?: UseRuntimeConfigOptions): {
419
+ declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
498
420
  state: RuntimeConfigState;
499
421
  config: RuntimeConfig | null;
500
422
  loading: boolean;
@@ -507,10 +429,7 @@ interface ToastHostProps {
507
429
  toasts: ToastItem[];
508
430
  onDismiss: (id: number) => void;
509
431
  }
510
- declare function ToastHost({
511
- toasts,
512
- onDismiss
513
- }: ToastHostProps): import("react").JSX.Element | null;
432
+ declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
514
433
  //#endregion
515
434
  //#region packages/admin/app/types.d.ts
516
435
  type NubitAppRoute = {
@@ -518,10 +437,12 @@ type NubitAppRoute = {
518
437
  element: ReactNode;
519
438
  };
520
439
  type NubitAppMenuSubItem = AdminMenuSubItem & {
521
- /** UX-only — hide unless the session has one of these roles. */roles?: string | string[];
440
+ /** UX-only — hide unless the session has one of these roles. */
441
+ roles?: string | string[];
522
442
  };
523
443
  type NubitAppMenuItem = Omit<AdminMenuItem, 'items'> & {
524
- /** UX-only — hide unless the session has one of these roles. */roles?: string | string[];
444
+ /** UX-only — hide unless the session has one of these roles. */
445
+ roles?: string | string[];
525
446
  items?: NubitAppMenuSubItem[];
526
447
  };
527
448
  type NubitAppMenuContext = {
@@ -540,8 +461,10 @@ type CreateNubitAppConfig = {
540
461
  homePath?: string;
541
462
  locale?: string;
542
463
  timezone?: string;
543
- currency?: string; /** Base URL for generated theme CSS files. Default `/themes/`. */
464
+ currency?: string;
465
+ /** Base URL for generated theme CSS files. Default `/themes/`. */
544
466
  themeBasePath?: string;
467
+ visualStyle?: ThemeProviderProps['visualStyle'];
545
468
  menu: NubitAppMenuItem[] | ((ctx: NubitAppMenuContext) => NubitAppMenuItem[]);
546
469
  routes: NubitAppRoute[];
547
470
  /**
@@ -558,13 +481,15 @@ type CreateNubitAppConfig = {
558
481
  label: string;
559
482
  }[];
560
483
  };
561
- shell?: Pick<AdminShellProps, 'headerActions' | 'footer'>;
484
+ shell?: Pick<AdminShellProps, 'headerActions' | 'footer' | 'variant' | 'brand' | 'headerContent' | 'sidebarContext' | 'bottomNavigation'>;
562
485
  renderThemeSwitcher?: () => ReactNode;
563
- renderUserMenu?: (ctx: NubitAppUserMenuContext) => ReactNode; /** Wraps authenticated shell content (inside Hydra providers). */
486
+ renderUserMenu?: (ctx: NubitAppUserMenuContext) => ReactNode;
487
+ /** Wraps authenticated shell content (inside Hydra providers). */
564
488
  Wrapper?: React.ComponentType<{
565
489
  children: ReactNode;
566
490
  }>;
567
- queryClient?: QueryClient; /** Register Mercure + Hydra schema/store providers. Default true. */
491
+ queryClient?: QueryClient;
492
+ /** Register Mercure + Hydra schema/store providers. Default true. */
568
493
  hydra?: boolean;
569
494
  /**
570
495
  * Show the Nubit DevTools panel (field mapping, provider tree).
@@ -590,4 +515,4 @@ declare function hasAnyRole(required: string | string[] | undefined, roles: stri
590
515
  */
591
516
  declare function filterMenuByRoles(items: NubitAppMenuItem[], roles: string[]): AdminMenuItem[];
592
517
  //#endregion
593
- export { AcceptInvitationPage, type AcceptInvitationPageProps, AccountPage, type AccountPageProps, AdminHeader, type AdminHeaderAction, type AdminHeaderProps, type AdminMenuItem, type AdminMenuSubItem, AdminShell, type AdminShellProps, AdminSidebarMenu, type AdminSidebarMenuProps, type AdminSidebarMenuSelectEvent, type AppProfile, type CreateNubitAppConfig, FeatureGate, type FeatureGateProps, type FeatureHubBanner, type FeatureHubDensity, FeatureHubLayout, type FeatureHubLayoutProps, type FeatureHubTab, ForgotPasswordPage, type ForgotPasswordPageProps, type LoginOidcProvider, LoginPage, type LoginPageProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationType, type NubitApp, type NubitAppMenuContext, type NubitAppMenuItem, type NubitAppMenuSubItem, type NubitAppRoute, type NubitAppUserMenuContext, NubitDevToolsPanel, type ParsedQuotaError, type PlanDefinition, PlanPanel, type PlanPanelLabels, type PlanPanelProps, QuotaUsageBanner, type QuotaUsageBannerProps, type RegisterField, type RegisterFieldType, RegisterPage, type RegisterPageProps, type RegisterSelectOption, ResetPasswordPage, type ResetPasswordPageProps, type RuntimeConfig, type RuntimeConfigState, type SessionContextValue, type SessionFeatureEntitlement, type SessionPermissionLimit, type SessionProfile, SessionProvider, type SessionProviderConfig, type SessionState, type SessionTenant, StaticSessionProvider, ToastHost, type ToastHostProps, type ToastItem, type UseNotificationsOptions, type UseQuotaUsageOptions, type UseRuntimeConfigOptions, createNubitApp, filterMenuByRoles, hasAnyRole, parseQuotaError, quotaErrorToastMessage, quotaUsageAboveGrid, useAppRuntime, useFeature, useFeatureConfig, useNotifications, useQuotaUsage, useRuntimeConfig, useScreenSize, useScreenSizeClass, useSession };
518
+ export { AcceptInvitationPage, type AcceptInvitationPageProps, AccountPage, type AccountPageProps, AdminBottomNavigation, type AdminBottomNavigationItem, type AdminBottomNavigationProps, AdminHeader, type AdminHeaderAction, type AdminHeaderProps, type AdminMenuItem, type AdminMenuSubItem, AdminShell, type AdminShellProps, AdminSidebarMenu, type AdminSidebarMenuProps, type AdminSidebarMenuSelectEvent, type AppProfile, type CreateNubitAppConfig, FeatureGate, type FeatureGateProps, type FeatureHubBanner, type FeatureHubDensity, FeatureHubLayout, type FeatureHubLayoutProps, type FeatureHubTab, ForgotPasswordPage, type ForgotPasswordPageProps, type LoginOidcProvider, LoginPage, type LoginPageProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationType, type NubitApp, type NubitAppMenuContext, type NubitAppMenuItem, type NubitAppMenuSubItem, type NubitAppRoute, type NubitAppUserMenuContext, NubitDevToolsPanel, type ParsedQuotaError, type PlanDefinition, PlanPanel, type PlanPanelLabels, type PlanPanelProps, QuotaUsageBanner, type QuotaUsageBannerProps, type RegisterField, type RegisterFieldType, RegisterPage, type RegisterPageProps, type RegisterSelectOption, ResetPasswordPage, type ResetPasswordPageProps, type RuntimeConfig, type RuntimeConfigState, type SessionContextValue, type SessionFeatureEntitlement, type SessionPermissionLimit, type SessionProfile, SessionProvider, type SessionProviderConfig, type SessionState, type SessionTenant, StaticSessionProvider, ToastHost, type ToastHostProps, type ToastItem, type UseNotificationsOptions, type UseQuotaUsageOptions, type UseRuntimeConfigOptions, createNubitApp, filterMenuByRoles, hasAnyRole, parseQuotaError, quotaErrorToastMessage, quotaUsageAboveGrid, useAppRuntime, useFeature, useFeatureConfig, useNotifications, useQuotaUsage, useRuntimeConfig, useScreenSize, useScreenSizeClass, useSession };