@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.
Files changed (62) hide show
  1. package/Dashboard/Welcome.js +29 -33
  2. package/Dashboard/Welcome.js.map +1 -1
  3. package/Dashboard/components/AssistanceWidget.js +51 -52
  4. package/Dashboard/components/AssistanceWidget.js.map +1 -1
  5. package/Dashboard/components/CommunityWidget.js +55 -63
  6. package/Dashboard/components/CommunityWidget.js.map +1 -1
  7. package/Dashboard/components/MissingPermissionsWidget.js +13 -14
  8. package/Dashboard/components/MissingPermissionsWidget.js.map +1 -1
  9. package/Dashboard/components/assets/github.js +14 -0
  10. package/Dashboard/components/assets/github.js.map +1 -0
  11. package/Dashboard/components/assets/slack.js +27 -0
  12. package/Dashboard/components/assets/slack.js.map +1 -0
  13. package/Dashboard/components/assets/x-twitter.js +18 -0
  14. package/Dashboard/components/assets/x-twitter.js.map +1 -0
  15. package/Dashboard/components/assets/youtube.js +28 -0
  16. package/Dashboard/components/assets/youtube.js.map +1 -0
  17. package/Dashboard/components/index.js +0 -2
  18. package/Dashboard.js +6 -7
  19. package/Dashboard.js.map +1 -1
  20. package/Dialog/DialogContainer.js +54 -66
  21. package/Dialog/DialogContainer.js.map +1 -1
  22. package/Dialog/DialogProvider.js +5 -8
  23. package/Dialog/DialogProvider.js.map +1 -1
  24. package/Dialog.js +5 -9
  25. package/Dialog.js.map +1 -1
  26. package/Layout.js +22 -30
  27. package/Layout.js.map +1 -1
  28. package/Logo.js +12 -16
  29. package/Logo.js.map +1 -1
  30. package/Navigation/Navigation.js +30 -34
  31. package/Navigation/Navigation.js.map +1 -1
  32. package/Navigation/SidebarMenuItems.js +32 -44
  33. package/Navigation/SidebarMenuItems.js.map +1 -1
  34. package/Navigation/SidebarProvider.js +21 -29
  35. package/Navigation/SidebarProvider.js.map +1 -1
  36. package/Navigation.js +6 -7
  37. package/Navigation.js.map +1 -1
  38. package/NotFound/notFound.js +297 -0
  39. package/NotFound/notFound.js.map +1 -0
  40. package/NotFound.js +17 -18
  41. package/NotFound.js.map +1 -1
  42. package/UserMenu/UserMenu.js +17 -25
  43. package/UserMenu/UserMenu.js.map +1 -1
  44. package/UserMenu/UserMenuHandle.js +33 -46
  45. package/UserMenu/UserMenuHandle.js.map +1 -1
  46. package/UserMenu/UserMenuItem.js +9 -12
  47. package/UserMenu/UserMenuItem.js.map +1 -1
  48. package/UserMenu/UserMenuLink.js +9 -12
  49. package/UserMenu/UserMenuLink.js.map +1 -1
  50. package/UserMenu/UserMenuSeparator.js +9 -9
  51. package/UserMenu/UserMenuSeparator.js.map +1 -1
  52. package/UserMenu.js +4 -5
  53. package/UserMenu.js.map +1 -1
  54. package/index.js +13 -14
  55. package/index.js.map +1 -1
  56. package/package.json +7 -8
  57. package/static/svg/github.08a73b00.svg +1 -0
  58. package/static/svg/notFound.e8b15981.svg +1 -0
  59. package/static/svg/slack.1b2ba162.svg +8 -0
  60. package/static/svg/x-twitter.46e7218c.svg +5 -0
  61. package/static/svg/youtube.3c232651.svg +11 -0
  62. package/Dashboard/components/index.js.map +0 -1
