@tailor-platform/app-shell 0.20.1 → 0.21.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.
- package/dist/app-shell.css +1 -1
- package/dist/app-shell.js +569 -523
- package/dist/index.d.ts +44 -15
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { AuthState } from '@tailor-platform/auth-browser-client';
|
|
|
2
2
|
import { DocumentNode } from 'graphql';
|
|
3
3
|
import { JSX } from 'react/jsx-runtime';
|
|
4
4
|
import { Link } from 'react-router';
|
|
5
|
+
import { LoaderFunctionArgs } from 'react-router';
|
|
6
|
+
import { Params } from 'react-router';
|
|
5
7
|
import { ReactNode } from 'react';
|
|
6
8
|
import { useLocation } from 'react-router';
|
|
7
9
|
import { useNavigate } from 'react-router';
|
|
@@ -9,13 +11,40 @@ import { useParams } from 'react-router';
|
|
|
9
11
|
import { useRouteError } from 'react-router';
|
|
10
12
|
import { useSearchParams } from 'react-router';
|
|
11
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Context provided to access control functions
|
|
16
|
+
*/
|
|
17
|
+
declare type AccessContext = {
|
|
18
|
+
params: Params;
|
|
19
|
+
searchParams: URLSearchParams;
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare type AccessControl = (context: AccessContext) => Promise<AccessResult> | AccessResult;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Result of access control evaluation
|
|
27
|
+
*/
|
|
28
|
+
declare type AccessResult =
|
|
29
|
+
/**
|
|
30
|
+
* Resource is visible and accessible
|
|
31
|
+
*/
|
|
32
|
+
{
|
|
33
|
+
state: "visible";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resource is hidden and not accessible
|
|
37
|
+
*/
|
|
38
|
+
| {
|
|
39
|
+
state: "hidden";
|
|
40
|
+
};
|
|
41
|
+
|
|
12
42
|
export declare const AppShell: (props: AppShellProps) => JSX.Element | null;
|
|
13
43
|
|
|
14
44
|
declare type AppShellContextType = {
|
|
15
45
|
title?: string;
|
|
16
46
|
icon?: ReactNode;
|
|
17
47
|
configurations: RootConfiguration;
|
|
18
|
-
navItems: Array<NavItem>;
|
|
19
48
|
};
|
|
20
49
|
|
|
21
50
|
export declare type AppShellProps = React.PropsWithChildren<{
|
|
@@ -212,6 +241,10 @@ declare type AuthProviderProps = {
|
|
|
212
241
|
export declare interface AuthRegister {
|
|
213
242
|
}
|
|
214
243
|
|
|
244
|
+
/**
|
|
245
|
+
* CommandPalette component that uses navigation items with access control.
|
|
246
|
+
* Renders a searchable command palette UI triggered by Cmd+K / Ctrl+K.
|
|
247
|
+
*/
|
|
215
248
|
export declare function CommandPalette(): JSX.Element;
|
|
216
249
|
|
|
217
250
|
declare type CommonModuleProps = {
|
|
@@ -246,6 +279,10 @@ declare type CommonProps = {
|
|
|
246
279
|
* Metadata for the resource.
|
|
247
280
|
*/
|
|
248
281
|
meta?: ResourceMetaProps;
|
|
282
|
+
/**
|
|
283
|
+
* Access guard to control visibility and access of this module and its resources.
|
|
284
|
+
*/
|
|
285
|
+
accessControl?: AccessControl;
|
|
249
286
|
};
|
|
250
287
|
|
|
251
288
|
export declare const DefaultSidebar: (props: DefaultSidebarProps) => JSX.Element;
|
|
@@ -492,6 +529,8 @@ declare type LabelValue = string | ((props: any) => string);
|
|
|
492
529
|
|
|
493
530
|
export { Link }
|
|
494
531
|
|
|
532
|
+
declare type LoaderHandler = (args: LoaderFunctionArgs) => Promise<unknown> | unknown;
|
|
533
|
+
|
|
495
534
|
declare type LocalizedString = string | ((locale: string) => string);
|
|
496
535
|
|
|
497
536
|
/**
|
|
@@ -504,25 +543,13 @@ declare type Module = Omit<CommonPageResource, "meta"> & {
|
|
|
504
543
|
menuItemClickable: boolean;
|
|
505
544
|
};
|
|
506
545
|
resources: Array<Resource>;
|
|
507
|
-
loader?: () => Response;
|
|
508
546
|
errorBoundary: ErrorBoundaryComponent;
|
|
547
|
+
accessControl?: AccessControl;
|
|
548
|
+
loader?: LoaderHandler;
|
|
509
549
|
};
|
|
510
550
|
|
|
511
551
|
declare type Modules = Array<Module>;
|
|
512
552
|
|
|
513
|
-
declare type NavChildItem = {
|
|
514
|
-
title: string;
|
|
515
|
-
url: string;
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
declare type NavItem = {
|
|
519
|
-
title: string;
|
|
520
|
-
url: string | undefined;
|
|
521
|
-
icon: ReactNode;
|
|
522
|
-
isActive?: boolean;
|
|
523
|
-
items?: Array<NavChildItem>;
|
|
524
|
-
};
|
|
525
|
-
|
|
526
553
|
declare type ReactResourceProps = {
|
|
527
554
|
/**
|
|
528
555
|
* React component to render.
|
|
@@ -565,6 +592,8 @@ declare type Resource = CommonPageResource & {
|
|
|
565
592
|
_type: "resource";
|
|
566
593
|
subResources?: Array<Resource>;
|
|
567
594
|
errorBoundary: ErrorBoundaryComponent;
|
|
595
|
+
accessControl?: AccessControl;
|
|
596
|
+
loader?: LoaderHandler;
|
|
568
597
|
};
|
|
569
598
|
|
|
570
599
|
export declare type ResourceComponentProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/app-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./styles": "./dist/app-shell.css",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
25
25
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
26
26
|
"@radix-ui/react-label": "^2.1.8",
|
|
27
|
-
"@radix-ui/react-navigation-menu": "^1.2.
|
|
27
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
28
28
|
"@radix-ui/react-popover": "^1.1.15",
|
|
29
29
|
"@radix-ui/react-select": "^2.1.6",
|
|
30
30
|
"@radix-ui/react-separator": "^1.1.8",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vite": "^7.3.0",
|
|
65
65
|
"vite-plugin-dts": "^4.5.0",
|
|
66
66
|
"vite-plugin-externalize-deps": "^0.10.0",
|
|
67
|
-
"vite-tsconfig-paths": "^
|
|
67
|
+
"vite-tsconfig-paths": "^6.0.4",
|
|
68
68
|
"vitest": "^4.0.16"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|