@iowas/toolpad 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppProvider-CIyOzZv_.d.mts +201 -0
- package/dist/AppProvider-CIyOzZv_.d.ts +201 -0
- package/dist/{chunk-6JQJK2JX.mjs → chunk-3JWXE2JW.mjs} +5 -26
- package/dist/chunk-5B2NQDIH.js +145 -0
- package/dist/chunk-BN55HN4U.js +12 -0
- package/dist/chunk-F6JD4MSY.mjs +10 -0
- package/dist/chunk-LUTZBKSG.mjs +636 -0
- package/dist/chunk-PMIWCP25.mjs +4 -19
- package/dist/chunk-SITC3EZQ.js +2225 -0
- package/dist/chunk-SWAF5R4Y.js +686 -0
- package/dist/chunk-VMBNHIHN.js +84 -0
- package/dist/{chunk-IDMYUY7L.mjs → chunk-ZXM3V5SD.mjs} +456 -1325
- package/dist/core.d.mts +4 -198
- package/dist/core.d.ts +4 -198
- package/dist/core.js +126 -3100
- package/dist/core.mjs +4 -69
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +195 -3260
- package/dist/index.mjs +5 -106
- package/dist/nextjs.d.mts +3 -157
- package/dist/nextjs.d.ts +3 -157
- package/dist/nextjs.js +38 -772
- package/dist/nextjs.mjs +15 -747
- package/dist/utils.js +71 -213
- package/dist/utils.mjs +3 -40
- package/package.json +1 -1
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { RouterContext, NotificationsContext, WindowContext, useLocaleText, DialogsContext, AuthenticationContext, SessionContext, PaletteModeContext, BrandingContext, NavigationContext, DashboardSidebarPageItemContext } from './chunk-LUTZBKSG.mjs';
|
|
2
|
+
import { warnOnce } from './chunk-F6JD4MSY.mjs';
|
|
3
|
+
import { __objRest, __spreadProps, __spreadValues, useNonNullableContext } from './chunk-3JWXE2JW.mjs';
|
|
4
|
+
import * as React16 from 'react';
|
|
5
|
+
import PropTypes9 from 'prop-types';
|
|
6
|
+
import Popover from '@mui/material/Popover';
|
|
7
|
+
import Divider from '@mui/material/Divider';
|
|
8
|
+
import Stack from '@mui/material/Stack';
|
|
9
|
+
import Button from '@mui/material/Button';
|
|
10
|
+
import Dialog from '@mui/material/Dialog';
|
|
11
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
12
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
13
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
14
|
+
import TextField from '@mui/material/TextField';
|
|
15
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
16
|
+
import invariant from 'invariant';
|
|
17
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
18
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
19
|
+
import LogoutIcon from '@mui/icons-material/Logout';
|
|
20
|
+
import Avatar from '@mui/material/Avatar';
|
|
21
|
+
import Typography from '@mui/material/Typography';
|
|
22
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
23
|
+
import IconButton from '@mui/material/IconButton';
|
|
24
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
25
|
+
import Box4 from '@mui/material/Box';
|
|
26
|
+
import { styled as styled$1, useTheme as useTheme$1 } from '@mui/material/styles';
|
|
27
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
28
|
+
import Drawer from '@mui/material/Drawer';
|
|
29
|
+
import Toolbar2 from '@mui/material/Toolbar';
|
|
30
|
+
import MuiAppBar from '@mui/material/AppBar';
|
|
31
|
+
import MenuIcon from '@mui/icons-material/Menu';
|
|
32
|
+
import MenuOpenIcon from '@mui/icons-material/MenuOpen';
|
|
33
|
+
import { styled, useTheme } from '@mui/material';
|
|
34
|
+
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
|
35
|
+
import LightModeIcon from '@mui/icons-material/LightMode';
|
|
36
|
+
import List from '@mui/material/List';
|
|
37
|
+
import ListSubheader from '@mui/material/ListSubheader';
|
|
38
|
+
import { pathToRegexp } from 'path-to-regexp';
|
|
39
|
+
import Collapse from '@mui/material/Collapse';
|
|
40
|
+
import Grow from '@mui/material/Grow';
|
|
41
|
+
import ListItem from '@mui/material/ListItem';
|
|
42
|
+
import ListItemButton from '@mui/material/ListItemButton';
|
|
43
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
44
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
45
|
+
import Paper from '@mui/material/Paper';
|
|
46
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
47
|
+
import Container from '@mui/material/Container';
|
|
48
|
+
import Breadcrumbs from '@mui/material/Breadcrumbs';
|
|
49
|
+
import Link4 from '@mui/material/Link';
|
|
50
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
51
|
|
|
9
|
-
// src/toolpad-core/Account/Account.tsx
|
|
10
|
-
import * as React16 from "react";
|
|
11
|
-
import PropTypes8 from "prop-types";
|
|
12
|
-
import Popover from "@mui/material/Popover";
|
|
13
|
-
import Divider from "@mui/material/Divider";
|
|
14
|
-
import Stack3 from "@mui/material/Stack";
|
|
15
|
-
|
|
16
|
-
// src/toolpad-core/Account/SignInButton.tsx
|
|
17
|
-
import * as React13 from "react";
|
|
18
|
-
import PropTypes3 from "prop-types";
|
|
19
|
-
import Button3 from "@mui/material/Button";
|
|
20
|
-
|
|
21
|
-
// src/toolpad-core/AppProvider/AppProvider.tsx
|
|
22
|
-
import * as React11 from "react";
|
|
23
|
-
import PropTypes2 from "prop-types";
|
|
24
|
-
import { createTheme } from "@mui/material/styles";
|
|
25
|
-
|
|
26
|
-
// src/toolpad-core/useNotifications/useNotifications.tsx
|
|
27
|
-
import * as React2 from "react";
|
|
28
|
-
|
|
29
|
-
// src/toolpad-core/useNotifications/NotificationsContext.ts
|
|
30
|
-
import * as React from "react";
|
|
31
|
-
var NotificationsContext = React.createContext(null);
|
|
32
|
-
|
|
33
|
-
// src/toolpad-core/useNotifications/useNotifications.tsx
|
|
34
52
|
var serverNotifications = {
|
|
35
53
|
show: () => {
|
|
36
54
|
throw new Error("Not supported on server side");
|
|
@@ -40,261 +58,20 @@ var serverNotifications = {
|
|
|
40
58
|
}
|
|
41
59
|
};
|
|
42
60
|
function useNotifications() {
|
|
43
|
-
const context =
|
|
61
|
+
const context = React16.useContext(NotificationsContext);
|
|
44
62
|
if (context) {
|
|
45
63
|
return context;
|
|
46
64
|
}
|
|
47
65
|
return serverNotifications;
|
|
48
66
|
}
|
|
49
|
-
|
|
50
|
-
// src/toolpad-core/useNotifications/NotificationsProvider.tsx
|
|
51
|
-
import * as React4 from "react";
|
|
52
|
-
import {
|
|
53
|
-
Alert,
|
|
54
|
-
Badge,
|
|
55
|
-
Button,
|
|
56
|
-
IconButton,
|
|
57
|
-
Snackbar,
|
|
58
|
-
SnackbarContent
|
|
59
|
-
} from "@mui/material";
|
|
60
|
-
import CloseIcon from "@mui/icons-material/Close";
|
|
61
|
-
import useSlotProps from "@mui/utils/useSlotProps";
|
|
62
|
-
|
|
63
|
-
// src/toolpad-core/AppProvider/LocalizationProvider.tsx
|
|
64
|
-
import * as React3 from "react";
|
|
65
|
-
import PropTypes from "prop-types";
|
|
66
|
-
import { useTheme } from "@mui/material/styles";
|
|
67
|
-
|
|
68
|
-
// src/toolpad-core/locales/getLocalization.ts
|
|
69
|
-
var getLocalization = (translations) => {
|
|
70
|
-
return {
|
|
71
|
-
components: {
|
|
72
|
-
MuiLocalizationProvider: {
|
|
73
|
-
defaultProps: {
|
|
74
|
-
localeText: __spreadValues({}, translations)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// src/toolpad-core/locales/en.tsx
|
|
82
|
-
var enLabels = {
|
|
83
|
-
// Account
|
|
84
|
-
accountSignInLabel: "Sign In",
|
|
85
|
-
accountSignOutLabel: "Sign Out",
|
|
86
|
-
// AccountPreview
|
|
87
|
-
accountPreviewTitle: "Account",
|
|
88
|
-
accountPreviewIconButtonLabel: "Current User",
|
|
89
|
-
// SignInPage
|
|
90
|
-
signInTitle: (brandingTitle) => brandingTitle ? `Sign in to ${brandingTitle}` : "Sign in",
|
|
91
|
-
signInSubtitle: "Welcome user, please sign in to continue",
|
|
92
|
-
signInRememberMe: "Remember Me",
|
|
93
|
-
providerSignInTitle: (provider) => `Sign in with ${provider}`,
|
|
94
|
-
// Common authentication labels
|
|
95
|
-
email: "Email",
|
|
96
|
-
password: "Password",
|
|
97
|
-
username: "Username",
|
|
98
|
-
passkey: "Passkey",
|
|
99
|
-
// Common action labels
|
|
100
|
-
save: "Save",
|
|
101
|
-
cancel: "Cancel",
|
|
102
|
-
ok: "Ok",
|
|
103
|
-
or: "Or",
|
|
104
|
-
to: "To",
|
|
105
|
-
with: "With",
|
|
106
|
-
close: "Close",
|
|
107
|
-
delete: "Delete",
|
|
108
|
-
alert: "Alert",
|
|
109
|
-
confirm: "Confirm",
|
|
110
|
-
loading: "Loading...",
|
|
111
|
-
// CRUD
|
|
112
|
-
createNewButtonLabel: "Create new",
|
|
113
|
-
reloadButtonLabel: "Reload data",
|
|
114
|
-
createLabel: "Create",
|
|
115
|
-
createSuccessMessage: "Item created successfully.",
|
|
116
|
-
createErrorMessage: "Failed to create item. Reason:",
|
|
117
|
-
editLabel: "Edit",
|
|
118
|
-
editSuccessMessage: "Item edited successfully.",
|
|
119
|
-
editErrorMessage: "Failed to edit item. Reason:",
|
|
120
|
-
deleteLabel: "Delete",
|
|
121
|
-
deleteConfirmTitle: "Delete item?",
|
|
122
|
-
deleteConfirmMessage: "Do you wish to delete this item?",
|
|
123
|
-
deleteConfirmLabel: "Delete",
|
|
124
|
-
deleteCancelLabel: "Cancel",
|
|
125
|
-
deleteSuccessMessage: "Item deleted successfully.",
|
|
126
|
-
deleteErrorMessage: "Failed to delete item. Reason:",
|
|
127
|
-
deletedItemMessage: "This item has been deleted."
|
|
128
|
-
};
|
|
129
|
-
var en_default = getLocalization(enLabels);
|
|
130
|
-
|
|
131
|
-
// src/toolpad-core/AppProvider/LocalizationProvider.tsx
|
|
132
|
-
import { jsx } from "react/jsx-runtime";
|
|
133
|
-
var LocalizationContext = React3.createContext({});
|
|
134
|
-
var LocalizationProvider = function LocalizationProvider2(props) {
|
|
135
|
-
var _a, _b, _c;
|
|
136
|
-
const { localeText: propsLocaleText, children } = props;
|
|
137
|
-
const theme = useTheme();
|
|
138
|
-
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;
|
|
139
|
-
const defaultLocaleText3 = en_default.components.MuiLocalizationProvider.defaultProps.localeText;
|
|
140
|
-
const localeText = React3.useMemo(
|
|
141
|
-
() => __spreadValues(__spreadValues(__spreadValues({}, defaultLocaleText3), themeLocaleText), propsLocaleText),
|
|
142
|
-
[defaultLocaleText3, themeLocaleText, propsLocaleText]
|
|
143
|
-
);
|
|
144
|
-
return /* @__PURE__ */ jsx(LocalizationContext.Provider, { value: localeText, children });
|
|
145
|
-
};
|
|
146
|
-
LocalizationProvider.propTypes = {
|
|
147
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
148
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
149
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
150
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
151
|
-
/**
|
|
152
|
-
* @ignore
|
|
153
|
-
*/
|
|
154
|
-
children: PropTypes.node,
|
|
155
|
-
/**
|
|
156
|
-
* Locale for components texts
|
|
157
|
-
*/
|
|
158
|
-
localeText: PropTypes.object
|
|
159
|
-
};
|
|
160
|
-
function useLocaleText() {
|
|
161
|
-
return React3.useContext(LocalizationContext);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/toolpad-core/useNotifications/NotificationsProvider.tsx
|
|
165
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
166
|
-
var RootPropsContext = React4.createContext(null);
|
|
167
67
|
var defaultLocaleText = {
|
|
168
|
-
close: "Close"
|
|
169
|
-
};
|
|
170
|
-
function Notification({ notificationKey, open, message, options, badge }) {
|
|
171
|
-
var _a, _b, _c;
|
|
172
|
-
const globalLocaleText = useLocaleText();
|
|
173
|
-
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
174
|
-
const { close } = useNonNullableContext(NotificationsContext);
|
|
175
|
-
const { severity, actionText, onAction, autoHideDuration } = options;
|
|
176
|
-
const handleClose = React4.useCallback(
|
|
177
|
-
(event, reason) => {
|
|
178
|
-
if (reason === "clickaway") {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
close(notificationKey);
|
|
182
|
-
},
|
|
183
|
-
[notificationKey, close]
|
|
184
|
-
);
|
|
185
|
-
const action = /* @__PURE__ */ jsxs(React4.Fragment, { children: [
|
|
186
|
-
onAction ? /* @__PURE__ */ jsx2(Button, { color: "inherit", size: "small", onClick: onAction, children: actionText != null ? actionText : "Action" }) : null,
|
|
187
|
-
/* @__PURE__ */ jsx2(
|
|
188
|
-
IconButton,
|
|
189
|
-
{
|
|
190
|
-
size: "small",
|
|
191
|
-
"aria-label": localeText == null ? void 0 : localeText.close,
|
|
192
|
-
title: localeText == null ? void 0 : localeText.close,
|
|
193
|
-
color: "inherit",
|
|
194
|
-
onClick: handleClose,
|
|
195
|
-
children: /* @__PURE__ */ jsx2(CloseIcon, { fontSize: "small" })
|
|
196
|
-
}
|
|
197
|
-
)
|
|
198
|
-
] });
|
|
199
|
-
const props = React4.useContext(RootPropsContext);
|
|
200
|
-
const SnackbarComponent = (_b = (_a = props == null ? void 0 : props.slots) == null ? void 0 : _a.snackbar) != null ? _b : Snackbar;
|
|
201
|
-
const snackbarSlotProps = useSlotProps({
|
|
202
|
-
elementType: SnackbarComponent,
|
|
203
|
-
ownerState: props,
|
|
204
|
-
externalSlotProps: (_c = props == null ? void 0 : props.slotProps) == null ? void 0 : _c.snackbar,
|
|
205
|
-
additionalProps: {
|
|
206
|
-
open,
|
|
207
|
-
autoHideDuration,
|
|
208
|
-
onClose: handleClose,
|
|
209
|
-
action
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
return /* @__PURE__ */ jsx2(SnackbarComponent, __spreadProps(__spreadValues({}, snackbarSlotProps), { children: /* @__PURE__ */ jsx2(Badge, { badgeContent: badge, color: "primary", sx: { width: "100%" }, children: severity ? /* @__PURE__ */ jsx2(Alert, { severity, sx: { width: "100%" }, action, children: message }) : /* @__PURE__ */ jsx2(SnackbarContent, { message, action }) }) }), notificationKey);
|
|
213
|
-
}
|
|
214
|
-
function Notifications({ state }) {
|
|
215
|
-
var _a;
|
|
216
|
-
const currentNotification = (_a = state.queue[0]) != null ? _a : null;
|
|
217
|
-
return currentNotification ? /* @__PURE__ */ jsx2(
|
|
218
|
-
Notification,
|
|
219
|
-
__spreadProps(__spreadValues({}, currentNotification), {
|
|
220
|
-
badge: state.queue.length > 1 ? String(state.queue.length) : null
|
|
221
|
-
})
|
|
222
|
-
) : null;
|
|
223
|
-
}
|
|
224
|
-
var nextId = 0;
|
|
225
|
-
var generateId = () => {
|
|
226
|
-
const id = nextId;
|
|
227
|
-
nextId += 1;
|
|
228
|
-
return id;
|
|
229
|
-
};
|
|
230
|
-
function NotificationsProvider(props) {
|
|
231
|
-
const { children } = props;
|
|
232
|
-
const [state, setState] = React4.useState({ queue: [] });
|
|
233
|
-
const show = React4.useCallback((message, options = {}) => {
|
|
234
|
-
var _a;
|
|
235
|
-
const notificationKey = (_a = options.key) != null ? _a : `::toolpad-internal::notification::${generateId()}`;
|
|
236
|
-
setState((prev) => {
|
|
237
|
-
if (prev.queue.some((n) => n.notificationKey === notificationKey)) {
|
|
238
|
-
return prev;
|
|
239
|
-
}
|
|
240
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
241
|
-
queue: [...prev.queue, { message, options, notificationKey, open: true }]
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
return notificationKey;
|
|
245
|
-
}, []);
|
|
246
|
-
const close = React4.useCallback((key) => {
|
|
247
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
248
|
-
queue: prev.queue.filter((n) => n.notificationKey !== key)
|
|
249
|
-
}));
|
|
250
|
-
}, []);
|
|
251
|
-
const contextValue = React4.useMemo(() => ({ show, close }), [show, close]);
|
|
252
|
-
return /* @__PURE__ */ jsx2(RootPropsContext.Provider, { value: props, children: /* @__PURE__ */ jsxs(NotificationsContext.Provider, { value: contextValue, children: [
|
|
253
|
-
children,
|
|
254
|
-
/* @__PURE__ */ jsx2(Notifications, { state })
|
|
255
|
-
] }) });
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// src/toolpad-core/useDialogs/useDialogs.tsx
|
|
259
|
-
import Button2 from "@mui/material/Button";
|
|
260
|
-
import Dialog from "@mui/material/Dialog";
|
|
261
|
-
import DialogTitle from "@mui/material/DialogTitle";
|
|
262
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
263
|
-
import DialogActions from "@mui/material/DialogActions";
|
|
264
|
-
import TextField from "@mui/material/TextField";
|
|
265
|
-
import DialogContentText from "@mui/material/DialogContentText";
|
|
266
|
-
import invariant from "invariant";
|
|
267
|
-
import * as React7 from "react";
|
|
268
|
-
import useEventCallback from "@mui/utils/useEventCallback";
|
|
269
|
-
|
|
270
|
-
// src/toolpad-core/useDialogs/DialogsContext.tsx
|
|
271
|
-
import * as React5 from "react";
|
|
272
|
-
var DialogsContext = React5.createContext(null);
|
|
273
|
-
|
|
274
|
-
// src/toolpad-core/shared/context.ts
|
|
275
|
-
import * as React6 from "react";
|
|
276
|
-
var BrandingContext = React6.createContext(null);
|
|
277
|
-
var NavigationContext = React6.createContext([]);
|
|
278
|
-
var PaletteModeContext = React6.createContext({
|
|
279
|
-
paletteMode: "light",
|
|
280
|
-
setPaletteMode: () => {
|
|
281
|
-
},
|
|
282
|
-
isDualTheme: false
|
|
283
|
-
});
|
|
284
|
-
var RouterContext = React6.createContext(null);
|
|
285
|
-
var DashboardSidebarPageItemContext = React6.createContext(null);
|
|
286
|
-
var WindowContext = React6.createContext(void 0);
|
|
287
|
-
|
|
288
|
-
// src/toolpad-core/useDialogs/useDialogs.tsx
|
|
289
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
290
|
-
var defaultLocaleText2 = {
|
|
291
68
|
alert: "Alert",
|
|
292
69
|
confirm: "Confirm",
|
|
293
70
|
cancel: "Cancel",
|
|
294
71
|
ok: "Ok"
|
|
295
72
|
};
|
|
296
73
|
function useDialogLoadingButton(onClose) {
|
|
297
|
-
const [loading, setLoading] =
|
|
74
|
+
const [loading, setLoading] = React16.useState(false);
|
|
298
75
|
const handleClick = async () => {
|
|
299
76
|
try {
|
|
300
77
|
setLoading(true);
|
|
@@ -310,11 +87,11 @@ function useDialogLoadingButton(onClose) {
|
|
|
310
87
|
}
|
|
311
88
|
function AlertDialog({ open, payload, onClose }) {
|
|
312
89
|
var _a, _b;
|
|
313
|
-
const appWindowContext =
|
|
90
|
+
const appWindowContext = React16.useContext(WindowContext);
|
|
314
91
|
const globalLocaleText = useLocaleText();
|
|
315
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
92
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
316
93
|
const okButtonProps = useDialogLoadingButton(() => onClose());
|
|
317
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ jsxs(
|
|
318
95
|
Dialog,
|
|
319
96
|
{
|
|
320
97
|
maxWidth: "xs",
|
|
@@ -323,21 +100,21 @@ function AlertDialog({ open, payload, onClose }) {
|
|
|
323
100
|
onClose: () => onClose(),
|
|
324
101
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
325
102
|
children: [
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.alert }),
|
|
104
|
+
/* @__PURE__ */ jsx(DialogContent, { children: payload.msg }),
|
|
105
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
|
|
329
106
|
]
|
|
330
107
|
}
|
|
331
108
|
);
|
|
332
109
|
}
|
|
333
110
|
function ConfirmDialog({ open, payload, onClose }) {
|
|
334
111
|
var _a, _b, _c;
|
|
335
|
-
const appWindowContext =
|
|
112
|
+
const appWindowContext = React16.useContext(WindowContext);
|
|
336
113
|
const globalLocaleText = useLocaleText();
|
|
337
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
114
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
338
115
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
|
|
339
116
|
const okButtonProps = useDialogLoadingButton(() => onClose(true));
|
|
340
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ jsxs(
|
|
341
118
|
Dialog,
|
|
342
119
|
{
|
|
343
120
|
maxWidth: "xs",
|
|
@@ -346,11 +123,11 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
346
123
|
onClose: () => onClose(false),
|
|
347
124
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
348
125
|
children: [
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
127
|
+
/* @__PURE__ */ jsx(DialogContent, { children: payload.msg }),
|
|
128
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
130
|
+
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
|
|
354
131
|
] })
|
|
355
132
|
]
|
|
356
133
|
}
|
|
@@ -358,14 +135,14 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
358
135
|
}
|
|
359
136
|
function PromptDialog({ open, payload, onClose }) {
|
|
360
137
|
var _a, _b, _c;
|
|
361
|
-
const appWindowContext =
|
|
138
|
+
const appWindowContext = React16.useContext(WindowContext);
|
|
362
139
|
const globalLocaleText = useLocaleText();
|
|
363
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
364
|
-
const [input, setInput] =
|
|
140
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
141
|
+
const [input, setInput] = React16.useState("");
|
|
365
142
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
|
|
366
|
-
const [loading, setLoading] =
|
|
143
|
+
const [loading, setLoading] = React16.useState(false);
|
|
367
144
|
const name = "input";
|
|
368
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
369
146
|
Dialog,
|
|
370
147
|
{
|
|
371
148
|
maxWidth: "xs",
|
|
@@ -390,13 +167,13 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
390
167
|
},
|
|
391
168
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
392
169
|
children: [
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
171
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
172
|
+
/* @__PURE__ */ jsxs(DialogContentText, { children: [
|
|
396
173
|
payload.msg,
|
|
397
174
|
" "
|
|
398
175
|
] }),
|
|
399
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
400
177
|
TextField,
|
|
401
178
|
{
|
|
402
179
|
autoFocus: true,
|
|
@@ -412,9 +189,9 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
412
189
|
}
|
|
413
190
|
)
|
|
414
191
|
] }),
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
193
|
+
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
194
|
+
/* @__PURE__ */ jsx(Button, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
|
|
418
195
|
] })
|
|
419
196
|
]
|
|
420
197
|
}
|
|
@@ -440,7 +217,7 @@ function useDialogs() {
|
|
|
440
217
|
return open(PromptDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
441
218
|
}
|
|
442
219
|
);
|
|
443
|
-
return
|
|
220
|
+
return React16.useMemo(
|
|
444
221
|
() => ({
|
|
445
222
|
alert,
|
|
446
223
|
confirm,
|
|
@@ -451,468 +228,14 @@ function useDialogs() {
|
|
|
451
228
|
[alert, close, confirm, open, prompt]
|
|
452
229
|
);
|
|
453
230
|
}
|
|
454
|
-
|
|
455
|
-
// src/toolpad-core/useDialogs/DialogsProvider.tsx
|
|
456
|
-
import invariant2 from "invariant";
|
|
457
|
-
import * as React8 from "react";
|
|
458
|
-
import useEventCallback2 from "@mui/utils/useEventCallback";
|
|
459
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
460
|
-
function DialogsProvider(props) {
|
|
461
|
-
const { children, unmountAfter = 1e3 } = props;
|
|
462
|
-
const [stack, setStack] = React8.useState([]);
|
|
463
|
-
const keyPrefix = React8.useId();
|
|
464
|
-
const nextId2 = React8.useRef(0);
|
|
465
|
-
const dialogMetadata = React8.useRef(/* @__PURE__ */ new WeakMap());
|
|
466
|
-
const requestDialog = useEventCallback2(function open(Component, payload, options = {}) {
|
|
467
|
-
const { onClose = async () => {
|
|
468
|
-
} } = options;
|
|
469
|
-
let resolve;
|
|
470
|
-
const promise = new Promise((resolveImpl) => {
|
|
471
|
-
resolve = resolveImpl;
|
|
472
|
-
});
|
|
473
|
-
invariant2(resolve, "resolve not set");
|
|
474
|
-
const key = `${keyPrefix}-${nextId2.current}`;
|
|
475
|
-
nextId2.current += 1;
|
|
476
|
-
const newEntry = {
|
|
477
|
-
key,
|
|
478
|
-
open: true,
|
|
479
|
-
promise,
|
|
480
|
-
Component,
|
|
481
|
-
payload,
|
|
482
|
-
onClose,
|
|
483
|
-
resolve
|
|
484
|
-
};
|
|
485
|
-
dialogMetadata.current.set(promise, newEntry);
|
|
486
|
-
setStack((prevStack) => [...prevStack, newEntry]);
|
|
487
|
-
return promise;
|
|
488
|
-
});
|
|
489
|
-
const closeDialogUi = useEventCallback2(function closeDialogUi2(dialog) {
|
|
490
|
-
setStack(
|
|
491
|
-
(prevStack) => prevStack.map((entry) => entry.promise === dialog ? __spreadProps(__spreadValues({}, entry), { open: false }) : entry)
|
|
492
|
-
);
|
|
493
|
-
setTimeout(() => {
|
|
494
|
-
setStack((prevStack) => prevStack.filter((entry) => entry.promise !== dialog));
|
|
495
|
-
}, unmountAfter);
|
|
496
|
-
});
|
|
497
|
-
const closeDialog = useEventCallback2(async function closeDialog2(dialog, result) {
|
|
498
|
-
const entryToClose = dialogMetadata.current.get(dialog);
|
|
499
|
-
invariant2(entryToClose, "dialog not found");
|
|
500
|
-
try {
|
|
501
|
-
await entryToClose.onClose(result);
|
|
502
|
-
} finally {
|
|
503
|
-
entryToClose.resolve(result);
|
|
504
|
-
closeDialogUi(dialog);
|
|
505
|
-
}
|
|
506
|
-
return dialog;
|
|
507
|
-
});
|
|
508
|
-
const contextValue = React8.useMemo(
|
|
509
|
-
() => ({ open: requestDialog, close: closeDialog }),
|
|
510
|
-
[requestDialog, closeDialog]
|
|
511
|
-
);
|
|
512
|
-
return /* @__PURE__ */ jsxs3(DialogsContext.Provider, { value: contextValue, children: [
|
|
513
|
-
children,
|
|
514
|
-
stack.map(({ key, open, Component, payload, promise }) => /* @__PURE__ */ jsx4(
|
|
515
|
-
Component,
|
|
516
|
-
{
|
|
517
|
-
payload,
|
|
518
|
-
open,
|
|
519
|
-
onClose: async (result) => {
|
|
520
|
-
await closeDialog(promise, result);
|
|
521
|
-
}
|
|
522
|
-
},
|
|
523
|
-
key
|
|
524
|
-
))
|
|
525
|
-
] });
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
// src/toolpad-core/AppProvider/AppThemeProvider.tsx
|
|
529
|
-
import * as React10 from "react";
|
|
530
|
-
import { useMediaQuery } from "@mui/material";
|
|
531
|
-
import { ThemeProvider, useColorScheme } from "@mui/material/styles";
|
|
532
|
-
import InitColorSchemeScript from "@mui/material/InitColorSchemeScript";
|
|
533
|
-
import CssBaseline from "@mui/material/CssBaseline";
|
|
534
|
-
import invariant3 from "invariant";
|
|
535
|
-
|
|
536
|
-
// src/toolpad-core/persistence/useStorageState.tsx
|
|
537
|
-
import * as React9 from "react";
|
|
538
|
-
|
|
539
|
-
// src/toolpad-core/persistence/codec.tsx
|
|
540
|
-
var CODEC_STRING = {
|
|
541
|
-
parse: (value) => value,
|
|
542
|
-
stringify: (value) => value
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
// src/toolpad-core/persistence/useStorageState.tsx
|
|
546
|
-
var currentTabChangeListeners = /* @__PURE__ */ new Map();
|
|
547
|
-
function onCurrentTabStorageChange(key, handler) {
|
|
548
|
-
let listeners = currentTabChangeListeners.get(key);
|
|
549
|
-
if (!listeners) {
|
|
550
|
-
listeners = /* @__PURE__ */ new Set();
|
|
551
|
-
currentTabChangeListeners.set(key, listeners);
|
|
552
|
-
}
|
|
553
|
-
listeners.add(handler);
|
|
554
|
-
}
|
|
555
|
-
function offCurrentTabStorageChange(key, handler) {
|
|
556
|
-
const listeners = currentTabChangeListeners.get(key);
|
|
557
|
-
if (!listeners) {
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
listeners.delete(handler);
|
|
561
|
-
if (listeners.size === 0) {
|
|
562
|
-
currentTabChangeListeners.delete(key);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
function emitCurrentTabStorageChange(key) {
|
|
566
|
-
const listeners = currentTabChangeListeners.get(key);
|
|
567
|
-
if (listeners) {
|
|
568
|
-
listeners.forEach((listener) => listener());
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (typeof window !== "undefined") {
|
|
572
|
-
const origSetItem = window.localStorage.setItem;
|
|
573
|
-
window.localStorage.setItem = function setItem(key, value) {
|
|
574
|
-
const result = origSetItem.call(this, key, value);
|
|
575
|
-
emitCurrentTabStorageChange(key);
|
|
576
|
-
return result;
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
function subscribe(area, key, callback) {
|
|
580
|
-
if (!key) {
|
|
581
|
-
return () => {
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
const storageHandler = (event) => {
|
|
585
|
-
if (event.storageArea === area && event.key === key) {
|
|
586
|
-
callback();
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
window.addEventListener("storage", storageHandler);
|
|
590
|
-
onCurrentTabStorageChange(key, callback);
|
|
591
|
-
return () => {
|
|
592
|
-
window.removeEventListener("storage", storageHandler);
|
|
593
|
-
offCurrentTabStorageChange(key, callback);
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
function getSnapshot(area, key) {
|
|
597
|
-
if (!key) {
|
|
598
|
-
return null;
|
|
599
|
-
}
|
|
600
|
-
try {
|
|
601
|
-
return area.getItem(key);
|
|
602
|
-
} catch (e) {
|
|
603
|
-
return null;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
function setValue(area, key, value) {
|
|
607
|
-
if (!key) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
try {
|
|
611
|
-
if (value === null) {
|
|
612
|
-
area.removeItem(key);
|
|
613
|
-
} else {
|
|
614
|
-
area.setItem(key, String(value));
|
|
615
|
-
}
|
|
616
|
-
} catch (e) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
emitCurrentTabStorageChange(key);
|
|
620
|
-
}
|
|
621
|
-
var serverValue = [null, () => {
|
|
622
|
-
}];
|
|
623
|
-
function useStorageStateServer() {
|
|
624
|
-
return serverValue;
|
|
625
|
-
}
|
|
626
|
-
function encode(codec, value) {
|
|
627
|
-
return value === null ? null : codec.stringify(value);
|
|
628
|
-
}
|
|
629
|
-
function decode(codec, value) {
|
|
630
|
-
return value === null ? null : codec.parse(value);
|
|
631
|
-
}
|
|
632
|
-
var getKeyServerSnapshot = () => null;
|
|
633
|
-
function useStorageState(area, key, initializer = null, options) {
|
|
634
|
-
var _a;
|
|
635
|
-
const codec = (_a = options == null ? void 0 : options.codec) != null ? _a : CODEC_STRING;
|
|
636
|
-
const [initialValue] = React9.useState(initializer);
|
|
637
|
-
const encodedInitialValue = React9.useMemo(
|
|
638
|
-
() => encode(codec, initialValue),
|
|
639
|
-
[codec, initialValue]
|
|
640
|
-
);
|
|
641
|
-
const subscribeKey = React9.useCallback(
|
|
642
|
-
(callback) => subscribe(area, key, callback),
|
|
643
|
-
[area, key]
|
|
644
|
-
);
|
|
645
|
-
const getKeySnapshot = React9.useCallback(
|
|
646
|
-
() => {
|
|
647
|
-
var _a2;
|
|
648
|
-
return (_a2 = getSnapshot(area, key)) != null ? _a2 : encodedInitialValue;
|
|
649
|
-
},
|
|
650
|
-
[area, encodedInitialValue, key]
|
|
651
|
-
);
|
|
652
|
-
const encodedStoredValue = React9.useSyncExternalStore(
|
|
653
|
-
subscribeKey,
|
|
654
|
-
getKeySnapshot,
|
|
655
|
-
getKeyServerSnapshot
|
|
656
|
-
);
|
|
657
|
-
const storedValue = React9.useMemo(
|
|
658
|
-
() => decode(codec, encodedStoredValue),
|
|
659
|
-
[codec, encodedStoredValue]
|
|
660
|
-
);
|
|
661
|
-
const setStoredValue = React9.useCallback(
|
|
662
|
-
(value) => {
|
|
663
|
-
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
664
|
-
const encodedValueToStore = encode(codec, valueToStore);
|
|
665
|
-
setValue(area, key, encodedValueToStore);
|
|
666
|
-
},
|
|
667
|
-
[area, codec, storedValue, key]
|
|
668
|
-
);
|
|
669
|
-
const [nonStoredValue, setNonStoredValue] = React9.useState(initialValue);
|
|
670
|
-
if (!key) {
|
|
671
|
-
return [nonStoredValue, setNonStoredValue];
|
|
672
|
-
}
|
|
673
|
-
return [storedValue, setStoredValue];
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
// src/toolpad-core/useLocalStorageState/useLocalStorageState.tsx
|
|
677
|
-
var useLocalStorageStateBrowser = (...args) => useStorageState(window.localStorage, ...args);
|
|
678
|
-
var useLocalStorageState = typeof window === "undefined" ? useStorageStateServer : useLocalStorageStateBrowser;
|
|
679
|
-
|
|
680
|
-
// src/toolpad-core/AppProvider/AppThemeProvider.tsx
|
|
681
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
682
|
-
var COLOR_SCHEME_STORAGE_KEY = "toolpad-color-scheme";
|
|
683
|
-
var MODE_STORAGE_KEY = "toolpad-mode";
|
|
684
|
-
function usePreferredMode(window2) {
|
|
685
|
-
const prefersDarkMode = useMediaQuery(
|
|
686
|
-
"(prefers-color-scheme: dark)",
|
|
687
|
-
window2 && {
|
|
688
|
-
matchMedia: window2.matchMedia
|
|
689
|
-
}
|
|
690
|
-
);
|
|
691
|
-
return prefersDarkMode ? "dark" : "light";
|
|
692
|
-
}
|
|
693
|
-
function isCssVarsTheme(theme) {
|
|
694
|
-
return "vars" in theme;
|
|
695
|
-
}
|
|
696
|
-
function LegacyThemeProvider(props) {
|
|
697
|
-
const { children, theme, window: appWindow } = props;
|
|
698
|
-
invariant3(!isCssVarsTheme(theme), "This provider only accepts legacy themes.");
|
|
699
|
-
const isDualTheme = "light" in theme || "dark" in theme;
|
|
700
|
-
const preferredMode = usePreferredMode(appWindow);
|
|
701
|
-
const [userMode, setUserMode] = useLocalStorageState(MODE_STORAGE_KEY, "system");
|
|
702
|
-
const paletteMode = !userMode || userMode === "system" ? preferredMode : userMode;
|
|
703
|
-
const dualAwareTheme = React10.useMemo(
|
|
704
|
-
() => {
|
|
705
|
-
var _a;
|
|
706
|
-
return isDualTheme ? (_a = theme[paletteMode === "dark" ? "dark" : "light"]) != null ? _a : theme[paletteMode === "dark" ? "light" : "dark"] : theme;
|
|
707
|
-
},
|
|
708
|
-
[isDualTheme, paletteMode, theme]
|
|
709
|
-
);
|
|
710
|
-
const paletteModeContextValue = React10.useMemo(
|
|
711
|
-
() => ({
|
|
712
|
-
paletteMode,
|
|
713
|
-
setPaletteMode: setUserMode,
|
|
714
|
-
isDualTheme
|
|
715
|
-
}),
|
|
716
|
-
[isDualTheme, paletteMode, setUserMode]
|
|
717
|
-
);
|
|
718
|
-
return /* @__PURE__ */ jsx5(ThemeProvider, { theme: dualAwareTheme, children: /* @__PURE__ */ jsxs4(PaletteModeContext.Provider, { value: paletteModeContextValue, children: [
|
|
719
|
-
/* @__PURE__ */ jsx5(CssBaseline, { enableColorScheme: true }),
|
|
720
|
-
children
|
|
721
|
-
] }) });
|
|
722
|
-
}
|
|
723
|
-
function CssVarsPaletteModeProvider(props) {
|
|
724
|
-
const { children, window: appWindow } = props;
|
|
725
|
-
const preferredMode = usePreferredMode(appWindow);
|
|
726
|
-
const { mode, setMode, allColorSchemes } = useColorScheme();
|
|
727
|
-
const paletteModeContextValue = React10.useMemo(() => {
|
|
728
|
-
return {
|
|
729
|
-
paletteMode: !mode || mode === "system" ? preferredMode : mode,
|
|
730
|
-
setPaletteMode: setMode,
|
|
731
|
-
isDualTheme: allColorSchemes.length > 1
|
|
732
|
-
};
|
|
733
|
-
}, [allColorSchemes, mode, preferredMode, setMode]);
|
|
734
|
-
return /* @__PURE__ */ jsx5(PaletteModeContext.Provider, { value: paletteModeContextValue, children });
|
|
735
|
-
}
|
|
736
|
-
function CssVarsThemeProvider(props) {
|
|
737
|
-
const { children, theme, window: appWindow, nonce } = props;
|
|
738
|
-
invariant3(isCssVarsTheme(theme), "This provider only accepts CSS vars themes.");
|
|
739
|
-
return /* @__PURE__ */ jsxs4(
|
|
740
|
-
ThemeProvider,
|
|
741
|
-
{
|
|
742
|
-
theme,
|
|
743
|
-
documentNode: appWindow == null ? void 0 : appWindow.document,
|
|
744
|
-
colorSchemeNode: appWindow == null ? void 0 : appWindow.document.documentElement,
|
|
745
|
-
disableNestedContext: true,
|
|
746
|
-
colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
|
|
747
|
-
modeStorageKey: MODE_STORAGE_KEY,
|
|
748
|
-
children: [
|
|
749
|
-
/* @__PURE__ */ jsx5(
|
|
750
|
-
InitColorSchemeScript,
|
|
751
|
-
{
|
|
752
|
-
attribute: theme.colorSchemeSelector,
|
|
753
|
-
colorSchemeStorageKey: COLOR_SCHEME_STORAGE_KEY,
|
|
754
|
-
modeStorageKey: MODE_STORAGE_KEY,
|
|
755
|
-
nonce
|
|
756
|
-
}
|
|
757
|
-
),
|
|
758
|
-
/* @__PURE__ */ jsxs4(CssVarsPaletteModeProvider, { window: appWindow, children: [
|
|
759
|
-
/* @__PURE__ */ jsx5(CssBaseline, { enableColorScheme: true }),
|
|
760
|
-
children
|
|
761
|
-
] })
|
|
762
|
-
]
|
|
763
|
-
}
|
|
764
|
-
);
|
|
765
|
-
}
|
|
766
|
-
function AppThemeProvider(props) {
|
|
767
|
-
const _a = props, { children, theme } = _a, rest = __objRest(_a, ["children", "theme"]);
|
|
768
|
-
const useCssVarsProvider = isCssVarsTheme(theme);
|
|
769
|
-
return useCssVarsProvider ? /* @__PURE__ */ jsx5(CssVarsThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children })) : /* @__PURE__ */ jsx5(LegacyThemeProvider, __spreadProps(__spreadValues({ theme }, rest), { children }));
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
// src/toolpad-core/AppProvider/AppProvider.tsx
|
|
773
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
774
|
-
var AuthenticationContext = React11.createContext(null);
|
|
775
|
-
var SessionContext = React11.createContext(null);
|
|
776
|
-
function createDefaultTheme() {
|
|
777
|
-
return createTheme({
|
|
778
|
-
cssVariables: {
|
|
779
|
-
colorSchemeSelector: "data-toolpad-color-scheme"
|
|
780
|
-
},
|
|
781
|
-
colorSchemes: { dark: true }
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
function AppProvider(props) {
|
|
785
|
-
const {
|
|
786
|
-
children,
|
|
787
|
-
theme = createDefaultTheme(),
|
|
788
|
-
branding = null,
|
|
789
|
-
navigation = [],
|
|
790
|
-
localeText,
|
|
791
|
-
router = null,
|
|
792
|
-
authentication = null,
|
|
793
|
-
session = null,
|
|
794
|
-
window: appWindow,
|
|
795
|
-
nonce
|
|
796
|
-
} = props;
|
|
797
|
-
return /* @__PURE__ */ jsx6(WindowContext.Provider, { value: appWindow, children: /* @__PURE__ */ jsx6(AuthenticationContext.Provider, { value: authentication, children: /* @__PURE__ */ jsx6(SessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx6(RouterContext.Provider, { value: router, children: /* @__PURE__ */ jsx6(AppThemeProvider, { theme, window: appWindow, nonce, children: /* @__PURE__ */ jsx6(LocalizationProvider, { localeText, children: /* @__PURE__ */ jsx6(NotificationsProvider, { children: /* @__PURE__ */ jsx6(DialogsProvider, { children: /* @__PURE__ */ jsx6(BrandingContext.Provider, { value: branding, children: /* @__PURE__ */ jsx6(NavigationContext.Provider, { value: navigation, children }) }) }) }) }) }) }) }) }) });
|
|
798
|
-
}
|
|
799
|
-
AppProvider.propTypes = {
|
|
800
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
801
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
802
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
803
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
804
|
-
/**
|
|
805
|
-
* Authentication methods.
|
|
806
|
-
* @default null
|
|
807
|
-
*/
|
|
808
|
-
authentication: PropTypes2.shape({
|
|
809
|
-
signIn: PropTypes2.func.isRequired,
|
|
810
|
-
signOut: PropTypes2.func.isRequired
|
|
811
|
-
}),
|
|
812
|
-
/**
|
|
813
|
-
* Branding options for the app.
|
|
814
|
-
* @default null
|
|
815
|
-
*/
|
|
816
|
-
branding: PropTypes2.shape({
|
|
817
|
-
homeUrl: PropTypes2.string,
|
|
818
|
-
logo: PropTypes2.node,
|
|
819
|
-
title: PropTypes2.string
|
|
820
|
-
}),
|
|
821
|
-
/**
|
|
822
|
-
* The content of the app provider.
|
|
823
|
-
*/
|
|
824
|
-
children: PropTypes2.node,
|
|
825
|
-
/**
|
|
826
|
-
* Locale text for components
|
|
827
|
-
*/
|
|
828
|
-
localeText: PropTypes2.object,
|
|
829
|
-
/**
|
|
830
|
-
* Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
|
|
831
|
-
* @default []
|
|
832
|
-
*/
|
|
833
|
-
navigation: PropTypes2.arrayOf(
|
|
834
|
-
PropTypes2.oneOfType([
|
|
835
|
-
PropTypes2.shape({
|
|
836
|
-
action: PropTypes2.node,
|
|
837
|
-
children: PropTypes2.arrayOf(
|
|
838
|
-
PropTypes2.oneOfType([
|
|
839
|
-
PropTypes2.object,
|
|
840
|
-
PropTypes2.shape({
|
|
841
|
-
kind: PropTypes2.oneOf(["header"]).isRequired,
|
|
842
|
-
title: PropTypes2.string.isRequired
|
|
843
|
-
}),
|
|
844
|
-
PropTypes2.shape({
|
|
845
|
-
kind: PropTypes2.oneOf(["divider"]).isRequired
|
|
846
|
-
})
|
|
847
|
-
]).isRequired
|
|
848
|
-
),
|
|
849
|
-
icon: PropTypes2.node,
|
|
850
|
-
kind: PropTypes2.oneOf(["page"]),
|
|
851
|
-
pattern: PropTypes2.string,
|
|
852
|
-
segment: PropTypes2.string,
|
|
853
|
-
title: PropTypes2.string
|
|
854
|
-
}),
|
|
855
|
-
PropTypes2.shape({
|
|
856
|
-
kind: PropTypes2.oneOf(["header"]).isRequired,
|
|
857
|
-
title: PropTypes2.string.isRequired
|
|
858
|
-
}),
|
|
859
|
-
PropTypes2.shape({
|
|
860
|
-
kind: PropTypes2.oneOf(["divider"]).isRequired
|
|
861
|
-
})
|
|
862
|
-
]).isRequired
|
|
863
|
-
),
|
|
864
|
-
/**
|
|
865
|
-
* The nonce to be used for inline scripts.
|
|
866
|
-
*/
|
|
867
|
-
nonce: PropTypes2.string,
|
|
868
|
-
/**
|
|
869
|
-
* Router implementation used inside Toolpad components.
|
|
870
|
-
* @default null
|
|
871
|
-
*/
|
|
872
|
-
router: PropTypes2.shape({
|
|
873
|
-
Link: PropTypes2.elementType,
|
|
874
|
-
navigate: PropTypes2.func.isRequired,
|
|
875
|
-
pathname: PropTypes2.string.isRequired,
|
|
876
|
-
searchParams: PropTypes2.instanceOf(URLSearchParams).isRequired
|
|
877
|
-
}),
|
|
878
|
-
/**
|
|
879
|
-
* Session info about the current user.
|
|
880
|
-
* @default null
|
|
881
|
-
*/
|
|
882
|
-
session: PropTypes2.shape({
|
|
883
|
-
user: PropTypes2.shape({
|
|
884
|
-
email: PropTypes2.string,
|
|
885
|
-
id: PropTypes2.string,
|
|
886
|
-
image: PropTypes2.string,
|
|
887
|
-
name: PropTypes2.string
|
|
888
|
-
})
|
|
889
|
-
}),
|
|
890
|
-
/**
|
|
891
|
-
* [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.
|
|
892
|
-
* @default createDefaultTheme()
|
|
893
|
-
*/
|
|
894
|
-
theme: PropTypes2.object,
|
|
895
|
-
/**
|
|
896
|
-
* The window where the application is rendered.
|
|
897
|
-
* This is needed when rendering the app inside an iframe, for example.
|
|
898
|
-
* @default window
|
|
899
|
-
*/
|
|
900
|
-
window: PropTypes2.object
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
// src/toolpad-core/Account/AccountLocaleContext.tsx
|
|
904
|
-
import * as React12 from "react";
|
|
905
|
-
var AccountLocaleContext = React12.createContext(null);
|
|
906
|
-
|
|
907
|
-
// src/toolpad-core/Account/SignInButton.tsx
|
|
908
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
231
|
+
var AccountLocaleContext = React16.createContext(null);
|
|
909
232
|
function SignInButton(props) {
|
|
910
|
-
const authentication =
|
|
233
|
+
const authentication = React16.useContext(AuthenticationContext);
|
|
911
234
|
const globalLocaleText = useLocaleText();
|
|
912
|
-
const accountLocaleText =
|
|
235
|
+
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
913
236
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
914
|
-
return /* @__PURE__ */
|
|
915
|
-
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
Button,
|
|
916
239
|
__spreadProps(__spreadValues({
|
|
917
240
|
disableElevation: true,
|
|
918
241
|
variant: "contained",
|
|
@@ -941,22 +264,15 @@ SignInButton.propTypes = {
|
|
|
941
264
|
/**
|
|
942
265
|
* The content of the component.
|
|
943
266
|
*/
|
|
944
|
-
children:
|
|
267
|
+
children: PropTypes9.node
|
|
945
268
|
};
|
|
946
|
-
|
|
947
|
-
// src/toolpad-core/Account/SignOutButton.tsx
|
|
948
|
-
import * as React14 from "react";
|
|
949
|
-
import PropTypes4 from "prop-types";
|
|
950
|
-
import Button4 from "@mui/material/Button";
|
|
951
|
-
import LogoutIcon from "@mui/icons-material/Logout";
|
|
952
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
953
269
|
function SignOutButton(props) {
|
|
954
|
-
const authentication =
|
|
270
|
+
const authentication = React16.useContext(AuthenticationContext);
|
|
955
271
|
const globalLocaleText = useLocaleText();
|
|
956
|
-
const accountLocaleText =
|
|
272
|
+
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
957
273
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
958
|
-
return /* @__PURE__ */
|
|
959
|
-
|
|
274
|
+
return /* @__PURE__ */ jsx(
|
|
275
|
+
Button,
|
|
960
276
|
__spreadProps(__spreadValues({
|
|
961
277
|
disabled: !authentication,
|
|
962
278
|
variant: "outlined",
|
|
@@ -972,7 +288,7 @@ function SignOutButton(props) {
|
|
|
972
288
|
filter: "opacity(1)"
|
|
973
289
|
}
|
|
974
290
|
},
|
|
975
|
-
startIcon: /* @__PURE__ */
|
|
291
|
+
startIcon: /* @__PURE__ */ jsx(LogoutIcon, {})
|
|
976
292
|
}, props), {
|
|
977
293
|
children: localeText == null ? void 0 : localeText.accountSignOutLabel
|
|
978
294
|
})
|
|
@@ -986,30 +302,19 @@ SignOutButton.propTypes = {
|
|
|
986
302
|
/**
|
|
987
303
|
* The content of the component.
|
|
988
304
|
*/
|
|
989
|
-
children:
|
|
305
|
+
children: PropTypes9.node
|
|
990
306
|
};
|
|
991
|
-
|
|
992
|
-
// src/toolpad-core/Account/AccountPreview.tsx
|
|
993
|
-
import * as React15 from "react";
|
|
994
|
-
import PropTypes5 from "prop-types";
|
|
995
|
-
import Avatar from "@mui/material/Avatar";
|
|
996
|
-
import Typography from "@mui/material/Typography";
|
|
997
|
-
import Tooltip from "@mui/material/Tooltip";
|
|
998
|
-
import Stack from "@mui/material/Stack";
|
|
999
|
-
import IconButton2 from "@mui/material/IconButton";
|
|
1000
|
-
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
1001
|
-
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1002
307
|
function AccountPreview(props) {
|
|
1003
308
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1004
309
|
const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
|
|
1005
|
-
const session =
|
|
310
|
+
const session = React16.useContext(SessionContext);
|
|
1006
311
|
const globalLocaleText = useLocaleText();
|
|
1007
|
-
const accountLocaleText =
|
|
312
|
+
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
1008
313
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
1009
314
|
if (!session || !session.user) {
|
|
1010
315
|
return null;
|
|
1011
316
|
}
|
|
1012
|
-
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */
|
|
317
|
+
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsx(slots.avatar, {}) : /* @__PURE__ */ jsx(
|
|
1013
318
|
Avatar,
|
|
1014
319
|
__spreadValues({
|
|
1015
320
|
src: ((_a = session.user) == null ? void 0 : _a.image) || "",
|
|
@@ -1018,28 +323,28 @@ function AccountPreview(props) {
|
|
|
1018
323
|
}, slotProps == null ? void 0 : slotProps.avatar)
|
|
1019
324
|
);
|
|
1020
325
|
if (variant === "expanded") {
|
|
1021
|
-
return /* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: __spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
|
|
327
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
|
|
1023
328
|
avatarContent,
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
|
|
330
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
|
|
331
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
|
|
1027
332
|
] })
|
|
1028
333
|
] }),
|
|
1029
|
-
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */
|
|
1030
|
-
|
|
334
|
+
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsx(slots.moreIconButton, {}) : /* @__PURE__ */ jsx(
|
|
335
|
+
IconButton,
|
|
1031
336
|
__spreadProps(__spreadValues({
|
|
1032
337
|
size: "small",
|
|
1033
338
|
onClick: handleClick
|
|
1034
339
|
}, slotProps == null ? void 0 : slotProps.moreIconButton), {
|
|
1035
340
|
sx: __spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
|
|
1036
|
-
children: /* @__PURE__ */
|
|
341
|
+
children: /* @__PURE__ */ jsx(MoreVertIcon, { fontSize: "small" })
|
|
1037
342
|
})
|
|
1038
343
|
))
|
|
1039
344
|
] });
|
|
1040
345
|
}
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
|
|
346
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsx(slots.avatarIconButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsx(Stack, { sx: __spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsx(
|
|
347
|
+
IconButton,
|
|
1043
348
|
__spreadProps(__spreadValues({
|
|
1044
349
|
onClick: handleClick,
|
|
1045
350
|
"aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
|
|
@@ -1061,35 +366,35 @@ AccountPreview.propTypes = {
|
|
|
1061
366
|
/**
|
|
1062
367
|
* The handler used when the preview is expanded
|
|
1063
368
|
*/
|
|
1064
|
-
handleClick:
|
|
369
|
+
handleClick: PropTypes9.func,
|
|
1065
370
|
/**
|
|
1066
371
|
* The state of the Account popover
|
|
1067
372
|
* @default false
|
|
1068
373
|
*/
|
|
1069
|
-
open:
|
|
374
|
+
open: PropTypes9.bool,
|
|
1070
375
|
/**
|
|
1071
376
|
* The props used for each slot inside.
|
|
1072
377
|
*/
|
|
1073
|
-
slotProps:
|
|
1074
|
-
avatar:
|
|
1075
|
-
avatarIconButton:
|
|
1076
|
-
moreIconButton:
|
|
378
|
+
slotProps: PropTypes9.shape({
|
|
379
|
+
avatar: PropTypes9.object,
|
|
380
|
+
avatarIconButton: PropTypes9.object,
|
|
381
|
+
moreIconButton: PropTypes9.object
|
|
1077
382
|
}),
|
|
1078
383
|
/**
|
|
1079
384
|
* The components used for each slot inside.
|
|
1080
385
|
*/
|
|
1081
|
-
slots:
|
|
1082
|
-
avatar:
|
|
1083
|
-
avatarIconButton:
|
|
1084
|
-
moreIconButton:
|
|
386
|
+
slots: PropTypes9.shape({
|
|
387
|
+
avatar: PropTypes9.elementType,
|
|
388
|
+
avatarIconButton: PropTypes9.elementType,
|
|
389
|
+
moreIconButton: PropTypes9.elementType
|
|
1085
390
|
}),
|
|
1086
391
|
/**
|
|
1087
392
|
* The prop used to customize the styling of the preview
|
|
1088
393
|
*/
|
|
1089
|
-
sx:
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
394
|
+
sx: PropTypes9.oneOfType([
|
|
395
|
+
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
396
|
+
PropTypes9.func,
|
|
397
|
+
PropTypes9.object
|
|
1093
398
|
]),
|
|
1094
399
|
/**
|
|
1095
400
|
* The type of account details to display.
|
|
@@ -1097,16 +402,11 @@ AccountPreview.propTypes = {
|
|
|
1097
402
|
* @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
|
|
1098
403
|
* @default 'condensed'
|
|
1099
404
|
*/
|
|
1100
|
-
variant:
|
|
405
|
+
variant: PropTypes9.oneOf(["condensed", "expanded"])
|
|
1101
406
|
};
|
|
1102
|
-
|
|
1103
|
-
// src/toolpad-core/Account/AccountPopoverHeader.tsx
|
|
1104
|
-
import PropTypes6 from "prop-types";
|
|
1105
|
-
import Stack2 from "@mui/material/Stack";
|
|
1106
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1107
407
|
function AccountPopoverHeader(props) {
|
|
1108
408
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
1109
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, rest), { children }));
|
|
1110
410
|
}
|
|
1111
411
|
AccountPopoverHeader.propTypes = {
|
|
1112
412
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -1116,17 +416,12 @@ AccountPopoverHeader.propTypes = {
|
|
|
1116
416
|
/**
|
|
1117
417
|
* The content of the component.
|
|
1118
418
|
*/
|
|
1119
|
-
children:
|
|
419
|
+
children: PropTypes9.node
|
|
1120
420
|
};
|
|
1121
|
-
|
|
1122
|
-
// src/toolpad-core/Account/AccountPopoverFooter.tsx
|
|
1123
|
-
import PropTypes7 from "prop-types";
|
|
1124
|
-
import Box from "@mui/material/Box";
|
|
1125
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1126
421
|
function AccountPopoverFooter(props) {
|
|
1127
422
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
1128
|
-
return /* @__PURE__ */
|
|
1129
|
-
|
|
423
|
+
return /* @__PURE__ */ jsx(
|
|
424
|
+
Box4,
|
|
1130
425
|
__spreadProps(__spreadValues({}, rest), {
|
|
1131
426
|
sx: __spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
|
|
1132
427
|
children
|
|
@@ -1141,19 +436,16 @@ AccountPopoverFooter.propTypes = {
|
|
|
1141
436
|
/**
|
|
1142
437
|
* @ignore
|
|
1143
438
|
*/
|
|
1144
|
-
children:
|
|
439
|
+
children: PropTypes9.node,
|
|
1145
440
|
/**
|
|
1146
441
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1147
442
|
*/
|
|
1148
|
-
sx:
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
443
|
+
sx: PropTypes9.oneOfType([
|
|
444
|
+
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
445
|
+
PropTypes9.func,
|
|
446
|
+
PropTypes9.object
|
|
1152
447
|
])
|
|
1153
448
|
};
|
|
1154
|
-
|
|
1155
|
-
// src/toolpad-core/Account/Account.tsx
|
|
1156
|
-
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1157
449
|
var defaultAccountLocaleText = {
|
|
1158
450
|
accountPreviewIconButtonLabel: "Current User",
|
|
1159
451
|
accountPreviewTitle: "Account",
|
|
@@ -1184,10 +476,10 @@ function Account(props) {
|
|
|
1184
476
|
}
|
|
1185
477
|
let accountContent = null;
|
|
1186
478
|
if (!(session == null ? void 0 : session.user)) {
|
|
1187
|
-
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */
|
|
479
|
+
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsx(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsx(SignInButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
|
|
1188
480
|
} else {
|
|
1189
|
-
accountContent = /* @__PURE__ */
|
|
1190
|
-
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */
|
|
481
|
+
accountContent = /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
482
|
+
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsx(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsx(
|
|
1191
483
|
AccountPreview,
|
|
1192
484
|
__spreadValues({
|
|
1193
485
|
variant: "condensed",
|
|
@@ -1195,14 +487,14 @@ function Account(props) {
|
|
|
1195
487
|
open
|
|
1196
488
|
}, slotProps == null ? void 0 : slotProps.preview)
|
|
1197
489
|
),
|
|
1198
|
-
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */
|
|
490
|
+
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsx(
|
|
1199
491
|
slots.popover,
|
|
1200
492
|
__spreadValues({
|
|
1201
493
|
open,
|
|
1202
494
|
onClick: handleClick,
|
|
1203
495
|
onClose: handleClose
|
|
1204
496
|
}, slotProps == null ? void 0 : slotProps.popover)
|
|
1205
|
-
) : /* @__PURE__ */
|
|
497
|
+
) : /* @__PURE__ */ jsx(
|
|
1206
498
|
Popover,
|
|
1207
499
|
__spreadProps(__spreadValues({
|
|
1208
500
|
anchorEl,
|
|
@@ -1235,16 +527,16 @@ function Account(props) {
|
|
|
1235
527
|
}
|
|
1236
528
|
}
|
|
1237
529
|
}, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
|
|
1238
|
-
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
530
|
+
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsx(slots.popoverContent, __spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxs(Stack, __spreadProps(__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
|
|
531
|
+
/* @__PURE__ */ jsx(AccountPopoverHeader, { children: /* @__PURE__ */ jsx(AccountPreview, { variant: "expanded" }) }),
|
|
532
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
533
|
+
/* @__PURE__ */ jsx(AccountPopoverFooter, { children: /* @__PURE__ */ jsx(SignOutButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
|
|
1242
534
|
] }))
|
|
1243
535
|
})
|
|
1244
536
|
)
|
|
1245
537
|
] });
|
|
1246
538
|
}
|
|
1247
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ jsx(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
|
|
1248
540
|
}
|
|
1249
541
|
Account.propTypes = {
|
|
1250
542
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -1254,82 +546,51 @@ Account.propTypes = {
|
|
|
1254
546
|
/**
|
|
1255
547
|
* The labels for the account component.
|
|
1256
548
|
*/
|
|
1257
|
-
localeText:
|
|
549
|
+
localeText: PropTypes9.object,
|
|
1258
550
|
/**
|
|
1259
551
|
* The props used for each slot inside.
|
|
1260
552
|
*/
|
|
1261
|
-
slotProps:
|
|
1262
|
-
popover:
|
|
1263
|
-
popoverContent:
|
|
1264
|
-
preview:
|
|
1265
|
-
handleClick:
|
|
1266
|
-
open:
|
|
1267
|
-
slotProps:
|
|
1268
|
-
avatar:
|
|
1269
|
-
avatarIconButton:
|
|
1270
|
-
moreIconButton:
|
|
553
|
+
slotProps: PropTypes9.shape({
|
|
554
|
+
popover: PropTypes9.object,
|
|
555
|
+
popoverContent: PropTypes9.object,
|
|
556
|
+
preview: PropTypes9.shape({
|
|
557
|
+
handleClick: PropTypes9.func,
|
|
558
|
+
open: PropTypes9.bool,
|
|
559
|
+
slotProps: PropTypes9.shape({
|
|
560
|
+
avatar: PropTypes9.object,
|
|
561
|
+
avatarIconButton: PropTypes9.object,
|
|
562
|
+
moreIconButton: PropTypes9.object
|
|
1271
563
|
}),
|
|
1272
|
-
slots:
|
|
1273
|
-
avatar:
|
|
1274
|
-
avatarIconButton:
|
|
1275
|
-
moreIconButton:
|
|
564
|
+
slots: PropTypes9.shape({
|
|
565
|
+
avatar: PropTypes9.elementType,
|
|
566
|
+
avatarIconButton: PropTypes9.elementType,
|
|
567
|
+
moreIconButton: PropTypes9.elementType
|
|
1276
568
|
}),
|
|
1277
|
-
sx:
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
569
|
+
sx: PropTypes9.oneOfType([
|
|
570
|
+
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
571
|
+
PropTypes9.func,
|
|
572
|
+
PropTypes9.object
|
|
1281
573
|
]),
|
|
1282
|
-
variant:
|
|
574
|
+
variant: PropTypes9.oneOf(["condensed", "expanded"])
|
|
1283
575
|
}),
|
|
1284
|
-
signInButton:
|
|
1285
|
-
signOutButton:
|
|
576
|
+
signInButton: PropTypes9.object,
|
|
577
|
+
signOutButton: PropTypes9.object
|
|
1286
578
|
}),
|
|
1287
579
|
/**
|
|
1288
580
|
* The components used for each slot inside.
|
|
1289
581
|
*/
|
|
1290
|
-
slots:
|
|
1291
|
-
popover:
|
|
1292
|
-
popoverContent:
|
|
1293
|
-
preview:
|
|
1294
|
-
signInButton:
|
|
1295
|
-
signOutButton:
|
|
582
|
+
slots: PropTypes9.shape({
|
|
583
|
+
popover: PropTypes9.elementType,
|
|
584
|
+
popoverContent: PropTypes9.elementType,
|
|
585
|
+
preview: PropTypes9.elementType,
|
|
586
|
+
signInButton: PropTypes9.elementType,
|
|
587
|
+
signOutButton: PropTypes9.elementType
|
|
1296
588
|
})
|
|
1297
589
|
};
|
|
1298
|
-
|
|
1299
|
-
// src/toolpad-core/DashboardLayout/DashboardLayout.tsx
|
|
1300
|
-
import * as React25 from "react";
|
|
1301
|
-
import PropTypes11 from "prop-types";
|
|
1302
|
-
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
1303
|
-
import useMediaQuery2 from "@mui/material/useMediaQuery";
|
|
1304
|
-
import Box4 from "@mui/material/Box";
|
|
1305
|
-
import Drawer from "@mui/material/Drawer";
|
|
1306
|
-
import Toolbar2 from "@mui/material/Toolbar";
|
|
1307
|
-
|
|
1308
|
-
// src/toolpad-core/DashboardLayout/DashboardHeader.tsx
|
|
1309
|
-
import * as React21 from "react";
|
|
1310
|
-
import PropTypes9 from "prop-types";
|
|
1311
|
-
import { styled as styled2 } from "@mui/material/styles";
|
|
1312
|
-
import Box2 from "@mui/material/Box";
|
|
1313
|
-
import MuiAppBar from "@mui/material/AppBar";
|
|
1314
|
-
import IconButton4 from "@mui/material/IconButton";
|
|
1315
|
-
import Toolbar from "@mui/material/Toolbar";
|
|
1316
|
-
import Tooltip3 from "@mui/material/Tooltip";
|
|
1317
|
-
import MenuIcon from "@mui/icons-material/Menu";
|
|
1318
|
-
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
|
|
1319
|
-
import Stack6 from "@mui/material/Stack";
|
|
1320
|
-
|
|
1321
|
-
// src/toolpad-core/DashboardLayout/AppTitle.tsx
|
|
1322
|
-
import Typography2 from "@mui/material/Typography";
|
|
1323
|
-
import Stack4 from "@mui/material/Stack";
|
|
1324
|
-
import { styled, useTheme as useTheme2 } from "@mui/material";
|
|
1325
|
-
|
|
1326
|
-
// src/toolpad-core/shared/Link.tsx
|
|
1327
|
-
import * as React17 from "react";
|
|
1328
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1329
|
-
var DefaultLink = React17.forwardRef(function Link(props, ref) {
|
|
590
|
+
var DefaultLink = React16.forwardRef(function Link(props, ref) {
|
|
1330
591
|
const _a = props, { children, href, onClick, history } = _a, rest = __objRest(_a, ["children", "href", "onClick", "history"]);
|
|
1331
|
-
const routerContext =
|
|
1332
|
-
const handleLinkClick =
|
|
592
|
+
const routerContext = React16.useContext(RouterContext);
|
|
593
|
+
const handleLinkClick = React16.useMemo(() => {
|
|
1333
594
|
if (!routerContext) {
|
|
1334
595
|
return onClick;
|
|
1335
596
|
}
|
|
@@ -1340,25 +601,22 @@ var DefaultLink = React17.forwardRef(function Link(props, ref) {
|
|
|
1340
601
|
onClick == null ? void 0 : onClick(event);
|
|
1341
602
|
};
|
|
1342
603
|
}, [routerContext, onClick, history]);
|
|
1343
|
-
return /* @__PURE__ */
|
|
604
|
+
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
|
|
1344
605
|
});
|
|
1345
|
-
var Link2 =
|
|
606
|
+
var Link2 = React16.forwardRef(function Link3(props, ref) {
|
|
1346
607
|
var _a;
|
|
1347
|
-
const routerContext =
|
|
608
|
+
const routerContext = React16.useContext(RouterContext);
|
|
1348
609
|
const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
|
|
1349
|
-
return /* @__PURE__ */
|
|
610
|
+
return /* @__PURE__ */ jsx(LinkComponent, __spreadProps(__spreadValues({ ref }, props), { children: props.children }));
|
|
1350
611
|
});
|
|
1351
|
-
|
|
1352
|
-
// src/toolpad-core/DashboardLayout/ToolpadLogo.tsx
|
|
1353
|
-
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1354
612
|
function ToolpadLogo({ size = 40 }) {
|
|
1355
|
-
return /* @__PURE__ */
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1359
|
-
/* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
614
|
+
/* @__PURE__ */ jsxs("g", { mask: "url(#a)", children: [
|
|
615
|
+
/* @__PURE__ */ jsx("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
|
|
616
|
+
/* @__PURE__ */ jsx("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
|
|
617
|
+
/* @__PURE__ */ 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" })
|
|
1360
618
|
] }),
|
|
1361
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ jsx(
|
|
1362
620
|
"mask",
|
|
1363
621
|
{
|
|
1364
622
|
id: "b",
|
|
@@ -1370,7 +628,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1370
628
|
y: "17",
|
|
1371
629
|
width: "14",
|
|
1372
630
|
height: "15",
|
|
1373
|
-
children: /* @__PURE__ */
|
|
631
|
+
children: /* @__PURE__ */ jsx(
|
|
1374
632
|
"path",
|
|
1375
633
|
{
|
|
1376
634
|
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",
|
|
@@ -1379,12 +637,12 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1379
637
|
)
|
|
1380
638
|
}
|
|
1381
639
|
),
|
|
1382
|
-
/* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
/* @__PURE__ */
|
|
1385
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ jsxs("g", { mask: "url(#b)", children: [
|
|
641
|
+
/* @__PURE__ */ jsx("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
|
|
642
|
+
/* @__PURE__ */ jsx("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
|
|
643
|
+
/* @__PURE__ */ 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" })
|
|
1386
644
|
] }),
|
|
1387
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ jsx(
|
|
1388
646
|
"mask",
|
|
1389
647
|
{
|
|
1390
648
|
id: "c",
|
|
@@ -1396,7 +654,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1396
654
|
y: "4",
|
|
1397
655
|
width: "22",
|
|
1398
656
|
height: "20",
|
|
1399
|
-
children: /* @__PURE__ */
|
|
657
|
+
children: /* @__PURE__ */ jsx(
|
|
1400
658
|
"path",
|
|
1401
659
|
{
|
|
1402
660
|
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",
|
|
@@ -1405,24 +663,18 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
1405
663
|
)
|
|
1406
664
|
}
|
|
1407
665
|
),
|
|
1408
|
-
/* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ jsxs("g", { mask: "url(#c)", children: [
|
|
667
|
+
/* @__PURE__ */ jsx("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
|
|
668
|
+
/* @__PURE__ */ jsx("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
|
|
669
|
+
/* @__PURE__ */ jsx("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
|
|
1412
670
|
] })
|
|
1413
671
|
] });
|
|
1414
672
|
}
|
|
1415
|
-
|
|
1416
|
-
// src/toolpad-core/shared/branding.ts
|
|
1417
|
-
import * as React18 from "react";
|
|
1418
673
|
function useApplicationTitle() {
|
|
1419
674
|
var _a;
|
|
1420
|
-
const branding =
|
|
675
|
+
const branding = React16.useContext(BrandingContext);
|
|
1421
676
|
return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
|
|
1422
677
|
}
|
|
1423
|
-
|
|
1424
|
-
// src/toolpad-core/DashboardLayout/AppTitle.tsx
|
|
1425
|
-
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1426
678
|
var LogoContainer = styled("div")({
|
|
1427
679
|
position: "relative",
|
|
1428
680
|
height: 40,
|
|
@@ -1434,13 +686,13 @@ var LogoContainer = styled("div")({
|
|
|
1434
686
|
});
|
|
1435
687
|
function AppTitle(props) {
|
|
1436
688
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1437
|
-
const theme =
|
|
689
|
+
const theme = useTheme();
|
|
1438
690
|
const defaultTitle = useApplicationTitle();
|
|
1439
691
|
const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
|
|
1440
|
-
return /* @__PURE__ */
|
|
1441
|
-
/* @__PURE__ */
|
|
1442
|
-
/* @__PURE__ */
|
|
1443
|
-
|
|
692
|
+
return /* @__PURE__ */ jsx(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", children: [
|
|
693
|
+
/* @__PURE__ */ jsx(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsx(ToolpadLogo, { size: 40 }) }),
|
|
694
|
+
/* @__PURE__ */ jsx(
|
|
695
|
+
Typography,
|
|
1444
696
|
{
|
|
1445
697
|
variant: "h6",
|
|
1446
698
|
sx: {
|
|
@@ -1455,59 +707,42 @@ function AppTitle(props) {
|
|
|
1455
707
|
)
|
|
1456
708
|
] }) });
|
|
1457
709
|
}
|
|
1458
|
-
|
|
1459
|
-
// src/toolpad-core/DashboardLayout/ToolbarActions.tsx
|
|
1460
|
-
import Stack5 from "@mui/material/Stack";
|
|
1461
|
-
|
|
1462
|
-
// src/toolpad-core/DashboardLayout/ThemeSwitcher.tsx
|
|
1463
|
-
import * as React20 from "react";
|
|
1464
|
-
import { useTheme as useTheme3 } from "@mui/material";
|
|
1465
|
-
import IconButton3 from "@mui/material/IconButton";
|
|
1466
|
-
import Tooltip2 from "@mui/material/Tooltip";
|
|
1467
|
-
import DarkModeIcon from "@mui/icons-material/DarkMode";
|
|
1468
|
-
import LightModeIcon from "@mui/icons-material/LightMode";
|
|
1469
|
-
|
|
1470
|
-
// src/toolpad-utils/hooks/useSsr.ts
|
|
1471
|
-
import * as React19 from "react";
|
|
1472
|
-
function subscribe2() {
|
|
710
|
+
function subscribe() {
|
|
1473
711
|
return () => {
|
|
1474
712
|
};
|
|
1475
713
|
}
|
|
1476
|
-
function
|
|
714
|
+
function getSnapshot() {
|
|
1477
715
|
return false;
|
|
1478
716
|
}
|
|
1479
717
|
function getServerSnapshot() {
|
|
1480
718
|
return true;
|
|
1481
719
|
}
|
|
1482
720
|
function useSsr() {
|
|
1483
|
-
return
|
|
721
|
+
return React16.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1484
722
|
}
|
|
1485
|
-
|
|
1486
|
-
// src/toolpad-core/DashboardLayout/ThemeSwitcher.tsx
|
|
1487
|
-
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1488
723
|
function ThemeSwitcher() {
|
|
1489
724
|
var _a;
|
|
1490
725
|
const isSsr = useSsr();
|
|
1491
|
-
const theme =
|
|
1492
|
-
const { paletteMode, setPaletteMode, isDualTheme } =
|
|
1493
|
-
const toggleMode =
|
|
726
|
+
const theme = useTheme();
|
|
727
|
+
const { paletteMode, setPaletteMode, isDualTheme } = React16.useContext(PaletteModeContext);
|
|
728
|
+
const toggleMode = React16.useCallback(() => {
|
|
1494
729
|
setPaletteMode(paletteMode === "dark" ? "light" : "dark");
|
|
1495
730
|
}, [paletteMode, setPaletteMode]);
|
|
1496
|
-
return isDualTheme ? /* @__PURE__ */
|
|
1497
|
-
|
|
731
|
+
return isDualTheme ? /* @__PURE__ */ jsx(
|
|
732
|
+
Tooltip,
|
|
1498
733
|
{
|
|
1499
734
|
title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
|
|
1500
735
|
enterDelay: 1e3,
|
|
1501
|
-
children: /* @__PURE__ */
|
|
1502
|
-
|
|
736
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
737
|
+
IconButton,
|
|
1503
738
|
{
|
|
1504
739
|
"aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
|
|
1505
740
|
onClick: toggleMode,
|
|
1506
741
|
sx: {
|
|
1507
742
|
color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
|
|
1508
743
|
},
|
|
1509
|
-
children: theme.getColorSchemeSelector ? /* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
744
|
+
children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
745
|
+
/* @__PURE__ */ jsx(
|
|
1511
746
|
DarkModeIcon,
|
|
1512
747
|
{
|
|
1513
748
|
sx: {
|
|
@@ -1518,7 +753,7 @@ function ThemeSwitcher() {
|
|
|
1518
753
|
}
|
|
1519
754
|
}
|
|
1520
755
|
),
|
|
1521
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ jsx(
|
|
1522
757
|
LightModeIcon,
|
|
1523
758
|
{
|
|
1524
759
|
sx: {
|
|
@@ -1529,25 +764,19 @@ function ThemeSwitcher() {
|
|
|
1529
764
|
}
|
|
1530
765
|
}
|
|
1531
766
|
)
|
|
1532
|
-
] }) : /* @__PURE__ */
|
|
767
|
+
] }) : /* @__PURE__ */ jsx(React16.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsx(DarkModeIcon, {}) : /* @__PURE__ */ jsx(LightModeIcon, {}) })
|
|
1533
768
|
}
|
|
1534
769
|
) })
|
|
1535
770
|
}
|
|
1536
771
|
) : null;
|
|
1537
772
|
}
|
|
1538
|
-
|
|
1539
|
-
// src/toolpad-core/DashboardLayout/ToolbarActions.tsx
|
|
1540
|
-
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1541
773
|
function ToolbarActions() {
|
|
1542
|
-
return /* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", children: [
|
|
775
|
+
/* @__PURE__ */ jsx(ThemeSwitcher, {}),
|
|
776
|
+
/* @__PURE__ */ jsx(Account, {})
|
|
1545
777
|
] });
|
|
1546
778
|
}
|
|
1547
|
-
|
|
1548
|
-
// src/toolpad-core/DashboardLayout/DashboardHeader.tsx
|
|
1549
|
-
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1550
|
-
var AppBar = styled2(MuiAppBar)(({ theme }) => {
|
|
779
|
+
var AppBar = styled$1(MuiAppBar)(({ theme }) => {
|
|
1551
780
|
var _a;
|
|
1552
781
|
return {
|
|
1553
782
|
borderWidth: 0,
|
|
@@ -1568,26 +797,26 @@ function DashboardHeader(props) {
|
|
|
1568
797
|
slots,
|
|
1569
798
|
slotProps
|
|
1570
799
|
} = props;
|
|
1571
|
-
const brandingContext =
|
|
800
|
+
const brandingContext = React16.useContext(BrandingContext);
|
|
1572
801
|
const branding = __spreadValues(__spreadValues({}, brandingContext), brandingProp);
|
|
1573
|
-
const handleMenuOpen =
|
|
802
|
+
const handleMenuOpen = React16.useCallback(() => {
|
|
1574
803
|
onToggleMenu(!menuOpen);
|
|
1575
804
|
}, [menuOpen, onToggleMenu]);
|
|
1576
|
-
const getMenuIcon =
|
|
805
|
+
const getMenuIcon = React16.useCallback(
|
|
1577
806
|
(isExpanded) => {
|
|
1578
807
|
const expandMenuActionText = "Expand";
|
|
1579
808
|
const collapseMenuActionText = "Collapse";
|
|
1580
|
-
return /* @__PURE__ */
|
|
1581
|
-
|
|
809
|
+
return /* @__PURE__ */ jsx(
|
|
810
|
+
Tooltip,
|
|
1582
811
|
{
|
|
1583
812
|
title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
|
|
1584
813
|
enterDelay: 1e3,
|
|
1585
|
-
children: /* @__PURE__ */
|
|
1586
|
-
|
|
814
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
815
|
+
IconButton,
|
|
1587
816
|
{
|
|
1588
817
|
"aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
|
|
1589
818
|
onClick: handleMenuOpen,
|
|
1590
|
-
children: isExpanded ? /* @__PURE__ */
|
|
819
|
+
children: isExpanded ? /* @__PURE__ */ jsx(MenuOpenIcon, {}) : /* @__PURE__ */ jsx(MenuIcon, {})
|
|
1591
820
|
}
|
|
1592
821
|
) })
|
|
1593
822
|
}
|
|
@@ -1597,8 +826,8 @@ function DashboardHeader(props) {
|
|
|
1597
826
|
);
|
|
1598
827
|
const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
|
|
1599
828
|
const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
|
|
1600
|
-
return /* @__PURE__ */
|
|
1601
|
-
|
|
829
|
+
return /* @__PURE__ */ jsx(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsx(Toolbar2, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxs(
|
|
830
|
+
Stack,
|
|
1602
831
|
{
|
|
1603
832
|
direction: "row",
|
|
1604
833
|
justifyContent: "space-between",
|
|
@@ -1608,10 +837,10 @@ function DashboardHeader(props) {
|
|
|
1608
837
|
width: "100%"
|
|
1609
838
|
},
|
|
1610
839
|
children: [
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
!hideMenuButton ? /* @__PURE__ */
|
|
1613
|
-
/* @__PURE__ */
|
|
1614
|
-
|
|
840
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
|
|
841
|
+
!hideMenuButton ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
842
|
+
/* @__PURE__ */ jsx(
|
|
843
|
+
Box4,
|
|
1615
844
|
{
|
|
1616
845
|
sx: {
|
|
1617
846
|
display: { xs: "block", md: "none" },
|
|
@@ -1620,8 +849,8 @@ function DashboardHeader(props) {
|
|
|
1620
849
|
children: getMenuIcon(menuOpen)
|
|
1621
850
|
}
|
|
1622
851
|
),
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
|
|
852
|
+
/* @__PURE__ */ jsx(
|
|
853
|
+
Box4,
|
|
1625
854
|
{
|
|
1626
855
|
sx: {
|
|
1627
856
|
display: { xs: "none", md: "block" },
|
|
@@ -1631,18 +860,18 @@ function DashboardHeader(props) {
|
|
|
1631
860
|
}
|
|
1632
861
|
)
|
|
1633
862
|
] }) : null,
|
|
1634
|
-
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */
|
|
863
|
+
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsx(slots.appTitle, __spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
|
|
1635
864
|
/* Hierarchy of application of `branding`
|
|
1636
865
|
* 1. Branding prop passed in the `slotProps.appTitle`
|
|
1637
866
|
* 2. Branding prop passed to the `DashboardLayout`
|
|
1638
867
|
* 3. Branding prop passed to the `AppProvider`
|
|
1639
868
|
*/
|
|
1640
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsx(AppTitle, __spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
|
|
1641
870
|
)
|
|
1642
871
|
] }),
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
|
|
873
|
+
/* @__PURE__ */ jsx(ToolbarActionsSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
|
|
874
|
+
/* @__PURE__ */ jsx(ToolbarAccountSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
|
|
1646
875
|
] })
|
|
1647
876
|
]
|
|
1648
877
|
}
|
|
@@ -1716,16 +945,6 @@ DashboardHeader.propTypes = {
|
|
|
1716
945
|
toolbarActions: PropTypes9.elementType
|
|
1717
946
|
})
|
|
1718
947
|
};
|
|
1719
|
-
|
|
1720
|
-
// src/toolpad-core/DashboardLayout/DashboardSidebarSubNavigation.tsx
|
|
1721
|
-
import * as React24 from "react";
|
|
1722
|
-
import Divider2 from "@mui/material/Divider";
|
|
1723
|
-
import List from "@mui/material/List";
|
|
1724
|
-
import ListSubheader from "@mui/material/ListSubheader";
|
|
1725
|
-
|
|
1726
|
-
// src/toolpad-core/shared/navigation.tsx
|
|
1727
|
-
import { pathToRegexp } from "path-to-regexp";
|
|
1728
|
-
import invariant4 from "invariant";
|
|
1729
948
|
var getItemKind = (item) => {
|
|
1730
949
|
var _a;
|
|
1731
950
|
return (_a = item.kind) != null ? _a : "page";
|
|
@@ -1811,7 +1030,7 @@ function matchPath(navigation, path) {
|
|
|
1811
1030
|
function getItemPath(navigation, item) {
|
|
1812
1031
|
const map = getItemToPathMap(navigation);
|
|
1813
1032
|
const path = map.get(item);
|
|
1814
|
-
|
|
1033
|
+
invariant(path, `Item not found in navigation: ${item.title}`);
|
|
1815
1034
|
return path;
|
|
1816
1035
|
}
|
|
1817
1036
|
function hasSelectedNavigationChildren(navigation, item, activePagePath) {
|
|
@@ -1843,17 +1062,14 @@ function getDrawerWidthTransitionMixin(isExpanded) {
|
|
|
1843
1062
|
overflowX: "hidden"
|
|
1844
1063
|
});
|
|
1845
1064
|
}
|
|
1846
|
-
|
|
1847
|
-
// src/toolpad-core/useActivePage/useActivePage.ts
|
|
1848
|
-
import * as React22 from "react";
|
|
1849
1065
|
function useActivePage() {
|
|
1850
1066
|
var _a;
|
|
1851
|
-
const navigationContext =
|
|
1852
|
-
const routerContext =
|
|
1067
|
+
const navigationContext = React16.useContext(NavigationContext);
|
|
1068
|
+
const routerContext = React16.useContext(RouterContext);
|
|
1853
1069
|
const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
|
|
1854
1070
|
const activeItem = matchPath(navigationContext, pathname);
|
|
1855
1071
|
const rootItem = matchPath(navigationContext, "/");
|
|
1856
|
-
return
|
|
1072
|
+
return React16.useMemo(() => {
|
|
1857
1073
|
if (!activeItem) {
|
|
1858
1074
|
return null;
|
|
1859
1075
|
}
|
|
@@ -1890,29 +1106,9 @@ function useActivePage() {
|
|
|
1890
1106
|
}, [activeItem, rootItem, pathname, navigationContext]);
|
|
1891
1107
|
}
|
|
1892
1108
|
|
|
1893
|
-
// src/toolpad-core/DashboardLayout/DashboardSidebarPageItem.tsx
|
|
1894
|
-
import * as React23 from "react";
|
|
1895
|
-
import PropTypes10 from "prop-types";
|
|
1896
|
-
import { styled as styled3 } from "@mui/material";
|
|
1897
|
-
import Avatar2 from "@mui/material/Avatar";
|
|
1898
|
-
import Box3 from "@mui/material/Box";
|
|
1899
|
-
import Collapse from "@mui/material/Collapse";
|
|
1900
|
-
import Grow from "@mui/material/Grow";
|
|
1901
|
-
import ListItem from "@mui/material/ListItem";
|
|
1902
|
-
import ListItemButton from "@mui/material/ListItemButton";
|
|
1903
|
-
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
1904
|
-
import ListItemText from "@mui/material/ListItemText";
|
|
1905
|
-
import Paper from "@mui/material/Paper";
|
|
1906
|
-
import Typography3 from "@mui/material/Typography";
|
|
1907
|
-
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
1908
|
-
import invariant5 from "invariant";
|
|
1909
|
-
|
|
1910
1109
|
// src/toolpad-core/DashboardLayout/shared.ts
|
|
1911
1110
|
var MINI_DRAWER_WIDTH = 84;
|
|
1912
|
-
|
|
1913
|
-
// src/toolpad-core/DashboardLayout/DashboardSidebarPageItem.tsx
|
|
1914
|
-
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1915
|
-
var NavigationListItemButton = styled3(ListItemButton)(({ theme }) => {
|
|
1111
|
+
var NavigationListItemButton = styled(ListItemButton)(({ theme }) => {
|
|
1916
1112
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1917
1113
|
return {
|
|
1918
1114
|
borderRadius: 8,
|
|
@@ -1944,9 +1140,9 @@ var NavigationListItemButton = styled3(ListItemButton)(({ theme }) => {
|
|
|
1944
1140
|
var LIST_ITEM_ICON_SIZE = 34;
|
|
1945
1141
|
function DashboardSidebarPageItem(props) {
|
|
1946
1142
|
var _a;
|
|
1947
|
-
const navigationContext =
|
|
1948
|
-
const pageItemContextProps =
|
|
1949
|
-
|
|
1143
|
+
const navigationContext = React16.useContext(NavigationContext);
|
|
1144
|
+
const pageItemContextProps = React16.useContext(DashboardSidebarPageItemContext);
|
|
1145
|
+
invariant(pageItemContextProps, "No navigation page item context provided.");
|
|
1950
1146
|
const contextAwareProps = __spreadValues(__spreadValues({}, pageItemContextProps), props);
|
|
1951
1147
|
const {
|
|
1952
1148
|
item,
|
|
@@ -1962,10 +1158,10 @@ function DashboardSidebarPageItem(props) {
|
|
|
1962
1158
|
isSidebarFullyCollapsed = false,
|
|
1963
1159
|
renderNestedNavigation
|
|
1964
1160
|
} = contextAwareProps;
|
|
1965
|
-
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] =
|
|
1161
|
+
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React16.useState(
|
|
1966
1162
|
null
|
|
1967
1163
|
);
|
|
1968
|
-
const handleClick =
|
|
1164
|
+
const handleClick = React16.useCallback(() => {
|
|
1969
1165
|
onClick(id, item);
|
|
1970
1166
|
}, [id, item, onClick]);
|
|
1971
1167
|
let nestedNavigationCollapseSx = { display: "none" };
|
|
@@ -1990,7 +1186,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1990
1186
|
const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
|
|
1991
1187
|
const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
|
|
1992
1188
|
const title = getItemTitle(item);
|
|
1993
|
-
const listItem = /* @__PURE__ */
|
|
1189
|
+
const listItem = /* @__PURE__ */ jsxs(
|
|
1994
1190
|
ListItem,
|
|
1995
1191
|
__spreadProps(__spreadValues({}, item.children && isMini ? {
|
|
1996
1192
|
onMouseEnter: () => {
|
|
@@ -2006,7 +1202,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
2006
1202
|
overflowX: "hidden"
|
|
2007
1203
|
},
|
|
2008
1204
|
children: [
|
|
2009
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ jsxs(
|
|
2010
1206
|
NavigationListItemButton,
|
|
2011
1207
|
__spreadProps(__spreadValues(__spreadValues({
|
|
2012
1208
|
selected,
|
|
@@ -2027,8 +1223,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2027
1223
|
onClick: handleClick
|
|
2028
1224
|
}) : {}), {
|
|
2029
1225
|
children: [
|
|
2030
|
-
item.icon || isMini ? /* @__PURE__ */
|
|
2031
|
-
|
|
1226
|
+
item.icon || isMini ? /* @__PURE__ */ jsxs(
|
|
1227
|
+
Box4,
|
|
2032
1228
|
{
|
|
2033
1229
|
sx: isMini ? {
|
|
2034
1230
|
position: "absolute",
|
|
@@ -2037,7 +1233,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
2037
1233
|
transform: "translate(-50%, -50%)"
|
|
2038
1234
|
} : {},
|
|
2039
1235
|
children: [
|
|
2040
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsxs(
|
|
2041
1237
|
ListItemIcon,
|
|
2042
1238
|
{
|
|
2043
1239
|
sx: {
|
|
@@ -2048,8 +1244,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2048
1244
|
},
|
|
2049
1245
|
children: [
|
|
2050
1246
|
(_a = item.icon) != null ? _a : null,
|
|
2051
|
-
!item.icon && isMini ? /* @__PURE__ */
|
|
2052
|
-
|
|
1247
|
+
!item.icon && isMini ? /* @__PURE__ */ jsx(
|
|
1248
|
+
Avatar,
|
|
2053
1249
|
{
|
|
2054
1250
|
sx: {
|
|
2055
1251
|
width: LIST_ITEM_ICON_SIZE - 7,
|
|
@@ -2062,8 +1258,8 @@ function DashboardSidebarPageItem(props) {
|
|
|
2062
1258
|
]
|
|
2063
1259
|
}
|
|
2064
1260
|
),
|
|
2065
|
-
isMini ? /* @__PURE__ */
|
|
2066
|
-
|
|
1261
|
+
isMini ? /* @__PURE__ */ jsx(
|
|
1262
|
+
Typography,
|
|
2067
1263
|
{
|
|
2068
1264
|
variant: "caption",
|
|
2069
1265
|
sx: {
|
|
@@ -2085,7 +1281,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
2085
1281
|
]
|
|
2086
1282
|
}
|
|
2087
1283
|
) : null,
|
|
2088
|
-
!isMini ? /* @__PURE__ */
|
|
1284
|
+
!isMini ? /* @__PURE__ */ jsx(
|
|
2089
1285
|
ListItemText,
|
|
2090
1286
|
{
|
|
2091
1287
|
primary: title,
|
|
@@ -2097,19 +1293,19 @@ function DashboardSidebarPageItem(props) {
|
|
|
2097
1293
|
}
|
|
2098
1294
|
) : null,
|
|
2099
1295
|
item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
|
|
2100
|
-
item.children ? /* @__PURE__ */
|
|
1296
|
+
item.children ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: nestedNavigationCollapseSx }) : null
|
|
2101
1297
|
]
|
|
2102
1298
|
})
|
|
2103
1299
|
),
|
|
2104
|
-
item.children && isMini ? /* @__PURE__ */
|
|
2105
|
-
|
|
1300
|
+
item.children && isMini ? /* @__PURE__ */ jsx(Grow, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsx(
|
|
1301
|
+
Box4,
|
|
2106
1302
|
{
|
|
2107
1303
|
sx: {
|
|
2108
1304
|
position: "fixed",
|
|
2109
1305
|
left: MINI_DRAWER_WIDTH - 2,
|
|
2110
1306
|
pl: "6px"
|
|
2111
1307
|
},
|
|
2112
|
-
children: /* @__PURE__ */
|
|
1308
|
+
children: /* @__PURE__ */ jsx(
|
|
2113
1309
|
Paper,
|
|
2114
1310
|
{
|
|
2115
1311
|
sx: {
|
|
@@ -2125,9 +1321,9 @@ function DashboardSidebarPageItem(props) {
|
|
|
2125
1321
|
]
|
|
2126
1322
|
})
|
|
2127
1323
|
);
|
|
2128
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
2129
1325
|
listItem,
|
|
2130
|
-
item.children && !isMini ? /* @__PURE__ */
|
|
1326
|
+
item.children && !isMini ? /* @__PURE__ */ jsx(Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
|
|
2131
1327
|
] }, id);
|
|
2132
1328
|
}
|
|
2133
1329
|
DashboardSidebarPageItem.propTypes = {
|
|
@@ -2139,54 +1335,51 @@ DashboardSidebarPageItem.propTypes = {
|
|
|
2139
1335
|
* If `true`, the item is disabled.
|
|
2140
1336
|
* @default false
|
|
2141
1337
|
*/
|
|
2142
|
-
disabled:
|
|
1338
|
+
disabled: PropTypes9.bool,
|
|
2143
1339
|
/**
|
|
2144
1340
|
* If `true`, expands any nested navigation in the item, otherwise collapse it.
|
|
2145
1341
|
* @default false
|
|
2146
1342
|
*/
|
|
2147
|
-
expanded:
|
|
1343
|
+
expanded: PropTypes9.bool,
|
|
2148
1344
|
/**
|
|
2149
1345
|
* Link `href` for when the item is rendered as a link.
|
|
2150
1346
|
* @default getItemPath(navigationContext, item)
|
|
2151
1347
|
*/
|
|
2152
|
-
href:
|
|
1348
|
+
href: PropTypes9.string,
|
|
2153
1349
|
/**
|
|
2154
1350
|
* Navigation page item definition.
|
|
2155
1351
|
*/
|
|
2156
|
-
item:
|
|
2157
|
-
action:
|
|
2158
|
-
children:
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
kind:
|
|
2163
|
-
title:
|
|
1352
|
+
item: PropTypes9.shape({
|
|
1353
|
+
action: PropTypes9.node,
|
|
1354
|
+
children: PropTypes9.arrayOf(
|
|
1355
|
+
PropTypes9.oneOfType([
|
|
1356
|
+
PropTypes9.object,
|
|
1357
|
+
PropTypes9.shape({
|
|
1358
|
+
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1359
|
+
title: PropTypes9.string.isRequired
|
|
2164
1360
|
}),
|
|
2165
|
-
|
|
2166
|
-
kind:
|
|
1361
|
+
PropTypes9.shape({
|
|
1362
|
+
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
2167
1363
|
})
|
|
2168
1364
|
]).isRequired
|
|
2169
1365
|
),
|
|
2170
|
-
icon:
|
|
2171
|
-
kind:
|
|
2172
|
-
pattern:
|
|
2173
|
-
segment:
|
|
2174
|
-
title:
|
|
1366
|
+
icon: PropTypes9.node,
|
|
1367
|
+
kind: PropTypes9.oneOf(["page"]),
|
|
1368
|
+
pattern: PropTypes9.string,
|
|
1369
|
+
segment: PropTypes9.string,
|
|
1370
|
+
title: PropTypes9.string
|
|
2175
1371
|
}).isRequired,
|
|
2176
1372
|
/**
|
|
2177
1373
|
* The component used to render the item as a link.
|
|
2178
1374
|
* @default Link
|
|
2179
1375
|
*/
|
|
2180
|
-
LinkComponent:
|
|
1376
|
+
LinkComponent: PropTypes9.elementType,
|
|
2181
1377
|
/**
|
|
2182
1378
|
* Use to apply selected styling.
|
|
2183
1379
|
* @default false
|
|
2184
1380
|
*/
|
|
2185
|
-
selected:
|
|
1381
|
+
selected: PropTypes9.bool
|
|
2186
1382
|
};
|
|
2187
|
-
|
|
2188
|
-
// src/toolpad-core/DashboardLayout/DashboardSidebarSubNavigation.tsx
|
|
2189
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2190
1383
|
function DashboardSidebarSubNavigationPageItem({
|
|
2191
1384
|
id,
|
|
2192
1385
|
item,
|
|
@@ -2200,11 +1393,11 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2200
1393
|
sidebarExpandedWidth,
|
|
2201
1394
|
renderPageItem
|
|
2202
1395
|
}) {
|
|
2203
|
-
const navigationContext =
|
|
1396
|
+
const navigationContext = React16.useContext(NavigationContext);
|
|
2204
1397
|
const activePage = useActivePage();
|
|
2205
1398
|
const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
|
|
2206
1399
|
const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
|
|
2207
|
-
const pageItemContextProps =
|
|
1400
|
+
const pageItemContextProps = React16.useMemo(
|
|
2208
1401
|
() => ({
|
|
2209
1402
|
expanded: isExpanded,
|
|
2210
1403
|
selected: isSelected,
|
|
@@ -2215,7 +1408,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2215
1408
|
isSidebarFullyCollapsed: isFullyCollapsed,
|
|
2216
1409
|
renderNestedNavigation: () => {
|
|
2217
1410
|
var _a;
|
|
2218
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx(
|
|
2219
1412
|
DashboardSidebarSubNavigation,
|
|
2220
1413
|
{
|
|
2221
1414
|
subNavigation: (_a = item.children) != null ? _a : [],
|
|
@@ -2241,7 +1434,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
2241
1434
|
sidebarExpandedWidth
|
|
2242
1435
|
]
|
|
2243
1436
|
);
|
|
2244
|
-
return /* @__PURE__ */
|
|
1437
|
+
return /* @__PURE__ */ jsx(DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsx(DashboardSidebarPageItem, { item }) });
|
|
2245
1438
|
}
|
|
2246
1439
|
function DashboardSidebarSubNavigation({
|
|
2247
1440
|
subNavigation,
|
|
@@ -2255,9 +1448,9 @@ function DashboardSidebarSubNavigation({
|
|
|
2255
1448
|
sidebarExpandedWidth,
|
|
2256
1449
|
renderPageItem
|
|
2257
1450
|
}) {
|
|
2258
|
-
const navigationContext =
|
|
1451
|
+
const navigationContext = React16.useContext(NavigationContext);
|
|
2259
1452
|
const activePage = useActivePage();
|
|
2260
|
-
const initialExpandedItemIds =
|
|
1453
|
+
const initialExpandedItemIds = React16.useMemo(
|
|
2261
1454
|
() => subNavigation.map((navigationItem, navigationItemIndex) => ({
|
|
2262
1455
|
navigationItem,
|
|
2263
1456
|
originalIndex: navigationItemIndex
|
|
@@ -2266,8 +1459,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2266
1459
|
).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
|
|
2267
1460
|
[activePage, depth, navigationContext, subNavigation]
|
|
2268
1461
|
);
|
|
2269
|
-
const [expandedItemIds, setExpandedItemIds] =
|
|
2270
|
-
const handlePageItemClick =
|
|
1462
|
+
const [expandedItemIds, setExpandedItemIds] = React16.useState(initialExpandedItemIds);
|
|
1463
|
+
const handlePageItemClick = React16.useCallback(
|
|
2271
1464
|
(itemId, item) => {
|
|
2272
1465
|
if (item.children && !isMini) {
|
|
2273
1466
|
setExpandedItemIds(
|
|
@@ -2279,7 +1472,7 @@ function DashboardSidebarSubNavigation({
|
|
|
2279
1472
|
},
|
|
2280
1473
|
[isMini, onLinkClick]
|
|
2281
1474
|
);
|
|
2282
|
-
return /* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ jsx(
|
|
2283
1476
|
List,
|
|
2284
1477
|
{
|
|
2285
1478
|
sx: {
|
|
@@ -2292,7 +1485,7 @@ function DashboardSidebarSubNavigation({
|
|
|
2292
1485
|
},
|
|
2293
1486
|
children: subNavigation.map((navigationItem, navigationItemIndex) => {
|
|
2294
1487
|
if (navigationItem.kind === "header") {
|
|
2295
|
-
return /* @__PURE__ */
|
|
1488
|
+
return /* @__PURE__ */ jsx(
|
|
2296
1489
|
ListSubheader,
|
|
2297
1490
|
{
|
|
2298
1491
|
sx: __spreadProps(__spreadValues({
|
|
@@ -2314,8 +1507,8 @@ function DashboardSidebarSubNavigation({
|
|
|
2314
1507
|
}
|
|
2315
1508
|
if (navigationItem.kind === "divider") {
|
|
2316
1509
|
const nextItem = subNavigation[navigationItemIndex + 1];
|
|
2317
|
-
return /* @__PURE__ */
|
|
2318
|
-
|
|
1510
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
1511
|
+
Divider,
|
|
2319
1512
|
{
|
|
2320
1513
|
sx: __spreadValues({
|
|
2321
1514
|
borderBottomWidth: 2,
|
|
@@ -2327,7 +1520,7 @@ function DashboardSidebarSubNavigation({
|
|
|
2327
1520
|
) }, `divider-${depth}-${navigationItemIndex}`);
|
|
2328
1521
|
}
|
|
2329
1522
|
const pageItemId = `page-${depth}-${navigationItemIndex}`;
|
|
2330
|
-
return /* @__PURE__ */
|
|
1523
|
+
return /* @__PURE__ */ jsx(
|
|
2331
1524
|
DashboardSidebarSubNavigationPageItem,
|
|
2332
1525
|
{
|
|
2333
1526
|
id: pageItemId,
|
|
@@ -2348,9 +1541,6 @@ function DashboardSidebarSubNavigation({
|
|
|
2348
1541
|
}
|
|
2349
1542
|
);
|
|
2350
1543
|
}
|
|
2351
|
-
|
|
2352
|
-
// src/toolpad-core/DashboardLayout/DashboardLayout.tsx
|
|
2353
|
-
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2354
1544
|
function DashboardLayout(props) {
|
|
2355
1545
|
var _a, _b;
|
|
2356
1546
|
const {
|
|
@@ -2371,26 +1561,26 @@ function DashboardLayout(props) {
|
|
|
2371
1561
|
"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)."
|
|
2372
1562
|
);
|
|
2373
1563
|
}
|
|
2374
|
-
const theme =
|
|
2375
|
-
const navigationContext =
|
|
2376
|
-
const appWindowContext =
|
|
1564
|
+
const theme = useTheme$1();
|
|
1565
|
+
const navigationContext = React16.useContext(NavigationContext);
|
|
1566
|
+
const appWindowContext = React16.useContext(WindowContext);
|
|
2377
1567
|
const navigation = navigationProp != null ? navigationProp : navigationContext;
|
|
2378
|
-
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] =
|
|
2379
|
-
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] =
|
|
2380
|
-
const isOverSmViewport =
|
|
1568
|
+
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React16.useState(!defaultSidebarCollapsed);
|
|
1569
|
+
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React16.useState(false);
|
|
1570
|
+
const isOverSmViewport = useMediaQuery(
|
|
2381
1571
|
theme.breakpoints.up("sm"),
|
|
2382
1572
|
appWindowContext && {
|
|
2383
1573
|
matchMedia: appWindowContext.matchMedia
|
|
2384
1574
|
}
|
|
2385
1575
|
);
|
|
2386
|
-
const isOverMdViewport =
|
|
1576
|
+
const isOverMdViewport = useMediaQuery(
|
|
2387
1577
|
theme.breakpoints.up("md"),
|
|
2388
1578
|
appWindowContext && {
|
|
2389
1579
|
matchMedia: appWindowContext.matchMedia
|
|
2390
1580
|
}
|
|
2391
1581
|
);
|
|
2392
1582
|
const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
|
|
2393
|
-
const setIsNavigationExpanded =
|
|
1583
|
+
const setIsNavigationExpanded = React16.useCallback(
|
|
2394
1584
|
(newExpanded) => {
|
|
2395
1585
|
if (isOverMdViewport) {
|
|
2396
1586
|
setIsDesktopNavigationExpanded(newExpanded);
|
|
@@ -2400,9 +1590,9 @@ function DashboardLayout(props) {
|
|
|
2400
1590
|
},
|
|
2401
1591
|
[isOverMdViewport]
|
|
2402
1592
|
);
|
|
2403
|
-
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] =
|
|
2404
|
-
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] =
|
|
2405
|
-
|
|
1593
|
+
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React16.useState(isNavigationExpanded);
|
|
1594
|
+
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React16.useState(!isNavigationExpanded);
|
|
1595
|
+
React16.useEffect(() => {
|
|
2406
1596
|
if (isNavigationExpanded) {
|
|
2407
1597
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
2408
1598
|
setIsNavigationFullyExpanded(true);
|
|
@@ -2413,7 +1603,7 @@ function DashboardLayout(props) {
|
|
|
2413
1603
|
return () => {
|
|
2414
1604
|
};
|
|
2415
1605
|
}, [isNavigationExpanded, theme]);
|
|
2416
|
-
|
|
1606
|
+
React16.useEffect(() => {
|
|
2417
1607
|
if (!isNavigationExpanded) {
|
|
2418
1608
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
2419
1609
|
setIsNavigationFullyCollapsed(true);
|
|
@@ -2424,19 +1614,19 @@ function DashboardLayout(props) {
|
|
|
2424
1614
|
return () => {
|
|
2425
1615
|
};
|
|
2426
1616
|
}, [isNavigationExpanded, theme]);
|
|
2427
|
-
const handleSetNavigationExpanded =
|
|
1617
|
+
const handleSetNavigationExpanded = React16.useCallback(
|
|
2428
1618
|
(newExpanded) => () => {
|
|
2429
1619
|
setIsNavigationExpanded(newExpanded);
|
|
2430
1620
|
},
|
|
2431
1621
|
[setIsNavigationExpanded]
|
|
2432
1622
|
);
|
|
2433
|
-
const handleToggleHeaderMenu =
|
|
1623
|
+
const handleToggleHeaderMenu = React16.useCallback(
|
|
2434
1624
|
(isExpanded) => {
|
|
2435
1625
|
setIsNavigationExpanded(isExpanded);
|
|
2436
1626
|
},
|
|
2437
1627
|
[setIsNavigationExpanded]
|
|
2438
1628
|
);
|
|
2439
|
-
const handleNavigationLinkClick =
|
|
1629
|
+
const handleNavigationLinkClick = React16.useCallback(() => {
|
|
2440
1630
|
setIsMobileNavigationExpanded(false);
|
|
2441
1631
|
}, [setIsMobileNavigationExpanded]);
|
|
2442
1632
|
const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
|
|
@@ -2444,7 +1634,7 @@ function DashboardLayout(props) {
|
|
|
2444
1634
|
const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
|
|
2445
1635
|
const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
|
|
2446
1636
|
const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
|
|
2447
|
-
const headerSlotProps =
|
|
1637
|
+
const headerSlotProps = React16.useMemo(
|
|
2448
1638
|
() => __spreadValues({
|
|
2449
1639
|
branding,
|
|
2450
1640
|
menuOpen: isNavigationExpanded,
|
|
@@ -2472,12 +1662,12 @@ function DashboardLayout(props) {
|
|
|
2472
1662
|
slots
|
|
2473
1663
|
]
|
|
2474
1664
|
);
|
|
2475
|
-
const getDrawerContent =
|
|
1665
|
+
const getDrawerContent = React16.useCallback(
|
|
2476
1666
|
(isMini, viewport) => {
|
|
2477
1667
|
var _a2;
|
|
2478
|
-
return /* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
1668
|
+
return /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1669
|
+
/* @__PURE__ */ jsx(Toolbar2, {}),
|
|
1670
|
+
/* @__PURE__ */ jsxs(
|
|
2481
1671
|
Box4,
|
|
2482
1672
|
{
|
|
2483
1673
|
component: "nav",
|
|
@@ -2493,7 +1683,7 @@ function DashboardLayout(props) {
|
|
|
2493
1683
|
pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
|
|
2494
1684
|
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
|
|
2495
1685
|
children: [
|
|
2496
|
-
/* @__PURE__ */
|
|
1686
|
+
/* @__PURE__ */ jsx(
|
|
2497
1687
|
DashboardSidebarSubNavigation,
|
|
2498
1688
|
{
|
|
2499
1689
|
subNavigation: navigation,
|
|
@@ -2506,7 +1696,7 @@ function DashboardLayout(props) {
|
|
|
2506
1696
|
renderPageItem
|
|
2507
1697
|
}
|
|
2508
1698
|
),
|
|
2509
|
-
SidebarFooterSlot ? /* @__PURE__ */
|
|
1699
|
+
SidebarFooterSlot ? /* @__PURE__ */ jsx(SidebarFooterSlot, __spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
|
|
2510
1700
|
]
|
|
2511
1701
|
}
|
|
2512
1702
|
)
|
|
@@ -2524,7 +1714,7 @@ function DashboardLayout(props) {
|
|
|
2524
1714
|
slotProps == null ? void 0 : slotProps.sidebarFooter
|
|
2525
1715
|
]
|
|
2526
1716
|
);
|
|
2527
|
-
const getDrawerSharedSx =
|
|
1717
|
+
const getDrawerSharedSx = React16.useCallback(
|
|
2528
1718
|
(isMini, isTemporary) => {
|
|
2529
1719
|
const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
|
|
2530
1720
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
@@ -2542,7 +1732,7 @@ function DashboardLayout(props) {
|
|
|
2542
1732
|
},
|
|
2543
1733
|
[isNavigationExpanded, sidebarExpandedWidth]
|
|
2544
1734
|
);
|
|
2545
|
-
return /* @__PURE__ */
|
|
1735
|
+
return /* @__PURE__ */ jsxs(
|
|
2546
1736
|
Box4,
|
|
2547
1737
|
{
|
|
2548
1738
|
sx: __spreadValues({
|
|
@@ -2553,9 +1743,9 @@ function DashboardLayout(props) {
|
|
|
2553
1743
|
width: "100vw"
|
|
2554
1744
|
}, sx),
|
|
2555
1745
|
children: [
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
!hideNavigation ? /* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsx(HeaderSlot, __spreadValues({}, headerSlotProps)),
|
|
1747
|
+
!hideNavigation ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1748
|
+
/* @__PURE__ */ jsx(
|
|
2559
1749
|
Drawer,
|
|
2560
1750
|
{
|
|
2561
1751
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
@@ -2576,7 +1766,7 @@ function DashboardLayout(props) {
|
|
|
2576
1766
|
children: getDrawerContent(false, "phone")
|
|
2577
1767
|
}
|
|
2578
1768
|
),
|
|
2579
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx(
|
|
2580
1770
|
Drawer,
|
|
2581
1771
|
{
|
|
2582
1772
|
variant: "permanent",
|
|
@@ -2590,7 +1780,7 @@ function DashboardLayout(props) {
|
|
|
2590
1780
|
children: getDrawerContent(isMobileMini, "tablet")
|
|
2591
1781
|
}
|
|
2592
1782
|
),
|
|
2593
|
-
/* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsx(
|
|
2594
1784
|
Drawer,
|
|
2595
1785
|
{
|
|
2596
1786
|
variant: "permanent",
|
|
@@ -2601,7 +1791,7 @@ function DashboardLayout(props) {
|
|
|
2601
1791
|
}
|
|
2602
1792
|
)
|
|
2603
1793
|
] }) : null,
|
|
2604
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ jsxs(
|
|
2605
1795
|
Box4,
|
|
2606
1796
|
{
|
|
2607
1797
|
sx: {
|
|
@@ -2611,8 +1801,8 @@ function DashboardLayout(props) {
|
|
|
2611
1801
|
minWidth: 0
|
|
2612
1802
|
},
|
|
2613
1803
|
children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ jsx(Toolbar2, { sx: { displayPrint: "none" } }),
|
|
1805
|
+
/* @__PURE__ */ jsx(
|
|
2616
1806
|
Box4,
|
|
2617
1807
|
{
|
|
2618
1808
|
component: "main",
|
|
@@ -2641,63 +1831,63 @@ DashboardLayout.propTypes = {
|
|
|
2641
1831
|
* Branding options for the dashboard.
|
|
2642
1832
|
* @default null
|
|
2643
1833
|
*/
|
|
2644
|
-
branding:
|
|
2645
|
-
homeUrl:
|
|
2646
|
-
logo:
|
|
2647
|
-
title:
|
|
1834
|
+
branding: PropTypes9.shape({
|
|
1835
|
+
homeUrl: PropTypes9.string,
|
|
1836
|
+
logo: PropTypes9.node,
|
|
1837
|
+
title: PropTypes9.string
|
|
2648
1838
|
}),
|
|
2649
1839
|
/**
|
|
2650
1840
|
* The content of the dashboard.
|
|
2651
1841
|
*/
|
|
2652
|
-
children:
|
|
1842
|
+
children: PropTypes9.node,
|
|
2653
1843
|
/**
|
|
2654
1844
|
* Whether the sidebar should start collapsed in desktop size screens.
|
|
2655
1845
|
* @default false
|
|
2656
1846
|
*/
|
|
2657
|
-
defaultSidebarCollapsed:
|
|
1847
|
+
defaultSidebarCollapsed: PropTypes9.bool,
|
|
2658
1848
|
/**
|
|
2659
1849
|
* Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
|
|
2660
1850
|
* @default false
|
|
2661
1851
|
*/
|
|
2662
|
-
disableCollapsibleSidebar:
|
|
1852
|
+
disableCollapsibleSidebar: PropTypes9.bool,
|
|
2663
1853
|
/**
|
|
2664
1854
|
* Whether the navigation bar and menu icon should be hidden.
|
|
2665
1855
|
* @default false
|
|
2666
1856
|
*/
|
|
2667
|
-
hideNavigation:
|
|
1857
|
+
hideNavigation: PropTypes9.bool,
|
|
2668
1858
|
/**
|
|
2669
1859
|
* Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
|
|
2670
1860
|
* @default []
|
|
2671
1861
|
* @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
|
|
2672
1862
|
*/
|
|
2673
|
-
navigation:
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
action:
|
|
2677
|
-
children:
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
kind:
|
|
2682
|
-
title:
|
|
1863
|
+
navigation: PropTypes9.arrayOf(
|
|
1864
|
+
PropTypes9.oneOfType([
|
|
1865
|
+
PropTypes9.shape({
|
|
1866
|
+
action: PropTypes9.node,
|
|
1867
|
+
children: PropTypes9.arrayOf(
|
|
1868
|
+
PropTypes9.oneOfType([
|
|
1869
|
+
PropTypes9.object,
|
|
1870
|
+
PropTypes9.shape({
|
|
1871
|
+
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1872
|
+
title: PropTypes9.string.isRequired
|
|
2683
1873
|
}),
|
|
2684
|
-
|
|
2685
|
-
kind:
|
|
1874
|
+
PropTypes9.shape({
|
|
1875
|
+
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
2686
1876
|
})
|
|
2687
1877
|
]).isRequired
|
|
2688
1878
|
),
|
|
2689
|
-
icon:
|
|
2690
|
-
kind:
|
|
2691
|
-
pattern:
|
|
2692
|
-
segment:
|
|
2693
|
-
title:
|
|
1879
|
+
icon: PropTypes9.node,
|
|
1880
|
+
kind: PropTypes9.oneOf(["page"]),
|
|
1881
|
+
pattern: PropTypes9.string,
|
|
1882
|
+
segment: PropTypes9.string,
|
|
1883
|
+
title: PropTypes9.string
|
|
2694
1884
|
}),
|
|
2695
|
-
|
|
2696
|
-
kind:
|
|
2697
|
-
title:
|
|
1885
|
+
PropTypes9.shape({
|
|
1886
|
+
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1887
|
+
title: PropTypes9.string.isRequired
|
|
2698
1888
|
}),
|
|
2699
|
-
|
|
2700
|
-
kind:
|
|
1889
|
+
PropTypes9.shape({
|
|
1890
|
+
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
2701
1891
|
})
|
|
2702
1892
|
]).isRequired
|
|
2703
1893
|
),
|
|
@@ -2708,107 +1898,87 @@ DashboardLayout.propTypes = {
|
|
|
2708
1898
|
* @param {{ mini: boolean }} params
|
|
2709
1899
|
* @returns {ReactNode}
|
|
2710
1900
|
*/
|
|
2711
|
-
renderPageItem:
|
|
1901
|
+
renderPageItem: PropTypes9.func,
|
|
2712
1902
|
/**
|
|
2713
1903
|
* Width of the sidebar when expanded.
|
|
2714
1904
|
* @default 320
|
|
2715
1905
|
*/
|
|
2716
|
-
sidebarExpandedWidth:
|
|
1906
|
+
sidebarExpandedWidth: PropTypes9.oneOfType([PropTypes9.number, PropTypes9.string]),
|
|
2717
1907
|
/**
|
|
2718
1908
|
* The props used for each slot inside.
|
|
2719
1909
|
* @default {}
|
|
2720
1910
|
*/
|
|
2721
|
-
slotProps:
|
|
2722
|
-
appTitle:
|
|
2723
|
-
branding:
|
|
2724
|
-
homeUrl:
|
|
2725
|
-
logo:
|
|
2726
|
-
title:
|
|
1911
|
+
slotProps: PropTypes9.shape({
|
|
1912
|
+
appTitle: PropTypes9.shape({
|
|
1913
|
+
branding: PropTypes9.shape({
|
|
1914
|
+
homeUrl: PropTypes9.string,
|
|
1915
|
+
logo: PropTypes9.node,
|
|
1916
|
+
title: PropTypes9.string
|
|
2727
1917
|
})
|
|
2728
1918
|
}),
|
|
2729
|
-
header:
|
|
2730
|
-
branding:
|
|
2731
|
-
homeUrl:
|
|
2732
|
-
logo:
|
|
2733
|
-
title:
|
|
1919
|
+
header: PropTypes9.shape({
|
|
1920
|
+
branding: PropTypes9.shape({
|
|
1921
|
+
homeUrl: PropTypes9.string,
|
|
1922
|
+
logo: PropTypes9.node,
|
|
1923
|
+
title: PropTypes9.string
|
|
2734
1924
|
}),
|
|
2735
|
-
hideMenuButton:
|
|
2736
|
-
menuOpen:
|
|
2737
|
-
onToggleMenu:
|
|
2738
|
-
slotProps:
|
|
2739
|
-
appTitle:
|
|
2740
|
-
toolbarAccount:
|
|
2741
|
-
toolbarActions:
|
|
1925
|
+
hideMenuButton: PropTypes9.bool,
|
|
1926
|
+
menuOpen: PropTypes9.bool.isRequired,
|
|
1927
|
+
onToggleMenu: PropTypes9.func.isRequired,
|
|
1928
|
+
slotProps: PropTypes9.shape({
|
|
1929
|
+
appTitle: PropTypes9.object,
|
|
1930
|
+
toolbarAccount: PropTypes9.object,
|
|
1931
|
+
toolbarActions: PropTypes9.object
|
|
2742
1932
|
}),
|
|
2743
|
-
slots:
|
|
2744
|
-
appTitle:
|
|
2745
|
-
toolbarAccount:
|
|
2746
|
-
toolbarActions:
|
|
1933
|
+
slots: PropTypes9.shape({
|
|
1934
|
+
appTitle: PropTypes9.elementType,
|
|
1935
|
+
toolbarAccount: PropTypes9.elementType,
|
|
1936
|
+
toolbarActions: PropTypes9.elementType
|
|
2747
1937
|
})
|
|
2748
1938
|
}),
|
|
2749
|
-
sidebarFooter:
|
|
2750
|
-
mini:
|
|
1939
|
+
sidebarFooter: PropTypes9.shape({
|
|
1940
|
+
mini: PropTypes9.bool.isRequired
|
|
2751
1941
|
}),
|
|
2752
|
-
toolbarAccount:
|
|
2753
|
-
localeText:
|
|
2754
|
-
slotProps:
|
|
2755
|
-
popover:
|
|
2756
|
-
popoverContent:
|
|
2757
|
-
preview:
|
|
2758
|
-
signInButton:
|
|
2759
|
-
signOutButton:
|
|
1942
|
+
toolbarAccount: PropTypes9.shape({
|
|
1943
|
+
localeText: PropTypes9.object,
|
|
1944
|
+
slotProps: PropTypes9.shape({
|
|
1945
|
+
popover: PropTypes9.object,
|
|
1946
|
+
popoverContent: PropTypes9.object,
|
|
1947
|
+
preview: PropTypes9.object,
|
|
1948
|
+
signInButton: PropTypes9.object,
|
|
1949
|
+
signOutButton: PropTypes9.object
|
|
2760
1950
|
}),
|
|
2761
|
-
slots:
|
|
2762
|
-
popover:
|
|
2763
|
-
popoverContent:
|
|
2764
|
-
preview:
|
|
2765
|
-
signInButton:
|
|
2766
|
-
signOutButton:
|
|
1951
|
+
slots: PropTypes9.shape({
|
|
1952
|
+
popover: PropTypes9.elementType,
|
|
1953
|
+
popoverContent: PropTypes9.elementType,
|
|
1954
|
+
preview: PropTypes9.elementType,
|
|
1955
|
+
signInButton: PropTypes9.elementType,
|
|
1956
|
+
signOutButton: PropTypes9.elementType
|
|
2767
1957
|
})
|
|
2768
1958
|
}),
|
|
2769
|
-
toolbarActions:
|
|
1959
|
+
toolbarActions: PropTypes9.object
|
|
2770
1960
|
}),
|
|
2771
1961
|
/**
|
|
2772
1962
|
* The components used for each slot inside.
|
|
2773
1963
|
* @default {}
|
|
2774
1964
|
*/
|
|
2775
|
-
slots:
|
|
2776
|
-
appTitle:
|
|
2777
|
-
header:
|
|
2778
|
-
sidebarFooter:
|
|
2779
|
-
toolbarAccount:
|
|
2780
|
-
toolbarActions:
|
|
1965
|
+
slots: PropTypes9.shape({
|
|
1966
|
+
appTitle: PropTypes9.elementType,
|
|
1967
|
+
header: PropTypes9.elementType,
|
|
1968
|
+
sidebarFooter: PropTypes9.elementType,
|
|
1969
|
+
toolbarAccount: PropTypes9.elementType,
|
|
1970
|
+
toolbarActions: PropTypes9.elementType
|
|
2781
1971
|
}),
|
|
2782
1972
|
/**
|
|
2783
1973
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2784
1974
|
*/
|
|
2785
|
-
sx:
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
1975
|
+
sx: PropTypes9.oneOfType([
|
|
1976
|
+
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
1977
|
+
PropTypes9.func,
|
|
1978
|
+
PropTypes9.object
|
|
2789
1979
|
])
|
|
2790
1980
|
};
|
|
2791
|
-
|
|
2792
|
-
// src/toolpad-core/PageContainer/PageContainer.tsx
|
|
2793
|
-
import PropTypes14 from "prop-types";
|
|
2794
|
-
import Box5 from "@mui/material/Box";
|
|
2795
|
-
import Container from "@mui/material/Container";
|
|
2796
|
-
import Stack8 from "@mui/material/Stack";
|
|
2797
|
-
|
|
2798
|
-
// src/toolpad-core/PageContainer/PageHeader.tsx
|
|
2799
|
-
import PropTypes13 from "prop-types";
|
|
2800
|
-
import Breadcrumbs from "@mui/material/Breadcrumbs";
|
|
2801
|
-
import Link4 from "@mui/material/Link";
|
|
2802
|
-
import Stack7 from "@mui/material/Stack";
|
|
2803
|
-
import Typography4 from "@mui/material/Typography";
|
|
2804
|
-
import useSlotProps2 from "@mui/utils/useSlotProps";
|
|
2805
|
-
import { styled as styled5 } from "@mui/material";
|
|
2806
|
-
|
|
2807
|
-
// src/toolpad-core/PageContainer/PageHeaderToolbar.tsx
|
|
2808
|
-
import PropTypes12 from "prop-types";
|
|
2809
|
-
import { styled as styled4 } from "@mui/material";
|
|
2810
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2811
|
-
var PageHeaderToolbarRoot = styled4("div")(({ theme }) => ({
|
|
1981
|
+
var PageHeaderToolbarRoot = styled("div")(({ theme }) => ({
|
|
2812
1982
|
display: "flex",
|
|
2813
1983
|
flexDirection: "row",
|
|
2814
1984
|
gap: theme.spacing(1),
|
|
@@ -2816,7 +1986,7 @@ var PageHeaderToolbarRoot = styled4("div")(({ theme }) => ({
|
|
|
2816
1986
|
marginLeft: "auto"
|
|
2817
1987
|
}));
|
|
2818
1988
|
function PageHeaderToolbar(props) {
|
|
2819
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ jsx(PageHeaderToolbarRoot, __spreadValues({}, props));
|
|
2820
1990
|
}
|
|
2821
1991
|
PageHeaderToolbar.propTypes = {
|
|
2822
1992
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -2826,12 +1996,9 @@ PageHeaderToolbar.propTypes = {
|
|
|
2826
1996
|
/**
|
|
2827
1997
|
* @ignore
|
|
2828
1998
|
*/
|
|
2829
|
-
children:
|
|
1999
|
+
children: PropTypes9.node
|
|
2830
2000
|
};
|
|
2831
|
-
|
|
2832
|
-
// src/toolpad-core/PageContainer/PageHeader.tsx
|
|
2833
|
-
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2834
|
-
var PageContentHeader = styled5("div")(({ theme }) => ({
|
|
2001
|
+
var PageContentHeader = styled("div")(({ theme }) => ({
|
|
2835
2002
|
display: "flex",
|
|
2836
2003
|
flexDirection: "row",
|
|
2837
2004
|
justifyContent: "space-between",
|
|
@@ -2844,15 +2011,15 @@ function PageHeader(props) {
|
|
|
2844
2011
|
const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
|
|
2845
2012
|
const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
|
|
2846
2013
|
const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
|
|
2847
|
-
const toolbarSlotProps =
|
|
2014
|
+
const toolbarSlotProps = useSlotProps({
|
|
2848
2015
|
elementType: ToolbarComponent,
|
|
2849
2016
|
ownerState: props,
|
|
2850
2017
|
externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
|
|
2851
2018
|
additionalProps: {}
|
|
2852
2019
|
});
|
|
2853
|
-
return /* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
return item.path ? /* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
2021
|
+
/* @__PURE__ */ jsx(Breadcrumbs, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
|
|
2022
|
+
return item.path ? /* @__PURE__ */ jsx(
|
|
2856
2023
|
Link4,
|
|
2857
2024
|
{
|
|
2858
2025
|
component: Link2,
|
|
@@ -2862,11 +2029,11 @@ function PageHeader(props) {
|
|
|
2862
2029
|
children: getItemTitle(item)
|
|
2863
2030
|
},
|
|
2864
2031
|
index
|
|
2865
|
-
) : /* @__PURE__ */
|
|
2032
|
+
) : /* @__PURE__ */ jsx(Typography, { color: "text.primary", children: getItemTitle(item) }, index);
|
|
2866
2033
|
}) : null }),
|
|
2867
|
-
/* @__PURE__ */
|
|
2868
|
-
resolvedTitle ? /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2034
|
+
/* @__PURE__ */ jsxs(PageContentHeader, { children: [
|
|
2035
|
+
resolvedTitle ? /* @__PURE__ */ jsx(Typography, { variant: "h4", children: resolvedTitle }) : null,
|
|
2036
|
+
/* @__PURE__ */ jsx(ToolbarComponent, __spreadValues({}, toolbarSlotProps))
|
|
2870
2037
|
] })
|
|
2871
2038
|
] });
|
|
2872
2039
|
}
|
|
@@ -2878,41 +2045,38 @@ PageHeader.propTypes = {
|
|
|
2878
2045
|
/**
|
|
2879
2046
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2880
2047
|
*/
|
|
2881
|
-
breadcrumbs:
|
|
2882
|
-
|
|
2883
|
-
path:
|
|
2884
|
-
title:
|
|
2048
|
+
breadcrumbs: PropTypes9.arrayOf(
|
|
2049
|
+
PropTypes9.shape({
|
|
2050
|
+
path: PropTypes9.string,
|
|
2051
|
+
title: PropTypes9.string.isRequired
|
|
2885
2052
|
})
|
|
2886
2053
|
),
|
|
2887
2054
|
/**
|
|
2888
2055
|
* The props used for each slot inside.
|
|
2889
2056
|
*/
|
|
2890
|
-
slotProps:
|
|
2891
|
-
toolbar:
|
|
2892
|
-
children:
|
|
2057
|
+
slotProps: PropTypes9.shape({
|
|
2058
|
+
toolbar: PropTypes9.shape({
|
|
2059
|
+
children: PropTypes9.node
|
|
2893
2060
|
}).isRequired
|
|
2894
2061
|
}),
|
|
2895
2062
|
/**
|
|
2896
2063
|
* The components used for each slot inside.
|
|
2897
2064
|
*/
|
|
2898
|
-
slots:
|
|
2899
|
-
toolbar:
|
|
2065
|
+
slots: PropTypes9.shape({
|
|
2066
|
+
toolbar: PropTypes9.elementType
|
|
2900
2067
|
}),
|
|
2901
2068
|
/**
|
|
2902
2069
|
* The title of the page. Leave blank to use the active page title.
|
|
2903
2070
|
*/
|
|
2904
|
-
title:
|
|
2071
|
+
title: PropTypes9.string
|
|
2905
2072
|
};
|
|
2906
|
-
|
|
2907
|
-
// src/toolpad-core/PageContainer/PageContainer.tsx
|
|
2908
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2909
2073
|
function PageContainer(props) {
|
|
2910
2074
|
var _b;
|
|
2911
2075
|
const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = __objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
|
|
2912
2076
|
const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
|
|
2913
|
-
return /* @__PURE__ */
|
|
2914
|
-
/* @__PURE__ */
|
|
2915
|
-
/* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, rest), { sx: __spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxs(Stack, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
|
|
2078
|
+
/* @__PURE__ */ jsx(PageHeaderSlot, __spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
|
|
2079
|
+
/* @__PURE__ */ jsx(Box4, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
|
|
2916
2080
|
] }) }));
|
|
2917
2081
|
}
|
|
2918
2082
|
PageContainer.propTypes = {
|
|
@@ -2923,87 +2087,54 @@ PageContainer.propTypes = {
|
|
|
2923
2087
|
/**
|
|
2924
2088
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2925
2089
|
*/
|
|
2926
|
-
breadcrumbs:
|
|
2927
|
-
|
|
2928
|
-
path:
|
|
2929
|
-
title:
|
|
2090
|
+
breadcrumbs: PropTypes9.arrayOf(
|
|
2091
|
+
PropTypes9.shape({
|
|
2092
|
+
path: PropTypes9.string,
|
|
2093
|
+
title: PropTypes9.string.isRequired
|
|
2930
2094
|
})
|
|
2931
2095
|
),
|
|
2932
2096
|
/**
|
|
2933
2097
|
* @ignore
|
|
2934
2098
|
*/
|
|
2935
|
-
children:
|
|
2099
|
+
children: PropTypes9.node,
|
|
2936
2100
|
/**
|
|
2937
2101
|
* The props used for each slot inside.
|
|
2938
2102
|
*/
|
|
2939
|
-
slotProps:
|
|
2940
|
-
header:
|
|
2941
|
-
breadcrumbs:
|
|
2942
|
-
|
|
2943
|
-
path:
|
|
2944
|
-
title:
|
|
2103
|
+
slotProps: PropTypes9.shape({
|
|
2104
|
+
header: PropTypes9.shape({
|
|
2105
|
+
breadcrumbs: PropTypes9.arrayOf(
|
|
2106
|
+
PropTypes9.shape({
|
|
2107
|
+
path: PropTypes9.string,
|
|
2108
|
+
title: PropTypes9.string.isRequired
|
|
2945
2109
|
})
|
|
2946
2110
|
),
|
|
2947
|
-
slotProps:
|
|
2948
|
-
toolbar:
|
|
2111
|
+
slotProps: PropTypes9.shape({
|
|
2112
|
+
toolbar: PropTypes9.object.isRequired
|
|
2949
2113
|
}),
|
|
2950
|
-
slots:
|
|
2951
|
-
toolbar:
|
|
2114
|
+
slots: PropTypes9.shape({
|
|
2115
|
+
toolbar: PropTypes9.elementType
|
|
2952
2116
|
}),
|
|
2953
|
-
title:
|
|
2117
|
+
title: PropTypes9.string
|
|
2954
2118
|
}).isRequired
|
|
2955
2119
|
}),
|
|
2956
2120
|
/**
|
|
2957
2121
|
* The components used for each slot inside.
|
|
2958
2122
|
*/
|
|
2959
|
-
slots:
|
|
2960
|
-
header:
|
|
2123
|
+
slots: PropTypes9.shape({
|
|
2124
|
+
header: PropTypes9.elementType
|
|
2961
2125
|
}),
|
|
2962
2126
|
/**
|
|
2963
2127
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2964
2128
|
*/
|
|
2965
|
-
sx:
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2129
|
+
sx: PropTypes9.oneOfType([
|
|
2130
|
+
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
2131
|
+
PropTypes9.func,
|
|
2132
|
+
PropTypes9.object
|
|
2969
2133
|
]),
|
|
2970
2134
|
/**
|
|
2971
2135
|
* The title of the page. Leave blank to use the active page title.
|
|
2972
2136
|
*/
|
|
2973
|
-
title:
|
|
2137
|
+
title: PropTypes9.string
|
|
2974
2138
|
};
|
|
2975
2139
|
|
|
2976
|
-
export {
|
|
2977
|
-
useNotifications,
|
|
2978
|
-
en_default,
|
|
2979
|
-
LocalizationContext,
|
|
2980
|
-
LocalizationProvider,
|
|
2981
|
-
useLocaleText,
|
|
2982
|
-
NotificationsProvider,
|
|
2983
|
-
AlertDialog,
|
|
2984
|
-
ConfirmDialog,
|
|
2985
|
-
PromptDialog,
|
|
2986
|
-
useDialogs,
|
|
2987
|
-
DialogsProvider,
|
|
2988
|
-
useStorageStateServer,
|
|
2989
|
-
useStorageState,
|
|
2990
|
-
useLocalStorageState,
|
|
2991
|
-
AuthenticationContext,
|
|
2992
|
-
SessionContext,
|
|
2993
|
-
AppProvider,
|
|
2994
|
-
SignInButton,
|
|
2995
|
-
SignOutButton,
|
|
2996
|
-
AccountPreview,
|
|
2997
|
-
AccountPopoverHeader,
|
|
2998
|
-
AccountPopoverFooter,
|
|
2999
|
-
Account,
|
|
3000
|
-
ThemeSwitcher,
|
|
3001
|
-
ToolbarActions,
|
|
3002
|
-
DashboardHeader,
|
|
3003
|
-
useActivePage,
|
|
3004
|
-
DashboardSidebarPageItem,
|
|
3005
|
-
DashboardLayout,
|
|
3006
|
-
PageHeaderToolbar,
|
|
3007
|
-
PageHeader,
|
|
3008
|
-
PageContainer
|
|
3009
|
-
};
|
|
2140
|
+
export { Account, AccountPopoverFooter, AccountPopoverHeader, AccountPreview, AlertDialog, ConfirmDialog, DashboardHeader, DashboardLayout, DashboardSidebarPageItem, PageContainer, PageHeader, PageHeaderToolbar, PromptDialog, SignInButton, SignOutButton, ThemeSwitcher, ToolbarActions, useActivePage, useDialogs, useNotifications };
|