@iowas/toolpad 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,206 +1,2952 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
- var chunkSITC3EZQ_js = require('./chunk-SITC3EZQ.js');
4
- var chunkSWAF5R4Y_js = require('./chunk-SWAF5R4Y.js');
5
- var chunkVMBNHIHN_js = require('./chunk-VMBNHIHN.js');
6
- var chunkBN55HN4U_js = require('./chunk-BN55HN4U.js');
7
- var chunk5B2NQDIH_js = require('./chunk-5B2NQDIH.js');
4
+ var React26 = require('react');
5
+ var PropTypes11 = require('prop-types');
6
+ var Popover = require('@mui/material/Popover');
7
+ var Divider = require('@mui/material/Divider');
8
+ var Stack = require('@mui/material/Stack');
9
+ var Button2 = require('@mui/material/Button');
10
+ var styles = require('@mui/material/styles');
11
+ var material = require('@mui/material');
12
+ var CloseIcon = require('@mui/icons-material/Close');
13
+ var useSlotProps = require('@mui/utils/useSlotProps');
14
+ var jsxRuntime = require('react/jsx-runtime');
15
+ require('react-is');
16
+ var Dialog = require('@mui/material/Dialog');
17
+ var DialogTitle = require('@mui/material/DialogTitle');
18
+ var DialogContent = require('@mui/material/DialogContent');
19
+ var DialogActions = require('@mui/material/DialogActions');
20
+ var TextField = require('@mui/material/TextField');
21
+ var DialogContentText = require('@mui/material/DialogContentText');
22
+ var invariant2 = require('invariant');
23
+ var useEventCallback = require('@mui/utils/useEventCallback');
24
+ var InitColorSchemeScript = require('@mui/material/InitColorSchemeScript');
25
+ var CssBaseline = require('@mui/material/CssBaseline');
26
+ var LogoutIcon = require('@mui/icons-material/Logout');
27
+ var Avatar = require('@mui/material/Avatar');
28
+ var Typography = require('@mui/material/Typography');
29
+ var Tooltip = require('@mui/material/Tooltip');
30
+ var IconButton2 = require('@mui/material/IconButton');
31
+ var MoreVertIcon = require('@mui/icons-material/MoreVert');
32
+ var Box4 = require('@mui/material/Box');
33
+ var useMediaQuery2 = require('@mui/material/useMediaQuery');
34
+ var Drawer = require('@mui/material/Drawer');
35
+ var Toolbar2 = require('@mui/material/Toolbar');
36
+ var MuiAppBar = require('@mui/material/AppBar');
37
+ var MenuIcon = require('@mui/icons-material/Menu');
38
+ var MenuOpenIcon = require('@mui/icons-material/MenuOpen');
39
+ var DarkModeIcon = require('@mui/icons-material/DarkMode');
40
+ var LightModeIcon = require('@mui/icons-material/LightMode');
41
+ var List = require('@mui/material/List');
42
+ var ListSubheader = require('@mui/material/ListSubheader');
43
+ var pathToRegexp = require('path-to-regexp');
44
+ var Collapse = require('@mui/material/Collapse');
45
+ var Grow = require('@mui/material/Grow');
46
+ var ListItem = require('@mui/material/ListItem');
47
+ var ListItemButton = require('@mui/material/ListItemButton');
48
+ var ListItemIcon = require('@mui/material/ListItemIcon');
49
+ var ListItemText = require('@mui/material/ListItemText');
50
+ var Paper = require('@mui/material/Paper');
51
+ var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
52
+ var Container = require('@mui/material/Container');
53
+ var Breadcrumbs = require('@mui/material/Breadcrumbs');
54
+ var Link4 = require('@mui/material/Link');
55
+ var NextLink = require('next/link.js');
56
+ var navigation_js = require('next/navigation.js');
8
57
 
58
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
59
 
60
+ function _interopNamespace(e) {
61
+ if (e && e.__esModule) return e;
62
+ var n = Object.create(null);
63
+ if (e) {
64
+ Object.keys(e).forEach(function (k) {
65
+ if (k !== 'default') {
66
+ var d = Object.getOwnPropertyDescriptor(e, k);
67
+ Object.defineProperty(n, k, d.get ? d : {
68
+ enumerable: true,
69
+ get: function () { return e[k]; }
70
+ });
71
+ }
72
+ });
73
+ }
74
+ n.default = e;
75
+ return Object.freeze(n);
76
+ }
10
77
 
11
- Object.defineProperty(exports, "Account", {
12
- enumerable: true,
13
- get: function () { return chunkSITC3EZQ_js.Account; }
14
- });
15
- Object.defineProperty(exports, "AccountPopoverFooter", {
16
- enumerable: true,
17
- get: function () { return chunkSITC3EZQ_js.AccountPopoverFooter; }
18
- });
19
- Object.defineProperty(exports, "AccountPopoverHeader", {
20
- enumerable: true,
21
- get: function () { return chunkSITC3EZQ_js.AccountPopoverHeader; }
22
- });
23
- Object.defineProperty(exports, "AccountPreview", {
24
- enumerable: true,
25
- get: function () { return chunkSITC3EZQ_js.AccountPreview; }
26
- });
27
- Object.defineProperty(exports, "AlertDialog", {
28
- enumerable: true,
29
- get: function () { return chunkSITC3EZQ_js.AlertDialog; }
30
- });
31
- Object.defineProperty(exports, "ConfirmDialog", {
32
- enumerable: true,
33
- get: function () { return chunkSITC3EZQ_js.ConfirmDialog; }
34
- });
35
- Object.defineProperty(exports, "DashboardHeader", {
36
- enumerable: true,
37
- get: function () { return chunkSITC3EZQ_js.DashboardHeader; }
38
- });
39
- Object.defineProperty(exports, "DashboardLayout", {
40
- enumerable: true,
41
- get: function () { return chunkSITC3EZQ_js.DashboardLayout; }
42
- });
43
- Object.defineProperty(exports, "DashboardSidebarPageItem", {
44
- enumerable: true,
45
- get: function () { return chunkSITC3EZQ_js.DashboardSidebarPageItem; }
46
- });
47
- Object.defineProperty(exports, "PageContainer", {
48
- enumerable: true,
49
- get: function () { return chunkSITC3EZQ_js.PageContainer; }
50
- });
51
- Object.defineProperty(exports, "PageHeader", {
52
- enumerable: true,
53
- get: function () { return chunkSITC3EZQ_js.PageHeader; }
54
- });
55
- Object.defineProperty(exports, "PageHeaderToolbar", {
56
- enumerable: true,
57
- get: function () { return chunkSITC3EZQ_js.PageHeaderToolbar; }
58
- });
59
- Object.defineProperty(exports, "PromptDialog", {
60
- enumerable: true,
61
- get: function () { return chunkSITC3EZQ_js.PromptDialog; }
62
- });
63
- Object.defineProperty(exports, "SignInButton", {
64
- enumerable: true,
65
- get: function () { return chunkSITC3EZQ_js.SignInButton; }
66
- });
67
- Object.defineProperty(exports, "SignOutButton", {
68
- enumerable: true,
69
- get: function () { return chunkSITC3EZQ_js.SignOutButton; }
70
- });
71
- Object.defineProperty(exports, "ThemeSwitcher", {
72
- enumerable: true,
73
- get: function () { return chunkSITC3EZQ_js.ThemeSwitcher; }
74
- });
75
- Object.defineProperty(exports, "ToolbarActions", {
76
- enumerable: true,
77
- get: function () { return chunkSITC3EZQ_js.ToolbarActions; }
78
- });
79
- Object.defineProperty(exports, "useActivePage", {
80
- enumerable: true,
81
- get: function () { return chunkSITC3EZQ_js.useActivePage; }
82
- });
83
- Object.defineProperty(exports, "useDialogs", {
84
- enumerable: true,
85
- get: function () { return chunkSITC3EZQ_js.useDialogs; }
86
- });
87
- Object.defineProperty(exports, "useNotifications", {
88
- enumerable: true,
89
- get: function () { return chunkSITC3EZQ_js.useNotifications; }
90
- });
91
- Object.defineProperty(exports, "AppProvider", {
92
- enumerable: true,
93
- get: function () { return chunkSWAF5R4Y_js.AppProvider; }
94
- });
95
- Object.defineProperty(exports, "AuthenticationContext", {
96
- enumerable: true,
97
- get: function () { return chunkSWAF5R4Y_js.AuthenticationContext; }
98
- });
99
- Object.defineProperty(exports, "DialogsProvider", {
100
- enumerable: true,
101
- get: function () { return chunkSWAF5R4Y_js.DialogsProvider; }
102
- });
103
- Object.defineProperty(exports, "LocalizationContext", {
104
- enumerable: true,
105
- get: function () { return chunkSWAF5R4Y_js.LocalizationContext; }
106
- });
107
- Object.defineProperty(exports, "LocalizationProvider", {
108
- enumerable: true,
109
- get: function () { return chunkSWAF5R4Y_js.LocalizationProvider; }
110
- });
111
- Object.defineProperty(exports, "NotificationsProvider", {
112
- enumerable: true,
113
- get: function () { return chunkSWAF5R4Y_js.NotificationsProvider; }
114
- });
115
- Object.defineProperty(exports, "SessionContext", {
116
- enumerable: true,
117
- get: function () { return chunkSWAF5R4Y_js.SessionContext; }
118
- });
119
- Object.defineProperty(exports, "en", {
120
- enumerable: true,
121
- get: function () { return chunkSWAF5R4Y_js.en_default; }
122
- });
123
- Object.defineProperty(exports, "useLocalStorageState", {
124
- enumerable: true,
125
- get: function () { return chunkSWAF5R4Y_js.useLocalStorageState; }
126
- });
127
- Object.defineProperty(exports, "useLocaleText", {
128
- enumerable: true,
129
- get: function () { return chunkSWAF5R4Y_js.useLocaleText; }
130
- });
131
- Object.defineProperty(exports, "useStorageState", {
132
- enumerable: true,
133
- get: function () { return chunkSWAF5R4Y_js.useStorageState; }
134
- });
135
- Object.defineProperty(exports, "useStorageStateServer", {
136
- enumerable: true,
137
- get: function () { return chunkSWAF5R4Y_js.useStorageStateServer; }
138
- });
139
- Object.defineProperty(exports, "asArray", {
140
- enumerable: true,
141
- get: function () { return chunkVMBNHIHN_js.asArray; }
142
- });
143
- Object.defineProperty(exports, "equalProperties", {
144
- enumerable: true,
145
- get: function () { return chunkVMBNHIHN_js.equalProperties; }
146
- });
147
- Object.defineProperty(exports, "filterKeys", {
148
- enumerable: true,
149
- get: function () { return chunkVMBNHIHN_js.filterKeys; }
150
- });
151
- Object.defineProperty(exports, "filterValues", {
152
- enumerable: true,
153
- get: function () { return chunkVMBNHIHN_js.filterValues; }
154
- });
155
- Object.defineProperty(exports, "hasOwnProperty", {
156
- enumerable: true,
157
- get: function () { return chunkVMBNHIHN_js.hasOwnProperty; }
158
- });
159
- Object.defineProperty(exports, "mapKeys", {
160
- enumerable: true,
161
- get: function () { return chunkVMBNHIHN_js.mapKeys; }
162
- });
163
- Object.defineProperty(exports, "mapProperties", {
164
- enumerable: true,
165
- get: function () { return chunkVMBNHIHN_js.mapProperties; }
166
- });
167
- Object.defineProperty(exports, "mapValues", {
168
- enumerable: true,
169
- get: function () { return chunkVMBNHIHN_js.mapValues; }
170
- });
171
- Object.defineProperty(exports, "useBoolean", {
172
- enumerable: true,
173
- get: function () { return chunkVMBNHIHN_js.useBoolean; }
174
- });
175
- Object.defineProperty(exports, "usePageTitle", {
176
- enumerable: true,
177
- get: function () { return chunkVMBNHIHN_js.usePageTitle; }
178
- });
179
- Object.defineProperty(exports, "warnOnce", {
180
- enumerable: true,
181
- get: function () { return chunkBN55HN4U_js.warnOnce; }
78
+ var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
79
+ var PropTypes11__default = /*#__PURE__*/_interopDefault(PropTypes11);
80
+ var Popover__default = /*#__PURE__*/_interopDefault(Popover);
81
+ var Divider__default = /*#__PURE__*/_interopDefault(Divider);
82
+ var Stack__default = /*#__PURE__*/_interopDefault(Stack);
83
+ var Button2__default = /*#__PURE__*/_interopDefault(Button2);
84
+ var CloseIcon__default = /*#__PURE__*/_interopDefault(CloseIcon);
85
+ var useSlotProps__default = /*#__PURE__*/_interopDefault(useSlotProps);
86
+ var Dialog__default = /*#__PURE__*/_interopDefault(Dialog);
87
+ var DialogTitle__default = /*#__PURE__*/_interopDefault(DialogTitle);
88
+ var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
89
+ var DialogActions__default = /*#__PURE__*/_interopDefault(DialogActions);
90
+ var TextField__default = /*#__PURE__*/_interopDefault(TextField);
91
+ var DialogContentText__default = /*#__PURE__*/_interopDefault(DialogContentText);
92
+ var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
93
+ var useEventCallback__default = /*#__PURE__*/_interopDefault(useEventCallback);
94
+ var InitColorSchemeScript__default = /*#__PURE__*/_interopDefault(InitColorSchemeScript);
95
+ var CssBaseline__default = /*#__PURE__*/_interopDefault(CssBaseline);
96
+ var LogoutIcon__default = /*#__PURE__*/_interopDefault(LogoutIcon);
97
+ var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
98
+ var Typography__default = /*#__PURE__*/_interopDefault(Typography);
99
+ var Tooltip__default = /*#__PURE__*/_interopDefault(Tooltip);
100
+ var IconButton2__default = /*#__PURE__*/_interopDefault(IconButton2);
101
+ var MoreVertIcon__default = /*#__PURE__*/_interopDefault(MoreVertIcon);
102
+ var Box4__default = /*#__PURE__*/_interopDefault(Box4);
103
+ var useMediaQuery2__default = /*#__PURE__*/_interopDefault(useMediaQuery2);
104
+ var Drawer__default = /*#__PURE__*/_interopDefault(Drawer);
105
+ var Toolbar2__default = /*#__PURE__*/_interopDefault(Toolbar2);
106
+ var MuiAppBar__default = /*#__PURE__*/_interopDefault(MuiAppBar);
107
+ var MenuIcon__default = /*#__PURE__*/_interopDefault(MenuIcon);
108
+ var MenuOpenIcon__default = /*#__PURE__*/_interopDefault(MenuOpenIcon);
109
+ var DarkModeIcon__default = /*#__PURE__*/_interopDefault(DarkModeIcon);
110
+ var LightModeIcon__default = /*#__PURE__*/_interopDefault(LightModeIcon);
111
+ var List__default = /*#__PURE__*/_interopDefault(List);
112
+ var ListSubheader__default = /*#__PURE__*/_interopDefault(ListSubheader);
113
+ var Collapse__default = /*#__PURE__*/_interopDefault(Collapse);
114
+ var Grow__default = /*#__PURE__*/_interopDefault(Grow);
115
+ var ListItem__default = /*#__PURE__*/_interopDefault(ListItem);
116
+ var ListItemButton__default = /*#__PURE__*/_interopDefault(ListItemButton);
117
+ var ListItemIcon__default = /*#__PURE__*/_interopDefault(ListItemIcon);
118
+ var ListItemText__default = /*#__PURE__*/_interopDefault(ListItemText);
119
+ var Paper__default = /*#__PURE__*/_interopDefault(Paper);
120
+ var ExpandMoreIcon__default = /*#__PURE__*/_interopDefault(ExpandMoreIcon);
121
+ var Container__default = /*#__PURE__*/_interopDefault(Container);
122
+ var Breadcrumbs__default = /*#__PURE__*/_interopDefault(Breadcrumbs);
123
+ var Link4__default = /*#__PURE__*/_interopDefault(Link4);
124
+ var NextLink__default = /*#__PURE__*/_interopDefault(NextLink);
125
+
126
+ var __defProp = Object.defineProperty;
127
+ var __defProps = Object.defineProperties;
128
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
129
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
130
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
131
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
132
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
133
+ var __spreadValues = (a, b) => {
134
+ for (var prop in b || (b = {}))
135
+ if (__hasOwnProp.call(b, prop))
136
+ __defNormalProp(a, prop, b[prop]);
137
+ if (__getOwnPropSymbols)
138
+ for (var prop of __getOwnPropSymbols(b)) {
139
+ if (__propIsEnum.call(b, prop))
140
+ __defNormalProp(a, prop, b[prop]);
141
+ }
142
+ return a;
143
+ };
144
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
145
+ var __objRest = (source, exclude) => {
146
+ var target = {};
147
+ for (var prop in source)
148
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
149
+ target[prop] = source[prop];
150
+ if (source != null && __getOwnPropSymbols)
151
+ for (var prop of __getOwnPropSymbols(source)) {
152
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
153
+ target[prop] = source[prop];
154
+ }
155
+ return target;
156
+ };
157
+ var NotificationsContext = React26__namespace.createContext(null);
158
+
159
+ // src/toolpad-core/useNotifications/useNotifications.tsx
160
+ var serverNotifications = {
161
+ show: () => {
162
+ throw new Error("Not supported on server side");
163
+ },
164
+ close: () => {
165
+ throw new Error("Not supported on server side");
166
+ }
167
+ };
168
+ function useNotifications() {
169
+ const context = React26__namespace.useContext(NotificationsContext);
170
+ if (context) {
171
+ return context;
172
+ }
173
+ return serverNotifications;
174
+ }
175
+
176
+ // src/toolpad-core/locales/getLocalization.ts
177
+ var getLocalization = (translations) => {
178
+ return {
179
+ components: {
180
+ MuiLocalizationProvider: {
181
+ defaultProps: {
182
+ localeText: __spreadValues({}, translations)
183
+ }
184
+ }
185
+ }
186
+ };
187
+ };
188
+
189
+ // src/toolpad-core/locales/en.tsx
190
+ var enLabels = {
191
+ // Account
192
+ accountSignInLabel: "Sign In",
193
+ accountSignOutLabel: "Sign Out",
194
+ // AccountPreview
195
+ accountPreviewTitle: "Account",
196
+ accountPreviewIconButtonLabel: "Current User",
197
+ // SignInPage
198
+ signInTitle: (brandingTitle) => brandingTitle ? `Sign in to ${brandingTitle}` : "Sign in",
199
+ signInSubtitle: "Welcome user, please sign in to continue",
200
+ signInRememberMe: "Remember Me",
201
+ providerSignInTitle: (provider) => `Sign in with ${provider}`,
202
+ // Common authentication labels
203
+ email: "Email",
204
+ password: "Password",
205
+ username: "Username",
206
+ passkey: "Passkey",
207
+ // Common action labels
208
+ save: "Save",
209
+ cancel: "Cancel",
210
+ ok: "Ok",
211
+ or: "Or",
212
+ to: "To",
213
+ with: "With",
214
+ close: "Close",
215
+ delete: "Delete",
216
+ alert: "Alert",
217
+ confirm: "Confirm",
218
+ loading: "Loading...",
219
+ // CRUD
220
+ createNewButtonLabel: "Create new",
221
+ reloadButtonLabel: "Reload data",
222
+ createLabel: "Create",
223
+ createSuccessMessage: "Item created successfully.",
224
+ createErrorMessage: "Failed to create item. Reason:",
225
+ editLabel: "Edit",
226
+ editSuccessMessage: "Item edited successfully.",
227
+ editErrorMessage: "Failed to edit item. Reason:",
228
+ deleteLabel: "Delete",
229
+ deleteConfirmTitle: "Delete item?",
230
+ deleteConfirmMessage: "Do you wish to delete this item?",
231
+ deleteConfirmLabel: "Delete",
232
+ deleteCancelLabel: "Cancel",
233
+ deleteSuccessMessage: "Item deleted successfully.",
234
+ deleteErrorMessage: "Failed to delete item. Reason:",
235
+ deletedItemMessage: "This item has been deleted."
236
+ };
237
+ var en_default = getLocalization(enLabels);
238
+ var LocalizationContext = React26__namespace.createContext({});
239
+ var LocalizationProvider = function LocalizationProvider2(props) {
240
+ var _a, _b, _c;
241
+ const { localeText: propsLocaleText, children } = props;
242
+ const theme = styles.useTheme();
243
+ const themeLocaleText = (_c = (_b = (_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a.MuiLocalizationProvider) == null ? void 0 : _b.defaultProps) == null ? void 0 : _c.localeText;
244
+ const defaultLocaleText3 = en_default.components.MuiLocalizationProvider.defaultProps.localeText;
245
+ const localeText = React26__namespace.useMemo(
246
+ () => __spreadValues(__spreadValues(__spreadValues({}, defaultLocaleText3), themeLocaleText), propsLocaleText),
247
+ [defaultLocaleText3, themeLocaleText, propsLocaleText]
248
+ );
249
+ return /* @__PURE__ */ jsxRuntime.jsx(LocalizationContext.Provider, { value: localeText, children });
250
+ };
251
+ LocalizationProvider.propTypes = {
252
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
253
+ // │ These PropTypes are generated from the TypeScript type definitions. │
254
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
255
+ // └─────────────────────────────────────────────────────────────────────┘
256
+ /**
257
+ * @ignore
258
+ */
259
+ children: PropTypes11__default.default.node,
260
+ /**
261
+ * Locale for components texts
262
+ */
263
+ localeText: PropTypes11__default.default.object
264
+ };
265
+ function useLocaleText() {
266
+ return React26__namespace.useContext(LocalizationContext);
267
+ }
268
+ function useNonNullableContext(context, name) {
269
+ const maybeContext = React26__namespace.useContext(context);
270
+ if (maybeContext === null || maybeContext === void 0) {
271
+ throw new Error(`context "${name}" was used without a Provider`);
272
+ }
273
+ return maybeContext;
274
+ }
275
+ var RootPropsContext = React26__namespace.createContext(null);
276
+ var defaultLocaleText = {
277
+ close: "Close"
278
+ };
279
+ function Notification({ notificationKey, open, message, options, badge }) {
280
+ var _a, _b, _c;
281
+ const globalLocaleText = useLocaleText();
282
+ const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
283
+ const { close } = useNonNullableContext(NotificationsContext);
284
+ const { severity, actionText, onAction, autoHideDuration } = options;
285
+ const handleClose = React26__namespace.useCallback(
286
+ (event, reason) => {
287
+ if (reason === "clickaway") {
288
+ return;
289
+ }
290
+ close(notificationKey);
291
+ },
292
+ [notificationKey, close]
293
+ );
294
+ const action = /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
295
+ onAction ? /* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", size: "small", onClick: onAction, children: actionText != null ? actionText : "Action" }) : null,
296
+ /* @__PURE__ */ jsxRuntime.jsx(
297
+ material.IconButton,
298
+ {
299
+ size: "small",
300
+ "aria-label": localeText == null ? void 0 : localeText.close,
301
+ title: localeText == null ? void 0 : localeText.close,
302
+ color: "inherit",
303
+ onClick: handleClose,
304
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon__default.default, { fontSize: "small" })
305
+ }
306
+ )
307
+ ] });
308
+ const props = React26__namespace.useContext(RootPropsContext);
309
+ const SnackbarComponent = (_b = (_a = props == null ? void 0 : props.slots) == null ? void 0 : _a.snackbar) != null ? _b : material.Snackbar;
310
+ const snackbarSlotProps = useSlotProps__default.default({
311
+ elementType: SnackbarComponent,
312
+ ownerState: props,
313
+ externalSlotProps: (_c = props == null ? void 0 : props.slotProps) == null ? void 0 : _c.snackbar,
314
+ additionalProps: {
315
+ open,
316
+ autoHideDuration,
317
+ onClose: handleClose,
318
+ action
319
+ }
320
+ });
321
+ return /* @__PURE__ */ jsxRuntime.jsx(SnackbarComponent, __spreadProps(__spreadValues({}, snackbarSlotProps), { children: /* @__PURE__ */ jsxRuntime.jsx(material.Badge, { badgeContent: badge, color: "primary", sx: { width: "100%" }, children: severity ? /* @__PURE__ */ jsxRuntime.jsx(material.Alert, { severity, sx: { width: "100%" }, action, children: message }) : /* @__PURE__ */ jsxRuntime.jsx(material.SnackbarContent, { message, action }) }) }), notificationKey);
322
+ }
323
+ function Notifications({ state }) {
324
+ var _a;
325
+ const currentNotification = (_a = state.queue[0]) != null ? _a : null;
326
+ return currentNotification ? /* @__PURE__ */ jsxRuntime.jsx(
327
+ Notification,
328
+ __spreadProps(__spreadValues({}, currentNotification), {
329
+ badge: state.queue.length > 1 ? String(state.queue.length) : null
330
+ })
331
+ ) : null;
332
+ }
333
+ var nextId = 0;
334
+ var generateId = () => {
335
+ const id = nextId;
336
+ nextId += 1;
337
+ return id;
338
+ };
339
+ function NotificationsProvider(props) {
340
+ const { children } = props;
341
+ const [state, setState] = React26__namespace.useState({ queue: [] });
342
+ const show = React26__namespace.useCallback((message, options = {}) => {
343
+ var _a;
344
+ const notificationKey = (_a = options.key) != null ? _a : `::toolpad-internal::notification::${generateId()}`;
345
+ setState((prev) => {
346
+ if (prev.queue.some((n) => n.notificationKey === notificationKey)) {
347
+ return prev;
348
+ }
349
+ return __spreadProps(__spreadValues({}, prev), {
350
+ queue: [...prev.queue, { message, options, notificationKey, open: true }]
351
+ });
352
+ });
353
+ return notificationKey;
354
+ }, []);
355
+ const close = React26__namespace.useCallback((key) => {
356
+ setState((prev) => __spreadProps(__spreadValues({}, prev), {
357
+ queue: prev.queue.filter((n) => n.notificationKey !== key)
358
+ }));
359
+ }, []);
360
+ const contextValue = React26__namespace.useMemo(() => ({ show, close }), [show, close]);
361
+ return /* @__PURE__ */ jsxRuntime.jsx(RootPropsContext.Provider, { value: props, children: /* @__PURE__ */ jsxRuntime.jsxs(NotificationsContext.Provider, { value: contextValue, children: [
362
+ children,
363
+ /* @__PURE__ */ jsxRuntime.jsx(Notifications, { state })
364
+ ] }) });
365
+ }
366
+ var DialogsContext = React26__namespace.createContext(null);
367
+ var BrandingContext = React26__namespace.createContext(null);
368
+ var NavigationContext = React26__namespace.createContext([]);
369
+ var PaletteModeContext = React26__namespace.createContext({
370
+ paletteMode: "light",
371
+ setPaletteMode: () => {
372
+ },
373
+ isDualTheme: false
182
374
  });
