@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.
Files changed (260) hide show
  1. package/babel.config.json +11 -0
  2. package/build/cjs/Account/Account.js +104 -0
  3. package/build/cjs/Account/Account.test.js +40 -0
  4. package/build/cjs/Account/AccountPopoverFooter.js +18 -0
  5. package/build/cjs/Account/AccountPopoverHeader.js +12 -0
  6. package/build/cjs/Account/AccountPreview.js +96 -0
  7. package/build/cjs/Account/AccountPreview.test.js +52 -0
  8. package/build/cjs/Account/SignInButton.js +56 -0
  9. package/build/cjs/Account/SignOutButton.js +58 -0
  10. package/build/cjs/Account/index.js +22 -0
  11. package/build/cjs/AppProvider/AppProvider.js +40 -0
  12. package/build/cjs/AppProvider/AppProvider.test.js +18 -0
  13. package/build/cjs/AppProvider/AppProviderComponent.js +33 -0
  14. package/build/cjs/AppProvider/AppThemeProvider.js +111 -0
  15. package/build/cjs/AppProvider/index.js +17 -0
  16. package/build/cjs/DashboardLayout/DashboardLayout.js +230 -0
  17. package/build/cjs/DashboardLayout/DashboardLayout.test.js +296 -0
  18. package/build/cjs/DashboardLayout/DashboardSidebarSubNavigation.js +185 -0
  19. package/build/cjs/DashboardLayout/ThemeSwitcher.js +84 -0
  20. package/build/cjs/DashboardLayout/TitleBar.d.ts +2 -0
  21. package/build/cjs/DashboardLayout/TitleBar.js +57 -0
  22. package/build/cjs/DashboardLayout/ToolbarActions.js +11 -0
  23. package/build/cjs/DashboardLayout/index.js +19 -0
  24. package/build/cjs/DashboardLayout/utils.js +20 -0
  25. package/build/{PageContainer → cjs/PageContainer}/PageContainer.d.ts +4 -0
  26. package/build/cjs/PageContainer/PageContainer.js +133 -0
  27. package/build/cjs/PageContainer/PageContainer.test.js +128 -0
  28. package/build/cjs/PageContainer/PageContainerToolbar.js +26 -0
  29. package/build/cjs/PageContainer/PageContainerToolbar.test.js +15 -0
  30. package/build/cjs/PageContainer/index.js +18 -0
  31. package/build/cjs/index.js +24 -0
  32. package/build/cjs/nextjs/AppProvider.js +18 -0
  33. package/build/cjs/nextjs/AppProvider.test.js +71 -0
  34. package/build/cjs/nextjs/AppProviderNextApp.js +63 -0
  35. package/build/cjs/nextjs/AppProviderNextPages.js +73 -0
  36. package/build/cjs/nextjs/index.js +17 -0
  37. package/build/cjs/persistence/codec.js +60 -0
  38. package/build/cjs/persistence/index.js +17 -0
  39. package/build/cjs/persistence/useStorageState.js +153 -0
  40. package/build/cjs/persistence/useStorageState.test.js +63 -0
  41. package/build/cjs/react-router-dom/AppProvider.js +64 -0
  42. package/build/cjs/react-router-dom/AppProvider.test.js +14 -0
  43. package/build/cjs/react-router-dom/index.js +17 -0
  44. package/build/cjs/shared/Link.js +55 -0
  45. package/build/cjs/shared/components.js +30 -0
  46. package/build/cjs/shared/context.js +46 -0
  47. package/build/cjs/shared/locales/LocaleContext.js +71 -0
  48. package/build/cjs/shared/navigation.js +151 -0
  49. package/build/cjs/useActivePage/index.js +17 -0
  50. package/build/cjs/useActivePage/useActivePage.js +83 -0
  51. package/build/cjs/useLocalStorageState/index.js +17 -0
  52. package/build/cjs/useLocalStorageState/useLocalStorageState.js +17 -0
  53. package/build/cjs/useSessionStorageState/index.js +17 -0
  54. package/build/cjs/useSessionStorageState/useSessionStorageState.js +17 -0
  55. package/build/cjs/utils/collections.js +53 -0
  56. package/build/cjs/utils/describeConformance.js +6 -0
  57. package/build/cjs/utils/events.js +58 -0
  58. package/build/cjs/utils/hooks/index.js +10 -0
  59. package/build/cjs/utils/hooks/useBoolean.js +47 -0
  60. package/build/cjs/utils/hooks/useDebounced.js +64 -0
  61. package/build/cjs/utils/hooks/useDebouncedHandler.js +77 -0
  62. package/build/cjs/utils/hooks/useLatest.js +44 -0
  63. package/build/cjs/utils/hooks/usePageTitle.js +49 -0
  64. package/build/cjs/utils/hooks/useSsr.js +52 -0
  65. package/build/cjs/utils/hooks/useStorageState.js +86 -0
  66. package/build/cjs/utils/warnOnce.js +14 -0
  67. package/build/mjs/Account/Account.d.ts +63 -0
  68. package/build/mjs/Account/Account.test.d.ts +1 -0
  69. package/build/mjs/Account/AccountPopoverFooter.d.ts +6 -0
  70. package/build/mjs/Account/AccountPopoverHeader.d.ts +6 -0
  71. package/build/mjs/Account/AccountPreview.d.ts +64 -0
  72. package/build/mjs/Account/AccountPreview.test.d.ts +1 -0
  73. package/build/mjs/Account/SignInButton.d.ts +2 -0
  74. package/build/mjs/Account/SignOutButton.d.ts +3 -0
  75. package/build/mjs/Account/index.js +6 -0
  76. package/build/mjs/AppProvider/AppProvider.d.ts +105 -0
  77. package/build/mjs/AppProvider/AppProvider.test.d.ts +4 -0
  78. package/build/mjs/AppProvider/AppProviderComponent.d.ts +14 -0
  79. package/build/mjs/AppProvider/AppThemeProvider.d.ts +12 -0
  80. package/build/mjs/DashboardLayout/DashboardLayout.d.ts +91 -0
  81. package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.js +9 -10
  82. package/build/mjs/DashboardLayout/DashboardLayout.test.d.ts +1 -0
  83. package/build/mjs/DashboardLayout/DashboardSidebarSubNavigation.d.ts +16 -0
  84. package/build/mjs/DashboardLayout/ThemeSwitcher.d.ts +5 -0
  85. package/build/mjs/DashboardLayout/TitleBar.d.ts +2 -0
  86. package/build/mjs/DashboardLayout/ToolbarActions.d.ts +5 -0
  87. package/build/mjs/DashboardLayout/index.d.ts +2 -0
  88. package/build/mjs/DashboardLayout/utils.d.ts +8 -0
  89. package/build/mjs/PageContainer/PageContainer.d.ts +61 -0
  90. package/build/{PageContainer → mjs/PageContainer}/PageContainer.js +8 -4
  91. package/build/mjs/PageContainer/PageContainer.test.d.ts +1 -0
  92. package/build/mjs/PageContainer/PageContainerToolbar.d.ts +16 -0
  93. package/build/mjs/PageContainer/PageContainerToolbar.test.d.ts +1 -0
  94. package/build/mjs/PageContainer/index.js +2 -0
  95. package/build/mjs/index.js +8 -0
  96. package/build/mjs/nextjs/AppProvider.d.ts +6 -0
  97. package/build/mjs/nextjs/AppProvider.test.d.ts +1 -0
  98. package/build/mjs/nextjs/AppProviderNextApp.d.ts +5 -0
  99. package/build/mjs/nextjs/AppProviderNextPages.d.ts +5 -0
  100. package/build/mjs/nextjs/index.js +1 -0
  101. package/build/mjs/persistence/codec.d.ts +47 -0
  102. package/build/mjs/persistence/index.js +1 -0
  103. package/build/mjs/persistence/useStorageState.d.ts +50 -0
  104. package/build/mjs/persistence/useStorageState.test.d.ts +1 -0
  105. package/build/mjs/react-router-dom/AppProvider.d.ts +6 -0
  106. package/build/mjs/react-router-dom/AppProvider.test.d.ts +1 -0
  107. package/build/mjs/react-router-dom/index.d.ts +1 -0
  108. package/build/mjs/react-router-dom/index.js +1 -0
  109. package/build/mjs/shared/Link.d.ts +8 -0
  110. package/build/mjs/shared/components.d.ts +5 -0
  111. package/build/mjs/shared/context.d.ts +12 -0
  112. package/build/mjs/shared/locales/LocaleContext.d.ts +56 -0
  113. package/build/mjs/shared/navigation.d.ts +16 -0
  114. package/build/mjs/useActivePage/index.js +1 -0
  115. package/build/mjs/useActivePage/useActivePage.d.ts +8 -0
  116. package/build/mjs/useLocalStorageState/index.js +1 -0
  117. package/build/mjs/useLocalStorageState/useLocalStorageState.d.ts +2 -0
  118. package/build/mjs/useSessionStorageState/index.js +1 -0
  119. package/build/mjs/useSessionStorageState/useSessionStorageState.d.ts +2 -0
  120. package/build/mjs/utils/collections.d.ts +44 -0
  121. package/build/mjs/utils/describeConformance.d.ts +7 -0
  122. package/build/mjs/utils/events.d.ts +27 -0
  123. package/build/mjs/utils/hooks/index.js +2 -0
  124. package/build/mjs/utils/hooks/useBoolean.d.ts +11 -0
  125. package/build/mjs/utils/hooks/useDebounced.d.ts +8 -0
  126. package/build/mjs/utils/hooks/useDebouncedHandler.d.ts +12 -0
  127. package/build/mjs/utils/hooks/useLatest.d.ts +6 -0
  128. package/build/mjs/utils/hooks/usePageTitle.d.ts +4 -0
  129. package/build/mjs/utils/hooks/useSsr.d.ts +4 -0
  130. package/build/mjs/utils/hooks/useStorageState.d.ts +10 -0
  131. package/build/mjs/utils/warnOnce.d.ts +5 -0
  132. package/package.json +33 -23
  133. package/src/DashboardLayout/DashboardLayout.tsx +13 -12
  134. package/src/PageContainer/PageContainer.tsx +12 -4
  135. package/tsconfig.cjs.json +20 -0
  136. package/tsconfig.json +2 -2
  137. package/build/DashboardLayout/TitleBar.d.ts +0 -2
  138. /package/build/{Account → cjs/Account}/Account.d.ts +0 -0
  139. /package/build/{Account → cjs/Account}/Account.test.d.ts +0 -0
  140. /package/build/{Account → cjs/Account}/AccountPopoverFooter.d.ts +0 -0
  141. /package/build/{Account → cjs/Account}/AccountPopoverHeader.d.ts +0 -0
  142. /package/build/{Account → cjs/Account}/AccountPreview.d.ts +0 -0
  143. /package/build/{Account → cjs/Account}/AccountPreview.test.d.ts +0 -0
  144. /package/build/{Account → cjs/Account}/SignInButton.d.ts +0 -0
  145. /package/build/{Account → cjs/Account}/SignOutButton.d.ts +0 -0
  146. /package/build/{Account → cjs/Account}/index.d.ts +0 -0
  147. /package/build/{AppProvider → cjs/AppProvider}/AppProvider.d.ts +0 -0
  148. /package/build/{AppProvider → cjs/AppProvider}/AppProvider.test.d.ts +0 -0
  149. /package/build/{AppProvider → cjs/AppProvider}/AppProviderComponent.d.ts +0 -0
  150. /package/build/{AppProvider → cjs/AppProvider}/AppThemeProvider.d.ts +0 -0
  151. /package/build/{AppProvider → cjs/AppProvider}/index.d.ts +0 -0
  152. /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.d.ts +0 -0
  153. /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.test.d.ts +0 -0
  154. /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardSidebarSubNavigation.d.ts +0 -0
  155. /package/build/{DashboardLayout → cjs/DashboardLayout}/ThemeSwitcher.d.ts +0 -0
  156. /package/build/{DashboardLayout → cjs/DashboardLayout}/ToolbarActions.d.ts +0 -0
  157. /package/build/{DashboardLayout → cjs/DashboardLayout}/index.d.ts +0 -0
  158. /package/build/{DashboardLayout → cjs/DashboardLayout}/utils.d.ts +0 -0
  159. /package/build/{PageContainer → cjs/PageContainer}/PageContainer.test.d.ts +0 -0
  160. /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.d.ts +0 -0
  161. /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.test.d.ts +0 -0
  162. /package/build/{PageContainer → cjs/PageContainer}/index.d.ts +0 -0
  163. /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
  164. /package/build/{nextjs → cjs/nextjs}/AppProvider.d.ts +0 -0
  165. /package/build/{nextjs → cjs/nextjs}/AppProvider.test.d.ts +0 -0
  166. /package/build/{nextjs → cjs/nextjs}/AppProviderNextApp.d.ts +0 -0
  167. /package/build/{nextjs → cjs/nextjs}/AppProviderNextPages.d.ts +0 -0
  168. /package/build/{nextjs → cjs/nextjs}/index.d.ts +0 -0
  169. /package/build/{persistence → cjs/persistence}/codec.d.ts +0 -0
  170. /package/build/{persistence → cjs/persistence}/index.d.ts +0 -0
  171. /package/build/{persistence → cjs/persistence}/useStorageState.d.ts +0 -0
  172. /package/build/{persistence → cjs/persistence}/useStorageState.test.d.ts +0 -0
  173. /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.d.ts +0 -0
  174. /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.test.d.ts +0 -0
  175. /package/build/{react-router-dom → cjs/react-router-dom}/index.d.ts +0 -0
  176. /package/build/{shared → cjs/shared}/Link.d.ts +0 -0
  177. /package/build/{shared → cjs/shared}/components.d.ts +0 -0
  178. /package/build/{shared → cjs/shared}/context.d.ts +0 -0
  179. /package/build/{shared → cjs/shared}/locales/LocaleContext.d.ts +0 -0
  180. /package/build/{shared → cjs/shared}/navigation.d.ts +0 -0
  181. /package/build/{useActivePage → cjs/useActivePage}/index.d.ts +0 -0
  182. /package/build/{useActivePage → cjs/useActivePage}/useActivePage.d.ts +0 -0
  183. /package/build/{useLocalStorageState → cjs/useLocalStorageState}/index.d.ts +0 -0
  184. /package/build/{useLocalStorageState → cjs/useLocalStorageState}/useLocalStorageState.d.ts +0 -0
  185. /package/build/{useSessionStorageState → cjs/useSessionStorageState}/index.d.ts +0 -0
  186. /package/build/{useSessionStorageState → cjs/useSessionStorageState}/useSessionStorageState.d.ts +0 -0
  187. /package/build/{utils → cjs/utils}/collections.d.ts +0 -0
  188. /package/build/{utils → cjs/utils}/describeConformance.d.ts +0 -0
  189. /package/build/{utils → cjs/utils}/events.d.ts +0 -0
  190. /package/build/{utils → cjs/utils}/hooks/index.d.ts +0 -0
  191. /package/build/{utils → cjs/utils}/hooks/useBoolean.d.ts +0 -0
  192. /package/build/{utils → cjs/utils}/hooks/useDebounced.d.ts +0 -0
  193. /package/build/{utils → cjs/utils}/hooks/useDebouncedHandler.d.ts +0 -0
  194. /package/build/{utils → cjs/utils}/hooks/useLatest.d.ts +0 -0
  195. /package/build/{utils → cjs/utils}/hooks/usePageTitle.d.ts +0 -0
  196. /package/build/{utils → cjs/utils}/hooks/useSsr.d.ts +0 -0
  197. /package/build/{utils → cjs/utils}/hooks/useStorageState.d.ts +0 -0
  198. /package/build/{utils → cjs/utils}/warnOnce.d.ts +0 -0
  199. /package/build/{Account → mjs/Account}/Account.js +0 -0
  200. /package/build/{Account → mjs/Account}/Account.test.js +0 -0
  201. /package/build/{Account → mjs/Account}/AccountPopoverFooter.js +0 -0
  202. /package/build/{Account → mjs/Account}/AccountPopoverHeader.js +0 -0
  203. /package/build/{Account → mjs/Account}/AccountPreview.js +0 -0
  204. /package/build/{Account → mjs/Account}/AccountPreview.test.js +0 -0
  205. /package/build/{Account → mjs/Account}/SignInButton.js +0 -0
  206. /package/build/{Account → mjs/Account}/SignOutButton.js +0 -0
  207. /package/build/{Account/index.js → mjs/Account/index.d.ts} +0 -0
  208. /package/build/{AppProvider → mjs/AppProvider}/AppProvider.js +0 -0
  209. /package/build/{AppProvider → mjs/AppProvider}/AppProvider.test.js +0 -0
  210. /package/build/{AppProvider → mjs/AppProvider}/AppProviderComponent.js +0 -0
  211. /package/build/{AppProvider → mjs/AppProvider}/AppThemeProvider.js +0 -0
  212. /package/build/{AppProvider/index.js → mjs/AppProvider/index.d.ts} +0 -0
  213. /package/build/{nextjs → mjs/AppProvider}/index.js +0 -0
  214. /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.test.js +0 -0
  215. /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardSidebarSubNavigation.js +0 -0
  216. /package/build/{DashboardLayout → mjs/DashboardLayout}/ThemeSwitcher.js +0 -0
  217. /package/build/{DashboardLayout → mjs/DashboardLayout}/TitleBar.js +0 -0
  218. /package/build/{DashboardLayout → mjs/DashboardLayout}/ToolbarActions.js +0 -0
  219. /package/build/{DashboardLayout → mjs/DashboardLayout}/index.js +0 -0
  220. /package/build/{DashboardLayout → mjs/DashboardLayout}/utils.js +0 -0
  221. /package/build/{PageContainer → mjs/PageContainer}/PageContainer.test.js +0 -0
  222. /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.js +0 -0
  223. /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.test.js +0 -0
  224. /package/build/{PageContainer/index.js → mjs/PageContainer/index.d.ts} +0 -0
  225. /package/build/{index.js → mjs/index.d.ts} +0 -0
  226. /package/build/{nextjs → mjs/nextjs}/AppProvider.js +0 -0
  227. /package/build/{nextjs → mjs/nextjs}/AppProvider.test.js +0 -0
  228. /package/build/{nextjs → mjs/nextjs}/AppProviderNextApp.js +0 -0
  229. /package/build/{nextjs → mjs/nextjs}/AppProviderNextPages.js +0 -0
  230. /package/build/{react-router-dom/index.js → mjs/nextjs/index.d.ts} +0 -0
  231. /package/build/{persistence → mjs/persistence}/codec.js +0 -0
  232. /package/build/{persistence/index.js → mjs/persistence/index.d.ts} +0 -0
  233. /package/build/{persistence → mjs/persistence}/useStorageState.js +0 -0
  234. /package/build/{persistence → mjs/persistence}/useStorageState.test.js +0 -0
  235. /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.js +0 -0
  236. /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.test.js +0 -0
  237. /package/build/{shared → mjs/shared}/Link.js +0 -0
  238. /package/build/{shared → mjs/shared}/components.js +0 -0
  239. /package/build/{shared → mjs/shared}/context.js +0 -0
  240. /package/build/{shared → mjs/shared}/locales/LocaleContext.js +0 -0
  241. /package/build/{shared → mjs/shared}/navigation.js +0 -0
  242. /package/build/{useActivePage/index.js → mjs/useActivePage/index.d.ts} +0 -0
  243. /package/build/{useActivePage → mjs/useActivePage}/useActivePage.js +0 -0
  244. /package/build/{useLocalStorageState/index.js → mjs/useLocalStorageState/index.d.ts} +0 -0
  245. /package/build/{useLocalStorageState → mjs/useLocalStorageState}/useLocalStorageState.js +0 -0
  246. /package/build/{useSessionStorageState/index.js → mjs/useSessionStorageState/index.d.ts} +0 -0
  247. /package/build/{useSessionStorageState → mjs/useSessionStorageState}/useSessionStorageState.js +0 -0
  248. /package/build/{utils → mjs/utils}/collections.js +0 -0
  249. /package/build/{utils → mjs/utils}/describeConformance.js +0 -0
  250. /package/build/{utils → mjs/utils}/events.js +0 -0
  251. /package/build/{utils/hooks/index.js → mjs/utils/hooks/index.d.ts} +0 -0
  252. /package/build/{utils → mjs/utils}/hooks/useBoolean.js +0 -0
  253. /package/build/{utils → mjs/utils}/hooks/useDebounced.js +0 -0
  254. /package/build/{utils → mjs/utils}/hooks/useDebouncedHandler.js +0 -0
  255. /package/build/{utils → mjs/utils}/hooks/useLatest.js +0 -0
  256. /package/build/{utils → mjs/utils}/hooks/usePageTitle.js +0 -0
  257. /package/build/{utils → mjs/utils}/hooks/useSsr.js +0 -0
  258. /package/build/{utils → mjs/utils}/hooks/useStorageState.js +0 -0
  259. /package/build/{utils → mjs/utils}/warnOnce.js +0 -0
  260. /package/{vite.config.ts → vite.config.mts} +0 -0
