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