183
- Object.defineProperty(exports, "createGlobalState", {
184
- enumerable: true,
185
- get: function () { return chunk5B2NQDIH_js.createGlobalState; }
375
+ var RouterContext = React26__namespace.createContext(null);
376
+ var DashboardSidebarPageItemContext = React26__namespace.createContext(null);
377
+ var WindowContext = React26__namespace.createContext(void 0);
378
+ var defaultLocaleText2 = {
379
+ alert: "Alert",
380
+ confirm: "Confirm",
381
+ cancel: "Cancel",
382
+ ok: "Ok"
383
+ };
384
+ function useDialogLoadingButton(onClose) {
385
+ const [loading, setLoading] = React26__namespace.useState(false);
386
+ const handleClick = async () => {
387
+ try {
388
+ setLoading(true);
389
+ await onClose();
390
+ } finally {
391
+ setLoading(false);
392
+ }
393
+ };
394
+ return {
395
+ onClick: handleClick,
396
+ loading
397
+ };
398
+ }
399
+ function AlertDialog({ open, payload, onClose }) {
400
+ var _a, _b;
401
+ const appWindowContext = React26__namespace.useContext(WindowContext);
402
+ const globalLocaleText = useLocaleText();
403
+ const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
404
+ const okButtonProps = useDialogLoadingButton(() => onClose());
405
+ return /* @__PURE__ */ jsxRuntime.jsxs(
406
+ Dialog__default.default,
407
+ {
408
+ maxWidth: "xs",
409
+ fullWidth: true,
410
+ open,
411
+ onClose: () => onClose(),
412
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
413
+ children: [
414
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.alert }),
415
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
416
+ /* @__PURE__ */ jsxRuntime.jsx(DialogActions__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
417
+ ]
418
+ }
419
+ );
420
+ }
421
+ function ConfirmDialog({ open, payload, onClose }) {
422
+ var _a, _b, _c;
423
+ const appWindowContext = React26__namespace.useContext(WindowContext);
424
+ const globalLocaleText = useLocaleText();
425
+ const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
426
+ const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
427
+ const okButtonProps = useDialogLoadingButton(() => onClose(true));
428
+ return /* @__PURE__ */ jsxRuntime.jsxs(
429
+ Dialog__default.default,
430
+ {
431
+ maxWidth: "xs",
432
+ fullWidth: true,
433
+ open,
434
+ onClose: () => onClose(false),
435
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
436
+ children: [
437
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
438
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
439
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
440
+ /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
441
+ /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
442
+ ] })
443
+ ]
444
+ }
445
+ );
446
+ }
447
+ function PromptDialog({ open, payload, onClose }) {
448
+ var _a, _b, _c;
449
+ const appWindowContext = React26__namespace.useContext(WindowContext);
450
+ const globalLocaleText = useLocaleText();
451
+ const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
452
+ const [input, setInput] = React26__namespace.useState("");
453
+ const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
454
+ const [loading, setLoading] = React26__namespace.useState(false);
455
+ const name = "input";
456
+ return /* @__PURE__ */ jsxRuntime.jsxs(
457
+ Dialog__default.default,
458
+ {
459
+ maxWidth: "xs",
460
+ fullWidth: true,
461
+ open,
462
+ onClose: () => onClose(null),
463
+ PaperProps: {
464
+ component: "form",
465
+ onSubmit: async (event) => {
466
+ var _a2;
467
+ event.preventDefault();
468
+ try {
469
+ setLoading(true);
470
+ const formData = new FormData(event.currentTarget);
471
+ const value = (_a2 = formData.get(name)) != null ? _a2 : "";
472
+ invariant2__default.default(typeof value === "string", "Value must come from a text input");
473
+ await onClose(value);
474
+ } finally {
475
+ setLoading(false);
476
+ }
477
+ }
478
+ },
479
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
480
+ children: [
481
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
482
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogContent__default.default, { children: [
483
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogContentText__default.default, { children: [
484
+ payload.msg,
485
+ " "
486
+ ] }),
487
+ /* @__PURE__ */ jsxRuntime.jsx(
488
+ TextField__default.default,
489
+ {
490
+ autoFocus: true,
491
+ required: true,
492
+ margin: "dense",
493
+ id: "name",
494
+ name,
495
+ type: "text",
496
+ fullWidth: true,
497
+ variant: "standard",
498
+ value: input,
499
+ onChange: (event) => setInput(event.target.value)
500
+ }
501
+ )
502
+ ] }),
503
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
504
+ /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
505
+ /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
506
+ ] })
507
+ ]
508
+ }
509
+ );
510
+ }
511
+ function useDialogs() {
512
+ const { open, close } = useNonNullableContext(DialogsContext);
513
+ const alert = useEventCallback__default.default(
514
+ (msg, _a = {}) => {
515
+ var _b = _a, { onClose } = _b, options = __objRest(_b, ["onClose"]);
516
+ return open(AlertDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
517
+ }
518
+ );
519
+ const confirm = useEventCallback__default.default(
520
+ (msg, _c = {}) => {
521
+ var _d = _c, { onClose } = _d, options = __objRest(_d, ["onClose"]);
522
+ return open(ConfirmDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
523
+ }
524
+ );
525
+ const prompt = useEventCallback__default.default(
526
+ (msg, _e = {}) => {
527
+ var _f = _e, { onClose } = _f, options = __objRest(_f, ["onClose"]);
528
+ return open(PromptDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
529
+ }
530
+ );
531
+ return React26__namespace.useMemo(
532
+ () => ({
533
+ alert,
534
+ confirm,
535
+ prompt,
536
+ open,
537
+ close
538
+ }),
539
+ [alert, close, confirm, open, prompt]
540
+ );
541
+ }
542
+ function DialogsProvider(props) {
543
+ const { children, unmountAfter = 1e3 } = props;
544
+ const [stack, setStack] = React26__namespace.useState([]);
545
+ const keyPrefix = React26__namespace.useId();
546
+ const nextId2 = React26__namespace.useRef(0);
547
+ const dialogMetadata = React26__namespace.useRef(/* @__PURE__ */ new WeakMap());
548
+ const requestDialog = useEventCallback__default.default(function open(Component, payload, options = {}) {
549
+ const { onClose = async () => {
550
+ } } = options;
551
+ let resolve;
552
+ const promise = new Promise((resolveImpl) => {
553
+ resolve = resolveImpl;
554
+ });
555
+ invariant2__default.default(resolve, "resolve not set");
556
+ const key = `${keyPrefix}-${nextId2.current}`;
557
+ nextId2.current += 1;
558
+ const newEntry = {
559
+ key,
560
+ open: true,
561
+ promise,
562
+ Component,
563
+ payload,
564
+ onClose,
565
+ resolve
566
+ };
567
+ dialogMetadata.current.set(promise, newEntry);
568
+ setStack((prevStack) => [...prevStack, newEntry]);
569
+ return promise;
570
+ });
571
+ const closeDialogUi = useEventCallback__default.default(function closeDialogUi2(dialog) {
572
+ setStack(
573
+ (prevStack) => prevStack.map((entry) => entry.promise === dialog ? __spreadProps(__spreadValues({}, entry), { open: false }) : entry)
574
+ );
575
+ setTimeout(() => {
576
+ setStack((prevStack) => prevStack.filter((entry) => entry.promise !== dialog));
577
+ }, unmountAfter);
578
+ });
579
+ const closeDialog = useEventCallback__default.default(async function closeDialog2(dialog, result) {
580
+ const entryToClose = dialogMetadata.current.get(dialog);
581
+ invariant2__default.default(entryToClose, "dialog not found");
582
+ try {
583
+ await entryToClose.onClose(result);
584
+ } finally {
585
+ entryToClose.resolve(result);
586
+ closeDialogUi(dialog);
587
+ }
588
+ return dialog;
589
+ });
590
+ const contextValue = React26__namespace.useMemo(
591
+ () => ({ open: requestDialog, close: closeDialog }),
592
+ [requestDialog, closeDialog]
593
+ );
594
+ return /* @__PURE__ */ jsxRuntime.jsxs(DialogsContext.Provider, { value: contextValue, children: [
595
+ children,
596
+ stack.map(({ key, open, Component, payload, promise }) => /* @__PURE__ */ jsxRuntime.jsx(
597
+ Component,
598
+ {
599
+ payload,
600
+ open,
601
+ onClose: async (result) => {
602
+ await closeDialog(promise, result);
603
+ }
604
+ },
605
+ key
606
+ ))
607
+ ] });
608
+ }
609
+
610
+ // src/toolpad-core/persistence/codec.tsx
611
+ var CODEC_STRING = {
612
+ parse: (value) => value,
613
+ stringify: (value) => value
614
+ };
615
+
616
+ // src/toolpad-core/persistence/useStorageState.tsx
617
+ var currentTabChangeListeners = /* @__PURE__ */ new Map();
618
+ function onCurrentTabStorageChange(key, handler) {
619
+ let listeners = currentTabChangeListeners.get(key);
620
+ if (!listeners) {
621
+ listeners = /* @__PURE__ */ new Set();
622
+ currentTabChangeListeners.set(key, listeners);
623
+ }
624
+ listeners.add(handler);
625
+ }
626
+ function offCurrentTabStorageChange(key, handler) {
627
+ const listeners = currentTabChangeListeners.get(key);
628
+ if (!listeners) {
629
+ return;
630
+ }
631
+ listeners.delete(handler);
632
+ if (listeners.size === 0) {
633
+ currentTabChangeListeners.delete(key);
634
+ }
635
+ }
636
+ function emitCurrentTabStorageChange(key) {
637
+ const listeners = currentTabChangeListeners.get(key);
638
+ if (listeners) {
639
+ listeners.forEach((listener) => listener());
640
+ }
641
+ }
642
+ if (typeof window !== "undefined") {
643
+ const origSetItem = window.localStorage.setItem;
644
+ window.localStorage.setItem = function setItem(key, value) {
645
+ const result = origSetItem.call(this, key, value);
646
+ emitCurrentTabStorageChange(key);
647
+ return result;
648
+ };
649
+ }
650
+ function subscribe(area, key, callback) {
651
+ if (!key) {
652
+ return () => {
653
+ };
654
+ }
655
+ const storageHandler = (event) => {
656
+ if (event.storageArea === area && event.key === key) {
657
+ callback();
658
+ }
659
+ };
660
+ window.addEventListener("storage", storageHandler);
661
+ onCurrentTabStorageChange(key, callback);
662
+ return () => {
663
+ window.removeEventListener("storage", storageHandler);
664
+ offCurrentTabStorageChange(key, callback);
665
+ };
666
+ }
667
+ function getSnapshot(area, key) {
668
+ if (!key) {
669
+ return null;
670
+ }
671
+ try {
672
+ return area.getItem(key);
673
+ } catch (e) {
674
+ return null;
675
+ }
676
+ }
677
+ function setValue(area, key, value) {
678
+ if (!key) {
679
+ return;
680
+ }
681
+ try {
682
+ if (value === null) {
683
+ area.removeItem(key);
684
+ } else {
685
+ area.setItem(key, String(value));
686
+ }
687
+ } catch (e) {
688
+ return;
689
+ }
690
+ emitCurrentTabStorageChange(key);
691
+ }
692
+ var serverValue = [null, () => {
693
+ }];
694
+ function useStorageStateServer() {
695
+ return serverValue;
696
+ }
697
+ function encode(codec, value) {
698
+ return value === null ? null : codec.stringify(value);
699
+ }
700
+ function decode(codec, value) {
701
+ return value === null ? null : codec.parse(value);
702
+ }
703
+ var getKeyServerSnapshot = () => null;
704
+ function useStorageState(area, key, initializer = null, options) {
705
+ var _a;
706
+ const codec = (_a = options == null ? void 0 : options.codec) != null ? _a : CODEC_STRING;
707
+ const [initialValue] = React26__namespace.useState(initializer);
708
+ const encodedInitialValue = React26__namespace.useMemo(
709
+ () => encode(codec, initialValue),
710
+ [codec, initialValue]
711
+ );
712
+ const subscribeKey = React26__namespace.useCallback(
713
+ (callback) => subscribe(area, key, callback),
714
+ [area, key]
715
+ );
716
+ const getKeySnapshot = React26__namespace.useCallback(
717
+ () => {
718
+ var _a2;
719
+ return (_a2 = getSnapshot(area, key)) != null ? _a2 : encodedInitialValue;
720
+ },
721
+ [area, encodedInitialValue, key]
722
+ );
723
+ const encodedStoredValue = React26__namespace.useSyncExternalStore(
724
+ subscribeKey,
725
+ getKeySnapshot,
726
+ getKeyServerSnapshot
727
+ );
728
+ const storedValue = React26__namespace.useMemo(
729
+ () => decode(codec, encodedStoredValue),
730
+ [codec, encodedStoredValue]
731
+ );
732
+ const setStoredValue = React26__namespace.useCallback(
733
+ (value) => {
734
+ const valueToStore = value instanceof Function ? value(storedValue) : value;
735
+ const encodedValueToStore = encode(codec, valueToStore);
736
+ setValue(area, key, encodedValueToStore);
737
+ },
738
+ [area, codec, storedValue, key]
739
+ );
740
+ const [nonStoredValue, setNonStoredValue] = React26__namespace.useState(initialValue);
741
+ if (!key) {
742
+ return [nonStoredValue, setNonStoredValue];
743
+ }
744
+ return [storedValue, setStoredValue];
745
+ }
746
+
747
+ // src/toolpad-core/useLocalStorageState/useLocalStorageState.tsx
748
+ var useLocalStorageStateBrowser = (...args) => useStorageState(window.localStorage, ...args);
749
+ var useLocalStorageState = typeof window === "undefined" ? useStorageStateServer : useLocalStorageStateBrowser;
750
+ var COLOR_SCHEME_STORAGE_KEY = "toolpad-color-scheme";
751
+ var MODE_STORAGE_KEY = "toolpad-mode";
752
+ function usePreferredMode(window2) {
753
+ const prefersDarkMode = material.useMediaQuery(
754
+ "(prefers-color-scheme: dark)",
755
+ window2 && {
756
+ matchMedia: window2.matchMedia
757
+ }
758
+ );
759
+ return prefersDarkMode ? "dark" : "light";
760
+ }
761
+ function isCssVarsTheme(theme) {
762
+ return "vars" in theme;
763
+ }
764
+ function LegacyThemeProvider(props) {
765
+ const { children, theme, window: appWindow } = props;
766
+ invariant2__default.default(!isCssVarsTheme(theme), "This provider only accepts legacy themes.");
767
+ const isDualTheme = "light" in theme || "dark" in theme;
768
+ const preferredMode = usePreferredMode(appWindow);
769
+ const [userMode, setUserMode] = useLocalStorageState(MODE_STORAGE_KEY, "system");
770
+ const paletteMode = !userMode || userMode === "system" ? preferredMode : userMode;
771
+ const dualAwareTheme = React26__namespace.useMemo(
772
+ () => {
773
+ var _a;
774
+ return isDualTheme ? (_a = theme[paletteMode === "dark" ? "dark" : "light"]) != null ? _a : theme[paletteMode === "dark" ? "light" : "dark"] : theme;
775
+ },
776
+ [isDualTheme, paletteMode, theme]
777
+ );
778
+ const paletteModeContextValue = React26__namespace.useMemo(
779
+ () => ({
780
+ paletteMode,
781
+ setPaletteMode: setUserMode,
782
+ isDualTheme
783
+ }),
784
+ [isDualTheme, paletteMode, setUserMode]
785
+ );
786
+ return /* @__PURE__ */ jsxRuntime.jsx(styles.ThemeProvider, { theme: dualAwareTheme, children: /* @__PURE__ */ jsxRuntime.jsxs(PaletteModeContext.Provider, { value: paletteModeContextValue, children: [
787
+ /* @__PURE__ */ jsxRuntime.jsx(CssBaseline__default.default, { enableColorScheme: true }),
788
+ children
789
+ ] }) });
790
+ }
791
+ function CssVarsPaletteModeProvider(props) {
792
+ const { children, window: appWindow } = props;
793
+ const preferredMode = usePreferredMode(appWindow);
794
+ const { mode, setMode, allColorSchemes } = styles.useColorScheme();
795
+ const paletteModeContextValue = React26__namespace.useMemo(() => {
796
+ return {
797
+ paletteMode: !mode || mode === "system" ? preferredMode : mode,
798
+ setPaletteMode: setMode,
799
+ isDualTheme: allColorSchemes.length > 1
800
+ };
801
+ }, [allColorSchemes, mode, preferredMode, setMode]);
802
+ return /* @__PURE__ */ jsxRuntime.jsx(PaletteModeContext.Provider, { value: paletteModeContextValue, children });
803
+ }
804
+ function CssVarsThemeProvider(props) {
805
+ const { children, theme, window: appWindow, nonce } = props;
806
+ invariant2__default.default(isCssVarsTheme(theme), "This provider only accepts CSS vars themes.");
807
+ return /* @__PURE__ */ jsxRuntime.jsxs(
808
+ styles.ThemeProvider,
809
+ {
810
+ theme,
811
+ documentNode: appWindow == null ? void 0 : appWindow.document,
812
+ colorSchemeNode: appWindow == null ? void 0 : appWindow.document.documentElement,
813
+ disableNestedContext: true,
814
+ colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
815
+ modeStorageKey: MODE_STORAGE_KEY,
816
+ children: [
817
+ /* @__PURE__ */ jsxRuntime.jsx(
818
+ InitColorSchemeScript__default.default,
819
+ {
820
+ attribute: theme.colorSchemeSelector,
821
+ colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
822
+ modeStorageKey: MODE_STORAGE_KEY,
823
+ nonce
824
+ }
825
+ ),
826
+ /* @__PURE__ */ jsxRuntime.jsxs(CssVarsPaletteModeProvider, { window: appWindow, children: [
827
+ /* @__PURE__ */ jsxRuntime.jsx(CssBaseline__default.default, { enableColorScheme: true }),
828
+ children
829
+ ] })
830
+ ]
831
+ }
832
+ );
833
+ }
834
+ function AppThemeProvider(props) {
835
+ const _a = props, { children, theme } = _a, rest = __objRest(_a, ["children", "theme"]);
836
+ const useCssVarsProvider = isCssVarsTheme(theme);
837
+ return useCssVarsProvider ? /* @__PURE__ */ jsxRuntime.jsx(CssVarsThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children })) : /* @__PURE__ */ jsxRuntime.jsx(LegacyThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children }));
838
+ }
839
+ var AuthenticationContext = React26__namespace.createContext(null);
840
+ var SessionContext = React26__namespace.createContext(null);
841
+ function createDefaultTheme() {
842
+ return styles.createTheme({
843
+ cssVariables: {
844
+ colorSchemeSelector: "data-toolpad-color-scheme"
845
+ },
846
+ colorSchemes: { dark: true }
847
+ });
848
+ }
849
+ function AppProvider(props) {
850
+ const {
851
+ children,
852
+ theme = createDefaultTheme(),
853
+ branding = null,
854
+ navigation = [],
855
+ localeText,
856
+ router = null,
857
+ authentication = null,
858
+ session = null,
859
+ window: appWindow,
860
+ nonce
861
+ } = props;
862
+ return /* @__PURE__ */ jsxRuntime.jsx(WindowContext.Provider, { value: appWindow, children: /* @__PURE__ */ jsxRuntime.jsx(AuthenticationContext.Provider, { value: authentication, children: /* @__PURE__ */ jsxRuntime.jsx(SessionContext.Provider, { value: session, children: /* @__PURE__ */ jsxRuntime.jsx(RouterContext.Provider, { value: router, children: /* @__PURE__ */ jsxRuntime.jsx(AppThemeProvider, { theme, window: appWindow, nonce, children: /* @__PURE__ */ jsxRuntime.jsx(LocalizationProvider, { localeText, children: /* @__PURE__ */ jsxRuntime.jsx(NotificationsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BrandingContext.Provider, { value: branding, children: /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: navigation, children }) }) }) }) }) }) }) }) }) });
863
+ }
864
+ AppProvider.propTypes = {
865
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
866
+ // │ These PropTypes are generated from the TypeScript type definitions. │
867
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
868
+ // └─────────────────────────────────────────────────────────────────────┘
869
+ /**
870
+ * Authentication methods.
871
+ * @default null
872
+ */
873
+ authentication: PropTypes11__default.default.shape({
874
+ signIn: PropTypes11__default.default.func.isRequired,
875
+ signOut: PropTypes11__default.default.func.isRequired
876
+ }),
877
+ /**
878
+ * Branding options for the app.
879
+ * @default null
880
+ */
881
+ branding: PropTypes11__default.default.shape({
882
+ homeUrl: PropTypes11__default.default.string,
883
+ logo: PropTypes11__default.default.node,
884
+ title: PropTypes11__default.default.string
885
+ }),
886
+ /**
887
+ * The content of the app provider.
888
+ */
889
+ children: PropTypes11__default.default.node,
890
+ /**
891
+ * Locale text for components
892
+ */
893
+ localeText: PropTypes11__default.default.object,
894
+ /**
895
+ * Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
896
+ * @default []
897
+ */
898
+ navigation: PropTypes11__default.default.arrayOf(
899
+ PropTypes11__default.default.oneOfType([
900
+ PropTypes11__default.default.shape({
901
+ action: PropTypes11__default.default.node,
902
+ children: PropTypes11__default.default.arrayOf(
903
+ PropTypes11__default.default.oneOfType([
904
+ PropTypes11__default.default.object,
905
+ PropTypes11__default.default.shape({
906
+ kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
907
+ title: PropTypes11__default.default.string.isRequired
908
+ }),
909
+ PropTypes11__default.default.shape({
910
+ kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
911
+ })
912
+ ]).isRequired
913
+ ),
914
+ icon: PropTypes11__default.default.node,
915
+ kind: PropTypes11__default.default.oneOf(["page"]),
916
+ pattern: PropTypes11__default.default.string,
917
+ segment: PropTypes11__default.default.string,
918
+ title: PropTypes11__default.default.string
919
+ }),
920
+ PropTypes11__default.default.shape({
921
+ kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
922
+ title: PropTypes11__default.default.string.isRequired
923
+ }),
924
+ PropTypes11__default.default.shape({
925
+ kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
926
+ })
927
+ ]).isRequired
928
+ ),
929
+ /**
930
+ * The nonce to be used for inline scripts.
931
+ */
932
+ nonce: PropTypes11__default.default.string,
933
+ /**
934
+ * Router implementation used inside Toolpad components.
935
+ * @default null
936
+ */
937
+ router: PropTypes11__default.default.shape({
938
+ Link: PropTypes11__default.default.elementType,
939
+ navigate: PropTypes11__default.default.func.isRequired,
940
+ pathname: PropTypes11__default.default.string.isRequired,
941
+ searchParams: PropTypes11__default.default.instanceOf(URLSearchParams).isRequired
942
+ }),
943
+ /**
944
+ * Session info about the current user.
945
+ * @default null
946
+ */
947
+ session: PropTypes11__default.default.shape({
948
+ user: PropTypes11__default.default.shape({
949
+ email: PropTypes11__default.default.string,
950
+ id: PropTypes11__default.default.string,
951
+ image: PropTypes11__default.default.string,
952
+ name: PropTypes11__default.default.string
953
+ })
954
+ }),
955
+ /**
956
+ * [Theme or themes](https://mui.com/toolpad/core/react-app-provider/#theming) to be used by the app in light/dark mode. A [CSS variables theme](https://mui.com/material-ui/customization/css-theme-variables/overview/) is recommended.
957
+ * @default createDefaultTheme()
958
+ */
959
+ theme: PropTypes11__default.default.object,
960
+ /**
961
+ * The window where the application is rendered.
962
+ * This is needed when rendering the app inside an iframe, for example.
963
+ * @default window
964
+ */
965
+ window: PropTypes11__default.default.object
966
+ };
967
+ var AccountLocaleContext = React26__namespace.createContext(null);
968
+ function SignInButton(props) {
969
+ const authentication = React26__namespace.useContext(AuthenticationContext);
970
+ const globalLocaleText = useLocaleText();
971
+ const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
972
+ const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
973
+ return /* @__PURE__ */ jsxRuntime.jsx(
974
+ Button2__default.default,
975
+ __spreadProps(__spreadValues({
976
+ disableElevation: true,
977
+ variant: "contained",
978
+ size: "small",
979
+ onClick: authentication == null ? void 0 : authentication.signIn,
980
+ sx: {
981
+ textTransform: "capitalize",
982
+ filter: "opacity(0.9)",
983
+ width: "50%",
984
+ margin: (theme) => `${theme.spacing(1)} auto`,
985
+ transition: "filter 0.2s ease-in",
986
+ "&:hover": {
987
+ filter: "opacity(1)"
988
+ }
989
+ }
990
+ }, props), {
991
+ children: localeText == null ? void 0 : localeText.accountSignInLabel
992
+ })
993
+ );
994
+ }
995
+ SignInButton.propTypes = {
996
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
997
+ // │ These PropTypes are generated from the TypeScript type definitions. │
998
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
999
+ // └─────────────────────────────────────────────────────────────────────┘
1000
+ /**
1001
+ * The content of the component.
1002
+ */
1003
+ children: PropTypes11__default.default.node
1004
+ };
1005
+ function SignOutButton(props) {
1006
+ const authentication = React26__namespace.useContext(AuthenticationContext);
1007
+ const globalLocaleText = useLocaleText();
1008
+ const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
1009
+ const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
1010
+ return /* @__PURE__ */ jsxRuntime.jsx(
1011
+ Button2__default.default,
1012
+ __spreadProps(__spreadValues({
1013
+ disabled: !authentication,
1014
+ variant: "outlined",
1015
+ size: "small",
1016
+ disableElevation: true,
1017
+ onClick: authentication == null ? void 0 : authentication.signOut,
1018
+ sx: {
1019
+ textTransform: "capitalize",
1020
+ fontWeight: "normal",
1021
+ filter: "opacity(0.9)",
1022
+ transition: "filter 0.2s ease-in",
1023
+ "&:hover": {
1024
+ filter: "opacity(1)"
1025
+ }
1026
+ },
1027
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(LogoutIcon__default.default, {})
1028
+ }, props), {
1029
+ children: localeText == null ? void 0 : localeText.accountSignOutLabel
1030
+ })
1031
+ );
1032
+ }
1033
+ SignOutButton.propTypes = {
1034
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1035
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1036
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1037
+ // └─────────────────────────────────────────────────────────────────────┘
1038
+ /**
1039
+ * The content of the component.
1040
+ */
1041
+ children: PropTypes11__default.default.node
1042
+ };
1043
+ function AccountPreview(props) {
1044
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1045
+ const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
1046
+ const session = React26__namespace.useContext(SessionContext);
1047
+ const globalLocaleText = useLocaleText();
1048
+ const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
1049
+ const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
1050
+ if (!session || !session.user) {
1051
+ return null;
1052
+ }
1053
+ const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatar, {}) : /* @__PURE__ */ jsxRuntime.jsx(
1054
+ Avatar__default.default,
1055
+ __spreadValues({
1056
+ src: ((_a = session.user) == null ? void 0 : _a.image) || "",
1057
+ alt: ((_b = session.user) == null ? void 0 : _b.name) || ((_c = session.user) == null ? void 0 : _c.email) || "",
1058
+ sx: { height: variant === "expanded" ? 48 : 32, width: variant === "expanded" ? 48 : 32 }
1059
+ }, slotProps == null ? void 0 : slotProps.avatar)
1060
+ );
1061
+ if (variant === "expanded") {
1062
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "space-between", sx: __spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
1063
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
1064
+ avatarContent,
1065
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
1066
+ /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
1067
+ /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
1068
+ ] })
1069
+ ] }),
1070
+ handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.moreIconButton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
1071
+ IconButton2__default.default,
1072
+ __spreadProps(__spreadValues({
1073
+ size: "small",
1074
+ onClick: handleClick
1075
+ }, slotProps == null ? void 0 : slotProps.moreIconButton), {
1076
+ sx: __spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
1077
+ children: /* @__PURE__ */ jsxRuntime.jsx(MoreVertIcon__default.default, { fontSize: "small" })
1078
+ })
1079
+ ))
1080
+ ] });
1081
+ }
1082
+ return /* @__PURE__ */ jsxRuntime.jsx(Tooltip__default.default, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatarIconButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, { sx: __spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsxRuntime.jsx(
1083
+ IconButton2__default.default,
1084
+ __spreadProps(__spreadValues({
1085
+ onClick: handleClick,
1086
+ "aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
1087
+ size: "small",
1088
+ "aria-controls": open ? "account-menu" : void 0,
1089
+ "aria-haspopup": "true",
1090
+ "aria-expanded": open ? "true" : void 0
1091
+ }, slotProps == null ? void 0 : slotProps.avatarIconButton), {
1092
+ sx: __spreadValues({ width: "fit-content", margin: "0 auto" }, (_h = slotProps == null ? void 0 : slotProps.avatarIconButton) == null ? void 0 : _h.sx),
1093
+ children: avatarContent
1094
+ })
1095
+ ) }) });
1096
+ }
1097
+ AccountPreview.propTypes = {
1098
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1099
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1100
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1101
+ // └─────────────────────────────────────────────────────────────────────┘
1102
+ /**
1103
+ * The handler used when the preview is expanded
1104
+ */
1105
+ handleClick: PropTypes11__default.default.func,
1106
+ /**
1107
+ * The state of the Account popover
1108
+ * @default false
1109
+ */
1110
+ open: PropTypes11__default.default.bool,
1111
+ /**
1112
+ * The props used for each slot inside.
1113
+ */
1114
+ slotProps: PropTypes11__default.default.shape({
1115
+ avatar: PropTypes11__default.default.object,
1116
+ avatarIconButton: PropTypes11__default.default.object,
1117
+ moreIconButton: PropTypes11__default.default.object
1118
+ }),
1119
+ /**
1120
+ * The components used for each slot inside.
1121
+ */
1122
+ slots: PropTypes11__default.default.shape({
1123
+ avatar: PropTypes11__default.default.elementType,
1124
+ avatarIconButton: PropTypes11__default.default.elementType,
1125
+ moreIconButton: PropTypes11__default.default.elementType
1126
+ }),
1127
+ /**
1128
+ * The prop used to customize the styling of the preview
1129
+ */
1130
+ sx: PropTypes11__default.default.oneOfType([
1131
+ PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
1132
+ PropTypes11__default.default.func,
1133
+ PropTypes11__default.default.object
1134
+ ]),
1135
+ /**
1136
+ * The type of account details to display.
1137
+ * @property {'condensed'} condensed - Shows only the user's avatar.
1138
+ * @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
1139
+ * @default 'condensed'
1140
+ */
1141
+ variant: PropTypes11__default.default.oneOf(["condensed", "expanded"])
1142
+ };
1143
+ function AccountPopoverHeader(props) {
1144
+ const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
1145
+ return /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, __spreadProps(__spreadValues({}, rest), { children }));
1146
+ }
1147
+ AccountPopoverHeader.propTypes = {
1148
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1149
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1150
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1151
+ // └─────────────────────────────────────────────────────────────────────┘
1152
+ /**
1153
+ * The content of the component.
1154
+ */
1155
+ children: PropTypes11__default.default.node
1156
+ };
1157
+ function AccountPopoverFooter(props) {
1158
+ const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
1159
+ return /* @__PURE__ */ jsxRuntime.jsx(
1160
+ Box4__default.default,
1161
+ __spreadProps(__spreadValues({}, rest), {
1162
+ sx: __spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
1163
+ children
1164
+ })
1165
+ );
1166
+ }
1167
+ AccountPopoverFooter.propTypes = {
1168
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1169
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1170
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1171
+ // └─────────────────────────────────────────────────────────────────────┘
1172
+ /**
1173
+ * @ignore
1174
+ */
1175
+ children: PropTypes11__default.default.node,
1176
+ /**
1177
+ * The system prop that allows defining system overrides as well as additional CSS styles.
1178
+ */
1179
+ sx: PropTypes11__default.default.oneOfType([
1180
+ PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
1181
+ PropTypes11__default.default.func,
1182
+ PropTypes11__default.default.object
1183
+ ])
1184
+ };
1185
+ var defaultAccountLocaleText = {
1186
+ accountPreviewIconButtonLabel: "Current User",
1187
+ accountPreviewTitle: "Account",
1188
+ accountSignInLabel: "Sign in",
1189
+ accountSignOutLabel: "Sign out"
1190
+ };
1191
+ function Account(props) {
1192
+ var _a;
1193
+ const { localeText: propsLocaleText } = props;
1194
+ const globalLocaleText = useLocaleText();
1195
+ const localeText = React26__namespace.useMemo(
1196
+ () => __spreadValues(__spreadValues(__spreadValues({}, defaultAccountLocaleText), globalLocaleText), propsLocaleText),
1197
+ [globalLocaleText, propsLocaleText]
1198
+ );
1199
+ const { slots, slotProps } = props;
1200
+ const [anchorEl, setAnchorEl] = React26__namespace.useState(null);
1201
+ const session = React26__namespace.useContext(SessionContext);
1202
+ const authentication = React26__namespace.useContext(AuthenticationContext);
1203
+ const open = Boolean(anchorEl);
1204
+ const handleClick = (event) => {
1205
+ setAnchorEl(event.currentTarget);
1206
+ };
1207
+ const handleClose = () => {
1208
+ setAnchorEl(null);
1209
+ };
1210
+ if (!authentication) {
1211
+ return null;
1212
+ }
1213
+ let accountContent = null;
1214
+ if (!(session == null ? void 0 : session.user)) {
1215
+ accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsxRuntime.jsx(SignInButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
1216
+ } else {
1217
+ accountContent = /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
1218
+ (slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsxRuntime.jsx(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsxRuntime.jsx(
1219
+ AccountPreview,
1220
+ __spreadValues({
1221
+ variant: "condensed",
1222
+ handleClick,
1223
+ open
1224
+ }, slotProps == null ? void 0 : slotProps.preview)
1225
+ ),
1226
+ (slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsxRuntime.jsx(
1227
+ slots.popover,
1228
+ __spreadValues({
1229
+ open,
1230
+ onClick: handleClick,
1231
+ onClose: handleClose
1232
+ }, slotProps == null ? void 0 : slotProps.popover)
1233
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1234
+ Popover__default.default,
1235
+ __spreadProps(__spreadValues({
1236
+ anchorEl,
1237
+ id: "account-menu",
1238
+ open,
1239
+ onClose: handleClose,
1240
+ onClick: handleClose,
1241
+ transformOrigin: { horizontal: "right", vertical: "top" },
1242
+ anchorOrigin: { horizontal: "right", vertical: "bottom" }
1243
+ }, slotProps == null ? void 0 : slotProps.popover), {
1244
+ slotProps: __spreadValues({
1245
+ paper: {
1246
+ elevation: 0,
1247
+ sx: {
1248
+ overflow: "visible",
1249
+ filter: (theme) => `drop-shadow(0px 2px 8px ${theme.palette.mode === "dark" ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.32)"})`,
1250
+ mt: 1,
1251
+ "&::before": {
1252
+ content: '""',
1253
+ display: "block",
1254
+ position: "absolute",
1255
+ top: 0,
1256
+ right: 14,
1257
+ width: 10,
1258
+ height: 10,
1259
+ bgcolor: "background.paper",
1260
+ transform: "translateY(-50%) rotate(45deg)",
1261
+ zIndex: 0
1262
+ }
1263
+ }
1264
+ }
1265
+ }, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
1266
+ children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsxRuntime.jsx(slots.popoverContent, __spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, __spreadProps(__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
1267
+ /* @__PURE__ */ jsxRuntime.jsx(AccountPopoverHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(AccountPreview, { variant: "expanded" }) }),
1268
+ /* @__PURE__ */ jsxRuntime.jsx(Divider__default.default, {}),
1269
+ /* @__PURE__ */ jsxRuntime.jsx(AccountPopoverFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(SignOutButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
1270
+ ] }))
1271
+ })
1272
+ )
1273
+ ] });
1274
+ }
1275
+ return /* @__PURE__ */ jsxRuntime.jsx(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
1276
+ }
1277
+ Account.propTypes = {
1278
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1279
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1280
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1281
+ // └─────────────────────────────────────────────────────────────────────┘
1282
+ /**
1283
+ * The labels for the account component.
1284
+ */
1285
+ localeText: PropTypes11__default.default.object,
1286
+ /**
1287
+ * The props used for each slot inside.
1288
+ */
1289
+ slotProps: PropTypes11__default.default.shape({
1290
+ popover: PropTypes11__default.default.object,
1291
+ popoverContent: PropTypes11__default.default.object,
1292
+ preview: PropTypes11__default.default.shape({
1293
+ handleClick: PropTypes11__default.default.func,
1294
+ open: PropTypes11__default.default.bool,
1295
+ slotProps: PropTypes11__default.default.shape({
1296
+ avatar: PropTypes11__default.default.object,
1297
+ avatarIconButton: PropTypes11__default.default.object,
1298
+ moreIconButton: PropTypes11__default.default.object
1299
+ }),
1300
+ slots: PropTypes11__default.default.shape({
1301
+ avatar: PropTypes11__default.default.elementType,
1302
+ avatarIconButton: PropTypes11__default.default.elementType,
1303
+ moreIconButton: PropTypes11__default.default.elementType
1304
+ }),
1305
+ sx: PropTypes11__default.default.oneOfType([
1306
+ PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
1307
+ PropTypes11__default.default.func,
1308
+ PropTypes11__default.default.object
1309
+ ]),
1310
+ variant: PropTypes11__default.default.oneOf(["condensed", "expanded"])
1311
+ }),
1312
+ signInButton: PropTypes11__default.default.object,
1313
+ signOutButton: PropTypes11__default.default.object
1314
+ }),
1315
+ /**
1316
+ * The components used for each slot inside.
1317
+ */
1318
+ slots: PropTypes11__default.default.shape({
1319
+ popover: PropTypes11__default.default.elementType,
1320
+ popoverContent: PropTypes11__default.default.elementType,
1321
+ preview: PropTypes11__default.default.elementType,
1322
+ signInButton: PropTypes11__default.default.elementType,
1323
+ signOutButton: PropTypes11__default.default.elementType
1324
+ })
1325
+ };
1326
+ var DefaultLink = React26__namespace.forwardRef(function Link(props, ref) {
1327
+ const _a = props, { children, href, onClick, history: history2 } = _a, rest = __objRest(_a, ["children", "href", "onClick", "history"]);
1328
+ const routerContext = React26__namespace.useContext(RouterContext);
1329
+ const handleLinkClick = React26__namespace.useMemo(() => {
1330
+ if (!routerContext) {
1331
+ return onClick;
1332
+ }
1333
+ return (event) => {
1334
+ event.preventDefault();
1335
+ const url = new URL(event.currentTarget.href);
1336
+ routerContext.navigate(url.pathname, { history: history2 });
1337
+ onClick == null ? void 0 : onClick(event);
1338
+ };
1339
+ }, [routerContext, onClick, history2]);
1340
+ return /* @__PURE__ */ jsxRuntime.jsx("a", __spreadProps(__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
186
1341
  });
187
- Object.defineProperty(exports, "createProvidedContext", {
188
- enumerable: true,
189
- get: function () { return chunk5B2NQDIH_js.createProvidedContext; }
1342
+ var Link2 = React26__namespace.forwardRef(function Link3(props, ref) {
1343
+ var _a;
1344
+ const routerContext = React26__namespace.useContext(RouterContext);
1345
+ const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
1346
+ return /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, __spreadProps(__spreadValues({ ref }, props), { children: props.children }));
190
1347
  });
191
- Object.defineProperty(exports, "interleave", {
192
- enumerable: true,
193
- get: function () { return chunk5B2NQDIH_js.interleave; }
1348
+ function ToolpadLogo({ size = 40 }) {
1349
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1350
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#a)", children: [
1351
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
1352
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
1353
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16.1 16.34 6.64-3.8 6.64 3.8-6.64 3.8-6.65-3.8Z", fill: "#A5D8FF" })
1354
+ ] }),
1355
+ /* @__PURE__ */ jsxRuntime.jsx(
1356
+ "mask",
1357
+ {
1358
+ id: "b",
1359
+ style: {
1360
+ maskType: "alpha"
1361
+ },
1362
+ maskUnits: "userSpaceOnUse",
1363
+ x: "8",
1364
+ y: "17",
1365
+ width: "14",
1366
+ height: "15",
1367
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1368
+ "path",
1369
+ {
1370
+ d: "M8.5 22.3c0-1.05.56-2 1.46-2.53l3.75-2.14c.89-.5 1.98-.5 2.87 0l3.75 2.14a2.9 2.9 0 0 1 1.46 2.52v4.23c0 1.04-.56 2-1.46 2.52l-3.75 2.14c-.89.5-1.98.5-2.87 0l-3.75-2.14a2.9 2.9 0 0 1-1.46-2.52v-4.23Z",
1371
+ fill: "#D7DCE1"
1372
+ }
1373
+ )
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#b)", children: [
1377
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
1378
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
1379
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.5 20.6 6.64-3.79 6.65 3.8-6.65 3.8-6.64-3.8Z", fill: "#A5D8FF" })
1380
+ ] }),
1381
+ /* @__PURE__ */ jsxRuntime.jsx(
1382
+ "mask",
1383
+ {
1384
+ id: "c",
1385
+ style: {
1386
+ maskType: "alpha"
1387
+ },
1388
+ maskUnits: "userSpaceOnUse",
1389
+ x: "8",
1390
+ y: "4",
1391
+ width: "22",
1392
+ height: "20",
1393
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1394
+ "path",
1395
+ {
1396
+ d: "M24.17 4.82a2.9 2.9 0 0 0-2.87 0L9.97 11.22a2.9 2.9 0 0 0-1.47 2.53v4.22c0 1.04.56 2 1.46 2.52l3.75 2.14c.89.5 1.98.5 2.87 0l11.33-6.42a2.9 2.9 0 0 0 1.47-2.52V9.48c0-1.04-.56-2-1.46-2.52l-3.75-2.14Z",
1397
+ fill: "#D7DCE1"
1398
+ }
1399
+ )
1400
+ }
1401
+ ),
1402
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#c)", children: [
1403
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
1404
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
1405
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
1406
+ ] })
1407
+ ] });
1408
+ }
1409
+ function useApplicationTitle() {
1410
+ var _a;
1411
+ const branding = React26__namespace.useContext(BrandingContext);
1412
+ return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
1413
+ }
1414
+ var LogoContainer = material.styled("div")({
1415
+ position: "relative",
1416
+ height: 40,
1417
+ display: "flex",
1418
+ alignItems: "center",
1419
+ "& img": {
1420
+ maxHeight: 40
1421
+ }
194
1422
  });
