@iowas/toolpad 1.0.3 → 1.0.5

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