@iowas/toolpad 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/dist/core.d.mts +200 -4
- package/dist/core.d.ts +200 -4
- package/dist/core.js +2940 -125
- package/dist/core.mjs +2850 -4
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2940 -194
- package/dist/index.mjs +2850 -5
- package/package.json +2 -12
- package/dist/AppProvider-CIyOzZv_.d.mts +0 -201
- package/dist/AppProvider-CIyOzZv_.d.ts +0 -201
- package/dist/chunk-3JWXE2JW.mjs +0 -114
- package/dist/chunk-5B2NQDIH.js +0 -145
- package/dist/chunk-BN55HN4U.js +0 -12
- package/dist/chunk-F6JD4MSY.mjs +0 -10
- package/dist/chunk-LUTZBKSG.mjs +0 -636
- package/dist/chunk-PMIWCP25.mjs +0 -53
- package/dist/chunk-SITC3EZQ.js +0 -2225
- package/dist/chunk-SWAF5R4Y.js +0 -686
- package/dist/chunk-VMBNHIHN.js +0 -84
- package/dist/chunk-ZXM3V5SD.mjs +0 -2140
- package/dist/nextjs.d.mts +0 -8
- package/dist/nextjs.d.ts +0 -8
- package/dist/nextjs.js +0 -69
- package/dist/nextjs.mjs +0 -44
- package/dist/utils.d.mts +0 -98
- package/dist/utils.d.ts +0 -98
- package/dist/utils.js +0 -76
- package/dist/utils.mjs +0 -3
package/dist/chunk-ZXM3V5SD.mjs
DELETED
|
@@ -1,2140 +0,0 @@
|
|
|
1
|
-
import { RouterContext, NotificationsContext, WindowContext, useLocaleText, DialogsContext, AuthenticationContext, SessionContext, PaletteModeContext, BrandingContext, NavigationContext, DashboardSidebarPageItemContext } from './chunk-LUTZBKSG.mjs';
|
|
2
|
-
import { warnOnce } from './chunk-F6JD4MSY.mjs';
|
|
3
|
-
import { __objRest, __spreadProps, __spreadValues, useNonNullableContext } from './chunk-3JWXE2JW.mjs';
|
|
4
|
-
import * as React16 from 'react';
|
|
5
|
-
import PropTypes9 from 'prop-types';
|
|
6
|
-
import Popover from '@mui/material/Popover';
|
|
7
|
-
import Divider from '@mui/material/Divider';
|
|
8
|
-
import Stack from '@mui/material/Stack';
|
|
9
|
-
import Button from '@mui/material/Button';
|
|
10
|
-
import Dialog from '@mui/material/Dialog';
|
|
11
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
|
12
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
13
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
14
|
-
import TextField from '@mui/material/TextField';
|
|
15
|
-
import DialogContentText from '@mui/material/DialogContentText';
|
|
16
|
-
import invariant from 'invariant';
|
|
17
|
-
import useEventCallback from '@mui/utils/useEventCallback';
|
|
18
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
19
|
-
import LogoutIcon from '@mui/icons-material/Logout';
|
|
20
|
-
import Avatar from '@mui/material/Avatar';
|
|
21
|
-
import Typography from '@mui/material/Typography';
|
|
22
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
23
|
-
import IconButton from '@mui/material/IconButton';
|
|
24
|
-
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
25
|
-
import Box4 from '@mui/material/Box';
|
|
26
|
-
import { styled as styled$1, useTheme as useTheme$1 } from '@mui/material/styles';
|
|
27
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
28
|
-
import Drawer from '@mui/material/Drawer';
|
|
29
|
-
import Toolbar2 from '@mui/material/Toolbar';
|
|
30
|
-
import MuiAppBar from '@mui/material/AppBar';
|
|
31
|
-
import MenuIcon from '@mui/icons-material/Menu';
|
|
32
|
-
import MenuOpenIcon from '@mui/icons-material/MenuOpen';
|
|
33
|
-
import { styled, useTheme } from '@mui/material';
|
|
34
|
-
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
|
35
|
-
import LightModeIcon from '@mui/icons-material/LightMode';
|
|
36
|
-
import List from '@mui/material/List';
|
|
37
|
-
import ListSubheader from '@mui/material/ListSubheader';
|
|
38
|
-
import { pathToRegexp } from 'path-to-regexp';
|
|
39
|
-
import Collapse from '@mui/material/Collapse';
|
|
40
|
-
import Grow from '@mui/material/Grow';
|
|
41
|
-
import ListItem from '@mui/material/ListItem';
|
|
42
|
-
import ListItemButton from '@mui/material/ListItemButton';
|
|
43
|
-
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
44
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
45
|
-
import Paper from '@mui/material/Paper';
|
|
46
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
47
|
-
import Container from '@mui/material/Container';
|
|
48
|
-
import Breadcrumbs from '@mui/material/Breadcrumbs';
|
|
49
|
-
import Link4 from '@mui/material/Link';
|
|
50
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
51
|
-
|
|
52
|
-
var serverNotifications = {
|
|
53
|
-
show: () => {
|
|
54
|
-
throw new Error("Not supported on server side");
|
|
55
|
-
},
|
|
56
|
-
close: () => {
|
|
57
|
-
throw new Error("Not supported on server side");
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
function useNotifications() {
|
|
61
|
-
const context = React16.useContext(NotificationsContext);
|
|
62
|
-
if (context) {
|
|
63
|
-
return context;
|
|
64
|
-
}
|
|
65
|
-
return serverNotifications;
|
|
66
|
-
}
|
|
67
|
-
var defaultLocaleText = {
|
|
68
|
-
alert: "Alert",
|
|
69
|
-
confirm: "Confirm",
|
|
70
|
-
cancel: "Cancel",
|
|
71
|
-
ok: "Ok"
|
|
72
|
-
};
|
|
73
|
-
function useDialogLoadingButton(onClose) {
|
|
74
|
-
const [loading, setLoading] = React16.useState(false);
|
|
75
|
-
const handleClick = async () => {
|
|
76
|
-
try {
|
|
77
|
-
setLoading(true);
|
|
78
|
-
await onClose();
|
|
79
|
-
} finally {
|
|
80
|
-
setLoading(false);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return {
|
|
84
|
-
onClick: handleClick,
|
|
85
|
-
loading
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function AlertDialog({ open, payload, onClose }) {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
const appWindowContext = React16.useContext(WindowContext);
|
|
91
|
-
const globalLocaleText = useLocaleText();
|
|
92
|
-
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
93
|
-
const okButtonProps = useDialogLoadingButton(() => onClose());
|
|
94
|
-
return /* @__PURE__ */ jsxs(
|
|
95
|
-
Dialog,
|
|
96
|
-
{
|
|
97
|
-
maxWidth: "xs",
|
|
98
|
-
fullWidth: true,
|
|
99
|
-
open,
|
|
100
|
-
onClose: () => onClose(),
|
|
101
|
-
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.alert }),
|
|
104
|
-
/* @__PURE__ */ jsx(DialogContent, { children: payload.msg }),
|
|
105
|
-
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
function ConfirmDialog({ open, payload, onClose }) {
|
|
111
|
-
var _a, _b, _c;
|
|
112
|
-
const appWindowContext = React16.useContext(WindowContext);
|
|
113
|
-
const globalLocaleText = useLocaleText();
|
|
114
|
-
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
115
|
-
const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
|
|
116
|
-
const okButtonProps = useDialogLoadingButton(() => onClose(true));
|
|
117
|
-
return /* @__PURE__ */ jsxs(
|
|
118
|
-
Dialog,
|
|
119
|
-
{
|
|
120
|
-
maxWidth: "xs",
|
|
121
|
-
fullWidth: true,
|
|
122
|
-
open,
|
|
123
|
-
onClose: () => onClose(false),
|
|
124
|
-
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
127
|
-
/* @__PURE__ */ jsx(DialogContent, { children: payload.msg }),
|
|
128
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
129
|
-
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
130
|
-
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
|
|
131
|
-
] })
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
function PromptDialog({ open, payload, onClose }) {
|
|
137
|
-
var _a, _b, _c;
|
|
138
|
-
const appWindowContext = React16.useContext(WindowContext);
|
|
139
|
-
const globalLocaleText = useLocaleText();
|
|
140
|
-
const localeText = __spreadValues(__spreadValues({}, defaultLocaleText), globalLocaleText);
|
|
141
|
-
const [input, setInput] = React16.useState("");
|
|
142
|
-
const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
|
|
143
|
-
const [loading, setLoading] = React16.useState(false);
|
|
144
|
-
const name = "input";
|
|
145
|
-
return /* @__PURE__ */ jsxs(
|
|
146
|
-
Dialog,
|
|
147
|
-
{
|
|
148
|
-
maxWidth: "xs",
|
|
149
|
-
fullWidth: true,
|
|
150
|
-
open,
|
|
151
|
-
onClose: () => onClose(null),
|
|
152
|
-
PaperProps: {
|
|
153
|
-
component: "form",
|
|
154
|
-
onSubmit: async (event) => {
|
|
155
|
-
var _a2;
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
try {
|
|
158
|
-
setLoading(true);
|
|
159
|
-
const formData = new FormData(event.currentTarget);
|
|
160
|
-
const value = (_a2 = formData.get(name)) != null ? _a2 : "";
|
|
161
|
-
invariant(typeof value === "string", "Value must come from a text input");
|
|
162
|
-
await onClose(value);
|
|
163
|
-
} finally {
|
|
164
|
-
setLoading(false);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
169
|
-
children: [
|
|
170
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
|
|
171
|
-
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
172
|
-
/* @__PURE__ */ jsxs(DialogContentText, { children: [
|
|
173
|
-
payload.msg,
|
|
174
|
-
" "
|
|
175
|
-
] }),
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
TextField,
|
|
178
|
-
{
|
|
179
|
-
autoFocus: true,
|
|
180
|
-
required: true,
|
|
181
|
-
margin: "dense",
|
|
182
|
-
id: "name",
|
|
183
|
-
name,
|
|
184
|
-
type: "text",
|
|
185
|
-
fullWidth: true,
|
|
186
|
-
variant: "standard",
|
|
187
|
-
value: input,
|
|
188
|
-
onChange: (event) => setInput(event.target.value)
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
] }),
|
|
192
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
193
|
-
/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
|
|
194
|
-
/* @__PURE__ */ jsx(Button, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
|
|
195
|
-
] })
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
function useDialogs() {
|
|
201
|
-
const { open, close } = useNonNullableContext(DialogsContext);
|
|
202
|
-
const alert = useEventCallback(
|
|
203
|
-
(msg, _a = {}) => {
|
|
204
|
-
var _b = _a, { onClose } = _b, options = __objRest(_b, ["onClose"]);
|
|
205
|
-
return open(AlertDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
const confirm = useEventCallback(
|
|
209
|
-
(msg, _c = {}) => {
|
|
210
|
-
var _d = _c, { onClose } = _d, options = __objRest(_d, ["onClose"]);
|
|
211
|
-
return open(ConfirmDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
const prompt = useEventCallback(
|
|
215
|
-
(msg, _e = {}) => {
|
|
216
|
-
var _f = _e, { onClose } = _f, options = __objRest(_f, ["onClose"]);
|
|
217
|
-
return open(PromptDialog, __spreadProps(__spreadValues({}, options), { msg }), { onClose });
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
return React16.useMemo(
|
|
221
|
-
() => ({
|
|
222
|
-
alert,
|
|
223
|
-
confirm,
|
|
224
|
-
prompt,
|
|
225
|
-
open,
|
|
226
|
-
close
|
|
227
|
-
}),
|
|
228
|
-
[alert, close, confirm, open, prompt]
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
var AccountLocaleContext = React16.createContext(null);
|
|
232
|
-
function SignInButton(props) {
|
|
233
|
-
const authentication = React16.useContext(AuthenticationContext);
|
|
234
|
-
const globalLocaleText = useLocaleText();
|
|
235
|
-
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
236
|
-
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
237
|
-
return /* @__PURE__ */ jsx(
|
|
238
|
-
Button,
|
|
239
|
-
__spreadProps(__spreadValues({
|
|
240
|
-
disableElevation: true,
|
|
241
|
-
variant: "contained",
|
|
242
|
-
size: "small",
|
|
243
|
-
onClick: authentication == null ? void 0 : authentication.signIn,
|
|
244
|
-
sx: {
|
|
245
|
-
textTransform: "capitalize",
|
|
246
|
-
filter: "opacity(0.9)",
|
|
247
|
-
width: "50%",
|
|
248
|
-
margin: (theme) => `${theme.spacing(1)} auto`,
|
|
249
|
-
transition: "filter 0.2s ease-in",
|
|
250
|
-
"&:hover": {
|
|
251
|
-
filter: "opacity(1)"
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}, props), {
|
|
255
|
-
children: localeText == null ? void 0 : localeText.accountSignInLabel
|
|
256
|
-
})
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
SignInButton.propTypes = {
|
|
260
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
261
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
262
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
263
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
264
|
-
/**
|
|
265
|
-
* The content of the component.
|
|
266
|
-
*/
|
|
267
|
-
children: PropTypes9.node
|
|
268
|
-
};
|
|
269
|
-
function SignOutButton(props) {
|
|
270
|
-
const authentication = React16.useContext(AuthenticationContext);
|
|
271
|
-
const globalLocaleText = useLocaleText();
|
|
272
|
-
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
273
|
-
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
274
|
-
return /* @__PURE__ */ jsx(
|
|
275
|
-
Button,
|
|
276
|
-
__spreadProps(__spreadValues({
|
|
277
|
-
disabled: !authentication,
|
|
278
|
-
variant: "outlined",
|
|
279
|
-
size: "small",
|
|
280
|
-
disableElevation: true,
|
|
281
|
-
onClick: authentication == null ? void 0 : authentication.signOut,
|
|
282
|
-
sx: {
|
|
283
|
-
textTransform: "capitalize",
|
|
284
|
-
fontWeight: "normal",
|
|
285
|
-
filter: "opacity(0.9)",
|
|
286
|
-
transition: "filter 0.2s ease-in",
|
|
287
|
-
"&:hover": {
|
|
288
|
-
filter: "opacity(1)"
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
startIcon: /* @__PURE__ */ jsx(LogoutIcon, {})
|
|
292
|
-
}, props), {
|
|
293
|
-
children: localeText == null ? void 0 : localeText.accountSignOutLabel
|
|
294
|
-
})
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
SignOutButton.propTypes = {
|
|
298
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
299
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
300
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
301
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
302
|
-
/**
|
|
303
|
-
* The content of the component.
|
|
304
|
-
*/
|
|
305
|
-
children: PropTypes9.node
|
|
306
|
-
};
|
|
307
|
-
function AccountPreview(props) {
|
|
308
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
309
|
-
const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
|
|
310
|
-
const session = React16.useContext(SessionContext);
|
|
311
|
-
const globalLocaleText = useLocaleText();
|
|
312
|
-
const accountLocaleText = React16.useContext(AccountLocaleContext);
|
|
313
|
-
const localeText = __spreadValues(__spreadValues({}, globalLocaleText), accountLocaleText);
|
|
314
|
-
if (!session || !session.user) {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsx(slots.avatar, {}) : /* @__PURE__ */ jsx(
|
|
318
|
-
Avatar,
|
|
319
|
-
__spreadValues({
|
|
320
|
-
src: ((_a = session.user) == null ? void 0 : _a.image) || "",
|
|
321
|
-
alt: ((_b = session.user) == null ? void 0 : _b.name) || ((_c = session.user) == null ? void 0 : _c.email) || "",
|
|
322
|
-
sx: { height: variant === "expanded" ? 48 : 32, width: variant === "expanded" ? 48 : 32 }
|
|
323
|
-
}, slotProps == null ? void 0 : slotProps.avatar)
|
|
324
|
-
);
|
|
325
|
-
if (variant === "expanded") {
|
|
326
|
-
return /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: __spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
|
|
327
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
|
|
328
|
-
avatarContent,
|
|
329
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
|
|
330
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
|
|
331
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
|
|
332
|
-
] })
|
|
333
|
-
] }),
|
|
334
|
-
handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsx(slots.moreIconButton, {}) : /* @__PURE__ */ jsx(
|
|
335
|
-
IconButton,
|
|
336
|
-
__spreadProps(__spreadValues({
|
|
337
|
-
size: "small",
|
|
338
|
-
onClick: handleClick
|
|
339
|
-
}, slotProps == null ? void 0 : slotProps.moreIconButton), {
|
|
340
|
-
sx: __spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
|
|
341
|
-
children: /* @__PURE__ */ jsx(MoreVertIcon, { fontSize: "small" })
|
|
342
|
-
})
|
|
343
|
-
))
|
|
344
|
-
] });
|
|
345
|
-
}
|
|
346
|
-
return /* @__PURE__ */ jsx(Tooltip, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsx(slots.avatarIconButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsx(Stack, { sx: __spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsx(
|
|
347
|
-
IconButton,
|
|
348
|
-
__spreadProps(__spreadValues({
|
|
349
|
-
onClick: handleClick,
|
|
350
|
-
"aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
|
|
351
|
-
size: "small",
|
|
352
|
-
"aria-controls": open ? "account-menu" : void 0,
|
|
353
|
-
"aria-haspopup": "true",
|
|
354
|
-
"aria-expanded": open ? "true" : void 0
|
|
355
|
-
}, slotProps == null ? void 0 : slotProps.avatarIconButton), {
|
|
356
|
-
sx: __spreadValues({ width: "fit-content", margin: "0 auto" }, (_h = slotProps == null ? void 0 : slotProps.avatarIconButton) == null ? void 0 : _h.sx),
|
|
357
|
-
children: avatarContent
|
|
358
|
-
})
|
|
359
|
-
) }) });
|
|
360
|
-
}
|
|
361
|
-
AccountPreview.propTypes = {
|
|
362
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
363
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
364
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
365
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
366
|
-
/**
|
|
367
|
-
* The handler used when the preview is expanded
|
|
368
|
-
*/
|
|
369
|
-
handleClick: PropTypes9.func,
|
|
370
|
-
/**
|
|
371
|
-
* The state of the Account popover
|
|
372
|
-
* @default false
|
|
373
|
-
*/
|
|
374
|
-
open: PropTypes9.bool,
|
|
375
|
-
/**
|
|
376
|
-
* The props used for each slot inside.
|
|
377
|
-
*/
|
|
378
|
-
slotProps: PropTypes9.shape({
|
|
379
|
-
avatar: PropTypes9.object,
|
|
380
|
-
avatarIconButton: PropTypes9.object,
|
|
381
|
-
moreIconButton: PropTypes9.object
|
|
382
|
-
}),
|
|
383
|
-
/**
|
|
384
|
-
* The components used for each slot inside.
|
|
385
|
-
*/
|
|
386
|
-
slots: PropTypes9.shape({
|
|
387
|
-
avatar: PropTypes9.elementType,
|
|
388
|
-
avatarIconButton: PropTypes9.elementType,
|
|
389
|
-
moreIconButton: PropTypes9.elementType
|
|
390
|
-
}),
|
|
391
|
-
/**
|
|
392
|
-
* The prop used to customize the styling of the preview
|
|
393
|
-
*/
|
|
394
|
-
sx: PropTypes9.oneOfType([
|
|
395
|
-
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
396
|
-
PropTypes9.func,
|
|
397
|
-
PropTypes9.object
|
|
398
|
-
]),
|
|
399
|
-
/**
|
|
400
|
-
* The type of account details to display.
|
|
401
|
-
* @property {'condensed'} condensed - Shows only the user's avatar.
|
|
402
|
-
* @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
|
|
403
|
-
* @default 'condensed'
|
|
404
|
-
*/
|
|
405
|
-
variant: PropTypes9.oneOf(["condensed", "expanded"])
|
|
406
|
-
};
|
|
407
|
-
function AccountPopoverHeader(props) {
|
|
408
|
-
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
409
|
-
return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, rest), { children }));
|
|
410
|
-
}
|
|
411
|
-
AccountPopoverHeader.propTypes = {
|
|
412
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
413
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
414
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
415
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
416
|
-
/**
|
|
417
|
-
* The content of the component.
|
|
418
|
-
*/
|
|
419
|
-
children: PropTypes9.node
|
|
420
|
-
};
|
|
421
|
-
function AccountPopoverFooter(props) {
|
|
422
|
-
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
423
|
-
return /* @__PURE__ */ jsx(
|
|
424
|
-
Box4,
|
|
425
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
426
|
-
sx: __spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
|
|
427
|
-
children
|
|
428
|
-
})
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
AccountPopoverFooter.propTypes = {
|
|
432
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
433
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
434
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
435
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
436
|
-
/**
|
|
437
|
-
* @ignore
|
|
438
|
-
*/
|
|
439
|
-
children: PropTypes9.node,
|
|
440
|
-
/**
|
|
441
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
442
|
-
*/
|
|
443
|
-
sx: PropTypes9.oneOfType([
|
|
444
|
-
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
445
|
-
PropTypes9.func,
|
|
446
|
-
PropTypes9.object
|
|
447
|
-
])
|
|
448
|
-
};
|
|
449
|
-
var defaultAccountLocaleText = {
|
|
450
|
-
accountPreviewIconButtonLabel: "Current User",
|
|
451
|
-
accountPreviewTitle: "Account",
|
|
452
|
-
accountSignInLabel: "Sign in",
|
|
453
|
-
accountSignOutLabel: "Sign out"
|
|
454
|
-
};
|
|
455
|
-
function Account(props) {
|
|
456
|
-
var _a;
|
|
457
|
-
const { localeText: propsLocaleText } = props;
|
|
458
|
-
const globalLocaleText = useLocaleText();
|
|
459
|
-
const localeText = React16.useMemo(
|
|
460
|
-
() => __spreadValues(__spreadValues(__spreadValues({}, defaultAccountLocaleText), globalLocaleText), propsLocaleText),
|
|
461
|
-
[globalLocaleText, propsLocaleText]
|
|
462
|
-
);
|
|
463
|
-
const { slots, slotProps } = props;
|
|
464
|
-
const [anchorEl, setAnchorEl] = React16.useState(null);
|
|
465
|
-
const session = React16.useContext(SessionContext);
|
|
466
|
-
const authentication = React16.useContext(AuthenticationContext);
|
|
467
|
-
const open = Boolean(anchorEl);
|
|
468
|
-
const handleClick = (event) => {
|
|
469
|
-
setAnchorEl(event.currentTarget);
|
|
470
|
-
};
|
|
471
|
-
const handleClose = () => {
|
|
472
|
-
setAnchorEl(null);
|
|
473
|
-
};
|
|
474
|
-
if (!authentication) {
|
|
475
|
-
return null;
|
|
476
|
-
}
|
|
477
|
-
let accountContent = null;
|
|
478
|
-
if (!(session == null ? void 0 : session.user)) {
|
|
479
|
-
accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsx(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsx(SignInButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
|
|
480
|
-
} else {
|
|
481
|
-
accountContent = /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
482
|
-
(slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsx(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsx(
|
|
483
|
-
AccountPreview,
|
|
484
|
-
__spreadValues({
|
|
485
|
-
variant: "condensed",
|
|
486
|
-
handleClick,
|
|
487
|
-
open
|
|
488
|
-
}, slotProps == null ? void 0 : slotProps.preview)
|
|
489
|
-
),
|
|
490
|
-
(slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsx(
|
|
491
|
-
slots.popover,
|
|
492
|
-
__spreadValues({
|
|
493
|
-
open,
|
|
494
|
-
onClick: handleClick,
|
|
495
|
-
onClose: handleClose
|
|
496
|
-
}, slotProps == null ? void 0 : slotProps.popover)
|
|
497
|
-
) : /* @__PURE__ */ jsx(
|
|
498
|
-
Popover,
|
|
499
|
-
__spreadProps(__spreadValues({
|
|
500
|
-
anchorEl,
|
|
501
|
-
id: "account-menu",
|
|
502
|
-
open,
|
|
503
|
-
onClose: handleClose,
|
|
504
|
-
onClick: handleClose,
|
|
505
|
-
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
506
|
-
anchorOrigin: { horizontal: "right", vertical: "bottom" }
|
|
507
|
-
}, slotProps == null ? void 0 : slotProps.popover), {
|
|
508
|
-
slotProps: __spreadValues({
|
|
509
|
-
paper: {
|
|
510
|
-
elevation: 0,
|
|
511
|
-
sx: {
|
|
512
|
-
overflow: "visible",
|
|
513
|
-
filter: (theme) => `drop-shadow(0px 2px 8px ${theme.palette.mode === "dark" ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.32)"})`,
|
|
514
|
-
mt: 1,
|
|
515
|
-
"&::before": {
|
|
516
|
-
content: '""',
|
|
517
|
-
display: "block",
|
|
518
|
-
position: "absolute",
|
|
519
|
-
top: 0,
|
|
520
|
-
right: 14,
|
|
521
|
-
width: 10,
|
|
522
|
-
height: 10,
|
|
523
|
-
bgcolor: "background.paper",
|
|
524
|
-
transform: "translateY(-50%) rotate(45deg)",
|
|
525
|
-
zIndex: 0
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
|
|
530
|
-
children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsx(slots.popoverContent, __spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxs(Stack, __spreadProps(__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
|
|
531
|
-
/* @__PURE__ */ jsx(AccountPopoverHeader, { children: /* @__PURE__ */ jsx(AccountPreview, { variant: "expanded" }) }),
|
|
532
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
533
|
-
/* @__PURE__ */ jsx(AccountPopoverFooter, { children: /* @__PURE__ */ jsx(SignOutButton, __spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
|
|
534
|
-
] }))
|
|
535
|
-
})
|
|
536
|
-
)
|
|
537
|
-
] });
|
|
538
|
-
}
|
|
539
|
-
return /* @__PURE__ */ jsx(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
|
|
540
|
-
}
|
|
541
|
-
Account.propTypes = {
|
|
542
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
543
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
544
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
545
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
546
|
-
/**
|
|
547
|
-
* The labels for the account component.
|
|
548
|
-
*/
|
|
549
|
-
localeText: PropTypes9.object,
|
|
550
|
-
/**
|
|
551
|
-
* The props used for each slot inside.
|
|
552
|
-
*/
|
|
553
|
-
slotProps: PropTypes9.shape({
|
|
554
|
-
popover: PropTypes9.object,
|
|
555
|
-
popoverContent: PropTypes9.object,
|
|
556
|
-
preview: PropTypes9.shape({
|
|
557
|
-
handleClick: PropTypes9.func,
|
|
558
|
-
open: PropTypes9.bool,
|
|
559
|
-
slotProps: PropTypes9.shape({
|
|
560
|
-
avatar: PropTypes9.object,
|
|
561
|
-
avatarIconButton: PropTypes9.object,
|
|
562
|
-
moreIconButton: PropTypes9.object
|
|
563
|
-
}),
|
|
564
|
-
slots: PropTypes9.shape({
|
|
565
|
-
avatar: PropTypes9.elementType,
|
|
566
|
-
avatarIconButton: PropTypes9.elementType,
|
|
567
|
-
moreIconButton: PropTypes9.elementType
|
|
568
|
-
}),
|
|
569
|
-
sx: PropTypes9.oneOfType([
|
|
570
|
-
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
571
|
-
PropTypes9.func,
|
|
572
|
-
PropTypes9.object
|
|
573
|
-
]),
|
|
574
|
-
variant: PropTypes9.oneOf(["condensed", "expanded"])
|
|
575
|
-
}),
|
|
576
|
-
signInButton: PropTypes9.object,
|
|
577
|
-
signOutButton: PropTypes9.object
|
|
578
|
-
}),
|
|
579
|
-
/**
|
|
580
|
-
* The components used for each slot inside.
|
|
581
|
-
*/
|
|
582
|
-
slots: PropTypes9.shape({
|
|
583
|
-
popover: PropTypes9.elementType,
|
|
584
|
-
popoverContent: PropTypes9.elementType,
|
|
585
|
-
preview: PropTypes9.elementType,
|
|
586
|
-
signInButton: PropTypes9.elementType,
|
|
587
|
-
signOutButton: PropTypes9.elementType
|
|
588
|
-
})
|
|
589
|
-
};
|
|
590
|
-
var DefaultLink = React16.forwardRef(function Link(props, ref) {
|
|
591
|
-
const _a = props, { children, href, onClick, history } = _a, rest = __objRest(_a, ["children", "href", "onClick", "history"]);
|
|
592
|
-
const routerContext = React16.useContext(RouterContext);
|
|
593
|
-
const handleLinkClick = React16.useMemo(() => {
|
|
594
|
-
if (!routerContext) {
|
|
595
|
-
return onClick;
|
|
596
|
-
}
|
|
597
|
-
return (event) => {
|
|
598
|
-
event.preventDefault();
|
|
599
|
-
const url = new URL(event.currentTarget.href);
|
|
600
|
-
routerContext.navigate(url.pathname, { history });
|
|
601
|
-
onClick == null ? void 0 : onClick(event);
|
|
602
|
-
};
|
|
603
|
-
}, [routerContext, onClick, history]);
|
|
604
|
-
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
|
|
605
|
-
});
|
|
606
|
-
var Link2 = React16.forwardRef(function Link3(props, ref) {
|
|
607
|
-
var _a;
|
|
608
|
-
const routerContext = React16.useContext(RouterContext);
|
|
609
|
-
const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
|
|
610
|
-
return /* @__PURE__ */ jsx(LinkComponent, __spreadProps(__spreadValues({ ref }, props), { children: props.children }));
|
|
611
|
-
});
|
|
612
|
-
function ToolpadLogo({ size = 40 }) {
|
|
613
|
-
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
614
|
-
/* @__PURE__ */ jsxs("g", { mask: "url(#a)", children: [
|
|
615
|
-
/* @__PURE__ */ jsx("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
|
|
616
|
-
/* @__PURE__ */ jsx("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
|
|
617
|
-
/* @__PURE__ */ jsx("path", { d: "m16.1 16.34 6.64-3.8 6.64 3.8-6.64 3.8-6.65-3.8Z", fill: "#A5D8FF" })
|
|
618
|
-
] }),
|
|
619
|
-
/* @__PURE__ */ jsx(
|
|
620
|
-
"mask",
|
|
621
|
-
{
|
|
622
|
-
id: "b",
|
|
623
|
-
style: {
|
|
624
|
-
maskType: "alpha"
|
|
625
|
-
},
|
|
626
|
-
maskUnits: "userSpaceOnUse",
|
|
627
|
-
x: "8",
|
|
628
|
-
y: "17",
|
|
629
|
-
width: "14",
|
|
630
|
-
height: "15",
|
|
631
|
-
children: /* @__PURE__ */ jsx(
|
|
632
|
-
"path",
|
|
633
|
-
{
|
|
634
|
-
d: "M8.5 22.3c0-1.05.56-2 1.46-2.53l3.75-2.14c.89-.5 1.98-.5 2.87 0l3.75 2.14a2.9 2.9 0 0 1 1.46 2.52v4.23c0 1.04-.56 2-1.46 2.52l-3.75 2.14c-.89.5-1.98.5-2.87 0l-3.75-2.14a2.9 2.9 0 0 1-1.46-2.52v-4.23Z",
|
|
635
|
-
fill: "#D7DCE1"
|
|
636
|
-
}
|
|
637
|
-
)
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
/* @__PURE__ */ jsxs("g", { mask: "url(#b)", children: [
|
|
641
|
-
/* @__PURE__ */ jsx("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
|
|
642
|
-
/* @__PURE__ */ jsx("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
|
|
643
|
-
/* @__PURE__ */ jsx("path", { d: "m8.5 20.6 6.64-3.79 6.65 3.8-6.65 3.8-6.64-3.8Z", fill: "#A5D8FF" })
|
|
644
|
-
] }),
|
|
645
|
-
/* @__PURE__ */ jsx(
|
|
646
|
-
"mask",
|
|
647
|
-
{
|
|
648
|
-
id: "c",
|
|
649
|
-
style: {
|
|
650
|
-
maskType: "alpha"
|
|
651
|
-
},
|
|
652
|
-
maskUnits: "userSpaceOnUse",
|
|
653
|
-
x: "8",
|
|
654
|
-
y: "4",
|
|
655
|
-
width: "22",
|
|
656
|
-
height: "20",
|
|
657
|
-
children: /* @__PURE__ */ jsx(
|
|
658
|
-
"path",
|
|
659
|
-
{
|
|
660
|
-
d: "M24.17 4.82a2.9 2.9 0 0 0-2.87 0L9.97 11.22a2.9 2.9 0 0 0-1.47 2.53v4.22c0 1.04.56 2 1.46 2.52l3.75 2.14c.89.5 1.98.5 2.87 0l11.33-6.42a2.9 2.9 0 0 0 1.47-2.52V9.48c0-1.04-.56-2-1.46-2.52l-3.75-2.14Z",
|
|
661
|
-
fill: "#D7DCE1"
|
|
662
|
-
}
|
|
663
|
-
)
|
|
664
|
-
}
|
|
665
|
-
),
|
|
666
|
-
/* @__PURE__ */ jsxs("g", { mask: "url(#c)", children: [
|
|
667
|
-
/* @__PURE__ */ jsx("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
|
|
668
|
-
/* @__PURE__ */ jsx("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
|
|
669
|
-
/* @__PURE__ */ jsx("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
|
|
670
|
-
] })
|
|
671
|
-
] });
|
|
672
|
-
}
|
|
673
|
-
function useApplicationTitle() {
|
|
674
|
-
var _a;
|
|
675
|
-
const branding = React16.useContext(BrandingContext);
|
|
676
|
-
return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
|
|
677
|
-
}
|
|
678
|
-
var LogoContainer = styled("div")({
|
|
679
|
-
position: "relative",
|
|
680
|
-
height: 40,
|
|
681
|
-
display: "flex",
|
|
682
|
-
alignItems: "center",
|
|
683
|
-
"& img": {
|
|
684
|
-
maxHeight: 40
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
function AppTitle(props) {
|
|
688
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
689
|
-
const theme = useTheme();
|
|
690
|
-
const defaultTitle = useApplicationTitle();
|
|
691
|
-
const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
|
|
692
|
-
return /* @__PURE__ */ jsx(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", children: [
|
|
693
|
-
/* @__PURE__ */ jsx(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsx(ToolpadLogo, { size: 40 }) }),
|
|
694
|
-
/* @__PURE__ */ jsx(
|
|
695
|
-
Typography,
|
|
696
|
-
{
|
|
697
|
-
variant: "h6",
|
|
698
|
-
sx: {
|
|
699
|
-
color: ((_g = theme.vars) != null ? _g : theme).palette.primary.main,
|
|
700
|
-
fontWeight: "700",
|
|
701
|
-
ml: 1,
|
|
702
|
-
whiteSpace: "nowrap",
|
|
703
|
-
lineHeight: 1
|
|
704
|
-
},
|
|
705
|
-
children: title
|
|
706
|
-
}
|
|
707
|
-
)
|
|
708
|
-
] }) });
|
|
709
|
-
}
|
|
710
|
-
function subscribe() {
|
|
711
|
-
return () => {
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
function getSnapshot() {
|
|
715
|
-
return false;
|
|
716
|
-
}
|
|
717
|
-
function getServerSnapshot() {
|
|
718
|
-
return true;
|
|
719
|
-
}
|
|
720
|
-
function useSsr() {
|
|
721
|
-
return React16.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
722
|
-
}
|
|
723
|
-
function ThemeSwitcher() {
|
|
724
|
-
var _a;
|
|
725
|
-
const isSsr = useSsr();
|
|
726
|
-
const theme = useTheme();
|
|
727
|
-
const { paletteMode, setPaletteMode, isDualTheme } = React16.useContext(PaletteModeContext);
|
|
728
|
-
const toggleMode = React16.useCallback(() => {
|
|
729
|
-
setPaletteMode(paletteMode === "dark" ? "light" : "dark");
|
|
730
|
-
}, [paletteMode, setPaletteMode]);
|
|
731
|
-
return isDualTheme ? /* @__PURE__ */ jsx(
|
|
732
|
-
Tooltip,
|
|
733
|
-
{
|
|
734
|
-
title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
|
|
735
|
-
enterDelay: 1e3,
|
|
736
|
-
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
737
|
-
IconButton,
|
|
738
|
-
{
|
|
739
|
-
"aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
|
|
740
|
-
onClick: toggleMode,
|
|
741
|
-
sx: {
|
|
742
|
-
color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
|
|
743
|
-
},
|
|
744
|
-
children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
745
|
-
/* @__PURE__ */ jsx(
|
|
746
|
-
DarkModeIcon,
|
|
747
|
-
{
|
|
748
|
-
sx: {
|
|
749
|
-
display: "inline",
|
|
750
|
-
[theme.getColorSchemeSelector("dark")]: {
|
|
751
|
-
display: "none"
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
),
|
|
756
|
-
/* @__PURE__ */ jsx(
|
|
757
|
-
LightModeIcon,
|
|
758
|
-
{
|
|
759
|
-
sx: {
|
|
760
|
-
display: "none",
|
|
761
|
-
[theme.getColorSchemeSelector("dark")]: {
|
|
762
|
-
display: "inline"
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
)
|
|
767
|
-
] }) : /* @__PURE__ */ jsx(React16.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsx(DarkModeIcon, {}) : /* @__PURE__ */ jsx(LightModeIcon, {}) })
|
|
768
|
-
}
|
|
769
|
-
) })
|
|
770
|
-
}
|
|
771
|
-
) : null;
|
|
772
|
-
}
|
|
773
|
-
function ToolbarActions() {
|
|
774
|
-
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", children: [
|
|
775
|
-
/* @__PURE__ */ jsx(ThemeSwitcher, {}),
|
|
776
|
-
/* @__PURE__ */ jsx(Account, {})
|
|
777
|
-
] });
|
|
778
|
-
}
|
|
779
|
-
var AppBar = styled$1(MuiAppBar)(({ theme }) => {
|
|
780
|
-
var _a;
|
|
781
|
-
return {
|
|
782
|
-
borderWidth: 0,
|
|
783
|
-
borderBottomWidth: 1,
|
|
784
|
-
borderStyle: "solid",
|
|
785
|
-
borderColor: ((_a = theme.vars) != null ? _a : theme).palette.divider,
|
|
786
|
-
boxShadow: "none",
|
|
787
|
-
zIndex: theme.zIndex.drawer + 1
|
|
788
|
-
};
|
|
789
|
-
});
|
|
790
|
-
function DashboardHeader(props) {
|
|
791
|
-
var _a, _b;
|
|
792
|
-
const {
|
|
793
|
-
branding: brandingProp,
|
|
794
|
-
menuOpen,
|
|
795
|
-
onToggleMenu,
|
|
796
|
-
hideMenuButton,
|
|
797
|
-
slots,
|
|
798
|
-
slotProps
|
|
799
|
-
} = props;
|
|
800
|
-
const brandingContext = React16.useContext(BrandingContext);
|
|
801
|
-
const branding = __spreadValues(__spreadValues({}, brandingContext), brandingProp);
|
|
802
|
-
const handleMenuOpen = React16.useCallback(() => {
|
|
803
|
-
onToggleMenu(!menuOpen);
|
|
804
|
-
}, [menuOpen, onToggleMenu]);
|
|
805
|
-
const getMenuIcon = React16.useCallback(
|
|
806
|
-
(isExpanded) => {
|
|
807
|
-
const expandMenuActionText = "Expand";
|
|
808
|
-
const collapseMenuActionText = "Collapse";
|
|
809
|
-
return /* @__PURE__ */ jsx(
|
|
810
|
-
Tooltip,
|
|
811
|
-
{
|
|
812
|
-
title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
|
|
813
|
-
enterDelay: 1e3,
|
|
814
|
-
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
815
|
-
IconButton,
|
|
816
|
-
{
|
|
817
|
-
"aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
|
|
818
|
-
onClick: handleMenuOpen,
|
|
819
|
-
children: isExpanded ? /* @__PURE__ */ jsx(MenuOpenIcon, {}) : /* @__PURE__ */ jsx(MenuIcon, {})
|
|
820
|
-
}
|
|
821
|
-
) })
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
},
|
|
825
|
-
[handleMenuOpen]
|
|
826
|
-
);
|
|
827
|
-
const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
|
|
828
|
-
const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
|
|
829
|
-
return /* @__PURE__ */ jsx(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsx(Toolbar2, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxs(
|
|
830
|
-
Stack,
|
|
831
|
-
{
|
|
832
|
-
direction: "row",
|
|
833
|
-
justifyContent: "space-between",
|
|
834
|
-
alignItems: "center",
|
|
835
|
-
sx: {
|
|
836
|
-
flexWrap: "wrap",
|
|
837
|
-
width: "100%"
|
|
838
|
-
},
|
|
839
|
-
children: [
|
|
840
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
|
|
841
|
-
!hideMenuButton ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
842
|
-
/* @__PURE__ */ jsx(
|
|
843
|
-
Box4,
|
|
844
|
-
{
|
|
845
|
-
sx: {
|
|
846
|
-
display: { xs: "block", md: "none" },
|
|
847
|
-
mr: { sm: 1 }
|
|
848
|
-
},
|
|
849
|
-
children: getMenuIcon(menuOpen)
|
|
850
|
-
}
|
|
851
|
-
),
|
|
852
|
-
/* @__PURE__ */ jsx(
|
|
853
|
-
Box4,
|
|
854
|
-
{
|
|
855
|
-
sx: {
|
|
856
|
-
display: { xs: "none", md: "block" },
|
|
857
|
-
mr: 1
|
|
858
|
-
},
|
|
859
|
-
children: getMenuIcon(menuOpen)
|
|
860
|
-
}
|
|
861
|
-
)
|
|
862
|
-
] }) : null,
|
|
863
|
-
(slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsx(slots.appTitle, __spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
|
|
864
|
-
/* Hierarchy of application of `branding`
|
|
865
|
-
* 1. Branding prop passed in the `slotProps.appTitle`
|
|
866
|
-
* 2. Branding prop passed to the `DashboardLayout`
|
|
867
|
-
* 3. Branding prop passed to the `AppProvider`
|
|
868
|
-
*/
|
|
869
|
-
/* @__PURE__ */ jsx(AppTitle, __spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
|
|
870
|
-
)
|
|
871
|
-
] }),
|
|
872
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
|
|
873
|
-
/* @__PURE__ */ jsx(ToolbarActionsSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
|
|
874
|
-
/* @__PURE__ */ jsx(ToolbarAccountSlot, __spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
|
|
875
|
-
] })
|
|
876
|
-
]
|
|
877
|
-
}
|
|
878
|
-
) }) });
|
|
879
|
-
}
|
|
880
|
-
DashboardHeader.propTypes = {
|
|
881
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
882
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
883
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
884
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
885
|
-
/**
|
|
886
|
-
* Branding options for the header.
|
|
887
|
-
* @default null
|
|
888
|
-
*/
|
|
889
|
-
branding: PropTypes9.shape({
|
|
890
|
-
homeUrl: PropTypes9.string,
|
|
891
|
-
logo: PropTypes9.node,
|
|
892
|
-
title: PropTypes9.string
|
|
893
|
-
}),
|
|
894
|
-
/**
|
|
895
|
-
* Whether the menu icon should always be hidden.
|
|
896
|
-
* @default false
|
|
897
|
-
*/
|
|
898
|
-
hideMenuButton: PropTypes9.bool,
|
|
899
|
-
/**
|
|
900
|
-
* If `true`, show menu button as if menu is expanded, otherwise show it as if menu is collapsed.
|
|
901
|
-
*/
|
|
902
|
-
menuOpen: PropTypes9.bool.isRequired,
|
|
903
|
-
/**
|
|
904
|
-
* Callback fired when the menu button is clicked.
|
|
905
|
-
*/
|
|
906
|
-
onToggleMenu: PropTypes9.func.isRequired,
|
|
907
|
-
/**
|
|
908
|
-
* The props used for each slot inside.
|
|
909
|
-
* @default {}
|
|
910
|
-
*/
|
|
911
|
-
slotProps: PropTypes9.shape({
|
|
912
|
-
appTitle: PropTypes9.shape({
|
|
913
|
-
branding: PropTypes9.shape({
|
|
914
|
-
homeUrl: PropTypes9.string,
|
|
915
|
-
logo: PropTypes9.node,
|
|
916
|
-
title: PropTypes9.string
|
|
917
|
-
})
|
|
918
|
-
}),
|
|
919
|
-
toolbarAccount: PropTypes9.shape({
|
|
920
|
-
localeText: PropTypes9.object,
|
|
921
|
-
slotProps: PropTypes9.shape({
|
|
922
|
-
popover: PropTypes9.object,
|
|
923
|
-
popoverContent: PropTypes9.object,
|
|
924
|
-
preview: PropTypes9.object,
|
|
925
|
-
signInButton: PropTypes9.object,
|
|
926
|
-
signOutButton: PropTypes9.object
|
|
927
|
-
}),
|
|
928
|
-
slots: PropTypes9.shape({
|
|
929
|
-
popover: PropTypes9.elementType,
|
|
930
|
-
popoverContent: PropTypes9.elementType,
|
|
931
|
-
preview: PropTypes9.elementType,
|
|
932
|
-
signInButton: PropTypes9.elementType,
|
|
933
|
-
signOutButton: PropTypes9.elementType
|
|
934
|
-
})
|
|
935
|
-
}),
|
|
936
|
-
toolbarActions: PropTypes9.object
|
|
937
|
-
}),
|
|
938
|
-
/**
|
|
939
|
-
* The components used for each slot inside.
|
|
940
|
-
* @default {}
|
|
941
|
-
*/
|
|
942
|
-
slots: PropTypes9.shape({
|
|
943
|
-
appTitle: PropTypes9.elementType,
|
|
944
|
-
toolbarAccount: PropTypes9.elementType,
|
|
945
|
-
toolbarActions: PropTypes9.elementType
|
|
946
|
-
})
|
|
947
|
-
};
|
|
948
|
-
var getItemKind = (item) => {
|
|
949
|
-
var _a;
|
|
950
|
-
return (_a = item.kind) != null ? _a : "page";
|
|
951
|
-
};
|
|
952
|
-
var isPageItem = (item) => getItemKind(item) === "page";
|
|
953
|
-
var getItemTitle = (item) => {
|
|
954
|
-
var _a, _b;
|
|
955
|
-
return isPageItem(item) ? (_b = (_a = item.title) != null ? _a : item.segment) != null ? _b : "" : item.title;
|
|
956
|
-
};
|
|
957
|
-
function buildItemToPathMap(navigation) {
|
|
958
|
-
const map = /* @__PURE__ */ new Map();
|
|
959
|
-
const visit = (item, base) => {
|
|
960
|
-
if (isPageItem(item)) {
|
|
961
|
-
const path = `${base.startsWith("/") ? base : `/${base}`}${base && base !== "/" && item.segment ? "/" : ""}${item.segment || ""}` || "/";
|
|
962
|
-
map.set(item, path);
|
|
963
|
-
if (item.children) {
|
|
964
|
-
for (const child of item.children) {
|
|
965
|
-
visit(child, path);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
};
|
|
970
|
-
for (const item of navigation) {
|
|
971
|
-
visit(item, "");
|
|
972
|
-
}
|
|
973
|
-
return map;
|
|
974
|
-
}
|
|
975
|
-
var itemToPathMapCache = /* @__PURE__ */ new WeakMap();
|
|
976
|
-
function getItemToPathMap(navigation) {
|
|
977
|
-
let map = itemToPathMapCache.get(navigation);
|
|
978
|
-
if (!map) {
|
|
979
|
-
map = buildItemToPathMap(navigation);
|
|
980
|
-
itemToPathMapCache.set(navigation, map);
|
|
981
|
-
}
|
|
982
|
-
return map;
|
|
983
|
-
}
|
|
984
|
-
function buildItemLookup(navigation) {
|
|
985
|
-
const map = /* @__PURE__ */ new Map();
|
|
986
|
-
const visit = (item) => {
|
|
987
|
-
if (isPageItem(item)) {
|
|
988
|
-
const path = getItemPath(navigation, item);
|
|
989
|
-
if (map.has(path)) {
|
|
990
|
-
console.warn(`Duplicate path in navigation: ${path}`);
|
|
991
|
-
}
|
|
992
|
-
map.set(path, item);
|
|
993
|
-
if (item.pattern) {
|
|
994
|
-
const basePath = item.segment ? path.slice(0, -item.segment.length) : path;
|
|
995
|
-
map.set(pathToRegexp(basePath + item.pattern).regexp, item);
|
|
996
|
-
}
|
|
997
|
-
if (item.children) {
|
|
998
|
-
for (const child of item.children) {
|
|
999
|
-
visit(child);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
for (const item of navigation) {
|
|
1005
|
-
visit(item);
|
|
1006
|
-
}
|
|
1007
|
-
return map;
|
|
1008
|
-
}
|
|
1009
|
-
var itemLookupMapCache = /* @__PURE__ */ new WeakMap();
|
|
1010
|
-
function getItemLookup(navigation) {
|
|
1011
|
-
let map = itemLookupMapCache.get(navigation);
|
|
1012
|
-
if (!map) {
|
|
1013
|
-
map = buildItemLookup(navigation);
|
|
1014
|
-
itemLookupMapCache.set(navigation, map);
|
|
1015
|
-
}
|
|
1016
|
-
return map;
|
|
1017
|
-
}
|
|
1018
|
-
function matchPath(navigation, path) {
|
|
1019
|
-
const lookup = getItemLookup(navigation);
|
|
1020
|
-
for (const [key, item] of lookup.entries()) {
|
|
1021
|
-
if (typeof key === "string" && key === path) {
|
|
1022
|
-
return item;
|
|
1023
|
-
}
|
|
1024
|
-
if (key instanceof RegExp && key.test(path)) {
|
|
1025
|
-
return item;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
return null;
|
|
1029
|
-
}
|
|
1030
|
-
function getItemPath(navigation, item) {
|
|
1031
|
-
const map = getItemToPathMap(navigation);
|
|
1032
|
-
const path = map.get(item);
|
|
1033
|
-
invariant(path, `Item not found in navigation: ${item.title}`);
|
|
1034
|
-
return path;
|
|
1035
|
-
}
|
|
1036
|
-
function hasSelectedNavigationChildren(navigation, item, activePagePath) {
|
|
1037
|
-
if (item.children) {
|
|
1038
|
-
return item.children.some((nestedItem) => {
|
|
1039
|
-
if (!isPageItem(nestedItem)) {
|
|
1040
|
-
return false;
|
|
1041
|
-
}
|
|
1042
|
-
if (nestedItem.children) {
|
|
1043
|
-
return hasSelectedNavigationChildren(navigation, nestedItem, activePagePath);
|
|
1044
|
-
}
|
|
1045
|
-
return activePagePath === getItemPath(navigation, nestedItem);
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
return false;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
// src/toolpad-core/DashboardLayout/utils.ts
|
|
1052
|
-
function getDrawerSxTransitionMixin(isExpanded, property) {
|
|
1053
|
-
return {
|
|
1054
|
-
transition: (theme) => theme.transitions.create(property, {
|
|
1055
|
-
easing: theme.transitions.easing.sharp,
|
|
1056
|
-
duration: isExpanded ? theme.transitions.duration.enteringScreen : theme.transitions.duration.leavingScreen
|
|
1057
|
-
})
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function getDrawerWidthTransitionMixin(isExpanded) {
|
|
1061
|
-
return __spreadProps(__spreadValues({}, getDrawerSxTransitionMixin(isExpanded, "width")), {
|
|
1062
|
-
overflowX: "hidden"
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
function useActivePage() {
|
|
1066
|
-
var _a;
|
|
1067
|
-
const navigationContext = React16.useContext(NavigationContext);
|
|
1068
|
-
const routerContext = React16.useContext(RouterContext);
|
|
1069
|
-
const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
|
|
1070
|
-
const activeItem = matchPath(navigationContext, pathname);
|
|
1071
|
-
const rootItem = matchPath(navigationContext, "/");
|
|
1072
|
-
return React16.useMemo(() => {
|
|
1073
|
-
if (!activeItem) {
|
|
1074
|
-
return null;
|
|
1075
|
-
}
|
|
1076
|
-
const breadcrumbs = [];
|
|
1077
|
-
if (rootItem) {
|
|
1078
|
-
breadcrumbs.push({
|
|
1079
|
-
title: getItemTitle(rootItem),
|
|
1080
|
-
path: "/"
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
const segments = pathname.split("/").filter(Boolean);
|
|
1084
|
-
let prefix = "";
|
|
1085
|
-
for (const segment of segments) {
|
|
1086
|
-
const path = `${prefix}/${segment}`;
|
|
1087
|
-
prefix = path;
|
|
1088
|
-
const item = matchPath(navigationContext, path);
|
|
1089
|
-
if (!item) {
|
|
1090
|
-
continue;
|
|
1091
|
-
}
|
|
1092
|
-
const itemPath = getItemPath(navigationContext, item);
|
|
1093
|
-
const lastCrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
1094
|
-
if ((lastCrumb == null ? void 0 : lastCrumb.path) !== itemPath) {
|
|
1095
|
-
breadcrumbs.push({
|
|
1096
|
-
title: getItemTitle(item),
|
|
1097
|
-
path: itemPath
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
return {
|
|
1102
|
-
title: getItemTitle(activeItem),
|
|
1103
|
-
path: getItemPath(navigationContext, activeItem),
|
|
1104
|
-
breadcrumbs
|
|
1105
|
-
};
|
|
1106
|
-
}, [activeItem, rootItem, pathname, navigationContext]);
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
// src/toolpad-core/DashboardLayout/shared.ts
|
|
1110
|
-
var MINI_DRAWER_WIDTH = 84;
|
|
1111
|
-
var NavigationListItemButton = styled(ListItemButton)(({ theme }) => {
|
|
1112
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1113
|
-
return {
|
|
1114
|
-
borderRadius: 8,
|
|
1115
|
-
"&.Mui-selected": {
|
|
1116
|
-
"& .MuiListItemIcon-root": {
|
|
1117
|
-
color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
|
|
1118
|
-
},
|
|
1119
|
-
"& .MuiTypography-root": {
|
|
1120
|
-
color: ((_b = theme.vars) != null ? _b : theme).palette.primary.dark
|
|
1121
|
-
},
|
|
1122
|
-
"& .MuiSvgIcon-root": {
|
|
1123
|
-
color: ((_c = theme.vars) != null ? _c : theme).palette.primary.dark
|
|
1124
|
-
},
|
|
1125
|
-
"& .MuiAvatar-root": {
|
|
1126
|
-
backgroundColor: ((_d = theme.vars) != null ? _d : theme).palette.primary.dark
|
|
1127
|
-
},
|
|
1128
|
-
"& .MuiTouchRipple-child": {
|
|
1129
|
-
backgroundColor: ((_e = theme.vars) != null ? _e : theme).palette.primary.dark
|
|
1130
|
-
}
|
|
1131
|
-
},
|
|
1132
|
-
"& .MuiSvgIcon-root": {
|
|
1133
|
-
color: ((_f = theme.vars) != null ? _f : theme).palette.action.active
|
|
1134
|
-
},
|
|
1135
|
-
"& .MuiAvatar-root": {
|
|
1136
|
-
backgroundColor: ((_g = theme.vars) != null ? _g : theme).palette.action.active
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
});
|
|
1140
|
-
var LIST_ITEM_ICON_SIZE = 34;
|
|
1141
|
-
function DashboardSidebarPageItem(props) {
|
|
1142
|
-
var _a;
|
|
1143
|
-
const navigationContext = React16.useContext(NavigationContext);
|
|
1144
|
-
const pageItemContextProps = React16.useContext(DashboardSidebarPageItemContext);
|
|
1145
|
-
invariant(pageItemContextProps, "No navigation page item context provided.");
|
|
1146
|
-
const contextAwareProps = __spreadValues(__spreadValues({}, pageItemContextProps), props);
|
|
1147
|
-
const {
|
|
1148
|
-
item,
|
|
1149
|
-
href = getItemPath(navigationContext, item),
|
|
1150
|
-
LinkComponent: LinkComponentProp,
|
|
1151
|
-
expanded = false,
|
|
1152
|
-
selected = false,
|
|
1153
|
-
disabled = false,
|
|
1154
|
-
id,
|
|
1155
|
-
onClick,
|
|
1156
|
-
isMini = false,
|
|
1157
|
-
isSidebarFullyExpanded = true,
|
|
1158
|
-
isSidebarFullyCollapsed = false,
|
|
1159
|
-
renderNestedNavigation
|
|
1160
|
-
} = contextAwareProps;
|
|
1161
|
-
const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React16.useState(
|
|
1162
|
-
null
|
|
1163
|
-
);
|
|
1164
|
-
const handleClick = React16.useCallback(() => {
|
|
1165
|
-
onClick(id, item);
|
|
1166
|
-
}, [id, item, onClick]);
|
|
1167
|
-
let nestedNavigationCollapseSx = { display: "none" };
|
|
1168
|
-
if (isMini && isSidebarFullyCollapsed) {
|
|
1169
|
-
nestedNavigationCollapseSx = {
|
|
1170
|
-
fontSize: 18,
|
|
1171
|
-
position: "absolute",
|
|
1172
|
-
top: "41.5%",
|
|
1173
|
-
right: "2px",
|
|
1174
|
-
transform: "translateY(-50%) rotate(-90deg)"
|
|
1175
|
-
};
|
|
1176
|
-
} else if (!isMini && isSidebarFullyExpanded) {
|
|
1177
|
-
nestedNavigationCollapseSx = {
|
|
1178
|
-
ml: 0.5,
|
|
1179
|
-
transform: `rotate(${expanded ? 0 : -90}deg)`,
|
|
1180
|
-
transition: (theme) => theme.transitions.create("transform", {
|
|
1181
|
-
easing: theme.transitions.easing.sharp,
|
|
1182
|
-
duration: 100
|
|
1183
|
-
})
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
|
|
1187
|
-
const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
|
|
1188
|
-
const title = getItemTitle(item);
|
|
1189
|
-
const listItem = /* @__PURE__ */ jsxs(
|
|
1190
|
-
ListItem,
|
|
1191
|
-
__spreadProps(__spreadValues({}, item.children && isMini ? {
|
|
1192
|
-
onMouseEnter: () => {
|
|
1193
|
-
setHoveredMiniSidebarItemId(id);
|
|
1194
|
-
},
|
|
1195
|
-
onMouseLeave: () => {
|
|
1196
|
-
setHoveredMiniSidebarItemId(null);
|
|
1197
|
-
}
|
|
1198
|
-
} : {}), {
|
|
1199
|
-
sx: {
|
|
1200
|
-
py: 0,
|
|
1201
|
-
px: 1,
|
|
1202
|
-
overflowX: "hidden"
|
|
1203
|
-
},
|
|
1204
|
-
children: [
|
|
1205
|
-
/* @__PURE__ */ jsxs(
|
|
1206
|
-
NavigationListItemButton,
|
|
1207
|
-
__spreadProps(__spreadValues(__spreadValues({
|
|
1208
|
-
selected,
|
|
1209
|
-
disabled,
|
|
1210
|
-
sx: {
|
|
1211
|
-
px: 1.4,
|
|
1212
|
-
height: isMini ? 60 : 48
|
|
1213
|
-
}
|
|
1214
|
-
}, item.children && !isMini ? {
|
|
1215
|
-
onClick: handleClick
|
|
1216
|
-
} : {}), !item.children ? __spreadProps(__spreadValues({
|
|
1217
|
-
LinkComponent
|
|
1218
|
-
}, hasExternalHref ? {
|
|
1219
|
-
target: "_blank",
|
|
1220
|
-
rel: "noopener noreferrer"
|
|
1221
|
-
} : {}), {
|
|
1222
|
-
href,
|
|
1223
|
-
onClick: handleClick
|
|
1224
|
-
}) : {}), {
|
|
1225
|
-
children: [
|
|
1226
|
-
item.icon || isMini ? /* @__PURE__ */ jsxs(
|
|
1227
|
-
Box4,
|
|
1228
|
-
{
|
|
1229
|
-
sx: isMini ? {
|
|
1230
|
-
position: "absolute",
|
|
1231
|
-
left: "50%",
|
|
1232
|
-
top: "calc(50% - 6px)",
|
|
1233
|
-
transform: "translate(-50%, -50%)"
|
|
1234
|
-
} : {},
|
|
1235
|
-
children: [
|
|
1236
|
-
/* @__PURE__ */ jsxs(
|
|
1237
|
-
ListItemIcon,
|
|
1238
|
-
{
|
|
1239
|
-
sx: {
|
|
1240
|
-
display: "flex",
|
|
1241
|
-
alignItems: "center",
|
|
1242
|
-
justifyContent: "center",
|
|
1243
|
-
minWidth: LIST_ITEM_ICON_SIZE
|
|
1244
|
-
},
|
|
1245
|
-
children: [
|
|
1246
|
-
(_a = item.icon) != null ? _a : null,
|
|
1247
|
-
!item.icon && isMini ? /* @__PURE__ */ jsx(
|
|
1248
|
-
Avatar,
|
|
1249
|
-
{
|
|
1250
|
-
sx: {
|
|
1251
|
-
width: LIST_ITEM_ICON_SIZE - 7,
|
|
1252
|
-
height: LIST_ITEM_ICON_SIZE - 7,
|
|
1253
|
-
fontSize: 12
|
|
1254
|
-
},
|
|
1255
|
-
children: title.split(" ").slice(0, 2).map((titleWord) => titleWord.charAt(0).toUpperCase())
|
|
1256
|
-
}
|
|
1257
|
-
) : null
|
|
1258
|
-
]
|
|
1259
|
-
}
|
|
1260
|
-
),
|
|
1261
|
-
isMini ? /* @__PURE__ */ jsx(
|
|
1262
|
-
Typography,
|
|
1263
|
-
{
|
|
1264
|
-
variant: "caption",
|
|
1265
|
-
sx: {
|
|
1266
|
-
position: "absolute",
|
|
1267
|
-
bottom: -18,
|
|
1268
|
-
left: "50%",
|
|
1269
|
-
transform: "translateX(-50%)",
|
|
1270
|
-
fontSize: 10,
|
|
1271
|
-
fontWeight: 500,
|
|
1272
|
-
textAlign: "center",
|
|
1273
|
-
whiteSpace: "nowrap",
|
|
1274
|
-
overflow: "hidden",
|
|
1275
|
-
textOverflow: "ellipsis",
|
|
1276
|
-
maxWidth: MINI_DRAWER_WIDTH - 28
|
|
1277
|
-
},
|
|
1278
|
-
children: title
|
|
1279
|
-
}
|
|
1280
|
-
) : null
|
|
1281
|
-
]
|
|
1282
|
-
}
|
|
1283
|
-
) : null,
|
|
1284
|
-
!isMini ? /* @__PURE__ */ jsx(
|
|
1285
|
-
ListItemText,
|
|
1286
|
-
{
|
|
1287
|
-
primary: title,
|
|
1288
|
-
sx: {
|
|
1289
|
-
ml: 1.2,
|
|
1290
|
-
whiteSpace: "nowrap",
|
|
1291
|
-
zIndex: 1
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
) : null,
|
|
1295
|
-
item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
|
|
1296
|
-
item.children ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: nestedNavigationCollapseSx }) : null
|
|
1297
|
-
]
|
|
1298
|
-
})
|
|
1299
|
-
),
|
|
1300
|
-
item.children && isMini ? /* @__PURE__ */ jsx(Grow, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsx(
|
|
1301
|
-
Box4,
|
|
1302
|
-
{
|
|
1303
|
-
sx: {
|
|
1304
|
-
position: "fixed",
|
|
1305
|
-
left: MINI_DRAWER_WIDTH - 2,
|
|
1306
|
-
pl: "6px"
|
|
1307
|
-
},
|
|
1308
|
-
children: /* @__PURE__ */ jsx(
|
|
1309
|
-
Paper,
|
|
1310
|
-
{
|
|
1311
|
-
sx: {
|
|
1312
|
-
pt: 0.5,
|
|
1313
|
-
pb: 0.5,
|
|
1314
|
-
transform: "translateY(calc(50% - 30px))"
|
|
1315
|
-
},
|
|
1316
|
-
children: renderNestedNavigation(item.children)
|
|
1317
|
-
}
|
|
1318
|
-
)
|
|
1319
|
-
}
|
|
1320
|
-
) }) : null
|
|
1321
|
-
]
|
|
1322
|
-
})
|
|
1323
|
-
);
|
|
1324
|
-
return /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1325
|
-
listItem,
|
|
1326
|
-
item.children && !isMini ? /* @__PURE__ */ jsx(Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
|
|
1327
|
-
] }, id);
|
|
1328
|
-
}
|
|
1329
|
-
DashboardSidebarPageItem.propTypes = {
|
|
1330
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1331
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1332
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1333
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1334
|
-
/**
|
|
1335
|
-
* If `true`, the item is disabled.
|
|
1336
|
-
* @default false
|
|
1337
|
-
*/
|
|
1338
|
-
disabled: PropTypes9.bool,
|
|
1339
|
-
/**
|
|
1340
|
-
* If `true`, expands any nested navigation in the item, otherwise collapse it.
|
|
1341
|
-
* @default false
|
|
1342
|
-
*/
|
|
1343
|
-
expanded: PropTypes9.bool,
|
|
1344
|
-
/**
|
|
1345
|
-
* Link `href` for when the item is rendered as a link.
|
|
1346
|
-
* @default getItemPath(navigationContext, item)
|
|
1347
|
-
*/
|
|
1348
|
-
href: PropTypes9.string,
|
|
1349
|
-
/**
|
|
1350
|
-
* Navigation page item definition.
|
|
1351
|
-
*/
|
|
1352
|
-
item: PropTypes9.shape({
|
|
1353
|
-
action: PropTypes9.node,
|
|
1354
|
-
children: PropTypes9.arrayOf(
|
|
1355
|
-
PropTypes9.oneOfType([
|
|
1356
|
-
PropTypes9.object,
|
|
1357
|
-
PropTypes9.shape({
|
|
1358
|
-
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1359
|
-
title: PropTypes9.string.isRequired
|
|
1360
|
-
}),
|
|
1361
|
-
PropTypes9.shape({
|
|
1362
|
-
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
1363
|
-
})
|
|
1364
|
-
]).isRequired
|
|
1365
|
-
),
|
|
1366
|
-
icon: PropTypes9.node,
|
|
1367
|
-
kind: PropTypes9.oneOf(["page"]),
|
|
1368
|
-
pattern: PropTypes9.string,
|
|
1369
|
-
segment: PropTypes9.string,
|
|
1370
|
-
title: PropTypes9.string
|
|
1371
|
-
}).isRequired,
|
|
1372
|
-
/**
|
|
1373
|
-
* The component used to render the item as a link.
|
|
1374
|
-
* @default Link
|
|
1375
|
-
*/
|
|
1376
|
-
LinkComponent: PropTypes9.elementType,
|
|
1377
|
-
/**
|
|
1378
|
-
* Use to apply selected styling.
|
|
1379
|
-
* @default false
|
|
1380
|
-
*/
|
|
1381
|
-
selected: PropTypes9.bool
|
|
1382
|
-
};
|
|
1383
|
-
function DashboardSidebarSubNavigationPageItem({
|
|
1384
|
-
id,
|
|
1385
|
-
item,
|
|
1386
|
-
isExpanded,
|
|
1387
|
-
onClick,
|
|
1388
|
-
depth,
|
|
1389
|
-
onLinkClick,
|
|
1390
|
-
isMini,
|
|
1391
|
-
isFullyExpanded,
|
|
1392
|
-
isFullyCollapsed,
|
|
1393
|
-
sidebarExpandedWidth,
|
|
1394
|
-
renderPageItem
|
|
1395
|
-
}) {
|
|
1396
|
-
const navigationContext = React16.useContext(NavigationContext);
|
|
1397
|
-
const activePage = useActivePage();
|
|
1398
|
-
const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
|
|
1399
|
-
const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
|
|
1400
|
-
const pageItemContextProps = React16.useMemo(
|
|
1401
|
-
() => ({
|
|
1402
|
-
expanded: isExpanded,
|
|
1403
|
-
selected: isSelected,
|
|
1404
|
-
id,
|
|
1405
|
-
onClick,
|
|
1406
|
-
isMini,
|
|
1407
|
-
isSidebarFullyExpanded: isFullyExpanded,
|
|
1408
|
-
isSidebarFullyCollapsed: isFullyCollapsed,
|
|
1409
|
-
renderNestedNavigation: () => {
|
|
1410
|
-
var _a;
|
|
1411
|
-
return /* @__PURE__ */ jsx(
|
|
1412
|
-
DashboardSidebarSubNavigation,
|
|
1413
|
-
{
|
|
1414
|
-
subNavigation: (_a = item.children) != null ? _a : [],
|
|
1415
|
-
depth: depth + 1,
|
|
1416
|
-
onLinkClick,
|
|
1417
|
-
isPopover: isMini,
|
|
1418
|
-
sidebarExpandedWidth
|
|
1419
|
-
}
|
|
1420
|
-
);
|
|
1421
|
-
}
|
|
1422
|
-
}),
|
|
1423
|
-
[
|
|
1424
|
-
depth,
|
|
1425
|
-
id,
|
|
1426
|
-
isExpanded,
|
|
1427
|
-
isFullyCollapsed,
|
|
1428
|
-
isFullyExpanded,
|
|
1429
|
-
isMini,
|
|
1430
|
-
isSelected,
|
|
1431
|
-
item.children,
|
|
1432
|
-
onClick,
|
|
1433
|
-
onLinkClick,
|
|
1434
|
-
sidebarExpandedWidth
|
|
1435
|
-
]
|
|
1436
|
-
);
|
|
1437
|
-
return /* @__PURE__ */ jsx(DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsx(DashboardSidebarPageItem, { item }) });
|
|
1438
|
-
}
|
|
1439
|
-
function DashboardSidebarSubNavigation({
|
|
1440
|
-
subNavigation,
|
|
1441
|
-
depth = 0,
|
|
1442
|
-
onLinkClick,
|
|
1443
|
-
isMini = false,
|
|
1444
|
-
isPopover = false,
|
|
1445
|
-
isFullyExpanded = true,
|
|
1446
|
-
isFullyCollapsed = false,
|
|
1447
|
-
hasDrawerTransitions = false,
|
|
1448
|
-
sidebarExpandedWidth,
|
|
1449
|
-
renderPageItem
|
|
1450
|
-
}) {
|
|
1451
|
-
const navigationContext = React16.useContext(NavigationContext);
|
|
1452
|
-
const activePage = useActivePage();
|
|
1453
|
-
const initialExpandedItemIds = React16.useMemo(
|
|
1454
|
-
() => subNavigation.map((navigationItem, navigationItemIndex) => ({
|
|
1455
|
-
navigationItem,
|
|
1456
|
-
originalIndex: navigationItemIndex
|
|
1457
|
-
})).filter(
|
|
1458
|
-
({ navigationItem }) => isPageItem(navigationItem) && !!activePage && hasSelectedNavigationChildren(navigationContext, navigationItem, activePage.path)
|
|
1459
|
-
).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
|
|
1460
|
-
[activePage, depth, navigationContext, subNavigation]
|
|
1461
|
-
);
|
|
1462
|
-
const [expandedItemIds, setExpandedItemIds] = React16.useState(initialExpandedItemIds);
|
|
1463
|
-
const handlePageItemClick = React16.useCallback(
|
|
1464
|
-
(itemId, item) => {
|
|
1465
|
-
if (item.children && !isMini) {
|
|
1466
|
-
setExpandedItemIds(
|
|
1467
|
-
(previousValue) => previousValue.includes(itemId) ? previousValue.filter((previousValueItemId) => previousValueItemId !== itemId) : [...previousValue, itemId]
|
|
1468
|
-
);
|
|
1469
|
-
} else if (!item.children) {
|
|
1470
|
-
onLinkClick();
|
|
1471
|
-
}
|
|
1472
|
-
},
|
|
1473
|
-
[isMini, onLinkClick]
|
|
1474
|
-
);
|
|
1475
|
-
return /* @__PURE__ */ jsx(
|
|
1476
|
-
List,
|
|
1477
|
-
{
|
|
1478
|
-
sx: {
|
|
1479
|
-
padding: 0,
|
|
1480
|
-
mt: isPopover && depth === 1 ? 0.5 : 0,
|
|
1481
|
-
mb: depth === 0 && !isPopover ? 4 : 0.5,
|
|
1482
|
-
pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
|
|
1483
|
-
minWidth: isPopover && depth === 1 ? 240 : "auto",
|
|
1484
|
-
width: isMini ? MINI_DRAWER_WIDTH : "auto"
|
|
1485
|
-
},
|
|
1486
|
-
children: subNavigation.map((navigationItem, navigationItemIndex) => {
|
|
1487
|
-
if (navigationItem.kind === "header") {
|
|
1488
|
-
return /* @__PURE__ */ jsx(
|
|
1489
|
-
ListSubheader,
|
|
1490
|
-
{
|
|
1491
|
-
sx: __spreadProps(__spreadValues({
|
|
1492
|
-
fontSize: 12,
|
|
1493
|
-
fontWeight: "700",
|
|
1494
|
-
height: isMini ? 0 : 40
|
|
1495
|
-
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "height") : {}), {
|
|
1496
|
-
px: 2,
|
|
1497
|
-
minWidth: sidebarExpandedWidth,
|
|
1498
|
-
overflow: "hidden",
|
|
1499
|
-
textOverflow: "ellipsis",
|
|
1500
|
-
whiteSpace: "nowrap",
|
|
1501
|
-
zIndex: 2
|
|
1502
|
-
}),
|
|
1503
|
-
children: getItemTitle(navigationItem)
|
|
1504
|
-
},
|
|
1505
|
-
`subheader-${depth}-${navigationItemIndex}`
|
|
1506
|
-
);
|
|
1507
|
-
}
|
|
1508
|
-
if (navigationItem.kind === "divider") {
|
|
1509
|
-
const nextItem = subNavigation[navigationItemIndex + 1];
|
|
1510
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
1511
|
-
Divider,
|
|
1512
|
-
{
|
|
1513
|
-
sx: __spreadValues({
|
|
1514
|
-
borderBottomWidth: 2,
|
|
1515
|
-
mx: 1,
|
|
1516
|
-
mt: 1,
|
|
1517
|
-
mb: (nextItem == null ? void 0 : nextItem.kind) === "header" && !isMini ? 0 : 1
|
|
1518
|
-
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "margin") : {})
|
|
1519
|
-
}
|
|
1520
|
-
) }, `divider-${depth}-${navigationItemIndex}`);
|
|
1521
|
-
}
|
|
1522
|
-
const pageItemId = `page-${depth}-${navigationItemIndex}`;
|
|
1523
|
-
return /* @__PURE__ */ jsx(
|
|
1524
|
-
DashboardSidebarSubNavigationPageItem,
|
|
1525
|
-
{
|
|
1526
|
-
id: pageItemId,
|
|
1527
|
-
item: navigationItem,
|
|
1528
|
-
isExpanded: expandedItemIds.includes(pageItemId),
|
|
1529
|
-
onClick: handlePageItemClick,
|
|
1530
|
-
depth,
|
|
1531
|
-
onLinkClick,
|
|
1532
|
-
isMini,
|
|
1533
|
-
isFullyExpanded,
|
|
1534
|
-
isFullyCollapsed,
|
|
1535
|
-
sidebarExpandedWidth,
|
|
1536
|
-
renderPageItem
|
|
1537
|
-
},
|
|
1538
|
-
pageItemId
|
|
1539
|
-
);
|
|
1540
|
-
})
|
|
1541
|
-
}
|
|
1542
|
-
);
|
|
1543
|
-
}
|
|
1544
|
-
function DashboardLayout(props) {
|
|
1545
|
-
var _a, _b;
|
|
1546
|
-
const {
|
|
1547
|
-
children,
|
|
1548
|
-
branding,
|
|
1549
|
-
navigation: navigationProp,
|
|
1550
|
-
defaultSidebarCollapsed = false,
|
|
1551
|
-
disableCollapsibleSidebar = false,
|
|
1552
|
-
hideNavigation = false,
|
|
1553
|
-
sidebarExpandedWidth = 320,
|
|
1554
|
-
renderPageItem,
|
|
1555
|
-
slots,
|
|
1556
|
-
slotProps,
|
|
1557
|
-
sx
|
|
1558
|
-
} = props;
|
|
1559
|
-
if (navigationProp && process.env.NODE_ENV !== "production") {
|
|
1560
|
-
warnOnce(
|
|
1561
|
-
"The navigation prop in the DashboardLayout component is deprecated and will eventually be removed. Set the navigation prop in the AppProvider instead (https://mui.com/toolpad/core/react-app-provider/#navigation)."
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
const theme = useTheme$1();
|
|
1565
|
-
const navigationContext = React16.useContext(NavigationContext);
|
|
1566
|
-
const appWindowContext = React16.useContext(WindowContext);
|
|
1567
|
-
const navigation = navigationProp != null ? navigationProp : navigationContext;
|
|
1568
|
-
const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React16.useState(!defaultSidebarCollapsed);
|
|
1569
|
-
const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React16.useState(false);
|
|
1570
|
-
const isOverSmViewport = useMediaQuery(
|
|
1571
|
-
theme.breakpoints.up("sm"),
|
|
1572
|
-
appWindowContext && {
|
|
1573
|
-
matchMedia: appWindowContext.matchMedia
|
|
1574
|
-
}
|
|
1575
|
-
);
|
|
1576
|
-
const isOverMdViewport = useMediaQuery(
|
|
1577
|
-
theme.breakpoints.up("md"),
|
|
1578
|
-
appWindowContext && {
|
|
1579
|
-
matchMedia: appWindowContext.matchMedia
|
|
1580
|
-
}
|
|
1581
|
-
);
|
|
1582
|
-
const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
|
|
1583
|
-
const setIsNavigationExpanded = React16.useCallback(
|
|
1584
|
-
(newExpanded) => {
|
|
1585
|
-
if (isOverMdViewport) {
|
|
1586
|
-
setIsDesktopNavigationExpanded(newExpanded);
|
|
1587
|
-
} else {
|
|
1588
|
-
setIsMobileNavigationExpanded(newExpanded);
|
|
1589
|
-
}
|
|
1590
|
-
},
|
|
1591
|
-
[isOverMdViewport]
|
|
1592
|
-
);
|
|
1593
|
-
const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React16.useState(isNavigationExpanded);
|
|
1594
|
-
const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React16.useState(!isNavigationExpanded);
|
|
1595
|
-
React16.useEffect(() => {
|
|
1596
|
-
if (isNavigationExpanded) {
|
|
1597
|
-
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
1598
|
-
setIsNavigationFullyExpanded(true);
|
|
1599
|
-
}, theme.transitions.duration.enteringScreen);
|
|
1600
|
-
return () => clearTimeout(drawerWidthTransitionTimeout);
|
|
1601
|
-
}
|
|
1602
|
-
setIsNavigationFullyExpanded(false);
|
|
1603
|
-
return () => {
|
|
1604
|
-
};
|
|
1605
|
-
}, [isNavigationExpanded, theme]);
|
|
1606
|
-
React16.useEffect(() => {
|
|
1607
|
-
if (!isNavigationExpanded) {
|
|
1608
|
-
const drawerWidthTransitionTimeout = setTimeout(() => {
|
|
1609
|
-
setIsNavigationFullyCollapsed(true);
|
|
1610
|
-
}, theme.transitions.duration.leavingScreen);
|
|
1611
|
-
return () => clearTimeout(drawerWidthTransitionTimeout);
|
|
1612
|
-
}
|
|
1613
|
-
setIsNavigationFullyCollapsed(false);
|
|
1614
|
-
return () => {
|
|
1615
|
-
};
|
|
1616
|
-
}, [isNavigationExpanded, theme]);
|
|
1617
|
-
const handleSetNavigationExpanded = React16.useCallback(
|
|
1618
|
-
(newExpanded) => () => {
|
|
1619
|
-
setIsNavigationExpanded(newExpanded);
|
|
1620
|
-
},
|
|
1621
|
-
[setIsNavigationExpanded]
|
|
1622
|
-
);
|
|
1623
|
-
const handleToggleHeaderMenu = React16.useCallback(
|
|
1624
|
-
(isExpanded) => {
|
|
1625
|
-
setIsNavigationExpanded(isExpanded);
|
|
1626
|
-
},
|
|
1627
|
-
[setIsNavigationExpanded]
|
|
1628
|
-
);
|
|
1629
|
-
const handleNavigationLinkClick = React16.useCallback(() => {
|
|
1630
|
-
setIsMobileNavigationExpanded(false);
|
|
1631
|
-
}, [setIsMobileNavigationExpanded]);
|
|
1632
|
-
const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
|
|
1633
|
-
const isMobileMini = !disableCollapsibleSidebar && !isMobileNavigationExpanded;
|
|
1634
|
-
const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
|
|
1635
|
-
const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
|
|
1636
|
-
const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
|
|
1637
|
-
const headerSlotProps = React16.useMemo(
|
|
1638
|
-
() => __spreadValues({
|
|
1639
|
-
branding,
|
|
1640
|
-
menuOpen: isNavigationExpanded,
|
|
1641
|
-
onToggleMenu: handleToggleHeaderMenu,
|
|
1642
|
-
hideMenuButton: hideNavigation || isOverMdViewport && disableCollapsibleSidebar,
|
|
1643
|
-
slots: {
|
|
1644
|
-
appTitle: slots == null ? void 0 : slots.appTitle,
|
|
1645
|
-
toolbarActions: slots == null ? void 0 : slots.toolbarActions,
|
|
1646
|
-
toolbarAccount: slots == null ? void 0 : slots.toolbarAccount
|
|
1647
|
-
},
|
|
1648
|
-
slotProps: {
|
|
1649
|
-
appTitle: slotProps == null ? void 0 : slotProps.appTitle,
|
|
1650
|
-
toolbarActions: slotProps == null ? void 0 : slotProps.toolbarActions,
|
|
1651
|
-
toolbarAccount: slotProps == null ? void 0 : slotProps.toolbarAccount
|
|
1652
|
-
}
|
|
1653
|
-
}, slotProps == null ? void 0 : slotProps.header),
|
|
1654
|
-
[
|
|
1655
|
-
branding,
|
|
1656
|
-
isNavigationExpanded,
|
|
1657
|
-
handleToggleHeaderMenu,
|
|
1658
|
-
hideNavigation,
|
|
1659
|
-
isOverMdViewport,
|
|
1660
|
-
disableCollapsibleSidebar,
|
|
1661
|
-
slotProps,
|
|
1662
|
-
slots
|
|
1663
|
-
]
|
|
1664
|
-
);
|
|
1665
|
-
const getDrawerContent = React16.useCallback(
|
|
1666
|
-
(isMini, viewport) => {
|
|
1667
|
-
var _a2;
|
|
1668
|
-
return /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1669
|
-
/* @__PURE__ */ jsx(Toolbar2, {}),
|
|
1670
|
-
/* @__PURE__ */ jsxs(
|
|
1671
|
-
Box4,
|
|
1672
|
-
{
|
|
1673
|
-
component: "nav",
|
|
1674
|
-
"aria-label": `${viewport.charAt(0).toUpperCase()}${viewport.slice(1)}`,
|
|
1675
|
-
sx: __spreadValues({
|
|
1676
|
-
height: "100%",
|
|
1677
|
-
display: "flex",
|
|
1678
|
-
flexDirection: "column",
|
|
1679
|
-
justifyContent: "space-between",
|
|
1680
|
-
overflow: "auto",
|
|
1681
|
-
scrollbarGutter: isMini ? "stable" : "auto",
|
|
1682
|
-
overflowX: "hidden",
|
|
1683
|
-
pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
|
|
1684
|
-
}, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
|
|
1685
|
-
children: [
|
|
1686
|
-
/* @__PURE__ */ jsx(
|
|
1687
|
-
DashboardSidebarSubNavigation,
|
|
1688
|
-
{
|
|
1689
|
-
subNavigation: navigation,
|
|
1690
|
-
onLinkClick: handleNavigationLinkClick,
|
|
1691
|
-
isMini,
|
|
1692
|
-
isFullyExpanded: isNavigationFullyExpanded,
|
|
1693
|
-
isFullyCollapsed: isNavigationFullyCollapsed,
|
|
1694
|
-
hasDrawerTransitions,
|
|
1695
|
-
sidebarExpandedWidth,
|
|
1696
|
-
renderPageItem
|
|
1697
|
-
}
|
|
1698
|
-
),
|
|
1699
|
-
SidebarFooterSlot ? /* @__PURE__ */ jsx(SidebarFooterSlot, __spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
|
|
1700
|
-
]
|
|
1701
|
-
}
|
|
1702
|
-
)
|
|
1703
|
-
] });
|
|
1704
|
-
},
|
|
1705
|
-
[
|
|
1706
|
-
SidebarFooterSlot,
|
|
1707
|
-
handleNavigationLinkClick,
|
|
1708
|
-
hasDrawerTransitions,
|
|
1709
|
-
isNavigationFullyCollapsed,
|
|
1710
|
-
isNavigationFullyExpanded,
|
|
1711
|
-
navigation,
|
|
1712
|
-
sidebarExpandedWidth,
|
|
1713
|
-
renderPageItem,
|
|
1714
|
-
slotProps == null ? void 0 : slotProps.sidebarFooter
|
|
1715
|
-
]
|
|
1716
|
-
);
|
|
1717
|
-
const getDrawerSharedSx = React16.useCallback(
|
|
1718
|
-
(isMini, isTemporary) => {
|
|
1719
|
-
const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
|
|
1720
|
-
return __spreadProps(__spreadValues(__spreadValues({
|
|
1721
|
-
displayPrint: "none",
|
|
1722
|
-
width: drawerWidth,
|
|
1723
|
-
flexShrink: 0
|
|
1724
|
-
}, getDrawerWidthTransitionMixin(isNavigationExpanded)), isTemporary ? { position: "absolute" } : {}), {
|
|
1725
|
-
[`& .MuiDrawer-paper`]: __spreadValues({
|
|
1726
|
-
position: "absolute",
|
|
1727
|
-
width: drawerWidth,
|
|
1728
|
-
boxSizing: "border-box",
|
|
1729
|
-
backgroundImage: "none"
|
|
1730
|
-
}, getDrawerWidthTransitionMixin(isNavigationExpanded))
|
|
1731
|
-
});
|
|
1732
|
-
},
|
|
1733
|
-
[isNavigationExpanded, sidebarExpandedWidth]
|
|
1734
|
-
);
|
|
1735
|
-
return /* @__PURE__ */ jsxs(
|
|
1736
|
-
Box4,
|
|
1737
|
-
{
|
|
1738
|
-
sx: __spreadValues({
|
|
1739
|
-
position: "relative",
|
|
1740
|
-
display: "flex",
|
|
1741
|
-
overflow: "hidden",
|
|
1742
|
-
height: "100vh",
|
|
1743
|
-
width: "100vw"
|
|
1744
|
-
}, sx),
|
|
1745
|
-
children: [
|
|
1746
|
-
/* @__PURE__ */ jsx(HeaderSlot, __spreadValues({}, headerSlotProps)),
|
|
1747
|
-
!hideNavigation ? /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1748
|
-
/* @__PURE__ */ jsx(
|
|
1749
|
-
Drawer,
|
|
1750
|
-
{
|
|
1751
|
-
container: appWindowContext == null ? void 0 : appWindowContext.document.body,
|
|
1752
|
-
variant: "temporary",
|
|
1753
|
-
open: isMobileNavigationExpanded,
|
|
1754
|
-
onClose: handleSetNavigationExpanded(false),
|
|
1755
|
-
ModalProps: {
|
|
1756
|
-
keepMounted: true
|
|
1757
|
-
// Better open performance on mobile.
|
|
1758
|
-
},
|
|
1759
|
-
sx: __spreadValues({
|
|
1760
|
-
display: {
|
|
1761
|
-
xs: "block",
|
|
1762
|
-
sm: disableCollapsibleSidebar ? "block" : "none",
|
|
1763
|
-
md: "none"
|
|
1764
|
-
}
|
|
1765
|
-
}, getDrawerSharedSx(false, true)),
|
|
1766
|
-
children: getDrawerContent(false, "phone")
|
|
1767
|
-
}
|
|
1768
|
-
),
|
|
1769
|
-
/* @__PURE__ */ jsx(
|
|
1770
|
-
Drawer,
|
|
1771
|
-
{
|
|
1772
|
-
variant: "permanent",
|
|
1773
|
-
sx: __spreadValues({
|
|
1774
|
-
display: {
|
|
1775
|
-
xs: "none",
|
|
1776
|
-
sm: disableCollapsibleSidebar ? "none" : "block",
|
|
1777
|
-
md: "none"
|
|
1778
|
-
}
|
|
1779
|
-
}, getDrawerSharedSx(isMobileMini, false)),
|
|
1780
|
-
children: getDrawerContent(isMobileMini, "tablet")
|
|
1781
|
-
}
|
|
1782
|
-
),
|
|
1783
|
-
/* @__PURE__ */ jsx(
|
|
1784
|
-
Drawer,
|
|
1785
|
-
{
|
|
1786
|
-
variant: "permanent",
|
|
1787
|
-
sx: __spreadValues({
|
|
1788
|
-
display: { xs: "none", md: "block" }
|
|
1789
|
-
}, getDrawerSharedSx(isDesktopMini, false)),
|
|
1790
|
-
children: getDrawerContent(isDesktopMini, "desktop")
|
|
1791
|
-
}
|
|
1792
|
-
)
|
|
1793
|
-
] }) : null,
|
|
1794
|
-
/* @__PURE__ */ jsxs(
|
|
1795
|
-
Box4,
|
|
1796
|
-
{
|
|
1797
|
-
sx: {
|
|
1798
|
-
display: "flex",
|
|
1799
|
-
flexDirection: "column",
|
|
1800
|
-
flex: 1,
|
|
1801
|
-
minWidth: 0
|
|
1802
|
-
},
|
|
1803
|
-
children: [
|
|
1804
|
-
/* @__PURE__ */ jsx(Toolbar2, { sx: { displayPrint: "none" } }),
|
|
1805
|
-
/* @__PURE__ */ jsx(
|
|
1806
|
-
Box4,
|
|
1807
|
-
{
|
|
1808
|
-
component: "main",
|
|
1809
|
-
sx: {
|
|
1810
|
-
display: "flex",
|
|
1811
|
-
flexDirection: "column",
|
|
1812
|
-
flex: 1,
|
|
1813
|
-
overflow: "auto"
|
|
1814
|
-
},
|
|
1815
|
-
children
|
|
1816
|
-
}
|
|
1817
|
-
)
|
|
1818
|
-
]
|
|
1819
|
-
}
|
|
1820
|
-
)
|
|
1821
|
-
]
|
|
1822
|
-
}
|
|
1823
|
-
);
|
|
1824
|
-
}
|
|
1825
|
-
DashboardLayout.propTypes = {
|
|
1826
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1827
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1828
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1829
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1830
|
-
/**
|
|
1831
|
-
* Branding options for the dashboard.
|
|
1832
|
-
* @default null
|
|
1833
|
-
*/
|
|
1834
|
-
branding: PropTypes9.shape({
|
|
1835
|
-
homeUrl: PropTypes9.string,
|
|
1836
|
-
logo: PropTypes9.node,
|
|
1837
|
-
title: PropTypes9.string
|
|
1838
|
-
}),
|
|
1839
|
-
/**
|
|
1840
|
-
* The content of the dashboard.
|
|
1841
|
-
*/
|
|
1842
|
-
children: PropTypes9.node,
|
|
1843
|
-
/**
|
|
1844
|
-
* Whether the sidebar should start collapsed in desktop size screens.
|
|
1845
|
-
* @default false
|
|
1846
|
-
*/
|
|
1847
|
-
defaultSidebarCollapsed: PropTypes9.bool,
|
|
1848
|
-
/**
|
|
1849
|
-
* Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
|
|
1850
|
-
* @default false
|
|
1851
|
-
*/
|
|
1852
|
-
disableCollapsibleSidebar: PropTypes9.bool,
|
|
1853
|
-
/**
|
|
1854
|
-
* Whether the navigation bar and menu icon should be hidden.
|
|
1855
|
-
* @default false
|
|
1856
|
-
*/
|
|
1857
|
-
hideNavigation: PropTypes9.bool,
|
|
1858
|
-
/**
|
|
1859
|
-
* Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
|
|
1860
|
-
* @default []
|
|
1861
|
-
* @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
|
|
1862
|
-
*/
|
|
1863
|
-
navigation: PropTypes9.arrayOf(
|
|
1864
|
-
PropTypes9.oneOfType([
|
|
1865
|
-
PropTypes9.shape({
|
|
1866
|
-
action: PropTypes9.node,
|
|
1867
|
-
children: PropTypes9.arrayOf(
|
|
1868
|
-
PropTypes9.oneOfType([
|
|
1869
|
-
PropTypes9.object,
|
|
1870
|
-
PropTypes9.shape({
|
|
1871
|
-
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1872
|
-
title: PropTypes9.string.isRequired
|
|
1873
|
-
}),
|
|
1874
|
-
PropTypes9.shape({
|
|
1875
|
-
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
1876
|
-
})
|
|
1877
|
-
]).isRequired
|
|
1878
|
-
),
|
|
1879
|
-
icon: PropTypes9.node,
|
|
1880
|
-
kind: PropTypes9.oneOf(["page"]),
|
|
1881
|
-
pattern: PropTypes9.string,
|
|
1882
|
-
segment: PropTypes9.string,
|
|
1883
|
-
title: PropTypes9.string
|
|
1884
|
-
}),
|
|
1885
|
-
PropTypes9.shape({
|
|
1886
|
-
kind: PropTypes9.oneOf(["header"]).isRequired,
|
|
1887
|
-
title: PropTypes9.string.isRequired
|
|
1888
|
-
}),
|
|
1889
|
-
PropTypes9.shape({
|
|
1890
|
-
kind: PropTypes9.oneOf(["divider"]).isRequired
|
|
1891
|
-
})
|
|
1892
|
-
]).isRequired
|
|
1893
|
-
),
|
|
1894
|
-
/**
|
|
1895
|
-
* Render each page item.
|
|
1896
|
-
*
|
|
1897
|
-
* @param {NavigationPageItem} item
|
|
1898
|
-
* @param {{ mini: boolean }} params
|
|
1899
|
-
* @returns {ReactNode}
|
|
1900
|
-
*/
|
|
1901
|
-
renderPageItem: PropTypes9.func,
|
|
1902
|
-
/**
|
|
1903
|
-
* Width of the sidebar when expanded.
|
|
1904
|
-
* @default 320
|
|
1905
|
-
*/
|
|
1906
|
-
sidebarExpandedWidth: PropTypes9.oneOfType([PropTypes9.number, PropTypes9.string]),
|
|
1907
|
-
/**
|
|
1908
|
-
* The props used for each slot inside.
|
|
1909
|
-
* @default {}
|
|
1910
|
-
*/
|
|
1911
|
-
slotProps: PropTypes9.shape({
|
|
1912
|
-
appTitle: PropTypes9.shape({
|
|
1913
|
-
branding: PropTypes9.shape({
|
|
1914
|
-
homeUrl: PropTypes9.string,
|
|
1915
|
-
logo: PropTypes9.node,
|
|
1916
|
-
title: PropTypes9.string
|
|
1917
|
-
})
|
|
1918
|
-
}),
|
|
1919
|
-
header: PropTypes9.shape({
|
|
1920
|
-
branding: PropTypes9.shape({
|
|
1921
|
-
homeUrl: PropTypes9.string,
|
|
1922
|
-
logo: PropTypes9.node,
|
|
1923
|
-
title: PropTypes9.string
|
|
1924
|
-
}),
|
|
1925
|
-
hideMenuButton: PropTypes9.bool,
|
|
1926
|
-
menuOpen: PropTypes9.bool.isRequired,
|
|
1927
|
-
onToggleMenu: PropTypes9.func.isRequired,
|
|
1928
|
-
slotProps: PropTypes9.shape({
|
|
1929
|
-
appTitle: PropTypes9.object,
|
|
1930
|
-
toolbarAccount: PropTypes9.object,
|
|
1931
|
-
toolbarActions: PropTypes9.object
|
|
1932
|
-
}),
|
|
1933
|
-
slots: PropTypes9.shape({
|
|
1934
|
-
appTitle: PropTypes9.elementType,
|
|
1935
|
-
toolbarAccount: PropTypes9.elementType,
|
|
1936
|
-
toolbarActions: PropTypes9.elementType
|
|
1937
|
-
})
|
|
1938
|
-
}),
|
|
1939
|
-
sidebarFooter: PropTypes9.shape({
|
|
1940
|
-
mini: PropTypes9.bool.isRequired
|
|
1941
|
-
}),
|
|
1942
|
-
toolbarAccount: PropTypes9.shape({
|
|
1943
|
-
localeText: PropTypes9.object,
|
|
1944
|
-
slotProps: PropTypes9.shape({
|
|
1945
|
-
popover: PropTypes9.object,
|
|
1946
|
-
popoverContent: PropTypes9.object,
|
|
1947
|
-
preview: PropTypes9.object,
|
|
1948
|
-
signInButton: PropTypes9.object,
|
|
1949
|
-
signOutButton: PropTypes9.object
|
|
1950
|
-
}),
|
|
1951
|
-
slots: PropTypes9.shape({
|
|
1952
|
-
popover: PropTypes9.elementType,
|
|
1953
|
-
popoverContent: PropTypes9.elementType,
|
|
1954
|
-
preview: PropTypes9.elementType,
|
|
1955
|
-
signInButton: PropTypes9.elementType,
|
|
1956
|
-
signOutButton: PropTypes9.elementType
|
|
1957
|
-
})
|
|
1958
|
-
}),
|
|
1959
|
-
toolbarActions: PropTypes9.object
|
|
1960
|
-
}),
|
|
1961
|
-
/**
|
|
1962
|
-
* The components used for each slot inside.
|
|
1963
|
-
* @default {}
|
|
1964
|
-
*/
|
|
1965
|
-
slots: PropTypes9.shape({
|
|
1966
|
-
appTitle: PropTypes9.elementType,
|
|
1967
|
-
header: PropTypes9.elementType,
|
|
1968
|
-
sidebarFooter: PropTypes9.elementType,
|
|
1969
|
-
toolbarAccount: PropTypes9.elementType,
|
|
1970
|
-
toolbarActions: PropTypes9.elementType
|
|
1971
|
-
}),
|
|
1972
|
-
/**
|
|
1973
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1974
|
-
*/
|
|
1975
|
-
sx: PropTypes9.oneOfType([
|
|
1976
|
-
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
1977
|
-
PropTypes9.func,
|
|
1978
|
-
PropTypes9.object
|
|
1979
|
-
])
|
|
1980
|
-
};
|
|
1981
|
-
var PageHeaderToolbarRoot = styled("div")(({ theme }) => ({
|
|
1982
|
-
display: "flex",
|
|
1983
|
-
flexDirection: "row",
|
|
1984
|
-
gap: theme.spacing(1),
|
|
1985
|
-
// Ensure the toolbar is always on the right side, even after wrapping
|
|
1986
|
-
marginLeft: "auto"
|
|
1987
|
-
}));
|
|
1988
|
-
function PageHeaderToolbar(props) {
|
|
1989
|
-
return /* @__PURE__ */ jsx(PageHeaderToolbarRoot, __spreadValues({}, props));
|
|
1990
|
-
}
|
|
1991
|
-
PageHeaderToolbar.propTypes = {
|
|
1992
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1993
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1994
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1995
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1996
|
-
/**
|
|
1997
|
-
* @ignore
|
|
1998
|
-
*/
|
|
1999
|
-
children: PropTypes9.node
|
|
2000
|
-
};
|
|
2001
|
-
var PageContentHeader = styled("div")(({ theme }) => ({
|
|
2002
|
-
display: "flex",
|
|
2003
|
-
flexDirection: "row",
|
|
2004
|
-
justifyContent: "space-between",
|
|
2005
|
-
gap: theme.spacing(2)
|
|
2006
|
-
}));
|
|
2007
|
-
function PageHeader(props) {
|
|
2008
|
-
var _a, _b, _c, _d, _e;
|
|
2009
|
-
const { breadcrumbs, title } = props;
|
|
2010
|
-
const activePage = useActivePage();
|
|
2011
|
-
const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
|
|
2012
|
-
const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
|
|
2013
|
-
const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
|
|
2014
|
-
const toolbarSlotProps = useSlotProps({
|
|
2015
|
-
elementType: ToolbarComponent,
|
|
2016
|
-
ownerState: props,
|
|
2017
|
-
externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
|
|
2018
|
-
additionalProps: {}
|
|
2019
|
-
});
|
|
2020
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
2021
|
-
/* @__PURE__ */ jsx(Breadcrumbs, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
|
|
2022
|
-
return item.path ? /* @__PURE__ */ jsx(
|
|
2023
|
-
Link4,
|
|
2024
|
-
{
|
|
2025
|
-
component: Link2,
|
|
2026
|
-
underline: "hover",
|
|
2027
|
-
color: "inherit",
|
|
2028
|
-
href: item.path,
|
|
2029
|
-
children: getItemTitle(item)
|
|
2030
|
-
},
|
|
2031
|
-
index
|
|
2032
|
-
) : /* @__PURE__ */ jsx(Typography, { color: "text.primary", children: getItemTitle(item) }, index);
|
|
2033
|
-
}) : null }),
|
|
2034
|
-
/* @__PURE__ */ jsxs(PageContentHeader, { children: [
|
|
2035
|
-
resolvedTitle ? /* @__PURE__ */ jsx(Typography, { variant: "h4", children: resolvedTitle }) : null,
|
|
2036
|
-
/* @__PURE__ */ jsx(ToolbarComponent, __spreadValues({}, toolbarSlotProps))
|
|
2037
|
-
] })
|
|
2038
|
-
] });
|
|
2039
|
-
}
|
|
2040
|
-
PageHeader.propTypes = {
|
|
2041
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
2042
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
2043
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
2044
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
2045
|
-
/**
|
|
2046
|
-
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2047
|
-
*/
|
|
2048
|
-
breadcrumbs: PropTypes9.arrayOf(
|
|
2049
|
-
PropTypes9.shape({
|
|
2050
|
-
path: PropTypes9.string,
|
|
2051
|
-
title: PropTypes9.string.isRequired
|
|
2052
|
-
})
|
|
2053
|
-
),
|
|
2054
|
-
/**
|
|
2055
|
-
* The props used for each slot inside.
|
|
2056
|
-
*/
|
|
2057
|
-
slotProps: PropTypes9.shape({
|
|
2058
|
-
toolbar: PropTypes9.shape({
|
|
2059
|
-
children: PropTypes9.node
|
|
2060
|
-
}).isRequired
|
|
2061
|
-
}),
|
|
2062
|
-
/**
|
|
2063
|
-
* The components used for each slot inside.
|
|
2064
|
-
*/
|
|
2065
|
-
slots: PropTypes9.shape({
|
|
2066
|
-
toolbar: PropTypes9.elementType
|
|
2067
|
-
}),
|
|
2068
|
-
/**
|
|
2069
|
-
* The title of the page. Leave blank to use the active page title.
|
|
2070
|
-
*/
|
|
2071
|
-
title: PropTypes9.string
|
|
2072
|
-
};
|
|
2073
|
-
function PageContainer(props) {
|
|
2074
|
-
var _b;
|
|
2075
|
-
const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = __objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
|
|
2076
|
-
const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
|
|
2077
|
-
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, rest), { sx: __spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxs(Stack, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
|
|
2078
|
-
/* @__PURE__ */ jsx(PageHeaderSlot, __spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
|
|
2079
|
-
/* @__PURE__ */ jsx(Box4, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
|
|
2080
|
-
] }) }));
|
|
2081
|
-
}
|
|
2082
|
-
PageContainer.propTypes = {
|
|
2083
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
2084
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
2085
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
2086
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
2087
|
-
/**
|
|
2088
|
-
* The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
|
|
2089
|
-
*/
|
|
2090
|
-
breadcrumbs: PropTypes9.arrayOf(
|
|
2091
|
-
PropTypes9.shape({
|
|
2092
|
-
path: PropTypes9.string,
|
|
2093
|
-
title: PropTypes9.string.isRequired
|
|
2094
|
-
})
|
|
2095
|
-
),
|
|
2096
|
-
/**
|
|
2097
|
-
* @ignore
|
|
2098
|
-
*/
|
|
2099
|
-
children: PropTypes9.node,
|
|
2100
|
-
/**
|
|
2101
|
-
* The props used for each slot inside.
|
|
2102
|
-
*/
|
|
2103
|
-
slotProps: PropTypes9.shape({
|
|
2104
|
-
header: PropTypes9.shape({
|
|
2105
|
-
breadcrumbs: PropTypes9.arrayOf(
|
|
2106
|
-
PropTypes9.shape({
|
|
2107
|
-
path: PropTypes9.string,
|
|
2108
|
-
title: PropTypes9.string.isRequired
|
|
2109
|
-
})
|
|
2110
|
-
),
|
|
2111
|
-
slotProps: PropTypes9.shape({
|
|
2112
|
-
toolbar: PropTypes9.object.isRequired
|
|
2113
|
-
}),
|
|
2114
|
-
slots: PropTypes9.shape({
|
|
2115
|
-
toolbar: PropTypes9.elementType
|
|
2116
|
-
}),
|
|
2117
|
-
title: PropTypes9.string
|
|
2118
|
-
}).isRequired
|
|
2119
|
-
}),
|
|
2120
|
-
/**
|
|
2121
|
-
* The components used for each slot inside.
|
|
2122
|
-
*/
|
|
2123
|
-
slots: PropTypes9.shape({
|
|
2124
|
-
header: PropTypes9.elementType
|
|
2125
|
-
}),
|
|
2126
|
-
/**
|
|
2127
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2128
|
-
*/
|
|
2129
|
-
sx: PropTypes9.oneOfType([
|
|
2130
|
-
PropTypes9.arrayOf(PropTypes9.oneOfType([PropTypes9.func, PropTypes9.object, PropTypes9.bool])),
|
|
2131
|
-
PropTypes9.func,
|
|
2132
|
-
PropTypes9.object
|
|
2133
|
-
]),
|
|
2134
|
-
/**
|
|
2135
|
-
* The title of the page. Leave blank to use the active page title.
|
|
2136
|
-
*/
|
|
2137
|
-
title: PropTypes9.string
|
|
2138
|
-
};
|
|
2139
|
-
|
|
2140
|
-
export { Account, AccountPopoverFooter, AccountPopoverHeader, AccountPreview, AlertDialog, ConfirmDialog, DashboardHeader, DashboardLayout, DashboardSidebarPageItem, PageContainer, PageHeader, PageHeaderToolbar, PromptDialog, SignInButton, SignOutButton, ThemeSwitcher, ToolbarActions, useActivePage, useDialogs, useNotifications };
|