195
- Object.defineProperty(exports, "useAssertedContext", {
196
- enumerable: true,
197
- get: function () { return chunk5B2NQDIH_js.useAssertedContext; }
1423
+ function AppTitle(props) {
1424
+ var _a, _b, _c, _d, _e, _f, _g;
1425
+ const theme = material.useTheme();
1426
+ const defaultTitle = useApplicationTitle();
1427
+ const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
1428
+ return /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
1429
+ /* @__PURE__ */ jsxRuntime.jsx(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsxRuntime.jsx(ToolpadLogo, { size: 40 }) }),
1430
+ /* @__PURE__ */ jsxRuntime.jsx(
1431
+ Typography__default.default,
1432
+ {
1433
+ variant: "h6",
1434
+ sx: {
1435
+ color: ((_g = theme.vars) != null ? _g : theme).palette.primary.main,
1436
+ fontWeight: "700",
1437
+ ml: 1,
1438
+ whiteSpace: "nowrap",
1439
+ lineHeight: 1
1440
+ },
1441
+ children: title
1442
+ }
1443
+ )
1444
+ ] }) });
1445
+ }
1446
+ function subscribe2() {
1447
+ return () => {
1448
+ };
1449
+ }
1450
+ function getSnapshot2() {
1451
+ return false;
1452
+ }
1453
+ function getServerSnapshot() {
1454
+ return true;
1455
+ }
1456
+ function useSsr() {
1457
+ return React26__namespace.useSyncExternalStore(subscribe2, getSnapshot2, getServerSnapshot);
1458
+ }
1459
+ function ThemeSwitcher() {
1460
+ var _a;
1461
+ const isSsr = useSsr();
1462
+ const theme = material.useTheme();
1463
+ const { paletteMode, setPaletteMode, isDualTheme } = React26__namespace.useContext(PaletteModeContext);
1464
+ const toggleMode = React26__namespace.useCallback(() => {
1465
+ setPaletteMode(paletteMode === "dark" ? "light" : "dark");
1466
+ }, [paletteMode, setPaletteMode]);
1467
+ return isDualTheme ? /* @__PURE__ */ jsxRuntime.jsx(
1468
+ Tooltip__default.default,
1469
+ {
1470
+ title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
1471
+ enterDelay: 1e3,
1472
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1473
+ IconButton2__default.default,
1474
+ {
1475
+ "aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
1476
+ onClick: toggleMode,
1477
+ sx: {
1478
+ color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
1479
+ },
1480
+ children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
1481
+ /* @__PURE__ */ jsxRuntime.jsx(
1482
+ DarkModeIcon__default.default,
1483
+ {
1484
+ sx: {
1485
+ display: "inline",
1486
+ [theme.getColorSchemeSelector("dark")]: {
1487
+ display: "none"
1488
+ }
1489
+ }
1490
+ }
1491
+ ),
1492
+ /* @__PURE__ */ jsxRuntime.jsx(
1493
+ LightModeIcon__default.default,
1494
+ {
1495
+ sx: {
1496
+ display: "none",
1497
+ [theme.getColorSchemeSelector("dark")]: {
1498
+ display: "inline"
1499
+ }
1500
+ }
1501
+ }
1502
+ )
1503
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(React26__namespace.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsxRuntime.jsx(DarkModeIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(LightModeIcon__default.default, {}) })
1504
+ }
1505
+ ) })
1506
+ }
1507
+ ) : null;
1508
+ }
1509
+ function ToolbarActions() {
1510
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
1511
+ /* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, {}),
1512
+ /* @__PURE__ */ jsxRuntime.jsx(Account, {})
1513
+ ] });
1514
+ }
1515
+ var AppBar = styles.styled(MuiAppBar__default.default)(({ theme }) => {
1516
+ var _a;
1517
+ return {
1518
+ borderWidth: 0,
1519
+ borderBottomWidth: 1,
1520
+ borderStyle: "solid",
1521
+ borderColor: ((_a = theme.vars) != null ? _a : theme).palette.divider,
1522
+ boxShadow: "none",
1523
+ zIndex: theme.zIndex.drawer + 1
1524
+ };
198
1525
  });