@@ -1,71 +1,59 @@
1
- import React, { useCallback, useEffect, useState } from "react";
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
- export const DialogContainer = () => {
5
- const ui = useUi();
6
- const [isLoading, setIsLoading] = useState(false);
7
- const message = ui.dialog?.message;
8
- const {
9
- dataTestId,
10
- title,
11
- loading,
12
- actions = {
13
- cancel: null,
14
- accept: {
15
- label: "OK"
16
- }
17
- },
18
- style,
19
- onClose,
20
- showCloseButton
21
- } = ui.dialog?.options || {};
22
- const hideDialog = useCallback(() => {
23
- ui.setState(ui => ({
24
- ...ui,
25
- dialog: null
26
- }));
27
- if (typeof onClose === "function") {
28
- onClose();
29
- }
30
- }, [ui]);
31
-
32
- /**
33
- * We need this part because message can change while the dialog is opened and in loading state.
34
- */
35
- useEffect(() => {
36
- setIsLoading(false);
37
- }, [ui.dialog?.message]);
38
- const handleConfirm = async () => {
39
- if (!actions.accept.onClick) {
40
- /**
41
- * Should not happen as users should define "accept.onClick" function, but just in case lets show the information.
42
- * Possible to happen in development process.
43
- */
44
- console.info("There is no actions.accept.onClick callback defined.");
45
- hideDialog();
46
- return;
47
- }
48
- setIsLoading(true);
49
- await actions.accept.onClick();
50
- setIsLoading(false);
51
- hideDialog();
52
- };
53
- return /*#__PURE__*/React.createElement(Dialog, {
54
- open: !!message,
55
- onClose: hideDialog,
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,"names":["React","useCallback","useEffect","useState","useUi","Dialog","DialogContainer","ui","isLoading","setIsLoading","message","dialog","dataTestId","title","loading","actions","cancel","accept","label","style","onClose","showCloseButton","options","hideDialog","setState","handleConfirm","onClick","console","info","createElement","open","Fragment","CancelAction","text","ConfirmAction"],"sources":["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 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 {isLoading ? loading : null}\n {message}\n </Dialog>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,KAAK,QAAQ,4BAA4B;AAClD,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACjC,MAAMC,EAAE,GAAGH,KAAK,CAAC,CAAC;EAClB,MAAM,CAACI,SAAS,EAAEC,YAAY,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAMO,OAAwB,GAAGH,EAAE,CAACI,MAAM,EAAED,OAAO;EAEnD,MAAM;IACFE,UAAU;IACVC,KAAK;IACLC,OAAO;IACPC,OAAO,GAAG;MAAEC,MAAM,EAAE,IAAI;MAAEC,MAAM,EAAE;QAAEC,KAAK,EAAE;MAAK;IAAE,CAAC;IACnDC,KAAK;IACLC,OAAO;IACPC;EACJ,CAAC,GAAGd,EAAE,CAACI,MAAM,EAAEW,OAAO,IAAI,CAAC,CAAC;EAE5B,MAAMC,UAAU,GAAGtB,WAAW,CAAC,MAAM;IACjCM,EAAE,CAACiB,QAAQ,CAACjB,EAAE,KAAK;MAAE,GAAGA,EAAE;MAAEI,MAAM,EAAE;IAAK,CAAC,CAAC,CAAC;IAC5C,IAAI,OAAOS,OAAO,KAAK,UAAU,EAAE;MAC/BA,OAAO,CAAC,CAAC;IACb;EACJ,CAAC,EAAE,CAACb,EAAE,CAAC,CAAC;;EAER;AACJ;AACA;EACIL,SAAS,CAAC,MAAM;IACZO,YAAY,CAAC,KAAK,CAAC;EACvB,CAAC,EAAE,CAACF,EAAE,CAACI,MAAM,EAAED,OAAO,CAAC,CAAC;EAExB,MAAMe,aAAa,GAAG,MAAAA,CAAA,KAAY;IAC9B,IAAI,CAACV,OAAO,CAACE,MAAM,CAACS,OAAO,EAAE;MACzB;AACZ;AACA;AACA;MACYC,OAAO,CAACC,IAAI,CAAC,sDAAsD,CAAC;MACpEL,UAAU,CAAC,CAAC;MACZ;IACJ;IACAd,YAAY,CAAC,IAAI,CAAC;IAClB,MAAMM,OAAO,CAACE,MAAM,CAACS,OAAO,CAAC,CAAC;IAC9BjB,YAAY,CAAC,KAAK,CAAC;IACnBc,UAAU,CAAC,CAAC;EAChB,CAAC;EAED,oBACIvB,KAAA,CAAA6B,aAAA,CAACxB,MAAM;IACHyB,IAAI,EAAE,CAAC,CAACpB,OAAQ;IAChBU,OAAO,EAAEG,UAAW;IACpB,eAAaX,UAAW;IACxBO,KAAK,EAAEA,KAAM;IACbE,eAAe,EAAEA,eAAgB;IACjCR,KAAK,EAAEA,KAAM;IACbE,OAAO,EACH,CAACA,OAAO,CAACC,MAAM,IAAI,CAACD,OAAO,CAACE,MAAM,GAAG,IAAI,gBACrCjB,KAAA,CAAA6B,aAAA,CAAA7B,KAAA,CAAA+B,QAAA,QACKhB,OAAO,CAACC,MAAM,iBACXhB,KAAA,CAAA6B,aAAA,CAACxB,MAAM,CAAC2B,YAAY;MAChBN,OAAO,EAAEX,OAAO,CAACC,MAAM,CAACU,OAAQ;MAChCO,IAAI,EAAElB,OAAO,CAACC,MAAM,CAACE;IAAM,CAC9B,CACJ,EACAH,OAAO,CAACE,MAAM,iBACXjB,KAAA,CAAA6B,aAAA,CAACxB,MAAM,CAAC6B,aAAa;MACjBR,OAAO,EAAED,aAAc;MACvBQ,IAAI,EAAElB,OAAO,CAACE,MAAM,CAACC,KAAM;MAC3B,eAAa;IAAoC,CACpD,CAEP;EAET,GAEAV,SAAS,GAAGM,OAAO,GAAG,IAAI,EAC1BJ,OACG,CAAC;AAEjB,CAAC","ignoreList":[]}
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"}
@@ -1,11 +1,8 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import { DialogContainer } from "./DialogContainer.js";
3
- export const DialogProvider = Component => {
4
- return function DialogProviderProps({
5
- children
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,"names":["React","DialogContainer","DialogProvider","Component","DialogProviderProps","children","createElement"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe;AAMxB,OAAO,MAAMC,cAAc,GAAIC,SAAmD,IAAK;EACnF,OAAO,SAASC,mBAAmBA,CAAC;IAAEC;EAA8B,CAAC,EAAE;IACnE,oBACIL,KAAA,CAAAM,aAAA,CAACH,SAAS,QACLE,QAAQ,eACTL,KAAA,CAAAM,aAAA,CAACL,eAAe,MAAE,CACX,CAAC;EAEpB,CAAC;AACL,CAAC","ignoreList":[]}
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 React from "react";
1
+ import react from "react";
2
2
  import { Provider } from "@webiny/app-admin";
3
3
  import { DialogProvider } from "./Dialog/DialogProvider.js";
4
-
5
- // This implements the global dialog, which is controlled via the
6
- // `useDialog` hook (`packages/app-admin/src/hooks/useDialog.ts`).
7
- export const Dialog = () => {
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,"names":["React","Provider","DialogProvider","Dialog","createElement","hoc"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc;;AAEvB;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EACxB,oBAAOH,KAAA,CAAAI,aAAA,CAACH,QAAQ;IAACI,GAAG,EAAEH;EAAe,CAAE,CAAC;AAC5C,CAAC","ignoreList":[]}
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 React from "react";
2
- import Helmet from "react-helmet";
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
- export const Layout = LayoutRenderer.createDecorator(() => {
6
- return function Layout({
7
- title,
8
- startElement = null,
9
- hideNavigation = false,
10
- children
11
- }) {
12
- const {
13
- pinned
14
- } = useSidebar();
15
- const widthClassNames = {
16
- "max-w-[calc(100%-(var(--spacing-sidebar-expanded)))] ": pinned,
17
- "max-w-[calc(100%-(var(--spacing-sidebar-collapsed)))] ": !pinned
18
- };
19
- return /*#__PURE__*/React.createElement(React.Fragment, null, title ? /*#__PURE__*/React.createElement(Helmet, {
20
- title: title
21
- }) : null, hideNavigation ? null : /*#__PURE__*/React.createElement(Navigation, null), /*#__PURE__*/React.createElement("div", {
22
- className: cn("ml-auto bg-neutral-base transition-[max-width,min-width] ease-linear w-full", hideNavigation ? undefined : widthClassNames)
23
- }, /*#__PURE__*/React.createElement(HeaderBar, {
24
- start: startElement,
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,"names":["React","Helmet","LayoutRenderer","Navigation","TenantSelector","UserMenu","HeaderBar","cn","useSidebar","Layout","createDecorator","title","startElement","hideNavigation","children","pinned","widthClassNames","createElement","Fragment","className","undefined","start","end"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,cAAc;AAEjC,SAASC,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,mBAAmB;AACxF,SAASC,SAAS,EAAEC,EAAE,EAAEC,UAAU,QAAQ,kBAAkB;AAE5D,OAAO,MAAMC,MAAM,GAAGP,cAAc,CAACQ,eAAe,CAAC,MAAM;EACvD,OAAO,SAASD,MAAMA,CAAC;IACnBE,KAAK;IACLC,YAAY,GAAG,IAAI;IACnBC,cAAc,GAAG,KAAK;IACtBC;EACS,CAAC,EAAE;IACZ,MAAM;MAAEC;IAAO,CAAC,GAAGP,UAAU,CAAC,CAAC;IAE/B,MAAMQ,eAAe,GAAG;MACpB,uDAAuD,EAAED,MAAM;MAC/D,wDAAwD,EAAE,CAACA;IAC/D,CAAC;IAED,oBACIf,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,QACKP,KAAK,gBAAGX,KAAA,CAAAiB,aAAA,CAAChB,MAAM;MAACU,KAAK,EAAEA;IAAM,CAAE,CAAC,GAAG,IAAI,EACvCE,cAAc,GAAG,IAAI,gBAAGb,KAAA,CAAAiB,aAAA,CAACd,UAAU,MAAE,CAAC,eACvCH,KAAA,CAAAiB,aAAA;MACIE,SAAS,EAAEZ,EAAE,CACT,6EAA6E,EAC7EM,cAAc,GAAGO,SAAS,GAAGJ,eACjC;IAAE,gBAEFhB,KAAA,CAAAiB,aAAA,CAACX,SAAS;MACNe,KAAK,EAAET,YAAa;MACpBU,GAAG,eACCtB,KAAA,CAAAiB,aAAA;QAAKE,SAAS,EAAE;MAAyC,gBACrDnB,KAAA,CAAAiB,aAAA,CAACb,cAAc,MAAE,CAAC,eAClBJ,KAAA,CAAAiB,aAAA,CAACZ,QAAQ,MAAE,CACV;IACR,CACJ,CAAC,eACFL,KAAA,CAAAiB,aAAA;MAAME,SAAS,EAAE;IAA0C,GAAEL,QAAe,CAC3E,CACP,CAAC;EAEX,CAAC;AACL,CAAC,CAAC","ignoreList":[]}
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 React from "react";
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
- minHeight: 48
4
+ minHeight: 48
6
5
  };
7
- export const Logo = LogoRenderer.createDecorator(() => {
8
- return function Logo() {
9
- const {
10
- logo
11
- } = useAdminConfig();
12
- const isInNavigation = useIsInNavigation();
13
- const logoElement = isInNavigation ? logo.squareLogo : logo.horizontalLogo;
14
- return /*#__PURE__*/React.createElement("div", {
15
- style: minHeight
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,"names":["React","LogoRenderer","useAdminConfig","useIsInNavigation","minHeight","Logo","createDecorator","logo","isInNavigation","logoElement","squareLogo","horizontalLogo","createElement","style"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,cAAc,QAAQ,mBAAmB;AAChE,SAASC,iBAAiB,QAAQ,mBAAmB;AAErD,MAAMC,SAAS,GAAG;EAAEA,SAAS,EAAE;AAAG,CAAC;AAEnC,OAAO,MAAMC,IAAI,GAAGJ,YAAY,CAACK,eAAe,CAAC,MAAM;EACnD,OAAO,SAASD,IAAIA,CAAA,EAAG;IACnB,MAAM;MAAEE;IAAK,CAAC,GAAGL,cAAc,CAAC,CAAC;IACjC,MAAMM,cAAc,GAAGL,iBAAiB,CAAC,CAAC;IAE1C,MAAMM,WAAW,GAAGD,cAAc,GAAGD,IAAI,CAACG,UAAU,GAAGH,IAAI,CAACI,cAAc;IAE1E,oBAAOX,KAAA,CAAAY,aAAA;MAAKC,KAAK,EAAET;IAAU,GAAEK,WAAW,IAAI,IAAU,CAAC;EAC7D,CAAC;AACL,CAAC,CAAC","ignoreList":[]}
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"}
@@ -1,38 +1,34 @@
1
- import React from "react";
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
- import { SimpleLink } from "@webiny/app-admin";
6
- export const Navigation = NavigationRenderer.createDecorator(() => {
7
- return function Navigation() {
8
- const {
9
- menus,
10
- title,
11
- logo
12
- } = useAdminConfig();
13
- const titleElement = /*#__PURE__*/React.createElement(SimpleLink, {
14
- to: "/"
15
- }, title);
16
- const icon = /*#__PURE__*/React.createElement(SimpleLink, {
17
- to: "/"
18
- }, /*#__PURE__*/React.createElement(Sidebar.Icon, {
19
- element: logo.squareLogo,
20
- label: "Webiny"
21
- }));
22
- const hasFooterMenus = menus.some(m => (m.tags || []).includes("footer"));
23
- return /*#__PURE__*/React.createElement(Sidebar, {
24
- title: titleElement,
25
- icon: icon,
26
- footer: hasFooterMenus ? /*#__PURE__*/React.createElement(SidebarMenuItems, {
27
- menus: menus,
28
- where: {
29
- tags: ["footer"]
30
- }
31
- }) : undefined
32
- }, /*#__PURE__*/React.createElement(SidebarMenuItems, {
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,"names":["React","NavigationRenderer","useAdminConfig","Sidebar","SidebarMenuItems","SimpleLink","Navigation","createDecorator","menus","title","logo","titleElement","createElement","to","icon","Icon","element","squareLogo","label","hasFooterMenus","some","m","tags","includes","footer","where","undefined"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,mBAAmB;AACtE,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,gBAAgB;AACzB,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,OAAO,MAAMC,UAAU,GAAGL,kBAAkB,CAACM,eAAe,CAAC,MAAM;EAC/D,OAAO,SAASD,UAAUA,CAAA,EAAG;IACzB,MAAM;MAAEE,KAAK;MAAEC,KAAK;MAAEC;IAAK,CAAC,GAAGR,cAAc,CAAC,CAAC;IAE/C,MAAMS,YAAY,gBAAGX,KAAA,CAAAY,aAAA,CAACP,UAAU;MAACQ,EAAE,EAAE;IAAI,GAAEJ,KAAkB,CAAC;IAC9D,MAAMK,IAAI,gBACNd,KAAA,CAAAY,aAAA,CAACP,UAAU;MAACQ,EAAE,EAAE;IAAI,gBAChBb,KAAA,CAAAY,aAAA,CAACT,OAAO,CAACY,IAAI;MAACC,OAAO,EAAEN,IAAI,CAACO,UAAW;MAACC,KAAK,EAAE;IAAS,CAAE,CAClD,CACf;IAED,MAAMC,cAAc,GAAGX,KAAK,CAACY,IAAI,CAACC,CAAC,IAAI,CAACA,CAAC,CAACC,IAAI,IAAI,EAAE,EAAEC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEzE,oBACIvB,KAAA,CAAAY,aAAA,CAACT,OAAO;MACJM,KAAK,EAAEE,YAAa;MACpBG,IAAI,EAAEA,IAAK;MACXU,MAAM,EACFL,cAAc,gBACVnB,KAAA,CAAAY,aAAA,CAACR,gBAAgB;QAACI,KAAK,EAAEA,KAAM;QAACiB,KAAK,EAAE;UAAEH,IAAI,EAAE,CAAC,QAAQ;QAAE;MAAE,CAAE,CAAC,GAC/DI;IACP,gBAED1B,KAAA,CAAAY,aAAA,CAACR,gBAAgB;MAACI,KAAK,EAAEA;IAAM,CAAE,CAC5B,CAAC;EAElB,CAAC;AACL,CAAC,CAAC","ignoreList":[]}
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 React from "react";
2
- // This component is called recursively to render root and nested menu items.
3
- // The menu items are defined via AdminConfig.
4
- export const SidebarMenuItems = props => {
5
- const {
6
- menus: allMenus,
7
- where = {}
8
- } = props;
9
- const filteredMenus = allMenus.filter(menu => {
10
- const whereParent = where.parent || null;
11
- const menuParent = menu.parent;
12
- if (whereParent !== menuParent) {
13
- return false;
14
- }
15
- const whereTags = where.tags || [];
16
- const menuTags = menu.tags || [];
17
- if (whereTags.length > 0) {
18
- // If not all tags are present, return false.
19
- return whereTags.every(tag => menuTags.includes(tag));
20
- }
21
- return menuTags.length === 0;
22
- });
23
- return filteredMenus.map(m => {
24
- if (! /*#__PURE__*/React.isValidElement(m.element)) {
25
- return null;
26
- }
27
- const key = [m.parent, m.name].join("-");
28
- const hasChildMenus = allMenus.some(menu => menu.parent === m.name);
29
- if (hasChildMenus) {
30
- return /*#__PURE__*/React.cloneElement(m.element, {
31
- key
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,"names":["React","SidebarMenuItems","props","menus","allMenus","where","filteredMenus","filter","menu","whereParent","parent","menuParent","whereTags","tags","menuTags","length","every","tag","includes","map","m","isValidElement","element","key","name","join","hasChildMenus","some","cloneElement","createElement","hideIfEmpty"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAQzB;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,KAAiB,IAAK;EACnD,MAAM;IAAEC,KAAK,EAAEC,QAAQ;IAAEC,KAAK,GAAG,CAAC;EAAE,CAAC,GAAGH,KAAK;EAC7C,MAAMI,aAAa,GAAGF,QAAQ,CAACG,MAAM,CAACC,IAAI,IAAI;IAC1C,MAAMC,WAAW,GAAGJ,KAAK,CAACK,MAAM,IAAI,IAAI;IACxC,MAAMC,UAAU,GAAGH,IAAI,CAACE,MAAM;IAC9B,IAAID,WAAW,KAAKE,UAAU,EAAE;MAC5B,OAAO,KAAK;IAChB;IAEA,MAAMC,SAAS,GAAGP,KAAK,CAACQ,IAAI,IAAI,EAAE;IAClC,MAAMC,QAAQ,GAAGN,IAAI,CAACK,IAAI,IAAI,EAAE;IAEhC,IAAID,SAAS,CAACG,MAAM,GAAG,CAAC,EAAE;MACtB;MACA,OAAOH,SAAS,CAACI,KAAK,CAACC,GAAG,IAAIH,QAAQ,CAACI,QAAQ,CAACD,GAAG,CAAC,CAAC;IACzD;IAEA,OAAOH,QAAQ,CAACC,MAAM,KAAK,CAAC;EAChC,CAAC,CAAC;EAEF,OAAOT,aAAa,CAACa,GAAG,CAACC,CAAC,IAAI;IAC1B,IAAI,eAACpB,KAAK,CAACqB,cAAc,CAACD,CAAC,CAACE,OAAO,CAAC,EAAE;MAClC,OAAO,IAAI;IACf;IAEA,MAAMC,GAAG,GAAG,CAACH,CAAC,CAACV,MAAM,EAAEU,CAAC,CAACI,IAAI,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;IAExC,MAAMC,aAAa,GAAGtB,QAAQ,CAACuB,IAAI,CAACnB,IAAI,IAAIA,IAAI,CAACE,MAAM,KAAKU,CAAC,CAACI,IAAI,CAAC;IACnE,IAAIE,aAAa,EAAE;MACf,oBAAO1B,KAAK,CAAC4B,YAAY,CACrBR,CAAC,CAACE,OAAO,EACT;QAAEC;MAAI,CAAC,eACPvB,KAAA,CAAA6B,aAAA,CAAC5B,gBAAgB;QAACE,KAAK,EAAEC,QAAS;QAACC,KAAK,EAAE;UAAEK,MAAM,EAAEU,CAAC,CAACI;QAAK;MAAE,CAAE,CACnE,CAAC;IACL;IAEA,IAAIJ,CAAC,CAACU,WAAW,EAAE;MACf,OAAO,IAAI;IACf;IAEA,oBAAO9B,KAAK,CAAC4B,YAAY,CAACR,CAAC,CAACE,OAAO,EAAE;MAAEC;IAAI,CAAC,CAAC;EACjD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
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 React, { useMemo } from "react";
2
- import { SidebarProvider as AdminUiSidebar } from "@webiny/admin-ui";
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
- export const SidebarProvider = Component => {
6
- return function SidebarProvider(props) {
7
- const rawState = useLocalStorageValue(SIDEBAR_STATE_KEY);
8
- const {
9
- set
10
- } = useLocalStorage();
11
- const state = useMemo(() => {
12
- try {
13
- if (typeof rawState === "object" && rawState !== null) {
14
- return rawState;
15
- }
16
- if (typeof rawState === "string") {
17
- return JSON.parse(rawState);
18
- }
19
- } catch {
20
- // Ignore parse errors
21
- }
22
- return undefined;
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
- return /*#__PURE__*/React.createElement(AdminUiSidebar, {
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