@webiny/app-admin-ui 0.0.0-unstable.a4637c5ce6 → 0.0.0-unstable.a4f3e4ea8b
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/CommandPalette/CommandPalette.d.ts +6 -0
- package/CommandPalette/CommandPalette.js +171 -0
- package/CommandPalette/CommandPalette.js.map +1 -0
- package/CommandPalette/components/CommandDetail.d.ts +13 -0
- package/CommandPalette/components/CommandDetail.js +39 -0
- package/CommandPalette/components/CommandDetail.js.map +1 -0
- package/CommandPalette/components/CommandItemRow.d.ts +5 -0
- package/CommandPalette/components/CommandItemRow.js +39 -0
- package/CommandPalette/components/CommandItemRow.js.map +1 -0
- package/CommandPalette/components/GroupHeading.d.ts +4 -0
- package/CommandPalette/components/GroupHeading.js +10 -0
- package/CommandPalette/components/GroupHeading.js.map +1 -0
- package/CommandPalette/components/HintIcon.d.ts +4 -0
- package/CommandPalette/components/HintIcon.js +11 -0
- package/CommandPalette/components/HintIcon.js.map +1 -0
- package/CommandPalette/components/Kbd.d.ts +4 -0
- package/CommandPalette/components/Kbd.js +14 -0
- package/CommandPalette/components/Kbd.js.map +1 -0
- package/CommandPalette/components/index.d.ts +5 -0
- package/CommandPalette/components/index.js +5 -0
- package/CommandPalette/constants.d.ts +8 -0
- package/CommandPalette/constants.js +5 -0
- package/CommandPalette/constants.js.map +1 -0
- package/CommandPalette/deriveRows.d.ts +19 -0
- package/CommandPalette/deriveRows.js +100 -0
- package/CommandPalette/deriveRows.js.map +1 -0
- package/CommandPalette/types.d.ts +15 -0
- package/CommandPalette/types.js +0 -0
- package/Dashboard/Welcome.d.ts +1 -1
- package/Dashboard/Welcome.js +29 -44
- package/Dashboard/Welcome.js.map +1 -1
- package/Dashboard/components/AssistanceWidget.js +52 -57
- package/Dashboard/components/AssistanceWidget.js.map +1 -1
- package/Dashboard/components/CommunityWidget.js +56 -63
- package/Dashboard/components/CommunityWidget.js.map +1 -1
- package/Dashboard/components/MissingPermissionsWidget.js +13 -14
- package/Dashboard/components/MissingPermissionsWidget.js.map +1 -1
- package/Dashboard/components/assets/github.js +14 -0
- package/Dashboard/components/assets/github.js.map +1 -0
- package/Dashboard/components/assets/slack.js +27 -0
- package/Dashboard/components/assets/slack.js.map +1 -0
- package/Dashboard/components/assets/x-twitter.js +18 -0
- package/Dashboard/components/assets/x-twitter.js.map +1 -0
- package/Dashboard/components/assets/youtube.js +28 -0
- package/Dashboard/components/assets/youtube.js.map +1 -0
- package/Dashboard/components/index.d.ts +3 -4
- package/Dashboard/components/index.js +3 -6
- package/Dashboard.js +7 -8
- package/Dashboard.js.map +1 -1
- package/Dialog/DialogContainer.js +55 -67
- package/Dialog/DialogContainer.js.map +1 -1
- package/Dialog/DialogProvider.js +6 -9
- package/Dialog/DialogProvider.js.map +1 -1
- package/Dialog.js +6 -10
- package/Dialog.js.map +1 -1
- package/Layout.js +48 -29
- package/Layout.js.map +1 -1
- package/Logo.js +12 -13
- package/Logo.js.map +1 -1
- package/Navigation/Navigation.js +31 -33
- package/Navigation/Navigation.js.map +1 -1
- package/Navigation/SidebarMenuItems.d.ts +1 -1
- package/Navigation/SidebarMenuItems.js +32 -40
- package/Navigation/SidebarMenuItems.js.map +1 -1
- package/NotFound/notFound.js +297 -0
- package/NotFound/notFound.js.map +1 -0
- package/NotFound.js +17 -18
- package/NotFound.js.map +1 -1
- package/README.md +9 -5
- package/UserMenu/UserMenu.js +17 -25
- package/UserMenu/UserMenu.js.map +1 -1
- package/UserMenu/UserMenuHandle.js +33 -42
- package/UserMenu/UserMenuHandle.js.map +1 -1
- package/UserMenu/UserMenuItem.js +9 -12
- package/UserMenu/UserMenuItem.js.map +1 -1
- package/UserMenu/UserMenuLink.js +9 -12
- package/UserMenu/UserMenuLink.js.map +1 -1
- package/UserMenu/UserMenuSeparator.js +9 -9
- package/UserMenu/UserMenuSeparator.js.map +1 -1
- package/UserMenu.js +8 -9
- package/UserMenu.js.map +1 -1
- package/index.js +22 -11
- package/index.js.map +1 -1
- package/package.json +21 -25
- package/static/svg/github.08a73b00.svg +1 -0
- package/static/svg/notFound.e8b15981.svg +1 -0
- package/static/svg/slack.1b2ba162.svg +8 -0
- package/static/svg/x-twitter.46e7218c.svg +5 -0
- package/static/svg/youtube.3c232651.svg +11 -0
- package/styles.scss +1 -1
- package/Dashboard/components/ApplicationWidget.d.ts +0 -9
- package/Dashboard/components/ApplicationWidget.js +0 -31
- package/Dashboard/components/ApplicationWidget.js.map +0 -1
- package/Dashboard/components/index.js.map +0 -1
- package/Navigation/SidebarProvider.d.ts +0 -6
- package/Navigation/SidebarProvider.js +0 -9
- package/Navigation/SidebarProvider.js.map +0 -1
- package/Navigation.d.ts +0 -2
- package/Navigation.js +0 -11
- package/Navigation.js.map +0 -1
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./MissingPermissionsWidget";
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./AssistanceWidget.js";
|
|
2
|
+
export * from "./CommunityWidget.js";
|
|
3
|
+
export * from "./MissingPermissionsWidget.js";
|
package/Dashboard.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
1
|
+
import { CenteredView, DashboardRenderer as app_admin_DashboardRenderer } from "@webiny/app-admin";
|
|
2
|
+
import Welcome from "./Dashboard/Welcome.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
const Dashboard = app_admin_DashboardRenderer.createDecorator(()=>function() {
|
|
5
|
+
return /*#__PURE__*/ __rspack_external_react.createElement(CenteredView, null, /*#__PURE__*/ __rspack_external_react.createElement(Welcome, null));
|
|
6
|
+
});
|
|
7
|
+
export { Dashboard };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=Dashboard.js.map
|
package/Dashboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Dashboard.js","sources":["../src/Dashboard.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { CenteredView, DashboardRenderer } from \"@webiny/app-admin\";\nimport Welcome from \"./Dashboard/Welcome.js\";\n\nexport const Dashboard = DashboardRenderer.createDecorator(() => {\n return function DashboardRenderer() {\n return (\n <CenteredView>\n <Welcome />\n </CenteredView>\n );\n };\n});\n"],"names":["Dashboard","DashboardRenderer","CenteredView","Welcome"],"mappings":";;;AAIO,MAAMA,YAAYC,4BAAAA,eAAiC,CAAC,IAChD;QACH,OAAO,WAAP,GACI,sCAACC,cAAYA,MAAAA,WAAAA,GACT,sCAACC,SAAOA;IAGpB"}
|
|
@@ -1,71 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useUi } from "@webiny/app/hooks/useUi";
|
|
1
|
+
import react, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { useUi } from "@webiny/app/hooks/useUi.js";
|
|
3
3
|
import { Dialog } from "@webiny/admin-ui";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"data-testid": dataTestId,
|
|
57
|
-
style: style,
|
|
58
|
-
showCloseButton: showCloseButton,
|
|
59
|
-
title: title,
|
|
60
|
-
actions: !actions.cancel && !actions.accept ? null : /*#__PURE__*/React.createElement(React.Fragment, null, actions.cancel && /*#__PURE__*/React.createElement(Dialog.CancelButton, {
|
|
61
|
-
onClick: actions.cancel.onClick,
|
|
62
|
-
text: actions.cancel.label
|
|
63
|
-
}), actions.accept && /*#__PURE__*/React.createElement(Dialog.ConfirmButton, {
|
|
64
|
-
onClick: handleConfirm,
|
|
65
|
-
text: actions.accept.label,
|
|
66
|
-
"data-testid": "confirmationdialog-confirm-action"
|
|
67
|
-
}))
|
|
68
|
-
}, isLoading ? loading : null, message);
|
|
4
|
+
const DialogContainer = ()=>{
|
|
5
|
+
const ui = useUi();
|
|
6
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
7
|
+
const message = ui.dialog?.message;
|
|
8
|
+
const { dataTestId, title, loading, actions = {
|
|
9
|
+
cancel: null,
|
|
10
|
+
accept: {
|
|
11
|
+
label: "OK"
|
|
12
|
+
}
|
|
13
|
+
}, style, onClose, showCloseButton } = ui.dialog?.options || {};
|
|
14
|
+
const hideDialog = useCallback(()=>{
|
|
15
|
+
ui.setState((ui)=>({
|
|
16
|
+
...ui,
|
|
17
|
+
dialog: null
|
|
18
|
+
}));
|
|
19
|
+
if ("function" == typeof onClose) onClose();
|
|
20
|
+
}, [
|
|
21
|
+
ui
|
|
22
|
+
]);
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
setIsLoading(false);
|
|
25
|
+
}, [
|
|
26
|
+
ui.dialog?.message
|
|
27
|
+
]);
|
|
28
|
+
const handleConfirm = async ()=>{
|
|
29
|
+
if (!actions.accept.onClick) {
|
|
30
|
+
console.info("There is no actions.accept.onClick callback defined.");
|
|
31
|
+
hideDialog();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setIsLoading(true);
|
|
35
|
+
await actions.accept.onClick();
|
|
36
|
+
setIsLoading(false);
|
|
37
|
+
hideDialog();
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/ react.createElement(Dialog, {
|
|
40
|
+
open: !!message,
|
|
41
|
+
onClose: hideDialog,
|
|
42
|
+
"data-testid": dataTestId,
|
|
43
|
+
style: style,
|
|
44
|
+
showCloseButton: showCloseButton,
|
|
45
|
+
title: title,
|
|
46
|
+
loading: isLoading ? loading : false,
|
|
47
|
+
actions: actions.cancel || actions.accept ? /*#__PURE__*/ react.createElement(react.Fragment, null, actions.cancel && /*#__PURE__*/ react.createElement(Dialog.CancelAction, {
|
|
48
|
+
onClick: actions.cancel.onClick,
|
|
49
|
+
text: actions.cancel.label
|
|
50
|
+
}), actions.accept && /*#__PURE__*/ react.createElement(Dialog.ConfirmAction, {
|
|
51
|
+
onClick: handleConfirm,
|
|
52
|
+
text: actions.accept.label,
|
|
53
|
+
"data-testid": "confirmationdialog-confirm-action"
|
|
54
|
+
})) : null
|
|
55
|
+
}, message);
|
|
69
56
|
};
|
|
57
|
+
export { DialogContainer };
|
|
70
58
|
|
|
71
59
|
//# sourceMappingURL=DialogContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Dialog/DialogContainer.js","sources":["../../src/Dialog/DialogContainer.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { useUi } from \"@webiny/app/hooks/useUi.js\";\nimport { Dialog } from \"@webiny/admin-ui\";\n\nexport const DialogContainer = () => {\n const ui = useUi();\n const [isLoading, setIsLoading] = useState(false);\n const message: React.ReactNode = ui.dialog?.message;\n\n const {\n dataTestId,\n title,\n loading,\n actions = { cancel: null, accept: { label: \"OK\" } },\n style,\n onClose,\n showCloseButton\n } = ui.dialog?.options || {};\n\n const hideDialog = useCallback(() => {\n ui.setState(ui => ({ ...ui, dialog: null }));\n if (typeof onClose === \"function\") {\n onClose();\n }\n }, [ui]);\n\n /**\n * We need this part because message can change while the dialog is opened and in loading state.\n */\n useEffect(() => {\n setIsLoading(false);\n }, [ui.dialog?.message]);\n\n const handleConfirm = async () => {\n if (!actions.accept.onClick) {\n /**\n * Should not happen as users should define \"accept.onClick\" function, but just in case lets show the information.\n * Possible to happen in development process.\n */\n console.info(\"There is no actions.accept.onClick callback defined.\");\n hideDialog();\n return;\n }\n setIsLoading(true);\n await actions.accept.onClick();\n setIsLoading(false);\n hideDialog();\n };\n\n return (\n <Dialog\n open={!!message}\n onClose={hideDialog}\n data-testid={dataTestId}\n style={style}\n showCloseButton={showCloseButton}\n title={title}\n loading={isLoading ? loading : false}\n actions={\n !actions.cancel && !actions.accept ? null : (\n <>\n {actions.cancel && (\n <Dialog.CancelAction\n onClick={actions.cancel.onClick}\n text={actions.cancel.label}\n />\n )}\n {actions.accept && (\n <Dialog.ConfirmAction\n onClick={handleConfirm}\n text={actions.accept.label}\n data-testid={\"confirmationdialog-confirm-action\"}\n />\n )}\n </>\n )\n }\n >\n {message}\n </Dialog>\n );\n};\n"],"names":["DialogContainer","ui","useUi","isLoading","setIsLoading","useState","message","dataTestId","title","loading","actions","style","onClose","showCloseButton","hideDialog","useCallback","useEffect","handleConfirm","console","Dialog"],"mappings":";;;AAIO,MAAMA,kBAAkB;IAC3B,MAAMC,KAAKC;IACX,MAAM,CAACC,WAAWC,aAAa,GAAGC,SAAS;IAC3C,MAAMC,UAA2BL,GAAG,MAAM,EAAE;IAE5C,MAAM,EACFM,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,UAAU;QAAE,QAAQ;QAAM,QAAQ;YAAE,OAAO;QAAK;IAAE,CAAC,EACnDC,KAAK,EACLC,OAAO,EACPC,eAAe,EAClB,GAAGZ,GAAG,MAAM,EAAE,WAAW,CAAC;IAE3B,MAAMa,aAAaC,YAAY;QAC3Bd,GAAG,QAAQ,CAACA,CAAAA,KAAO;gBAAE,GAAGA,EAAE;gBAAE,QAAQ;YAAK;QACzC,IAAI,AAAmB,cAAnB,OAAOW,SACPA;IAER,GAAG;QAACX;KAAG;IAKPe,UAAU;QACNZ,aAAa;IACjB,GAAG;QAACH,GAAG,MAAM,EAAE;KAAQ;IAEvB,MAAMgB,gBAAgB;QAClB,IAAI,CAACP,QAAQ,MAAM,CAAC,OAAO,EAAE;YAKzBQ,QAAQ,IAAI,CAAC;YACbJ;YACA;QACJ;QACAV,aAAa;QACb,MAAMM,QAAQ,MAAM,CAAC,OAAO;QAC5BN,aAAa;QACbU;IACJ;IAEA,OAAO,WAAP,GACI,oBAACK,QAAMA;QACH,MAAM,CAAC,CAACb;QACR,SAASQ;QACT,eAAaP;QACb,OAAOI;QACP,iBAAiBE;QACjB,OAAOL;QACP,SAASL,YAAYM,UAAU;QAC/B,SACI,AAACC,QAAQ,MAAM,IAAKA,QAAQ,MAAM,GAAU,WAAP,GACjC,0CACKA,QAAQ,MAAM,IAAI,WAAJ,GACX,oBAACS,OAAO,YAAY;YAChB,SAAST,QAAQ,MAAM,CAAC,OAAO;YAC/B,MAAMA,QAAQ,MAAM,CAAC,KAAK;YAGjCA,QAAQ,MAAM,IAAI,WAAJ,GACX,oBAACS,OAAO,aAAa;YACjB,SAASF;YACT,MAAMP,QAAQ,MAAM,CAAC,KAAK;YAC1B,eAAa;cAZQ;OAmBxCJ;AAGb"}
|
package/Dialog/DialogProvider.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DialogContainer } from "./DialogContainer";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return /*#__PURE__*/React.createElement(Component, null, children, /*#__PURE__*/React.createElement(DialogContainer, null));
|
|
8
|
-
};
|
|
9
|
-
};
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { DialogContainer } from "./DialogContainer.js";
|
|
3
|
+
const DialogProvider = (Component)=>function({ children }) {
|
|
4
|
+
return /*#__PURE__*/ react.createElement(Component, null, children, /*#__PURE__*/ react.createElement(DialogContainer, null));
|
|
5
|
+
};
|
|
6
|
+
export { DialogProvider };
|
|
10
7
|
|
|
11
8
|
//# sourceMappingURL=DialogProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Dialog/DialogProvider.js","sources":["../../src/Dialog/DialogProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { DialogContainer } from \"./DialogContainer.js\";\n\nexport interface DialogProviderProps {\n children?: React.ReactNode;\n}\n\nexport const DialogProvider = (Component: React.ComponentType<DialogProviderProps>) => {\n return function DialogProviderProps({ children }: DialogProviderProps) {\n return (\n <Component>\n {children}\n <DialogContainer />\n </Component>\n );\n };\n};\n"],"names":["DialogProvider","Component","children","DialogContainer"],"mappings":";;AAOO,MAAMA,iBAAiB,CAACC,YACpB,SAA6B,EAAEC,QAAQ,EAAuB;QACjE,OAAO,WAAP,GACI,oBAACD,WAAAA,MACIC,UAAAA,WAAAA,GACD,oBAACC,iBAAeA;IAG5B"}
|
package/Dialog.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { Provider } from "@webiny/app-admin";
|
|
3
|
-
import { DialogProvider } from "./Dialog/DialogProvider";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
9
|
-
hoc: DialogProvider
|
|
10
|
-
});
|
|
11
|
-
};
|
|
3
|
+
import { DialogProvider } from "./Dialog/DialogProvider.js";
|
|
4
|
+
const Dialog = ()=>/*#__PURE__*/ react.createElement(Provider, {
|
|
5
|
+
hoc: DialogProvider
|
|
6
|
+
});
|
|
7
|
+
export { Dialog };
|
|
12
8
|
|
|
13
9
|
//# sourceMappingURL=Dialog.js.map
|
package/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../src/Dialog.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"@webiny/app-admin\";\nimport { DialogProvider } from \"./Dialog/DialogProvider.js\";\n\n// This implements the global dialog, which is controlled via the\n// `useDialog` hook (`packages/app-admin/src/hooks/useDialog.ts`).\nexport const Dialog = () => {\n return <Provider hoc={DialogProvider} />;\n};\n"],"names":["Dialog","Provider","DialogProvider"],"mappings":";;;AAMO,MAAMA,SAAS,IACX,WAAP,GAAO,oBAACC,UAAQA;QAAC,KAAKC"}
|
package/Layout.js
CHANGED
|
@@ -1,34 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { LayoutRenderer,
|
|
4
|
-
import { HeaderBar, cn, useSidebar } from "@webiny/admin-ui";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import react, { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import react_helmet from "react-helmet";
|
|
3
|
+
import { LayoutRenderer, Navigation, TenantSelector, UserMenu } from "@webiny/app-admin";
|
|
4
|
+
import { HeaderBar, SidebarProvider, cn, useSidebar } from "@webiny/admin-ui";
|
|
5
|
+
import { useLocalStorage, useLocalStorageValue } from "@webiny/app";
|
|
6
|
+
import { CommandPalette } from "./CommandPalette/CommandPalette.js";
|
|
7
|
+
const SIDEBAR_STATE_KEY = "navigation/state";
|
|
8
|
+
const parseSidebarState = (raw)=>{
|
|
9
|
+
try {
|
|
10
|
+
if ("object" == typeof raw && null !== raw) return raw;
|
|
11
|
+
if ("string" == typeof raw) return JSON.parse(raw);
|
|
12
|
+
} catch {}
|
|
13
|
+
};
|
|
14
|
+
const LayoutContent = ({ title, startElement = null, hideNavigation = false, children })=>{
|
|
15
|
+
const { pinned } = useSidebar();
|
|
15
16
|
const widthClassNames = {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
"max-w-[calc(100%-(var(--spacing-sidebar-expanded)))] ": pinned,
|
|
18
|
+
"max-w-[calc(100%-(var(--spacing-sidebar-collapsed)))] ": !pinned
|
|
18
19
|
};
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
|
|
21
|
-
}) : null, hideNavigation ? null : /*#__PURE__*/
|
|
22
|
-
|
|
23
|
-
}, /*#__PURE__*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, title ? /*#__PURE__*/ react.createElement(react_helmet, {
|
|
21
|
+
title: title
|
|
22
|
+
}) : null, /*#__PURE__*/ react.createElement(CommandPalette, null), hideNavigation ? null : /*#__PURE__*/ react.createElement(Navigation, null), /*#__PURE__*/ react.createElement("div", {
|
|
23
|
+
className: cn("ml-auto bg-neutral-base transition-[max-width,min-width] ease-linear w-full", hideNavigation ? void 0 : widthClassNames)
|
|
24
|
+
}, /*#__PURE__*/ react.createElement(HeaderBar, {
|
|
25
|
+
start: /*#__PURE__*/ react.createElement("div", {
|
|
26
|
+
className: "flex items-center gap-sm"
|
|
27
|
+
}, startElement),
|
|
28
|
+
end: /*#__PURE__*/ react.createElement("div", {
|
|
29
|
+
className: "flex gap-x-sm items-center justify-end"
|
|
30
|
+
}, /*#__PURE__*/ react.createElement(TenantSelector, null), /*#__PURE__*/ react.createElement(UserMenu, null))
|
|
31
|
+
}), /*#__PURE__*/ react.createElement("main", {
|
|
32
|
+
className: "relative overflow-y-auto h-main-content"
|
|
30
33
|
}, children)));
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
};
|
|
35
|
+
const Layout_Layout = LayoutRenderer.createDecorator(()=>function(props) {
|
|
36
|
+
const localStorage = useLocalStorage();
|
|
37
|
+
const localStorageRef = useRef(localStorage);
|
|
38
|
+
localStorageRef.current = localStorage;
|
|
39
|
+
const rawState = useLocalStorageValue(SIDEBAR_STATE_KEY);
|
|
40
|
+
const cachedState = useMemo(()=>parseSidebarState(rawState), [
|
|
41
|
+
rawState
|
|
42
|
+
]);
|
|
43
|
+
const onChangeState = useCallback((newState)=>{
|
|
44
|
+
localStorageRef.current.set(SIDEBAR_STATE_KEY, JSON.stringify(newState));
|
|
45
|
+
}, []);
|
|
46
|
+
return /*#__PURE__*/ react.createElement(SidebarProvider, {
|
|
47
|
+
state: cachedState,
|
|
48
|
+
onChangeState: onChangeState
|
|
49
|
+
}, /*#__PURE__*/ react.createElement(LayoutContent, props));
|
|
50
|
+
});
|
|
51
|
+
export { Layout_Layout as Layout };
|
|
33
52
|
|
|
34
53
|
//# sourceMappingURL=Layout.js.map
|
package/Layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Layout.js","sources":["../src/Layout.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef } from \"react\";\nimport Helmet from \"react-helmet\";\nimport type { LayoutProps } from \"@webiny/app-admin\";\nimport { LayoutRenderer, Navigation, TenantSelector, UserMenu } from \"@webiny/app-admin\";\nimport { HeaderBar, SidebarProvider, cn, useSidebar } from \"@webiny/admin-ui\";\nimport { useLocalStorage, useLocalStorageValue } from \"@webiny/app\";\nimport { CommandPalette } from \"./CommandPalette/CommandPalette.js\";\n\nconst SIDEBAR_STATE_KEY = \"navigation/state\";\n\ntype SidebarCachedState = {\n pinned: boolean;\n expandedSections: string[];\n pinnedItems: string[];\n};\n\nconst parseSidebarState = (raw: unknown): SidebarCachedState | undefined => {\n try {\n if (typeof raw === \"object\" && raw !== null) {\n return raw as SidebarCachedState;\n }\n if (typeof raw === \"string\") {\n return JSON.parse(raw) as SidebarCachedState;\n }\n } catch {\n // Ignore parse errors\n }\n return undefined;\n};\n\nconst LayoutContent = ({\n title,\n startElement = null,\n hideNavigation = false,\n children\n}: LayoutProps) => {\n const { pinned } = useSidebar();\n\n const widthClassNames = {\n \"max-w-[calc(100%-(var(--spacing-sidebar-expanded)))] \": pinned,\n \"max-w-[calc(100%-(var(--spacing-sidebar-collapsed)))] \": !pinned\n };\n\n return (\n <>\n {title ? <Helmet title={title} /> : null}\n <CommandPalette />\n {hideNavigation ? null : <Navigation />}\n <div\n className={cn(\n \"ml-auto bg-neutral-base transition-[max-width,min-width] ease-linear w-full\",\n hideNavigation ? undefined : widthClassNames\n )}\n >\n <HeaderBar\n start={<div className=\"flex items-center gap-sm\">{startElement}</div>}\n end={\n <div className={\"flex gap-x-sm items-center justify-end\"}>\n <TenantSelector />\n <UserMenu />\n </div>\n }\n />\n <main className={\"relative overflow-y-auto h-main-content\"}>{children}</main>\n </div>\n </>\n );\n};\n\nexport const Layout = LayoutRenderer.createDecorator(() => {\n return function Layout(props: LayoutProps) {\n const localStorage = useLocalStorage();\n const localStorageRef = useRef(localStorage);\n localStorageRef.current = localStorage;\n\n const rawState = useLocalStorageValue(SIDEBAR_STATE_KEY);\n const cachedState = useMemo(() => parseSidebarState(rawState), [rawState]);\n\n const onChangeState = useCallback((newState: SidebarCachedState) => {\n localStorageRef.current.set(SIDEBAR_STATE_KEY, JSON.stringify(newState));\n }, []);\n\n return (\n <SidebarProvider state={cachedState} onChangeState={onChangeState}>\n <LayoutContent {...props} />\n </SidebarProvider>\n );\n };\n});\n"],"names":["SIDEBAR_STATE_KEY","parseSidebarState","raw","JSON","LayoutContent","title","startElement","hideNavigation","children","pinned","useSidebar","widthClassNames","Helmet","CommandPalette","Navigation","cn","undefined","HeaderBar","TenantSelector","UserMenu","Layout","LayoutRenderer","props","localStorage","useLocalStorage","localStorageRef","useRef","rawState","useLocalStorageValue","cachedState","useMemo","onChangeState","useCallback","newState","SidebarProvider"],"mappings":";;;;;;AAQA,MAAMA,oBAAoB;AAQ1B,MAAMC,oBAAoB,CAACC;IACvB,IAAI;QACA,IAAI,AAAe,YAAf,OAAOA,OAAoBA,AAAQ,SAARA,KAC3B,OAAOA;QAEX,IAAI,AAAe,YAAf,OAAOA,KACP,OAAOC,KAAK,KAAK,CAACD;IAE1B,EAAE,OAAM,CAER;AAEJ;AAEA,MAAME,gBAAgB,CAAC,EACnBC,KAAK,EACLC,eAAe,IAAI,EACnBC,iBAAiB,KAAK,EACtBC,QAAQ,EACE;IACV,MAAM,EAAEC,MAAM,EAAE,GAAGC;IAEnB,MAAMC,kBAAkB;QACpB,yDAAyDF;QACzD,0DAA0D,CAACA;IAC/D;IAEA,OAAO,WAAP,GACI,0CACKJ,QAAQ,WAARA,GAAQ,oBAACO,cAAMA;QAAC,OAAOP;SAAY,oBACpC,oBAACQ,gBAAcA,OACdN,iBAAiB,OAAO,WAAP,GAAO,oBAACO,YAAUA,OAAAA,WAAAA,GACpC,oBAAC;QACG,WAAWC,GACP,+EACAR,iBAAiBS,SAAYL;qBAGjC,oBAACM,WAASA;QACN,qBAAO,oBAAC;YAAI,WAAU;WAA4BX;QAClD,mBACI,oBAAC;YAAI,WAAW;yBACZ,oBAACY,gBAAcA,OAAAA,WAAAA,GACf,oBAACC,UAAQA;sBAIrB,oBAAC;QAAK,WAAW;OAA4CX;AAI7E;AAEO,MAAMY,gBAASC,eAAe,eAAe,CAAC,IAC1C,SAAgBC,KAAkB;QACrC,MAAMC,eAAeC;QACrB,MAAMC,kBAAkBC,OAAOH;QAC/BE,gBAAgB,OAAO,GAAGF;QAE1B,MAAMI,WAAWC,qBAAqB5B;QACtC,MAAM6B,cAAcC,QAAQ,IAAM7B,kBAAkB0B,WAAW;YAACA;SAAS;QAEzE,MAAMI,gBAAgBC,YAAY,CAACC;YAC/BR,gBAAgB,OAAO,CAAC,GAAG,CAACzB,mBAAmBG,KAAK,SAAS,CAAC8B;QAClE,GAAG,EAAE;QAEL,OAAO,WAAP,GACI,oBAACC,iBAAeA;YAAC,OAAOL;YAAa,eAAeE;yBAChD,oBAAC3B,eAAkBkB;IAG/B"}
|
package/Logo.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LogoRenderer, useAdminConfig } from "@webiny/app-admin";
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { LogoRenderer, useAdminConfig, useIsInNavigation } from "@webiny/app-admin";
|
|
3
3
|
const minHeight = {
|
|
4
|
-
|
|
4
|
+
minHeight: 48
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
});
|
|
6
|
+
const Logo_Logo = LogoRenderer.createDecorator(()=>function() {
|
|
7
|
+
const { logo } = useAdminConfig();
|
|
8
|
+
const isInNavigation = useIsInNavigation();
|
|
9
|
+
const logoElement = isInNavigation ? logo.squareLogo : logo.horizontalLogo;
|
|
10
|
+
return /*#__PURE__*/ react.createElement("div", {
|
|
11
|
+
style: minHeight
|
|
12
|
+
}, logoElement || null);
|
|
13
|
+
});
|
|
14
|
+
export { Logo_Logo as Logo };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=Logo.js.map
|
package/Logo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Logo.js","sources":["../src/Logo.tsx"],"sourcesContent":["import React from \"react\";\nimport { LogoRenderer, useAdminConfig } from \"@webiny/app-admin\";\nimport { useIsInNavigation } from \"@webiny/app-admin\";\n\nconst minHeight = { minHeight: 48 };\n\nexport const Logo = LogoRenderer.createDecorator(() => {\n return function Logo() {\n const { logo } = useAdminConfig();\n const isInNavigation = useIsInNavigation();\n\n const logoElement = isInNavigation ? logo.squareLogo : logo.horizontalLogo;\n\n return <div style={minHeight}>{logoElement || null}</div>;\n };\n});\n"],"names":["minHeight","Logo","LogoRenderer","logo","useAdminConfig","isInNavigation","useIsInNavigation","logoElement"],"mappings":";;AAIA,MAAMA,YAAY;IAAE,WAAW;AAAG;AAE3B,MAAMC,YAAOC,aAAa,eAAe,CAAC,IACtC;QACH,MAAM,EAAEC,IAAI,EAAE,GAAGC;QACjB,MAAMC,iBAAiBC;QAEvB,MAAMC,cAAcF,iBAAiBF,KAAK,UAAU,GAAGA,KAAK,cAAc;QAE1E,OAAO,WAAP,GAAO,oBAAC;YAAI,OAAOH;WAAYO,eAAe;IAClD"}
|
package/Navigation/Navigation.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { NavigationRenderer, useAdminConfig } from "@webiny/app-admin";
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { NavigationRenderer, SimpleLink, useAdminConfig } from "@webiny/app-admin";
|
|
3
3
|
import { Sidebar } from "@webiny/admin-ui";
|
|
4
|
-
import { SidebarMenuItems } from "./SidebarMenuItems";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
});
|
|
4
|
+
import { SidebarMenuItems } from "./SidebarMenuItems.js";
|
|
5
|
+
const Navigation_Navigation = NavigationRenderer.createDecorator(()=>function() {
|
|
6
|
+
const { menus, title, logo } = useAdminConfig();
|
|
7
|
+
const titleElement = /*#__PURE__*/ react.createElement(SimpleLink, {
|
|
8
|
+
to: "/"
|
|
9
|
+
}, title);
|
|
10
|
+
const icon = /*#__PURE__*/ react.createElement(SimpleLink, {
|
|
11
|
+
to: "/"
|
|
12
|
+
}, /*#__PURE__*/ react.createElement(Sidebar.Icon, {
|
|
13
|
+
element: logo.squareLogo,
|
|
14
|
+
label: "Webiny"
|
|
15
|
+
}));
|
|
16
|
+
const hasFooterMenus = menus.some((m)=>(m.tags || []).includes("footer"));
|
|
17
|
+
return /*#__PURE__*/ react.createElement(Sidebar, {
|
|
18
|
+
title: titleElement,
|
|
19
|
+
icon: icon,
|
|
20
|
+
footer: hasFooterMenus ? /*#__PURE__*/ react.createElement(SidebarMenuItems, {
|
|
21
|
+
menus: menus,
|
|
22
|
+
where: {
|
|
23
|
+
tags: [
|
|
24
|
+
"footer"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}) : void 0
|
|
28
|
+
}, /*#__PURE__*/ react.createElement(SidebarMenuItems, {
|
|
29
|
+
menus: menus
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
export { Navigation_Navigation as Navigation };
|
|
35
33
|
|
|
36
34
|
//# sourceMappingURL=Navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Navigation/Navigation.js","sources":["../../src/Navigation/Navigation.tsx"],"sourcesContent":["import React from \"react\";\nimport { NavigationRenderer, useAdminConfig } from \"@webiny/app-admin\";\nimport { Sidebar } from \"@webiny/admin-ui\";\nimport { SidebarMenuItems } from \"./SidebarMenuItems.js\";\nimport { SimpleLink } from \"@webiny/app-admin\";\n\nexport const Navigation = NavigationRenderer.createDecorator(() => {\n return function Navigation() {\n const { menus, title, logo } = useAdminConfig();\n\n const titleElement = <SimpleLink to={\"/\"}>{title}</SimpleLink>;\n const icon = (\n <SimpleLink to={\"/\"}>\n <Sidebar.Icon element={logo.squareLogo} label={\"Webiny\"} />\n </SimpleLink>\n );\n\n const hasFooterMenus = menus.some(m => (m.tags || []).includes(\"footer\"));\n\n return (\n <Sidebar\n title={titleElement}\n icon={icon}\n footer={\n hasFooterMenus ? (\n <SidebarMenuItems menus={menus} where={{ tags: [\"footer\"] }} />\n ) : undefined\n }\n >\n <SidebarMenuItems menus={menus} />\n </Sidebar>\n );\n };\n});\n"],"names":["Navigation","NavigationRenderer","menus","title","logo","useAdminConfig","titleElement","SimpleLink","icon","Sidebar","hasFooterMenus","m","SidebarMenuItems","undefined"],"mappings":";;;;AAMO,MAAMA,wBAAaC,mBAAmB,eAAe,CAAC,IAClD;QACH,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGC;QAE/B,MAAMC,eAAe,WAAfA,GAAe,oBAACC,YAAUA;YAAC,IAAI;WAAMJ;QAC3C,MAAMK,OAAO,WAAPA,GACF,oBAACD,YAAUA;YAAC,IAAI;yBACZ,oBAACE,QAAQ,IAAI;YAAC,SAASL,KAAK,UAAU;YAAE,OAAO;;QAIvD,MAAMM,iBAAiBR,MAAM,IAAI,CAACS,CAAAA,IAAMA,AAAAA,CAAAA,EAAE,IAAI,IAAI,EAAC,EAAG,QAAQ,CAAC;QAE/D,OAAO,WAAP,GACI,oBAACF,SAAOA;YACJ,OAAOH;YACP,MAAME;YACN,QACIE,iBAAiB,WAAjBA,GACI,oBAACE,kBAAgBA;gBAAC,OAAOV;gBAAO,OAAO;oBAAE,MAAM;wBAAC;qBAAS;gBAAC;iBAC1DW;yBAGR,oBAACD,kBAAgBA;YAAC,OAAOV;;IAGrC"}
|
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
menus: allMenus,
|
|
33
|
-
where: {
|
|
34
|
-
parent: m.name
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
return /*#__PURE__*/React.cloneElement(m.element, {
|
|
39
|
-
key: m.parent + m.name
|
|
1
|
+
import react from "react";
|
|
2
|
+
const SidebarMenuItems = (props)=>{
|
|
3
|
+
const { menus: allMenus, where = {} } = props;
|
|
4
|
+
const filteredMenus = allMenus.filter((menu)=>{
|
|
5
|
+
const whereParent = where.parent || null;
|
|
6
|
+
const menuParent = menu.parent;
|
|
7
|
+
if (whereParent !== menuParent) return false;
|
|
8
|
+
const whereTags = where.tags || [];
|
|
9
|
+
const menuTags = menu.tags || [];
|
|
10
|
+
if (whereTags.length > 0) return whereTags.every((tag)=>menuTags.includes(tag));
|
|
11
|
+
return 0 === menuTags.length;
|
|
12
|
+
});
|
|
13
|
+
return filteredMenus.map((m)=>{
|
|
14
|
+
if (!/*#__PURE__*/ react.isValidElement(m.element)) return null;
|
|
15
|
+
const key = [
|
|
16
|
+
m.parent,
|
|
17
|
+
m.name
|
|
18
|
+
].join("-");
|
|
19
|
+
const hasChildMenus = allMenus.some((menu)=>menu.parent === m.name);
|
|
20
|
+
if (hasChildMenus) return /*#__PURE__*/ react.cloneElement(m.element, {
|
|
21
|
+
key
|
|
22
|
+
}, /*#__PURE__*/ react.createElement(SidebarMenuItems, {
|
|
23
|
+
menus: allMenus,
|
|
24
|
+
where: {
|
|
25
|
+
parent: m.name
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
if (m.hideIfEmpty) return null;
|
|
29
|
+
return /*#__PURE__*/ react.cloneElement(m.element, {
|
|
30
|
+
key
|
|
31
|
+
});
|
|
40
32
|
});
|
|
41
|
-
});
|
|
42
33
|
};
|
|
34
|
+
export { SidebarMenuItems };
|
|
43
35
|
|
|
44
36
|
//# sourceMappingURL=SidebarMenuItems.js.map
|