199
- Object.defineProperty(exports, "useNonNullableContext", {
200
- enumerable: true,
201
- get: function () { return chunk5B2NQDIH_js.useNonNullableContext; }
1526
+ function DashboardHeader(props) {
1527
+ var _a, _b;
1528
+ const {
1529
+ branding: brandingProp,
1530
+ menuOpen,
1531
+ onToggleMenu,
1532
+ hideMenuButton,
1533
+ slots,
1534
+ slotProps
1535
+ } = props;
1536
+ const brandingContext = React26__namespace.useContext(BrandingContext);
1537
+ const branding = __spreadValues(__spreadValues({}, brandingContext), brandingProp);
1538
+ const handleMenuOpen = React26__namespace.useCallback(() => {
1539
+ onToggleMenu(!menuOpen);
1540
+ }, [menuOpen, onToggleMenu]);
1541
+ const getMenuIcon = React26__namespace.useCallback(
1542
+ (isExpanded) => {
1543
+ const expandMenuActionText = "Expand";
1544
+ const collapseMenuActionText = "Collapse";
1545
+ return /* @__PURE__ */ jsxRuntime.jsx(
1546
+ Tooltip__default.default,
1547
+ {
1548
+ title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
1549
+ enterDelay: 1e3,
1550
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1551
+ IconButton2__default.default,
1552
+ {
1553
+ "aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
1554
+ onClick: handleMenuOpen,
1555
+ children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(MenuOpenIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(MenuIcon__default.default, {})
1556
+ }
1557
+ ) })
1558
+ }
1559
+ );
1560
+ },
1561
+ [handleMenuOpen]
1562
+ );
1563
+ const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
1564
+ const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
1565
+ return /* @__PURE__ */ jsxRuntime.jsx(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1566
+ Stack__default.default,
1567
+ {
1568
+ direction: "row",
1569
+ justifyContent: "space-between",
1570
+ alignItems: "center",
1571
+ sx: {
1572
+ flexWrap: "wrap",
1573
+ width: "100%"
1574
+ },
1575
+ children: [
1576
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", children: [
1577
+ !hideMenuButton ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
1578
+ /* @__PURE__ */ jsxRuntime.jsx(
1579
+ Box4__default.default,
1580
+ {
1581
+ sx: {
1582
+ display: { xs: "block", md: "none" },
1583
+ mr: { sm: 1 }
1584
+ },
1585
+ children: getMenuIcon(menuOpen)
1586
+ }
1587
+ ),
1588
+ /* @__PURE__ */ jsxRuntime.jsx(
1589
+ Box4__default.default,
1590
+ {
1591
+ sx: {
1592
+ display: { xs: "none", md: "block" },
1593
+ mr: 1
1594
+ },
1595
+ children: getMenuIcon(menuOpen)
1596
+ }
1597
+ )
1598
+ ] }) : null,
1599
+ (slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsxRuntime.jsx(slots.appTitle, __spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
1600
+ /* Hierarchy of application of `branding`
1601
+ * 1. Branding prop passed in the `slotProps.appTitle`
1602
+ * 2. Branding prop passed to the `DashboardLayout`
1603
+ * 3. Branding prop passed to the `AppProvider`
1604
+ */
1605
+ /* @__PURE__ */ jsxRuntime.jsx(AppTitle, __spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
1606
+ )
1607
+ ] }),
1608
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
1609
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarActionsSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
1610
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarAccountSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
1611
+ ] })
1612
+ ]
1613
+ }
1614
+ ) }) });
1615
+ }
1616
+ DashboardHeader.propTypes = {
1617
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1618
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1619
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1620
+ // └─────────────────────────────────────────────────────────────────────┘
1621
+ /**
1622
+ * Branding options for the header.
1623
+ * @default null
1624
+ */
1625
+ branding: PropTypes11__default.default.shape({
1626
+ homeUrl: PropTypes11__default.default.string,
1627
+ logo: PropTypes11__default.default.node,
1628
+ title: PropTypes11__default.default.string
1629
+ }),
1630
+ /**
1631
+ * Whether the menu icon should always be hidden.
1632
+ * @default false
1633
+ */
1634
+ hideMenuButton: PropTypes11__default.default.bool,
1635
+ /**
1636
+ * If `true`, show menu button as if menu is expanded, otherwise show it as if menu is collapsed.
1637
+ */
1638
+ menuOpen: PropTypes11__default.default.bool.isRequired,
1639
+ /**
1640
+ * Callback fired when the menu button is clicked.
1641
+ */
1642
+ onToggleMenu: PropTypes11__default.default.func.isRequired,
1643
+ /**
1644
+ * The props used for each slot inside.
1645
+ * @default {}
1646
+ */
1647
+ slotProps: PropTypes11__default.default.shape({
1648
+ appTitle: PropTypes11__default.default.shape({
1649
+ branding: PropTypes11__default.default.shape({
1650
+ homeUrl: PropTypes11__default.default.string,
1651
+ logo: PropTypes11__default.default.node,
1652
+ title: PropTypes11__default.default.string
1653
+ })
1654
+ }),
1655
+ toolbarAccount: PropTypes11__default.default.shape({
1656
+ localeText: PropTypes11__default.default.object,
1657
+ slotProps: PropTypes11__default.default.shape({
1658
+ popover: PropTypes11__default.default.object,
1659
+ popoverContent: PropTypes11__default.default.object,
1660
+ preview: PropTypes11__default.default.object,
1661
+ signInButton: PropTypes11__default.default.object,
1662
+ signOutButton: PropTypes11__default.default.object
1663
+ }),
1664
+ slots: PropTypes11__default.default.shape({
1665
+ popover: PropTypes11__default.default.elementType,
1666
+ popoverContent: PropTypes11__default.default.elementType,
1667
+ preview: PropTypes11__default.default.elementType,
1668
+ signInButton: PropTypes11__default.default.elementType,
1669
+ signOutButton: PropTypes11__default.default.elementType
1670
+ })
1671
+ }),
1672
+ toolbarActions: PropTypes11__default.default.object
1673
+ }),
1674
+ /**
1675
+ * The components used for each slot inside.
1676
+ * @default {}
1677
+ */
1678
+ slots: PropTypes11__default.default.shape({
1679
+ appTitle: PropTypes11__default.default.elementType,
1680
+ toolbarAccount: PropTypes11__default.default.elementType,
1681
+ toolbarActions: PropTypes11__default.default.elementType
1682
+ })
1683
+ };
1684
+ var getItemKind = (item) => {
1685
+ var _a;
1686
+ return (_a = item.kind) != null ? _a : "page";
1687
+ };
1688
+ var isPageItem = (item) => getItemKind(item) === "page";
1689
+ var getItemTitle = (item) => {
1690
+ var _a, _b;
1691
+ return isPageItem(item) ? (_b = (_a = item.title) != null ? _a : item.segment) != null ? _b : "" : item.title;
1692
+ };
1693
+ function buildItemToPathMap(navigation) {
1694
+ const map = /* @__PURE__ */ new Map();
1695
+ const visit = (item, base) => {
1696
+ if (isPageItem(item)) {
1697
+ const path = `${base.startsWith("/") ? base : `/${base}`}${base && base !== "/" && item.segment ? "/" : ""}${item.segment || ""}` || "/";
1698
+ map.set(item, path);
1699
+ if (item.children) {
1700
+ for (const child of item.children) {
1701
+ visit(child, path);
1702
+ }
1703
+ }
1704
+ }
1705
+ };
1706
+ for (const item of navigation) {
1707
+ visit(item, "");
1708
+ }
1709
+ return map;
1710
+ }
1711
+ var itemToPathMapCache = /* @__PURE__ */ new WeakMap();
1712
+ function getItemToPathMap(navigation) {
1713
+ let map = itemToPathMapCache.get(navigation);
1714
+ if (!map) {
1715
+ map = buildItemToPathMap(navigation);
1716
+ itemToPathMapCache.set(navigation, map);
1717
+ }
1718
+ return map;
1719
+ }
1720
+ function buildItemLookup(navigation) {
1721
+ const map = /* @__PURE__ */ new Map();
1722
+ const visit = (item) => {
1723
+ if (isPageItem(item)) {
1724
+ const path = getItemPath(navigation, item);
1725
+ if (map.has(path)) {
1726
+ console.warn(`Duplicate path in navigation: ${path}`);
1727
+ }
1728
+ map.set(path, item);
1729
+ if (item.pattern) {
1730
+ const basePath = item.segment ? path.slice(0, -item.segment.length) : path;
1731
+ map.set(pathToRegexp.pathToRegexp(basePath + item.pattern).regexp, item);
1732
+ }
1733
+ if (item.children) {
1734
+ for (const child of item.children) {
1735
+ visit(child);
1736
+ }
1737
+ }
1738
+ }
1739
+ };
1740
+ for (const item of navigation) {
1741
+ visit(item);
1742
+ }
1743
+ return map;
1744
+ }
1745
+ var itemLookupMapCache = /* @__PURE__ */ new WeakMap();
1746
+ function getItemLookup(navigation) {
1747
+ let map = itemLookupMapCache.get(navigation);
1748
+ if (!map) {
1749
+ map = buildItemLookup(navigation);
1750
+ itemLookupMapCache.set(navigation, map);
1751
+ }
1752
+ return map;
1753
+ }
1754
+ function matchPath(navigation, path) {
1755
+ const lookup = getItemLookup(navigation);
1756
+ for (const [key, item] of lookup.entries()) {
1757
+ if (typeof key === "string" && key === path) {
1758
+ return item;
1759
+ }
1760
+ if (key instanceof RegExp && key.test(path)) {
1761
+ return item;
1762
+ }
1763
+ }
1764
+ return null;
1765
+ }
1766
+ function getItemPath(navigation, item) {
1767
+ const map = getItemToPathMap(navigation);
1768
+ const path = map.get(item);
1769
+ invariant2__default.default(path, `Item not found in navigation: ${item.title}`);
1770
+ return path;
1771
+ }
1772
+ function hasSelectedNavigationChildren(navigation, item, activePagePath) {
1773
+ if (item.children) {
1774
+ return item.children.some((nestedItem) => {
1775
+ if (!isPageItem(nestedItem)) {
1776
+ return false;
1777
+ }
1778
+ if (nestedItem.children) {
1779
+ return hasSelectedNavigationChildren(navigation, nestedItem, activePagePath);
1780
+ }
1781
+ return activePagePath === getItemPath(navigation, nestedItem);
1782
+ });
1783
+ }
1784
+ return false;
1785
+ }
1786
+
1787
+ // src/toolpad-core/DashboardLayout/utils.ts
1788
+ function getDrawerSxTransitionMixin(isExpanded, property) {
1789
+ return {
1790
+ transition: (theme) => theme.transitions.create(property, {
1791
+ easing: theme.transitions.easing.sharp,
1792
+ duration: isExpanded ? theme.transitions.duration.enteringScreen : theme.transitions.duration.leavingScreen
1793
+ })
1794
+ };
1795
+ }
1796
+ function getDrawerWidthTransitionMixin(isExpanded) {
1797
+ return __spreadProps(__spreadValues({}, getDrawerSxTransitionMixin(isExpanded, "width")), {
1798
+ overflowX: "hidden"
1799
+ });
1800
+ }
1801
+ function useActivePage() {
1802
+ var _a;
1803
+ const navigationContext = React26__namespace.useContext(NavigationContext);
1804
+ const routerContext = React26__namespace.useContext(RouterContext);
1805
+ const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
1806
+ const activeItem = matchPath(navigationContext, pathname);
1807
+ const rootItem = matchPath(navigationContext, "/");
1808
+ return React26__namespace.useMemo(() => {
1809
+ if (!activeItem) {
1810
+ return null;
1811
+ }
1812
+ const breadcrumbs = [];
1813
+ if (rootItem) {
1814
+ breadcrumbs.push({
1815
+ title: getItemTitle(rootItem),
1816
+ path: "/"
1817
+ });
1818
+ }
1819
+ const segments = pathname.split("/").filter(Boolean);
1820
+ let prefix = "";
1821
+ for (const segment of segments) {
1822
+ const path = `${prefix}/${segment}`;
1823
+ prefix = path;
1824
+ const item = matchPath(navigationContext, path);
1825
+ if (!item) {
1826
+ continue;
1827
+ }
1828
+ const itemPath = getItemPath(navigationContext, item);
1829
+ const lastCrumb = breadcrumbs[breadcrumbs.length - 1];
1830
+ if ((lastCrumb == null ? void 0 : lastCrumb.path) !== itemPath) {
1831
+ breadcrumbs.push({
1832
+ title: getItemTitle(item),
1833
+ path: itemPath
1834
+ });
1835
+ }
1836
+ }
1837
+ return {
1838
+ title: getItemTitle(activeItem),
1839
+ path: getItemPath(navigationContext, activeItem),
1840
+ breadcrumbs
1841
+ };
1842
+ }, [activeItem, rootItem, pathname, navigationContext]);
1843
+ }
1844
+
1845
+ // src/toolpad-core/DashboardLayout/shared.ts
1846
+ var MINI_DRAWER_WIDTH = 84;
1847
+ var NavigationListItemButton = material.styled(ListItemButton__default.default)(({ theme }) => {
1848
+ var _a, _b, _c, _d, _e, _f, _g;
1849
+ return {
1850
+ borderRadius: 8,
1851
+ "&.Mui-selected": {
1852
+ "& .MuiListItemIcon-root": {
1853
+ color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
1854
+ },
1855
+ "& .MuiTypography-root": {
1856
+ color: ((_b = theme.vars) != null ? _b : theme).palette.primary.dark
1857
+ },
1858
+ "& .MuiSvgIcon-root": {
1859
+ color: ((_c = theme.vars) != null ? _c : theme).palette.primary.dark
1860
+ },
1861
+ "& .MuiAvatar-root": {
1862
+ backgroundColor: ((_d = theme.vars) != null ? _d : theme).palette.primary.dark
1863
+ },
1864
+ "& .MuiTouchRipple-child": {
1865
+ backgroundColor: ((_e = theme.vars) != null ? _e : theme).palette.primary.dark
1866
+ }
1867
+ },
1868
+ "& .MuiSvgIcon-root": {
1869
+ color: ((_f = theme.vars) != null ? _f : theme).palette.action.active
1870
+ },
1871
+ "& .MuiAvatar-root": {
1872
+ backgroundColor: ((_g = theme.vars) != null ? _g : theme).palette.action.active
1873
+ }
1874
+ };
202
1875
  });
