@webiny/app-admin-ui 6.3.0 → 6.4.0-beta.0
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/Dashboard/Welcome.js +29 -33
- package/Dashboard/Welcome.js.map +1 -1
- package/Dashboard/components/AssistanceWidget.js +51 -52
- package/Dashboard/components/AssistanceWidget.js.map +1 -1
- package/Dashboard/components/CommunityWidget.js +55 -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.js +0 -2
- package/Dashboard.js +6 -7
- package/Dashboard.js.map +1 -1
- package/Dialog/DialogContainer.js +54 -66
- package/Dialog/DialogContainer.js.map +1 -1
- package/Dialog/DialogProvider.js +5 -8
- package/Dialog/DialogProvider.js.map +1 -1
- package/Dialog.js +5 -9
- package/Dialog.js.map +1 -1
- package/Layout.js +22 -30
- package/Layout.js.map +1 -1
- package/Logo.js +12 -16
- package/Logo.js.map +1 -1
- package/Navigation/Navigation.js +30 -34
- package/Navigation/Navigation.js.map +1 -1
- package/Navigation/SidebarMenuItems.js +32 -44
- package/Navigation/SidebarMenuItems.js.map +1 -1
- package/Navigation/SidebarProvider.js +21 -29
- package/Navigation/SidebarProvider.js.map +1 -1
- package/Navigation.js +6 -7
- package/Navigation.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/UserMenu/UserMenu.js +17 -25
- package/UserMenu/UserMenu.js.map +1 -1
- package/UserMenu/UserMenuHandle.js +33 -46
- 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 +4 -5
- package/UserMenu.js.map +1 -1
- package/index.js +13 -14
- package/index.js.map +1 -1
- package/package.json +7 -8
- 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/Dashboard/components/index.js.map +0 -1
|
@@ -1,71 +1,59 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react, { useCallback, useEffect, useState } from "react";
|
|
2
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.CancelAction, {
|
|
61
|
-
onClick: actions.cancel.onClick,
|
|
62
|
-
text: actions.cancel.label
|
|
63
|
-
}), actions.accept && /*#__PURE__*/React.createElement(Dialog.ConfirmAction, {
|
|
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
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { DialogContainer } from "./DialogContainer.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return /*#__PURE__*/React.createElement(Component, null, children, /*#__PURE__*/React.createElement(DialogContainer, null));
|
|
8
|
-
};
|
|
9
|
-
};
|
|
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
3
|
import { DialogProvider } from "./Dialog/DialogProvider.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
9
|
-
hoc: DialogProvider
|
|
10
|
-
});
|
|
11
|
-
};
|
|
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,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
|
+
import react_helmet from "react-helmet";
|
|
3
3
|
import { LayoutRenderer, Navigation, TenantSelector, UserMenu } from "@webiny/app-admin";
|
|
4
4
|
import { HeaderBar, cn, useSidebar } from "@webiny/admin-ui";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
end: /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: "flex gap-x-sm items-center justify-end"
|
|
27
|
-
}, /*#__PURE__*/React.createElement(TenantSelector, null), /*#__PURE__*/React.createElement(UserMenu, null))
|
|
28
|
-
}), /*#__PURE__*/React.createElement("main", {
|
|
29
|
-
className: "relative overflow-y-auto h-main-content"
|
|
30
|
-
}, children)));
|
|
31
|
-
};
|
|
32
|
-
});
|
|
5
|
+
const Layout_Layout = LayoutRenderer.createDecorator(()=>function({ title, startElement = null, hideNavigation = false, children }) {
|
|
6
|
+
const { pinned } = useSidebar();
|
|
7
|
+
const widthClassNames = {
|
|
8
|
+
"max-w-[calc(100%-(var(--spacing-sidebar-expanded)))] ": pinned,
|
|
9
|
+
"max-w-[calc(100%-(var(--spacing-sidebar-collapsed)))] ": !pinned
|
|
10
|
+
};
|
|
11
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, title ? /*#__PURE__*/ react.createElement(react_helmet, {
|
|
12
|
+
title: title
|
|
13
|
+
}) : null, hideNavigation ? null : /*#__PURE__*/ react.createElement(Navigation, null), /*#__PURE__*/ react.createElement("div", {
|
|
14
|
+
className: cn("ml-auto bg-neutral-base transition-[max-width,min-width] ease-linear w-full", hideNavigation ? void 0 : widthClassNames)
|
|
15
|
+
}, /*#__PURE__*/ react.createElement(HeaderBar, {
|
|
16
|
+
start: startElement,
|
|
17
|
+
end: /*#__PURE__*/ react.createElement("div", {
|
|
18
|
+
className: "flex gap-x-sm items-center justify-end"
|
|
19
|
+
}, /*#__PURE__*/ react.createElement(TenantSelector, null), /*#__PURE__*/ react.createElement(UserMenu, null))
|
|
20
|
+
}), /*#__PURE__*/ react.createElement("main", {
|
|
21
|
+
className: "relative overflow-y-auto h-main-content"
|
|
22
|
+
}, children)));
|
|
23
|
+
});
|
|
24
|
+
export { Layout_Layout as Layout };
|
|
33
25
|
|
|
34
26
|
//# 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 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, cn, useSidebar } from \"@webiny/admin-ui\";\n\nexport const Layout = LayoutRenderer.createDecorator(() => {\n return function Layout({\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 {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={startElement}\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});\n"],"names":["Layout","LayoutRenderer","title","startElement","hideNavigation","children","pinned","useSidebar","widthClassNames","Helmet","Navigation","cn","undefined","HeaderBar","TenantSelector","UserMenu"],"mappings":";;;;AAMO,MAAMA,gBAASC,eAAe,eAAe,CAAC,IAC1C,SAAgB,EACnBC,KAAK,EACLC,eAAe,IAAI,EACnBC,iBAAiB,KAAK,EACtBC,QAAQ,EACE;QACV,MAAM,EAAEC,MAAM,EAAE,GAAGC;QAEnB,MAAMC,kBAAkB;YACpB,yDAAyDF;YACzD,0DAA0D,CAACA;QAC/D;QAEA,OAAO,WAAP,GACI,0CACKJ,QAAQ,WAARA,GAAQ,oBAACO,cAAMA;YAAC,OAAOP;aAAY,MACnCE,iBAAiB,OAAO,WAAP,GAAO,oBAACM,YAAUA,OAAAA,WAAAA,GACpC,oBAAC;YACG,WAAWC,GACP,+EACAP,iBAAiBQ,SAAYJ;yBAGjC,oBAACK,WAASA;YACN,OAAOV;YACP,mBACI,oBAAC;gBAAI,WAAW;6BACZ,oBAACW,gBAAcA,OAAAA,WAAAA,GACf,oBAACC,UAAQA;0BAIrB,oBAAC;YAAK,WAAW;WAA4CV;IAI7E"}
|
package/Logo.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LogoRenderer, useAdminConfig } from "@webiny/app-admin";
|
|
3
|
-
import { useIsInNavigation } from "@webiny/app-admin";
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { LogoRenderer, useAdminConfig, useIsInNavigation } from "@webiny/app-admin";
|
|
4
3
|
const minHeight = {
|
|
5
|
-
|
|
4
|
+
minHeight: 48
|
|
6
5
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, logoElement || null);
|
|
17
|
-
};
|
|
18
|
-
});
|
|
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 };
|
|
19
15
|
|
|
20
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,38 +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
4
|
import { SidebarMenuItems } from "./SidebarMenuItems.js";
|
|
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
|
-
menus: menus
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
36
|
-
});
|
|
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 };
|
|
37
33
|
|
|
38
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,48 +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
|
-
}, /*#__PURE__*/React.createElement(SidebarMenuItems, {
|
|
33
|
-
menus: allMenus,
|
|
34
|
-
where: {
|
|
35
|
-
parent: m.name
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
if (m.hideIfEmpty) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return /*#__PURE__*/React.cloneElement(m.element, {
|
|
43
|
-
key
|
|
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
|
+
});
|
|
44
32
|
});
|
|
45
|
-
});
|
|
46
33
|
};
|
|
34
|
+
export { SidebarMenuItems };
|
|
47
35
|
|
|
48
36
|
//# sourceMappingURL=SidebarMenuItems.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Navigation/SidebarMenuItems.js","sources":["../../src/Navigation/SidebarMenuItems.tsx"],"sourcesContent":["import React from \"react\";\nimport type { MenuConfig } from \"@webiny/app-admin/config/AdminConfig/Menu.js\";\n\nexport interface MenusProps {\n menus: MenuConfig[];\n where?: { tags?: string[]; parent?: string };\n}\n\n// This component is called recursively to render root and nested menu items.\n// The menu items are defined via AdminConfig.\nexport const SidebarMenuItems = (props: MenusProps) => {\n const { menus: allMenus, where = {} } = props;\n const filteredMenus = allMenus.filter(menu => {\n const whereParent = where.parent || null;\n const menuParent = menu.parent;\n if (whereParent !== menuParent) {\n return false;\n }\n\n const whereTags = where.tags || [];\n const menuTags = menu.tags || [];\n\n if (whereTags.length > 0) {\n // If not all tags are present, return false.\n return whereTags.every(tag => menuTags.includes(tag));\n }\n\n return menuTags.length === 0;\n });\n\n return filteredMenus.map(m => {\n if (!React.isValidElement(m.element)) {\n return null;\n }\n\n const key = [m.parent, m.name].join(\"-\");\n\n const hasChildMenus = allMenus.some(menu => menu.parent === m.name);\n if (hasChildMenus) {\n return React.cloneElement(\n m.element,\n { key },\n <SidebarMenuItems menus={allMenus} where={{ parent: m.name }} />\n );\n }\n\n if (m.hideIfEmpty) {\n return null;\n }\n\n return React.cloneElement(m.element, { key });\n });\n};\n"],"names":["SidebarMenuItems","props","allMenus","where","filteredMenus","menu","whereParent","menuParent","whereTags","menuTags","tag","m","React","key","hasChildMenus"],"mappings":";AAUO,MAAMA,mBAAmB,CAACC;IAC7B,MAAM,EAAE,OAAOC,QAAQ,EAAEC,QAAQ,CAAC,CAAC,EAAE,GAAGF;IACxC,MAAMG,gBAAgBF,SAAS,MAAM,CAACG,CAAAA;QAClC,MAAMC,cAAcH,MAAM,MAAM,IAAI;QACpC,MAAMI,aAAaF,KAAK,MAAM;QAC9B,IAAIC,gBAAgBC,YAChB,OAAO;QAGX,MAAMC,YAAYL,MAAM,IAAI,IAAI,EAAE;QAClC,MAAMM,WAAWJ,KAAK,IAAI,IAAI,EAAE;QAEhC,IAAIG,UAAU,MAAM,GAAG,GAEnB,OAAOA,UAAU,KAAK,CAACE,CAAAA,MAAOD,SAAS,QAAQ,CAACC;QAGpD,OAAOD,AAAoB,MAApBA,SAAS,MAAM;IAC1B;IAEA,OAAOL,cAAc,GAAG,CAACO,CAAAA;QACrB,IAAI,CAAC,WAAD,GAACC,MAAAA,cAAoB,CAACD,EAAE,OAAO,GAC/B,OAAO;QAGX,MAAME,MAAM;YAACF,EAAE,MAAM;YAAEA,EAAE,IAAI;SAAC,CAAC,IAAI,CAAC;QAEpC,MAAMG,gBAAgBZ,SAAS,IAAI,CAACG,CAAAA,OAAQA,KAAK,MAAM,KAAKM,EAAE,IAAI;QAClE,IAAIG,eACA,OAAO,WAAP,GAAOF,MAAAA,YAAkB,CACrBD,EAAE,OAAO,EACT;YAAEE;QAAI,iBACN,oBAACb,kBAAgBA;YAAC,OAAOE;YAAU,OAAO;gBAAE,QAAQS,EAAE,IAAI;YAAC;;QAInE,IAAIA,EAAE,WAAW,EACb,OAAO;QAGX,OAAO,WAAP,GAAOC,MAAAA,YAAkB,CAACD,EAAE,OAAO,EAAE;YAAEE;QAAI;IAC/C;AACJ"}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SidebarProvider as
|
|
1
|
+
import react, { useMemo } from "react";
|
|
2
|
+
import { SidebarProvider as admin_ui_SidebarProvider } from "@webiny/admin-ui";
|
|
3
3
|
import { useLocalStorage, useLocalStorageValue } from "@webiny/app";
|
|
4
4
|
const SIDEBAR_STATE_KEY = "navigation/state";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, [rawState]);
|
|
24
|
-
const onChangeState = newState => {
|
|
25
|
-
set(SIDEBAR_STATE_KEY, JSON.stringify(newState));
|
|
5
|
+
const SidebarProvider_SidebarProvider = (Component)=>function(props) {
|
|
6
|
+
const rawState = useLocalStorageValue(SIDEBAR_STATE_KEY);
|
|
7
|
+
const { set } = useLocalStorage();
|
|
8
|
+
const state = useMemo(()=>{
|
|
9
|
+
try {
|
|
10
|
+
if ("object" == typeof rawState && null !== rawState) return rawState;
|
|
11
|
+
if ("string" == typeof rawState) return JSON.parse(rawState);
|
|
12
|
+
} catch {}
|
|
13
|
+
}, [
|
|
14
|
+
rawState
|
|
15
|
+
]);
|
|
16
|
+
const onChangeState = (newState)=>{
|
|
17
|
+
set(SIDEBAR_STATE_KEY, JSON.stringify(newState));
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/ react.createElement(admin_ui_SidebarProvider, {
|
|
20
|
+
state: state,
|
|
21
|
+
onChangeState: onChangeState
|
|
22
|
+
}, /*#__PURE__*/ react.createElement(Component, props));
|
|
26
23
|
};
|
|
27
|
-
|
|
28
|
-
state: state,
|
|
29
|
-
onChangeState: onChangeState
|
|
30
|
-
}, /*#__PURE__*/React.createElement(Component, props));
|
|
31
|
-
};
|
|
32
|
-
};
|
|
24
|
+
export { SidebarProvider_SidebarProvider as SidebarProvider };
|
|
33
25
|
|
|
34
26
|
//# sourceMappingURL=SidebarProvider.js.map
|