@@ -0,0 +1,185 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.DashboardSidebarSubNavigation = DashboardSidebarSubNavigation;
41
+ const jsx_runtime_1 = require("react/jsx-runtime");
42
+ const React = __importStar(require("react"));
43
+ const material_1 = require("@mui/material");
44
+ const Avatar_1 = __importDefault(require("@mui/material/Avatar"));
45
+ const Collapse_1 = __importDefault(require("@mui/material/Collapse"));
46
+ const Divider_1 = __importDefault(require("@mui/material/Divider"));
47
+ const List_1 = __importDefault(require("@mui/material/List"));
48
+ const ListItem_1 = __importDefault(require("@mui/material/ListItem"));
49
+ const ListItemButton_1 = __importDefault(require("@mui/material/ListItemButton"));
50
+ const ListItemIcon_1 = __importDefault(require("@mui/material/ListItemIcon"));
51
+ const ListItemText_1 = __importDefault(require("@mui/material/ListItemText"));
52
+ const ListSubheader_1 = __importDefault(require("@mui/material/ListSubheader"));
53
+ const Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
54
+ const ExpandLess_1 = __importDefault(require("@mui/icons-material/ExpandLess"));
55
+ const ExpandMore_1 = __importDefault(require("@mui/icons-material/ExpandMore"));
56
+ const Link_1 = require("../shared/Link");
57
+ const context_1 = require("../shared/context");
58
+ const navigation_1 = require("../shared/navigation");
59
+ const utils_1 = require("./utils");
60
+ const NavigationListItemButton = (0, material_1.styled)(ListItemButton_1.default)(({ theme }) => ({
61
+ borderRadius: 8,
62
+ "&.Mui-selected": {
63
+ "& .MuiListItemIcon-root": {
64
+ color: (theme.vars ?? theme).palette.primary.dark
65
+ },
66
+ "& .MuiTypography-root": {
67
+ color: (theme.vars ?? theme).palette.primary.dark
68
+ },
69
+ "& .MuiSvgIcon-root": {
70
+ color: (theme.vars ?? theme).palette.primary.dark
71
+ },
72
+ "& .MuiAvatar-root": {
73
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
74
+ },
75
+ "& .MuiTouchRipple-child": {
76
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
77
+ }
78
+ },
79
+ "& .MuiSvgIcon-root": {
80
+ color: (theme.vars ?? theme).palette.action.active
81
+ },
82
+ "& .MuiAvatar-root": {
83
+ backgroundColor: (theme.vars ?? theme).palette.action.active
84
+ }
85
+ }));
86
+ /**
87
+ * @ignore - internal component.
88
+ */
89
+ function DashboardSidebarSubNavigation({ subNavigation, basePath = "", depth = 0, onLinkClick, isMini = false, isFullyExpanded = true, hasDrawerTransitions = false, selectedItemId }) {
90
+ const routerContext = React.useContext(context_1.RouterContext);
91
+ const pathname = routerContext?.pathname ?? "/";
92
+ const initialExpandedSidebarItemIds = React.useMemo(() => subNavigation
93
+ .map((navigationItem, navigationItemIndex) => ({
94
+ navigationItem,
95
+ originalIndex: navigationItemIndex
96
+ }))
97
+ .filter(({ navigationItem }) => (0, navigation_1.hasSelectedNavigationChildren)(navigationItem, basePath, pathname))
98
+ .map(({ originalIndex }) => `${depth}-${originalIndex}`), [basePath, depth, pathname, subNavigation]);
99
+ const [expandedSidebarItemIds, setExpandedSidebarItemIds] = React.useState(initialExpandedSidebarItemIds);
100
+ const handleOpenFolderClick = React.useCallback((itemId) => () => {
101
+ setExpandedSidebarItemIds((previousValue) => previousValue.includes(itemId)
102
+ ? previousValue.filter((previousValueItemId) => previousValueItemId !== itemId)
103
+ : [...previousValue, itemId]);
104
+ }, []);
105
+ return ((0, jsx_runtime_1.jsx)(List_1.default, { sx: { padding: 0, mb: depth === 0 ? 4 : 1, pl: 2 * depth }, children: subNavigation.map((navigationItem, navigationItemIndex) => {
106
+ if (navigationItem.kind === "header") {
107
+ return ((0, jsx_runtime_1.jsx)(ListSubheader_1.default, { component: "div", sx: {
108
+ fontSize: 12,
109
+ fontWeight: "700",
110
+ height: isMini ? 0 : 40,
111
+ ...(hasDrawerTransitions
112
+ ? (0, utils_1.getDrawerSxTransitionMixin)(isFullyExpanded, "height")
113
+ : {}),
114
+ px: 2,
115
+ overflow: "hidden",
116
+ textOverflow: "ellipsis",
117
+ whiteSpace: "nowrap",
118
+ zIndex: 2
119
+ }, children: (0, navigation_1.getItemTitle)(navigationItem) }, `subheader-${depth}-${navigationItemIndex}`));
120
+ }
121
+ if (navigationItem.kind === "divider") {
122
+ const nextItem = subNavigation[navigationItemIndex + 1];
123
+ return ((0, jsx_runtime_1.jsx)(Divider_1.default, { sx: {
124
+ borderBottomWidth: 2,
125
+ mx: 1,
126
+ mt: 1,
127
+ mb: nextItem?.kind === "header" && !isMini ? 0 : 1,
128
+ ...(hasDrawerTransitions
129
+ ? (0, utils_1.getDrawerSxTransitionMixin)(isFullyExpanded, "margin")
130
+ : {})
131
+ } }, `divider-${depth}-${navigationItemIndex}`));
132
+ }
133
+ const navigationItemFullPath = (0, navigation_1.getPageItemFullPath)(basePath, navigationItem);
134
+ const navigationItemId = `${depth}-${navigationItemIndex}`;
135
+ const navigationItemTitle = (0, navigation_1.getItemTitle)(navigationItem);
136
+ const isNestedNavigationExpanded = expandedSidebarItemIds.includes(navigationItemId);
137
+ const nestedNavigationCollapseIcon = isNestedNavigationExpanded ? ((0, jsx_runtime_1.jsx)(ExpandLess_1.default, {})) : ((0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}));
138
+ const listItemIconSize = 34;
139
+ // If the item is selected, we don't want to select more
140
+ const isSelected = selectedItemId
141
+ ? false
142
+ : (0, navigation_1.isPageItemSelected)(navigationItem, basePath, pathname);
143
+ if (isSelected && !selectedItemId) {
144
+ selectedItemId = navigationItemId;
145
+ }
146
+ const listItem = ((0, jsx_runtime_1.jsx)(ListItem_1.default, { sx: {
147
+ py: 0,
148
+ px: 1,
149
+ overflowX: "hidden"
150
+ }, children: (0, jsx_runtime_1.jsxs)(NavigationListItemButton, { selected: isSelected && (!navigationItem.children || isMini), sx: {
151
+ px: 1.4,
152
+ height: 48
153
+ }, ...(navigationItem.children && !isMini
154
+ ? {
155
+ onClick: handleOpenFolderClick(navigationItemId)
156
+ }
157
+ : {
158
+ LinkComponent: Link_1.Link,
159
+ href: navigationItemFullPath,
160
+ onClick: onLinkClick
161
+ }), children: [navigationItem.icon || isMini ? ((0, jsx_runtime_1.jsxs)(ListItemIcon_1.default, { sx: {
162
+ minWidth: listItemIconSize,
163
+ mr: 1.2
164
+ }, children: [navigationItem.icon ?? null, !navigationItem.icon && isMini ? ((0, jsx_runtime_1.jsx)(Avatar_1.default, { sx: {
165
+ width: listItemIconSize - 7,
166
+ height: listItemIconSize - 7,
167
+ fontSize: 12,
168
+ ml: "-2px"
169
+ }, children: navigationItemTitle
170
+ .split(" ")
171
+ .slice(0, 2)
172
+ .map((itemTitleWord) => itemTitleWord.charAt(0).toUpperCase()) })) : null] })) : null, (0, jsx_runtime_1.jsx)(ListItemText_1.default, { primary: navigationItemTitle, sx: {
173
+ whiteSpace: "nowrap",
174
+ zIndex: 1,
175
+ "& .MuiTypography-root": {
176
+ fontWeight: "500"
177
+ }
178
+ } }), navigationItem.action && !isMini && isFullyExpanded
179
+ ? navigationItem.action
180
+ : null, navigationItem.children && !isMini && isFullyExpanded
181
+ ? nestedNavigationCollapseIcon
182
+ : null] }) }));
183
+ return ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [isMini ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, { title: navigationItemTitle, placement: "right", children: listItem })) : (listItem), navigationItem.children && !isMini ? ((0, jsx_runtime_1.jsx)(Collapse_1.default, { in: isNestedNavigationExpanded, timeout: "auto", unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(DashboardSidebarSubNavigation, { subNavigation: navigationItem.children, basePath: navigationItemFullPath, depth: depth + 1, onLinkClick: onLinkClick, selectedItemId: selectedItemId }) })) : null] }, navigationItemId));
184
+ }) }));
185
+ }
@@ -0,0 +1,84 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.ThemeSwitcher = ThemeSwitcher;
41
+ const jsx_runtime_1 = require("react/jsx-runtime");
42
+ const React = __importStar(require("react"));
43
+ const material_1 = require("@mui/material");
44
+ const IconButton_1 = __importDefault(require("@mui/material/IconButton"));
45
+ const Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
46
+ const DarkMode_1 = __importDefault(require("@mui/icons-material/DarkMode"));
47
+ const LightMode_1 = __importDefault(require("@mui/icons-material/LightMode"));
48
+ const context_1 = require("../shared/context");
49
+ const useSsr_1 = __importDefault(require("../utils/hooks/useSsr"));
50
+ const LocaleContext_1 = require("../shared/locales/LocaleContext");
51
+ // TODO: When we use this component as the default for a slot, make it non-internal
52
+ /**
53
+ * @ignore - internal component.
54
+ */
55
+ function ThemeSwitcher() {
56
+ const isSsr = (0, useSsr_1.default)();
57
+ const theme = (0, material_1.useTheme)();
58
+ const localeText = (0, LocaleContext_1.useLocaleText)();
59
+ const { paletteMode, setPaletteMode, isDualTheme } = React.useContext(context_1.PaletteModeContext);
60
+ const toggleMode = React.useCallback(() => {
61
+ setPaletteMode(paletteMode === "dark" ? "light" : "dark");
62
+ }, [paletteMode, setPaletteMode]);
63
+ return isDualTheme ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, { title: isSsr
64
+ ? localeText.switchModeTitle
65
+ : paletteMode === "dark"
66
+ ? localeText.lightModeTitle
67
+ : localeText.darkModeTitle, enterDelay: 1000, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { "aria-label": isSsr
68
+ ? localeText.switchThemeModeAriaLabel
69
+ : paletteMode === "dark"
70
+ ? localeText.switchToLightModeAriaLabel
71
+ : localeText.switchToDarkModeAriaLabel, onClick: toggleMode, sx: {
72
+ color: (theme.vars ?? theme).palette.primary.dark
73
+ }, children: theme.getColorSchemeSelector ? ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(DarkMode_1.default, { sx: {
74
+ display: "inline",
75
+ [theme.getColorSchemeSelector("dark")]: {
76
+ display: "none"
77
+ }
78
+ } }), (0, jsx_runtime_1.jsx)(LightMode_1.default, { sx: {
79
+ display: "none",
80
+ [theme.getColorSchemeSelector("dark")]: {
81
+ display: "inline"
82
+ }
83
+ } })] })) : ((0, jsx_runtime_1.jsx)(React.Fragment, { children: isSsr || paletteMode !== "dark" ? ((0, jsx_runtime_1.jsx)(DarkMode_1.default, {})) : ((0, jsx_runtime_1.jsx)(LightMode_1.default, {})) })) }) }) })) : null;
84
+ }
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare function TitleBar(): number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,57 @@
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.TitleBar = TitleBar;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const material_1 = require("@mui/material");
9
+ const Link_1 = require("../shared/Link");
10
+ const react_1 = __importDefault(require("react"));
11
+ const context_1 = require("../shared/context");
12
+ const LogoContainer = (0, material_1.styled)("div")({
13
+ position: "relative",
14
+ height: 40,
15
+ "& img": {
16
+ maxHeight: 40
17
+ }
18
+ });
19
+ function TitleBar() {
20
+ // Theme
21
+ const theme = (0, material_1.useTheme)();
22
+ // Branding
23
+ const branding = react_1.default.useContext(context_1.BrandingContext);
24
+ // Application title
25
+ const title = branding?.title;
26
+ const [titleUI, hasLink] = react_1.default.useMemo(() => {
27
+ if (title == null)
28
+ return [undefined, true];
29
+ if (typeof title === "string" || Array.isArray(title)) {
30
+ let titleString;
31
+ let clickHandler;
32
+ if (Array.isArray(title)) {
33
+ titleString = title[0];
34
+ clickHandler = title[1];
35
+ }
36
+ else {
37
+ titleString = title;
38
+ }
39
+ return [
40
+ (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", sx: {
41
+ color: (theme.vars ?? theme).palette.primary.main,
42
+ fontWeight: "700",
43
+ ml: 0.5,
44
+ whiteSpace: "nowrap"
45
+ }, onClick: clickHandler == null ? undefined : (e) => clickHandler(e), children: titleString }),
46
+ true
47
+ ];
48
+ }
49
+ return [title, false];
50
+ }, [title]);
51
+ if (hasLink) {
52
+ return ((0, jsx_runtime_1.jsx)(Link_1.Link, { href: "/", style: { color: "inherit", textDecoration: "none" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", children: [branding?.logo && (0, jsx_runtime_1.jsx)(LogoContainer, { children: branding.logo }), titleUI] }) }));
53
+ }
54
+ else {
55
+ return titleUI;
56
+ }
57
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ToolbarActions = ToolbarActions;
5
+ // TODO: When we add content to this component, make it non-internal
6
+ /**
7
+ * @ignore - internal component.
8
+ */
9
+ function ToolbarActions() {
10
+ return null;
11
+ }
@@ -0,0 +1,19 @@
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("./DashboardLayout"), exports);
18
+ // Default slots components
19
+ __exportStar(require("./ToolbarActions"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDrawerSxTransitionMixin = getDrawerSxTransitionMixin;
4
+ exports.getDrawerWidthTransitionMixin = getDrawerWidthTransitionMixin;
5
+ function getDrawerSxTransitionMixin(isExpanded, property) {
6
+ return {
7
+ transition: (theme) => theme.transitions.create(property, {
8
+ easing: theme.transitions.easing.sharp,
9
+ duration: isExpanded
10
+ ? theme.transitions.duration.enteringScreen
11
+ : theme.transitions.duration.leavingScreen
12
+ })
13
+ };
14
+ }
15
+ function getDrawerWidthTransitionMixin(isExpanded) {
16
+ return {
17
+ ...getDrawerSxTransitionMixin(isExpanded, "width"),
18
+ overflowX: "hidden"
19
+ };
20
+ }
@@ -33,6 +33,10 @@ export declare const PageDataContext: React.Context<{
33
33
  }>;
34
34
  export declare function PageDataContextProvider(props: React.PropsWithChildren<PageData>): import("react/jsx-runtime").JSX.Element;
35
35
  export type PageContainerProps = React.PropsWithChildren<ContainerProps & {
36
+ /**
37
+ * The default title of the page.
38
+ */
39
+ defaultTitle?: string;
36
40
  /**
37
41
  * The components used for each slot inside.
38
42
  */
@@ -0,0 +1,133 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.PageDataContext = void 0;
41
+ exports.PageDataContextProvider = PageDataContextProvider;
42
+ exports.PageContainer = PageContainer;
43
+ const jsx_runtime_1 = require("react/jsx-runtime");
44
+ const React = __importStar(require("react"));
45
+ const Breadcrumbs_1 = __importDefault(require("@mui/material/Breadcrumbs"));
46
+ const Container_1 = __importDefault(require("@mui/material/Container"));
47
+ const Link_1 = __importDefault(require("@mui/material/Link"));
48
+ const Stack_1 = __importDefault(require("@mui/material/Stack"));
49
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
50
+ const useSlotProps_1 = __importDefault(require("@mui/utils/useSlotProps"));
51
+ const material_1 = require("@mui/material");
52
+ const Link_2 = require("../shared/Link");
53
+ const PageContainerToolbar_1 = require("./PageContainerToolbar");
54
+ const navigation_1 = require("../shared/navigation");
55
+ const useActivePage_1 = require("../useActivePage");
56
+ const PageContentHeader = (0, material_1.styled)("div")(({ theme }) => ({
57
+ display: "flex",
58
+ flexDirection: "row",
59
+ justifyContent: "space-between",
60
+ gap: theme.spacing(2)
61
+ }));
62
+ exports.PageDataContext = React.createContext({ state: {}, dispatch: (value) => value });
63
+ function reducer(state, action) {
64
+ if (action === true) {
65
+ // Reset the state
66
+ if (state.breadcrumbs == null &&
67
+ state.title == null &&
68
+ state.page == null) {
69
+ return state;
70
+ }
71
+ else {
72
+ return {};
73
+ }
74
+ }
75
+ return { ...state, ...action };
76
+ }
77
+ function PageDataContextProvider(props) {
78
+ // Destruct
79
+ const { title, page, breadcrumbs, ...rest } = props;
80
+ // useReducer hook to manage state with our reducer function and initial state
81
+ const [state, dispatch] = React.useReducer(reducer, {
82
+ title,
83
+ page,
84
+ breadcrumbs
85
+ });
86
+ // Provide the state and dispatch function to the context value
87
+ return (0, jsx_runtime_1.jsx)(exports.PageDataContext.Provider, { value: { state, dispatch }, ...rest });
88
+ }
89
+ /**
90
+ * A container component to provide a title and breadcrumbs for your pages.
91
+ *
92
+ * Demos:
93
+ *
94
+ * - [Page Container](https://mui.com/toolpad/core/react-page-container/)
95
+ *
96
+ * API:
97
+ *
98
+ * - [PageContainer API](https://mui.com/toolpad/core/api/page-container)
99
+ */
100
+ function PageContainer(props) {
101
+ const { children, defaultTitle, slots, slotProps, ...rest } = props;
102
+ const loaded = React.useRef(false);
103
+ const { state, dispatch } = React.useContext(exports.PageDataContext);
104
+ const activePage = (0, useActivePage_1.useActivePage)();
105
+ React.useLayoutEffect(() => {
106
+ if (loaded.current) {
107
+ dispatch(true);
108
+ }
109
+ else {
110
+ loaded.current = true;
111
+ }
112
+ }, [activePage?.sourcePath]);
113
+ let resolvedBreadcrumbs = state.breadcrumbs ?? activePage?.breadcrumbs ?? [];
114
+ const title = state.title ?? defaultTitle ?? activePage?.title ?? "";
115
+ if (state.page) {
116
+ resolvedBreadcrumbs = [
117
+ ...resolvedBreadcrumbs,
118
+ { title: state.page, path: "#" }
119
+ ];
120
+ }
121
+ const ToolbarComponent = props?.slots?.toolbar ?? PageContainerToolbar_1.PageContainerToolbar;
122
+ const toolbarSlotProps = (0, useSlotProps_1.default)({
123
+ elementType: ToolbarComponent,
124
+ ownerState: props,
125
+ externalSlotProps: props?.slotProps?.toolbar,
126
+ additionalProps: {}
127
+ });
128
+ return ((0, jsx_runtime_1.jsx)(Container_1.default, { ...rest, children: (0, jsx_runtime_1.jsxs)(Stack_1.default, { sx: { my: 2 }, spacing: 2, children: [(0, jsx_runtime_1.jsxs)(Stack_1.default, { children: [(0, jsx_runtime_1.jsx)(Breadcrumbs_1.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs
129
+ ? resolvedBreadcrumbs.map((item, index) => {
130
+ return index < resolvedBreadcrumbs.length - 1 ? ((0, jsx_runtime_1.jsx)(Link_1.default, { component: Link_2.Link, underline: "hover", color: "inherit", href: item.path, children: (0, navigation_1.getItemTitle)(item) }, item.path)) : ((0, jsx_runtime_1.jsx)(Typography_1.default, { color: "text.primary", children: (0, navigation_1.getItemTitle)(item) }, item.path));
131
+ })
132
+ : null }), (0, jsx_runtime_1.jsxs)(PageContentHeader, { children: [title ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h4", children: title }) : null, (0, jsx_runtime_1.jsx)(ToolbarComponent, { ...toolbarSlotProps })] })] }), (0, jsx_runtime_1.jsx)("div", { children: children })] }) }));
133
+ }
@@ -0,0 +1,128 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const vitest_1 = require("vitest");
8
+ const react_1 = require("@testing-library/react");
9
+ const user_event_1 = require("@testing-library/user-event");
10
+ const PageContainer_1 = require("./PageContainer");
11
+ const describeConformance_1 = __importDefault(require("../utils/describeConformance"));
12
+ const AppProviderComponent_1 = require("../AppProvider/AppProviderComponent");
13
+ (0, vitest_1.describe)("PageContainer", () => {
14
+ (0, describeConformance_1.default)((0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}), () => ({
15
+ skip: ["themeDefaultProps"],
16
+ slots: {
17
+ toolbar: {}
18
+ }
19
+ }));
20
+ (0, vitest_1.test)("renders page container correctly", async () => {
21
+ const user = user_event_1.userEvent.setup();
22
+ const router = {
23
+ pathname: "/orders",
24
+ searchParams: new URLSearchParams(),
25
+ navigate: vitest_1.vi.fn()
26
+ };
27
+ (0, react_1.act)(() => {
28
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(AppProviderComponent_1.AppProvider, { navigation: [
29
+ { segment: "", title: "Home" },
30
+ { segment: "orders", title: "Orders" }
31
+ ], router: router, children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageDataContextProvider, { children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}) }) }));
32
+ });
33
+ const breadcrumbs = react_1.screen.getByRole("navigation", { name: "breadcrumb" });
34
+ const homeLink = (0, react_1.within)(breadcrumbs).getByRole("link", { name: "Home" });
35
+ await user.click(homeLink);
36
+ (0, vitest_1.expect)(router.navigate).toHaveBeenCalledWith("/", vitest_1.expect.objectContaining({}));
37
+ router.navigate.mockClear();
38
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("Orders")).toBeTruthy();
39
+ (0, vitest_1.expect)(react_1.screen.getByText("Orders", { ignore: "nav *" }));
40
+ });
41
+ (0, vitest_1.test)("renders nested", async () => {
42
+ const navigation = [
43
+ { segment: "", title: "ACME" },
44
+ {
45
+ segment: "home",
46
+ title: "Home",
47
+ children: [
48
+ {
49
+ segment: "orders",
50
+ title: "Orders"
51
+ }
52
+ ]
53
+ }
54
+ ];
55
+ const router = {
56
+ pathname: "/home/orders",
57
+ searchParams: new URLSearchParams(),
58
+ navigate: vitest_1.vi.fn()
59
+ };
60
+ const branding = { title: "ACME" };
61
+ (0, react_1.act)(() => {
62
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(AppProviderComponent_1.AppProvider, { branding: branding, navigation: navigation, router: router, children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageDataContextProvider, { children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}) }) }));
63
+ });
64
+ const breadcrumbs = react_1.screen.getByRole("navigation", { name: "breadcrumb" });
65
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("ACME")).toBeTruthy();
66
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("Home")).toBeTruthy();
67
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("Orders")).toBeTruthy();
68
+ });
69
+ (0, vitest_1.test)("renders dynamic correctly", async () => {
70
+ const user = user_event_1.userEvent.setup();
71
+ const router = {
72
+ pathname: "/orders/123",
73
+ searchParams: new URLSearchParams(),
74
+ navigate: vitest_1.vi.fn()
75
+ };
76
+ (0, react_1.act)(() => {
77
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(AppProviderComponent_1.AppProvider, { navigation: [
78
+ { segment: "", title: "Home" },
79
+ { segment: "orders", title: "Orders", pattern: "orders/:id" }
80
+ ], router: router, children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageDataContextProvider, { children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}) }) }));
81
+ });
82
+ const breadcrumbs = react_1.screen.getByRole("navigation", { name: "breadcrumb" });
83
+ const homeLink = (0, react_1.within)(breadcrumbs).getByRole("link", { name: "Home" });
84
+ await user.click(homeLink);
85
+ (0, vitest_1.expect)(router.navigate).toHaveBeenCalledWith("/", vitest_1.expect.objectContaining({}));
86
+ router.navigate.mockClear();
87
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("Orders")).toBeTruthy();
88
+ (0, vitest_1.expect)(react_1.screen.getByText("Orders", { ignore: "nav *" }));
89
+ });
90
+ (0, vitest_1.test)("renders nested dynamic correctly", async () => {
91
+ const router = {
92
+ pathname: "/users/invoices/123",
93
+ searchParams: new URLSearchParams(),
94
+ navigate: vitest_1.vi.fn()
95
+ };
96
+ (0, react_1.act)(() => {
97
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(AppProviderComponent_1.AppProvider, { navigation: [
98
+ {
99
+ segment: "users",
100
+ title: "Users",
101
+ children: [
102
+ {
103
+ segment: "invoices",
104
+ title: "Invoices",
105
+ pattern: "invoices/:id"
106
+ }
107
+ ]
108
+ }
109
+ ], router: router, children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageDataContextProvider, { children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}) }) }));
110
+ });
111
+ const breadcrumbs = react_1.screen.getByRole("navigation", { name: "breadcrumb" });
112
+ const homeLink = (0, react_1.within)(breadcrumbs).getByRole("link", { name: "Users" });
113
+ (0, vitest_1.expect)(homeLink.getAttribute("href")).toBe("/users");
114
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("Invoices")).toBeTruthy();
115
+ });
116
+ (0, vitest_1.test)("renders custom breadcrumbs", async () => {
117
+ (0, react_1.act)(() => {
118
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(PageContainer_1.PageDataContextProvider, { breadcrumbs: [
119
+ { title: "Hello", path: "/hello" },
120
+ { title: "World", path: "/world" }
121
+ ], children: (0, jsx_runtime_1.jsx)(PageContainer_1.PageContainer, {}) }));
122
+ });
123
+ const breadcrumbs = react_1.screen.getByRole("navigation", { name: "breadcrumb" });
124
+ const helloLink = (0, react_1.within)(breadcrumbs).getByRole("link", { name: "Hello" });
125
+ (0, vitest_1.expect)(helloLink.getAttribute("href")).toBe("/hello");
126
+ (0, vitest_1.expect)((0, react_1.within)(breadcrumbs).getByText("World")).toBeTruthy();
127
+ });
128
+ });