203
- Object.defineProperty(exports, "useTraceUpdates", {
204
- enumerable: true,
205
- get: function () { return chunk5B2NQDIH_js.useTraceUpdates; }
1876
+ var LIST_ITEM_ICON_SIZE = 34;
1877
+ function DashboardSidebarPageItem(props) {
1878
+ var _a;
1879
+ const navigationContext = React26__namespace.useContext(NavigationContext);
1880
+ const pageItemContextProps = React26__namespace.useContext(DashboardSidebarPageItemContext);
1881
+ invariant2__default.default(pageItemContextProps, "No navigation page item context provided.");
1882
+ const contextAwareProps = __spreadValues(__spreadValues({}, pageItemContextProps), props);
1883
+ const {
1884
+ item,
1885
+ href = getItemPath(navigationContext, item),
1886
+ LinkComponent: LinkComponentProp,
1887
+ expanded = false,
1888
+ selected = false,
1889
+ disabled = false,
1890
+ id,
1891
+ onClick,
1892
+ isMini = false,
1893
+ isSidebarFullyExpanded = true,
1894
+ isSidebarFullyCollapsed = false,
1895
+ renderNestedNavigation
1896
+ } = contextAwareProps;
1897
+ const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React26__namespace.useState(
1898
+ null
1899
+ );
1900
+ const handleClick = React26__namespace.useCallback(() => {
1901
+ onClick(id, item);
1902
+ }, [id, item, onClick]);
1903
+ let nestedNavigationCollapseSx = { display: "none" };
1904
+ if (isMini && isSidebarFullyCollapsed) {
1905
+ nestedNavigationCollapseSx = {
1906
+ fontSize: 18,
1907
+ position: "absolute",
1908
+ top: "41.5%",
1909
+ right: "2px",
1910
+ transform: "translateY(-50%) rotate(-90deg)"
1911
+ };
1912
+ } else if (!isMini && isSidebarFullyExpanded) {
1913
+ nestedNavigationCollapseSx = {
1914
+ ml: 0.5,
1915
+ transform: `rotate(${expanded ? 0 : -90}deg)`,
1916
+ transition: (theme) => theme.transitions.create("transform", {
1917
+ easing: theme.transitions.easing.sharp,
1918
+ duration: 100
1919
+ })
1920
+ };
1921
+ }
1922
+ const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
1923
+ const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
1924
+ const title = getItemTitle(item);
1925
+ const listItem = /* @__PURE__ */ jsxRuntime.jsxs(
1926
+ ListItem__default.default,
1927
+ __spreadProps(__spreadValues({}, item.children && isMini ? {
1928
+ onMouseEnter: () => {
1929
+ setHoveredMiniSidebarItemId(id);
1930
+ },
1931
+ onMouseLeave: () => {
1932
+ setHoveredMiniSidebarItemId(null);
1933
+ }
1934
+ } : {}), {
1935
+ sx: {
1936
+ py: 0,
1937
+ px: 1,
1938
+ overflowX: "hidden"
1939
+ },
1940
+ children: [
1941
+ /* @__PURE__ */ jsxRuntime.jsxs(
1942
+ NavigationListItemButton,
1943
+ __spreadProps(__spreadValues(__spreadValues({
1944
+ selected,
1945
+ disabled,
1946
+ sx: {
1947
+ px: 1.4,
1948
+ height: isMini ? 60 : 48
1949
+ }
1950
+ }, item.children && !isMini ? {
1951
+ onClick: handleClick
1952
+ } : {}), !item.children ? __spreadProps(__spreadValues({
1953
+ LinkComponent
1954
+ }, hasExternalHref ? {
1955
+ target: "_blank",
1956
+ rel: "noopener noreferrer"
1957
+ } : {}), {
1958
+ href,
1959
+ onClick: handleClick
1960
+ }) : {}), {
1961
+ children: [
1962
+ item.icon || isMini ? /* @__PURE__ */ jsxRuntime.jsxs(
1963
+ Box4__default.default,
1964
+ {
1965
+ sx: isMini ? {
1966
+ position: "absolute",
1967
+ left: "50%",
1968
+ top: "calc(50% - 6px)",
1969
+ transform: "translate(-50%, -50%)"
1970
+ } : {},
1971
+ children: [
1972
+ /* @__PURE__ */ jsxRuntime.jsxs(
1973
+ ListItemIcon__default.default,
1974
+ {
1975
+ sx: {
1976
+ display: "flex",
1977
+ alignItems: "center",
1978
+ justifyContent: "center",
1979
+ minWidth: LIST_ITEM_ICON_SIZE
1980
+ },
1981
+ children: [
1982
+ (_a = item.icon) != null ? _a : null,
1983
+ !item.icon && isMini ? /* @__PURE__ */ jsxRuntime.jsx(
1984
+ Avatar__default.default,
1985
+ {
1986
+ sx: {
1987
+ width: LIST_ITEM_ICON_SIZE - 7,
1988
+ height: LIST_ITEM_ICON_SIZE - 7,
1989
+ fontSize: 12
1990
+ },
1991
+ children: title.split(" ").slice(0, 2).map((titleWord) => titleWord.charAt(0).toUpperCase())
1992
+ }
1993
+ ) : null
1994
+ ]
1995
+ }
1996
+ ),
1997
+ isMini ? /* @__PURE__ */ jsxRuntime.jsx(
1998
+ Typography__default.default,
1999
+ {
2000
+ variant: "caption",
2001
+ sx: {
2002
+ position: "absolute",
2003
+ bottom: -18,
2004
+ left: "50%",
2005
+ transform: "translateX(-50%)",
2006
+ fontSize: 10,
2007
+ fontWeight: 500,
2008
+ textAlign: "center",
2009
+ whiteSpace: "nowrap",
2010
+ overflow: "hidden",
2011
+ textOverflow: "ellipsis",
2012
+ maxWidth: MINI_DRAWER_WIDTH - 28
2013
+ },
2014
+ children: title
2015
+ }
2016
+ ) : null
2017
+ ]
2018
+ }
2019
+ ) : null,
2020
+ !isMini ? /* @__PURE__ */ jsxRuntime.jsx(
2021
+ ListItemText__default.default,
2022
+ {
2023
+ primary: title,
2024
+ sx: {
2025
+ ml: 1.2,
2026
+ whiteSpace: "nowrap",
2027
+ zIndex: 1
2028
+ }
2029
+ }
2030
+ ) : null,
2031
+ item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
2032
+ item.children ? /* @__PURE__ */ jsxRuntime.jsx(ExpandMoreIcon__default.default, { sx: nestedNavigationCollapseSx }) : null
2033
+ ]
2034
+ })
2035
+ ),
2036
+ item.children && isMini ? /* @__PURE__ */ jsxRuntime.jsx(Grow__default.default, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsxRuntime.jsx(
2037
+ Box4__default.default,
2038
+ {
2039
+ sx: {
2040
+ position: "fixed",
2041
+ left: MINI_DRAWER_WIDTH - 2,
2042
+ pl: "6px"
2043
+ },
2044
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2045
+ Paper__default.default,
2046
+ {
2047
+ sx: {
2048
+ pt: 0.5,
2049
+ pb: 0.5,
2050
+ transform: "translateY(calc(50% - 30px))"
2051
+ },
2052
+ children: renderNestedNavigation(item.children)
2053
+ }
2054
+ )
2055
+ }
2056
+ ) }) : null
2057
+ ]
2058
+ })
2059
+ );
2060
+ return /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
2061
+ listItem,
2062
+ item.children && !isMini ? /* @__PURE__ */ jsxRuntime.jsx(Collapse__default.default, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
2063
+ ] }, id);
2064
+ }
2065
+ DashboardSidebarPageItem.propTypes = {
2066
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2067
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2068
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2069
+ // └─────────────────────────────────────────────────────────────────────┘
2070
+ /**
2071
+ * If `true`, the item is disabled.
2072
+ * @default false
2073
+ */
2074
+ disabled: PropTypes11__default.default.bool,
2075
+ /**
2076
+ * If `true`, expands any nested navigation in the item, otherwise collapse it.
2077
+ * @default false
2078
+ */
2079
+ expanded: PropTypes11__default.default.bool,
2080
+ /**
2081
+ * Link `href` for when the item is rendered as a link.
2082
+ * @default getItemPath(navigationContext, item)
2083
+ */
2084
+ href: PropTypes11__default.default.string,
2085
+ /**
2086
+ * Navigation page item definition.
2087
+ */
2088
+ item: PropTypes11__default.default.shape({
2089
+ action: PropTypes11__default.default.node,
2090
+ children: PropTypes11__default.default.arrayOf(
2091
+ PropTypes11__default.default.oneOfType([
2092
+ PropTypes11__default.default.object,
2093
+ PropTypes11__default.default.shape({
2094
+ kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
2095
+ title: PropTypes11__default.default.string.isRequired
2096
+ }),
2097
+ PropTypes11__default.default.shape({
2098
+ kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
2099
+ })
2100
+ ]).isRequired
2101
+ ),
2102
+ icon: PropTypes11__default.default.node,
2103
+ kind: PropTypes11__default.default.oneOf(["page"]),
2104
+ pattern: PropTypes11__default.default.string,
2105
+ segment: PropTypes11__default.default.string,
2106
+ title: PropTypes11__default.default.string
2107
+ }).isRequired,
2108
+ /**
2109
+ * The component used to render the item as a link.
2110
+ * @default Link
2111
+ */
2112
+ LinkComponent: PropTypes11__default.default.elementType,
2113
+ /**
2114
+ * Use to apply selected styling.
2115
+ * @default false
2116
+ */
2117
+ selected: PropTypes11__default.default.bool
2118
+ };
2119
+ function DashboardSidebarSubNavigationPageItem({
2120
+ id,
2121
+ item,
2122
+ isExpanded,
2123
+ onClick,
2124
+ depth,
2125
+ onLinkClick,
2126
+ isMini,
2127
+ isFullyExpanded,
2128
+ isFullyCollapsed,
2129
+ sidebarExpandedWidth,
2130
+ renderPageItem
2131
+ }) {
2132
+ const navigationContext = React26__namespace.useContext(NavigationContext);
2133
+ const activePage = useActivePage();
2134
+ const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
2135
+ const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
2136
+ const pageItemContextProps = React26__namespace.useMemo(
2137
+ () => ({
2138
+ expanded: isExpanded,
2139
+ selected: isSelected,
2140
+ id,
2141
+ onClick,
2142
+ isMini,
2143
+ isSidebarFullyExpanded: isFullyExpanded,
2144
+ isSidebarFullyCollapsed: isFullyCollapsed,
2145
+ renderNestedNavigation: () => {
2146
+ var _a;
2147
+ return /* @__PURE__ */ jsxRuntime.jsx(
2148
+ DashboardSidebarSubNavigation,
2149
+ {
2150
+ subNavigation: (_a = item.children) != null ? _a : [],
2151
+ depth: depth + 1,
2152
+ onLinkClick,
2153
+ isPopover: isMini,
2154
+ sidebarExpandedWidth
2155
+ }
2156
+ );
2157
+ }
2158
+ }),
2159
+ [
2160
+ depth,
2161
+ id,
2162
+ isExpanded,
2163
+ isFullyCollapsed,
2164
+ isFullyExpanded,
2165
+ isMini,
2166
+ isSelected,
2167
+ item.children,
2168
+ onClick,
2169
+ onLinkClick,
2170
+ sidebarExpandedWidth
2171
+ ]
2172
+ );
2173
+ return /* @__PURE__ */ jsxRuntime.jsx(DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsxRuntime.jsx(DashboardSidebarPageItem, { item }) });
2174
+ }
2175
+ function DashboardSidebarSubNavigation({
2176
+ subNavigation,
2177
+ depth = 0,
2178
+ onLinkClick,
2179
+ isMini = false,
2180
+ isPopover = false,
2181
+ isFullyExpanded = true,
2182
+ isFullyCollapsed = false,
2183
+ hasDrawerTransitions = false,
2184
+ sidebarExpandedWidth,
2185
+ renderPageItem
2186
+ }) {
2187
+ const navigationContext = React26__namespace.useContext(NavigationContext);
2188
+ const activePage = useActivePage();
2189
+ const initialExpandedItemIds = React26__namespace.useMemo(
2190
+ () => subNavigation.map((navigationItem, navigationItemIndex) => ({
2191
+ navigationItem,
2192
+ originalIndex: navigationItemIndex
2193
+ })).filter(
2194
+ ({ navigationItem }) => isPageItem(navigationItem) && !!activePage && hasSelectedNavigationChildren(navigationContext, navigationItem, activePage.path)
2195
+ ).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
2196
+ [activePage, depth, navigationContext, subNavigation]
2197
+ );
2198
+ const [expandedItemIds, setExpandedItemIds] = React26__namespace.useState(initialExpandedItemIds);
2199
+ const handlePageItemClick = React26__namespace.useCallback(
2200
+ (itemId, item) => {
2201
+ if (item.children && !isMini) {
2202
+ setExpandedItemIds(
2203
+ (previousValue) => previousValue.includes(itemId) ? previousValue.filter((previousValueItemId) => previousValueItemId !== itemId) : [...previousValue, itemId]
2204
+ );
2205
+ } else if (!item.children) {
2206
+ onLinkClick();
2207
+ }
2208
+ },
2209
+ [isMini, onLinkClick]
2210
+ );
2211
+ return /* @__PURE__ */ jsxRuntime.jsx(
2212
+ List__default.default,
2213
+ {
2214
+ sx: {
2215
+ padding: 0,
2216
+ mt: isPopover && depth === 1 ? 0.5 : 0,
2217
+ mb: depth === 0 && !isPopover ? 4 : 0.5,
2218
+ pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
2219
+ minWidth: isPopover && depth === 1 ? 240 : "auto",
2220
+ width: isMini ? MINI_DRAWER_WIDTH : "auto"
2221
+ },
2222
+ children: subNavigation.map((navigationItem, navigationItemIndex) => {
2223
+ if (navigationItem.kind === "header") {
2224
+ return /* @__PURE__ */ jsxRuntime.jsx(
2225
+ ListSubheader__default.default,
2226
+ {
2227
+ sx: __spreadProps(__spreadValues({
2228
+ fontSize: 12,
2229
+ fontWeight: "700",
2230
+ height: isMini ? 0 : 40
2231
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "height") : {}), {
2232
+ px: 2,
2233
+ minWidth: sidebarExpandedWidth,
2234
+ overflow: "hidden",
2235
+ textOverflow: "ellipsis",
2236
+ whiteSpace: "nowrap",
2237
+ zIndex: 2
2238
+ }),
2239
+ children: getItemTitle(navigationItem)
2240
+ },
2241
+ `subheader-${depth}-${navigationItemIndex}`
2242
+ );
2243
+ }
2244
+ if (navigationItem.kind === "divider") {
2245
+ const nextItem = subNavigation[navigationItemIndex + 1];
2246
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
2247
+ Divider__default.default,
2248
+ {
2249
+ sx: __spreadValues({
2250
+ borderBottomWidth: 2,
2251
+ mx: 1,
2252
+ mt: 1,
2253
+ mb: (nextItem == null ? void 0 : nextItem.kind) === "header" && !isMini ? 0 : 1
2254
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "margin") : {})
2255
+ }
2256
+ ) }, `divider-${depth}-${navigationItemIndex}`);
2257
+ }
2258
+ const pageItemId = `page-${depth}-${navigationItemIndex}`;
2259
+ return /* @__PURE__ */ jsxRuntime.jsx(
2260
+ DashboardSidebarSubNavigationPageItem,
2261
+ {
2262
+ id: pageItemId,
2263
+ item: navigationItem,
2264
+ isExpanded: expandedItemIds.includes(pageItemId),
2265
+ onClick: handlePageItemClick,
2266
+ depth,
2267
+ onLinkClick,
2268
+ isMini,
2269
+ isFullyExpanded,
2270
+ isFullyCollapsed,
2271
+ sidebarExpandedWidth,
2272
+ renderPageItem
2273
+ },
2274
+ pageItemId
2275
+ );
2276
+ })
2277
+ }
2278
+ );
2279
+ }
2280
+
2281
+ // src/toolpad-utils/warnOnce.ts
2282
+ var history = /* @__PURE__ */ new Set();
2283
+ function warnOnce(msg) {
2284
+ if (!history.has(msg)) {
2285
+ history.add(msg);
2286
+ console.warn(msg);
2287
+ }
2288
+ }
2289
+ function DashboardLayout(props) {
2290
+ var _a, _b;
2291
+ const {
2292
+ children,
2293
+ branding,
2294
+ navigation: navigationProp,
2295
+ defaultSidebarCollapsed = false,
2296
+ disableCollapsibleSidebar = false,
2297
+ hideNavigation = false,
2298
+ sidebarExpandedWidth = 320,
2299
+ renderPageItem,
2300
+ slots,
2301
+ slotProps,
2302
+ sx
2303
+ } = props;
2304
+ if (navigationProp && process.env.NODE_ENV !== "production") {
2305
+ warnOnce(
2306
+ "The navigation prop in the DashboardLayout component is deprecated and will eventually be removed. Set the navigation prop in the AppProvider instead (https://mui.com/toolpad/core/react-app-provider/#navigation)."
2307
+ );
2308
+ }
2309
+ const theme = styles.useTheme();
2310
+ const navigationContext = React26__namespace.useContext(NavigationContext);
2311
+ const appWindowContext = React26__namespace.useContext(WindowContext);
2312
+ const navigation = navigationProp != null ? navigationProp : navigationContext;
2313
+ const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React26__namespace.useState(!defaultSidebarCollapsed);
2314
+ const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React26__namespace.useState(false);
2315
+ const isOverSmViewport = useMediaQuery2__default.default(
2316
+ theme.breakpoints.up("sm"),
2317
+ appWindowContext && {
2318
+ matchMedia: appWindowContext.matchMedia
2319
+ }
2320
+ );
2321
+ const isOverMdViewport = useMediaQuery2__default.default(
2322
+ theme.breakpoints.up("md"),
2323
+ appWindowContext && {
2324
+ matchMedia: appWindowContext.matchMedia
2325
+ }
2326
+ );
2327
+ const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
2328
+ const setIsNavigationExpanded = React26__namespace.useCallback(
2329
+ (newExpanded) => {
2330
+ if (isOverMdViewport) {
2331
+ setIsDesktopNavigationExpanded(newExpanded);
2332
+ } else {
2333
+ setIsMobileNavigationExpanded(newExpanded);
2334
+ }
2335
+ },
2336
+ [isOverMdViewport]
2337
+ );
2338
+ const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React26__namespace.useState(isNavigationExpanded);
2339
+ const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React26__namespace.useState(!isNavigationExpanded);
2340
+ React26__namespace.useEffect(() => {
2341
+ if (isNavigationExpanded) {
2342
+ const drawerWidthTransitionTimeout = setTimeout(() => {
2343
+ setIsNavigationFullyExpanded(true);
2344
+ }, theme.transitions.duration.enteringScreen);
2345
+ return () => clearTimeout(drawerWidthTransitionTimeout);
2346
+ }
2347
+ setIsNavigationFullyExpanded(false);
2348
+ return () => {
2349
+ };
2350
+ }, [isNavigationExpanded, theme]);
2351
+ React26__namespace.useEffect(() => {
2352
+ if (!isNavigationExpanded) {
2353
+ const drawerWidthTransitionTimeout = setTimeout(() => {
2354
+ setIsNavigationFullyCollapsed(true);
2355
+ }, theme.transitions.duration.leavingScreen);
2356
+ return () => clearTimeout(drawerWidthTransitionTimeout);
2357
+ }
2358
+ setIsNavigationFullyCollapsed(false);
2359
+ return () => {
2360
+ };
2361
+ }, [isNavigationExpanded, theme]);
2362
+ const handleSetNavigationExpanded = React26__namespace.useCallback(
2363
+ (newExpanded) => () => {
2364
+ setIsNavigationExpanded(newExpanded);
2365
+ },
2366
+ [setIsNavigationExpanded]
2367
+ );
2368
+ const handleToggleHeaderMenu = React26__namespace.useCallback(
2369
+ (isExpanded) => {
2370
+ setIsNavigationExpanded(isExpanded);
2371
+ },
2372
+ [setIsNavigationExpanded]
2373
+ );
2374
+ const handleNavigationLinkClick = React26__namespace.useCallback(() => {
2375
+ setIsMobileNavigationExpanded(false);
2376
+ }, [setIsMobileNavigationExpanded]);
2377
+ const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
2378
+ const isMobileMini = !disableCollapsibleSidebar && !isMobileNavigationExpanded;
2379
+ const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
2380
+ const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
2381
+ const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
2382
+ const headerSlotProps = React26__namespace.useMemo(
2383
+ () => __spreadValues({
2384
+ branding,
2385
+ menuOpen: isNavigationExpanded,
2386
+ onToggleMenu: handleToggleHeaderMenu,
2387
+ hideMenuButton: hideNavigation || isOverMdViewport && disableCollapsibleSidebar,
2388
+ slots: {
2389
+ appTitle: slots == null ? void 0 : slots.appTitle,
2390
+ toolbarActions: slots == null ? void 0 : slots.toolbarActions,
2391
+ toolbarAccount: slots == null ? void 0 : slots.toolbarAccount
2392
+ },
2393
+ slotProps: {
2394
+ appTitle: slotProps == null ? void 0 : slotProps.appTitle,
2395
+ toolbarActions: slotProps == null ? void 0 : slotProps.toolbarActions,
2396
+ toolbarAccount: slotProps == null ? void 0 : slotProps.toolbarAccount
2397
+ }
2398
+ }, slotProps == null ? void 0 : slotProps.header),
2399
+ [
2400
+ branding,
2401
+ isNavigationExpanded,
2402
+ handleToggleHeaderMenu,
2403
+ hideNavigation,
2404
+ isOverMdViewport,
2405
+ disableCollapsibleSidebar,
2406
+ slotProps,
2407
+ slots
2408
+ ]
2409
+ );
2410
+ const getDrawerContent = React26__namespace.useCallback(
2411
+ (isMini, viewport) => {
2412
+ var _a2;
2413
+ return /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
2414
+ /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, {}),
2415
+ /* @__PURE__ */ jsxRuntime.jsxs(
2416
+ Box4__default.default,
2417
+ {
2418
+ component: "nav",
2419
+ "aria-label": `${viewport.charAt(0).toUpperCase()}${viewport.slice(1)}`,
2420
+ sx: __spreadValues({
2421
+ height: "100%",
2422
+ display: "flex",
2423
+ flexDirection: "column",
2424
+ justifyContent: "space-between",
2425
+ overflow: "auto",
2426
+ scrollbarGutter: isMini ? "stable" : "auto",
2427
+ overflowX: "hidden",
2428
+ pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
2429
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
2430
+ children: [
2431
+ /* @__PURE__ */ jsxRuntime.jsx(
2432
+ DashboardSidebarSubNavigation,
2433
+ {
2434
+ subNavigation: navigation,
2435
+ onLinkClick: handleNavigationLinkClick,
2436
+ isMini,
2437
+ isFullyExpanded: isNavigationFullyExpanded,
2438
+ isFullyCollapsed: isNavigationFullyCollapsed,
2439
+ hasDrawerTransitions,
2440
+ sidebarExpandedWidth,
2441
+ renderPageItem
2442
+ }
2443
+ ),
2444
+ SidebarFooterSlot ? /* @__PURE__ */ jsxRuntime.jsx(SidebarFooterSlot, __spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
2445
+ ]
2446
+ }
2447
+ )
2448
+ ] });
2449
+ },
2450
+ [
2451
+ SidebarFooterSlot,
2452
+ handleNavigationLinkClick,
2453
+ hasDrawerTransitions,
2454
+ isNavigationFullyCollapsed,
2455
+ isNavigationFullyExpanded,
2456
+ navigation,
2457
+ sidebarExpandedWidth,
2458
+ renderPageItem,
2459
+ slotProps == null ? void 0 : slotProps.sidebarFooter
2460
+ ]
2461
+ );
2462
+ const getDrawerSharedSx = React26__namespace.useCallback(
2463
+ (isMini, isTemporary) => {
2464
+ const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
2465
+ return __spreadProps(__spreadValues(__spreadValues({
2466
+ displayPrint: "none",
2467
+ width: drawerWidth,
2468
+ flexShrink: 0
2469
+ }, getDrawerWidthTransitionMixin(isNavigationExpanded)), isTemporary ? { position: "absolute" } : {}), {
2470
+ [`& .MuiDrawer-paper`]: __spreadValues({
2471
+ position: "absolute",
2472
+ width: drawerWidth,
2473
+ boxSizing: "border-box",
2474
+ backgroundImage: "none"
2475
+ }, getDrawerWidthTransitionMixin(isNavigationExpanded))
2476
+ });
2477
+ },
2478
+ [isNavigationExpanded, sidebarExpandedWidth]
2479
+ );
2480
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2481
+ Box4__default.default,
2482
+ {
2483
+ sx: __spreadValues({
2484
+ position: "relative",
2485
+ display: "flex",
2486
+ overflow: "hidden",
2487
+ height: "100vh",
2488
+ width: "100vw"
2489
+ }, sx),
2490
+ children: [
2491
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderSlot, __spreadValues({}, headerSlotProps)),
2492
+ !hideNavigation ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
2493
+ /* @__PURE__ */ jsxRuntime.jsx(
2494
+ Drawer__default.default,
2495
+ {
2496
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
2497
+ variant: "temporary",
2498
+ open: isMobileNavigationExpanded,
2499
+ onClose: handleSetNavigationExpanded(false),
2500
+ ModalProps: {
2501
+ keepMounted: true
2502
+ // Better open performance on mobile.
2503
+ },
2504
+ sx: __spreadValues({
2505
+ display: {
2506
+ xs: "block",
2507
+ sm: disableCollapsibleSidebar ? "block" : "none",
2508
+ md: "none"
2509
+ }
2510
+ }, getDrawerSharedSx(false, true)),
2511
+ children: getDrawerContent(false, "phone")
2512
+ }
2513
+ ),
2514
+ /* @__PURE__ */ jsxRuntime.jsx(
2515
+ Drawer__default.default,
2516
+ {
2517
+ variant: "permanent",
2518
+ sx: __spreadValues({
2519
+ display: {
2520
+ xs: "none",
2521
+ sm: disableCollapsibleSidebar ? "none" : "block",
2522
+ md: "none"
2523
+ }
2524
+ }, getDrawerSharedSx(isMobileMini, false)),
2525
+ children: getDrawerContent(isMobileMini, "tablet")
2526
+ }
2527
+ ),
2528
+ /* @__PURE__ */ jsxRuntime.jsx(
2529
+ Drawer__default.default,
2530
+ {
2531
+ variant: "permanent",
2532
+ sx: __spreadValues({
2533
+ display: { xs: "none", md: "block" }
2534
+ }, getDrawerSharedSx(isDesktopMini, false)),
2535
+ children: getDrawerContent(isDesktopMini, "desktop")
2536
+ }
2537
+ )
2538
+ ] }) : null,
2539
+ /* @__PURE__ */ jsxRuntime.jsxs(
2540
+ Box4__default.default,
2541
+ {
2542
+ sx: {
2543
+ display: "flex",
2544
+ flexDirection: "column",
2545
+ flex: 1,
2546
+ minWidth: 0
2547
+ },
2548
+ children: [
2549
+ /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { displayPrint: "none" } }),
2550
+ /* @__PURE__ */ jsxRuntime.jsx(
2551
+ Box4__default.default,
2552
+ {
2553
+ component: "main",
2554
+ sx: {
2555
+ display: "flex",
2556
+ flexDirection: "column",
2557
+ flex: 1,
2558
+ overflow: "auto"
2559
+ },
2560
+ children
2561
+ }
2562
+ )
2563
+ ]
2564
+ }
2565
+ )
2566
+ ]
2567
+ }
2568
+ );
2569
+ }
2570
+ DashboardLayout.propTypes = {
2571
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2572
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2573
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2574
+ // └─────────────────────────────────────────────────────────────────────┘
2575
+ /**
2576
+ * Branding options for the dashboard.
2577
+ * @default null
2578
+ */
2579
+ branding: PropTypes11__default.default.shape({
2580
+ homeUrl: PropTypes11__default.default.string,
2581
+ logo: PropTypes11__default.default.node,
2582
+ title: PropTypes11__default.default.string
2583
+ }),
2584
+ /**
2585
+ * The content of the dashboard.
2586
+ */
2587
+ children: PropTypes11__default.default.node,
2588
+ /**
2589
+ * Whether the sidebar should start collapsed in desktop size screens.
2590
+ * @default false
2591
+ */
2592
+ defaultSidebarCollapsed: PropTypes11__default.default.bool,
2593
+ /**
2594
+ * Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
2595
+ * @default false
2596
+ */
2597
+ disableCollapsibleSidebar: PropTypes11__default.default.bool,
2598
+ /**
2599
+ * Whether the navigation bar and menu icon should be hidden.
2600
+ * @default false
2601
+ */
2602
+ hideNavigation: PropTypes11__default.default.bool,
2603
+ /**
2604
+ * Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
2605
+ * @default []
2606
+ * @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
2607
+ */
2608
+ navigation: PropTypes11__default.default.arrayOf(
2609
+ PropTypes11__default.default.oneOfType([
2610
+ PropTypes11__default.default.shape({
2611
+ action: PropTypes11__default.default.node,
2612
+ children: PropTypes11__default.default.arrayOf(
2613
+ PropTypes11__default.default.oneOfType([
2614
+ PropTypes11__default.default.object,
2615
+ PropTypes11__default.default.shape({
2616
+ kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
2617
+ title: PropTypes11__default.default.string.isRequired
2618
+ }),
2619
+ PropTypes11__default.default.shape({
2620
+ kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
2621
+ })
2622
+ ]).isRequired
2623
+ ),
2624
+ icon: PropTypes11__default.default.node,
2625
+ kind: PropTypes11__default.default.oneOf(["page"]),
2626
+ pattern: PropTypes11__default.default.string,
2627
+ segment: PropTypes11__default.default.string,
2628
+ title: PropTypes11__default.default.string
2629
+ }),
2630
+ PropTypes11__default.default.shape({
2631
+ kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
2632
+ title: PropTypes11__default.default.string.isRequired
2633
+ }),
2634
+ PropTypes11__default.default.shape({
2635
+ kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
2636
+ })
2637
+ ]).isRequired
2638
+ ),
2639
+ /**
2640
+ * Render each page item.
2641
+ *
2642
+ * @param {NavigationPageItem} item
2643
+ * @param {{ mini: boolean }} params
2644
+ * @returns {ReactNode}
2645
+ */
2646
+ renderPageItem: PropTypes11__default.default.func,
2647
+ /**
2648
+ * Width of the sidebar when expanded.
2649
+ * @default 320
2650
+ */
2651
+ sidebarExpandedWidth: PropTypes11__default.default.oneOfType([PropTypes11__default.default.number, PropTypes11__default.default.string]),
2652
+ /**
2653
+ * The props used for each slot inside.
2654
+ * @default {}
2655
+ */
2656
+ slotProps: PropTypes11__default.default.shape({
2657
+ appTitle: PropTypes11__default.default.shape({
2658
+ branding: PropTypes11__default.default.shape({
2659
+ homeUrl: PropTypes11__default.default.string,
2660
+ logo: PropTypes11__default.default.node,
2661
+ title: PropTypes11__default.default.string
2662
+ })
2663
+ }),
2664
+ header: PropTypes11__default.default.shape({
2665
+ branding: PropTypes11__default.default.shape({
2666
+ homeUrl: PropTypes11__default.default.string,
2667
+ logo: PropTypes11__default.default.node,
2668
+ title: PropTypes11__default.default.string
2669
+ }),
2670
+ hideMenuButton: PropTypes11__default.default.bool,
2671
+ menuOpen: PropTypes11__default.default.bool.isRequired,
2672
+ onToggleMenu: PropTypes11__default.default.func.isRequired,
2673
+ slotProps: PropTypes11__default.default.shape({
2674
+ appTitle: PropTypes11__default.default.object,
2675
+ toolbarAccount: PropTypes11__default.default.object,
2676
+ toolbarActions: PropTypes11__default.default.object
2677
+ }),
2678
+ slots: PropTypes11__default.default.shape({
2679
+ appTitle: PropTypes11__default.default.elementType,
2680
+ toolbarAccount: PropTypes11__default.default.elementType,
2681
+ toolbarActions: PropTypes11__default.default.elementType
2682
+ })
2683
+ }),
2684
+ sidebarFooter: PropTypes11__default.default.shape({
2685
+ mini: PropTypes11__default.default.bool.isRequired
2686
+ }),
2687
+ toolbarAccount: PropTypes11__default.default.shape({
2688
+ localeText: PropTypes11__default.default.object,
2689
+ slotProps: PropTypes11__default.default.shape({
2690
+ popover: PropTypes11__default.default.object,
2691
+ popoverContent: PropTypes11__default.default.object,
2692
+ preview: PropTypes11__default.default.object,
2693
+ signInButton: PropTypes11__default.default.object,
2694
+ signOutButton: PropTypes11__default.default.object
2695
+ }),
2696
+ slots: PropTypes11__default.default.shape({
2697
+ popover: PropTypes11__default.default.elementType,
2698
+ popoverContent: PropTypes11__default.default.elementType,
2699
+ preview: PropTypes11__default.default.elementType,
2700
+ signInButton: PropTypes11__default.default.elementType,
2701
+ signOutButton: PropTypes11__default.default.elementType
2702
+ })
2703
+ }),
2704
+ toolbarActions: PropTypes11__default.default.object
2705
+ }),
2706
+ /**
2707
+ * The components used for each slot inside.
2708
+ * @default {}
2709
+ */
2710
+ slots: PropTypes11__default.default.shape({
2711
+ appTitle: PropTypes11__default.default.elementType,
2712
+ header: PropTypes11__default.default.elementType,
2713
+ sidebarFooter: PropTypes11__default.default.elementType,
2714
+ toolbarAccount: PropTypes11__default.default.elementType,
2715
+ toolbarActions: PropTypes11__default.default.elementType
2716
+ }),
2717
+ /**
2718
+ * The system prop that allows defining system overrides as well as additional CSS styles.
2719
+ */
2720
+ sx: PropTypes11__default.default.oneOfType([
2721
+ PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
2722
+ PropTypes11__default.default.func,
2723
+ PropTypes11__default.default.object
2724
+ ])
2725
+ };
2726
+ var PageHeaderToolbarRoot = material.styled("div")(({ theme }) => ({
2727
+ display: "flex",
2728
+ flexDirection: "row",
2729
+ gap: theme.spacing(1),
2730
+ // Ensure the toolbar is always on the right side, even after wrapping
2731
+ marginLeft: "auto"
2732
+ }));
2733
+ function PageHeaderToolbar(props) {
2734
+ return /* @__PURE__ */ jsxRuntime.jsx(PageHeaderToolbarRoot, __spreadValues({}, props));
2735
+ }
2736
+ PageHeaderToolbar.propTypes = {
2737
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2738
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2739
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2740
+ // └─────────────────────────────────────────────────────────────────────┘
2741
+ /**
2742
+ * @ignore
2743
+ */
2744
+ children: PropTypes11__default.default.node
2745
+ };
2746
+ var PageContentHeader = material.styled("div")(({ theme }) => ({
2747
+ display: "flex",
2748
+ flexDirection: "row",
2749
+ justifyContent: "space-between",
2750
+ gap: theme.spacing(2)
2751
+ }));
2752
+ function PageHeader(props) {
2753
+ var _a, _b, _c, _d, _e;
2754
+ const { breadcrumbs, title } = props;
2755
+ const activePage = useActivePage();
2756
+ const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
2757
+ const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
2758
+ const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
2759
+ const toolbarSlotProps = useSlotProps__default.default({
2760
+ elementType: ToolbarComponent,
2761
+ ownerState: props,
2762
+ externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
2763
+ additionalProps: {}
2764
+ });
2765
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { children: [
2766
+ /* @__PURE__ */ jsxRuntime.jsx(Breadcrumbs__default.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
2767
+ return item.path ? /* @__PURE__ */ jsxRuntime.jsx(
2768
+ Link4__default.default,
2769
+ {
2770
+ component: Link2,
2771
+ underline: "hover",
2772
+ color: "inherit",
2773
+ href: item.path,
2774
+ children: getItemTitle(item)
2775
+ },
2776
+ index
2777
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { color: "text.primary", children: getItemTitle(item) }, index);
2778
+ }) : null }),
2779
+ /* @__PURE__ */ jsxRuntime.jsxs(PageContentHeader, { children: [
2780
+ resolvedTitle ? /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "h4", children: resolvedTitle }) : null,
2781
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarComponent, __spreadValues({}, toolbarSlotProps))
2782
+ ] })
2783
+ ] });
2784
+ }
2785
+ PageHeader.propTypes = {
2786
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2787
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2788
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2789
+ // └─────────────────────────────────────────────────────────────────────┘
2790
+ /**
2791
+ * The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
2792
+ */
2793
+ breadcrumbs: PropTypes11__default.default.arrayOf(
2794
+ PropTypes11__default.default.shape({
2795
+ path: PropTypes11__default.default.string,
2796
+ title: PropTypes11__default.default.string.isRequired
2797
+ })
2798
+ ),
2799
+ /**
2800
+ * The props used for each slot inside.
2801
+ */
2802
+ slotProps: PropTypes11__default.default.shape({
2803
+ toolbar: PropTypes11__default.default.shape({
2804
+ children: PropTypes11__default.default.node
2805
+ }).isRequired
2806
+ }),
2807
+ /**
2808
+ * The components used for each slot inside.
2809
+ */
2810
+ slots: PropTypes11__default.default.shape({
2811
+ toolbar: PropTypes11__default.default.elementType
2812
+ }),
2813
+ /**
2814
+ * The title of the page. Leave blank to use the active page title.
2815
+ */
2816
+ title: PropTypes11__default.default.string
2817
+ };
2818
+ function PageContainer(props) {
2819
+ var _b;
2820
+ const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = __objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
2821
+ const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
2822
+ return /* @__PURE__ */ jsxRuntime.jsx(Container__default.default, __spreadProps(__spreadValues({}, rest), { sx: __spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
2823
+ /* @__PURE__ */ jsxRuntime.jsx(PageHeaderSlot, __spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
2824
+ /* @__PURE__ */ jsxRuntime.jsx(Box4__default.default, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
2825
+ ] }) }));
2826
+ }
2827
+ PageContainer.propTypes = {
2828
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2829
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2830
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2831
+ // └─────────────────────────────────────────────────────────────────────┘
2832
+ /**
2833
+ * The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
2834
+ */
2835
+ breadcrumbs: PropTypes11__default.default.arrayOf(
2836
+ PropTypes11__default.default.shape({
2837
+ path: PropTypes11__default.default.string,
2838
+ title: PropTypes11__default.default.string.isRequired
2839
+ })
2840
+ ),
2841
+ /**
2842
+ * @ignore
2843
+ */
2844
+ children: PropTypes11__default.default.node,
2845
+ /**
2846
+ * The props used for each slot inside.
2847
+ */
2848
+ slotProps: PropTypes11__default.default.shape({
2849
+ header: PropTypes11__default.default.shape({
2850
+ breadcrumbs: PropTypes11__default.default.arrayOf(
2851
+ PropTypes11__default.default.shape({
2852
+ path: PropTypes11__default.default.string,
2853
+ title: PropTypes11__default.default.string.isRequired
2854
+ })
2855
+ ),
2856
+ slotProps: PropTypes11__default.default.shape({
2857
+ toolbar: PropTypes11__default.default.object.isRequired
2858
+ }),
2859
+ slots: PropTypes11__default.default.shape({
2860
+ toolbar: PropTypes11__default.default.elementType
2861
+ }),
2862
+ title: PropTypes11__default.default.string
2863
+ }).isRequired
2864
+ }),
2865
+ /**
2866
+ * The components used for each slot inside.
2867
+ */
2868
+ slots: PropTypes11__default.default.shape({
2869
+ header: PropTypes11__default.default.elementType
2870
+ }),
2871
+ /**
2872
+ * The system prop that allows defining system overrides as well as additional CSS styles.
2873
+ */
2874
+ sx: PropTypes11__default.default.oneOfType([
2875
+ PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
2876
+ PropTypes11__default.default.func,
2877
+ PropTypes11__default.default.object
2878
+ ]),
2879
+ /**
2880
+ * The title of the page. Leave blank to use the active page title.
2881
+ */
2882
+ title: PropTypes11__default.default.string
2883
+ };
2884
+ var Link5 = React26__namespace.forwardRef((props, ref) => {
2885
+ const _a = props, { href, history: history2 } = _a, rest = __objRest(_a, ["href", "history"]);
2886
+ return /* @__PURE__ */ jsxRuntime.jsx(NextLink__default.default, __spreadValues({ ref, href, replace: history2 === "replace" }, rest));
206
2887
  });
