@etsoo/toolpad 1.0.12 → 1.0.13
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/babel.config.json +11 -0
- package/build/cjs/Account/Account.js +104 -0
- package/build/cjs/Account/Account.test.js +40 -0
- package/build/cjs/Account/AccountPopoverFooter.js +18 -0
- package/build/cjs/Account/AccountPopoverHeader.js +12 -0
- package/build/cjs/Account/AccountPreview.js +96 -0
- package/build/cjs/Account/AccountPreview.test.js +52 -0
- package/build/cjs/Account/SignInButton.js +56 -0
- package/build/cjs/Account/SignOutButton.js +58 -0
- package/build/cjs/Account/index.js +22 -0
- package/build/cjs/AppProvider/AppProvider.js +40 -0
- package/build/cjs/AppProvider/AppProvider.test.js +18 -0
- package/build/cjs/AppProvider/AppProviderComponent.js +33 -0
- package/build/cjs/AppProvider/AppThemeProvider.js +111 -0
- package/build/cjs/AppProvider/index.js +17 -0
- package/build/cjs/DashboardLayout/DashboardLayout.js +230 -0
- package/build/cjs/DashboardLayout/DashboardLayout.test.js +296 -0
- package/build/cjs/DashboardLayout/DashboardSidebarSubNavigation.js +185 -0
- package/build/cjs/DashboardLayout/ThemeSwitcher.js +84 -0
- package/build/cjs/DashboardLayout/TitleBar.d.ts +2 -0
- package/build/cjs/DashboardLayout/TitleBar.js +57 -0
- package/build/cjs/DashboardLayout/ToolbarActions.js +11 -0
- package/build/cjs/DashboardLayout/index.js +19 -0
- package/build/cjs/DashboardLayout/utils.js +20 -0
- package/build/{PageContainer → cjs/PageContainer}/PageContainer.d.ts +4 -0
- package/build/cjs/PageContainer/PageContainer.js +133 -0
- package/build/cjs/PageContainer/PageContainer.test.js +128 -0
- package/build/cjs/PageContainer/PageContainerToolbar.js +26 -0
- package/build/cjs/PageContainer/PageContainerToolbar.test.js +15 -0
- package/build/cjs/PageContainer/index.js +18 -0
- package/build/cjs/index.js +24 -0
- package/build/cjs/nextjs/AppProvider.js +18 -0
- package/build/cjs/nextjs/AppProvider.test.js +71 -0
- package/build/cjs/nextjs/AppProviderNextApp.js +63 -0
- package/build/cjs/nextjs/AppProviderNextPages.js +73 -0
- package/build/cjs/nextjs/index.js +17 -0
- package/build/cjs/persistence/codec.js +60 -0
- package/build/cjs/persistence/index.js +17 -0
- package/build/cjs/persistence/useStorageState.js +153 -0
- package/build/cjs/persistence/useStorageState.test.js +63 -0
- package/build/cjs/react-router-dom/AppProvider.js +64 -0
- package/build/cjs/react-router-dom/AppProvider.test.js +14 -0
- package/build/cjs/react-router-dom/index.js +17 -0
- package/build/cjs/shared/Link.js +55 -0
- package/build/cjs/shared/components.js +30 -0
- package/build/cjs/shared/context.js +46 -0
- package/build/cjs/shared/locales/LocaleContext.js +71 -0
- package/build/cjs/shared/navigation.js +151 -0
- package/build/cjs/useActivePage/index.js +17 -0
- package/build/cjs/useActivePage/useActivePage.js +83 -0
- package/build/cjs/useLocalStorageState/index.js +17 -0
- package/build/cjs/useLocalStorageState/useLocalStorageState.js +17 -0
- package/build/cjs/useSessionStorageState/index.js +17 -0
- package/build/cjs/useSessionStorageState/useSessionStorageState.js +17 -0
- package/build/cjs/utils/collections.js +53 -0
- package/build/cjs/utils/describeConformance.js +6 -0
- package/build/cjs/utils/events.js +58 -0
- package/build/cjs/utils/hooks/index.js +10 -0
- package/build/cjs/utils/hooks/useBoolean.js +47 -0
- package/build/cjs/utils/hooks/useDebounced.js +64 -0
- package/build/cjs/utils/hooks/useDebouncedHandler.js +77 -0
- package/build/cjs/utils/hooks/useLatest.js +44 -0
- package/build/cjs/utils/hooks/usePageTitle.js +49 -0
- package/build/cjs/utils/hooks/useSsr.js +52 -0
- package/build/cjs/utils/hooks/useStorageState.js +86 -0
- package/build/cjs/utils/warnOnce.js +14 -0
- package/build/mjs/Account/Account.d.ts +63 -0
- package/build/mjs/Account/Account.test.d.ts +1 -0
- package/build/mjs/Account/AccountPopoverFooter.d.ts +6 -0
- package/build/mjs/Account/AccountPopoverHeader.d.ts +6 -0
- package/build/mjs/Account/AccountPreview.d.ts +64 -0
- package/build/mjs/Account/AccountPreview.test.d.ts +1 -0
- package/build/mjs/Account/SignInButton.d.ts +2 -0
- package/build/mjs/Account/SignOutButton.d.ts +3 -0
- package/build/mjs/Account/index.js +6 -0
- package/build/mjs/AppProvider/AppProvider.d.ts +105 -0
- package/build/mjs/AppProvider/AppProvider.test.d.ts +4 -0
- package/build/mjs/AppProvider/AppProviderComponent.d.ts +14 -0
- package/build/mjs/AppProvider/AppThemeProvider.d.ts +12 -0
- package/build/mjs/DashboardLayout/DashboardLayout.d.ts +91 -0
- package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.js +9 -10
- package/build/mjs/DashboardLayout/DashboardLayout.test.d.ts +1 -0
- package/build/mjs/DashboardLayout/DashboardSidebarSubNavigation.d.ts +16 -0
- package/build/mjs/DashboardLayout/ThemeSwitcher.d.ts +5 -0
- package/build/mjs/DashboardLayout/TitleBar.d.ts +2 -0
- package/build/mjs/DashboardLayout/ToolbarActions.d.ts +5 -0
- package/build/mjs/DashboardLayout/index.d.ts +2 -0
- package/build/mjs/DashboardLayout/utils.d.ts +8 -0
- package/build/mjs/PageContainer/PageContainer.d.ts +61 -0
- package/build/{PageContainer → mjs/PageContainer}/PageContainer.js +8 -4
- package/build/mjs/PageContainer/PageContainer.test.d.ts +1 -0
- package/build/mjs/PageContainer/PageContainerToolbar.d.ts +16 -0
- package/build/mjs/PageContainer/PageContainerToolbar.test.d.ts +1 -0
- package/build/mjs/PageContainer/index.js +2 -0
- package/build/mjs/index.js +8 -0
- package/build/mjs/nextjs/AppProvider.d.ts +6 -0
- package/build/mjs/nextjs/AppProvider.test.d.ts +1 -0
- package/build/mjs/nextjs/AppProviderNextApp.d.ts +5 -0
- package/build/mjs/nextjs/AppProviderNextPages.d.ts +5 -0
- package/build/mjs/nextjs/index.js +1 -0
- package/build/mjs/persistence/codec.d.ts +47 -0
- package/build/mjs/persistence/index.js +1 -0
- package/build/mjs/persistence/useStorageState.d.ts +50 -0
- package/build/mjs/persistence/useStorageState.test.d.ts +1 -0
- package/build/mjs/react-router-dom/AppProvider.d.ts +6 -0
- package/build/mjs/react-router-dom/AppProvider.test.d.ts +1 -0
- package/build/mjs/react-router-dom/index.d.ts +1 -0
- package/build/mjs/react-router-dom/index.js +1 -0
- package/build/mjs/shared/Link.d.ts +8 -0
- package/build/mjs/shared/components.d.ts +5 -0
- package/build/mjs/shared/context.d.ts +12 -0
- package/build/mjs/shared/locales/LocaleContext.d.ts +56 -0
- package/build/mjs/shared/navigation.d.ts +16 -0
- package/build/mjs/useActivePage/index.js +1 -0
- package/build/mjs/useActivePage/useActivePage.d.ts +8 -0
- package/build/mjs/useLocalStorageState/index.js +1 -0
- package/build/mjs/useLocalStorageState/useLocalStorageState.d.ts +2 -0
- package/build/mjs/useSessionStorageState/index.js +1 -0
- package/build/mjs/useSessionStorageState/useSessionStorageState.d.ts +2 -0
- package/build/mjs/utils/collections.d.ts +44 -0
- package/build/mjs/utils/describeConformance.d.ts +7 -0
- package/build/mjs/utils/events.d.ts +27 -0
- package/build/mjs/utils/hooks/index.js +2 -0
- package/build/mjs/utils/hooks/useBoolean.d.ts +11 -0
- package/build/mjs/utils/hooks/useDebounced.d.ts +8 -0
- package/build/mjs/utils/hooks/useDebouncedHandler.d.ts +12 -0
- package/build/mjs/utils/hooks/useLatest.d.ts +6 -0
- package/build/mjs/utils/hooks/usePageTitle.d.ts +4 -0
- package/build/mjs/utils/hooks/useSsr.d.ts +4 -0
- package/build/mjs/utils/hooks/useStorageState.d.ts +10 -0
- package/build/mjs/utils/warnOnce.d.ts +5 -0
- package/package.json +33 -23
- package/src/DashboardLayout/DashboardLayout.tsx +13 -12
- package/src/PageContainer/PageContainer.tsx +12 -4
- package/tsconfig.cjs.json +20 -0
- package/tsconfig.json +2 -2
- package/build/DashboardLayout/TitleBar.d.ts +0 -2
- /package/build/{Account → cjs/Account}/Account.d.ts +0 -0
- /package/build/{Account → cjs/Account}/Account.test.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPopoverFooter.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPopoverHeader.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPreview.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPreview.test.d.ts +0 -0
- /package/build/{Account → cjs/Account}/SignInButton.d.ts +0 -0
- /package/build/{Account → cjs/Account}/SignOutButton.d.ts +0 -0
- /package/build/{Account → cjs/Account}/index.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProvider.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProvider.test.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProviderComponent.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppThemeProvider.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/index.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.test.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardSidebarSubNavigation.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/ThemeSwitcher.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/ToolbarActions.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/index.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/utils.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainer.test.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.test.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/index.d.ts +0 -0
- /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProvider.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProvider.test.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProviderNextApp.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProviderNextPages.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/index.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/codec.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/index.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/useStorageState.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/useStorageState.test.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.test.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/index.d.ts +0 -0
- /package/build/{shared → cjs/shared}/Link.d.ts +0 -0
- /package/build/{shared → cjs/shared}/components.d.ts +0 -0
- /package/build/{shared → cjs/shared}/context.d.ts +0 -0
- /package/build/{shared → cjs/shared}/locales/LocaleContext.d.ts +0 -0
- /package/build/{shared → cjs/shared}/navigation.d.ts +0 -0
- /package/build/{useActivePage → cjs/useActivePage}/index.d.ts +0 -0
- /package/build/{useActivePage → cjs/useActivePage}/useActivePage.d.ts +0 -0
- /package/build/{useLocalStorageState → cjs/useLocalStorageState}/index.d.ts +0 -0
- /package/build/{useLocalStorageState → cjs/useLocalStorageState}/useLocalStorageState.d.ts +0 -0
- /package/build/{useSessionStorageState → cjs/useSessionStorageState}/index.d.ts +0 -0
- /package/build/{useSessionStorageState → cjs/useSessionStorageState}/useSessionStorageState.d.ts +0 -0
- /package/build/{utils → cjs/utils}/collections.d.ts +0 -0
- /package/build/{utils → cjs/utils}/describeConformance.d.ts +0 -0
- /package/build/{utils → cjs/utils}/events.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/index.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useBoolean.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useDebounced.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useDebouncedHandler.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useLatest.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/usePageTitle.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useSsr.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useStorageState.d.ts +0 -0
- /package/build/{utils → cjs/utils}/warnOnce.d.ts +0 -0
- /package/build/{Account → mjs/Account}/Account.js +0 -0
- /package/build/{Account → mjs/Account}/Account.test.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPopoverFooter.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPopoverHeader.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPreview.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPreview.test.js +0 -0
- /package/build/{Account → mjs/Account}/SignInButton.js +0 -0
- /package/build/{Account → mjs/Account}/SignOutButton.js +0 -0
- /package/build/{Account/index.js → mjs/Account/index.d.ts} +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProvider.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProvider.test.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProviderComponent.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppThemeProvider.js +0 -0
- /package/build/{AppProvider/index.js → mjs/AppProvider/index.d.ts} +0 -0
- /package/build/{nextjs → mjs/AppProvider}/index.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.test.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardSidebarSubNavigation.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/ThemeSwitcher.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/TitleBar.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/ToolbarActions.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/index.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/utils.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainer.test.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.test.js +0 -0
- /package/build/{PageContainer/index.js → mjs/PageContainer/index.d.ts} +0 -0
- /package/build/{index.js → mjs/index.d.ts} +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProvider.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProvider.test.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProviderNextApp.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProviderNextPages.js +0 -0
- /package/build/{react-router-dom/index.js → mjs/nextjs/index.d.ts} +0 -0
- /package/build/{persistence → mjs/persistence}/codec.js +0 -0
- /package/build/{persistence/index.js → mjs/persistence/index.d.ts} +0 -0
- /package/build/{persistence → mjs/persistence}/useStorageState.js +0 -0
- /package/build/{persistence → mjs/persistence}/useStorageState.test.js +0 -0
- /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.js +0 -0
- /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.test.js +0 -0
- /package/build/{shared → mjs/shared}/Link.js +0 -0
- /package/build/{shared → mjs/shared}/components.js +0 -0
- /package/build/{shared → mjs/shared}/context.js +0 -0
- /package/build/{shared → mjs/shared}/locales/LocaleContext.js +0 -0
- /package/build/{shared → mjs/shared}/navigation.js +0 -0
- /package/build/{useActivePage/index.js → mjs/useActivePage/index.d.ts} +0 -0
- /package/build/{useActivePage → mjs/useActivePage}/useActivePage.js +0 -0
- /package/build/{useLocalStorageState/index.js → mjs/useLocalStorageState/index.d.ts} +0 -0
- /package/build/{useLocalStorageState → mjs/useLocalStorageState}/useLocalStorageState.js +0 -0
- /package/build/{useSessionStorageState/index.js → mjs/useSessionStorageState/index.d.ts} +0 -0
- /package/build/{useSessionStorageState → mjs/useSessionStorageState}/useSessionStorageState.js +0 -0
- /package/build/{utils → mjs/utils}/collections.js +0 -0
- /package/build/{utils → mjs/utils}/describeConformance.js +0 -0
- /package/build/{utils → mjs/utils}/events.js +0 -0
- /package/build/{utils/hooks/index.js → mjs/utils/hooks/index.d.ts} +0 -0
- /package/build/{utils → mjs/utils}/hooks/useBoolean.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useDebounced.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useDebouncedHandler.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useLatest.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/usePageTitle.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useSsr.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useStorageState.js +0 -0
- /package/build/{utils → mjs/utils}/warnOnce.js +0 -0
- /package/{vite.config.ts → vite.config.mts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.AppProvider = AppProvider;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
41
|
+
const AppProviderComponent_1 = require("../AppProvider/AppProviderComponent");
|
|
42
|
+
/**
|
|
43
|
+
* @ignore - internal component.
|
|
44
|
+
*/
|
|
45
|
+
function AppProvider(props) {
|
|
46
|
+
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
47
|
+
const [searchParams] = (0, react_router_dom_1.useSearchParams)();
|
|
48
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
49
|
+
const navigateImpl = React.useCallback((url, { history = "auto" } = {}) => {
|
|
50
|
+
if (history === "auto" || history === "push") {
|
|
51
|
+
return navigate(url);
|
|
52
|
+
}
|
|
53
|
+
if (history === "replace") {
|
|
54
|
+
return navigate(url, { replace: true });
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Invalid history option: ${history}`);
|
|
57
|
+
}, [navigate]);
|
|
58
|
+
const routerImpl = React.useMemo(() => ({
|
|
59
|
+
pathname,
|
|
60
|
+
searchParams,
|
|
61
|
+
navigate: navigateImpl
|
|
62
|
+
}), [pathname, searchParams, navigateImpl]);
|
|
63
|
+
return (0, jsx_runtime_1.jsx)(AppProviderComponent_1.AppProvider, { router: routerImpl, ...props });
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const react_1 = require("@testing-library/react");
|
|
6
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
7
|
+
const AppProvider_1 = require("./AppProvider");
|
|
8
|
+
(0, vitest_1.describe)("React Router AppProvider", () => {
|
|
9
|
+
(0, vitest_1.test)("renders content correctly", async () => {
|
|
10
|
+
// placeholder test
|
|
11
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(AppProvider_1.AppProvider, { children: "Hello" }) }));
|
|
12
|
+
(0, vitest_1.expect)(react_1.screen.getByText("Hello")).toBeTruthy();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AppProvider"), exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Link = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const context_1 = require("./context");
|
|
40
|
+
exports.Link = React.forwardRef(function Link(props, ref) {
|
|
41
|
+
const { children, href, onClick, history, ...rest } = props;
|
|
42
|
+
const routerContext = React.useContext(context_1.RouterContext);
|
|
43
|
+
const handleLinkClick = React.useMemo(() => {
|
|
44
|
+
if (!routerContext) {
|
|
45
|
+
return onClick;
|
|
46
|
+
}
|
|
47
|
+
return (event) => {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
const url = new URL(event.currentTarget.href);
|
|
50
|
+
routerContext.navigate(url.pathname, { history });
|
|
51
|
+
onClick?.(event);
|
|
52
|
+
};
|
|
53
|
+
}, [routerContext, onClick, history]);
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)("a", { ref: ref, href: href, ...rest, onClick: handleLinkClick, children: children }));
|
|
55
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ErrorOverlay = ErrorOverlay;
|
|
7
|
+
exports.LoadingOverlay = LoadingOverlay;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const Error_1 = __importDefault(require("@mui/icons-material/Error"));
|
|
11
|
+
const OverlayRoot = (0, material_1.styled)("div")(({ theme }) => ({
|
|
12
|
+
position: "absolute",
|
|
13
|
+
inset: "0 0 0 0",
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
padding: theme.spacing(2)
|
|
19
|
+
}));
|
|
20
|
+
function ErrorOverlay({ error }) {
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)(OverlayRoot, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "h6", sx: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
gap: 1,
|
|
25
|
+
alignItems: "center"
|
|
26
|
+
}, children: [(0, jsx_runtime_1.jsx)(Error_1.default, { color: "error" }), " Error"] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", children: error?.message ?? "Unknown error" })] }));
|
|
27
|
+
}
|
|
28
|
+
function LoadingOverlay() {
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(OverlayRoot, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}) }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WindowContext = exports.RouterContext = exports.PaletteModeContext = exports.NavigationContext = exports.BrandingContext = void 0;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
exports.BrandingContext = React.createContext(null);
|
|
39
|
+
exports.NavigationContext = React.createContext([]);
|
|
40
|
+
exports.PaletteModeContext = React.createContext({
|
|
41
|
+
paletteMode: "light",
|
|
42
|
+
setPaletteMode: () => { },
|
|
43
|
+
isDualTheme: false
|
|
44
|
+
});
|
|
45
|
+
exports.RouterContext = React.createContext(null);
|
|
46
|
+
exports.WindowContext = React.createContext(undefined);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.LocaleContext = void 0;
|
|
38
|
+
exports.LocaleProvider = LocaleProvider;
|
|
39
|
+
exports.useLocaleText = useLocaleText;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const React = __importStar(require("react"));
|
|
42
|
+
const DEFAULT_LOCALE_TEXT = {
|
|
43
|
+
// Account
|
|
44
|
+
signInLabel: "Sign In",
|
|
45
|
+
signOutLabel: "Sign Out",
|
|
46
|
+
// Account Preview
|
|
47
|
+
accountIconButtonAriaLabel: "Current User",
|
|
48
|
+
// Menu
|
|
49
|
+
expandMenuTitle: "Expand menu",
|
|
50
|
+
expandNavMenuAriaLabel: "Expand navigation menu",
|
|
51
|
+
collapseMenuTitle: "Collapse menu",
|
|
52
|
+
collapseNavMenuAriaLabel: "Collapse navigation menu",
|
|
53
|
+
// Theme
|
|
54
|
+
switchModeTitle: "Switch mode",
|
|
55
|
+
darkModeTitle: "Dark mode",
|
|
56
|
+
lightModeTitle: "Light mode",
|
|
57
|
+
switchThemeModeAriaLabel: "Switch theme mode",
|
|
58
|
+
switchToDarkModeAriaLabel: "Switch to dark mode",
|
|
59
|
+
switchToLightModeAriaLabel: "Switch to light mode"
|
|
60
|
+
};
|
|
61
|
+
exports.LocaleContext = React.createContext(DEFAULT_LOCALE_TEXT);
|
|
62
|
+
/**
|
|
63
|
+
* @ignore - internal component.
|
|
64
|
+
*/
|
|
65
|
+
function LocaleProvider({ localeText, children }) {
|
|
66
|
+
const mergedLocaleText = React.useMemo(() => ({ ...DEFAULT_LOCALE_TEXT, ...localeText }), [localeText]);
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(exports.LocaleContext.Provider, { value: mergedLocaleText, children: children }));
|
|
68
|
+
}
|
|
69
|
+
function useLocaleText() {
|
|
70
|
+
return React.useContext(exports.LocaleContext);
|
|
71
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getItemTitle = exports.isPageItem = exports.getItemKind = void 0;
|
|
7
|
+
exports.getPageItemFullPath = getPageItemFullPath;
|
|
8
|
+
exports.isPageItemSelected = isPageItemSelected;
|
|
9
|
+
exports.hasSelectedNavigationChildren = hasSelectedNavigationChildren;
|
|
10
|
+
exports.matchPath = matchPath;
|
|
11
|
+
exports.getItemPath = getItemPath;
|
|
12
|
+
const path_to_regexp_1 = require("path-to-regexp");
|
|
13
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
14
|
+
const getItemKind = (item) => item.kind ?? "page";
|
|
15
|
+
exports.getItemKind = getItemKind;
|
|
16
|
+
const isPageItem = (item) => (0, exports.getItemKind)(item) === "page";
|
|
17
|
+
exports.isPageItem = isPageItem;
|
|
18
|
+
const getItemTitle = (item) => {
|
|
19
|
+
return (0, exports.isPageItem)(item) ? item.title ?? item.segment ?? "" : item.title;
|
|
20
|
+
};
|
|
21
|
+
exports.getItemTitle = getItemTitle;
|
|
22
|
+
function getPageItemFullPath(basePath, navigationItem) {
|
|
23
|
+
return `${basePath}${basePath && !navigationItem.segment ? "" : "/"}${navigationItem.segment ?? ""}`;
|
|
24
|
+
}
|
|
25
|
+
function isPageItemSelected(navigationItem, basePath, pathname) {
|
|
26
|
+
if (navigationItem.pattern) {
|
|
27
|
+
return (0, path_to_regexp_1.pathToRegexp)(`${basePath}/${navigationItem.pattern}`).test(pathname);
|
|
28
|
+
}
|
|
29
|
+
if (navigationItem.subs) {
|
|
30
|
+
return navigationItem.subs.some((sub) => new RegExp(sub).test(pathname));
|
|
31
|
+
}
|
|
32
|
+
return getPageItemFullPath(basePath, navigationItem) === pathname;
|
|
33
|
+
}
|
|
34
|
+
function hasSelectedNavigationChildren(navigationItem, basePath, pathname) {
|
|
35
|
+
if ((0, exports.isPageItem)(navigationItem) && navigationItem.children) {
|
|
36
|
+
const navigationItemFullPath = getPageItemFullPath(basePath, navigationItem);
|
|
37
|
+
return navigationItem.children.some((nestedNavigationItem) => {
|
|
38
|
+
if (!(0, exports.isPageItem)(nestedNavigationItem)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (nestedNavigationItem.children) {
|
|
42
|
+
return hasSelectedNavigationChildren(nestedNavigationItem, navigationItemFullPath, pathname);
|
|
43
|
+
}
|
|
44
|
+
return isPageItemSelected(nestedNavigationItem, navigationItemFullPath, pathname);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Builds a map of navigation page items to their respective paths. This map is used to quickly
|
|
51
|
+
* lookup the path of a navigation item. It will be cached for the lifetime of the navigation.
|
|
52
|
+
*/
|
|
53
|
+
function buildItemToPathMap(navigation) {
|
|
54
|
+
const map = new Map();
|
|
55
|
+
const visit = (item, base) => {
|
|
56
|
+
if ((0, exports.isPageItem)(item)) {
|
|
57
|
+
const path = `${base}${item.segment ? `/${item.segment}` : ""}` || "/";
|
|
58
|
+
map.set(item, path);
|
|
59
|
+
if (item.children) {
|
|
60
|
+
for (const child of item.children) {
|
|
61
|
+
visit(child, path);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
for (const item of navigation) {
|
|
67
|
+
visit(item, "");
|
|
68
|
+
}
|
|
69
|
+
return map;
|
|
70
|
+
}
|
|
71
|
+
const itemToPathMapCache = new WeakMap();
|
|
72
|
+
/**
|
|
73
|
+
* Gets the cached map of navigation page items to their respective paths.
|
|
74
|
+
*/
|
|
75
|
+
function getItemToPathMap(navigation) {
|
|
76
|
+
let map = itemToPathMapCache.get(navigation);
|
|
77
|
+
if (!map) {
|
|
78
|
+
map = buildItemToPathMap(navigation);
|
|
79
|
+
itemToPathMapCache.set(navigation, map);
|
|
80
|
+
}
|
|
81
|
+
return map;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build a lookup map of paths to navigation items. This map is used to match paths against
|
|
85
|
+
* to find the active page.
|
|
86
|
+
*/
|
|
87
|
+
function buildItemLookup(navigation) {
|
|
88
|
+
const map = new Map();
|
|
89
|
+
const visit = (item) => {
|
|
90
|
+
if ((0, exports.isPageItem)(item)) {
|
|
91
|
+
const path = getItemPath(navigation, item);
|
|
92
|
+
if (map.has(path)) {
|
|
93
|
+
console.warn(`Duplicate path in navigation: ${path}`);
|
|
94
|
+
}
|
|
95
|
+
map.set(path, item);
|
|
96
|
+
if (item.pattern) {
|
|
97
|
+
const basePath = item.segment
|
|
98
|
+
? path.slice(0, -item.segment.length)
|
|
99
|
+
: path;
|
|
100
|
+
map.set((0, path_to_regexp_1.pathToRegexp)(basePath + item.pattern), item);
|
|
101
|
+
}
|
|
102
|
+
if (item.children) {
|
|
103
|
+
for (const child of item.children) {
|
|
104
|
+
visit(child);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
for (const item of navigation) {
|
|
110
|
+
visit(item);
|
|
111
|
+
}
|
|
112
|
+
return map;
|
|
113
|
+
}
|
|
114
|
+
const itemLookupMapCache = new WeakMap();
|
|
115
|
+
function getItemLookup(navigation) {
|
|
116
|
+
let map = itemLookupMapCache.get(navigation);
|
|
117
|
+
if (!map) {
|
|
118
|
+
map = buildItemLookup(navigation);
|
|
119
|
+
itemLookupMapCache.set(navigation, map);
|
|
120
|
+
}
|
|
121
|
+
return map;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Matches a path against the navigation to find the active page. i.e. the page that should be
|
|
125
|
+
* marked as selected in the navigation.
|
|
126
|
+
*/
|
|
127
|
+
function matchPath(navigation, path) {
|
|
128
|
+
const lookup = getItemLookup(navigation);
|
|
129
|
+
for (const [key, item] of lookup.entries()) {
|
|
130
|
+
if (typeof key === "string") {
|
|
131
|
+
if (key === path)
|
|
132
|
+
return item;
|
|
133
|
+
else if (item.subs?.some((sub) => new RegExp(sub).test(path)))
|
|
134
|
+
return item;
|
|
135
|
+
}
|
|
136
|
+
else if (key instanceof RegExp) {
|
|
137
|
+
if (key.test(path))
|
|
138
|
+
return item;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets the path for a specific navigation page item.
|
|
145
|
+
*/
|
|
146
|
+
function getItemPath(navigation, item) {
|
|
147
|
+
const map = getItemToPathMap(navigation);
|
|
148
|
+
const path = map.get(item);
|
|
149
|
+
(0, invariant_1.default)(path, `Item not found in navigation: ${item.title}`);
|
|
150
|
+
return path;
|
|
151
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useActivePage"), exports);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useActivePage = useActivePage;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const context_1 = require("../shared/context");
|
|
40
|
+
const navigation_1 = require("../shared/navigation");
|
|
41
|
+
function useActivePage() {
|
|
42
|
+
const navigationContext = React.useContext(context_1.NavigationContext);
|
|
43
|
+
const routerContext = React.useContext(context_1.RouterContext);
|
|
44
|
+
const pathname = routerContext?.pathname ?? "/";
|
|
45
|
+
const activeItem = (0, navigation_1.matchPath)(navigationContext, pathname);
|
|
46
|
+
const rootItem = (0, navigation_1.matchPath)(navigationContext, "/");
|
|
47
|
+
return React.useMemo(() => {
|
|
48
|
+
if (!activeItem) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const breadcrumbs = [];
|
|
52
|
+
if (rootItem) {
|
|
53
|
+
breadcrumbs.push({
|
|
54
|
+
title: (0, navigation_1.getItemTitle)(rootItem),
|
|
55
|
+
path: "/"
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
59
|
+
let prefix = "";
|
|
60
|
+
for (const segment of segments) {
|
|
61
|
+
const path = `${prefix}/${segment}`;
|
|
62
|
+
prefix = path;
|
|
63
|
+
const item = (0, navigation_1.matchPath)(navigationContext, path);
|
|
64
|
+
if (!item) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const itemPath = (0, navigation_1.getItemPath)(navigationContext, item);
|
|
68
|
+
const lastCrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
69
|
+
if (lastCrumb?.path !== itemPath) {
|
|
70
|
+
breadcrumbs.push({
|
|
71
|
+
title: (0, navigation_1.getItemTitle)(item),
|
|
72
|
+
path: itemPath
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
title: (0, navigation_1.getItemTitle)(activeItem),
|
|
78
|
+
path: (0, navigation_1.getItemPath)(navigationContext, activeItem),
|
|
79
|
+
sourcePath: pathname,
|
|
80
|
+
breadcrumbs
|
|
81
|
+
};
|
|
82
|
+
}, [activeItem, rootItem, pathname, navigationContext]);
|
|
83
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useLocalStorageState"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useLocalStorageState = void 0;
|
|
5
|
+
const persistence_1 = require("../persistence");
|
|
6
|
+
/**
|
|
7
|
+
* Sync state to local storage so that it persists through a page refresh. Usage is
|
|
8
|
+
* similar to useState except we pass in a storage key so that we can default
|
|
9
|
+
* to that value on page load instead of the specified initial value.
|
|
10
|
+
*
|
|
11
|
+
* Since the storage API isn't available in server-rendering environments, we
|
|
12
|
+
* return null during SSR and hydration.
|
|
13
|
+
*/
|
|
14
|
+
const useLocalStorageStateBrowser = (...args) => (0, persistence_1.useStorageState)(window.localStorage, ...args);
|
|
15
|
+
exports.useLocalStorageState = typeof window === "undefined"
|
|
16
|
+
? persistence_1.useStorageStateServer
|
|
17
|
+
: useLocalStorageStateBrowser;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useSessionStorageState"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useSessionStorageState = void 0;
|
|
5
|
+
const persistence_1 = require("../persistence");
|
|
6
|
+
/**
|
|
7
|
+
* Sync state to session storage so that it persists through a page refresh. Usage is
|
|
8
|
+
* similar to useState except we pass in a storage key so that we can default
|
|
9
|
+
* to that value on page load instead of the specified initial value.
|
|
10
|
+
*
|
|
11
|
+
* Since the storage API isn't available in server-rendering environments, we
|
|
12
|
+
* return null during SSR and hydration.
|
|
13
|
+
*/
|
|
14
|
+
const useSessionStorageStateBrowser = (...args) => (0, persistence_1.useStorageState)(window.sessionStorage, ...args);
|
|
15
|
+
exports.useSessionStorageState = typeof window === "undefined"
|
|
16
|
+
? persistence_1.useStorageStateServer
|
|
17
|
+
: useSessionStorageStateBrowser;
|