@iowas/toolpad 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/{chunk-3JWXE2JW.mjs → chunk-6JQJK2JX.mjs} +11 -1
- package/dist/{chunk-ZXM3V5SD.mjs → chunk-IDMYUY7L.mjs} +1187 -503
- package/dist/{chunk-UNVYOWC2.mjs → chunk-PMIWCP25.mjs} +25 -1
- package/dist/core.d.mts +198 -4
- package/dist/core.d.ts +198 -4
- package/dist/core.mjs +11 -14
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.mjs +17 -23
- package/dist/nextjs.d.mts +157 -3
- package/dist/nextjs.d.ts +157 -3
- package/dist/nextjs.js +4 -59
- package/dist/nextjs.mjs +736 -66
- package/dist/utils.mjs +7 -11
- package/package.json +102 -87
- package/dist/AppProvider-CIyOzZv_.d.mts +0 -201
- package/dist/AppProvider-CIyOzZv_.d.ts +0 -201
- package/dist/chunk-CENJI4RY.mjs +0 -26
- package/dist/chunk-F6JD4MSY.mjs +0 -12
- package/dist/chunk-LUTZBKSG.mjs +0 -710
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AuthenticationContext,
|
|
3
|
-
BrandingContext,
|
|
4
|
-
DashboardSidebarPageItemContext,
|
|
5
|
-
DialogsContext,
|
|
6
|
-
NavigationContext,
|
|
7
|
-
NotificationsContext,
|
|
8
|
-
PaletteModeContext,
|
|
9
|
-
RouterContext,
|
|
10
|
-
SessionContext,
|
|
11
|
-
WindowContext,
|
|
12
|
-
useLocaleText
|
|
13
|
-
} from "./chunk-LUTZBKSG.mjs";
|
|
14
|
-
import {
|
|
15
|
-
warnOnce
|
|
16
|
-
} from "./chunk-F6JD4MSY.mjs";
|
|
17
1
|
import {
|
|
18
2
|
__objRest,
|
|
19
3
|
__spreadProps,
|
|
20
4
|
__spreadValues,
|
|
21
|
-
useNonNullableContext
|
|
22
|
-
|
|
5
|
+
useNonNullableContext,
|
|
6
|
+
warnOnce
|
|
7
|
+
} from "./chunk-6JQJK2JX.mjs";
|
|
23
8
|
|
|
24
9
|
// src/toolpad-core/Account/Account.tsx
|
|
25
|
-
import * as
|
|
26
|
-
import
|
|
10
|
+
import * as React16 from "react";
|
|
11
|
+
import PropTypes8 from "prop-types";
|
|
27
12
|
import Popover from "@mui/material/Popover";
|
|
28
13
|
import Divider from "@mui/material/Divider";
|
|
29
14
|
import Stack3 from "@mui/material/Stack";
|
|
30
15
|
|
|
31
16
|
// src/toolpad-core/Account/SignInButton.tsx
|
|
32
|
-
import * as
|
|
33
|
-
import
|
|
34
|
-
import
|
|
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";
|
|
35
25
|
|
|
36
26
|
// src/toolpad-core/useNotifications/useNotifications.tsx
|
|
27
|
+
import * as React2 from "react";
|
|
28
|
+
|
|
29
|
+
// src/toolpad-core/useNotifications/NotificationsContext.ts
|
|
37
30
|
import * as React from "react";
|
|
31
|
+
var NotificationsContext = React.createContext(null);
|
|
32
|
+
|
|
33
|
+
// src/toolpad-core/useNotifications/useNotifications.tsx
|
|
38
34
|
var serverNotifications = {
|
|
39
35
|
show: () => {
|
|
40
36
|
throw new Error("Not supported on server side");
|
|
@@ -44,15 +40,223 @@ var serverNotifications = {
|
|
|
44
40
|
}
|
|
45
41
|
};
|
|
46
42
|
function useNotifications() {
|
|
47
|
-
const context =
|
|
43
|
+
const context = React2.useContext(NotificationsContext);
|
|
48
44
|
if (context) {
|
|
49
45
|
return context;
|
|
50
46
|
}
|
|
51
47
|
return serverNotifications;
|
|
52
48
|
}
|
|
53
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
|
+
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
|
+
|
|
54
258
|
// src/toolpad-core/useDialogs/useDialogs.tsx
|
|
55
|
-
import
|
|
259
|
+
import Button2 from "@mui/material/Button";
|
|
56
260
|
import Dialog from "@mui/material/Dialog";
|
|
57
261
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
58
262
|
import DialogContent from "@mui/material/DialogContent";
|
|
@@ -60,17 +264,37 @@ import DialogActions from "@mui/material/DialogActions";
|
|
|
60
264
|
import TextField from "@mui/material/TextField";
|
|
61
265
|
import DialogContentText from "@mui/material/DialogContentText";
|
|
62
266
|
import invariant from "invariant";
|
|
63
|
-
import * as
|
|
267
|
+
import * as React7 from "react";
|
|
64
268
|
import useEventCallback from "@mui/utils/useEventCallback";
|
|
65
|
-
|
|
66
|
-
|
|
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 = {
|
|
67
291
|
alert: "Alert",
|
|
68
292
|
confirm: "Confirm",
|
|
69
293
|
cancel: "Cancel",
|
|
70
294
|
ok: "Ok"
|
|
71
295
|
};
|
|
72
296
|
function useDialogLoadingButton(onClose) {
|
|
73
|
-
const [loading, setLoading] =
|
|
297
|
+
const [loading, setLoading] = React7.useState(false);
|
|
74
298
|
const handleClick = async () => {
|
|
75
299
|
try {
|
|
76
300
|
setLoading(true);
|
|
@@ -86,11 +310,11 @@ function useDialogLoadingButton(onClose) {
|
|
|
86
310
|
}
|
|
87
311
|
function AlertDialog({ open, payload, onClose }) {
|
|
88
312
|
var _a, _b;
|
|
89
|
-
const appWindowContext =
|
|
313
|
+
const appWindowContext = React7.useContext(WindowContext);
|
|
90
314
|
const globalLocaleText = useLocaleText();
|
|
91
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
315
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
92
316
|
const okButtonProps = useDialogLoadingButton(() => onClose());
|
|
93
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ jsxs2(
|
|
94
318
|
Dialog,
|
|
95
319
|
{
|
|
96
320
|
maxWidth: "xs",
|
|
@@ -99,21 +323,21 @@ function AlertDialog({ open, payload, onClose }) {
|
|
|
99
323
|
onClose: () => onClose(),
|
|
100
324
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
101
325
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ jsx3(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.alert }),
|
|
327
|
+
/* @__PURE__ */ jsx3(DialogContent, { children: payload.msg }),
|
|
328
|
+
/* @__PURE__ */ jsx3(DialogActions, { children: /* @__PURE__ */ jsx3(Button2, __spreadProps(__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
|
|
105
329
|
]
|
|
106
330
|
}
|
|
107
331
|
);
|
|
108
332
|
}
|
|
109
333
|
function ConfirmDialog({ open, payload, onClose }) {
|
|
110
334
|
var _a, _b, _c;
|
|
111
|
-
const appWindowContext =
|
|
335
|
+
const appWindowContext = React7.useContext(WindowContext);
|
|
112
336
|
const globalLocaleText = useLocaleText();
|
|
113
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
337
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
114
338
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
|
|
115
339
|
const okButtonProps = useDialogLoadingButton(() => onClose(true));
|
|
116
|
-
return /* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ jsxs2(
|
|
117
341
|
Dialog,
|
|
118
342
|
{
|
|
119
343
|
maxWidth: "xs",
|
|
@@ -122,11 +346,11 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
122
346
|
onClose: () => onClose(false),
|
|
123
347
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
124
348
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ jsx3(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
350
|
+
/* @__PURE__ */ jsx3(DialogContent, { children: payload.msg }),
|
|
351
|
+
/* @__PURE__ */ jsxs2(DialogActions, { children: [
|
|
352
|
+
/* @__PURE__ */ jsx3(Button2, __spreadProps(__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
353
|
+
/* @__PURE__ */ jsx3(Button2, __spreadProps(__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
|
|
130
354
|
] })
|
|
131
355
|
]
|
|
132
356
|
}
|
|
@@ -134,14 +358,14 @@ function ConfirmDialog({ open, payload, onClose }) {
|
|
|
134
358
|
}
|
|
135
359
|
function PromptDialog({ open, payload, onClose }) {
|
|
136
360
|
var _a, _b, _c;
|
|
137
|
-
const appWindowContext =
|
|
361
|
+
const appWindowContext = React7.useContext(WindowContext);
|
|
138
362
|
const globalLocaleText = useLocaleText();
|
|
139
|
-
const localeText = __spreadValues(__spreadValues({},
|
|
140
|
-
const [input, setInput] =
|
|
363
|
+
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText2), globalLocaleText);
|
|
364
|
+
const [input, setInput] = React7.useState("");
|
|
141
365
|
const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
|
|
142
|
-
const [loading, setLoading] =
|
|
366
|
+
const [loading, setLoading] = React7.useState(false);
|
|
143
367
|
const name = "input";
|
|
144
|
-
return /* @__PURE__ */
|
|
368
|
+
return /* @__PURE__ */ jsxs2(
|
|
145
369
|
Dialog,
|
|
146
370
|
{
|
|
147
371
|
maxWidth: "xs",
|
|
@@ -166,13 +390,13 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
166
390
|
},
|
|
167
391
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
168
392
|
children: [
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ jsx3(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
394
|
+
/* @__PURE__ */ jsxs2(DialogContent, { children: [
|
|
395
|
+
/* @__PURE__ */ jsxs2(DialogContentText, { children: [
|
|
172
396
|
payload.msg,
|
|
173
397
|
" "
|
|
174
398
|
] }),
|
|
175
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ jsx3(
|
|
176
400
|
TextField,
|
|
177
401
|
{
|
|
178
402
|
autoFocus: true,
|
|
@@ -188,9 +412,9 @@ function PromptDialog({ open, payload, onClose }) {
|
|
|
188
412
|
}
|
|
189
413
|
)
|
|
190
414
|
] }),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ jsxs2(DialogActions, { children: [
|
|
416
|
+
/* @__PURE__ */ jsx3(Button2, __spreadProps(__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
417
|
+
/* @__PURE__ */ jsx3(Button2, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
|
|
194
418
|
] })
|
|
195
419
|
]
|
|
196
420
|
}
|
|
@@ -216,7 +440,7 @@ function useDialogs() {
|
|
|
216
440
|
return open(PromptDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
217
441
|
}
|
|
218
442
|
);
|
|
219
|
-
return
|
|
443
|
+
return React7.useMemo(
|
|
220
444
|
() => ({
|
|
221
445
|
alert,
|
|
222
446
|
confirm,
|
|
@@ -228,19 +452,467 @@ function useDialogs() {
|
|
|
228
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
|
+
|
|
231
903
|
// src/toolpad-core/Account/AccountLocaleContext.tsx
|
|
232
|
-
import * as
|
|
233
|
-
var AccountLocaleContext =
|
|
904
|
+
import * as React12 from "react";
|
|
905
|
+
var AccountLocaleContext = React12.createContext(null);
|
|
234
906
|
|
|
235
907
|
// src/toolpad-core/Account/SignInButton.tsx
|
|
236
|
-
import { jsx as
|
|
908
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
237
909
|
function SignInButton(props) {
|
|
238
|
-
const authentication =
|
|
910
|
+
const authentication = React13.useContext(AuthenticationContext);
|
|
239
911
|
const globalLocaleText = useLocaleText();
|
|
240
|
-
const accountLocaleText =
|
|
912
|
+
const accountLocaleText = React13.useContext(AccountLocaleContext);
|
|
241
913
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
|
|
914
|
+
return /* @__PURE__ */ jsx7(
|
|
915
|
+
Button3,
|
|
244
916
|
__spreadProps(__spreadValues({
|
|
245
917
|
disableElevation: true,
|
|
246
918
|
variant: "contained",
|
|
@@ -269,22 +941,22 @@ SignInButton.propTypes = {
|
|
|
269
941
|
/**
|
|
270
942
|
* The content of the component.
|
|
271
943
|
*/
|
|
272
|
-
children:
|
|
944
|
+
children: PropTypes3.node
|
|
273
945
|
};
|
|
274
946
|
|
|
275
947
|
// src/toolpad-core/Account/SignOutButton.tsx
|
|
276
|
-
import * as
|
|
277
|
-
import
|
|
278
|
-
import
|
|
948
|
+
import * as React14 from "react";
|
|
949
|
+
import PropTypes4 from "prop-types";
|
|
950
|
+
import Button4 from "@mui/material/Button";
|
|
279
951
|
import LogoutIcon from "@mui/icons-material/Logout";
|
|
280
|
-
import { jsx as
|
|
952
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
281
953
|
function SignOutButton(props) {
|
|
282
|
-
const authentication =
|
|
954
|
+
const authentication = React14.useContext(AuthenticationContext);
|
|
283
955
|
const globalLocaleText = useLocaleText();
|
|
284
|
-
const accountLocaleText =
|
|
956
|
+
const accountLocaleText = React14.useContext(AccountLocaleContext);
|
|
285
957
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
-
|
|
958
|
+
return /* @__PURE__ */ jsx8(
|
|
959
|
+
Button4,
|
|
288
960
|
__spreadProps(__spreadValues({
|
|
289
961
|
disabled: !authentication,
|
|
290
962
|
variant: "outlined",
|
|
@@ -300,7 +972,7 @@ function SignOutButton(props) {
|
|
|
300
972
|
filter: "opacity(1)"
|
|
301
973
|
}
|
|
302
974
|
},
|
|
303
|
-
startIcon: /* @__PURE__ */
|
|
975
|
+
startIcon: /* @__PURE__ */ jsx8(LogoutIcon, {})
|
|
304
976
|
}, props), {
|
|
305
977
|
children: localeText == null ? void 0 : localeText.accountSignOutLabel
|
|
306
978
|
})
|
|
@@ -314,30 +986,30 @@ SignOutButton.propTypes = {
|
|
|
314
986
|
/**
|
|
315
987
|
* The content of the component.
|
|
316
988
|
*/
|
|
317
|
-
children:
|
|
989
|
+
children: PropTypes4.node
|
|
318
990
|
};
|
|
319
991
|
|
|
320
992
|
// src/toolpad-core/Account/AccountPreview.tsx
|
|
321
|
-
import * as
|
|
322
|
-
import
|
|
993
|
+
import * as React15 from "react";
|
|
994
|
+
import PropTypes5 from "prop-types";
|
|
323
995
|
import Avatar from "@mui/material/Avatar";
|
|
324
996
|
import Typography from "@mui/material/Typography";
|
|
325
997
|
import Tooltip from "@mui/material/Tooltip";
|
|
326
998
|
import Stack from "@mui/material/Stack";
|
|
327
|
-
import
|
|
999
|
+
import IconButton2 from "@mui/material/IconButton";
|
|
328
1000
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
329
|
-
import { jsx as
|
|
1001
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
330
1002
|
function AccountPreview(props) {
|
|
331
1003
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
332
1004
|
const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
|
|
333
|
-
const session =
|
|
1005
|
+
const session = React15.useContext(SessionContext);
|
|
334
1006
|
const globalLocaleText = useLocaleText();
|
|
335
|
-
const accountLocaleText =
|
|
1007
|
+
const accountLocaleText = React15.useContext(AccountLocaleContext);
|
|
336
1008
|
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
337
1009
|
if (!session || !session.user) {
|
|
338
1010
|
return null;
|
|
339
1011
|
}
|
|
340
|
-
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */
|
|
1012
|
+
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsx9(slots.avatar, {}) : /* @__PURE__ */ jsx9(
|
|
341
1013
|
Avatar,
|
|
342
1014
|
__spreadValues({
|
|
343
1015
|
src: ((_a = session.user) == null ? void 0 : _a.image) || "",
|
|
@@ -346,28 +1018,28 @@ function AccountPreview(props) {
|
|
|
346
1018
|
}, slotProps == null ? void 0 : slotProps.avatar)
|
|
347
1019
|
);
|
|
348
1020
|
if (variant === "expanded") {
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsxs5(Stack, { direction: "row", justifyContent: "space-between", sx: __spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
|
|
1022
|
+
/* @__PURE__ */ jsxs5(Stack, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
|
|
351
1023
|
avatarContent,
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */
|
|
1024
|
+
/* @__PURE__ */ jsxs5(Stack, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
|
|
1025
|
+
/* @__PURE__ */ jsx9(Typography, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
|
|
1026
|
+
/* @__PURE__ */ jsx9(Typography, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
|
|
355
1027
|
] })
|
|
356
1028
|
] }),
|
|
357
|
-
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */
|
|
358
|
-
|
|
1029
|
+
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsx9(slots.moreIconButton, {}) : /* @__PURE__ */ jsx9(
|
|
1030
|
+
IconButton2,
|
|
359
1031
|
__spreadProps(__spreadValues({
|
|
360
1032
|
size: "small",
|
|
361
1033
|
onClick: handleClick
|
|
362
1034
|
}, slotProps == null ? void 0 : slotProps.moreIconButton), {
|
|
363
1035
|
sx: __spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
|
|
364
|
-
children: /* @__PURE__ */
|
|
1036
|
+
children: /* @__PURE__ */ jsx9(MoreVertIcon, { fontSize: "small" })
|
|
365
1037
|
})
|
|
366
1038
|
))
|
|
367
1039
|
] });
|
|
368
1040
|
}
|
|
369
|
-
return /* @__PURE__ */
|
|
370
|
-
|
|
1041
|
+
return /* @__PURE__ */ jsx9(Tooltip, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsx9(slots.avatarIconButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsx9(Stack, { sx: __spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsx9(
|
|
1042
|
+
IconButton2,
|
|
371
1043
|
__spreadProps(__spreadValues({
|
|
372
1044
|
onClick: handleClick,
|
|
373
1045
|
"aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
|
|
@@ -389,35 +1061,35 @@ AccountPreview.propTypes = {
|
|
|
389
1061
|
/**
|
|
390
1062
|
* The handler used when the preview is expanded
|
|
391
1063
|
*/
|
|
392
|
-
handleClick:
|
|
1064
|
+
handleClick: PropTypes5.func,
|
|
393
1065
|
/**
|
|
394
1066
|
* The state of the Account popover
|
|
395
1067
|
* @default false
|
|
396
1068
|
*/
|
|
397
|
-
open:
|
|
1069
|
+
open: PropTypes5.bool,
|
|
398
1070
|
/**
|
|
399
1071
|
* The props used for each slot inside.
|
|
400
1072
|
*/
|
|
401
|
-
slotProps:
|
|
402
|
-
avatar:
|
|
403
|
-
avatarIconButton:
|
|
404
|
-
moreIconButton:
|
|
1073
|
+
slotProps: PropTypes5.shape({
|
|
1074
|
+
avatar: PropTypes5.object,
|
|
1075
|
+
avatarIconButton: PropTypes5.object,
|
|
1076
|
+
moreIconButton: PropTypes5.object
|
|
405
1077
|
}),
|
|
406
1078
|
/**
|
|
407
1079
|
* The components used for each slot inside.
|
|
408
1080
|
*/
|
|
409
|
-
slots:
|
|
410
|
-
avatar:
|
|
411
|
-
avatarIconButton:
|
|
412
|
-
moreIconButton:
|
|
1081
|
+
slots: PropTypes5.shape({
|
|
1082
|
+
avatar: PropTypes5.elementType,
|
|
1083
|
+
avatarIconButton: PropTypes5.elementType,
|
|
1084
|
+
moreIconButton: PropTypes5.elementType
|
|
413
1085
|
}),
|
|
414
1086
|
/**
|
|
415
1087
|
* The prop used to customize the styling of the preview
|
|
416
1088
|
*/
|
|
417
|
-
sx:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
1089
|
+
sx: PropTypes5.oneOfType([
|
|
1090
|
+
PropTypes5.arrayOf(PropTypes5.oneOfType([PropTypes5.func, PropTypes5.object, PropTypes5.bool])),
|
|
1091
|
+
PropTypes5.func,
|
|
1092
|
+
PropTypes5.object
|
|
421
1093
|
]),
|
|
422
1094
|
/**
|
|
423
1095
|
* The type of account details to display.
|
|
@@ -425,16 +1097,16 @@ AccountPreview.propTypes = {
|
|
|
425
1097
|
* @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
|
|
426
1098
|
* @default 'condensed'
|
|
427
1099
|
*/
|
|
428
|
-
variant:
|
|
1100
|
+
variant: PropTypes5.oneOf(["condensed", "expanded"])
|
|
429
1101
|
};
|
|
430
1102
|
|
|
431
1103
|
// src/toolpad-core/Account/AccountPopoverHeader.tsx
|
|
432
|
-
import
|
|
1104
|
+
import PropTypes6 from "prop-types";
|
|
433
1105
|
import Stack2 from "@mui/material/Stack";
|
|
434
|
-
import { jsx as
|
|
1106
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
435
1107
|
function AccountPopoverHeader(props) {
|
|
436
1108
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
437
|
-
return /* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ jsx10(Stack2, __spreadProps(__spreadValues({}, rest), { children }));
|
|
438
1110
|
}
|
|
439
1111
|
AccountPopoverHeader.propTypes = {
|
|
440
1112
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -444,16 +1116,16 @@ AccountPopoverHeader.propTypes = {
|
|
|
444
1116
|
/**
|
|
445
1117
|
* The content of the component.
|
|
446
1118
|
*/
|
|
447
|
-
children:
|
|
1119
|
+
children: PropTypes6.node
|
|
448
1120
|
};
|
|
449
1121
|
|
|
450
1122
|
// src/toolpad-core/Account/AccountPopoverFooter.tsx
|
|
451
|
-
import
|
|
1123
|
+
import PropTypes7 from "prop-types";
|
|
452
1124
|
import Box from "@mui/material/Box";
|
|
453
|
-
import { jsx as
|
|
1125
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
454
1126
|
function AccountPopoverFooter(props) {
|
|
455
1127
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
456
|
-
return /* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ jsx11(
|
|
457
1129
|
Box,
|
|
458
1130
|
__spreadProps(__spreadValues({}, rest), {
|
|
459
1131
|
sx: __spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
|
|
@@ -469,19 +1141,19 @@ AccountPopoverFooter.propTypes = {
|
|
|
469
1141
|
/**
|
|
470
1142
|
* @ignore
|
|
471
1143
|
*/
|
|
472
|
-
children:
|
|
1144
|
+
children: PropTypes7.node,
|
|
473
1145
|
/**
|
|
474
1146
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
475
1147
|
*/
|
|
476
|
-
sx:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
1148
|
+
sx: PropTypes7.oneOfType([
|
|
1149
|
+
PropTypes7.arrayOf(PropTypes7.oneOfType([PropTypes7.func, PropTypes7.object, PropTypes7.bool])),
|
|
1150
|
+
PropTypes7.func,
|
|
1151
|
+
PropTypes7.object
|
|
480
1152
|
])
|
|
481
1153
|
};
|
|
482
1154
|
|
|
483
1155
|
// src/toolpad-core/Account/Account.tsx
|
|
484
|
-
import { jsx as
|
|
1156
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
485
1157
|
var defaultAccountLocaleText = {
|
|
486
1158
|
accountPreviewIconButtonLabel: "Current User",
|
|
487
1159
|
accountPreviewTitle: "Account",
|
|
@@ -492,14 +1164,14 @@ function Account(props) {
|
|
|
492
1164
|
var _a;
|
|
493
1165
|
const { localeText: propsLocaleText } = props;
|
|
494
1166
|
const globalLocaleText = useLocaleText();
|
|
495
|
-
const localeText =
|
|
1167
|
+
const localeText = React16.useMemo(
|
|
496
1168
|
() => __spreadValues(__spreadValues(__spreadValues({}, defaultAccountLocaleText), globalLocaleText), propsLocaleText),
|
|
497
1169
|
[globalLocaleText, propsLocaleText]
|
|
498
1170
|
);
|
|
499
1171
|
const { slots, slotProps } = props;
|
|
500
|
-
const [anchorEl, setAnchorEl] =
|
|
501
|
-
const session =
|
|
502
|
-
const authentication =
|
|
1172
|
+
const [anchorEl, setAnchorEl] = React16.useState(null);
|
|
1173
|
+
const session = React16.useContext(SessionContext);
|
|
1174
|
+
const authentication = React16.useContext(AuthenticationContext);
|
|
503
1175
|
const open = Boolean(anchorEl);
|
|
504
1176
|
const handleClick = (event) => {
|
|
505
1177
|
setAnchorEl(event.currentTarget);
|
|
@@ -512,10 +1184,10 @@ function Account(props) {
|
|
|
512
1184
|
}
|
|
513
1185
|
let accountContent = null;
|
|
514
1186
|
if (!(session == null ? void 0 : session.user)) {
|
|
515
|
-
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */
|
|
1187
|
+
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsx12(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsx12(SignInButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
|
|
516
1188
|
} else {
|
|
517
|
-
accountContent = /* @__PURE__ */
|
|
518
|
-
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */
|
|
1189
|
+
accountContent = /* @__PURE__ */ jsxs6(React16.Fragment, { children: [
|
|
1190
|
+
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsx12(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsx12(
|
|
519
1191
|
AccountPreview,
|
|
520
1192
|
__spreadValues({
|
|
521
1193
|
variant: "condensed",
|
|
@@ -523,14 +1195,14 @@ function Account(props) {
|
|
|
523
1195
|
open
|
|
524
1196
|
}, slotProps == null ? void 0 : slotProps.preview)
|
|
525
1197
|
),
|
|
526
|
-
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */
|
|
1198
|
+
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsx12(
|
|
527
1199
|
slots.popover,
|
|
528
1200
|
__spreadValues({
|
|
529
1201
|
open,
|
|
530
1202
|
onClick: handleClick,
|
|
531
1203
|
onClose: handleClose
|
|
532
1204
|
}, slotProps == null ? void 0 : slotProps.popover)
|
|
533
|
-
) : /* @__PURE__ */
|
|
1205
|
+
) : /* @__PURE__ */ jsx12(
|
|
534
1206
|
Popover,
|
|
535
1207
|
__spreadProps(__spreadValues({
|
|
536
1208
|
anchorEl,
|
|
@@ -563,16 +1235,16 @@ function Account(props) {
|
|
|
563
1235
|
}
|
|
564
1236
|
}
|
|
565
1237
|
}, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
|
|
566
|
-
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
1238
|
+
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsx12(slots.popoverContent, __spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxs6(Stack3, __spreadProps(__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
|
|
1239
|
+
/* @__PURE__ */ jsx12(AccountPopoverHeader, { children: /* @__PURE__ */ jsx12(AccountPreview, { variant: "expanded" }) }),
|
|
1240
|
+
/* @__PURE__ */ jsx12(Divider, {}),
|
|
1241
|
+
/* @__PURE__ */ jsx12(AccountPopoverFooter, { children: /* @__PURE__ */ jsx12(SignOutButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
|
|
570
1242
|
] }))
|
|
571
1243
|
})
|
|
572
1244
|
)
|
|
573
1245
|
] });
|
|
574
1246
|
}
|
|
575
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsx12(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
|
|
576
1248
|
}
|
|
577
1249
|
Account.propTypes = {
|
|
578
1250
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -582,64 +1254,64 @@ Account.propTypes = {
|
|
|
582
1254
|
/**
|
|
583
1255
|
* The labels for the account component.
|
|
584
1256
|
*/
|
|
585
|
-
localeText:
|
|
1257
|
+
localeText: PropTypes8.object,
|
|
586
1258
|
/**
|
|
587
1259
|
* The props used for each slot inside.
|
|
588
1260
|
*/
|
|
589
|
-
slotProps:
|
|
590
|
-
popover:
|
|
591
|
-
popoverContent:
|
|
592
|
-
preview:
|
|
593
|
-
handleClick:
|
|
594
|
-
open:
|
|
595
|
-
slotProps:
|
|
596
|
-
avatar:
|
|
597
|
-
avatarIconButton:
|
|
598
|
-
moreIconButton:
|
|
1261
|
+
slotProps: PropTypes8.shape({
|
|
1262
|
+
popover: PropTypes8.object,
|
|
1263
|
+
popoverContent: PropTypes8.object,
|
|
1264
|
+
preview: PropTypes8.shape({
|
|
1265
|
+
handleClick: PropTypes8.func,
|
|
1266
|
+
open: PropTypes8.bool,
|
|
1267
|
+
slotProps: PropTypes8.shape({
|
|
1268
|
+
avatar: PropTypes8.object,
|
|
1269
|
+
avatarIconButton: PropTypes8.object,
|
|
1270
|
+
moreIconButton: PropTypes8.object
|
|
599
1271
|
}),
|
|
600
|
-
slots:
|
|
601
|
-
avatar:
|
|
602
|
-
avatarIconButton:
|
|
603
|
-
moreIconButton:
|
|
1272
|
+
slots: PropTypes8.shape({
|
|
1273
|
+
avatar: PropTypes8.elementType,
|
|
1274
|
+
avatarIconButton: PropTypes8.elementType,
|
|
1275
|
+
moreIconButton: PropTypes8.elementType
|
|
604
1276
|
}),
|
|
605
|
-
sx:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
1277
|
+
sx: PropTypes8.oneOfType([
|
|
1278
|
+
PropTypes8.arrayOf(PropTypes8.oneOfType([PropTypes8.func, PropTypes8.object, PropTypes8.bool])),
|
|
1279
|
+
PropTypes8.func,
|
|
1280
|
+
PropTypes8.object
|
|
609
1281
|
]),
|
|
610
|
-
variant:
|
|
1282
|
+
variant: PropTypes8.oneOf(["condensed", "expanded"])
|
|
611
1283
|
}),
|
|
612
|
-
signInButton:
|
|
613
|
-
signOutButton:
|
|
1284
|
+
signInButton: PropTypes8.object,
|
|
1285
|
+
signOutButton: PropTypes8.object
|
|
614
1286
|
}),
|
|
615
1287
|
/**
|
|
616
1288
|
* The components used for each slot inside.
|
|
617
1289
|
*/
|
|
618
|
-
slots:
|
|
619
|
-
popover:
|
|
620
|
-
popoverContent:
|
|
621
|
-
preview:
|
|
622
|
-
signInButton:
|
|
623
|
-
signOutButton:
|
|
1290
|
+
slots: PropTypes8.shape({
|
|
1291
|
+
popover: PropTypes8.elementType,
|
|
1292
|
+
popoverContent: PropTypes8.elementType,
|
|
1293
|
+
preview: PropTypes8.elementType,
|
|
1294
|
+
signInButton: PropTypes8.elementType,
|
|
1295
|
+
signOutButton: PropTypes8.elementType
|
|
624
1296
|
})
|
|
625
1297
|
};
|
|
626
1298
|
|
|
627
1299
|
// src/toolpad-core/DashboardLayout/DashboardLayout.tsx
|
|
628
|
-
import * as
|
|
629
|
-
import
|
|
630
|
-
import { useTheme as
|
|
631
|
-
import
|
|
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";
|
|
632
1304
|
import Box4 from "@mui/material/Box";
|
|
633
1305
|
import Drawer from "@mui/material/Drawer";
|
|
634
1306
|
import Toolbar2 from "@mui/material/Toolbar";
|
|
635
1307
|
|
|
636
1308
|
// src/toolpad-core/DashboardLayout/DashboardHeader.tsx
|
|
637
|
-
import * as
|
|
638
|
-
import
|
|
1309
|
+
import * as React21 from "react";
|
|
1310
|
+
import PropTypes9 from "prop-types";
|
|
639
1311
|
import { styled as styled2 } from "@mui/material/styles";
|
|
640
1312
|
import Box2 from "@mui/material/Box";
|
|
641
1313
|
import MuiAppBar from "@mui/material/AppBar";
|
|
642
|
-
import
|
|
1314
|
+
import IconButton4 from "@mui/material/IconButton";
|
|
643
1315
|
import Toolbar from "@mui/material/Toolbar";
|
|
644
1316
|
import Tooltip3 from "@mui/material/Tooltip";
|
|
645
1317
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
@@ -649,15 +1321,15 @@ import Stack6 from "@mui/material/Stack";
|
|
|
649
1321
|
// src/toolpad-core/DashboardLayout/AppTitle.tsx
|
|
650
1322
|
import Typography2 from "@mui/material/Typography";
|
|
651
1323
|
import Stack4 from "@mui/material/Stack";
|
|
652
|
-
import { styled, useTheme } from "@mui/material";
|
|
1324
|
+
import { styled, useTheme as useTheme2 } from "@mui/material";
|
|
653
1325
|
|
|
654
1326
|
// src/toolpad-core/shared/Link.tsx
|
|
655
|
-
import * as
|
|
656
|
-
import { jsx as
|
|
657
|
-
var DefaultLink =
|
|
1327
|
+
import * as React17 from "react";
|
|
1328
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1329
|
+
var DefaultLink = React17.forwardRef(function Link(props, ref) {
|
|
658
1330
|
const _a = props, { children, href, onClick, history } = _a, rest = __objRest(_a, ["children", "href", "onClick", "history"]);
|
|
659
|
-
const routerContext =
|
|
660
|
-
const handleLinkClick =
|
|
1331
|
+
const routerContext = React17.useContext(RouterContext);
|
|
1332
|
+
const handleLinkClick = React17.useMemo(() => {
|
|
661
1333
|
if (!routerContext) {
|
|
662
1334
|
return onClick;
|
|
663
1335
|
}
|
|
@@ -668,25 +1340,25 @@ var DefaultLink = React8.forwardRef(function Link(props, ref) {
|
|
|
668
1340
|
onClick == null ? void 0 : onClick(event);
|
|
669
1341
|
};
|
|
670
1342
|
}, [routerContext, onClick, history]);
|
|
671
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ jsx13("a", __spreadProps(__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
|
|
672
1344
|
});
|
|
673
|
-
var Link2 =
|
|
1345
|
+
var Link2 = React17.forwardRef(function Link3(props, ref) {
|
|
674
1346
|
var _a;
|
|
675
|
-
const routerContext =
|
|
1347
|
+
const routerContext = React17.useContext(RouterContext);
|
|
676
1348
|
const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
|
|
677
|
-
return /* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ jsx13(LinkComponent, __spreadProps(__spreadValues({ ref }, props), { children: props.children }));
|
|
678
1350
|
});
|
|
679
1351
|
|
|
680
1352
|
// src/toolpad-core/DashboardLayout/ToolpadLogo.tsx
|
|
681
|
-
import { jsx as
|
|
1353
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
682
1354
|
function ToolpadLogo({ size = 40 }) {
|
|
683
|
-
return /* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ jsxs7("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1356
|
+
/* @__PURE__ */ jsxs7("g", { mask: "url(#a)", children: [
|
|
1357
|
+
/* @__PURE__ */ jsx14("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
|
|
1358
|
+
/* @__PURE__ */ jsx14("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
|
|
1359
|
+
/* @__PURE__ */ jsx14("path", { d: "m16.1 16.34 6.64-3.8 6.64 3.8-6.64 3.8-6.65-3.8Z", fill: "#A5D8FF" })
|
|
688
1360
|
] }),
|
|
689
|
-
/* @__PURE__ */
|
|
1361
|
+
/* @__PURE__ */ jsx14(
|
|
690
1362
|
"mask",
|
|
691
1363
|
{
|
|
692
1364
|
id: "b",
|
|
@@ -698,7 +1370,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
698
1370
|
y: "17",
|
|
699
1371
|
width: "14",
|
|
700
1372
|
height: "15",
|
|
701
|
-
children: /* @__PURE__ */
|
|
1373
|
+
children: /* @__PURE__ */ jsx14(
|
|
702
1374
|
"path",
|
|
703
1375
|
{
|
|
704
1376
|
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",
|
|
@@ -707,12 +1379,12 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
707
1379
|
)
|
|
708
1380
|
}
|
|
709
1381
|
),
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsxs7("g", { mask: "url(#b)", children: [
|
|
1383
|
+
/* @__PURE__ */ jsx14("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
|
|
1384
|
+
/* @__PURE__ */ jsx14("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
|
|
1385
|
+
/* @__PURE__ */ jsx14("path", { d: "m8.5 20.6 6.64-3.79 6.65 3.8-6.65 3.8-6.64-3.8Z", fill: "#A5D8FF" })
|
|
714
1386
|
] }),
|
|
715
|
-
/* @__PURE__ */
|
|
1387
|
+
/* @__PURE__ */ jsx14(
|
|
716
1388
|
"mask",
|
|
717
1389
|
{
|
|
718
1390
|
id: "c",
|
|
@@ -724,7 +1396,7 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
724
1396
|
y: "4",
|
|
725
1397
|
width: "22",
|
|
726
1398
|
height: "20",
|
|
727
|
-
children: /* @__PURE__ */
|
|
1399
|
+
children: /* @__PURE__ */ jsx14(
|
|
728
1400
|
"path",
|
|
729
1401
|
{
|
|
730
1402
|
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",
|
|
@@ -733,24 +1405,24 @@ function ToolpadLogo({ size = 40 }) {
|
|
|
733
1405
|
)
|
|
734
1406
|
}
|
|
735
1407
|
),
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ jsxs7("g", { mask: "url(#c)", children: [
|
|
1409
|
+
/* @__PURE__ */ jsx14("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
|
|
1410
|
+
/* @__PURE__ */ jsx14("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
|
|
1411
|
+
/* @__PURE__ */ jsx14("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
|
|
740
1412
|
] })
|
|
741
1413
|
] });
|
|
742
1414
|
}
|
|
743
1415
|
|
|
744
1416
|
// src/toolpad-core/shared/branding.ts
|
|
745
|
-
import * as
|
|
1417
|
+
import * as React18 from "react";
|
|
746
1418
|
function useApplicationTitle() {
|
|
747
1419
|
var _a;
|
|
748
|
-
const branding =
|
|
1420
|
+
const branding = React18.useContext(BrandingContext);
|
|
749
1421
|
return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
|
|
750
1422
|
}
|
|
751
1423
|
|
|
752
1424
|
// src/toolpad-core/DashboardLayout/AppTitle.tsx
|
|
753
|
-
import { jsx as
|
|
1425
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
754
1426
|
var LogoContainer = styled("div")({
|
|
755
1427
|
position: "relative",
|
|
756
1428
|
height: 40,
|
|
@@ -762,12 +1434,12 @@ var LogoContainer = styled("div")({
|
|
|
762
1434
|
});
|
|
763
1435
|
function AppTitle(props) {
|
|
764
1436
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
765
|
-
const theme =
|
|
1437
|
+
const theme = useTheme2();
|
|
766
1438
|
const defaultTitle = useApplicationTitle();
|
|
767
1439
|
const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
|
|
768
|
-
return /* @__PURE__ */
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
/* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ jsx15(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxs8(Stack4, { direction: "row", alignItems: "center", children: [
|
|
1441
|
+
/* @__PURE__ */ jsx15(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsx15(ToolpadLogo, { size: 40 }) }),
|
|
1442
|
+
/* @__PURE__ */ jsx15(
|
|
771
1443
|
Typography2,
|
|
772
1444
|
{
|
|
773
1445
|
variant: "h6",
|
|
@@ -788,54 +1460,54 @@ function AppTitle(props) {
|
|
|
788
1460
|
import Stack5 from "@mui/material/Stack";
|
|
789
1461
|
|
|
790
1462
|
// src/toolpad-core/DashboardLayout/ThemeSwitcher.tsx
|
|
791
|
-
import * as
|
|
792
|
-
import { useTheme as
|
|
793
|
-
import
|
|
1463
|
+
import * as React20 from "react";
|
|
1464
|
+
import { useTheme as useTheme3 } from "@mui/material";
|
|
1465
|
+
import IconButton3 from "@mui/material/IconButton";
|
|
794
1466
|
import Tooltip2 from "@mui/material/Tooltip";
|
|
795
1467
|
import DarkModeIcon from "@mui/icons-material/DarkMode";
|
|
796
1468
|
import LightModeIcon from "@mui/icons-material/LightMode";
|
|
797
1469
|
|
|
798
1470
|
// src/toolpad-utils/hooks/useSsr.ts
|
|
799
|
-
import * as
|
|
800
|
-
function
|
|
1471
|
+
import * as React19 from "react";
|
|
1472
|
+
function subscribe2() {
|
|
801
1473
|
return () => {
|
|
802
1474
|
};
|
|
803
1475
|
}
|
|
804
|
-
function
|
|
1476
|
+
function getSnapshot2() {
|
|
805
1477
|
return false;
|
|
806
1478
|
}
|
|
807
1479
|
function getServerSnapshot() {
|
|
808
1480
|
return true;
|
|
809
1481
|
}
|
|
810
1482
|
function useSsr() {
|
|
811
|
-
return
|
|
1483
|
+
return React19.useSyncExternalStore(subscribe2, getSnapshot2, getServerSnapshot);
|
|
812
1484
|
}
|
|
813
1485
|
|
|
814
1486
|
// src/toolpad-core/DashboardLayout/ThemeSwitcher.tsx
|
|
815
|
-
import { jsx as
|
|
1487
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
816
1488
|
function ThemeSwitcher() {
|
|
817
1489
|
var _a;
|
|
818
1490
|
const isSsr = useSsr();
|
|
819
|
-
const theme =
|
|
820
|
-
const { paletteMode, setPaletteMode, isDualTheme } =
|
|
821
|
-
const toggleMode =
|
|
1491
|
+
const theme = useTheme3();
|
|
1492
|
+
const { paletteMode, setPaletteMode, isDualTheme } = React20.useContext(PaletteModeContext);
|
|
1493
|
+
const toggleMode = React20.useCallback(() => {
|
|
822
1494
|
setPaletteMode(paletteMode === "dark" ? "light" : "dark");
|
|
823
1495
|
}, [paletteMode, setPaletteMode]);
|
|
824
|
-
return isDualTheme ? /* @__PURE__ */
|
|
1496
|
+
return isDualTheme ? /* @__PURE__ */ jsx16(
|
|
825
1497
|
Tooltip2,
|
|
826
1498
|
{
|
|
827
1499
|
title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
|
|
828
1500
|
enterDelay: 1e3,
|
|
829
|
-
children: /* @__PURE__ */
|
|
830
|
-
|
|
1501
|
+
children: /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16(
|
|
1502
|
+
IconButton3,
|
|
831
1503
|
{
|
|
832
1504
|
"aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
|
|
833
1505
|
onClick: toggleMode,
|
|
834
1506
|
sx: {
|
|
835
1507
|
color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
|
|
836
1508
|
},
|
|
837
|
-
children: theme.getColorSchemeSelector ? /* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */
|
|
1509
|
+
children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxs9(React20.Fragment, { children: [
|
|
1510
|
+
/* @__PURE__ */ jsx16(
|
|
839
1511
|
DarkModeIcon,
|
|
840
1512
|
{
|
|
841
1513
|
sx: {
|
|
@@ -846,7 +1518,7 @@ function ThemeSwitcher() {
|
|
|
846
1518
|
}
|
|
847
1519
|
}
|
|
848
1520
|
),
|
|
849
|
-
/* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ jsx16(
|
|
850
1522
|
LightModeIcon,
|
|
851
1523
|
{
|
|
852
1524
|
sx: {
|
|
@@ -857,7 +1529,7 @@ function ThemeSwitcher() {
|
|
|
857
1529
|
}
|
|
858
1530
|
}
|
|
859
1531
|
)
|
|
860
|
-
] }) : /* @__PURE__ */
|
|
1532
|
+
] }) : /* @__PURE__ */ jsx16(React20.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsx16(DarkModeIcon, {}) : /* @__PURE__ */ jsx16(LightModeIcon, {}) })
|
|
861
1533
|
}
|
|
862
1534
|
) })
|
|
863
1535
|
}
|
|
@@ -865,16 +1537,16 @@ function ThemeSwitcher() {
|
|
|
865
1537
|
}
|
|
866
1538
|
|
|
867
1539
|
// src/toolpad-core/DashboardLayout/ToolbarActions.tsx
|
|
868
|
-
import { jsx as
|
|
1540
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
869
1541
|
function ToolbarActions() {
|
|
870
|
-
return /* @__PURE__ */
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ jsxs10(Stack5, { direction: "row", alignItems: "center", children: [
|
|
1543
|
+
/* @__PURE__ */ jsx17(ThemeSwitcher, {}),
|
|
1544
|
+
/* @__PURE__ */ jsx17(Account, {})
|
|
873
1545
|
] });
|
|
874
1546
|
}
|
|
875
1547
|
|
|
876
1548
|
// src/toolpad-core/DashboardLayout/DashboardHeader.tsx
|
|
877
|
-
import { jsx as
|
|
1549
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
878
1550
|
var AppBar = styled2(MuiAppBar)(({ theme }) => {
|
|
879
1551
|
var _a;
|
|
880
1552
|
return {
|
|
@@ -896,26 +1568,26 @@ function DashboardHeader(props) {
|
|
|
896
1568
|
slots,
|
|
897
1569
|
slotProps
|
|
898
1570
|
} = props;
|
|
899
|
-
const brandingContext =
|
|
1571
|
+
const brandingContext = React21.useContext(BrandingContext);
|
|
900
1572
|
const branding = __spreadValues(__spreadValues({}, brandingContext), brandingProp);
|
|
901
|
-
const handleMenuOpen =
|
|
1573
|
+
const handleMenuOpen = React21.useCallback(() => {
|
|
902
1574
|
onToggleMenu(!menuOpen);
|
|
903
1575
|
}, [menuOpen, onToggleMenu]);
|
|
904
|
-
const getMenuIcon =
|
|
1576
|
+
const getMenuIcon = React21.useCallback(
|
|
905
1577
|
(isExpanded) => {
|
|
906
1578
|
const expandMenuActionText = "Expand";
|
|
907
1579
|
const collapseMenuActionText = "Collapse";
|
|
908
|
-
return /* @__PURE__ */
|
|
1580
|
+
return /* @__PURE__ */ jsx18(
|
|
909
1581
|
Tooltip3,
|
|
910
1582
|
{
|
|
911
1583
|
title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
|
|
912
1584
|
enterDelay: 1e3,
|
|
913
|
-
children: /* @__PURE__ */
|
|
914
|
-
|
|
1585
|
+
children: /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18(
|
|
1586
|
+
IconButton4,
|
|
915
1587
|
{
|
|
916
1588
|
"aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
|
|
917
1589
|
onClick: handleMenuOpen,
|
|
918
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1590
|
+
children: isExpanded ? /* @__PURE__ */ jsx18(MenuOpenIcon, {}) : /* @__PURE__ */ jsx18(MenuIcon, {})
|
|
919
1591
|
}
|
|
920
1592
|
) })
|
|
921
1593
|
}
|
|
@@ -925,7 +1597,7 @@ function DashboardHeader(props) {
|
|
|
925
1597
|
);
|
|
926
1598
|
const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
|
|
927
1599
|
const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
|
|
928
|
-
return /* @__PURE__ */
|
|
1600
|
+
return /* @__PURE__ */ jsx18(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsx18(Toolbar, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxs11(
|
|
929
1601
|
Stack6,
|
|
930
1602
|
{
|
|
931
1603
|
direction: "row",
|
|
@@ -936,9 +1608,9 @@ function DashboardHeader(props) {
|
|
|
936
1608
|
width: "100%"
|
|
937
1609
|
},
|
|
938
1610
|
children: [
|
|
939
|
-
/* @__PURE__ */
|
|
940
|
-
!hideMenuButton ? /* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ jsxs11(Stack6, { direction: "row", children: [
|
|
1612
|
+
!hideMenuButton ? /* @__PURE__ */ jsxs11(React21.Fragment, { children: [
|
|
1613
|
+
/* @__PURE__ */ jsx18(
|
|
942
1614
|
Box2,
|
|
943
1615
|
{
|
|
944
1616
|
sx: {
|
|
@@ -948,7 +1620,7 @@ function DashboardHeader(props) {
|
|
|
948
1620
|
children: getMenuIcon(menuOpen)
|
|
949
1621
|
}
|
|
950
1622
|
),
|
|
951
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsx18(
|
|
952
1624
|
Box2,
|
|
953
1625
|
{
|
|
954
1626
|
sx: {
|
|
@@ -959,18 +1631,18 @@ function DashboardHeader(props) {
|
|
|
959
1631
|
}
|
|
960
1632
|
)
|
|
961
1633
|
] }) : null,
|
|
962
|
-
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */
|
|
1634
|
+
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsx18(slots.appTitle, __spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
|
|
963
1635
|
/* Hierarchy of application of `branding`
|
|
964
1636
|
* 1. Branding prop passed in the `slotProps.appTitle`
|
|
965
1637
|
* 2. Branding prop passed to the `DashboardLayout`
|
|
966
1638
|
* 3. Branding prop passed to the `AppProvider`
|
|
967
1639
|
*/
|
|
968
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ jsx18(AppTitle, __spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
|
|
969
1641
|
)
|
|
970
1642
|
] }),
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ jsxs11(Stack6, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
|
|
1644
|
+
/* @__PURE__ */ jsx18(ToolbarActionsSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
|
|
1645
|
+
/* @__PURE__ */ jsx18(ToolbarAccountSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
|
|
974
1646
|
] })
|
|
975
1647
|
]
|
|
976
1648
|
}
|
|
@@ -985,75 +1657,75 @@ DashboardHeader.propTypes = {
|
|
|
985
1657
|
* Branding options for the header.
|
|
986
1658
|
* @default null
|
|
987
1659
|
*/
|
|
988
|
-
branding:
|
|
989
|
-
homeUrl:
|
|
990
|
-
logo:
|
|
991
|
-
title:
|
|
1660
|
+
branding: PropTypes9.shape({
|
|
1661
|
+
homeUrl: PropTypes9.string,
|
|
1662
|
+
logo: PropTypes9.node,
|
|
1663
|
+
title: PropTypes9.string
|
|
992
1664
|
}),
|
|
993
1665
|
/**
|
|
994
1666
|
* Whether the menu icon should always be hidden.
|
|
995
1667
|
* @default false
|
|
996
1668
|
*/
|
|
997
|
-
hideMenuButton:
|
|
1669
|
+
hideMenuButton: PropTypes9.bool,
|
|
998
1670
|
/**
|
|
999
1671
|
* If `true`, show menu button as if menu is expanded, otherwise show it as if menu is collapsed.
|
|
1000
1672
|
*/
|
|
1001
|
-
menuOpen:
|
|
1673
|
+
menuOpen: PropTypes9.bool.isRequired,
|
|
1002
1674
|
/**
|
|
1003
1675
|
* Callback fired when the menu button is clicked.
|
|
1004
1676
|
*/
|
|
1005
|
-
onToggleMenu:
|
|
1677
|
+
onToggleMenu: PropTypes9.func.isRequired,
|
|
1006
1678
|
/**
|
|
1007
1679
|
* The props used for each slot inside.
|
|
1008
1680
|
* @default {}
|
|
1009
1681
|
*/
|
|
1010
|
-
slotProps:
|
|
1011
|
-
appTitle:
|
|
1012
|
-
branding:
|
|
1013
|
-
homeUrl:
|
|
1014
|
-
logo:
|
|
1015
|
-
title:
|
|
1682
|
+
slotProps: PropTypes9.shape({
|
|
1683
|
+
appTitle: PropTypes9.shape({
|
|
1684
|
+
branding: PropTypes9.shape({
|
|
1685
|
+
homeUrl: PropTypes9.string,
|
|
1686
|
+
logo: PropTypes9.node,
|
|
1687
|
+
title: PropTypes9.string
|
|
1016
1688
|
})
|
|
1017
1689
|
}),
|
|
1018
|
-
toolbarAccount:
|
|
1019
|
-
localeText:
|
|
1020
|
-
slotProps:
|
|
1021
|
-
popover:
|
|
1022
|
-
popoverContent:
|
|
1023
|
-
preview:
|
|
1024
|
-
signInButton:
|
|
1025
|
-
signOutButton:
|
|
1690
|
+
toolbarAccount: PropTypes9.shape({
|
|
1691
|
+
localeText: PropTypes9.object,
|
|
1692
|
+
slotProps: PropTypes9.shape({
|
|
1693
|
+
popover: PropTypes9.object,
|
|
1694
|
+
popoverContent: PropTypes9.object,
|
|
1695
|
+
preview: PropTypes9.object,
|
|
1696
|
+
signInButton: PropTypes9.object,
|
|
1697
|
+
signOutButton: PropTypes9.object
|
|
1026
1698
|
}),
|
|
1027
|
-
slots:
|
|
1028
|
-
popover:
|
|
1029
|
-
popoverContent:
|
|
1030
|
-
preview:
|
|
1031
|
-
signInButton:
|
|
1032
|
-
signOutButton:
|
|
1699
|
+
slots: PropTypes9.shape({
|
|
1700
|
+
popover: PropTypes9.elementType,
|
|
1701
|
+
popoverContent: PropTypes9.elementType,
|
|
1702
|
+
preview: PropTypes9.elementType,
|
|
1703
|
+
signInButton: PropTypes9.elementType,
|
|
1704
|
+
signOutButton: PropTypes9.elementType
|
|
1033
1705
|
})
|
|
1034
1706
|
}),
|
|
1035
|
-
toolbarActions:
|
|
1707
|
+
toolbarActions: PropTypes9.object
|
|
1036
1708
|
}),
|
|
1037
1709
|
/**
|
|
1038
1710
|
* The components used for each slot inside.
|
|
1039
1711
|
* @default {}
|
|
1040
1712
|
*/
|
|
1041
|
-
slots:
|
|
1042
|
-
appTitle:
|
|
1043
|
-
toolbarAccount:
|
|
1044
|
-
toolbarActions:
|
|
1713
|
+
slots: PropTypes9.shape({
|
|
1714
|
+
appTitle: PropTypes9.elementType,
|
|
1715
|
+
toolbarAccount: PropTypes9.elementType,
|
|
1716
|
+
toolbarActions: PropTypes9.elementType
|
|
1045
1717
|
})
|
|
1046
1718
|
};
|
|
1047
1719
|
|
|
1048
1720
|
// src/toolpad-core/DashboardLayout/DashboardSidebarSubNavigation.tsx
|
|
1049
|
-
import * as
|
|
1721
|
+
import * as React24 from "react";
|
|
1050
1722
|
import Divider2 from "@mui/material/Divider";
|
|
1051
1723
|
import List from "@mui/material/List";
|
|
1052
1724
|
import ListSubheader from "@mui/material/ListSubheader";
|
|
1053
1725
|
|
|
1054
1726
|
// src/toolpad-core/shared/navigation.tsx
|
|
1055
1727
|
import { pathToRegexp } from "path-to-regexp";
|
|
1056
|
-
import
|
|
1728
|
+
import invariant4 from "invariant";
|
|
1057
1729
|
var getItemKind = (item) => {
|
|
1058
1730
|
var _a;
|
|
1059
1731
|
return (_a = item.kind) != null ? _a : "page";
|
|
@@ -1139,7 +1811,7 @@ function matchPath(navigation, path) {
|
|
|
1139
1811
|
function getItemPath(navigation, item) {
|
|
1140
1812
|
const map = getItemToPathMap(navigation);
|
|
1141
1813
|
const path = map.get(item);
|
|
1142
|
-
|
|
1814
|
+
invariant4(path, `Item not found in navigation: ${item.title}`);
|
|
1143
1815
|
return path;
|
|
1144
1816
|
}
|
|
1145
1817
|
function hasSelectedNavigationChildren(navigation, item, activePagePath) {
|
|
@@ -1173,15 +1845,15 @@ function getDrawerWidthTransitionMixin(isExpanded) {
|
|
|
1173
1845
|
}
|
|
1174
1846
|
|
|
1175
1847
|
// src/toolpad-core/useActivePage/useActivePage.ts
|
|
1176
|
-
import * as
|
|
1848
|
+
import * as React22 from "react";
|
|
1177
1849
|
function useActivePage() {
|
|
1178
1850
|
var _a;
|
|
1179
|
-
const navigationContext =
|
|
1180
|
-
const routerContext =
|
|
1851
|
+
const navigationContext = React22.useContext(NavigationContext);
|
|
1852
|
+
const routerContext = React22.useContext(RouterContext);
|
|
1181
1853
|
const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
|
|
1182
1854
|
const activeItem = matchPath(navigationContext, pathname);
|
|
1183
1855
|
const rootItem = matchPath(navigationContext, "/");
|
|
1184
|
-
return
|
|
1856
|
+
return React22.useMemo(() => {
|
|
1185
1857
|
if (!activeItem) {
|
|
1186
1858
|
return null;
|
|
1187
1859
|
}
|
|
@@ -1219,8 +1891,8 @@ function useActivePage() {
|
|
|
1219
1891
|
}
|
|
1220
1892
|
|
|
1221
1893
|
// src/toolpad-core/DashboardLayout/DashboardSidebarPageItem.tsx
|
|
1222
|
-
import * as
|
|
1223
|
-
import
|
|
1894
|
+
import * as React23 from "react";
|
|
1895
|
+
import PropTypes10 from "prop-types";
|
|
1224
1896
|
import { styled as styled3 } from "@mui/material";
|
|
1225
1897
|
import Avatar2 from "@mui/material/Avatar";
|
|
1226
1898
|
import Box3 from "@mui/material/Box";
|
|
@@ -1233,13 +1905,13 @@ import ListItemText from "@mui/material/ListItemText";
|
|
|
1233
1905
|
import Paper from "@mui/material/Paper";
|
|
1234
1906
|
import Typography3 from "@mui/material/Typography";
|
|
1235
1907
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
1236
|
-
import
|
|
1908
|
+
import invariant5 from "invariant";
|
|
1237
1909
|
|
|
1238
1910
|
// src/toolpad-core/DashboardLayout/shared.ts
|
|
1239
1911
|
var MINI_DRAWER_WIDTH = 84;
|
|
1240
1912
|
|
|
1241
1913
|
// src/toolpad-core/DashboardLayout/DashboardSidebarPageItem.tsx
|
|
1242
|
-
import { jsx as
|
|
1914
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1243
1915
|
var NavigationListItemButton = styled3(ListItemButton)(({ theme }) => {
|
|
1244
1916
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1245
1917
|
return {
|
|
@@ -1272,9 +1944,9 @@ var NavigationListItemButton = styled3(ListItemButton)(({ theme }) => {
|
|
|
1272
1944
|
var LIST_ITEM_ICON_SIZE = 34;
|
|
1273
1945
|
function DashboardSidebarPageItem(props) {
|
|
1274
1946
|
var _a;
|
|
1275
|
-
const navigationContext =
|
|
1276
|
-
const pageItemContextProps =
|
|
1277
|
-
|
|
1947
|
+
const navigationContext = React23.useContext(NavigationContext);
|
|
1948
|
+
const pageItemContextProps = React23.useContext(DashboardSidebarPageItemContext);
|
|
1949
|
+
invariant5(pageItemContextProps, "No navigation page item context provided.");
|
|
1278
1950
|
const contextAwareProps = __spreadValues(__spreadValues({}, pageItemContextProps), props);
|
|
1279
1951
|
const {
|
|
1280
1952
|
item,
|
|
@@ -1290,10 +1962,10 @@ function DashboardSidebarPageItem(props) {
|
|
|
1290
1962
|
isSidebarFullyCollapsed = false,
|
|
1291
1963
|
renderNestedNavigation
|
|
1292
1964
|
} = contextAwareProps;
|
|
1293
|
-
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] =
|
|
1965
|
+
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React23.useState(
|
|
1294
1966
|
null
|
|
1295
1967
|
);
|
|
1296
|
-
const handleClick =
|
|
1968
|
+
const handleClick = React23.useCallback(() => {
|
|
1297
1969
|
onClick(id, item);
|
|
1298
1970
|
}, [id, item, onClick]);
|
|
1299
1971
|
let nestedNavigationCollapseSx = { display: "none" };
|
|
@@ -1318,7 +1990,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1318
1990
|
const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
|
|
1319
1991
|
const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
|
|
1320
1992
|
const title = getItemTitle(item);
|
|
1321
|
-
const listItem = /* @__PURE__ */
|
|
1993
|
+
const listItem = /* @__PURE__ */ jsxs12(
|
|
1322
1994
|
ListItem,
|
|
1323
1995
|
__spreadProps(__spreadValues({}, item.children && isMini ? {
|
|
1324
1996
|
onMouseEnter: () => {
|
|
@@ -1334,7 +2006,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1334
2006
|
overflowX: "hidden"
|
|
1335
2007
|
},
|
|
1336
2008
|
children: [
|
|
1337
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsxs12(
|
|
1338
2010
|
NavigationListItemButton,
|
|
1339
2011
|
__spreadProps(__spreadValues(__spreadValues({
|
|
1340
2012
|
selected,
|
|
@@ -1355,7 +2027,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1355
2027
|
onClick: handleClick
|
|
1356
2028
|
}) : {}), {
|
|
1357
2029
|
children: [
|
|
1358
|
-
item.icon || isMini ? /* @__PURE__ */
|
|
2030
|
+
item.icon || isMini ? /* @__PURE__ */ jsxs12(
|
|
1359
2031
|
Box3,
|
|
1360
2032
|
{
|
|
1361
2033
|
sx: isMini ? {
|
|
@@ -1365,7 +2037,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1365
2037
|
transform: "translate(-50%, -50%)"
|
|
1366
2038
|
} : {},
|
|
1367
2039
|
children: [
|
|
1368
|
-
/* @__PURE__ */
|
|
2040
|
+
/* @__PURE__ */ jsxs12(
|
|
1369
2041
|
ListItemIcon,
|
|
1370
2042
|
{
|
|
1371
2043
|
sx: {
|
|
@@ -1376,7 +2048,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1376
2048
|
},
|
|
1377
2049
|
children: [
|
|
1378
2050
|
(_a = item.icon) != null ? _a : null,
|
|
1379
|
-
!item.icon && isMini ? /* @__PURE__ */
|
|
2051
|
+
!item.icon && isMini ? /* @__PURE__ */ jsx19(
|
|
1380
2052
|
Avatar2,
|
|
1381
2053
|
{
|
|
1382
2054
|
sx: {
|
|
@@ -1390,7 +2062,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1390
2062
|
]
|
|
1391
2063
|
}
|
|
1392
2064
|
),
|
|
1393
|
-
isMini ? /* @__PURE__ */
|
|
2065
|
+
isMini ? /* @__PURE__ */ jsx19(
|
|
1394
2066
|
Typography3,
|
|
1395
2067
|
{
|
|
1396
2068
|
variant: "caption",
|
|
@@ -1413,7 +2085,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1413
2085
|
]
|
|
1414
2086
|
}
|
|
1415
2087
|
) : null,
|
|
1416
|
-
!isMini ? /* @__PURE__ */
|
|
2088
|
+
!isMini ? /* @__PURE__ */ jsx19(
|
|
1417
2089
|
ListItemText,
|
|
1418
2090
|
{
|
|
1419
2091
|
primary: title,
|
|
@@ -1425,11 +2097,11 @@ function DashboardSidebarPageItem(props) {
|
|
|
1425
2097
|
}
|
|
1426
2098
|
) : null,
|
|
1427
2099
|
item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
|
|
1428
|
-
item.children ? /* @__PURE__ */
|
|
2100
|
+
item.children ? /* @__PURE__ */ jsx19(ExpandMoreIcon, { sx: nestedNavigationCollapseSx }) : null
|
|
1429
2101
|
]
|
|
1430
2102
|
})
|
|
1431
2103
|
),
|
|
1432
|
-
item.children && isMini ? /* @__PURE__ */
|
|
2104
|
+
item.children && isMini ? /* @__PURE__ */ jsx19(Grow, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsx19(
|
|
1433
2105
|
Box3,
|
|
1434
2106
|
{
|
|
1435
2107
|
sx: {
|
|
@@ -1437,7 +2109,7 @@ function DashboardSidebarPageItem(props) {
|
|
|
1437
2109
|
left: MINI_DRAWER_WIDTH - 2,
|
|
1438
2110
|
pl: "6px"
|
|
1439
2111
|
},
|
|
1440
|
-
children: /* @__PURE__ */
|
|
2112
|
+
children: /* @__PURE__ */ jsx19(
|
|
1441
2113
|
Paper,
|
|
1442
2114
|
{
|
|
1443
2115
|
sx: {
|
|
@@ -1453,9 +2125,9 @@ function DashboardSidebarPageItem(props) {
|
|
|
1453
2125
|
]
|
|
1454
2126
|
})
|
|
1455
2127
|
);
|
|
1456
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsxs12(React23.Fragment, { children: [
|
|
1457
2129
|
listItem,
|
|
1458
|
-
item.children && !isMini ? /* @__PURE__ */
|
|
2130
|
+
item.children && !isMini ? /* @__PURE__ */ jsx19(Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
|
|
1459
2131
|
] }, id);
|
|
1460
2132
|
}
|
|
1461
2133
|
DashboardSidebarPageItem.propTypes = {
|
|
@@ -1467,54 +2139,54 @@ DashboardSidebarPageItem.propTypes = {
|
|
|
1467
2139
|
* If `true`, the item is disabled.
|
|
1468
2140
|
* @default false
|
|
1469
2141
|
*/
|
|
1470
|
-
disabled:
|
|
2142
|
+
disabled: PropTypes10.bool,
|
|
1471
2143
|
/**
|
|
1472
2144
|
* If `true`, expands any nested navigation in the item, otherwise collapse it.
|
|
1473
2145
|
* @default false
|
|
1474
2146
|
*/
|
|
1475
|
-
expanded:
|
|
2147
|
+
expanded: PropTypes10.bool,
|
|
1476
2148
|
/**
|
|
1477
2149
|
* Link `href` for when the item is rendered as a link.
|
|
1478
2150
|
* @default getItemPath(navigationContext, item)
|
|
1479
2151
|
*/
|
|
1480
|
-
href:
|
|
2152
|
+
href: PropTypes10.string,
|
|
1481
2153
|
/**
|
|
1482
2154
|
* Navigation page item definition.
|
|
1483
2155
|
*/
|
|
1484
|
-
item:
|
|
1485
|
-
action:
|
|
1486
|
-
children:
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
kind:
|
|
1491
|
-
title:
|
|
2156
|
+
item: PropTypes10.shape({
|
|
2157
|
+
action: PropTypes10.node,
|
|
2158
|
+
children: PropTypes10.arrayOf(
|
|
2159
|
+
PropTypes10.oneOfType([
|
|
2160
|
+
PropTypes10.object,
|
|
2161
|
+
PropTypes10.shape({
|
|
2162
|
+
kind: PropTypes10.oneOf(["header"]).isRequired,
|
|
2163
|
+
title: PropTypes10.string.isRequired
|
|
1492
2164
|
}),
|
|
1493
|
-
|
|
1494
|
-
kind:
|
|
2165
|
+
PropTypes10.shape({
|
|
2166
|
+
kind: PropTypes10.oneOf(["divider"]).isRequired
|
|
1495
2167
|
})
|
|
1496
2168
|
]).isRequired
|
|
1497
2169
|
),
|
|
1498
|
-
icon:
|
|
1499
|
-
kind:
|
|
1500
|
-
pattern:
|
|
1501
|
-
segment:
|
|
1502
|
-
title:
|
|
2170
|
+
icon: PropTypes10.node,
|
|
2171
|
+
kind: PropTypes10.oneOf(["page"]),
|
|
2172
|
+
pattern: PropTypes10.string,
|
|
2173
|
+
segment: PropTypes10.string,
|
|
2174
|
+
title: PropTypes10.string
|
|
1503
2175
|
}).isRequired,
|
|
1504
2176
|
/**
|
|
1505
2177
|
* The component used to render the item as a link.
|
|
1506
2178
|
* @default Link
|
|
1507
2179
|
*/
|
|
1508
|
-
LinkComponent:
|
|
2180
|
+
LinkComponent: PropTypes10.elementType,
|
|
1509
2181
|
/**
|
|
1510
2182
|
* Use to apply selected styling.
|
|
1511
2183
|
* @default false
|
|
1512
2184
|
*/
|
|
1513
|
-
selected:
|
|
2185
|
+
selected: PropTypes10.bool
|
|
1514
2186
|
};
|
|
1515
2187
|
|
|
1516
2188
|
// src/toolpad-core/DashboardLayout/DashboardSidebarSubNavigation.tsx
|
|
1517
|
-
import { jsx as
|
|
2189
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1518
2190
|
function DashboardSidebarSubNavigationPageItem({
|
|
1519
2191
|
id,
|
|
1520
2192
|
item,
|
|
@@ -1528,11 +2200,11 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
1528
2200
|
sidebarExpandedWidth,
|
|
1529
2201
|
renderPageItem
|
|
1530
2202
|
}) {
|
|
1531
|
-
const navigationContext =
|
|
2203
|
+
const navigationContext = React24.useContext(NavigationContext);
|
|
1532
2204
|
const activePage = useActivePage();
|
|
1533
2205
|
const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
|
|
1534
2206
|
const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
|
|
1535
|
-
const pageItemContextProps =
|
|
2207
|
+
const pageItemContextProps = React24.useMemo(
|
|
1536
2208
|
() => ({
|
|
1537
2209
|
expanded: isExpanded,
|
|
1538
2210
|
selected: isSelected,
|
|
@@ -1543,7 +2215,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
1543
2215
|
isSidebarFullyCollapsed: isFullyCollapsed,
|
|
1544
2216
|
renderNestedNavigation: () => {
|
|
1545
2217
|
var _a;
|
|
1546
|
-
return /* @__PURE__ */
|
|
2218
|
+
return /* @__PURE__ */ jsx20(
|
|
1547
2219
|
DashboardSidebarSubNavigation,
|
|
1548
2220
|
{
|
|
1549
2221
|
subNavigation: (_a = item.children) != null ? _a : [],
|
|
@@ -1569,7 +2241,7 @@ function DashboardSidebarSubNavigationPageItem({
|
|
|
1569
2241
|
sidebarExpandedWidth
|
|
1570
2242
|
]
|
|
1571
2243
|
);
|
|
1572
|
-
return /* @__PURE__ */
|
|
2244
|
+
return /* @__PURE__ */ jsx20(DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsx20(DashboardSidebarPageItem, { item }) });
|
|
1573
2245
|
}
|
|
1574
2246
|
function DashboardSidebarSubNavigation({
|
|
1575
2247
|
subNavigation,
|
|
@@ -1583,9 +2255,9 @@ function DashboardSidebarSubNavigation({
|
|
|
1583
2255
|
sidebarExpandedWidth,
|
|
1584
2256
|
renderPageItem
|
|
1585
2257
|
}) {
|
|
1586
|
-
const navigationContext =
|
|
2258
|
+
const navigationContext = React24.useContext(NavigationContext);
|
|
1587
2259
|
const activePage = useActivePage();
|
|
1588
|
-
const initialExpandedItemIds =
|
|
2260
|
+
const initialExpandedItemIds = React24.useMemo(
|
|
1589
2261
|
() => subNavigation.map((navigationItem, navigationItemIndex) => ({
|
|
1590
2262
|
navigationItem,
|
|
1591
2263
|
originalIndex: navigationItemIndex
|
|
@@ -1594,8 +2266,8 @@ function DashboardSidebarSubNavigation({
|
|
|
1594
2266
|
).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
|
|
1595
2267
|
[activePage, depth, navigationContext, subNavigation]
|
|
1596
2268
|
);
|
|
1597
|
-
const [expandedItemIds, setExpandedItemIds] =
|
|
1598
|
-
const handlePageItemClick =
|
|
2269
|
+
const [expandedItemIds, setExpandedItemIds] = React24.useState(initialExpandedItemIds);
|
|
2270
|
+
const handlePageItemClick = React24.useCallback(
|
|
1599
2271
|
(itemId, item) => {
|
|
1600
2272
|
if (item.children && !isMini) {
|
|
1601
2273
|
setExpandedItemIds(
|
|
@@ -1607,7 +2279,7 @@ function DashboardSidebarSubNavigation({
|
|
|
1607
2279
|
},
|
|
1608
2280
|
[isMini, onLinkClick]
|
|
1609
2281
|
);
|
|
1610
|
-
return /* @__PURE__ */
|
|
2282
|
+
return /* @__PURE__ */ jsx20(
|
|
1611
2283
|
List,
|
|
1612
2284
|
{
|
|
1613
2285
|
sx: {
|
|
@@ -1620,7 +2292,7 @@ function DashboardSidebarSubNavigation({
|
|
|
1620
2292
|
},
|
|
1621
2293
|
children: subNavigation.map((navigationItem, navigationItemIndex) => {
|
|
1622
2294
|
if (navigationItem.kind === "header") {
|
|
1623
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx20(
|
|
1624
2296
|
ListSubheader,
|
|
1625
2297
|
{
|
|
1626
2298
|
sx: __spreadProps(__spreadValues({
|
|
@@ -1642,7 +2314,7 @@ function DashboardSidebarSubNavigation({
|
|
|
1642
2314
|
}
|
|
1643
2315
|
if (navigationItem.kind === "divider") {
|
|
1644
2316
|
const nextItem = subNavigation[navigationItemIndex + 1];
|
|
1645
|
-
return /* @__PURE__ */
|
|
2317
|
+
return /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(
|
|
1646
2318
|
Divider2,
|
|
1647
2319
|
{
|
|
1648
2320
|
sx: __spreadValues({
|
|
@@ -1655,7 +2327,7 @@ function DashboardSidebarSubNavigation({
|
|
|
1655
2327
|
) }, `divider-${depth}-${navigationItemIndex}`);
|
|
1656
2328
|
}
|
|
1657
2329
|
const pageItemId = `page-${depth}-${navigationItemIndex}`;
|
|
1658
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ jsx20(
|
|
1659
2331
|
DashboardSidebarSubNavigationPageItem,
|
|
1660
2332
|
{
|
|
1661
2333
|
id: pageItemId,
|
|
@@ -1678,7 +2350,7 @@ function DashboardSidebarSubNavigation({
|
|
|
1678
2350
|
}
|
|
1679
2351
|
|
|
1680
2352
|
// src/toolpad-core/DashboardLayout/DashboardLayout.tsx
|
|
1681
|
-
import { jsx as
|
|
2353
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1682
2354
|
function DashboardLayout(props) {
|
|
1683
2355
|
var _a, _b;
|
|
1684
2356
|
const {
|
|
@@ -1699,26 +2371,26 @@ function DashboardLayout(props) {
|
|
|
1699
2371
|
"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)."
|
|
1700
2372
|
);
|
|
1701
2373
|
}
|
|
1702
|
-
const theme =
|
|
1703
|
-
const navigationContext =
|
|
1704
|
-
const appWindowContext =
|
|
2374
|
+
const theme = useTheme4();
|
|
2375
|
+
const navigationContext = React25.useContext(NavigationContext);
|
|
2376
|
+
const appWindowContext = React25.useContext(WindowContext);
|
|
1705
2377
|
const navigation = navigationProp != null ? navigationProp : navigationContext;
|
|
1706
|
-
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] =
|
|
1707
|
-
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] =
|
|
1708
|
-
const isOverSmViewport =
|
|
2378
|
+
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React25.useState(!defaultSidebarCollapsed);
|
|
2379
|
+
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React25.useState(false);
|
|
2380
|
+
const isOverSmViewport = useMediaQuery2(
|
|
1709
2381
|
theme.breakpoints.up("sm"),
|
|
1710
2382
|
appWindowContext && {
|
|
1711
2383
|
matchMedia: appWindowContext.matchMedia
|
|
1712
2384
|
}
|
|
1713
2385
|
);
|
|
1714
|
-
const isOverMdViewport =
|
|
2386
|
+
const isOverMdViewport = useMediaQuery2(
|
|
1715
2387
|
theme.breakpoints.up("md"),
|
|
1716
2388
|
appWindowContext && {
|
|
1717
2389
|
matchMedia: appWindowContext.matchMedia
|
|
1718
2390
|
}
|
|
1719
2391
|
);
|
|
1720
2392
|
const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
|
|
1721
|
-
const setIsNavigationExpanded =
|
|
2393
|
+
const setIsNavigationExpanded = React25.useCallback(
|
|
1722
2394
|
(newExpanded) => {
|
|
1723
2395
|
if (isOverMdViewport) {
|
|
1724
2396
|
setIsDesktopNavigationExpanded(newExpanded);
|
|
@@ -1728,9 +2400,9 @@ function DashboardLayout(props) {
|
|
|
1728
2400
|
},
|
|
1729
2401
|
[isOverMdViewport]
|
|
1730
2402
|
);
|
|
1731
|
-
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] =
|
|
1732
|
-
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] =
|
|
1733
|
-
|
|
2403
|
+
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React25.useState(isNavigationExpanded);
|
|
2404
|
+
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React25.useState(!isNavigationExpanded);
|
|
2405
|
+
React25.useEffect(() => {
|
|
1734
2406
|
if (isNavigationExpanded) {
|
|
1735
2407
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
1736
2408
|
setIsNavigationFullyExpanded(true);
|
|
@@ -1741,7 +2413,7 @@ function DashboardLayout(props) {
|
|
|
1741
2413
|
return () => {
|
|
1742
2414
|
};
|
|
1743
2415
|
}, [isNavigationExpanded, theme]);
|
|
1744
|
-
|
|
2416
|
+
React25.useEffect(() => {
|
|
1745
2417
|
if (!isNavigationExpanded) {
|
|
1746
2418
|
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
1747
2419
|
setIsNavigationFullyCollapsed(true);
|
|
@@ -1752,19 +2424,19 @@ function DashboardLayout(props) {
|
|
|
1752
2424
|
return () => {
|
|
1753
2425
|
};
|
|
1754
2426
|
}, [isNavigationExpanded, theme]);
|
|
1755
|
-
const handleSetNavigationExpanded =
|
|
2427
|
+
const handleSetNavigationExpanded = React25.useCallback(
|
|
1756
2428
|
(newExpanded) => () => {
|
|
1757
2429
|
setIsNavigationExpanded(newExpanded);
|
|
1758
2430
|
},
|
|
1759
2431
|
[setIsNavigationExpanded]
|
|
1760
2432
|
);
|
|
1761
|
-
const handleToggleHeaderMenu =
|
|
2433
|
+
const handleToggleHeaderMenu = React25.useCallback(
|
|
1762
2434
|
(isExpanded) => {
|
|
1763
2435
|
setIsNavigationExpanded(isExpanded);
|
|
1764
2436
|
},
|
|
1765
2437
|
[setIsNavigationExpanded]
|
|
1766
2438
|
);
|
|
1767
|
-
const handleNavigationLinkClick =
|
|
2439
|
+
const handleNavigationLinkClick = React25.useCallback(() => {
|
|
1768
2440
|
setIsMobileNavigationExpanded(false);
|
|
1769
2441
|
}, [setIsMobileNavigationExpanded]);
|
|
1770
2442
|
const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
|
|
@@ -1772,7 +2444,7 @@ function DashboardLayout(props) {
|
|
|
1772
2444
|
const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
|
|
1773
2445
|
const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
|
|
1774
2446
|
const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
|
|
1775
|
-
const headerSlotProps =
|
|
2447
|
+
const headerSlotProps = React25.useMemo(
|
|
1776
2448
|
() => __spreadValues({
|
|
1777
2449
|
branding,
|
|
1778
2450
|
menuOpen: isNavigationExpanded,
|
|
@@ -1800,12 +2472,12 @@ function DashboardLayout(props) {
|
|
|
1800
2472
|
slots
|
|
1801
2473
|
]
|
|
1802
2474
|
);
|
|
1803
|
-
const getDrawerContent =
|
|
2475
|
+
const getDrawerContent = React25.useCallback(
|
|
1804
2476
|
(isMini, viewport) => {
|
|
1805
2477
|
var _a2;
|
|
1806
|
-
return /* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
2478
|
+
return /* @__PURE__ */ jsxs13(React25.Fragment, { children: [
|
|
2479
|
+
/* @__PURE__ */ jsx21(Toolbar2, {}),
|
|
2480
|
+
/* @__PURE__ */ jsxs13(
|
|
1809
2481
|
Box4,
|
|
1810
2482
|
{
|
|
1811
2483
|
component: "nav",
|
|
@@ -1821,7 +2493,7 @@ function DashboardLayout(props) {
|
|
|
1821
2493
|
pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
|
|
1822
2494
|
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
|
|
1823
2495
|
children: [
|
|
1824
|
-
/* @__PURE__ */
|
|
2496
|
+
/* @__PURE__ */ jsx21(
|
|
1825
2497
|
DashboardSidebarSubNavigation,
|
|
1826
2498
|
{
|
|
1827
2499
|
subNavigation: navigation,
|
|
@@ -1834,7 +2506,7 @@ function DashboardLayout(props) {
|
|
|
1834
2506
|
renderPageItem
|
|
1835
2507
|
}
|
|
1836
2508
|
),
|
|
1837
|
-
SidebarFooterSlot ? /* @__PURE__ */
|
|
2509
|
+
SidebarFooterSlot ? /* @__PURE__ */ jsx21(SidebarFooterSlot, __spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
|
|
1838
2510
|
]
|
|
1839
2511
|
}
|
|
1840
2512
|
)
|
|
@@ -1852,7 +2524,7 @@ function DashboardLayout(props) {
|
|
|
1852
2524
|
slotProps == null ? void 0 : slotProps.sidebarFooter
|
|
1853
2525
|
]
|
|
1854
2526
|
);
|
|
1855
|
-
const getDrawerSharedSx =
|
|
2527
|
+
const getDrawerSharedSx = React25.useCallback(
|
|
1856
2528
|
(isMini, isTemporary) => {
|
|
1857
2529
|
const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
|
|
1858
2530
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
@@ -1870,7 +2542,7 @@ function DashboardLayout(props) {
|
|
|
1870
2542
|
},
|
|
1871
2543
|
[isNavigationExpanded, sidebarExpandedWidth]
|
|
1872
2544
|
);
|
|
1873
|
-
return /* @__PURE__ */
|
|
2545
|
+
return /* @__PURE__ */ jsxs13(
|
|
1874
2546
|
Box4,
|
|
1875
2547
|
{
|
|
1876
2548
|
sx: __spreadValues({
|
|
@@ -1881,9 +2553,9 @@ function DashboardLayout(props) {
|
|
|
1881
2553
|
width: "100vw"
|
|
1882
2554
|
}, sx),
|
|
1883
2555
|
children: [
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
!hideNavigation ? /* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
2556
|
+
/* @__PURE__ */ jsx21(HeaderSlot, __spreadValues({}, headerSlotProps)),
|
|
2557
|
+
!hideNavigation ? /* @__PURE__ */ jsxs13(React25.Fragment, { children: [
|
|
2558
|
+
/* @__PURE__ */ jsx21(
|
|
1887
2559
|
Drawer,
|
|
1888
2560
|
{
|
|
1889
2561
|
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
@@ -1904,7 +2576,7 @@ function DashboardLayout(props) {
|
|
|
1904
2576
|
children: getDrawerContent(false, "phone")
|
|
1905
2577
|
}
|
|
1906
2578
|
),
|
|
1907
|
-
/* @__PURE__ */
|
|
2579
|
+
/* @__PURE__ */ jsx21(
|
|
1908
2580
|
Drawer,
|
|
1909
2581
|
{
|
|
1910
2582
|
variant: "permanent",
|
|
@@ -1918,7 +2590,7 @@ function DashboardLayout(props) {
|
|
|
1918
2590
|
children: getDrawerContent(isMobileMini, "tablet")
|
|
1919
2591
|
}
|
|
1920
2592
|
),
|
|
1921
|
-
/* @__PURE__ */
|
|
2593
|
+
/* @__PURE__ */ jsx21(
|
|
1922
2594
|
Drawer,
|
|
1923
2595
|
{
|
|
1924
2596
|
variant: "permanent",
|
|
@@ -1929,7 +2601,7 @@ function DashboardLayout(props) {
|
|
|
1929
2601
|
}
|
|
1930
2602
|
)
|
|
1931
2603
|
] }) : null,
|
|
1932
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs13(
|
|
1933
2605
|
Box4,
|
|
1934
2606
|
{
|
|
1935
2607
|
sx: {
|
|
@@ -1939,8 +2611,8 @@ function DashboardLayout(props) {
|
|
|
1939
2611
|
minWidth: 0
|
|
1940
2612
|
},
|
|
1941
2613
|
children: [
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsx21(Toolbar2, { sx: { displayPrint: "none" } }),
|
|
2615
|
+
/* @__PURE__ */ jsx21(
|
|
1944
2616
|
Box4,
|
|
1945
2617
|
{
|
|
1946
2618
|
component: "main",
|
|
@@ -1969,63 +2641,63 @@ DashboardLayout.propTypes = {
|
|
|
1969
2641
|
* Branding options for the dashboard.
|
|
1970
2642
|
* @default null
|
|
1971
2643
|
*/
|
|
1972
|
-
branding:
|
|
1973
|
-
homeUrl:
|
|
1974
|
-
logo:
|
|
1975
|
-
title:
|
|
2644
|
+
branding: PropTypes11.shape({
|
|
2645
|
+
homeUrl: PropTypes11.string,
|
|
2646
|
+
logo: PropTypes11.node,
|
|
2647
|
+
title: PropTypes11.string
|
|
1976
2648
|
}),
|
|
1977
2649
|
/**
|
|
1978
2650
|
* The content of the dashboard.
|
|
1979
2651
|
*/
|
|
1980
|
-
children:
|
|
2652
|
+
children: PropTypes11.node,
|
|
1981
2653
|
/**
|
|
1982
2654
|
* Whether the sidebar should start collapsed in desktop size screens.
|
|
1983
2655
|
* @default false
|
|
1984
2656
|
*/
|
|
1985
|
-
defaultSidebarCollapsed:
|
|
2657
|
+
defaultSidebarCollapsed: PropTypes11.bool,
|
|
1986
2658
|
/**
|
|
1987
2659
|
* Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
|
|
1988
2660
|
* @default false
|
|
1989
2661
|
*/
|
|
1990
|
-
disableCollapsibleSidebar:
|
|
2662
|
+
disableCollapsibleSidebar: PropTypes11.bool,
|
|
1991
2663
|
/**
|
|
1992
2664
|
* Whether the navigation bar and menu icon should be hidden.
|
|
1993
2665
|
* @default false
|
|
1994
2666
|
*/
|
|
1995
|
-
hideNavigation:
|
|
2667
|
+
hideNavigation: PropTypes11.bool,
|
|
1996
2668
|
/**
|
|
1997
2669
|
* Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
|
|
1998
2670
|
* @default []
|
|
1999
2671
|
* @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
|
|
2000
2672
|
*/
|
|
2001
|
-
navigation:
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
action:
|
|
2005
|
-
children:
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
kind:
|
|
2010
|
-
title:
|
|
2673
|
+
navigation: PropTypes11.arrayOf(
|
|
2674
|
+
PropTypes11.oneOfType([
|
|
2675
|
+
PropTypes11.shape({
|
|
2676
|
+
action: PropTypes11.node,
|
|
2677
|
+
children: PropTypes11.arrayOf(
|
|
2678
|
+
PropTypes11.oneOfType([
|
|
2679
|
+
PropTypes11.object,
|
|
2680
|
+
PropTypes11.shape({
|
|
2681
|
+
kind: PropTypes11.oneOf(["header"]).isRequired,
|
|
2682
|
+
title: PropTypes11.string.isRequired
|
|
2011
2683
|
}),
|
|
2012
|
-
|
|
2013
|
-
kind:
|
|
2684
|
+
PropTypes11.shape({
|
|
2685
|
+
kind: PropTypes11.oneOf(["divider"]).isRequired
|
|
2014
2686
|
})
|
|
2015
2687
|
]).isRequired
|
|
2016
2688
|
),
|
|
2017
|
-
icon:
|
|
2018
|
-
kind:
|
|
2019
|
-
pattern:
|
|
2020
|
-
segment:
|
|
2021
|
-
title:
|
|
2689
|
+
icon: PropTypes11.node,
|
|
2690
|
+
kind: PropTypes11.oneOf(["page"]),
|
|
2691
|
+
pattern: PropTypes11.string,
|
|
2692
|
+
segment: PropTypes11.string,
|
|
2693
|
+
title: PropTypes11.string
|
|
2022
2694
|
}),
|
|
2023
|
-
|
|
2024
|
-
kind:
|
|
2025
|
-
title:
|
|
2695
|
+
PropTypes11.shape({
|
|
2696
|
+
kind: PropTypes11.oneOf(["header"]).isRequired,
|
|
2697
|
+
title: PropTypes11.string.isRequired
|
|
2026
2698
|
}),
|
|
2027
|
-
|
|
2028
|
-
kind:
|
|
2699
|
+
PropTypes11.shape({
|
|
2700
|
+
kind: PropTypes11.oneOf(["divider"]).isRequired
|
|
2029
2701
|
})
|
|
2030
2702
|
]).isRequired
|
|
2031
2703
|
),
|
|
@@ -2036,106 +2708,106 @@ DashboardLayout.propTypes = {
|
|
|
2036
2708
|
* @param {{ mini: boolean }} params
|
|
2037
2709
|
* @returns {ReactNode}
|
|
2038
2710
|
*/
|
|
2039
|
-
renderPageItem:
|
|
2711
|
+
renderPageItem: PropTypes11.func,
|
|
2040
2712
|
/**
|
|
2041
2713
|
* Width of the sidebar when expanded.
|
|
2042
2714
|
* @default 320
|
|
2043
2715
|
*/
|
|
2044
|
-
sidebarExpandedWidth:
|
|
2716
|
+
sidebarExpandedWidth: PropTypes11.oneOfType([PropTypes11.number, PropTypes11.string]),
|
|
2045
2717
|
/**
|
|
2046
2718
|
* The props used for each slot inside.
|
|
2047
2719
|
* @default {}
|
|
2048
2720
|
*/
|
|
2049
|
-
slotProps:
|
|
2050
|
-
appTitle:
|
|
2051
|
-
branding:
|
|
2052
|
-
homeUrl:
|
|
2053
|
-
logo:
|
|
2054
|
-
title:
|
|
2721
|
+
slotProps: PropTypes11.shape({
|
|
2722
|
+
appTitle: PropTypes11.shape({
|
|
2723
|
+
branding: PropTypes11.shape({
|
|
2724
|
+
homeUrl: PropTypes11.string,
|
|
2725
|
+
logo: PropTypes11.node,
|
|
2726
|
+
title: PropTypes11.string
|
|
2055
2727
|
})
|
|
2056
2728
|
}),
|
|
2057
|
-
header:
|
|
2058
|
-
branding:
|
|
2059
|
-
homeUrl:
|
|
2060
|
-
logo:
|
|
2061
|
-
title:
|
|
2729
|
+
header: PropTypes11.shape({
|
|
2730
|
+
branding: PropTypes11.shape({
|
|
2731
|
+
homeUrl: PropTypes11.string,
|
|
2732
|
+
logo: PropTypes11.node,
|
|
2733
|
+
title: PropTypes11.string
|
|
2062
2734
|
}),
|
|
2063
|
-
hideMenuButton:
|
|
2064
|
-
menuOpen:
|
|
2065
|
-
onToggleMenu:
|
|
2066
|
-
slotProps:
|
|
2067
|
-
appTitle:
|
|
2068
|
-
toolbarAccount:
|
|
2069
|
-
toolbarActions:
|
|
2735
|
+
hideMenuButton: PropTypes11.bool,
|
|
2736
|
+
menuOpen: PropTypes11.bool.isRequired,
|
|
2737
|
+
onToggleMenu: PropTypes11.func.isRequired,
|
|
2738
|
+
slotProps: PropTypes11.shape({
|
|
2739
|
+
appTitle: PropTypes11.object,
|
|
2740
|
+
toolbarAccount: PropTypes11.object,
|
|
2741
|
+
toolbarActions: PropTypes11.object
|
|
2070
2742
|
}),
|
|
2071
|
-
slots:
|
|
2072
|
-
appTitle:
|
|
2073
|
-
toolbarAccount:
|
|
2074
|
-
toolbarActions:
|
|
2743
|
+
slots: PropTypes11.shape({
|
|
2744
|
+
appTitle: PropTypes11.elementType,
|
|
2745
|
+
toolbarAccount: PropTypes11.elementType,
|
|
2746
|
+
toolbarActions: PropTypes11.elementType
|
|
2075
2747
|
})
|
|
2076
2748
|
}),
|
|
2077
|
-
sidebarFooter:
|
|
2078
|
-
mini:
|
|
2749
|
+
sidebarFooter: PropTypes11.shape({
|
|
2750
|
+
mini: PropTypes11.bool.isRequired
|
|
2079
2751
|
}),
|
|
2080
|
-
toolbarAccount:
|
|
2081
|
-
localeText:
|
|
2082
|
-
slotProps:
|
|
2083
|
-
popover:
|
|
2084
|
-
popoverContent:
|
|
2085
|
-
preview:
|
|
2086
|
-
signInButton:
|
|
2087
|
-
signOutButton:
|
|
2752
|
+
toolbarAccount: PropTypes11.shape({
|
|
2753
|
+
localeText: PropTypes11.object,
|
|
2754
|
+
slotProps: PropTypes11.shape({
|
|
2755
|
+
popover: PropTypes11.object,
|
|
2756
|
+
popoverContent: PropTypes11.object,
|
|
2757
|
+
preview: PropTypes11.object,
|
|
2758
|
+
signInButton: PropTypes11.object,
|
|
2759
|
+
signOutButton: PropTypes11.object
|
|
2088
2760
|
}),
|
|
2089
|
-
slots:
|
|
2090
|
-
popover:
|
|
2091
|
-
popoverContent:
|
|
2092
|
-
preview:
|
|
2093
|
-
signInButton:
|
|
2094
|
-
signOutButton:
|
|
2761
|
+
slots: PropTypes11.shape({
|
|
2762
|
+
popover: PropTypes11.elementType,
|
|
2763
|
+
popoverContent: PropTypes11.elementType,
|
|
2764
|
+
preview: PropTypes11.elementType,
|
|
2765
|
+
signInButton: PropTypes11.elementType,
|
|
2766
|
+
signOutButton: PropTypes11.elementType
|
|
2095
2767
|
})
|
|
2096
2768
|
}),
|
|
2097
|
-
toolbarActions:
|
|
2769
|
+
toolbarActions: PropTypes11.object
|
|
2098
2770
|
}),
|
|
2099
2771
|
/**
|
|
2100
2772
|
* The components used for each slot inside.
|
|
2101
2773
|
* @default {}
|
|
2102
2774
|
*/
|
|
2103
|
-
slots:
|
|
2104
|
-
appTitle:
|
|
2105
|
-
header:
|
|
2106
|
-
sidebarFooter:
|
|
2107
|
-
toolbarAccount:
|
|
2108
|
-
toolbarActions:
|
|
2775
|
+
slots: PropTypes11.shape({
|
|
2776
|
+
appTitle: PropTypes11.elementType,
|
|
2777
|
+
header: PropTypes11.elementType,
|
|
2778
|
+
sidebarFooter: PropTypes11.elementType,
|
|
2779
|
+
toolbarAccount: PropTypes11.elementType,
|
|
2780
|
+
toolbarActions: PropTypes11.elementType
|
|
2109
2781
|
}),
|
|
2110
2782
|
/**
|
|
2111
2783
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2112
2784
|
*/
|
|
2113
|
-
sx:
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2785
|
+
sx: PropTypes11.oneOfType([
|
|
2786
|
+
PropTypes11.arrayOf(PropTypes11.oneOfType([PropTypes11.func, PropTypes11.object, PropTypes11.bool])),
|
|
2787
|
+
PropTypes11.func,
|
|
2788
|
+
PropTypes11.object
|
|
2117
2789
|
])
|
|
2118
2790
|
};
|
|
2119
2791
|
|
|
2120
2792
|
// src/toolpad-core/PageContainer/PageContainer.tsx
|
|
2121
|
-
import
|
|
2793
|
+
import PropTypes14 from "prop-types";
|
|
2122
2794
|
import Box5 from "@mui/material/Box";
|
|
2123
2795
|
import Container from "@mui/material/Container";
|
|
2124
2796
|
import Stack8 from "@mui/material/Stack";
|
|
2125
2797
|
|
|
2126
2798
|
// src/toolpad-core/PageContainer/PageHeader.tsx
|
|
2127
|
-
import
|
|
2799
|
+
import PropTypes13 from "prop-types";
|
|
2128
2800
|
import Breadcrumbs from "@mui/material/Breadcrumbs";
|
|
2129
2801
|
import Link4 from "@mui/material/Link";
|
|
2130
2802
|
import Stack7 from "@mui/material/Stack";
|
|
2131
2803
|
import Typography4 from "@mui/material/Typography";
|
|
2132
|
-
import
|
|
2804
|
+
import useSlotProps2 from "@mui/utils/useSlotProps";
|
|
2133
2805
|
import { styled as styled5 } from "@mui/material";
|
|
2134
2806
|
|
|
2135
2807
|
// src/toolpad-core/PageContainer/PageHeaderToolbar.tsx
|
|
2136
|
-
import
|
|
2808
|
+
import PropTypes12 from "prop-types";
|
|
2137
2809
|
import { styled as styled4 } from "@mui/material";
|
|
2138
|
-
import { jsx as
|
|
2810
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2139
2811
|
var PageHeaderToolbarRoot = styled4("div")(({ theme }) => ({
|
|
2140
2812
|
display: "flex",
|
|
2141
2813
|
flexDirection: "row",
|
|
@@ -2144,7 +2816,7 @@ var PageHeaderToolbarRoot = styled4("div")(({ theme }) => ({
|
|
|
2144
2816
|
marginLeft: "auto"
|
|
2145
2817
|
}));
|
|
2146
2818
|
function PageHeaderToolbar(props) {
|
|
2147
|
-
return /* @__PURE__ */
|
|
2819
|
+
return /* @__PURE__ */ jsx22(PageHeaderToolbarRoot, __spreadValues({}, props));
|
|
2148
2820
|
}
|
|
2149
2821
|
PageHeaderToolbar.propTypes = {
|
|
2150
2822
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
@@ -2154,11 +2826,11 @@ PageHeaderToolbar.propTypes = {
|
|
|
2154
2826
|
/**
|
|
2155
2827
|
* @ignore
|
|
2156
2828
|
*/
|
|
2157
|
-
children:
|
|
2829
|
+
children: PropTypes12.node
|
|
2158
2830
|
};
|
|
2159
2831
|
|
|
2160
2832
|
// src/toolpad-core/PageContainer/PageHeader.tsx
|
|
2161
|
-
import { jsx as
|
|
2833
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2162
2834
|
var PageContentHeader = styled5("div")(({ theme }) => ({
|
|
2163
2835
|
display: "flex",
|
|
2164
2836
|
flexDirection: "row",
|
|
@@ -2172,15 +2844,15 @@ function PageHeader(props) {
|
|
|
2172
2844
|
const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
|
|
2173
2845
|
const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
|
|
2174
2846
|
const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
|
|
2175
|
-
const toolbarSlotProps =
|
|
2847
|
+
const toolbarSlotProps = useSlotProps2({
|
|
2176
2848
|
elementType: ToolbarComponent,
|
|
2177
2849
|
ownerState: props,
|
|
2178
2850
|
externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
|
|
2179
2851
|
additionalProps: {}
|
|
2180
2852
|
});
|
|
2181
|
-
return /* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
return item.path ? /* @__PURE__ */
|
|
2853
|
+
return /* @__PURE__ */ jsxs14(Stack7, { children: [
|
|
2854
|
+
/* @__PURE__ */ jsx23(Breadcrumbs, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
|
|
2855
|
+
return item.path ? /* @__PURE__ */ jsx23(
|
|
2184
2856
|
Link4,
|
|
2185
2857
|
{
|
|
2186
2858
|
component: Link2,
|
|
@@ -2190,11 +2862,11 @@ function PageHeader(props) {
|
|
|
2190
2862
|
children: getItemTitle(item)
|
|
2191
2863
|
},
|
|
2192
2864
|
index
|
|
2193
|
-
) : /* @__PURE__ */
|
|
2865
|
+
) : /* @__PURE__ */ jsx23(Typography4, { color: "text.primary", children: getItemTitle(item) }, index);
|
|
2194
2866
|
}) : null }),
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
resolvedTitle ? /* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ jsxs14(PageContentHeader, { children: [
|
|
2868
|
+
resolvedTitle ? /* @__PURE__ */ jsx23(Typography4, { variant: "h4", children: resolvedTitle }) : null,
|
|
2869
|
+
/* @__PURE__ */ jsx23(ToolbarComponent, __spreadValues({}, toolbarSlotProps))
|
|
2198
2870
|
] })
|
|
2199
2871
|
] });
|
|
2200
2872
|
}
|
|
@@ -2206,41 +2878,41 @@ PageHeader.propTypes = {
|
|
|
2206
2878
|
/**
|
|
2207
2879
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2208
2880
|
*/
|
|
2209
|
-
breadcrumbs:
|
|
2210
|
-
|
|
2211
|
-
path:
|
|
2212
|
-
title:
|
|
2881
|
+
breadcrumbs: PropTypes13.arrayOf(
|
|
2882
|
+
PropTypes13.shape({
|
|
2883
|
+
path: PropTypes13.string,
|
|
2884
|
+
title: PropTypes13.string.isRequired
|
|
2213
2885
|
})
|
|
2214
2886
|
),
|
|
2215
2887
|
/**
|
|
2216
2888
|
* The props used for each slot inside.
|
|
2217
2889
|
*/
|
|
2218
|
-
slotProps:
|
|
2219
|
-
toolbar:
|
|
2220
|
-
children:
|
|
2890
|
+
slotProps: PropTypes13.shape({
|
|
2891
|
+
toolbar: PropTypes13.shape({
|
|
2892
|
+
children: PropTypes13.node
|
|
2221
2893
|
}).isRequired
|
|
2222
2894
|
}),
|
|
2223
2895
|
/**
|
|
2224
2896
|
* The components used for each slot inside.
|
|
2225
2897
|
*/
|
|
2226
|
-
slots:
|
|
2227
|
-
toolbar:
|
|
2898
|
+
slots: PropTypes13.shape({
|
|
2899
|
+
toolbar: PropTypes13.elementType
|
|
2228
2900
|
}),
|
|
2229
2901
|
/**
|
|
2230
2902
|
* The title of the page. Leave blank to use the active page title.
|
|
2231
2903
|
*/
|
|
2232
|
-
title:
|
|
2904
|
+
title: PropTypes13.string
|
|
2233
2905
|
};
|
|
2234
2906
|
|
|
2235
2907
|
// src/toolpad-core/PageContainer/PageContainer.tsx
|
|
2236
|
-
import { jsx as
|
|
2908
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2237
2909
|
function PageContainer(props) {
|
|
2238
2910
|
var _b;
|
|
2239
2911
|
const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = __objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
|
|
2240
2912
|
const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
|
|
2241
|
-
return /* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2913
|
+
return /* @__PURE__ */ jsx24(Container, __spreadProps(__spreadValues({}, rest), { sx: __spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxs15(Stack8, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
|
|
2914
|
+
/* @__PURE__ */ jsx24(PageHeaderSlot, __spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
|
|
2915
|
+
/* @__PURE__ */ jsx24(Box5, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
|
|
2244
2916
|
] }) }));
|
|
2245
2917
|
}
|
|
2246
2918
|
PageContainer.propTypes = {
|
|
@@ -2251,62 +2923,74 @@ PageContainer.propTypes = {
|
|
|
2251
2923
|
/**
|
|
2252
2924
|
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2253
2925
|
*/
|
|
2254
|
-
breadcrumbs:
|
|
2255
|
-
|
|
2256
|
-
path:
|
|
2257
|
-
title:
|
|
2926
|
+
breadcrumbs: PropTypes14.arrayOf(
|
|
2927
|
+
PropTypes14.shape({
|
|
2928
|
+
path: PropTypes14.string,
|
|
2929
|
+
title: PropTypes14.string.isRequired
|
|
2258
2930
|
})
|
|
2259
2931
|
),
|
|
2260
2932
|
/**
|
|
2261
2933
|
* @ignore
|
|
2262
2934
|
*/
|
|
2263
|
-
children:
|
|
2935
|
+
children: PropTypes14.node,
|
|
2264
2936
|
/**
|
|
2265
2937
|
* The props used for each slot inside.
|
|
2266
2938
|
*/
|
|
2267
|
-
slotProps:
|
|
2268
|
-
header:
|
|
2269
|
-
breadcrumbs:
|
|
2270
|
-
|
|
2271
|
-
path:
|
|
2272
|
-
title:
|
|
2939
|
+
slotProps: PropTypes14.shape({
|
|
2940
|
+
header: PropTypes14.shape({
|
|
2941
|
+
breadcrumbs: PropTypes14.arrayOf(
|
|
2942
|
+
PropTypes14.shape({
|
|
2943
|
+
path: PropTypes14.string,
|
|
2944
|
+
title: PropTypes14.string.isRequired
|
|
2273
2945
|
})
|
|
2274
2946
|
),
|
|
2275
|
-
slotProps:
|
|
2276
|
-
toolbar:
|
|
2947
|
+
slotProps: PropTypes14.shape({
|
|
2948
|
+
toolbar: PropTypes14.object.isRequired
|
|
2277
2949
|
}),
|
|
2278
|
-
slots:
|
|
2279
|
-
toolbar:
|
|
2950
|
+
slots: PropTypes14.shape({
|
|
2951
|
+
toolbar: PropTypes14.elementType
|
|
2280
2952
|
}),
|
|
2281
|
-
title:
|
|
2953
|
+
title: PropTypes14.string
|
|
2282
2954
|
}).isRequired
|
|
2283
2955
|
}),
|
|
2284
2956
|
/**
|
|
2285
2957
|
* The components used for each slot inside.
|
|
2286
2958
|
*/
|
|
2287
|
-
slots:
|
|
2288
|
-
header:
|
|
2959
|
+
slots: PropTypes14.shape({
|
|
2960
|
+
header: PropTypes14.elementType
|
|
2289
2961
|
}),
|
|
2290
2962
|
/**
|
|
2291
2963
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2292
2964
|
*/
|
|
2293
|
-
sx:
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2965
|
+
sx: PropTypes14.oneOfType([
|
|
2966
|
+
PropTypes14.arrayOf(PropTypes14.oneOfType([PropTypes14.func, PropTypes14.object, PropTypes14.bool])),
|
|
2967
|
+
PropTypes14.func,
|
|
2968
|
+
PropTypes14.object
|
|
2297
2969
|
]),
|
|
2298
2970
|
/**
|
|
2299
2971
|
* The title of the page. Leave blank to use the active page title.
|
|
2300
2972
|
*/
|
|
2301
|
-
title:
|
|
2973
|
+
title: PropTypes14.string
|
|
2302
2974
|
};
|
|
2303
2975
|
|
|
2304
2976
|
export {
|
|
2305
2977
|
useNotifications,
|
|
2978
|
+
en_default,
|
|
2979
|
+
LocalizationContext,
|
|
2980
|
+
LocalizationProvider,
|
|
2981
|
+
useLocaleText,
|
|
2982
|
+
NotificationsProvider,
|
|
2306
2983
|
AlertDialog,
|
|
2307
2984
|
ConfirmDialog,
|
|
2308
2985
|
PromptDialog,
|
|
2309
2986
|
useDialogs,
|
|
2987
|
+
DialogsProvider,
|
|
2988
|
+
useStorageStateServer,
|
|
2989
|
+
useStorageState,
|
|
2990
|
+
useLocalStorageState,
|
|
2991
|
+
AuthenticationContext,
|
|
2992
|
+
SessionContext,
|
|
2993
|
+
AppProvider,
|
|
2310
2994
|
SignInButton,
|
|
2311
2995
|
SignOutButton,
|
|
2312
2996
|
AccountPreview,
|