2888
+ function NextAppProviderApp(props) {
2889
+ const pathname = navigation_js.usePathname();
2890
+ const searchParams = navigation_js.useSearchParams();
2891
+ const { push, replace } = navigation_js.useRouter();
2892
+ const navigate = React26__namespace.useCallback(
2893
+ (url, { history: history2 = "auto" } = {}) => {
2894
+ if (history2 === "auto" || history2 === "push") {
2895
+ return push(String(url));
2896
+ }
2897
+ if (history2 === "replace") {
2898
+ return replace(String(url));
2899
+ }
2900
+ throw new Error(`Invalid history option: ${history2}`);
2901
+ },
2902
+ [push, replace]
2903
+ );
2904
+ const routerImpl = React26__namespace.useMemo(
2905
+ () => ({
2906
+ pathname,
2907
+ searchParams,
2908
+ navigate,
2909
+ Link: Link5
2910
+ }),
2911
+ [pathname, navigate, searchParams]
2912
+ );
2913
+ return /* @__PURE__ */ jsxRuntime.jsx(AppProvider, __spreadValues({ router: routerImpl }, props));
2914
+ }
2915
+ function NextAppProvider(props) {
2916
+ const AppProvider2 = NextAppProviderApp;
2917
+ return /* @__PURE__ */ jsxRuntime.jsx(AppProvider2, __spreadValues({}, props));
2918
+ }
2919
+
2920
+ exports.Account = Account;
2921
+ exports.AccountPopoverFooter = AccountPopoverFooter;
2922
+ exports.AccountPopoverHeader = AccountPopoverHeader;
2923
+ exports.AccountPreview = AccountPreview;
2924
+ exports.AlertDialog = AlertDialog;
2925
+ exports.AppProvider = AppProvider;
2926
+ exports.AuthenticationContext = AuthenticationContext;
2927
+ exports.ConfirmDialog = ConfirmDialog;
2928
+ exports.DashboardHeader = DashboardHeader;
2929
+ exports.DashboardLayout = DashboardLayout;
2930
+ exports.DashboardSidebarPageItem = DashboardSidebarPageItem;
2931
+ exports.DialogsProvider = DialogsProvider;
2932
+ exports.LocalizationContext = LocalizationContext;
2933
+ exports.LocalizationProvider = LocalizationProvider;
2934
+ exports.NextAppProvider = NextAppProvider;
2935
+ exports.NotificationsProvider = NotificationsProvider;
2936
+ exports.PageContainer = PageContainer;
2937
+ exports.PageHeader = PageHeader;
2938
+ exports.PageHeaderToolbar = PageHeaderToolbar;
2939
+ exports.PromptDialog = PromptDialog;
2940
+ exports.SessionContext = SessionContext;
2941
+ exports.SignInButton = SignInButton;
2942
+ exports.SignOutButton = SignOutButton;
2943
+ exports.ThemeSwitcher = ThemeSwitcher;
2944
+ exports.ToolbarActions = ToolbarActions;
2945
+ exports.en = en_default;
2946
+ exports.useActivePage = useActivePage;
2947
+ exports.useDialogs = useDialogs;
2948
+ exports.useLocalStorageState = useLocalStorageState;
2949
+ exports.useLocaleText = useLocaleText;
2950
+ exports.useNotifications = useNotifications;
2951
+ exports.useStorageState = useStorageState;
2952
+ exports.useStorageStateServer = useStorageStateServer;