@iowas/toolpad 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/dist/core.d.mts +200 -4
- package/dist/core.d.ts +200 -4
- package/dist/core.js +777 -936
- package/dist/core.mjs +2849 -71
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +776 -1095
- package/dist/index.mjs +2849 -109
- package/package.json +2 -12
- package/dist/AppProvider-CIyOzZv_.d.mts +0 -201
- package/dist/AppProvider-CIyOzZv_.d.ts +0 -201
- package/dist/chunk-3JWXE2JW.mjs +0 -125
- package/dist/chunk-F6JD4MSY.mjs +0 -12
- package/dist/chunk-LUTZBKSG.mjs +0 -710
- package/dist/chunk-PMIWCP25.mjs +0 -68
- package/dist/chunk-ZXM3V5SD.mjs +0 -2325
- package/dist/nextjs.d.mts +0 -8
- package/dist/nextjs.d.ts +0 -8
- package/dist/nextjs.js +0 -802
- package/dist/nextjs.mjs +0 -54
- package/dist/utils.d.mts +0 -98
- package/dist/utils.d.ts +0 -98
- package/dist/utils.js +0 -218
- package/dist/utils.mjs +0 -42
package/dist/index.js
CHANGED
|
@@ -1,12 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React26 = require('react');
|
|
5
|
+
var PropTypes11 = require('prop-types');
|
|
6
|
+
var Popover = require('@mui/material/Popover');
|
|
7
|
+
var Divider = require('@mui/material/Divider');
|
|
8
|
+
var Stack = require('@mui/material/Stack');
|
|
9
|
+
var Button2 = require('@mui/material/Button');
|
|
10
|
+
var styles = require('@mui/material/styles');
|
|
11
|
+
var material = require('@mui/material');
|
|
12
|
+
var CloseIcon = require('@mui/icons-material/Close');
|
|
13
|
+
var useSlotProps = require('@mui/utils/useSlotProps');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
require('react-is');
|
|
16
|
+
var Dialog = require('@mui/material/Dialog');
|
|
17
|
+
var DialogTitle = require('@mui/material/DialogTitle');
|
|
18
|
+
var DialogContent = require('@mui/material/DialogContent');
|
|
19
|
+
var DialogActions = require('@mui/material/DialogActions');
|
|
20
|
+
var TextField = require('@mui/material/TextField');
|
|
21
|
+
var DialogContentText = require('@mui/material/DialogContentText');
|
|
22
|
+
var invariant2 = require('invariant');
|
|
23
|
+
var useEventCallback = require('@mui/utils/useEventCallback');
|
|
24
|
+
var InitColorSchemeScript = require('@mui/material/InitColorSchemeScript');
|
|
25
|
+
var CssBaseline = require('@mui/material/CssBaseline');
|
|
26
|
+
var LogoutIcon = require('@mui/icons-material/Logout');
|
|
27
|
+
var Avatar = require('@mui/material/Avatar');
|
|
28
|
+
var Typography = require('@mui/material/Typography');
|
|
29
|
+
var Tooltip = require('@mui/material/Tooltip');
|
|
30
|
+
var IconButton2 = require('@mui/material/IconButton');
|
|
31
|
+
var MoreVertIcon = require('@mui/icons-material/MoreVert');
|
|
32
|
+
var Box4 = require('@mui/material/Box');
|
|
33
|
+
var useMediaQuery2 = require('@mui/material/useMediaQuery');
|
|
34
|
+
var Drawer = require('@mui/material/Drawer');
|
|
35
|
+
var Toolbar2 = require('@mui/material/Toolbar');
|
|
36
|
+
var MuiAppBar = require('@mui/material/AppBar');
|
|
37
|
+
var MenuIcon = require('@mui/icons-material/Menu');
|
|
38
|
+
var MenuOpenIcon = require('@mui/icons-material/MenuOpen');
|
|
39
|
+
var DarkModeIcon = require('@mui/icons-material/DarkMode');
|
|
40
|
+
var LightModeIcon = require('@mui/icons-material/LightMode');
|
|
41
|
+
var List = require('@mui/material/List');
|
|
42
|
+
var ListSubheader = require('@mui/material/ListSubheader');
|
|
43
|
+
var pathToRegexp = require('path-to-regexp');
|
|
44
|
+
var Collapse = require('@mui/material/Collapse');
|
|
45
|
+
var Grow = require('@mui/material/Grow');
|
|
46
|
+
var ListItem = require('@mui/material/ListItem');
|
|
47
|
+
var ListItemButton = require('@mui/material/ListItemButton');
|
|
48
|
+
var ListItemIcon = require('@mui/material/ListItemIcon');
|
|
49
|
+
var ListItemText = require('@mui/material/ListItemText');
|
|
50
|
+
var Paper = require('@mui/material/Paper');
|
|
51
|
+
var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
|
|
52
|
+
var Container = require('@mui/material/Container');
|
|
53
|
+
var Breadcrumbs = require('@mui/material/Breadcrumbs');
|
|
54
|
+
var Link4 = require('@mui/material/Link');
|
|
55
|
+
var NextLink = require('next/link.js');
|
|
56
|
+
var navigation_js = require('next/navigation.js');
|
|
57
|
+
|
|
58
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
59
|
+
|
|
60
|
+
function _interopNamespace(e) {
|
|
61
|
+
if (e && e.__esModule) return e;
|
|
62
|
+
var n = Object.create(null);
|
|
63
|
+
if (e) {
|
|
64
|
+
Object.keys(e).forEach(function (k) {
|
|
65
|
+
if (k !== 'default') {
|
|
66
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
67
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return e[k]; }
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
n.default = e;
|
|
75
|
+
return Object.freeze(n);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
|
|
79
|
+
var PropTypes11__default = /*#__PURE__*/_interopDefault(PropTypes11);
|
|
80
|
+
var Popover__default = /*#__PURE__*/_interopDefault(Popover);
|
|
81
|
+
var Divider__default = /*#__PURE__*/_interopDefault(Divider);
|
|
82
|
+
var Stack__default = /*#__PURE__*/_interopDefault(Stack);
|
|
83
|
+
var Button2__default = /*#__PURE__*/_interopDefault(Button2);
|
|
84
|
+
var CloseIcon__default = /*#__PURE__*/_interopDefault(CloseIcon);
|
|
85
|
+
var useSlotProps__default = /*#__PURE__*/_interopDefault(useSlotProps);
|
|
86
|
+
var Dialog__default = /*#__PURE__*/_interopDefault(Dialog);
|
|
87
|
+
var DialogTitle__default = /*#__PURE__*/_interopDefault(DialogTitle);
|
|
88
|
+
var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
|
|
89
|
+
var DialogActions__default = /*#__PURE__*/_interopDefault(DialogActions);
|
|
90
|
+
var TextField__default = /*#__PURE__*/_interopDefault(TextField);
|
|
91
|
+
var DialogContentText__default = /*#__PURE__*/_interopDefault(DialogContentText);
|
|
92
|
+
var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
|
|
93
|
+
var useEventCallback__default = /*#__PURE__*/_interopDefault(useEventCallback);
|
|
94
|
+
var InitColorSchemeScript__default = /*#__PURE__*/_interopDefault(InitColorSchemeScript);
|
|
95
|
+
var CssBaseline__default = /*#__PURE__*/_interopDefault(CssBaseline);
|
|
96
|
+
var LogoutIcon__default = /*#__PURE__*/_interopDefault(LogoutIcon);
|
|
97
|
+
var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
|
|
98
|
+
var Typography__default = /*#__PURE__*/_interopDefault(Typography);
|
|
99
|
+
var Tooltip__default = /*#__PURE__*/_interopDefault(Tooltip);
|
|
100
|
+
var IconButton2__default = /*#__PURE__*/_interopDefault(IconButton2);
|
|
101
|
+
var MoreVertIcon__default = /*#__PURE__*/_interopDefault(MoreVertIcon);
|
|
102
|
+
var Box4__default = /*#__PURE__*/_interopDefault(Box4);
|
|
103
|
+
var useMediaQuery2__default = /*#__PURE__*/_interopDefault(useMediaQuery2);
|
|
104
|
+
var Drawer__default = /*#__PURE__*/_interopDefault(Drawer);
|
|
105
|
+
var Toolbar2__default = /*#__PURE__*/_interopDefault(Toolbar2);
|
|
106
|
+
var MuiAppBar__default = /*#__PURE__*/_interopDefault(MuiAppBar);
|
|
107
|
+
var MenuIcon__default = /*#__PURE__*/_interopDefault(MenuIcon);
|
|
108
|
+
var MenuOpenIcon__default = /*#__PURE__*/_interopDefault(MenuOpenIcon);
|
|
109
|
+
var DarkModeIcon__default = /*#__PURE__*/_interopDefault(DarkModeIcon);
|
|
110
|
+
var LightModeIcon__default = /*#__PURE__*/_interopDefault(LightModeIcon);
|
|
111
|
+
var List__default = /*#__PURE__*/_interopDefault(List);
|
|
112
|
+
var ListSubheader__default = /*#__PURE__*/_interopDefault(ListSubheader);
|
|
113
|
+
var Collapse__default = /*#__PURE__*/_interopDefault(Collapse);
|
|
114
|
+
var Grow__default = /*#__PURE__*/_interopDefault(Grow);
|
|
115
|
+
var ListItem__default = /*#__PURE__*/_interopDefault(ListItem);
|
|
116
|
+
var ListItemButton__default = /*#__PURE__*/_interopDefault(ListItemButton);
|
|
117
|
+
var ListItemIcon__default = /*#__PURE__*/_interopDefault(ListItemIcon);
|
|
118
|
+
var ListItemText__default = /*#__PURE__*/_interopDefault(ListItemText);
|
|
119
|
+
var Paper__default = /*#__PURE__*/_interopDefault(Paper);
|
|
120
|
+
var ExpandMoreIcon__default = /*#__PURE__*/_interopDefault(ExpandMoreIcon);
|
|
121
|
+
var Container__default = /*#__PURE__*/_interopDefault(Container);
|
|
122
|
+
var Breadcrumbs__default = /*#__PURE__*/_interopDefault(Breadcrumbs);
|
|
123
|
+
var Link4__default = /*#__PURE__*/_interopDefault(Link4);
|
|
124
|
+
var NextLink__default = /*#__PURE__*/_interopDefault(NextLink);
|
|
125
|
+
|
|
3
126
|
var __defProp = Object.defineProperty;
|
|
4
127
|
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
128
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
129
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
130
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
131
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
132
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -34,106 +154,7 @@ var __objRest = (source, exclude) => {
|
|
|
34
154
|
}
|
|
35
155
|
return target;
|
|
36
156
|
};
|
|
37
|
-
var
|
|
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);
|
|
58
|
-
|
|
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);
|
|
157
|
+
var NotificationsContext = React26__namespace.createContext(null);
|
|
137
158
|
|
|
138
159
|
// src/toolpad-core/useNotifications/useNotifications.tsx
|
|
139
160
|
var serverNotifications = {
|
|
@@ -145,24 +166,13 @@ var serverNotifications = {
|
|
|
145
166
|
}
|
|
146
167
|
};
|
|
147
168
|
function useNotifications() {
|
|
148
|
-
const context =
|
|
169
|
+
const context = React26__namespace.useContext(NotificationsContext);
|
|
149
170
|
if (context) {
|
|
150
171
|
return context;
|
|
151
172
|
}
|
|
152
173
|
return serverNotifications;
|
|
153
174
|
}
|
|
154
175
|
|
|
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
176
|
// src/toolpad-core/locales/getLocalization.ts
|
|
167
177
|
var getLocalization = (translations) => {
|
|
168
178
|
return {
|
|
@@ -225,21 +235,18 @@ var enLabels = {
|
|
|
225
235
|
deletedItemMessage: "This item has been deleted."
|
|
226
236
|
};
|
|
227
237
|
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({});
|
|
238
|
+
var LocalizationContext = React26__namespace.createContext({});
|
|
232
239
|
var LocalizationProvider = function LocalizationProvider2(props) {
|
|
233
240
|
var _a, _b, _c;
|
|
234
241
|
const { localeText: propsLocaleText, children } = props;
|
|
235
|
-
const theme =
|
|
242
|
+
const theme = styles.useTheme();
|
|
236
243
|
const themeLocaleText = (_c = (_b = (_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a.MuiLocalizationProvider) == null ? void 0 : _b.defaultProps) == null ? void 0 : _c.localeText;
|
|
237
244
|
const defaultLocaleText3 = en_default.components.MuiLocalizationProvider.defaultProps.localeText;
|
|
238
|
-
const localeText =
|
|
245
|
+
const localeText = React26__namespace.useMemo(
|
|
239
246
|
() => __spreadValues(__spreadValues(__spreadValues({}, defaultLocaleText3), themeLocaleText), propsLocaleText),
|
|
240
247
|
[defaultLocaleText3, themeLocaleText, propsLocaleText]
|
|
241
248
|
);
|
|
242
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LocalizationContext.Provider, { value: localeText, children });
|
|
243
250
|
};
|
|
244
251
|
LocalizationProvider.propTypes = {
|
|
245
252
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -249,101 +256,23 @@ LocalizationProvider.propTypes = {
|
|
|
249
256
|
/**
|
|
250
257
|
* @ignore
|
|
251
258
|
*/
|
|
252
|
-
children:
|
|
259
|
+
children: PropTypes11__default.default.node,
|
|
253
260
|
/**
|
|
254
261
|
* Locale for components texts
|
|
255
262
|
*/
|
|
256
|
-
localeText:
|
|
263
|
+
localeText: PropTypes11__default.default.object
|
|
257
264
|
};
|
|
258
265
|
function useLocaleText() {
|
|
259
|
-
return
|
|
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 });
|
|
266
|
+
return React26__namespace.useContext(LocalizationContext);
|
|
280
267
|
}
|
|
281
268
|
function useNonNullableContext(context, name) {
|
|
282
|
-
const maybeContext =
|
|
269
|
+
const maybeContext = React26__namespace.useContext(context);
|
|
283
270
|
if (maybeContext === null || maybeContext === void 0) {
|
|
284
271
|
throw new Error(`context "${name}" was used without a Provider`);
|
|
285
272
|
}
|
|
286
273
|
return maybeContext;
|
|
287
274
|
}
|
|
288
|
-
|
|
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
|
-
}
|
|
343
|
-
|
|
344
|
-
// src/toolpad-core/useNotifications/NotificationsProvider.tsx
|
|
345
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
346
|
-
var RootPropsContext = React5.createContext(null);
|
|
275
|
+
var RootPropsContext = React26__namespace.createContext(null);
|
|
347
276
|
var defaultLocaleText = {
|
|
348
277
|
close: "Close"
|
|
349
278
|
};
|
|
@@ -353,7 +282,7 @@ function Notification({ notificationKey, open, message, options, badge }) {
|
|
|
353
282
|
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
354
283
|
const { close } = useNonNullableContext(NotificationsContext);
|
|
355
284
|
const { severity, actionText, onAction, autoHideDuration } = options;
|
|
356
|
-
const handleClose =
|
|
285
|
+
const handleClose = React26__namespace.useCallback(
|
|
357
286
|
(event, reason) => {
|
|
358
287
|
if (reason === "clickaway") {
|
|
359
288
|
return;
|
|
@@ -362,23 +291,23 @@ function Notification({ notificationKey, open, message, options, badge }) {
|
|
|
362
291
|
},
|
|
363
292
|
[notificationKey, close]
|
|
364
293
|
);
|
|
365
|
-
const action = /* @__PURE__ */
|
|
366
|
-
onAction ? /* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
|
|
294
|
+
const action = /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
295
|
+
onAction ? /* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", size: "small", onClick: onAction, children: actionText != null ? actionText : "Action" }) : null,
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
+
material.IconButton,
|
|
369
298
|
{
|
|
370
299
|
size: "small",
|
|
371
300
|
"aria-label": localeText == null ? void 0 : localeText.close,
|
|
372
301
|
title: localeText == null ? void 0 : localeText.close,
|
|
373
302
|
color: "inherit",
|
|
374
303
|
onClick: handleClose,
|
|
375
|
-
children: /* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon__default.default, { fontSize: "small" })
|
|
376
305
|
}
|
|
377
306
|
)
|
|
378
307
|
] });
|
|
379
|
-
const props =
|
|
380
|
-
const SnackbarComponent = (_b = (_a = props == null ? void 0 : props.slots) == null ? void 0 : _a.snackbar) != null ? _b :
|
|
381
|
-
const snackbarSlotProps =
|
|
308
|
+
const props = React26__namespace.useContext(RootPropsContext);
|
|
309
|
+
const SnackbarComponent = (_b = (_a = props == null ? void 0 : props.slots) == null ? void 0 : _a.snackbar) != null ? _b : material.Snackbar;
|
|
310
|
+
const snackbarSlotProps = useSlotProps__default.default({
|
|
382
311
|
elementType: SnackbarComponent,
|
|
383
312
|
ownerState: props,
|
|
384
313
|
externalSlotProps: (_c = props == null ? void 0 : props.slotProps) == null ? void 0 : _c.snackbar,
|
|
@@ -389,12 +318,12 @@ function Notification({ notificationKey, open, message, options, badge }) {
|
|
|
389
318
|
action
|
|
390
319
|
}
|
|
391
320
|
});
|
|
392
|
-
return /* @__PURE__ */
|
|
321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SnackbarComponent, __spreadProps(__spreadValues({}, snackbarSlotProps), { children: /* @__PURE__ */ jsxRuntime.jsx(material.Badge, { badgeContent: badge, color: "primary", sx: { width: "100%" }, children: severity ? /* @__PURE__ */ jsxRuntime.jsx(material.Alert, { severity, sx: { width: "100%" }, action, children: message }) : /* @__PURE__ */ jsxRuntime.jsx(material.SnackbarContent, { message, action }) }) }), notificationKey);
|
|
393
322
|
}
|
|
394
323
|
function Notifications({ state }) {
|
|
395
324
|
var _a;
|
|
396
325
|
const currentNotification = (_a = state.queue[0]) != null ? _a : null;
|
|
397
|
-
return currentNotification ? /* @__PURE__ */
|
|
326
|
+
return currentNotification ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
398
327
|
Notification,
|
|
399
328
|
__spreadProps(__spreadValues({}, currentNotification), {
|
|
400
329
|
badge: state.queue.length > 1 ? String(state.queue.length) : null
|
|
@@ -409,8 +338,8 @@ var generateId = () => {
|
|
|
409
338
|
};
|
|
410
339
|
function NotificationsProvider(props) {
|
|
411
340
|
const { children } = props;
|
|
412
|
-
const [state, setState] =
|
|
413
|
-
const show =
|
|
341
|
+
const [state, setState] = React26__namespace.useState({ queue: [] });
|
|
342
|
+
const show = React26__namespace.useCallback((message, options = {}) => {
|
|
414
343
|
var _a;
|
|
415
344
|
const notificationKey = (_a = options.key) != null ? _a : `::toolpad-internal::notification::${generateId()}`;
|
|
416
345
|
setState((prev) => {
|
|
@@ -423,50 +352,29 @@ function NotificationsProvider(props) {
|
|
|
423
352
|
});
|
|
424
353
|
return notificationKey;
|
|
425
354
|
}, []);
|
|
426
|
-
const close =
|
|
355
|
+
const close = React26__namespace.useCallback((key) => {
|
|
427
356
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
428
357
|
queue: prev.queue.filter((n) => n.notificationKey !== key)
|
|
429
358
|
}));
|
|
430
359
|
}, []);
|
|
431
|
-
const contextValue =
|
|
432
|
-
return /* @__PURE__ */
|
|
360
|
+
const contextValue = React26__namespace.useMemo(() => ({ show, close }), [show, close]);
|
|
361
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootPropsContext.Provider, { value: props, children: /* @__PURE__ */ jsxRuntime.jsxs(NotificationsContext.Provider, { value: contextValue, children: [
|
|
433
362
|
children,
|
|
434
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsx(Notifications, { state })
|
|
435
364
|
] }) });
|
|
436
365
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var
|
|
440
|
-
var
|
|
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
|
-
|
|
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({
|
|
366
|
+
var DialogsContext = React26__namespace.createContext(null);
|
|
367
|
+
var BrandingContext = React26__namespace.createContext(null);
|
|
368
|
+
var NavigationContext = React26__namespace.createContext([]);
|
|
369
|
+
var PaletteModeContext = React26__namespace.createContext({
|
|
459
370
|
paletteMode: "light",
|
|
460
371
|
setPaletteMode: () => {
|
|
461
372
|
},
|
|
462
373
|
isDualTheme: false
|
|
463
374
|
});
|
|
464
|
-
var RouterContext =
|
|
465
|
-
var DashboardSidebarPageItemContext =
|
|
466
|
-
var WindowContext =
|
|
467
|
-
|
|
468
|
-
// src/toolpad-core/useDialogs/useDialogs.tsx
|
|
469
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
375
|
+
var RouterContext = React26__namespace.createContext(null);
|
|
376
|
+
var DashboardSidebarPageItemContext = React26__namespace.createContext(null);
|
|
377
|
+
var WindowContext = React26__namespace.createContext(void 0);
|
|
470
378
|
var defaultLocaleText2 = {
|
|
471
379
|
alert: "Alert",
|
|
472
380
|
confirm: "Confirm",
|
|
@@ -474,7 +382,7 @@ var defaultLocaleText2 = {
|
|
|
474
382
|
ok: "Ok"
|
|
475
383
|
};
|
|
476
384
|
function useDialogLoadingButton(onClose) {
|
|
477
|
-
const [loading, setLoading] =
|
|
385
|
+
const [loading, setLoading] = React26__namespace.useState(false);
|
|
478
386
|
const handleClick = async () => {
|
|
479
387
|
try {
|
|
480
388
|
setLoading(true);
|
|
@@ -490,12 +398,12 @@ function useDialogLoadingButton(onClose) {
|
|
|
490
398
|
}
|
|
491
399
|
function AlertDialog({ open, payload, onClose }) {
|
|
492
400
|
var _a, _b;
|
|
493
|
-
const appWindowContext =
|
|
401
|
+
const appWindowContext = React26__namespace.useContext(WindowContext);
|
|
494
402
|
const globalLocaleText = useLocaleText();
|
|
495
403
|
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
496
404
|
const okButtonProps = useDialogLoadingButton(() => onClose());
|
|
497
|
-
return /* @__PURE__ */
|
|
498
|
-
|
|
405
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
406
|
+
Dialog__default.default,
|
|
499
407
|
{
|
|
500
408
|
maxWidth: "xs",
|
|
501
409
|
fullWidth: true,
|
|
@@ -503,22 +411,22 @@ function AlertDialog({ open, payload, onClose }) {
|
|
|
503
411
|
onClose: () => onClose(),
|
|
504
412
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
505
413
|
children: [
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.alert }),
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
|
|
416
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogActions__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
|
|
509
417
|
]
|
|
510
418
|
}
|
|
511
419
|
);
|
|
512
420
|
}
|
|
513
421
|
function ConfirmDialog({ open, payload, onClose }) {
|
|
514
422
|
var _a, _b, _c;
|
|
515
|
-
const appWindowContext =
|
|
423
|
+
const appWindowContext = React26__namespace.useContext(WindowContext);
|
|
516
424
|
const globalLocaleText = useLocaleText();
|
|
517
425
|
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
518
426
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
|
|
519
427
|
const okButtonProps = useDialogLoadingButton(() => onClose(true));
|
|
520
|
-
return /* @__PURE__ */
|
|
521
|
-
|
|
428
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
429
|
+
Dialog__default.default,
|
|
522
430
|
{
|
|
523
431
|
maxWidth: "xs",
|
|
524
432
|
fullWidth: true,
|
|
@@ -526,11 +434,11 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
526
434
|
onClose: () => onClose(false),
|
|
527
435
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
528
436
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
|
|
534
442
|
] })
|
|
535
443
|
]
|
|
536
444
|
}
|
|
@@ -538,15 +446,15 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
538
446
|
}
|
|
539
447
|
function PromptDialog({ open, payload, onClose }) {
|
|
540
448
|
var _a, _b, _c;
|
|
541
|
-
const appWindowContext =
|
|
449
|
+
const appWindowContext = React26__namespace.useContext(WindowContext);
|
|
542
450
|
const globalLocaleText = useLocaleText();
|
|
543
451
|
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
544
|
-
const [input, setInput] =
|
|
452
|
+
const [input, setInput] = React26__namespace.useState("");
|
|
545
453
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
|
|
546
|
-
const [loading, setLoading] =
|
|
454
|
+
const [loading, setLoading] = React26__namespace.useState(false);
|
|
547
455
|
const name = "input";
|
|
548
|
-
return /* @__PURE__ */
|
|
549
|
-
|
|
456
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
457
|
+
Dialog__default.default,
|
|
550
458
|
{
|
|
551
459
|
maxWidth: "xs",
|
|
552
460
|
fullWidth: true,
|
|
@@ -561,7 +469,7 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
561
469
|
setLoading(true);
|
|
562
470
|
const formData = new FormData(event.currentTarget);
|
|
563
471
|
const value = (_a2 = formData.get(name)) != null ? _a2 : "";
|
|
564
|
-
|
|
472
|
+
invariant2__default.default(typeof value === "string", "Value must come from a text input");
|
|
565
473
|
await onClose(value);
|
|
566
474
|
} finally {
|
|
567
475
|
setLoading(false);
|
|
@@ -570,14 +478,14 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
570
478
|
},
|
|
571
479
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
572
480
|
children: [
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
482
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent__default.default, { children: [
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogContentText__default.default, { children: [
|
|
576
484
|
payload.msg,
|
|
577
485
|
" "
|
|
578
486
|
] }),
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
+
TextField__default.default,
|
|
581
489
|
{
|
|
582
490
|
autoFocus: true,
|
|
583
491
|
required: true,
|
|
@@ -592,9 +500,9 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
592
500
|
}
|
|
593
501
|
)
|
|
594
502
|
] }),
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, __spreadProps(__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2__default.default, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
|
|
598
506
|
] })
|
|
599
507
|
]
|
|
600
508
|
}
|
|
@@ -602,25 +510,25 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
602
510
|
}
|
|
603
511
|
function useDialogs() {
|
|
604
512
|
const { open, close } = useNonNullableContext(DialogsContext);
|
|
605
|
-
const alert =
|
|
513
|
+
const alert = useEventCallback__default.default(
|
|
606
514
|
(msg, _a = {}) => {
|
|
607
515
|
var _b = _a, { onClose } = _b, options = __objRest(_b, ["onClose"]);
|
|
608
516
|
return open(AlertDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
609
517
|
}
|
|
610
518
|
);
|
|
611
|
-
const confirm =
|
|
519
|
+
const confirm = useEventCallback__default.default(
|
|
612
520
|
(msg, _c = {}) => {
|
|
613
521
|
var _d = _c, { onClose } = _d, options = __objRest(_d, ["onClose"]);
|
|
614
522
|
return open(ConfirmDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
615
523
|
}
|
|
616
524
|
);
|
|
617
|
-
const prompt =
|
|
525
|
+
const prompt = useEventCallback__default.default(
|
|
618
526
|
(msg, _e = {}) => {
|
|
619
527
|
var _f = _e, { onClose } = _f, options = __objRest(_f, ["onClose"]);
|
|
620
528
|
return open(PromptDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
621
529
|
}
|
|
622
530
|
);
|
|
623
|
-
return
|
|
531
|
+
return React26__namespace.useMemo(
|
|
624
532
|
() => ({
|
|
625
533
|
alert,
|
|
626
534
|
confirm,
|
|
@@ -631,26 +539,20 @@ function useDialogs() {
|
|
|
631
539
|
[alert, close, confirm, open, prompt]
|
|
632
540
|
);
|
|
633
541
|
}
|
|
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
542
|
function DialogsProvider(props) {
|
|
641
543
|
const { children, unmountAfter = 1e3 } = props;
|
|
642
|
-
const [stack, setStack] =
|
|
643
|
-
const keyPrefix =
|
|
644
|
-
const nextId2 =
|
|
645
|
-
const dialogMetadata =
|
|
646
|
-
const requestDialog =
|
|
544
|
+
const [stack, setStack] = React26__namespace.useState([]);
|
|
545
|
+
const keyPrefix = React26__namespace.useId();
|
|
546
|
+
const nextId2 = React26__namespace.useRef(0);
|
|
547
|
+
const dialogMetadata = React26__namespace.useRef(/* @__PURE__ */ new WeakMap());
|
|
548
|
+
const requestDialog = useEventCallback__default.default(function open(Component, payload, options = {}) {
|
|
647
549
|
const { onClose = async () => {
|
|
648
550
|
} } = options;
|
|
649
551
|
let resolve;
|
|
650
552
|
const promise = new Promise((resolveImpl) => {
|
|
651
553
|
resolve = resolveImpl;
|
|
652
554
|
});
|
|
653
|
-
|
|
555
|
+
invariant2__default.default(resolve, "resolve not set");
|
|
654
556
|
const key = `${keyPrefix}-${nextId2.current}`;
|
|
655
557
|
nextId2.current += 1;
|
|
656
558
|
const newEntry = {
|
|
@@ -666,7 +568,7 @@ function DialogsProvider(props) {
|
|
|
666
568
|
setStack((prevStack) => [...prevStack, newEntry]);
|
|
667
569
|
return promise;
|
|
668
570
|
});
|
|
669
|
-
const closeDialogUi =
|
|
571
|
+
const closeDialogUi = useEventCallback__default.default(function closeDialogUi2(dialog) {
|
|
670
572
|
setStack(
|
|
671
573
|
(prevStack) => prevStack.map((entry) => entry.promise === dialog ? __spreadProps(__spreadValues({}, entry), { open: false }) : entry)
|
|
672
574
|
);
|
|
@@ -674,9 +576,9 @@ function DialogsProvider(props) {
|
|
|
674
576
|
setStack((prevStack) => prevStack.filter((entry) => entry.promise !== dialog));
|
|
675
577
|
}, unmountAfter);
|
|
676
578
|
});
|
|
677
|
-
const closeDialog =
|
|
579
|
+
const closeDialog = useEventCallback__default.default(async function closeDialog2(dialog, result) {
|
|
678
580
|
const entryToClose = dialogMetadata.current.get(dialog);
|
|
679
|
-
|
|
581
|
+
invariant2__default.default(entryToClose, "dialog not found");
|
|
680
582
|
try {
|
|
681
583
|
await entryToClose.onClose(result);
|
|
682
584
|
} finally {
|
|
@@ -685,13 +587,13 @@ function DialogsProvider(props) {
|
|
|
685
587
|
}
|
|
686
588
|
return dialog;
|
|
687
589
|
});
|
|
688
|
-
const contextValue =
|
|
590
|
+
const contextValue = React26__namespace.useMemo(
|
|
689
591
|
() => ({ open: requestDialog, close: closeDialog }),
|
|
690
592
|
[requestDialog, closeDialog]
|
|
691
593
|
);
|
|
692
|
-
return /* @__PURE__ */
|
|
594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DialogsContext.Provider, { value: contextValue, children: [
|
|
693
595
|
children,
|
|
694
|
-
stack.map(({ key, open, Component, payload, promise }) => /* @__PURE__ */
|
|
596
|
+
stack.map(({ key, open, Component, payload, promise }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
695
597
|
Component,
|
|
696
598
|
{
|
|
697
599
|
payload,
|
|
@@ -705,17 +607,6 @@ function DialogsProvider(props) {
|
|
|
705
607
|
] });
|
|
706
608
|
}
|
|
707
609
|
|
|
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
610
|
// src/toolpad-core/persistence/codec.tsx
|
|
720
611
|
var CODEC_STRING = {
|
|
721
612
|
parse: (value) => value,
|
|
@@ -813,32 +704,32 @@ var getKeyServerSnapshot = () => null;
|
|
|
813
704
|
function useStorageState(area, key, initializer = null, options) {
|
|
814
705
|
var _a;
|
|
815
706
|
const codec = (_a = options == null ? void 0 : options.codec) != null ? _a : CODEC_STRING;
|
|
816
|
-
const [initialValue] =
|
|
817
|
-
const encodedInitialValue =
|
|
707
|
+
const [initialValue] = React26__namespace.useState(initializer);
|
|
708
|
+
const encodedInitialValue = React26__namespace.useMemo(
|
|
818
709
|
() => encode(codec, initialValue),
|
|
819
710
|
[codec, initialValue]
|
|
820
711
|
);
|
|
821
|
-
const subscribeKey =
|
|
712
|
+
const subscribeKey = React26__namespace.useCallback(
|
|
822
713
|
(callback) => subscribe(area, key, callback),
|
|
823
714
|
[area, key]
|
|
824
715
|
);
|
|
825
|
-
const getKeySnapshot =
|
|
716
|
+
const getKeySnapshot = React26__namespace.useCallback(
|
|
826
717
|
() => {
|
|
827
718
|
var _a2;
|
|
828
719
|
return (_a2 = getSnapshot(area, key)) != null ? _a2 : encodedInitialValue;
|
|
829
720
|
},
|
|
830
721
|
[area, encodedInitialValue, key]
|
|
831
722
|
);
|
|
832
|
-
const encodedStoredValue =
|
|
723
|
+
const encodedStoredValue = React26__namespace.useSyncExternalStore(
|
|
833
724
|
subscribeKey,
|
|
834
725
|
getKeySnapshot,
|
|
835
726
|
getKeyServerSnapshot
|
|
836
727
|
);
|
|
837
|
-
const storedValue =
|
|
728
|
+
const storedValue = React26__namespace.useMemo(
|
|
838
729
|
() => decode(codec, encodedStoredValue),
|
|
839
730
|
[codec, encodedStoredValue]
|
|
840
731
|
);
|
|
841
|
-
const setStoredValue =
|
|
732
|
+
const setStoredValue = React26__namespace.useCallback(
|
|
842
733
|
(value) => {
|
|
843
734
|
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
844
735
|
const encodedValueToStore = encode(codec, valueToStore);
|
|
@@ -846,7 +737,7 @@ function useStorageState(area, key, initializer = null, options) {
|
|
|
846
737
|
},
|
|
847
738
|
[area, codec, storedValue, key]
|
|
848
739
|
);
|
|
849
|
-
const [nonStoredValue, setNonStoredValue] =
|
|
740
|
+
const [nonStoredValue, setNonStoredValue] = React26__namespace.useState(initialValue);
|
|
850
741
|
if (!key) {
|
|
851
742
|
return [nonStoredValue, setNonStoredValue];
|
|
852
743
|
}
|
|
@@ -856,13 +747,10 @@ function useStorageState(area, key, initializer = null, options) {
|
|
|
856
747
|
// src/toolpad-core/useLocalStorageState/useLocalStorageState.tsx
|
|
857
748
|
var useLocalStorageStateBrowser = (...args) => useStorageState(window.localStorage, ...args);
|
|
858
749
|
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
750
|
var COLOR_SCHEME_STORAGE_KEY = "toolpad-color-scheme";
|
|
863
751
|
var MODE_STORAGE_KEY = "toolpad-mode";
|
|
864
752
|
function usePreferredMode(window2) {
|
|
865
|
-
const prefersDarkMode =
|
|
753
|
+
const prefersDarkMode = material.useMediaQuery(
|
|
866
754
|
"(prefers-color-scheme: dark)",
|
|
867
755
|
window2 && {
|
|
868
756
|
matchMedia: window2.matchMedia
|
|
@@ -875,19 +763,19 @@ function isCssVarsTheme(theme) {
|
|
|
875
763
|
}
|
|
876
764
|
function LegacyThemeProvider(props) {
|
|
877
765
|
const { children, theme, window: appWindow } = props;
|
|
878
|
-
|
|
766
|
+
invariant2__default.default(!isCssVarsTheme(theme), "This provider only accepts legacy themes.");
|
|
879
767
|
const isDualTheme = "light" in theme || "dark" in theme;
|
|
880
768
|
const preferredMode = usePreferredMode(appWindow);
|
|
881
769
|
const [userMode, setUserMode] = useLocalStorageState(MODE_STORAGE_KEY, "system");
|
|
882
770
|
const paletteMode = !userMode || userMode === "system" ? preferredMode : userMode;
|
|
883
|
-
const dualAwareTheme =
|
|
771
|
+
const dualAwareTheme = React26__namespace.useMemo(
|
|
884
772
|
() => {
|
|
885
773
|
var _a;
|
|
886
774
|
return isDualTheme ? (_a = theme[paletteMode === "dark" ? "dark" : "light"]) != null ? _a : theme[paletteMode === "dark" ? "light" : "dark"] : theme;
|
|
887
775
|
},
|
|
888
776
|
[isDualTheme, paletteMode, theme]
|
|
889
777
|
);
|
|
890
|
-
const paletteModeContextValue =
|
|
778
|
+
const paletteModeContextValue = React26__namespace.useMemo(
|
|
891
779
|
() => ({
|
|
892
780
|
paletteMode,
|
|
893
781
|
setPaletteMode: setUserMode,
|
|
@@ -895,29 +783,29 @@ function LegacyThemeProvider(props) {
|
|
|
895
783
|
}),
|
|
896
784
|
[isDualTheme, paletteMode, setUserMode]
|
|
897
785
|
);
|
|
898
|
-
return /* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.ThemeProvider, { theme: dualAwareTheme, children: /* @__PURE__ */ jsxRuntime.jsxs(PaletteModeContext.Provider, { value: paletteModeContextValue, children: [
|
|
787
|
+
/* @__PURE__ */ jsxRuntime.jsx(CssBaseline__default.default, { enableColorScheme: true }),
|
|
900
788
|
children
|
|
901
789
|
] }) });
|
|
902
790
|
}
|
|
903
791
|
function CssVarsPaletteModeProvider(props) {
|
|
904
792
|
const { children, window: appWindow } = props;
|
|
905
793
|
const preferredMode = usePreferredMode(appWindow);
|
|
906
|
-
const { mode, setMode, allColorSchemes } =
|
|
907
|
-
const paletteModeContextValue =
|
|
794
|
+
const { mode, setMode, allColorSchemes } = styles.useColorScheme();
|
|
795
|
+
const paletteModeContextValue = React26__namespace.useMemo(() => {
|
|
908
796
|
return {
|
|
909
797
|
paletteMode: !mode || mode === "system" ? preferredMode : mode,
|
|
910
798
|
setPaletteMode: setMode,
|
|
911
799
|
isDualTheme: allColorSchemes.length > 1
|
|
912
800
|
};
|
|
913
801
|
}, [allColorSchemes, mode, preferredMode, setMode]);
|
|
914
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PaletteModeContext.Provider, { value: paletteModeContextValue, children });
|
|
915
803
|
}
|
|
916
804
|
function CssVarsThemeProvider(props) {
|
|
917
805
|
const { children, theme, window: appWindow, nonce } = props;
|
|
918
|
-
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
|
|
806
|
+
invariant2__default.default(isCssVarsTheme(theme), "This provider only accepts CSS vars themes.");
|
|
807
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
808
|
+
styles.ThemeProvider,
|
|
921
809
|
{
|
|
922
810
|
theme,
|
|
923
811
|
documentNode: appWindow == null ? void 0 : appWindow.document,
|
|
@@ -926,8 +814,8 @@ function CssVarsThemeProvider(props) {
|
|
|
926
814
|
colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
|
|
927
815
|
modeStorageKey: MODE_STORAGE_KEY,
|
|
928
816
|
children: [
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
818
|
+
InitColorSchemeScript__default.default,
|
|
931
819
|
{
|
|
932
820
|
attribute: theme.colorSchemeSelector,
|
|
933
821
|
colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
|
|
@@ -935,8 +823,8 @@ function CssVarsThemeProvider(props) {
|
|
|
935
823
|
nonce
|
|
936
824
|
}
|
|
937
825
|
),
|
|
938
|
-
/* @__PURE__ */
|
|
939
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CssVarsPaletteModeProvider, { window: appWindow, children: [
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsx(CssBaseline__default.default, { enableColorScheme: true }),
|
|
940
828
|
children
|
|
941
829
|
] })
|
|
942
830
|
]
|
|
@@ -946,15 +834,12 @@ function CssVarsThemeProvider(props) {
|
|
|
946
834
|
function AppThemeProvider(props) {
|
|
947
835
|
const _a = props, { children, theme } = _a, rest = __objRest(_a, ["children", "theme"]);
|
|
948
836
|
const useCssVarsProvider = isCssVarsTheme(theme);
|
|
949
|
-
return useCssVarsProvider ? /* @__PURE__ */
|
|
837
|
+
return useCssVarsProvider ? /* @__PURE__ */ jsxRuntime.jsx(CssVarsThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children })) : /* @__PURE__ */ jsxRuntime.jsx(LegacyThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children }));
|
|
950
838
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
954
|
-
var AuthenticationContext = React12.createContext(null);
|
|
955
|
-
var SessionContext = React12.createContext(null);
|
|
839
|
+
var AuthenticationContext = React26__namespace.createContext(null);
|
|
840
|
+
var SessionContext = React26__namespace.createContext(null);
|
|
956
841
|
function createDefaultTheme() {
|
|
957
|
-
return
|
|
842
|
+
return styles.createTheme({
|
|
958
843
|
cssVariables: {
|
|
959
844
|
colorSchemeSelector: "data-toolpad-color-scheme"
|
|
960
845
|
},
|
|
@@ -974,7 +859,7 @@ function AppProvider(props) {
|
|
|
974
859
|
window: appWindow,
|
|
975
860
|
nonce
|
|
976
861
|
} = props;
|
|
977
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WindowContext.Provider, { value: appWindow, children: /* @__PURE__ */ jsxRuntime.jsx(AuthenticationContext.Provider, { value: authentication, children: /* @__PURE__ */ jsxRuntime.jsx(SessionContext.Provider, { value: session, children: /* @__PURE__ */ jsxRuntime.jsx(RouterContext.Provider, { value: router, children: /* @__PURE__ */ jsxRuntime.jsx(AppThemeProvider, { theme, window: appWindow, nonce, children: /* @__PURE__ */ jsxRuntime.jsx(LocalizationProvider, { localeText, children: /* @__PURE__ */ jsxRuntime.jsx(NotificationsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BrandingContext.Provider, { value: branding, children: /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: navigation, children }) }) }) }) }) }) }) }) }) });
|
|
978
863
|
}
|
|
979
864
|
AppProvider.propTypes = {
|
|
980
865
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -985,114 +870,108 @@ AppProvider.propTypes = {
|
|
|
985
870
|
* Authentication methods.
|
|
986
871
|
* @default null
|
|
987
872
|
*/
|
|
988
|
-
authentication:
|
|
989
|
-
signIn:
|
|
990
|
-
signOut:
|
|
873
|
+
authentication: PropTypes11__default.default.shape({
|
|
874
|
+
signIn: PropTypes11__default.default.func.isRequired,
|
|
875
|
+
signOut: PropTypes11__default.default.func.isRequired
|
|
991
876
|
}),
|
|
992
877
|
/**
|
|
993
878
|
* Branding options for the app.
|
|
994
879
|
* @default null
|
|
995
880
|
*/
|
|
996
|
-
branding:
|
|
997
|
-
homeUrl:
|
|
998
|
-
logo:
|
|
999
|
-
title:
|
|
881
|
+
branding: PropTypes11__default.default.shape({
|
|
882
|
+
homeUrl: PropTypes11__default.default.string,
|
|
883
|
+
logo: PropTypes11__default.default.node,
|
|
884
|
+
title: PropTypes11__default.default.string
|
|
1000
885
|
}),
|
|
1001
886
|
/**
|
|
1002
887
|
* The content of the app provider.
|
|
1003
888
|
*/
|
|
1004
|
-
children:
|
|
889
|
+
children: PropTypes11__default.default.node,
|
|
1005
890
|
/**
|
|
1006
891
|
* Locale text for components
|
|
1007
892
|
*/
|
|
1008
|
-
localeText:
|
|
893
|
+
localeText: PropTypes11__default.default.object,
|
|
1009
894
|
/**
|
|
1010
895
|
* Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
|
|
1011
896
|
* @default []
|
|
1012
897
|
*/
|
|
1013
|
-
navigation:
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
action:
|
|
1017
|
-
children:
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
kind:
|
|
1022
|
-
title:
|
|
898
|
+
navigation: PropTypes11__default.default.arrayOf(
|
|
899
|
+
PropTypes11__default.default.oneOfType([
|
|
900
|
+
PropTypes11__default.default.shape({
|
|
901
|
+
action: PropTypes11__default.default.node,
|
|
902
|
+
children: PropTypes11__default.default.arrayOf(
|
|
903
|
+
PropTypes11__default.default.oneOfType([
|
|
904
|
+
PropTypes11__default.default.object,
|
|
905
|
+
PropTypes11__default.default.shape({
|
|
906
|
+
kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
|
|
907
|
+
title: PropTypes11__default.default.string.isRequired
|
|
1023
908
|
}),
|
|
1024
|
-
|
|
1025
|
-
kind:
|
|
909
|
+
PropTypes11__default.default.shape({
|
|
910
|
+
kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
|
|
1026
911
|
})
|
|
1027
912
|
]).isRequired
|
|
1028
913
|
),
|
|
1029
|
-
icon:
|
|
1030
|
-
kind:
|
|
1031
|
-
pattern:
|
|
1032
|
-
segment:
|
|
1033
|
-
title:
|
|
914
|
+
icon: PropTypes11__default.default.node,
|
|
915
|
+
kind: PropTypes11__default.default.oneOf(["page"]),
|
|
916
|
+
pattern: PropTypes11__default.default.string,
|
|
917
|
+
segment: PropTypes11__default.default.string,
|
|
918
|
+
title: PropTypes11__default.default.string
|
|
1034
919
|
}),
|
|
1035
|
-
|
|
1036
|
-
kind:
|
|
1037
|
-
title:
|
|
920
|
+
PropTypes11__default.default.shape({
|
|
921
|
+
kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
|
|
922
|
+
title: PropTypes11__default.default.string.isRequired
|
|
1038
923
|
}),
|
|
1039
|
-
|
|
1040
|
-
kind:
|
|
924
|
+
PropTypes11__default.default.shape({
|
|
925
|
+
kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
|
|
1041
926
|
})
|
|
1042
927
|
]).isRequired
|
|
1043
928
|
),
|
|
1044
929
|
/**
|
|
1045
930
|
* The nonce to be used for inline scripts.
|
|
1046
931
|
*/
|
|
1047
|
-
nonce:
|
|
932
|
+
nonce: PropTypes11__default.default.string,
|
|
1048
933
|
/**
|
|
1049
934
|
* Router implementation used inside Toolpad components.
|
|
1050
935
|
* @default null
|
|
1051
936
|
*/
|
|
1052
|
-
router:
|
|
1053
|
-
Link:
|
|
1054
|
-
navigate:
|
|
1055
|
-
pathname:
|
|
1056
|
-
searchParams:
|
|
937
|
+
router: PropTypes11__default.default.shape({
|
|
938
|
+
Link: PropTypes11__default.default.elementType,
|
|
939
|
+
navigate: PropTypes11__default.default.func.isRequired,
|
|
940
|
+
pathname: PropTypes11__default.default.string.isRequired,
|
|
941
|
+
searchParams: PropTypes11__default.default.instanceOf(URLSearchParams).isRequired
|
|
1057
942
|
}),
|
|
1058
943
|
/**
|
|
1059
944
|
* Session info about the current user.
|
|
1060
945
|
* @default null
|
|
1061
946
|
*/
|
|
1062
|
-
session:
|
|
1063
|
-
user:
|
|
1064
|
-
email:
|
|
1065
|
-
id:
|
|
1066
|
-
image:
|
|
1067
|
-
name:
|
|
947
|
+
session: PropTypes11__default.default.shape({
|
|
948
|
+
user: PropTypes11__default.default.shape({
|
|
949
|
+
email: PropTypes11__default.default.string,
|
|
950
|
+
id: PropTypes11__default.default.string,
|
|
951
|
+
image: PropTypes11__default.default.string,
|
|
952
|
+
name: PropTypes11__default.default.string
|
|
1068
953
|
})
|
|
1069
954
|
}),
|
|
1070
955
|
/**
|
|
1071
956
|
* [Theme or themes](https://mui.com/toolpad/core/react-app-provider/#theming) to be used by the app in light/dark mode. A [CSS variables theme](https://mui.com/material-ui/customization/css-theme-variables/overview/) is recommended.
|
|
1072
957
|
* @default createDefaultTheme()
|
|
1073
958
|
*/
|
|
1074
|
-
theme:
|
|
959
|
+
theme: PropTypes11__default.default.object,
|
|
1075
960
|
/**
|
|
1076
961
|
* The window where the application is rendered.
|
|
1077
962
|
* This is needed when rendering the app inside an iframe, for example.
|
|
1078
963
|
* @default window
|
|
1079
964
|
*/
|
|
1080
|
-
window:
|
|
965
|
+
window: PropTypes11__default.default.object
|
|
1081
966
|
};
|
|
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");
|
|
967
|
+
var AccountLocaleContext = React26__namespace.createContext(null);
|
|
1089
968
|
function SignInButton(props) {
|
|
1090
|
-
const authentication =
|
|
969
|
+
const authentication = React26__namespace.useContext(AuthenticationContext);
|
|
1091
970
|
const globalLocaleText = useLocaleText();
|
|
1092
|
-
const accountLocaleText =
|
|
971
|
+
const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
|
|
1093
972
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
|
|
973
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
974
|
+
Button2__default.default,
|
|
1096
975
|
__spreadProps(__spreadValues({
|
|
1097
976
|
disableElevation: true,
|
|
1098
977
|
variant: "contained",
|
|
@@ -1121,22 +1000,15 @@ SignInButton.propTypes = {
|
|
|
1121
1000
|
/**
|
|
1122
1001
|
* The content of the component.
|
|
1123
1002
|
*/
|
|
1124
|
-
children:
|
|
1003
|
+
children: PropTypes11__default.default.node
|
|
1125
1004
|
};
|
|
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
1005
|
function SignOutButton(props) {
|
|
1134
|
-
const authentication =
|
|
1006
|
+
const authentication = React26__namespace.useContext(AuthenticationContext);
|
|
1135
1007
|
const globalLocaleText = useLocaleText();
|
|
1136
|
-
const accountLocaleText =
|
|
1008
|
+
const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
|
|
1137
1009
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
|
|
1010
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1011
|
+
Button2__default.default,
|
|
1140
1012
|
__spreadProps(__spreadValues({
|
|
1141
1013
|
disabled: !authentication,
|
|
1142
1014
|
variant: "outlined",
|
|
@@ -1152,7 +1024,7 @@ function SignOutButton(props) {
|
|
|
1152
1024
|
filter: "opacity(1)"
|
|
1153
1025
|
}
|
|
1154
1026
|
},
|
|
1155
|
-
startIcon: /* @__PURE__ */
|
|
1027
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(LogoutIcon__default.default, {})
|
|
1156
1028
|
}, props), {
|
|
1157
1029
|
children: localeText == null ? void 0 : localeText.accountSignOutLabel
|
|
1158
1030
|
})
|
|
@@ -1166,31 +1038,20 @@ SignOutButton.propTypes = {
|
|
|
1166
1038
|
/**
|
|
1167
1039
|
* The content of the component.
|
|
1168
1040
|
*/
|
|
1169
|
-
children:
|
|
1041
|
+
children: PropTypes11__default.default.node
|
|
1170
1042
|
};
|
|
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
1043
|
function AccountPreview(props) {
|
|
1183
1044
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1184
1045
|
const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
|
|
1185
|
-
const session =
|
|
1046
|
+
const session = React26__namespace.useContext(SessionContext);
|
|
1186
1047
|
const globalLocaleText = useLocaleText();
|
|
1187
|
-
const accountLocaleText =
|
|
1048
|
+
const accountLocaleText = React26__namespace.useContext(AccountLocaleContext);
|
|
1188
1049
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
1189
1050
|
if (!session || !session.user) {
|
|
1190
1051
|
return null;
|
|
1191
1052
|
}
|
|
1192
|
-
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */
|
|
1193
|
-
|
|
1053
|
+
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatar, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1054
|
+
Avatar__default.default,
|
|
1194
1055
|
__spreadValues({
|
|
1195
1056
|
src: ((_a = session.user) == null ? void 0 : _a.image) || "",
|
|
1196
1057
|
alt: ((_b = session.user) == null ? void 0 : _b.name) || ((_c = session.user) == null ? void 0 : _c.email) || "",
|
|
@@ -1198,28 +1059,28 @@ function AccountPreview(props) {
|
|
|
1198
1059
|
}, slotProps == null ? void 0 : slotProps.avatar)
|
|
1199
1060
|
);
|
|
1200
1061
|
if (variant === "expanded") {
|
|
1201
|
-
return /* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "space-between", sx: __spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
|
|
1203
1064
|
avatarContent,
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
|
|
1207
1068
|
] })
|
|
1208
1069
|
] }),
|
|
1209
|
-
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */
|
|
1210
|
-
|
|
1070
|
+
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.moreIconButton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1071
|
+
IconButton2__default.default,
|
|
1211
1072
|
__spreadProps(__spreadValues({
|
|
1212
1073
|
size: "small",
|
|
1213
1074
|
onClick: handleClick
|
|
1214
1075
|
}, slotProps == null ? void 0 : slotProps.moreIconButton), {
|
|
1215
1076
|
sx: __spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
|
|
1216
|
-
children: /* @__PURE__ */
|
|
1077
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MoreVertIcon__default.default, { fontSize: "small" })
|
|
1217
1078
|
})
|
|
1218
1079
|
))
|
|
1219
1080
|
] });
|
|
1220
1081
|
}
|
|
1221
|
-
return /* @__PURE__ */
|
|
1222
|
-
|
|
1082
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip__default.default, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatarIconButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, { sx: __spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1083
|
+
IconButton2__default.default,
|
|
1223
1084
|
__spreadProps(__spreadValues({
|
|
1224
1085
|
onClick: handleClick,
|
|
1225
1086
|
"aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
|
|
@@ -1241,35 +1102,35 @@ AccountPreview.propTypes = {
|
|
|
1241
1102
|
/**
|
|
1242
1103
|
* The handler used when the preview is expanded
|
|
1243
1104
|
*/
|
|
1244
|
-
handleClick:
|
|
1105
|
+
handleClick: PropTypes11__default.default.func,
|
|
1245
1106
|
/**
|
|
1246
1107
|
* The state of the Account popover
|
|
1247
1108
|
* @default false
|
|
1248
1109
|
*/
|
|
1249
|
-
open:
|
|
1110
|
+
open: PropTypes11__default.default.bool,
|
|
1250
1111
|
/**
|
|
1251
1112
|
* The props used for each slot inside.
|
|
1252
1113
|
*/
|
|
1253
|
-
slotProps:
|
|
1254
|
-
avatar:
|
|
1255
|
-
avatarIconButton:
|
|
1256
|
-
moreIconButton:
|
|
1114
|
+
slotProps: PropTypes11__default.default.shape({
|
|
1115
|
+
avatar: PropTypes11__default.default.object,
|
|
1116
|
+
avatarIconButton: PropTypes11__default.default.object,
|
|
1117
|
+
moreIconButton: PropTypes11__default.default.object
|
|
1257
1118
|
}),
|
|
1258
1119
|
/**
|
|
1259
1120
|
* The components used for each slot inside.
|
|
1260
1121
|
*/
|
|
1261
|
-
slots:
|
|
1262
|
-
avatar:
|
|
1263
|
-
avatarIconButton:
|
|
1264
|
-
moreIconButton:
|
|
1122
|
+
slots: PropTypes11__default.default.shape({
|
|
1123
|
+
avatar: PropTypes11__default.default.elementType,
|
|
1124
|
+
avatarIconButton: PropTypes11__default.default.elementType,
|
|
1125
|
+
moreIconButton: PropTypes11__default.default.elementType
|
|
1265
1126
|
}),
|
|
1266
1127
|
/**
|
|
1267
1128
|
* The prop used to customize the styling of the preview
|
|
1268
1129
|
*/
|
|
1269
|
-
sx:
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1130
|
+
sx: PropTypes11__default.default.oneOfType([
|
|
1131
|
+
PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
|
|
1132
|
+
PropTypes11__default.default.func,
|
|
1133
|
+
PropTypes11__default.default.object
|
|
1273
1134
|
]),
|
|
1274
1135
|
/**
|
|
1275
1136
|
* The type of account details to display.
|
|
@@ -1277,16 +1138,11 @@ AccountPreview.propTypes = {
|
|
|
1277
1138
|
* @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
|
|
1278
1139
|
* @default 'condensed'
|
|
1279
1140
|
*/
|
|
1280
|
-
variant:
|
|
1141
|
+
variant: PropTypes11__default.default.oneOf(["condensed", "expanded"])
|
|
1281
1142
|
};
|
|
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
1143
|
function AccountPopoverHeader(props) {
|
|
1288
1144
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
1289
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
1290
1146
|
}
|
|
1291
1147
|
AccountPopoverHeader.propTypes = {
|
|
1292
1148
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -1296,17 +1152,12 @@ AccountPopoverHeader.propTypes = {
|
|
|
1296
1152
|
/**
|
|
1297
1153
|
* The content of the component.
|
|
1298
1154
|
*/
|
|
1299
|
-
children:
|
|
1155
|
+
children: PropTypes11__default.default.node
|
|
1300
1156
|
};
|
|
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
1157
|
function AccountPopoverFooter(props) {
|
|
1307
1158
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
1308
|
-
return /* @__PURE__ */
|
|
1309
|
-
|
|
1159
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1160
|
+
Box4__default.default,
|
|
1310
1161
|
__spreadProps(__spreadValues({}, rest), {
|
|
1311
1162
|
sx: __spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
|
|
1312
1163
|
children
|
|
@@ -1321,19 +1172,16 @@ AccountPopoverFooter.propTypes = {
|
|
|
1321
1172
|
/**
|
|
1322
1173
|
* @ignore
|
|
1323
1174
|
*/
|
|
1324
|
-
children:
|
|
1175
|
+
children: PropTypes11__default.default.node,
|
|
1325
1176
|
/**
|
|
1326
1177
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1327
1178
|
*/
|
|
1328
|
-
sx:
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1179
|
+
sx: PropTypes11__default.default.oneOfType([
|
|
1180
|
+
PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
|
|
1181
|
+
PropTypes11__default.default.func,
|
|
1182
|
+
PropTypes11__default.default.object
|
|
1332
1183
|
])
|
|
1333
1184
|
};
|
|
1334
|
-
|
|
1335
|
-
// src/toolpad-core/Account/Account.tsx
|
|
1336
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1337
1185
|
var defaultAccountLocaleText = {
|
|
1338
1186
|
accountPreviewIconButtonLabel: "Current User",
|
|
1339
1187
|
accountPreviewTitle: "Account",
|
|
@@ -1344,14 +1192,14 @@ function Account(props) {
|
|
|
1344
1192
|
var _a;
|
|
1345
1193
|
const { localeText: propsLocaleText } = props;
|
|
1346
1194
|
const globalLocaleText = useLocaleText();
|
|
1347
|
-
const localeText =
|
|
1195
|
+
const localeText = React26__namespace.useMemo(
|
|
1348
1196
|
() => __spreadValues(__spreadValues(__spreadValues({}, defaultAccountLocaleText), globalLocaleText), propsLocaleText),
|
|
1349
1197
|
[globalLocaleText, propsLocaleText]
|
|
1350
1198
|
);
|
|
1351
1199
|
const { slots, slotProps } = props;
|
|
1352
|
-
const [anchorEl, setAnchorEl] =
|
|
1353
|
-
const session =
|
|
1354
|
-
const authentication =
|
|
1200
|
+
const [anchorEl, setAnchorEl] = React26__namespace.useState(null);
|
|
1201
|
+
const session = React26__namespace.useContext(SessionContext);
|
|
1202
|
+
const authentication = React26__namespace.useContext(AuthenticationContext);
|
|
1355
1203
|
const open = Boolean(anchorEl);
|
|
1356
1204
|
const handleClick = (event) => {
|
|
1357
1205
|
setAnchorEl(event.currentTarget);
|
|
@@ -1364,10 +1212,10 @@ function Account(props) {
|
|
|
1364
1212
|
}
|
|
1365
1213
|
let accountContent = null;
|
|
1366
1214
|
if (!(session == null ? void 0 : session.user)) {
|
|
1367
|
-
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */
|
|
1215
|
+
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsxRuntime.jsx(SignInButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
|
|
1368
1216
|
} else {
|
|
1369
|
-
accountContent = /* @__PURE__ */
|
|
1370
|
-
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */
|
|
1217
|
+
accountContent = /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
1218
|
+
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsxRuntime.jsx(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
1219
|
AccountPreview,
|
|
1372
1220
|
__spreadValues({
|
|
1373
1221
|
variant: "condensed",
|
|
@@ -1375,15 +1223,15 @@ function Account(props) {
|
|
|
1375
1223
|
open
|
|
1376
1224
|
}, slotProps == null ? void 0 : slotProps.preview)
|
|
1377
1225
|
),
|
|
1378
|
-
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */
|
|
1226
|
+
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1379
1227
|
slots.popover,
|
|
1380
1228
|
__spreadValues({
|
|
1381
1229
|
open,
|
|
1382
1230
|
onClick: handleClick,
|
|
1383
1231
|
onClose: handleClose
|
|
1384
1232
|
}, slotProps == null ? void 0 : slotProps.popover)
|
|
1385
|
-
) : /* @__PURE__ */
|
|
1386
|
-
|
|
1233
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1234
|
+
Popover__default.default,
|
|
1387
1235
|
__spreadProps(__spreadValues({
|
|
1388
1236
|
anchorEl,
|
|
1389
1237
|
id: "account-menu",
|
|
@@ -1415,16 +1263,16 @@ function Account(props) {
|
|
|
1415
1263
|
}
|
|
1416
1264
|
}
|
|
1417
1265
|
}, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
|
|
1418
|
-
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1266
|
+
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsxRuntime.jsx(slots.popoverContent, __spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, __spreadProps(__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
|
|
1267
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccountPopoverHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(AccountPreview, { variant: "expanded" }) }),
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider__default.default, {}),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccountPopoverFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(SignOutButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
|
|
1422
1270
|
] }))
|
|
1423
1271
|
})
|
|
1424
1272
|
)
|
|
1425
1273
|
] });
|
|
1426
1274
|
}
|
|
1427
|
-
return /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
|
|
1428
1276
|
}
|
|
1429
1277
|
Account.propTypes = {
|
|
1430
1278
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -1434,82 +1282,51 @@ Account.propTypes = {
|
|
|
1434
1282
|
/**
|
|
1435
1283
|
* The labels for the account component.
|
|
1436
1284
|
*/
|
|
1437
|
-
localeText:
|
|
1285
|
+
localeText: PropTypes11__default.default.object,
|
|
1438
1286
|
/**
|
|
1439
1287
|
* The props used for each slot inside.
|
|
1440
1288
|
*/
|
|
1441
|
-
slotProps:
|
|
1442
|
-
popover:
|
|
1443
|
-
popoverContent:
|
|
1444
|
-
preview:
|
|
1445
|
-
handleClick:
|
|
1446
|
-
open:
|
|
1447
|
-
slotProps:
|
|
1448
|
-
avatar:
|
|
1449
|
-
avatarIconButton:
|
|
1450
|
-
moreIconButton:
|
|
1289
|
+
slotProps: PropTypes11__default.default.shape({
|
|
1290
|
+
popover: PropTypes11__default.default.object,
|
|
1291
|
+
popoverContent: PropTypes11__default.default.object,
|
|
1292
|
+
preview: PropTypes11__default.default.shape({
|
|
1293
|
+
handleClick: PropTypes11__default.default.func,
|
|
1294
|
+
open: PropTypes11__default.default.bool,
|
|
1295
|
+
slotProps: PropTypes11__default.default.shape({
|
|
1296
|
+
avatar: PropTypes11__default.default.object,
|
|
1297
|
+
avatarIconButton: PropTypes11__default.default.object,
|
|
1298
|
+
moreIconButton: PropTypes11__default.default.object
|
|
1451
1299
|
}),
|
|
1452
|
-
slots:
|
|
1453
|
-
avatar:
|
|
1454
|
-
avatarIconButton:
|
|
1455
|
-
moreIconButton:
|
|
1300
|
+
slots: PropTypes11__default.default.shape({
|
|
1301
|
+
avatar: PropTypes11__default.default.elementType,
|
|
1302
|
+
avatarIconButton: PropTypes11__default.default.elementType,
|
|
1303
|
+
moreIconButton: PropTypes11__default.default.elementType
|
|
1456
1304
|
}),
|
|
1457
|
-
sx:
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1305
|
+
sx: PropTypes11__default.default.oneOfType([
|
|
1306
|
+
PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
|
|
1307
|
+
PropTypes11__default.default.func,
|
|
1308
|
+
PropTypes11__default.default.object
|
|
1461
1309
|
]),
|
|
1462
|
-
variant:
|
|
1310
|
+
variant: PropTypes11__default.default.oneOf(["condensed", "expanded"])
|
|
1463
1311
|
}),
|
|
1464
|
-
signInButton:
|
|
1465
|
-
signOutButton:
|
|
1312
|
+
signInButton: PropTypes11__default.default.object,
|
|
1313
|
+
signOutButton: PropTypes11__default.default.object
|
|
1466
1314
|
}),
|
|
1467
1315
|
/**
|
|
1468
1316
|
* The components used for each slot inside.
|
|
1469
1317
|
*/
|
|
1470
|
-
slots:
|
|
1471
|
-
popover:
|
|
1472
|
-
popoverContent:
|
|
1473
|
-
preview:
|
|
1474
|
-
signInButton:
|
|
1475
|
-
signOutButton:
|
|
1318
|
+
slots: PropTypes11__default.default.shape({
|
|
1319
|
+
popover: PropTypes11__default.default.elementType,
|
|
1320
|
+
popoverContent: PropTypes11__default.default.elementType,
|
|
1321
|
+
preview: PropTypes11__default.default.elementType,
|
|
1322
|
+
signInButton: PropTypes11__default.default.elementType,
|
|
1323
|
+
signOutButton: PropTypes11__default.default.elementType
|
|
1476
1324
|
})
|
|
1477
1325
|
};
|
|
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) {
|
|
1326
|
+
var DefaultLink = React26__namespace.forwardRef(function Link(props, ref) {
|
|
1510
1327
|
const _a = props, { children, href, onClick, history: history2 } = _a, rest = __objRest(_a, ["children", "href", "onClick", "history"]);
|
|
1511
|
-
const routerContext =
|
|
1512
|
-
const handleLinkClick =
|
|
1328
|
+
const routerContext = React26__namespace.useContext(RouterContext);
|
|
1329
|
+
const handleLinkClick = React26__namespace.useMemo(() => {
|
|
1513
1330
|
if (!routerContext) {
|
|
1514
1331
|
return onClick;
|
|
1515
1332
|
}
|
|
@@ -1520,25 +1337,22 @@ var DefaultLink = React18.forwardRef(function Link(props, ref) {
|
|
|
1520
1337
|
onClick == null ? void 0 : onClick(event);
|
|
1521
1338
|
};
|
|
1522
1339
|
}, [routerContext, onClick, history2]);
|
|
1523
|
-
return /* @__PURE__ */
|
|
1340
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", __spreadProps(__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
|
|
1524
1341
|
});
|
|
1525
|
-
var Link2 =
|
|
1342
|
+
var Link2 = React26__namespace.forwardRef(function Link3(props, ref) {
|
|
1526
1343
|
var _a;
|
|
1527
|
-
const routerContext =
|
|
1344
|
+
const routerContext = React26__namespace.useContext(RouterContext);
|
|
1528
1345
|
const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
|
|
1529
|
-
return /* @__PURE__ */
|
|
1346
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, __spreadProps(__spreadValues({ ref }, props), { children: props.children }));
|
|
1530
1347
|
});
|
|
1531
|
-
|
|
1532
|
-
// src/toolpad-core/DashboardLayout/ToolpadLogo.tsx
|
|
1533
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1534
1348
|
function ToolpadLogo({ size = 40 }) {
|
|
1535
|
-
return /* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1350
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#a)", children: [
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
|
|
1352
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16.1 16.34 6.64-3.8 6.64 3.8-6.64 3.8-6.65-3.8Z", fill: "#A5D8FF" })
|
|
1540
1354
|
] }),
|
|
1541
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1542
1356
|
"mask",
|
|
1543
1357
|
{
|
|
1544
1358
|
id: "b",
|
|
@@ -1550,7 +1364,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1550
1364
|
y: "17",
|
|
1551
1365
|
width: "14",
|
|
1552
1366
|
height: "15",
|
|
1553
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1554
1368
|
"path",
|
|
1555
1369
|
{
|
|
1556
1370
|
d: "M8.5 22.3c0-1.05.56-2 1.46-2.53l3.75-2.14c.89-.5 1.98-.5 2.87 0l3.75 2.14a2.9 2.9 0 0 1 1.46 2.52v4.23c0 1.04-.56 2-1.46 2.52l-3.75 2.14c-.89.5-1.98.5-2.87 0l-3.75-2.14a2.9 2.9 0 0 1-1.46-2.52v-4.23Z",
|
|
@@ -1559,12 +1373,12 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1559
1373
|
)
|
|
1560
1374
|
}
|
|
1561
1375
|
),
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#b)", children: [
|
|
1377
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
|
|
1378
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
|
|
1379
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.5 20.6 6.64-3.79 6.65 3.8-6.65 3.8-6.64-3.8Z", fill: "#A5D8FF" })
|
|
1566
1380
|
] }),
|
|
1567
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1568
1382
|
"mask",
|
|
1569
1383
|
{
|
|
1570
1384
|
id: "c",
|
|
@@ -1576,7 +1390,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1576
1390
|
y: "4",
|
|
1577
1391
|
width: "22",
|
|
1578
1392
|
height: "20",
|
|
1579
|
-
children: /* @__PURE__ */
|
|
1393
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1580
1394
|
"path",
|
|
1581
1395
|
{
|
|
1582
1396
|
d: "M24.17 4.82a2.9 2.9 0 0 0-2.87 0L9.97 11.22a2.9 2.9 0 0 0-1.47 2.53v4.22c0 1.04.56 2 1.46 2.52l3.75 2.14c.89.5 1.98.5 2.87 0l11.33-6.42a2.9 2.9 0 0 0 1.47-2.52V9.48c0-1.04-.56-2-1.46-2.52l-3.75-2.14Z",
|
|
@@ -1585,25 +1399,19 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1585
1399
|
)
|
|
1586
1400
|
}
|
|
1587
1401
|
),
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */
|
|
1591
|
-
/* @__PURE__ */
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#c)", children: [
|
|
1403
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
|
|
1404
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
|
|
1405
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
|
|
1592
1406
|
] })
|
|
1593
1407
|
] });
|
|
1594
1408
|
}
|
|
1595
|
-
|
|
1596
|
-
// src/toolpad-core/shared/branding.ts
|
|
1597
|
-
var React19 = __toESM(require("react"));
|
|
1598
1409
|
function useApplicationTitle() {
|
|
1599
1410
|
var _a;
|
|
1600
|
-
const branding =
|
|
1411
|
+
const branding = React26__namespace.useContext(BrandingContext);
|
|
1601
1412
|
return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
|
|
1602
1413
|
}
|
|
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")({
|
|
1414
|
+
var LogoContainer = material.styled("div")({
|
|
1607
1415
|
position: "relative",
|
|
1608
1416
|
height: 40,
|
|
1609
1417
|
display: "flex",
|
|
@@ -1614,13 +1422,13 @@ var LogoContainer = (0, import_material3.styled)("div")({
|
|
|
1614
1422
|
});
|
|
1615
1423
|
function AppTitle(props) {
|
|
1616
1424
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1617
|
-
const theme =
|
|
1425
|
+
const theme = material.useTheme();
|
|
1618
1426
|
const defaultTitle = useApplicationTitle();
|
|
1619
1427
|
const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
|
|
1620
|
-
return /* @__PURE__ */
|
|
1621
|
-
/* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
|
|
1428
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
|
|
1429
|
+
/* @__PURE__ */ jsxRuntime.jsx(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsxRuntime.jsx(ToolpadLogo, { size: 40 }) }),
|
|
1430
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1431
|
+
Typography__default.default,
|
|
1624
1432
|
{
|
|
1625
1433
|
variant: "h6",
|
|
1626
1434
|
sx: {
|
|
@@ -1635,20 +1443,6 @@ function AppTitle(props) {
|
|
|
1635
1443
|
)
|
|
1636
1444
|
] }) });
|
|
1637
1445
|
}
|
|
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
1446
|
function subscribe2() {
|
|
1653
1447
|
return () => {
|
|
1654
1448
|
};
|
|
@@ -1660,35 +1454,32 @@ function getServerSnapshot() {
|
|
|
1660
1454
|
return true;
|
|
1661
1455
|
}
|
|
1662
1456
|
function useSsr() {
|
|
1663
|
-
return
|
|
1457
|
+
return React26__namespace.useSyncExternalStore(subscribe2, getSnapshot2, getServerSnapshot);
|
|
1664
1458
|
}
|
|
1665
|
-
|
|
1666
|
-
// src/toolpad-core/DashboardLayout/ThemeSwitcher.tsx
|
|
1667
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1668
1459
|
function ThemeSwitcher() {
|
|
1669
1460
|
var _a;
|
|
1670
1461
|
const isSsr = useSsr();
|
|
1671
|
-
const theme =
|
|
1672
|
-
const { paletteMode, setPaletteMode, isDualTheme } =
|
|
1673
|
-
const toggleMode =
|
|
1462
|
+
const theme = material.useTheme();
|
|
1463
|
+
const { paletteMode, setPaletteMode, isDualTheme } = React26__namespace.useContext(PaletteModeContext);
|
|
1464
|
+
const toggleMode = React26__namespace.useCallback(() => {
|
|
1674
1465
|
setPaletteMode(paletteMode === "dark" ? "light" : "dark");
|
|
1675
1466
|
}, [paletteMode, setPaletteMode]);
|
|
1676
|
-
return isDualTheme ? /* @__PURE__ */
|
|
1677
|
-
|
|
1467
|
+
return isDualTheme ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1468
|
+
Tooltip__default.default,
|
|
1678
1469
|
{
|
|
1679
1470
|
title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
|
|
1680
1471
|
enterDelay: 1e3,
|
|
1681
|
-
children: /* @__PURE__ */
|
|
1682
|
-
|
|
1472
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1473
|
+
IconButton2__default.default,
|
|
1683
1474
|
{
|
|
1684
1475
|
"aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
|
|
1685
1476
|
onClick: toggleMode,
|
|
1686
1477
|
sx: {
|
|
1687
1478
|
color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
|
|
1688
1479
|
},
|
|
1689
|
-
children: theme.getColorSchemeSelector ? /* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
|
|
1480
|
+
children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
1481
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1482
|
+
DarkModeIcon__default.default,
|
|
1692
1483
|
{
|
|
1693
1484
|
sx: {
|
|
1694
1485
|
display: "inline",
|
|
@@ -1698,8 +1489,8 @@ function ThemeSwitcher() {
|
|
|
1698
1489
|
}
|
|
1699
1490
|
}
|
|
1700
1491
|
),
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
|
|
1492
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1493
|
+
LightModeIcon__default.default,
|
|
1703
1494
|
{
|
|
1704
1495
|
sx: {
|
|
1705
1496
|
display: "none",
|
|
@@ -1709,25 +1500,19 @@ function ThemeSwitcher() {
|
|
|
1709
1500
|
}
|
|
1710
1501
|
}
|
|
1711
1502
|
)
|
|
1712
|
-
] }) : /* @__PURE__ */
|
|
1503
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(React26__namespace.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsxRuntime.jsx(DarkModeIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(LightModeIcon__default.default, {}) })
|
|
1713
1504
|
}
|
|
1714
1505
|
) })
|
|
1715
1506
|
}
|
|
1716
1507
|
) : null;
|
|
1717
1508
|
}
|
|
1718
|
-
|
|
1719
|
-
// src/toolpad-core/DashboardLayout/ToolbarActions.tsx
|
|
1720
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1721
1509
|
function ToolbarActions() {
|
|
1722
|
-
return /* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1510
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
|
|
1511
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, {}),
|
|
1512
|
+
/* @__PURE__ */ jsxRuntime.jsx(Account, {})
|
|
1725
1513
|
] });
|
|
1726
1514
|
}
|
|
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 }) => {
|
|
1515
|
+
var AppBar = styles.styled(MuiAppBar__default.default)(({ theme }) => {
|
|
1731
1516
|
var _a;
|
|
1732
1517
|
return {
|
|
1733
1518
|
borderWidth: 0,
|
|
@@ -1748,26 +1533,26 @@ function DashboardHeader(props) {
|
|
|
1748
1533
|
slots,
|
|
1749
1534
|
slotProps
|
|
1750
1535
|
} = props;
|
|
1751
|
-
const brandingContext =
|
|
1536
|
+
const brandingContext = React26__namespace.useContext(BrandingContext);
|
|
1752
1537
|
const branding = __spreadValues(__spreadValues({}, brandingContext), brandingProp);
|
|
1753
|
-
const handleMenuOpen =
|
|
1538
|
+
const handleMenuOpen = React26__namespace.useCallback(() => {
|
|
1754
1539
|
onToggleMenu(!menuOpen);
|
|
1755
1540
|
}, [menuOpen, onToggleMenu]);
|
|
1756
|
-
const getMenuIcon =
|
|
1541
|
+
const getMenuIcon = React26__namespace.useCallback(
|
|
1757
1542
|
(isExpanded) => {
|
|
1758
1543
|
const expandMenuActionText = "Expand";
|
|
1759
1544
|
const collapseMenuActionText = "Collapse";
|
|
1760
|
-
return /* @__PURE__ */
|
|
1761
|
-
|
|
1545
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1546
|
+
Tooltip__default.default,
|
|
1762
1547
|
{
|
|
1763
1548
|
title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
|
|
1764
1549
|
enterDelay: 1e3,
|
|
1765
|
-
children: /* @__PURE__ */
|
|
1766
|
-
|
|
1550
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1551
|
+
IconButton2__default.default,
|
|
1767
1552
|
{
|
|
1768
1553
|
"aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
|
|
1769
1554
|
onClick: handleMenuOpen,
|
|
1770
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1555
|
+
children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(MenuOpenIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(MenuIcon__default.default, {})
|
|
1771
1556
|
}
|
|
1772
1557
|
) })
|
|
1773
1558
|
}
|
|
@@ -1777,8 +1562,8 @@ function DashboardHeader(props) {
|
|
|
1777
1562
|
);
|
|
1778
1563
|
const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
|
|
1779
1564
|
const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
|
|
1780
|
-
return /* @__PURE__ */
|
|
1781
|
-
|
|
1565
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1566
|
+
Stack__default.default,
|
|
1782
1567
|
{
|
|
1783
1568
|
direction: "row",
|
|
1784
1569
|
justifyContent: "space-between",
|
|
@@ -1788,10 +1573,10 @@ function DashboardHeader(props) {
|
|
|
1788
1573
|
width: "100%"
|
|
1789
1574
|
},
|
|
1790
1575
|
children: [
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
!hideMenuButton ? /* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
|
|
1576
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", children: [
|
|
1577
|
+
!hideMenuButton ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1579
|
+
Box4__default.default,
|
|
1795
1580
|
{
|
|
1796
1581
|
sx: {
|
|
1797
1582
|
display: { xs: "block", md: "none" },
|
|
@@ -1800,8 +1585,8 @@ function DashboardHeader(props) {
|
|
|
1800
1585
|
children: getMenuIcon(menuOpen)
|
|
1801
1586
|
}
|
|
1802
1587
|
),
|
|
1803
|
-
/* @__PURE__ */
|
|
1804
|
-
|
|
1588
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1589
|
+
Box4__default.default,
|
|
1805
1590
|
{
|
|
1806
1591
|
sx: {
|
|
1807
1592
|
display: { xs: "none", md: "block" },
|
|
@@ -1811,18 +1596,18 @@ function DashboardHeader(props) {
|
|
|
1811
1596
|
}
|
|
1812
1597
|
)
|
|
1813
1598
|
] }) : null,
|
|
1814
|
-
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */
|
|
1599
|
+
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsxRuntime.jsx(slots.appTitle, __spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
|
|
1815
1600
|
/* Hierarchy of application of `branding`
|
|
1816
1601
|
* 1. Branding prop passed in the `slotProps.appTitle`
|
|
1817
1602
|
* 2. Branding prop passed to the `DashboardLayout`
|
|
1818
1603
|
* 3. Branding prop passed to the `AppProvider`
|
|
1819
1604
|
*/
|
|
1820
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ jsxRuntime.jsx(AppTitle, __spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
|
|
1821
1606
|
)
|
|
1822
1607
|
] }),
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
|
|
1609
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarActionsSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
|
|
1610
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarAccountSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
|
|
1826
1611
|
] })
|
|
1827
1612
|
]
|
|
1828
1613
|
}
|
|
@@ -1837,75 +1622,65 @@ DashboardHeader.propTypes = {
|
|
|
1837
1622
|
* Branding options for the header.
|
|
1838
1623
|
* @default null
|
|
1839
1624
|
*/
|
|
1840
|
-
branding:
|
|
1841
|
-
homeUrl:
|
|
1842
|
-
logo:
|
|
1843
|
-
title:
|
|
1625
|
+
branding: PropTypes11__default.default.shape({
|
|
1626
|
+
homeUrl: PropTypes11__default.default.string,
|
|
1627
|
+
logo: PropTypes11__default.default.node,
|
|
1628
|
+
title: PropTypes11__default.default.string
|
|
1844
1629
|
}),
|
|
1845
1630
|
/**
|
|
1846
1631
|
* Whether the menu icon should always be hidden.
|
|
1847
1632
|
* @default false
|
|
1848
1633
|
*/
|
|
1849
|
-
hideMenuButton:
|
|
1634
|
+
hideMenuButton: PropTypes11__default.default.bool,
|
|
1850
1635
|
/**
|
|
1851
1636
|
* If `true`, show menu button as if menu is expanded, otherwise show it as if menu is collapsed.
|
|
1852
1637
|
*/
|
|
1853
|
-
menuOpen:
|
|
1638
|
+
menuOpen: PropTypes11__default.default.bool.isRequired,
|
|
1854
1639
|
/**
|
|
1855
1640
|
* Callback fired when the menu button is clicked.
|
|
1856
1641
|
*/
|
|
1857
|
-
onToggleMenu:
|
|
1642
|
+
onToggleMenu: PropTypes11__default.default.func.isRequired,
|
|
1858
1643
|
/**
|
|
1859
1644
|
* The props used for each slot inside.
|
|
1860
1645
|
* @default {}
|
|
1861
1646
|
*/
|
|
1862
|
-
slotProps:
|
|
1863
|
-
appTitle:
|
|
1864
|
-
branding:
|
|
1865
|
-
homeUrl:
|
|
1866
|
-
logo:
|
|
1867
|
-
title:
|
|
1647
|
+
slotProps: PropTypes11__default.default.shape({
|
|
1648
|
+
appTitle: PropTypes11__default.default.shape({
|
|
1649
|
+
branding: PropTypes11__default.default.shape({
|
|
1650
|
+
homeUrl: PropTypes11__default.default.string,
|
|
1651
|
+
logo: PropTypes11__default.default.node,
|
|
1652
|
+
title: PropTypes11__default.default.string
|
|
1868
1653
|
})
|
|
1869
1654
|
}),
|
|
1870
|
-
toolbarAccount:
|
|
1871
|
-
localeText:
|
|
1872
|
-
slotProps:
|
|
1873
|
-
popover:
|
|
1874
|
-
popoverContent:
|
|
1875
|
-
preview:
|
|
1876
|
-
signInButton:
|
|
1877
|
-
signOutButton:
|
|
1655
|
+
toolbarAccount: PropTypes11__default.default.shape({
|
|
1656
|
+
localeText: PropTypes11__default.default.object,
|
|
1657
|
+
slotProps: PropTypes11__default.default.shape({
|
|
1658
|
+
popover: PropTypes11__default.default.object,
|
|
1659
|
+
popoverContent: PropTypes11__default.default.object,
|
|
1660
|
+
preview: PropTypes11__default.default.object,
|
|
1661
|
+
signInButton: PropTypes11__default.default.object,
|
|
1662
|
+
signOutButton: PropTypes11__default.default.object
|
|
1878
1663
|
}),
|
|
1879
|
-
slots:
|
|
1880
|
-
popover:
|
|
1881
|
-
popoverContent:
|
|
1882
|
-
preview:
|
|
1883
|
-
signInButton:
|
|
1884
|
-
signOutButton:
|
|
1664
|
+
slots: PropTypes11__default.default.shape({
|
|
1665
|
+
popover: PropTypes11__default.default.elementType,
|
|
1666
|
+
popoverContent: PropTypes11__default.default.elementType,
|
|
1667
|
+
preview: PropTypes11__default.default.elementType,
|
|
1668
|
+
signInButton: PropTypes11__default.default.elementType,
|
|
1669
|
+
signOutButton: PropTypes11__default.default.elementType
|
|
1885
1670
|
})
|
|
1886
1671
|
}),
|
|
1887
|
-
toolbarActions:
|
|
1672
|
+
toolbarActions: PropTypes11__default.default.object
|
|
1888
1673
|
}),
|
|
1889
1674
|
/**
|
|
1890
1675
|
* The components used for each slot inside.
|
|
1891
1676
|
* @default {}
|
|
1892
1677
|
*/
|
|
1893
|
-
slots:
|
|
1894
|
-
appTitle:
|
|
1895
|
-
toolbarAccount:
|
|
1896
|
-
toolbarActions:
|
|
1678
|
+
slots: PropTypes11__default.default.shape({
|
|
1679
|
+
appTitle: PropTypes11__default.default.elementType,
|
|
1680
|
+
toolbarAccount: PropTypes11__default.default.elementType,
|
|
1681
|
+
toolbarActions: PropTypes11__default.default.elementType
|
|
1897
1682
|
})
|
|
1898
1683
|
};
|
|
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
1684
|
var getItemKind = (item) => {
|
|
1910
1685
|
var _a;
|
|
1911
1686
|
return (_a = item.kind) != null ? _a : "page";
|
|
@@ -1953,7 +1728,7 @@ function buildItemLookup(navigation) {
|
|
|
1953
1728
|
map.set(path, item);
|
|
1954
1729
|
if (item.pattern) {
|
|
1955
1730
|
const basePath = item.segment ? path.slice(0, -item.segment.length) : path;
|
|
1956
|
-
map.set(
|
|
1731
|
+
map.set(pathToRegexp.pathToRegexp(basePath + item.pattern).regexp, item);
|
|
1957
1732
|
}
|
|
1958
1733
|
if (item.children) {
|
|
1959
1734
|
for (const child of item.children) {
|
|
@@ -1991,7 +1766,7 @@ function matchPath(navigation, path) {
|
|
|
1991
1766
|
function getItemPath(navigation, item) {
|
|
1992
1767
|
const map = getItemToPathMap(navigation);
|
|
1993
1768
|
const path = map.get(item);
|
|
1994
|
-
|
|
1769
|
+
invariant2__default.default(path, `Item not found in navigation: ${item.title}`);
|
|
1995
1770
|
return path;
|
|
1996
1771
|
}
|
|
1997
1772
|
function hasSelectedNavigationChildren(navigation, item, activePagePath) {
|
|
@@ -2023,17 +1798,14 @@ function getDrawerWidthTransitionMixin(isExpanded) {
|
|
|
2023
1798
|
overflowX: "hidden"
|
|
2024
1799
|
});
|
|
2025
1800
|
}
|
|
2026
|
-
|
|
2027
|
-
// src/toolpad-core/useActivePage/useActivePage.ts
|
|
2028
|
-
var React23 = __toESM(require("react"));
|
|
2029
1801
|
function useActivePage() {
|
|
2030
1802
|
var _a;
|
|
2031
|
-
const navigationContext =
|
|
2032
|
-
const routerContext =
|
|
1803
|
+
const navigationContext = React26__namespace.useContext(NavigationContext);
|
|
1804
|
+
const routerContext = React26__namespace.useContext(RouterContext);
|
|
2033
1805
|
const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
|
|
2034
1806
|
const activeItem = matchPath(navigationContext, pathname);
|
|
2035
1807
|
const rootItem = matchPath(navigationContext, "/");
|
|
2036
|
-
return
|
|
1808
|
+
return React26__namespace.useMemo(() => {
|
|
2037
1809
|
if (!activeItem) {
|
|
2038
1810
|
return null;
|
|
2039
1811
|
}
|
|
@@ -2070,29 +1842,9 @@ function useActivePage() {
|
|
|
2070
1842
|
}, [activeItem, rootItem, pathname, navigationContext]);
|
|
2071
1843
|
}
|
|
2072
1844
|
|
|
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
1845
|
// src/toolpad-core/DashboardLayout/shared.ts
|
|
2091
1846
|
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 }) => {
|
|
1847
|
+
var NavigationListItemButton = material.styled(ListItemButton__default.default)(({ theme }) => {
|
|
2096
1848
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2097
1849
|
return {
|
|
2098
1850
|
borderRadius: 8,
|
|
@@ -2124,9 +1876,9 @@ var NavigationListItemButton = (0, import_material5.styled)(import_ListItemButto
|
|
|
2124
1876
|
var LIST_ITEM_ICON_SIZE = 34;
|
|
2125
1877
|
function DashboardSidebarPageItem(props) {
|
|
2126
1878
|
var _a;
|
|
2127
|
-
const navigationContext =
|
|
2128
|
-
const pageItemContextProps =
|
|
2129
|
-
|
|
1879
|
+
const navigationContext = React26__namespace.useContext(NavigationContext);
|
|
1880
|
+
const pageItemContextProps = React26__namespace.useContext(DashboardSidebarPageItemContext);
|
|
1881
|
+
invariant2__default.default(pageItemContextProps, "No navigation page item context provided.");
|
|
2130
1882
|
const contextAwareProps = __spreadValues(__spreadValues({}, pageItemContextProps), props);
|
|
2131
1883
|
const {
|
|
2132
1884
|
item,
|
|
@@ -2142,10 +1894,10 @@ function DashboardSidebarPageItem(props) {
|
|
|
2142
1894
|
isSidebarFullyCollapsed = false,
|
|
2143
1895
|
renderNestedNavigation
|
|
2144
1896
|
} = contextAwareProps;
|
|
2145
|
-
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] =
|
|
1897
|
+
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React26__namespace.useState(
|
|
2146
1898
|
null
|
|
2147
1899
|
);
|
|
2148
|
-
const handleClick =
|
|
1900
|
+
const handleClick = React26__namespace.useCallback(() => {
|
|
2149
1901
|
onClick(id, item);
|
|
2150
1902
|
}, [id, item, onClick]);
|
|
2151
1903
|
let nestedNavigationCollapseSx = { display: "none" };
|
|
@@ -2170,8 +1922,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2170
1922
|
const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
|
|
2171
1923
|
const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
|
|
2172
1924
|
const title = getItemTitle(item);
|
|
2173
|
-
const listItem = /* @__PURE__ */
|
|
2174
|
-
|
|
1925
|
+
const listItem = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1926
|
+
ListItem__default.default,
|
|
2175
1927
|
__spreadProps(__spreadValues({}, item.children && isMini ? {
|
|
2176
1928
|
onMouseEnter: () => {
|
|
2177
1929
|
setHoveredMiniSidebarItemId(id);
|
|
@@ -2186,7 +1938,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
2186
1938
|
overflowX: "hidden"
|
|
2187
1939
|
},
|
|
2188
1940
|
children: [
|
|
2189
|
-
/* @__PURE__ */
|
|
1941
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2190
1942
|
NavigationListItemButton,
|
|
2191
1943
|
__spreadProps(__spreadValues(__spreadValues({
|
|
2192
1944
|
selected,
|
|
@@ -2207,8 +1959,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2207
1959
|
onClick: handleClick
|
|
2208
1960
|
}) : {}), {
|
|
2209
1961
|
children: [
|
|
2210
|
-
item.icon || isMini ? /* @__PURE__ */
|
|
2211
|
-
|
|
1962
|
+
item.icon || isMini ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1963
|
+
Box4__default.default,
|
|
2212
1964
|
{
|
|
2213
1965
|
sx: isMini ? {
|
|
2214
1966
|
position: "absolute",
|
|
@@ -2217,8 +1969,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2217
1969
|
transform: "translate(-50%, -50%)"
|
|
2218
1970
|
} : {},
|
|
2219
1971
|
children: [
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
|
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1973
|
+
ListItemIcon__default.default,
|
|
2222
1974
|
{
|
|
2223
1975
|
sx: {
|
|
2224
1976
|
display: "flex",
|
|
@@ -2228,8 +1980,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2228
1980
|
},
|
|
2229
1981
|
children: [
|
|
2230
1982
|
(_a = item.icon) != null ? _a : null,
|
|
2231
|
-
!item.icon && isMini ? /* @__PURE__ */
|
|
2232
|
-
|
|
1983
|
+
!item.icon && isMini ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1984
|
+
Avatar__default.default,
|
|
2233
1985
|
{
|
|
2234
1986
|
sx: {
|
|
2235
1987
|
width: LIST_ITEM_ICON_SIZE - 7,
|
|
@@ -2242,8 +1994,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2242
1994
|
]
|
|
2243
1995
|
}
|
|
2244
1996
|
),
|
|
2245
|
-
isMini ? /* @__PURE__ */
|
|
2246
|
-
|
|
1997
|
+
isMini ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
Typography__default.default,
|
|
2247
1999
|
{
|
|
2248
2000
|
variant: "caption",
|
|
2249
2001
|
sx: {
|
|
@@ -2265,8 +2017,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2265
2017
|
]
|
|
2266
2018
|
}
|
|
2267
2019
|
) : null,
|
|
2268
|
-
!isMini ? /* @__PURE__ */
|
|
2269
|
-
|
|
2020
|
+
!isMini ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2021
|
+
ListItemText__default.default,
|
|
2270
2022
|
{
|
|
2271
2023
|
primary: title,
|
|
2272
2024
|
sx: {
|
|
@@ -2277,20 +2029,20 @@ function DashboardSidebarPageItem(props) {
|
|
|
2277
2029
|
}
|
|
2278
2030
|
) : null,
|
|
2279
2031
|
item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
|
|
2280
|
-
item.children ? /* @__PURE__ */
|
|
2032
|
+
item.children ? /* @__PURE__ */ jsxRuntime.jsx(ExpandMoreIcon__default.default, { sx: nestedNavigationCollapseSx }) : null
|
|
2281
2033
|
]
|
|
2282
2034
|
})
|
|
2283
2035
|
),
|
|
2284
|
-
item.children && isMini ? /* @__PURE__ */
|
|
2285
|
-
|
|
2036
|
+
item.children && isMini ? /* @__PURE__ */ jsxRuntime.jsx(Grow__default.default, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2037
|
+
Box4__default.default,
|
|
2286
2038
|
{
|
|
2287
2039
|
sx: {
|
|
2288
2040
|
position: "fixed",
|
|
2289
2041
|
left: MINI_DRAWER_WIDTH - 2,
|
|
2290
2042
|
pl: "6px"
|
|
2291
2043
|
},
|
|
2292
|
-
children: /* @__PURE__ */
|
|
2293
|
-
|
|
2044
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2045
|
+
Paper__default.default,
|
|
2294
2046
|
{
|
|
2295
2047
|
sx: {
|
|
2296
2048
|
pt: 0.5,
|
|
@@ -2305,9 +2057,9 @@ function DashboardSidebarPageItem(props) {
|
|
|
2305
2057
|
]
|
|
2306
2058
|
})
|
|
2307
2059
|
);
|
|
2308
|
-
return /* @__PURE__ */
|
|
2060
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
2309
2061
|
listItem,
|
|
2310
|
-
item.children && !isMini ? /* @__PURE__ */
|
|
2062
|
+
item.children && !isMini ? /* @__PURE__ */ jsxRuntime.jsx(Collapse__default.default, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
|
|
2311
2063
|
] }, id);
|
|
2312
2064
|
}
|
|
2313
2065
|
DashboardSidebarPageItem.propTypes = {
|
|
@@ -2319,54 +2071,51 @@ DashboardSidebarPageItem.propTypes = {
|
|
|
2319
2071
|
* If `true`, the item is disabled.
|
|
2320
2072
|
* @default false
|
|
2321
2073
|
*/
|
|
2322
|
-
disabled:
|
|
2074
|
+
disabled: PropTypes11__default.default.bool,
|
|
2323
2075
|
/**
|
|
2324
2076
|
* If `true`, expands any nested navigation in the item, otherwise collapse it.
|
|
2325
2077
|
* @default false
|
|
2326
2078
|
*/
|
|
2327
|
-
expanded:
|
|
2079
|
+
expanded: PropTypes11__default.default.bool,
|
|
2328
2080
|
/**
|
|
2329
2081
|
* Link `href` for when the item is rendered as a link.
|
|
2330
2082
|
* @default getItemPath(navigationContext, item)
|
|
2331
2083
|
*/
|
|
2332
|
-
href:
|
|
2084
|
+
href: PropTypes11__default.default.string,
|
|
2333
2085
|
/**
|
|
2334
2086
|
* Navigation page item definition.
|
|
2335
2087
|
*/
|
|
2336
|
-
item:
|
|
2337
|
-
action:
|
|
2338
|
-
children:
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
kind:
|
|
2343
|
-
title:
|
|
2088
|
+
item: PropTypes11__default.default.shape({
|
|
2089
|
+
action: PropTypes11__default.default.node,
|
|
2090
|
+
children: PropTypes11__default.default.arrayOf(
|
|
2091
|
+
PropTypes11__default.default.oneOfType([
|
|
2092
|
+
PropTypes11__default.default.object,
|
|
2093
|
+
PropTypes11__default.default.shape({
|
|
2094
|
+
kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
|
|
2095
|
+
title: PropTypes11__default.default.string.isRequired
|
|
2344
2096
|
}),
|
|
2345
|
-
|
|
2346
|
-
kind:
|
|
2097
|
+
PropTypes11__default.default.shape({
|
|
2098
|
+
kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
|
|
2347
2099
|
})
|
|
2348
2100
|
]).isRequired
|
|
2349
2101
|
),
|
|
2350
|
-
icon:
|
|
2351
|
-
kind:
|
|
2352
|
-
pattern:
|
|
2353
|
-
segment:
|
|
2354
|
-
title:
|
|
2102
|
+
icon: PropTypes11__default.default.node,
|
|
2103
|
+
kind: PropTypes11__default.default.oneOf(["page"]),
|
|
2104
|
+
pattern: PropTypes11__default.default.string,
|
|
2105
|
+
segment: PropTypes11__default.default.string,
|
|
2106
|
+
title: PropTypes11__default.default.string
|
|
2355
2107
|
}).isRequired,
|
|
2356
2108
|
/**
|
|
2357
2109
|
* The component used to render the item as a link.
|
|
2358
2110
|
* @default Link
|
|
2359
2111
|
*/
|
|
2360
|
-
LinkComponent:
|
|
2112
|
+
LinkComponent: PropTypes11__default.default.elementType,
|
|
2361
2113
|
/**
|
|
2362
2114
|
* Use to apply selected styling.
|
|
2363
2115
|
* @default false
|
|
2364
2116
|
*/
|
|
2365
|
-
selected:
|
|
2117
|
+
selected: PropTypes11__default.default.bool
|
|
2366
2118
|
};
|
|
2367
|
-
|
|
2368
|
-
// src/toolpad-core/DashboardLayout/DashboardSidebarSubNavigation.tsx
|
|
2369
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2370
2119
|
function DashboardSidebarSubNavigationPageItem({
|
|
2371
2120
|
id,
|
|
2372
2121
|
item,
|
|
@@ -2380,11 +2129,11 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2380
2129
|
sidebarExpandedWidth,
|
|
2381
2130
|
renderPageItem
|
|
2382
2131
|
}) {
|
|
2383
|
-
const navigationContext =
|
|
2132
|
+
const navigationContext = React26__namespace.useContext(NavigationContext);
|
|
2384
2133
|
const activePage = useActivePage();
|
|
2385
2134
|
const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
|
|
2386
2135
|
const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
|
|
2387
|
-
const pageItemContextProps =
|
|
2136
|
+
const pageItemContextProps = React26__namespace.useMemo(
|
|
2388
2137
|
() => ({
|
|
2389
2138
|
expanded: isExpanded,
|
|
2390
2139
|
selected: isSelected,
|
|
@@ -2395,7 +2144,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2395
2144
|
isSidebarFullyCollapsed: isFullyCollapsed,
|
|
2396
2145
|
renderNestedNavigation: () => {
|
|
2397
2146
|
var _a;
|
|
2398
|
-
return /* @__PURE__ */
|
|
2147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2399
2148
|
DashboardSidebarSubNavigation,
|
|
2400
2149
|
{
|
|
2401
2150
|
subNavigation: (_a = item.children) != null ? _a : [],
|
|
@@ -2421,7 +2170,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2421
2170
|
sidebarExpandedWidth
|
|
2422
2171
|
]
|
|
2423
2172
|
);
|
|
2424
|
-
return /* @__PURE__ */
|
|
2173
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsxRuntime.jsx(DashboardSidebarPageItem, { item }) });
|
|
2425
2174
|
}
|
|
2426
2175
|
function DashboardSidebarSubNavigation({
|
|
2427
2176
|
subNavigation,
|
|
@@ -2435,9 +2184,9 @@ function DashboardSidebarSubNavigation({
|
|
|
2435
2184
|
sidebarExpandedWidth,
|
|
2436
2185
|
renderPageItem
|
|
2437
2186
|
}) {
|
|
2438
|
-
const navigationContext =
|
|
2187
|
+
const navigationContext = React26__namespace.useContext(NavigationContext);
|
|
2439
2188
|
const activePage = useActivePage();
|
|
2440
|
-
const initialExpandedItemIds =
|
|
2189
|
+
const initialExpandedItemIds = React26__namespace.useMemo(
|
|
2441
2190
|
() => subNavigation.map((navigationItem, navigationItemIndex) => ({
|
|
2442
2191
|
navigationItem,
|
|
2443
2192
|
originalIndex: navigationItemIndex
|
|
@@ -2446,8 +2195,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2446
2195
|
).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
|
|
2447
2196
|
[activePage, depth, navigationContext, subNavigation]
|
|
2448
2197
|
);
|
|
2449
|
-
const [expandedItemIds, setExpandedItemIds] =
|
|
2450
|
-
const handlePageItemClick =
|
|
2198
|
+
const [expandedItemIds, setExpandedItemIds] = React26__namespace.useState(initialExpandedItemIds);
|
|
2199
|
+
const handlePageItemClick = React26__namespace.useCallback(
|
|
2451
2200
|
(itemId, item) => {
|
|
2452
2201
|
if (item.children && !isMini) {
|
|
2453
2202
|
setExpandedItemIds(
|
|
@@ -2459,8 +2208,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2459
2208
|
},
|
|
2460
2209
|
[isMini, onLinkClick]
|
|
2461
2210
|
);
|
|
2462
|
-
return /* @__PURE__ */
|
|
2463
|
-
|
|
2211
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2212
|
+
List__default.default,
|
|
2464
2213
|
{
|
|
2465
2214
|
sx: {
|
|
2466
2215
|
padding: 0,
|
|
@@ -2472,8 +2221,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2472
2221
|
},
|
|
2473
2222
|
children: subNavigation.map((navigationItem, navigationItemIndex) => {
|
|
2474
2223
|
if (navigationItem.kind === "header") {
|
|
2475
|
-
return /* @__PURE__ */
|
|
2476
|
-
|
|
2224
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2225
|
+
ListSubheader__default.default,
|
|
2477
2226
|
{
|
|
2478
2227
|
sx: __spreadProps(__spreadValues({
|
|
2479
2228
|
fontSize: 12,
|
|
@@ -2494,8 +2243,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2494
2243
|
}
|
|
2495
2244
|
if (navigationItem.kind === "divider") {
|
|
2496
2245
|
const nextItem = subNavigation[navigationItemIndex + 1];
|
|
2497
|
-
return /* @__PURE__ */
|
|
2498
|
-
|
|
2246
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2247
|
+
Divider__default.default,
|
|
2499
2248
|
{
|
|
2500
2249
|
sx: __spreadValues({
|
|
2501
2250
|
borderBottomWidth: 2,
|
|
@@ -2507,7 +2256,7 @@ function DashboardSidebarSubNavigation({
|
|
|
2507
2256
|
) }, `divider-${depth}-${navigationItemIndex}`);
|
|
2508
2257
|
}
|
|
2509
2258
|
const pageItemId = `page-${depth}-${navigationItemIndex}`;
|
|
2510
|
-
return /* @__PURE__ */
|
|
2259
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2511
2260
|
DashboardSidebarSubNavigationPageItem,
|
|
2512
2261
|
{
|
|
2513
2262
|
id: pageItemId,
|
|
@@ -2537,9 +2286,6 @@ function warnOnce(msg) {
|
|
|
2537
2286
|
console.warn(msg);
|
|
2538
2287
|
}
|
|
2539
2288
|
}
|
|
2540
|
-
|
|
2541
|
-
// src/toolpad-core/DashboardLayout/DashboardLayout.tsx
|
|
2542
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2543
2289
|
function DashboardLayout(props) {
|
|
2544
2290
|
var _a, _b;
|
|
2545
2291
|
const {
|
|
@@ -2560,26 +2306,26 @@ function DashboardLayout(props) {
|
|
|
2560
2306
|
"The navigation prop in the DashboardLayout component is deprecated and will eventually be removed. Set the navigation prop in the AppProvider instead (https://mui.com/toolpad/core/react-app-provider/#navigation)."
|
|
2561
2307
|
);
|
|
2562
2308
|
}
|
|
2563
|
-
const theme =
|
|
2564
|
-
const navigationContext =
|
|
2565
|
-
const appWindowContext =
|
|
2309
|
+
const theme = styles.useTheme();
|
|
2310
|
+
const navigationContext = React26__namespace.useContext(NavigationContext);
|
|
2311
|
+
const appWindowContext = React26__namespace.useContext(WindowContext);
|
|
2566
2312
|
const navigation = navigationProp != null ? navigationProp : navigationContext;
|
|
2567
|
-
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] =
|
|
2568
|
-
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] =
|
|
2569
|
-
const isOverSmViewport =
|
|
2313
|
+
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React26__namespace.useState(!defaultSidebarCollapsed);
|
|
2314
|
+
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React26__namespace.useState(false);
|
|
2315
|
+
const isOverSmViewport = useMediaQuery2__default.default(
|
|
2570
2316
|
theme.breakpoints.up("sm"),
|
|
2571
2317
|
appWindowContext && {
|
|
2572
2318
|
matchMedia: appWindowContext.matchMedia
|
|
2573
2319
|
}
|
|
2574
2320
|
);
|
|
2575
|
-
const isOverMdViewport =
|
|
2321
|
+
const isOverMdViewport = useMediaQuery2__default.default(
|
|
2576
2322
|
theme.breakpoints.up("md"),
|
|
2577
2323
|
appWindowContext && {
|
|
2578
2324
|
matchMedia: appWindowContext.matchMedia
|
|
2579
2325
|
}
|
|
2580
2326
|
);
|
|
2581
2327
|
const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
|
|
2582
|
-
const setIsNavigationExpanded =
|
|
2328
|
+
const setIsNavigationExpanded = React26__namespace.useCallback(
|
|
2583
2329
|
(newExpanded) => {
|
|
2584
2330
|
if (isOverMdViewport) {
|
|
2585
2331
|
setIsDesktopNavigationExpanded(newExpanded);
|
|
@@ -2589,9 +2335,9 @@ function DashboardLayout(props) {
|
|
|
2589
2335
|
},
|
|
2590
2336
|
[isOverMdViewport]
|
|
2591
2337
|
);
|
|
2592
|
-
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] =
|
|
2593
|
-
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] =
|
|
2594
|
-
|
|
2338
|
+
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React26__namespace.useState(isNavigationExpanded);
|
|
2339
|
+
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React26__namespace.useState(!isNavigationExpanded);
|
|
2340
|
+
React26__namespace.useEffect(() => {
|
|
2595
2341
|
if (isNavigationExpanded) {
|
|
2596
2342
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
2597
2343
|
setIsNavigationFullyExpanded(true);
|
|
@@ -2602,7 +2348,7 @@ function DashboardLayout(props) {
|
|
|
2602
2348
|
return () => {
|
|
2603
2349
|
};
|
|
2604
2350
|
}, [isNavigationExpanded, theme]);
|
|
2605
|
-
|
|
2351
|
+
React26__namespace.useEffect(() => {
|
|
2606
2352
|
if (!isNavigationExpanded) {
|
|
2607
2353
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
2608
2354
|
setIsNavigationFullyCollapsed(true);
|
|
@@ -2613,19 +2359,19 @@ function DashboardLayout(props) {
|
|
|
2613
2359
|
return () => {
|
|
2614
2360
|
};
|
|
2615
2361
|
}, [isNavigationExpanded, theme]);
|
|
2616
|
-
const handleSetNavigationExpanded =
|
|
2362
|
+
const handleSetNavigationExpanded = React26__namespace.useCallback(
|
|
2617
2363
|
(newExpanded) => () => {
|
|
2618
2364
|
setIsNavigationExpanded(newExpanded);
|
|
2619
2365
|
},
|
|
2620
2366
|
[setIsNavigationExpanded]
|
|
2621
2367
|
);
|
|
2622
|
-
const handleToggleHeaderMenu =
|
|
2368
|
+
const handleToggleHeaderMenu = React26__namespace.useCallback(
|
|
2623
2369
|
(isExpanded) => {
|
|
2624
2370
|
setIsNavigationExpanded(isExpanded);
|
|
2625
2371
|
},
|
|
2626
2372
|
[setIsNavigationExpanded]
|
|
2627
2373
|
);
|
|
2628
|
-
const handleNavigationLinkClick =
|
|
2374
|
+
const handleNavigationLinkClick = React26__namespace.useCallback(() => {
|
|
2629
2375
|
setIsMobileNavigationExpanded(false);
|
|
2630
2376
|
}, [setIsMobileNavigationExpanded]);
|
|
2631
2377
|
const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
|
|
@@ -2633,7 +2379,7 @@ function DashboardLayout(props) {
|
|
|
2633
2379
|
const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
|
|
2634
2380
|
const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
|
|
2635
2381
|
const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
|
|
2636
|
-
const headerSlotProps =
|
|
2382
|
+
const headerSlotProps = React26__namespace.useMemo(
|
|
2637
2383
|
() => __spreadValues({
|
|
2638
2384
|
branding,
|
|
2639
2385
|
menuOpen: isNavigationExpanded,
|
|
@@ -2661,13 +2407,13 @@ function DashboardLayout(props) {
|
|
|
2661
2407
|
slots
|
|
2662
2408
|
]
|
|
2663
2409
|
);
|
|
2664
|
-
const getDrawerContent =
|
|
2410
|
+
const getDrawerContent = React26__namespace.useCallback(
|
|
2665
2411
|
(isMini, viewport) => {
|
|
2666
2412
|
var _a2;
|
|
2667
|
-
return /* @__PURE__ */
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
|
|
2413
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
2414
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, {}),
|
|
2415
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2416
|
+
Box4__default.default,
|
|
2671
2417
|
{
|
|
2672
2418
|
component: "nav",
|
|
2673
2419
|
"aria-label": `${viewport.charAt(0).toUpperCase()}${viewport.slice(1)}`,
|
|
@@ -2682,7 +2428,7 @@ function DashboardLayout(props) {
|
|
|
2682
2428
|
pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
|
|
2683
2429
|
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
|
|
2684
2430
|
children: [
|
|
2685
|
-
/* @__PURE__ */
|
|
2431
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2686
2432
|
DashboardSidebarSubNavigation,
|
|
2687
2433
|
{
|
|
2688
2434
|
subNavigation: navigation,
|
|
@@ -2695,7 +2441,7 @@ function DashboardLayout(props) {
|
|
|
2695
2441
|
renderPageItem
|
|
2696
2442
|
}
|
|
2697
2443
|
),
|
|
2698
|
-
SidebarFooterSlot ? /* @__PURE__ */
|
|
2444
|
+
SidebarFooterSlot ? /* @__PURE__ */ jsxRuntime.jsx(SidebarFooterSlot, __spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
|
|
2699
2445
|
]
|
|
2700
2446
|
}
|
|
2701
2447
|
)
|
|
@@ -2713,7 +2459,7 @@ function DashboardLayout(props) {
|
|
|
2713
2459
|
slotProps == null ? void 0 : slotProps.sidebarFooter
|
|
2714
2460
|
]
|
|
2715
2461
|
);
|
|
2716
|
-
const getDrawerSharedSx =
|
|
2462
|
+
const getDrawerSharedSx = React26__namespace.useCallback(
|
|
2717
2463
|
(isMini, isTemporary) => {
|
|
2718
2464
|
const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
|
|
2719
2465
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
@@ -2731,8 +2477,8 @@ function DashboardLayout(props) {
|
|
|
2731
2477
|
},
|
|
2732
2478
|
[isNavigationExpanded, sidebarExpandedWidth]
|
|
2733
2479
|
);
|
|
2734
|
-
return /* @__PURE__ */
|
|
2735
|
-
|
|
2480
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2481
|
+
Box4__default.default,
|
|
2736
2482
|
{
|
|
2737
2483
|
sx: __spreadValues({
|
|
2738
2484
|
position: "relative",
|
|
@@ -2742,10 +2488,10 @@ function DashboardLayout(props) {
|
|
|
2742
2488
|
width: "100vw"
|
|
2743
2489
|
}, sx),
|
|
2744
2490
|
children: [
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
!hideNavigation ? /* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
|
|
2491
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderSlot, __spreadValues({}, headerSlotProps)),
|
|
2492
|
+
!hideNavigation ? /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
2493
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2494
|
+
Drawer__default.default,
|
|
2749
2495
|
{
|
|
2750
2496
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
2751
2497
|
variant: "temporary",
|
|
@@ -2765,8 +2511,8 @@ function DashboardLayout(props) {
|
|
|
2765
2511
|
children: getDrawerContent(false, "phone")
|
|
2766
2512
|
}
|
|
2767
2513
|
),
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
|
|
2514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
|
+
Drawer__default.default,
|
|
2770
2516
|
{
|
|
2771
2517
|
variant: "permanent",
|
|
2772
2518
|
sx: __spreadValues({
|
|
@@ -2779,8 +2525,8 @@ function DashboardLayout(props) {
|
|
|
2779
2525
|
children: getDrawerContent(isMobileMini, "tablet")
|
|
2780
2526
|
}
|
|
2781
2527
|
),
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
|
|
2528
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2529
|
+
Drawer__default.default,
|
|
2784
2530
|
{
|
|
2785
2531
|
variant: "permanent",
|
|
2786
2532
|
sx: __spreadValues({
|
|
@@ -2790,8 +2536,8 @@ function DashboardLayout(props) {
|
|
|
2790
2536
|
}
|
|
2791
2537
|
)
|
|
2792
2538
|
] }) : null,
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
|
|
2539
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2540
|
+
Box4__default.default,
|
|
2795
2541
|
{
|
|
2796
2542
|
sx: {
|
|
2797
2543
|
display: "flex",
|
|
@@ -2800,9 +2546,9 @@ function DashboardLayout(props) {
|
|
|
2800
2546
|
minWidth: 0
|
|
2801
2547
|
},
|
|
2802
2548
|
children: [
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
|
|
2549
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { displayPrint: "none" } }),
|
|
2550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2551
|
+
Box4__default.default,
|
|
2806
2552
|
{
|
|
2807
2553
|
component: "main",
|
|
2808
2554
|
sx: {
|
|
@@ -2830,63 +2576,63 @@ DashboardLayout.propTypes = {
|
|
|
2830
2576
|
* Branding options for the dashboard.
|
|
2831
2577
|
* @default null
|
|
2832
2578
|
*/
|
|
2833
|
-
branding:
|
|
2834
|
-
homeUrl:
|
|
2835
|
-
logo:
|
|
2836
|
-
title:
|
|
2579
|
+
branding: PropTypes11__default.default.shape({
|
|
2580
|
+
homeUrl: PropTypes11__default.default.string,
|
|
2581
|
+
logo: PropTypes11__default.default.node,
|
|
2582
|
+
title: PropTypes11__default.default.string
|
|
2837
2583
|
}),
|
|
2838
2584
|
/**
|
|
2839
2585
|
* The content of the dashboard.
|
|
2840
2586
|
*/
|
|
2841
|
-
children:
|
|
2587
|
+
children: PropTypes11__default.default.node,
|
|
2842
2588
|
/**
|
|
2843
2589
|
* Whether the sidebar should start collapsed in desktop size screens.
|
|
2844
2590
|
* @default false
|
|
2845
2591
|
*/
|
|
2846
|
-
defaultSidebarCollapsed:
|
|
2592
|
+
defaultSidebarCollapsed: PropTypes11__default.default.bool,
|
|
2847
2593
|
/**
|
|
2848
2594
|
* Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
|
|
2849
2595
|
* @default false
|
|
2850
2596
|
*/
|
|
2851
|
-
disableCollapsibleSidebar:
|
|
2597
|
+
disableCollapsibleSidebar: PropTypes11__default.default.bool,
|
|
2852
2598
|
/**
|
|
2853
2599
|
* Whether the navigation bar and menu icon should be hidden.
|
|
2854
2600
|
* @default false
|
|
2855
2601
|
*/
|
|
2856
|
-
hideNavigation:
|
|
2602
|
+
hideNavigation: PropTypes11__default.default.bool,
|
|
2857
2603
|
/**
|
|
2858
2604
|
* Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
|
|
2859
2605
|
* @default []
|
|
2860
2606
|
* @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
|
|
2861
2607
|
*/
|
|
2862
|
-
navigation:
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
action:
|
|
2866
|
-
children:
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
kind:
|
|
2871
|
-
title:
|
|
2608
|
+
navigation: PropTypes11__default.default.arrayOf(
|
|
2609
|
+
PropTypes11__default.default.oneOfType([
|
|
2610
|
+
PropTypes11__default.default.shape({
|
|
2611
|
+
action: PropTypes11__default.default.node,
|
|
2612
|
+
children: PropTypes11__default.default.arrayOf(
|
|
2613
|
+
PropTypes11__default.default.oneOfType([
|
|
2614
|
+
PropTypes11__default.default.object,
|
|
2615
|
+
PropTypes11__default.default.shape({
|
|
2616
|
+
kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
|
|
2617
|
+
title: PropTypes11__default.default.string.isRequired
|
|
2872
2618
|
}),
|
|
2873
|
-
|
|
2874
|
-
kind:
|
|
2619
|
+
PropTypes11__default.default.shape({
|
|
2620
|
+
kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
|
|
2875
2621
|
})
|
|
2876
2622
|
]).isRequired
|
|
2877
2623
|
),
|
|
2878
|
-
icon:
|
|
2879
|
-
kind:
|
|
2880
|
-
pattern:
|
|
2881
|
-
segment:
|
|
2882
|
-
title:
|
|
2624
|
+
icon: PropTypes11__default.default.node,
|
|
2625
|
+
kind: PropTypes11__default.default.oneOf(["page"]),
|
|
2626
|
+
pattern: PropTypes11__default.default.string,
|
|
2627
|
+
segment: PropTypes11__default.default.string,
|
|
2628
|
+
title: PropTypes11__default.default.string
|
|
2883
2629
|
}),
|
|
2884
|
-
|
|
2885
|
-
kind:
|
|
2886
|
-
title:
|
|
2630
|
+
PropTypes11__default.default.shape({
|
|
2631
|
+
kind: PropTypes11__default.default.oneOf(["header"]).isRequired,
|
|
2632
|
+
title: PropTypes11__default.default.string.isRequired
|
|
2887
2633
|
}),
|
|
2888
|
-
|
|
2889
|
-
kind:
|
|
2634
|
+
PropTypes11__default.default.shape({
|
|
2635
|
+
kind: PropTypes11__default.default.oneOf(["divider"]).isRequired
|
|
2890
2636
|
})
|
|
2891
2637
|
]).isRequired
|
|
2892
2638
|
),
|
|
@@ -2897,107 +2643,87 @@ DashboardLayout.propTypes = {
|
|
|
2897
2643
|
* @param {{ mini: boolean }} params
|
|
2898
2644
|
* @returns {ReactNode}
|
|
2899
2645
|
*/
|
|
2900
|
-
renderPageItem:
|
|
2646
|
+
renderPageItem: PropTypes11__default.default.func,
|
|
2901
2647
|
/**
|
|
2902
2648
|
* Width of the sidebar when expanded.
|
|
2903
2649
|
* @default 320
|
|
2904
2650
|
*/
|
|
2905
|
-
sidebarExpandedWidth:
|
|
2651
|
+
sidebarExpandedWidth: PropTypes11__default.default.oneOfType([PropTypes11__default.default.number, PropTypes11__default.default.string]),
|
|
2906
2652
|
/**
|
|
2907
2653
|
* The props used for each slot inside.
|
|
2908
2654
|
* @default {}
|
|
2909
2655
|
*/
|
|
2910
|
-
slotProps:
|
|
2911
|
-
appTitle:
|
|
2912
|
-
branding:
|
|
2913
|
-
homeUrl:
|
|
2914
|
-
logo:
|
|
2915
|
-
title:
|
|
2656
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2657
|
+
appTitle: PropTypes11__default.default.shape({
|
|
2658
|
+
branding: PropTypes11__default.default.shape({
|
|
2659
|
+
homeUrl: PropTypes11__default.default.string,
|
|
2660
|
+
logo: PropTypes11__default.default.node,
|
|
2661
|
+
title: PropTypes11__default.default.string
|
|
2916
2662
|
})
|
|
2917
2663
|
}),
|
|
2918
|
-
header:
|
|
2919
|
-
branding:
|
|
2920
|
-
homeUrl:
|
|
2921
|
-
logo:
|
|
2922
|
-
title:
|
|
2664
|
+
header: PropTypes11__default.default.shape({
|
|
2665
|
+
branding: PropTypes11__default.default.shape({
|
|
2666
|
+
homeUrl: PropTypes11__default.default.string,
|
|
2667
|
+
logo: PropTypes11__default.default.node,
|
|
2668
|
+
title: PropTypes11__default.default.string
|
|
2923
2669
|
}),
|
|
2924
|
-
hideMenuButton:
|
|
2925
|
-
menuOpen:
|
|
2926
|
-
onToggleMenu:
|
|
2927
|
-
slotProps:
|
|
2928
|
-
appTitle:
|
|
2929
|
-
toolbarAccount:
|
|
2930
|
-
toolbarActions:
|
|
2670
|
+
hideMenuButton: PropTypes11__default.default.bool,
|
|
2671
|
+
menuOpen: PropTypes11__default.default.bool.isRequired,
|
|
2672
|
+
onToggleMenu: PropTypes11__default.default.func.isRequired,
|
|
2673
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2674
|
+
appTitle: PropTypes11__default.default.object,
|
|
2675
|
+
toolbarAccount: PropTypes11__default.default.object,
|
|
2676
|
+
toolbarActions: PropTypes11__default.default.object
|
|
2931
2677
|
}),
|
|
2932
|
-
slots:
|
|
2933
|
-
appTitle:
|
|
2934
|
-
toolbarAccount:
|
|
2935
|
-
toolbarActions:
|
|
2678
|
+
slots: PropTypes11__default.default.shape({
|
|
2679
|
+
appTitle: PropTypes11__default.default.elementType,
|
|
2680
|
+
toolbarAccount: PropTypes11__default.default.elementType,
|
|
2681
|
+
toolbarActions: PropTypes11__default.default.elementType
|
|
2936
2682
|
})
|
|
2937
2683
|
}),
|
|
2938
|
-
sidebarFooter:
|
|
2939
|
-
mini:
|
|
2684
|
+
sidebarFooter: PropTypes11__default.default.shape({
|
|
2685
|
+
mini: PropTypes11__default.default.bool.isRequired
|
|
2940
2686
|
}),
|
|
2941
|
-
toolbarAccount:
|
|
2942
|
-
localeText:
|
|
2943
|
-
slotProps:
|
|
2944
|
-
popover:
|
|
2945
|
-
popoverContent:
|
|
2946
|
-
preview:
|
|
2947
|
-
signInButton:
|
|
2948
|
-
signOutButton:
|
|
2687
|
+
toolbarAccount: PropTypes11__default.default.shape({
|
|
2688
|
+
localeText: PropTypes11__default.default.object,
|
|
2689
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2690
|
+
popover: PropTypes11__default.default.object,
|
|
2691
|
+
popoverContent: PropTypes11__default.default.object,
|
|
2692
|
+
preview: PropTypes11__default.default.object,
|
|
2693
|
+
signInButton: PropTypes11__default.default.object,
|
|
2694
|
+
signOutButton: PropTypes11__default.default.object
|
|
2949
2695
|
}),
|
|
2950
|
-
slots:
|
|
2951
|
-
popover:
|
|
2952
|
-
popoverContent:
|
|
2953
|
-
preview:
|
|
2954
|
-
signInButton:
|
|
2955
|
-
signOutButton:
|
|
2696
|
+
slots: PropTypes11__default.default.shape({
|
|
2697
|
+
popover: PropTypes11__default.default.elementType,
|
|
2698
|
+
popoverContent: PropTypes11__default.default.elementType,
|
|
2699
|
+
preview: PropTypes11__default.default.elementType,
|
|
2700
|
+
signInButton: PropTypes11__default.default.elementType,
|
|
2701
|
+
signOutButton: PropTypes11__default.default.elementType
|
|
2956
2702
|
})
|
|
2957
2703
|
}),
|
|
2958
|
-
toolbarActions:
|
|
2704
|
+
toolbarActions: PropTypes11__default.default.object
|
|
2959
2705
|
}),
|
|
2960
2706
|
/**
|
|
2961
2707
|
* The components used for each slot inside.
|
|
2962
2708
|
* @default {}
|
|
2963
2709
|
*/
|
|
2964
|
-
slots:
|
|
2965
|
-
appTitle:
|
|
2966
|
-
header:
|
|
2967
|
-
sidebarFooter:
|
|
2968
|
-
toolbarAccount:
|
|
2969
|
-
toolbarActions:
|
|
2710
|
+
slots: PropTypes11__default.default.shape({
|
|
2711
|
+
appTitle: PropTypes11__default.default.elementType,
|
|
2712
|
+
header: PropTypes11__default.default.elementType,
|
|
2713
|
+
sidebarFooter: PropTypes11__default.default.elementType,
|
|
2714
|
+
toolbarAccount: PropTypes11__default.default.elementType,
|
|
2715
|
+
toolbarActions: PropTypes11__default.default.elementType
|
|
2970
2716
|
}),
|
|
2971
2717
|
/**
|
|
2972
2718
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2973
2719
|
*/
|
|
2974
|
-
sx:
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2720
|
+
sx: PropTypes11__default.default.oneOfType([
|
|
2721
|
+
PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
|
|
2722
|
+
PropTypes11__default.default.func,
|
|
2723
|
+
PropTypes11__default.default.object
|
|
2978
2724
|
])
|
|
2979
2725
|
};
|
|
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 }) => ({
|
|
2726
|
+
var PageHeaderToolbarRoot = material.styled("div")(({ theme }) => ({
|
|
3001
2727
|
display: "flex",
|
|
3002
2728
|
flexDirection: "row",
|
|
3003
2729
|
gap: theme.spacing(1),
|
|
@@ -3005,7 +2731,7 @@ var PageHeaderToolbarRoot = (0, import_material6.styled)("div")(({ theme }) => (
|
|
|
3005
2731
|
marginLeft: "auto"
|
|
3006
2732
|
}));
|
|
3007
2733
|
function PageHeaderToolbar(props) {
|
|
3008
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PageHeaderToolbarRoot, __spreadValues({}, props));
|
|
3009
2735
|
}
|
|
3010
2736
|
PageHeaderToolbar.propTypes = {
|
|
3011
2737
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -3015,12 +2741,9 @@ PageHeaderToolbar.propTypes = {
|
|
|
3015
2741
|
/**
|
|
3016
2742
|
* @ignore
|
|
3017
2743
|
*/
|
|
3018
|
-
children:
|
|
2744
|
+
children: PropTypes11__default.default.node
|
|
3019
2745
|
};
|
|
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 }) => ({
|
|
2746
|
+
var PageContentHeader = material.styled("div")(({ theme }) => ({
|
|
3024
2747
|
display: "flex",
|
|
3025
2748
|
flexDirection: "row",
|
|
3026
2749
|
justifyContent: "space-between",
|
|
@@ -3033,16 +2756,16 @@ function PageHeader(props) {
|
|
|
3033
2756
|
const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
|
|
3034
2757
|
const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
|
|
3035
2758
|
const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
|
|
3036
|
-
const toolbarSlotProps =
|
|
2759
|
+
const toolbarSlotProps = useSlotProps__default.default({
|
|
3037
2760
|
elementType: ToolbarComponent,
|
|
3038
2761
|
ownerState: props,
|
|
3039
2762
|
externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
|
|
3040
2763
|
additionalProps: {}
|
|
3041
2764
|
});
|
|
3042
|
-
return /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
return item.path ? /* @__PURE__ */
|
|
3045
|
-
|
|
2765
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { children: [
|
|
2766
|
+
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumbs__default.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
|
|
2767
|
+
return item.path ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2768
|
+
Link4__default.default,
|
|
3046
2769
|
{
|
|
3047
2770
|
component: Link2,
|
|
3048
2771
|
underline: "hover",
|
|
@@ -3051,11 +2774,11 @@ function PageHeader(props) {
|
|
|
3051
2774
|
children: getItemTitle(item)
|
|
3052
2775
|
},
|
|
3053
2776
|
index
|
|
3054
|
-
) : /* @__PURE__ */
|
|
2777
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { color: "text.primary", children: getItemTitle(item) }, index);
|
|
3055
2778
|
}) : null }),
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
resolvedTitle ? /* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
2779
|
+
/* @__PURE__ */ jsxRuntime.jsxs(PageContentHeader, { children: [
|
|
2780
|
+
resolvedTitle ? /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "h4", children: resolvedTitle }) : null,
|
|
2781
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarComponent, __spreadValues({}, toolbarSlotProps))
|
|
3059
2782
|
] })
|
|
3060
2783
|
] });
|
|
3061
2784
|
}
|
|
@@ -3067,41 +2790,38 @@ PageHeader.propTypes = {
|
|
|
3067
2790
|
/**
|
|
3068
2791
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
3069
2792
|
*/
|
|
3070
|
-
breadcrumbs:
|
|
3071
|
-
|
|
3072
|
-
path:
|
|
3073
|
-
title:
|
|
2793
|
+
breadcrumbs: PropTypes11__default.default.arrayOf(
|
|
2794
|
+
PropTypes11__default.default.shape({
|
|
2795
|
+
path: PropTypes11__default.default.string,
|
|
2796
|
+
title: PropTypes11__default.default.string.isRequired
|
|
3074
2797
|
})
|
|
3075
2798
|
),
|
|
3076
2799
|
/**
|
|
3077
2800
|
* The props used for each slot inside.
|
|
3078
2801
|
*/
|
|
3079
|
-
slotProps:
|
|
3080
|
-
toolbar:
|
|
3081
|
-
children:
|
|
2802
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2803
|
+
toolbar: PropTypes11__default.default.shape({
|
|
2804
|
+
children: PropTypes11__default.default.node
|
|
3082
2805
|
}).isRequired
|
|
3083
2806
|
}),
|
|
3084
2807
|
/**
|
|
3085
2808
|
* The components used for each slot inside.
|
|
3086
2809
|
*/
|
|
3087
|
-
slots:
|
|
3088
|
-
toolbar:
|
|
2810
|
+
slots: PropTypes11__default.default.shape({
|
|
2811
|
+
toolbar: PropTypes11__default.default.elementType
|
|
3089
2812
|
}),
|
|
3090
2813
|
/**
|
|
3091
2814
|
* The title of the page. Leave blank to use the active page title.
|
|
3092
2815
|
*/
|
|
3093
|
-
title:
|
|
2816
|
+
title: PropTypes11__default.default.string
|
|
3094
2817
|
};
|
|
3095
|
-
|
|
3096
|
-
// src/toolpad-core/PageContainer/PageContainer.tsx
|
|
3097
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3098
2818
|
function PageContainer(props) {
|
|
3099
2819
|
var _b;
|
|
3100
2820
|
const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = __objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
|
|
3101
2821
|
const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
|
|
3102
|
-
return /* @__PURE__ */
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
2822
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container__default.default, __spreadProps(__spreadValues({}, rest), { sx: __spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
|
|
2823
|
+
/* @__PURE__ */ jsxRuntime.jsx(PageHeaderSlot, __spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
|
|
2824
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box4__default.default, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
|
|
3105
2825
|
] }) }));
|
|
3106
2826
|
}
|
|
3107
2827
|
PageContainer.propTypes = {
|
|
@@ -3112,160 +2832,121 @@ PageContainer.propTypes = {
|
|
|
3112
2832
|
/**
|
|
3113
2833
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
3114
2834
|
*/
|
|
3115
|
-
breadcrumbs:
|
|
3116
|
-
|
|
3117
|
-
path:
|
|
3118
|
-
title:
|
|
2835
|
+
breadcrumbs: PropTypes11__default.default.arrayOf(
|
|
2836
|
+
PropTypes11__default.default.shape({
|
|
2837
|
+
path: PropTypes11__default.default.string,
|
|
2838
|
+
title: PropTypes11__default.default.string.isRequired
|
|
3119
2839
|
})
|
|
3120
2840
|
),
|
|
3121
2841
|
/**
|
|
3122
2842
|
* @ignore
|
|
3123
2843
|
*/
|
|
3124
|
-
children:
|
|
2844
|
+
children: PropTypes11__default.default.node,
|
|
3125
2845
|
/**
|
|
3126
2846
|
* The props used for each slot inside.
|
|
3127
2847
|
*/
|
|
3128
|
-
slotProps:
|
|
3129
|
-
header:
|
|
3130
|
-
breadcrumbs:
|
|
3131
|
-
|
|
3132
|
-
path:
|
|
3133
|
-
title:
|
|
2848
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2849
|
+
header: PropTypes11__default.default.shape({
|
|
2850
|
+
breadcrumbs: PropTypes11__default.default.arrayOf(
|
|
2851
|
+
PropTypes11__default.default.shape({
|
|
2852
|
+
path: PropTypes11__default.default.string,
|
|
2853
|
+
title: PropTypes11__default.default.string.isRequired
|
|
3134
2854
|
})
|
|
3135
2855
|
),
|
|
3136
|
-
slotProps:
|
|
3137
|
-
toolbar:
|
|
2856
|
+
slotProps: PropTypes11__default.default.shape({
|
|
2857
|
+
toolbar: PropTypes11__default.default.object.isRequired
|
|
3138
2858
|
}),
|
|
3139
|
-
slots:
|
|
3140
|
-
toolbar:
|
|
2859
|
+
slots: PropTypes11__default.default.shape({
|
|
2860
|
+
toolbar: PropTypes11__default.default.elementType
|
|
3141
2861
|
}),
|
|
3142
|
-
title:
|
|
2862
|
+
title: PropTypes11__default.default.string
|
|
3143
2863
|
}).isRequired
|
|
3144
2864
|
}),
|
|
3145
2865
|
/**
|
|
3146
2866
|
* The components used for each slot inside.
|
|
3147
2867
|
*/
|
|
3148
|
-
slots:
|
|
3149
|
-
header:
|
|
2868
|
+
slots: PropTypes11__default.default.shape({
|
|
2869
|
+
header: PropTypes11__default.default.elementType
|
|
3150
2870
|
}),
|
|
3151
2871
|
/**
|
|
3152
2872
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
3153
2873
|
*/
|
|
3154
|
-
sx:
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
2874
|
+
sx: PropTypes11__default.default.oneOfType([
|
|
2875
|
+
PropTypes11__default.default.arrayOf(PropTypes11__default.default.oneOfType([PropTypes11__default.default.func, PropTypes11__default.default.object, PropTypes11__default.default.bool])),
|
|
2876
|
+
PropTypes11__default.default.func,
|
|
2877
|
+
PropTypes11__default.default.object
|
|
3158
2878
|
]),
|
|
3159
2879
|
/**
|
|
3160
2880
|
* The title of the page. Leave blank to use the active page title.
|
|
3161
2881
|
*/
|
|
3162
|
-
title:
|
|
2882
|
+
title: PropTypes11__default.default.string
|
|
3163
2883
|
};
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
2884
|
+
var Link5 = React26__namespace.forwardRef((props, ref) => {
|
|
2885
|
+
const _a = props, { href, history: history2 } = _a, rest = __objRest(_a, ["href", "history"]);
|
|
2886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NextLink__default.default, __spreadValues({ ref, href, replace: history2 === "replace" }, rest));
|
|
2887
|
+
});
|
|
2888
|
+
function NextAppProviderApp(props) {
|
|
2889
|
+
const pathname = navigation_js.usePathname();
|
|
2890
|
+
const searchParams = navigation_js.useSearchParams();
|
|
2891
|
+
const { push, replace } = navigation_js.useRouter();
|
|
2892
|
+
const navigate = React26__namespace.useCallback(
|
|
2893
|
+
(url, { history: history2 = "auto" } = {}) => {
|
|
2894
|
+
if (history2 === "auto" || history2 === "push") {
|
|
2895
|
+
return push(String(url));
|
|
2896
|
+
}
|
|
2897
|
+
if (history2 === "replace") {
|
|
2898
|
+
return replace(String(url));
|
|
2899
|
+
}
|
|
2900
|
+
throw new Error(`Invalid history option: ${history2}`);
|
|
2901
|
+
},
|
|
2902
|
+
[push, replace]
|
|
3178
2903
|
);
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
}
|
|
3186
|
-
|
|
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)]
|
|
2904
|
+
const routerImpl = React26__namespace.useMemo(
|
|
2905
|
+
() => ({
|
|
2906
|
+
pathname,
|
|
2907
|
+
searchParams,
|
|
2908
|
+
navigate,
|
|
2909
|
+
Link: Link5
|
|
2910
|
+
}),
|
|
2911
|
+
[pathname, navigate, searchParams]
|
|
3195
2912
|
);
|
|
3196
|
-
return
|
|
3197
|
-
}
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
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
|
|
3271
|
-
});
|
|
2913
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppProvider, __spreadValues({ router: routerImpl }, props));
|
|
2914
|
+
}
|
|
2915
|
+
function NextAppProvider(props) {
|
|
2916
|
+
const AppProvider2 = NextAppProviderApp;
|
|
2917
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppProvider2, __spreadValues({}, props));
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
exports.Account = Account;
|
|
2921
|
+
exports.AccountPopoverFooter = AccountPopoverFooter;
|
|
2922
|
+
exports.AccountPopoverHeader = AccountPopoverHeader;
|
|
2923
|
+
exports.AccountPreview = AccountPreview;
|
|
2924
|
+
exports.AlertDialog = AlertDialog;
|
|
2925
|
+
exports.AppProvider = AppProvider;
|
|
2926
|
+
exports.AuthenticationContext = AuthenticationContext;
|
|
2927
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
2928
|
+
exports.DashboardHeader = DashboardHeader;
|
|
2929
|
+
exports.DashboardLayout = DashboardLayout;
|
|
2930
|
+
exports.DashboardSidebarPageItem = DashboardSidebarPageItem;
|
|
2931
|
+
exports.DialogsProvider = DialogsProvider;
|
|
2932
|
+
exports.LocalizationContext = LocalizationContext;
|
|
2933
|
+
exports.LocalizationProvider = LocalizationProvider;
|
|
2934
|
+
exports.NextAppProvider = NextAppProvider;
|
|
2935
|
+
exports.NotificationsProvider = NotificationsProvider;
|
|
2936
|
+
exports.PageContainer = PageContainer;
|
|
2937
|
+
exports.PageHeader = PageHeader;
|
|
2938
|
+
exports.PageHeaderToolbar = PageHeaderToolbar;
|
|
2939
|
+
exports.PromptDialog = PromptDialog;
|
|
2940
|
+
exports.SessionContext = SessionContext;
|
|
2941
|
+
exports.SignInButton = SignInButton;
|
|
2942
|
+
exports.SignOutButton = SignOutButton;
|
|
2943
|
+
exports.ThemeSwitcher = ThemeSwitcher;
|
|
2944
|
+
exports.ToolbarActions = ToolbarActions;
|
|
2945
|
+
exports.en = en_default;
|
|
2946
|
+
exports.useActivePage = useActivePage;
|
|
2947
|
+
exports.useDialogs = useDialogs;
|
|
2948
|
+
exports.useLocalStorageState = useLocalStorageState;
|
|
2949
|
+
exports.useLocaleText = useLocaleText;
|
|
2950
|
+
exports.useNotifications = useNotifications;
|
|
2951
|
+
exports.useStorageState = useStorageState;
|
|
2952
|
+
exports.useStorageStateServer = useStorageStateServer;
|