@blaze-cms/plugin-admin-core-ui 0.129.0-admin-updates.2 → 0.129.0-project-admin-customisations.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 (105) hide show
  1. package/CHANGELOG.md +7 -25
  2. package/README.md +97 -0
  3. package/lib/components/Header/Header.js.map +1 -1
  4. package/lib/components/Header/components/Language/Language.js.map +1 -1
  5. package/lib/components/Header/components/Logo/Logo.js.map +1 -1
  6. package/lib/components/Header/components/Menu/Menu.js.map +1 -1
  7. package/lib/components/Layout/Background.js.map +1 -1
  8. package/lib/components/Layout/Layout.js.map +1 -1
  9. package/lib/components/Layout/components/Grid/Grid.js +3 -84
  10. package/lib/components/Layout/components/Grid/Grid.js.map +1 -1
  11. package/lib/components/Menu/Icons/ChevronDown.js +27 -0
  12. package/lib/components/Menu/Icons/ChevronDown.js.map +1 -0
  13. package/lib/components/Menu/Icons/ChevronUp.js +27 -0
  14. package/lib/components/Menu/Icons/ChevronUp.js.map +1 -0
  15. package/lib/components/Menu/Items/MenuActionItem.js +37 -0
  16. package/lib/components/Menu/Items/MenuActionItem.js.map +1 -0
  17. package/lib/components/Menu/Items/MenuItem.js +73 -0
  18. package/lib/components/Menu/Items/MenuItem.js.map +1 -0
  19. package/lib/components/Menu/Items/MenuLinkItem.js +36 -0
  20. package/lib/components/Menu/Items/MenuLinkItem.js.map +1 -0
  21. package/lib/components/Menu/Menu.js +86 -0
  22. package/lib/components/Menu/Menu.js.map +1 -0
  23. package/lib/components/Menu/Section/MenuSection.js +28 -0
  24. package/lib/components/Menu/Section/MenuSection.js.map +1 -0
  25. package/lib/components/Menu/Section/MenuSectionCollapsible.js +91 -0
  26. package/lib/components/Menu/Section/MenuSectionCollapsible.js.map +1 -0
  27. package/lib/components/Menu/Section/MenuSectionItem.js +40 -0
  28. package/lib/components/Menu/Section/MenuSectionItem.js.map +1 -0
  29. package/lib/components/Menu/Section/MenuSectionItems.js +33 -0
  30. package/lib/components/Menu/Section/MenuSectionItems.js.map +1 -0
  31. package/lib/components/Menu/index.js +12 -0
  32. package/lib/components/Menu/index.js.map +1 -0
  33. package/lib/components/SideBar/SideBar.js +3 -14
  34. package/lib/components/SideBar/SideBar.js.map +1 -1
  35. package/lib/components/SideBar/components/SideBlock.js.map +1 -1
  36. package/lib/components/SideBar/components/SideBlockItem.js.map +1 -1
  37. package/lib/constants.js +1 -1
  38. package/lib/constants.js.map +1 -1
  39. package/lib/containers/Home/Home.js.map +1 -1
  40. package/lib/index.js +13 -9
  41. package/lib/index.js.map +1 -1
  42. package/lib/utils/get-menu-items-resolver.js.map +1 -1
  43. package/lib/utils/menu-handler-singleton.js +114 -0
  44. package/lib/utils/menu-handler-singleton.js.map +1 -0
  45. package/lib/utils/menu-handler.js.map +1 -1
  46. package/lib-es/components/Header/Header.js.map +1 -1
  47. package/lib-es/components/Header/components/Language/Language.js.map +1 -1
  48. package/lib-es/components/Header/components/Logo/Logo.js.map +1 -1
  49. package/lib-es/components/Header/components/Menu/Menu.js.map +1 -1
  50. package/lib-es/components/Layout/Background.js.map +1 -1
  51. package/lib-es/components/Layout/Layout.js.map +1 -1
  52. package/lib-es/components/Layout/components/Grid/Grid.js +8 -51
  53. package/lib-es/components/Layout/components/Grid/Grid.js.map +1 -1
  54. package/lib-es/components/Menu/Icons/ChevronDown.js +16 -0
  55. package/lib-es/components/Menu/Icons/ChevronDown.js.map +1 -0
  56. package/lib-es/components/Menu/Icons/ChevronUp.js +16 -0
  57. package/lib-es/components/Menu/Icons/ChevronUp.js.map +1 -0
  58. package/lib-es/components/Menu/Items/MenuActionItem.js +31 -0
  59. package/lib-es/components/Menu/Items/MenuActionItem.js.map +1 -0
  60. package/lib-es/components/Menu/Items/MenuItem.js +64 -0
  61. package/lib-es/components/Menu/Items/MenuItem.js.map +1 -0
  62. package/lib-es/components/Menu/Items/MenuLinkItem.js +28 -0
  63. package/lib-es/components/Menu/Items/MenuLinkItem.js.map +1 -0
  64. package/lib-es/components/Menu/Menu.js +40 -0
  65. package/lib-es/components/Menu/Menu.js.map +1 -0
  66. package/lib-es/components/Menu/Section/MenuSection.js +18 -0
  67. package/lib-es/components/Menu/Section/MenuSection.js.map +1 -0
  68. package/lib-es/components/Menu/Section/MenuSectionCollapsible.js +67 -0
  69. package/lib-es/components/Menu/Section/MenuSectionCollapsible.js.map +1 -0
  70. package/lib-es/components/Menu/Section/MenuSectionItem.js +30 -0
  71. package/lib-es/components/Menu/Section/MenuSectionItem.js.map +1 -0
  72. package/lib-es/components/Menu/Section/MenuSectionItems.js +20 -0
  73. package/lib-es/components/Menu/Section/MenuSectionItems.js.map +1 -0
  74. package/lib-es/components/Menu/index.js +3 -0
  75. package/lib-es/components/Menu/index.js.map +1 -0
  76. package/lib-es/components/SideBar/SideBar.js +2 -7
  77. package/lib-es/components/SideBar/SideBar.js.map +1 -1
  78. package/lib-es/components/SideBar/components/SideBlock.js.map +1 -1
  79. package/lib-es/components/SideBar/components/SideBlockItem.js.map +1 -1
  80. package/lib-es/constants.js +1 -1
  81. package/lib-es/constants.js.map +1 -1
  82. package/lib-es/containers/Home/Home.js.map +1 -1
  83. package/lib-es/index.js +9 -9
  84. package/lib-es/index.js.map +1 -1
  85. package/lib-es/utils/get-menu-items-resolver.js.map +1 -1
  86. package/lib-es/utils/menu-handler-singleton.js +55 -0
  87. package/lib-es/utils/menu-handler-singleton.js.map +1 -0
  88. package/lib-es/utils/menu-handler.js.map +1 -1
  89. package/package.json +9 -8
  90. package/src/components/Layout/components/Grid/Grid.js +7 -50
  91. package/src/components/Menu/Icons/ChevronDown.js +16 -0
  92. package/src/components/Menu/Icons/ChevronUp.js +16 -0
  93. package/src/components/Menu/Items/MenuActionItem.js +30 -0
  94. package/src/components/Menu/Items/MenuItem.js +49 -0
  95. package/src/components/Menu/Items/MenuLinkItem.js +25 -0
  96. package/src/components/Menu/Menu.js +48 -0
  97. package/src/components/Menu/Section/MenuSection.js +16 -0
  98. package/src/components/Menu/Section/MenuSectionCollapsible.js +59 -0
  99. package/src/components/Menu/Section/MenuSectionItem.js +28 -0
  100. package/src/components/Menu/Section/MenuSectionItems.js +17 -0
  101. package/src/components/Menu/index.js +3 -0
  102. package/src/components/SideBar/SideBar.js +3 -6
  103. package/src/constants.js +3 -1
  104. package/src/index.js +7 -6
  105. package/src/utils/menu-handler-singleton.js +64 -0
@@ -0,0 +1,18 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import MenuSectionItems from './MenuSectionItems';
4
+ const MenuSection = ({
5
+ items,
6
+ children
7
+ }) => /*#__PURE__*/React.createElement(MenuSectionItems, {
8
+ sectionItems: items
9
+ });
10
+ MenuSection.propTypes = {
11
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
12
+ items: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
13
+ };
14
+ MenuSection.defaultProps = {
15
+ children: null
16
+ };
17
+ export default MenuSection;
18
+ //# sourceMappingURL=MenuSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuSection.js","names":["PropTypes","React","MenuSectionItems","MenuSection","items","children","createElement","sectionItems","propTypes","oneOfType","arrayOf","node","isRequired","defaultProps"],"sources":["../../../../src/components/Menu/Section/MenuSection.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport MenuSectionItems from './MenuSectionItems';\n\nconst MenuSection = ({ items, children }) => <MenuSectionItems sectionItems={items} />;\n\nMenuSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n items: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nMenuSection.defaultProps = {\n children: null\n};\n\nexport default MenuSection;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAS,CAAC,kBAAKJ,KAAA,CAAAK,aAAA,CAACJ,gBAAgB;EAACK,YAAY,EAAEH;AAAM,CAAE,CAAC;AAEtFD,WAAW,CAACK,SAAS,GAAG;EACtBH,QAAQ,EAAEL,SAAS,CAACS,SAAS,CAAC,CAACT,SAAS,CAACU,OAAO,CAACV,SAAS,CAACW,IAAI,CAAC,EAAEX,SAAS,CAACW,IAAI,CAAC,CAAC;EAClFP,KAAK,EAAEJ,SAAS,CAACS,SAAS,CAAC,CAACT,SAAS,CAACU,OAAO,CAACV,SAAS,CAACW,IAAI,CAAC,EAAEX,SAAS,CAACW,IAAI,CAAC,CAAC,CAACC;AAClF,CAAC;AAEDT,WAAW,CAACU,YAAY,GAAG;EACzBR,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeF,WAAW"}
@@ -0,0 +1,67 @@
1
+ import React, { useState } from 'react';
2
+ import ChevronDown from '../Icons/ChevronDown';
3
+ import ChevronUp from '../Icons/ChevronUp';
4
+ const capitalise = s => {
5
+ if (typeof s !== 'string') return '';
6
+ return s.charAt(0).toUpperCase() + s.slice(1);
7
+ };
8
+ const MenuSectionCollapsible = ({
9
+ name,
10
+ item,
11
+ children
12
+ }) => {
13
+ const {
14
+ label,
15
+ loadOpen,
16
+ icon: MenuSectionIcon,
17
+ items
18
+ } = item;
19
+ const [collapsed, setCollapsed] = useState(!loadOpen);
20
+ const CollapseIcon = () => collapsed ? /*#__PURE__*/React.createElement(ChevronDown, null) : /*#__PURE__*/React.createElement(ChevronUp, null);
21
+ const handleClick = () => {
22
+ setCollapsed(!collapsed);
23
+ };
24
+ const modifier = collapsed ? 'side-nav__list--item' : 'side-nav__list--item__selected';
25
+ const buttonModifier = collapsed ? 'side-nav__list-link' : 'side-nav__list-link--selected';
26
+ if (name) {
27
+ return /*#__PURE__*/React.createElement("li", {
28
+ className: modifier
29
+ }, /*#__PURE__*/React.createElement("button", {
30
+ type: "button",
31
+ className: buttonModifier,
32
+ onClick: handleClick
33
+ }, /*#__PURE__*/React.createElement("div", {
34
+ className: "side-nav__list-link--icon"
35
+ }, MenuSectionIcon && /*#__PURE__*/React.createElement(MenuSectionIcon, null)), /*#__PURE__*/React.createElement("div", {
36
+ className: "side-nav__list-link--wrapper"
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: "side-nav__list-link--label"
39
+ }, capitalise(name)), /*#__PURE__*/React.createElement("div", {
40
+ className: "side-nav__list-link--toggleCollapseIcon",
41
+ role: "button"
42
+ }, /*#__PURE__*/React.createElement(CollapseIcon, null)))), /*#__PURE__*/React.createElement("div", {
43
+ className: "side-nav__list-link--children"
44
+ }, collapsed ? null : children));
45
+ }
46
+ if (label && items && Object.keys(items).length > 0) {
47
+ return /*#__PURE__*/React.createElement("li", {
48
+ className: modifier
49
+ }, children);
50
+ }
51
+ if (label && items && Object.keys(items).length === 0) {
52
+ return /*#__PURE__*/React.createElement("li", {
53
+ className: modifier
54
+ }, /*#__PURE__*/React.createElement("button", {
55
+ type: "button",
56
+ className: "side-nav__list-link",
57
+ onClick: handleClick
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ className: "side-nav__list-link--icon"
60
+ }, MenuSectionIcon && /*#__PURE__*/React.createElement(MenuSectionIcon, null)), /*#__PURE__*/React.createElement("div", {
61
+ className: "side-nav__list-label"
62
+ }, label)));
63
+ }
64
+ return null;
65
+ };
66
+ export default MenuSectionCollapsible;
67
+ //# sourceMappingURL=MenuSectionCollapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuSectionCollapsible.js","names":["React","useState","ChevronDown","ChevronUp","capitalise","s","charAt","toUpperCase","slice","MenuSectionCollapsible","name","item","children","label","loadOpen","icon","MenuSectionIcon","items","collapsed","setCollapsed","CollapseIcon","createElement","handleClick","modifier","buttonModifier","className","type","onClick","role","Object","keys","length"],"sources":["../../../../src/components/Menu/Section/MenuSectionCollapsible.js"],"sourcesContent":["import React, { useState } from 'react';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\n\nconst capitalise = s => {\n if (typeof s !== 'string') return '';\n return s.charAt(0).toUpperCase() + s.slice(1);\n};\n\nconst MenuSectionCollapsible = ({ name, item, children }) => {\n const { label, loadOpen, icon: MenuSectionIcon, items } = item;\n const [collapsed, setCollapsed] = useState(!loadOpen);\n\n const CollapseIcon = () => (collapsed ? <ChevronDown /> : <ChevronUp />);\n\n const handleClick = () => {\n setCollapsed(!collapsed);\n };\n\n const modifier = collapsed ? 'side-nav__list--item' : 'side-nav__list--item__selected';\n\n const buttonModifier = collapsed ? 'side-nav__list-link' : 'side-nav__list-link--selected';\n\n if (name) {\n return (\n <li className={modifier}>\n <button type=\"button\" className={buttonModifier} onClick={handleClick}>\n <div className=\"side-nav__list-link--icon\">{MenuSectionIcon && <MenuSectionIcon />}</div>\n <div className=\"side-nav__list-link--wrapper\">\n <div className=\"side-nav__list-link--label\">{capitalise(name)}</div>\n <div className=\"side-nav__list-link--toggleCollapseIcon\" role=\"button\">\n <CollapseIcon />\n </div>\n </div>\n </button>\n <div className=\"side-nav__list-link--children\">{collapsed ? null : children}</div>\n </li>\n );\n }\n\n if (label && items && Object.keys(items).length > 0) {\n return <li className={modifier}>{children}</li>;\n }\n\n if (label && items && Object.keys(items).length === 0) {\n return (\n <li className={modifier}>\n <button type=\"button\" className=\"side-nav__list-link\" onClick={handleClick}>\n <div className=\"side-nav__list-link--icon\">{MenuSectionIcon && <MenuSectionIcon />}</div>\n <div className=\"side-nav__list-label\">{label}</div>\n </button>\n </li>\n );\n }\n\n return null;\n};\n\nexport default MenuSectionCollapsible;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,SAAS,MAAM,oBAAoB;AAE1C,MAAMC,UAAU,GAAGC,CAAC,IAAI;EACtB,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE,OAAO,EAAE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O,CAAC,eACpEV,KAAA,CAAAqB,aAAA;MAAKI,SAAS,EAAC,yCAAyC;MAACG,IAAI,EAAC;IAAQ,gBACpE5B,KAAA,CAAAqB,aAAA,CAACD,YAAY,MAAE,CACZ,CACF,CACC,CAAC,eACTpB,KAAA,CAAAqB,aAAA;MAAKI,SAAS,EAAC;IAA+B,GAAEP,SAAS,GAAG,IAAI,GAAGN,QAAc,CAC/E,CAAC;EAET;EAEA,IAAIC,KAAK,IAAII,KAAK,IAAIY,MAAM,CAACC,IAAI,CAACb,KAAK,CAAC,CAACc,MAAM,GAAG,CAAC,EAAE;IACnD,oBAAO/B,KAAA,CAAAqB,aAAA;MAAII,SAAS,EAAEF;IAAS,GAAEX,QAAa,CAAC;EACjD;EAEA,IAAIC,KAAK,IAAII,KAAK,IAAIY,MAAM,CAACC,IAAI,CAACb,KAAK,CAAC,CAACc,MAAM,KAAK,CAAC,EAAE;IACrD,oBACE/B,KAAA,CAAAqB,aAAA;MAAII,SAAS,EAAEF;IAAS,gBACtBvB,KAAA,CAAAqB,aAAA;MAAQK,IAAI,EAAC,QAAQ;MAACD,SAAS,EAAC,qBAAqB;MAACE,OAAO,EAAEL;IAAY,gBACzEtB,KAAA,CAAAqB,aAAA;MAAKI,SAAS,EAAC;IAA2B,GAAET,eAAe,iBAAIhB,KAAA,CAAAqB,aAAA,CAACL,eAAe,MAAE,CAAO,CAAC,eACzFhB,KAAA,CAAAqB,aAAA;MAAKI,SAAS,EAAC;IAAsB,GAAEZ,KAAW,CAC5C,CACN,CAAC;EAET;EAEA,OAAO,IAAI;AACb,CAAC;AAED,eAAeJ,sBAAsB"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import MenuItem from '../Items/MenuItem';
4
+ import MenuSectionCollapsible from './MenuSectionCollapsible';
5
+ const MenuSectionItem = ({
6
+ name,
7
+ item
8
+ }) => {
9
+ if (!item) return null;
10
+ if (item.uri) {
11
+ return /*#__PURE__*/React.createElement(MenuItem, {
12
+ item: item,
13
+ RenderItems: MenuSectionCollapsible
14
+ });
15
+ }
16
+ if (Object.values(item.items).length === 0) return null;
17
+ return /*#__PURE__*/React.createElement(MenuSectionCollapsible, {
18
+ name: name,
19
+ item: item
20
+ }, /*#__PURE__*/React.createElement(MenuItem, {
21
+ item: item,
22
+ RenderItems: MenuSectionCollapsible
23
+ }));
24
+ };
25
+ export default MenuSectionItem;
26
+ MenuSectionItem.propTypes = {
27
+ name: PropTypes.string.isRequired,
28
+ item: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.object]).isRequired
29
+ };
30
+ //# sourceMappingURL=MenuSectionItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuSectionItem.js","names":["React","PropTypes","MenuItem","MenuSectionCollapsible","MenuSectionItem","name","item","uri","createElement","RenderItems","Object","values","items","length","propTypes","string","isRequired","oneOfType","arrayOf","node","object"],"sources":["../../../../src/components/Menu/Section/MenuSectionItem.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport MenuItem from '../Items/MenuItem';\nimport MenuSectionCollapsible from './MenuSectionCollapsible';\n\nconst MenuSectionItem = ({ name, item }) => {\n if (!item) return null;\n\n if (item.uri) {\n return <MenuItem item={item} RenderItems={MenuSectionCollapsible} />;\n }\n\n if (Object.values(item.items).length === 0) return null;\n\n return (\n <MenuSectionCollapsible name={name} item={item}>\n <MenuItem item={item} RenderItems={MenuSectionCollapsible} />\n </MenuSectionCollapsible>\n );\n};\n\nexport default MenuSectionItem;\n\nMenuSectionItem.propTypes = {\n name: PropTypes.string.isRequired,\n item: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.object])\n .isRequired\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,MAAMC,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAAK,CAAC,KAAK;EAC1C,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;EAEtB,IAAIA,IAAI,CAACC,GAAG,EAAE;IACZ,oBAAOP,KAAA,CAAAQ,aAAA,CAACN,QAAQ;MAACI,IAAI,EAAEA,IAAK;MAACG,WAAW,EAAEN;IAAuB,CAAE,CAAC;EACtE;EAEA,IAAIO,MAAM,CAACC,MAAM,CAACL,IAAI,CAACM,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAEvD,oBACEb,KAAA,CAAAQ,aAAA,CAACL,sBAAsB;IAACE,IAAI,EAAEA,IAAK;IAACC,IAAI,EAAEA;EAAK,gBAC7CN,KAAA,CAAAQ,aAAA,CAACN,QAAQ;IAACI,IAAI,EAAEA,IAAK;IAACG,WAAW,EAAEN;EAAuB,CAAE,CACtC,CAAC;AAE7B,CAAC;AAED,eAAeC,eAAe;AAE9BA,eAAe,CAACU,SAAS,GAAG;EAC1BT,IAAI,EAAEJ,SAAS,CAACc,MAAM,CAACC,UAAU;EACjCV,IAAI,EAAEL,SAAS,CAACgB,SAAS,CAAC,CAAChB,SAAS,CAACiB,OAAO,CAACjB,SAAS,CAACkB,IAAI,CAAC,EAAElB,SAAS,CAACkB,IAAI,EAAElB,SAAS,CAACmB,MAAM,CAAC,CAAC,CAC7FJ;AACL,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import MenuSectionItem from './MenuSectionItem';
4
+ const MenuSectionItems = ({
5
+ sectionItems
6
+ }) => {
7
+ const {
8
+ items
9
+ } = sectionItems;
10
+ const menuSections = Object.entries(items).sort((a, b) => a[1].order - b[1].order);
11
+ return menuSections.map(menuItem => /*#__PURE__*/React.createElement(MenuSectionItem, {
12
+ name: menuItem[0],
13
+ item: menuItem[1]
14
+ }));
15
+ };
16
+ export default MenuSectionItems;
17
+ MenuSectionItems.propTypes = {
18
+ sectionItems: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
19
+ };
20
+ //# sourceMappingURL=MenuSectionItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuSectionItems.js","names":["React","PropTypes","MenuSectionItem","MenuSectionItems","sectionItems","items","menuSections","Object","entries","sort","a","b","order","map","menuItem","createElement","name","item","propTypes","oneOfType","arrayOf","node","isRequired"],"sources":["../../../../src/components/Menu/Section/MenuSectionItems.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport MenuSectionItem from './MenuSectionItem';\n\nconst MenuSectionItems = ({ sectionItems }) => {\n const { items } = sectionItems;\n\n const menuSections = Object.entries(items).sort((a, b) => a[1].order - b[1].order);\n\n return menuSections.map(menuItem => <MenuSectionItem name={menuItem[0]} item={menuItem[1]} />);\n};\n\nexport default MenuSectionItems;\n\nMenuSectionItems.propTypes = {\n sectionItems: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC;AAAa,CAAC,KAAK;EAC7C,MAAM;IAAEC;EAAM,CAAC,GAAGD,YAAY;EAE9B,MAAME,YAAY,GAAGC,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC,CAACI,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACE,KAAK,GAAGD,CAAC,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC;EAElF,OAAON,YAAY,CAACO,GAAG,CAACC,QAAQ,iBAAId,KAAA,CAAAe,aAAA,CAACb,eAAe;IAACc,IAAI,EAAEF,QAAQ,CAAC,CAAC,CAAE;IAACG,IAAI,EAAEH,QAAQ,CAAC,CAAC;EAAE,CAAE,CAAC,CAAC;AAChG,CAAC;AAED,eAAeX,gBAAgB;AAE/BA,gBAAgB,CAACe,SAAS,GAAG;EAC3Bd,YAAY,EAAEH,SAAS,CAACkB,SAAS,CAAC,CAAClB,SAAS,CAACmB,OAAO,CAACnB,SAAS,CAACoB,IAAI,CAAC,EAAEpB,SAAS,CAACoB,IAAI,CAAC,CAAC,CAACC;AACzF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Menu from './Menu';
2
+ export default Menu;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Menu"],"sources":["../../../src/components/Menu/index.js"],"sourcesContent":["import Menu from './Menu';\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,QAAQ;AAEzB,eAAeA,IAAI"}
@@ -1,13 +1,11 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import classnames from 'classnames';
4
3
  import PropTypes from 'prop-types';
5
4
  import { useApolloClient } from '@apollo/client';
6
5
  import Avatar from '@blaze-react/avatar';
7
6
  import { handleLogout } from '@blaze-cms/core-auth-ui';
8
- import { SideBlock } from './components';
7
+ import Menu from '../Menu';
9
8
  const SideBar = ({
10
- menuItems,
11
9
  isOpenMenu,
12
10
  onMenuClick,
13
11
  userData
@@ -39,9 +37,7 @@ const SideBar = ({
39
37
  className: sideNavWrapperClassname,
40
38
  "data-testid": "sidenav",
41
39
  id: "side-nav__wrapper"
42
- }, menuItems.length ? menuItems.map(([, data]) => /*#__PURE__*/React.createElement(SideBlock, _extends({
43
- key: data.header
44
- }, data))) : 'Not available content types'), /*#__PURE__*/React.createElement("div", {
40
+ }, /*#__PURE__*/React.createElement(Menu, null)), /*#__PURE__*/React.createElement("div", {
45
41
  className: "side-nav__user"
46
42
  }, /*#__PURE__*/React.createElement("div", {
47
43
  className: "side-nav__user--info"
@@ -64,7 +60,6 @@ const SideBar = ({
64
60
  }, "Log off")));
65
61
  };
66
62
  SideBar.propTypes = {
67
- menuItems: PropTypes.array.isRequired,
68
63
  isOpenMenu: PropTypes.bool.isRequired,
69
64
  onMenuClick: PropTypes.func.isRequired,
70
65
  userData: PropTypes.object.isRequired
@@ -1 +1 @@
1
- {"version":3,"file":"SideBar.js","names":["React","classnames","PropTypes","useApolloClient","Avatar","handleLogout","SideBlock","SideBar","menuItems","isOpenMenu","onMenuClick","userData","client","firstname","lastname","username","sideNavClassname","sideNavWrapperClassname","createElement","className","role","id","onClick","length","map","data","_extends","key","header","window","location","href","propTypes","array","isRequired","bool","func","object"],"sources":["../../../src/components/SideBar/SideBar.js"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { useApolloClient } from '@apollo/client';\nimport Avatar from '@blaze-react/avatar';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { SideBlock } from './components';\n\nconst SideBar = ({ menuItems, isOpenMenu, onMenuClick, userData }) => {\n const client = useApolloClient();\n\n const { firstname, lastname } = userData;\n const username = `${firstname} ${lastname}`;\n\n const sideNavClassname = classnames('side-nav', {\n 'side-nav--open': isOpenMenu,\n 'side-nav--close': !isOpenMenu\n });\n\n const sideNavWrapperClassname = classnames('side-nav__wrapper', {\n 'side-nav__wrapper--close': !isOpenMenu\n });\n\n return (\n <div data-testid=\"sidebar\" className={sideNavClassname}>\n <div\n role=\"button\"\n className=\"side-nav__button open\"\n id=\"side-nav-button\"\n onClick={onMenuClick}>\n <i className=\"material-icons\">keyboard_arrow_left</i>\n </div>\n {/* <Link to=\"/\" className=\"side-nav__block-home\">\n Dashboard\n </Link> */}\n <div className={sideNavWrapperClassname} data-testid=\"sidenav\" id=\"side-nav__wrapper\">\n {menuItems.length\n ? menuItems.map(([, data]) => <SideBlock key={data.header} {...data} />)\n : 'Not available content types'}\n </div>\n <div className=\"side-nav__user\">\n <div className=\"side-nav__user--info\">\n <Avatar username={username} />\n <span className=\"user-name\">{username}</span>\n </div>\n <div className=\"side-nav__user--button\">\n <span\n id=\"logout-button\"\n role=\"button\"\n onClick={async () => {\n await handleLogout(client);\n window.location.href = '/';\n }}\n className=\"material-icons\">\n power_settings_new\n </span>\n </div>\n <span className=\"side-nav__user--toggle\">Log off</span>\n </div>\n </div>\n );\n};\n\nSideBar.propTypes = {\n menuItems: PropTypes.array.isRequired,\n isOpenMenu: PropTypes.bool.isRequired,\n onMenuClick: PropTypes.func.isRequired,\n userData: PropTypes.object.isRequired\n};\n\nexport default SideBar;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,SAAS,QAAQ,cAAc;AAExC,MAAMC,OAAO,GAAGA,CAAC;EAAEC,SAAS;EAAEC,UAAU;EAAEC,WAAW;EAAEC;AAAS,CAAC,KAAK;EACpE,MAAMC,MAAM,GAAGT,eAAe,EAAE;EAEhC,MAAM;IAAEU,SAAS;IAAEC;EAAS,CAAC,GAAGH,QAAQ;EACxC,MAAMI,QAAQ,GAAI,GAAEF,SAAU,IAAGC,QAAS,EAAC;EAE3C,MAAME,gBAAgB,GAAGf,UAAU,CAAC,UAAU,EAAE;IAC9C,gBAAgB,EAAEQ,UAAU;IAC5B,iBAAiB,EAAE,CAACA;EACtB,CAAC,CAAC;EAEF,MAAMQ,uBAAuB,GAAGhB,UAAU,CAAC,mBAAmB,EAAE;IAC9D,0BAA0B,EAAE,CAACQ;EAC/B,CAAC,CAAC;EAEF,oBACET,KAAA,CAAAkB,aAAA;IAAK,eAAY,SAAS;IAACC,SAAS,EAAEH;EAAiB,gBACrDhB,KAAA,CAAAkB,aAAA;IACEE,IAAI,EAAC,QAAQ;IACbD,SAAS,EAAC,uBAAuB;IACjCE,EAAE,EAAC,iBAAiB;IACpBC,OA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CAACiC,IAAI,CAACD,UAAU;EACrCxB,WAAW,EAAER,SAAS,CAACkC,IAAI,CAACF,UAAU;EACtCvB,QAAQ,EAAET,SAAS,CAACmC,MAAM,CAACH;AAC7B,CAAC;AAED,eAAe3B,OAAO"}
1
+ {"version":3,"file":"SideBar.js","names":["React","classnames","PropTypes","useApolloClient","Avatar","handleLogout","Menu","SideBar","isOpenMenu","onMenuClick","userData","client","firstname","lastname","username","sideNavClassname","sideNavWrapperClassname","createElement","className","role","id","onClick","window","location","href","propTypes","bool","isRequired","func","object"],"sources":["../../../src/components/SideBar/SideBar.js"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { useApolloClient } from '@apollo/client';\nimport Avatar from '@blaze-react/avatar';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport Menu from '../Menu';\n\nconst SideBar = ({ isOpenMenu, onMenuClick, userData }) => {\n const client = useApolloClient();\n\n const { firstname, lastname } = userData;\n const username = `${firstname} ${lastname}`;\n\n const sideNavClassname = classnames('side-nav', {\n 'side-nav--open': isOpenMenu,\n 'side-nav--close': !isOpenMenu\n });\n\n const sideNavWrapperClassname = classnames('side-nav__wrapper', {\n 'side-nav__wrapper--close': !isOpenMenu\n });\n\n return (\n <div data-testid=\"sidebar\" className={sideNavClassname}>\n <div\n role=\"button\"\n className=\"side-nav__button open\"\n id=\"side-nav-button\"\n onClick={onMenuClick}>\n <i className=\"material-icons\">keyboard_arrow_left</i>\n </div>\n {/* <Link to=\"/\" className=\"side-nav__block-home\">\n Dashboard\n </Link> */}\n <div className={sideNavWrapperClassname} data-testid=\"sidenav\" id=\"side-nav__wrapper\">\n <Menu />\n </div>\n <div className=\"side-nav__user\">\n <div className=\"side-nav__user--info\">\n <Avatar username={username} />\n <span className=\"user-name\">{username}</span>\n </div>\n <div className=\"side-nav__user--button\">\n <span\n id=\"logout-button\"\n role=\"button\"\n onClick={async () => {\n await handleLogout(client);\n window.location.href = '/';\n }}\n className=\"material-icons\">\n power_settings_new\n </span>\n </div>\n <span className=\"side-nav__user--toggle\">Log off</span>\n </div>\n </div>\n );\n};\n\nSideBar.propTypes = {\n isOpenMenu: PropTypes.bool.isRequired,\n onMenuClick: PropTypes.func.isRequired,\n userData: PropTypes.object.isRequired\n};\n\nexport default SideBar;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,YAAY,QAAQ,yBAAyB;AACtD,OAAOC,IAAI,MAAM,SAAS;AAE1B,MAAMC,OAAO,GAAGA,CAAC;EAAEC,UAAU;EAAEC,WAAW;EAAEC;AAAS,CAAC,KAAK;EACzD,MAAMC,MAAM,GAAGR,eAAe,CAAC,CAAC;EAEhC,MAAM;IAAES,SAAS;IAAEC;EAAS,CAAC,GAAGH,QAAQ;EACxC,MAAMI,QAAQ,GAAI,GAAEF,SAAU,IAAGC,QAAS,EAAC;EAE3C,MAAME,gBAAgB,GAAGd,UAAU,CAAC,UAAU,EAAE;IAC9C,gBAAgB,EAAEO,UAAU;IAC5B,iBAAiB,EAAE,CAACA;EACtB,CAAC,CAAC;EAEF,MAAMQ,uBAAuB,GAAGf,UAAU,CAAC,mBAAmB,EAAE;IAC9D,0BAA0B,EAAE,CAACO;EAC/B,CAAC,CAAC;EAEF,oBACER,KAAA,CAAAiB,aAAA;IAAK,eAAY,SAAS;IAACC,SAAS,EAAEH;EAAiB,gBACrDf,KAAA,CAAAiB,aAAA;IACEE,IAAI,EAAC,QAAQ;IACbD,SAAS,EAAC,uBAAuB;IACjCE,EAAE,EAAC,iBAAiB;IACpBC,OAAO,EAAEZ;EAAY,gBACrBT,KAAA,CAAAiB,aAAA;IAAGC,SAAS,EAAC;EAAgB,GAAC,qBAAsB,CACjD,CAAC,eAINlB,KAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAEF,uBAAwB;IAAC,eAAY,SAAS;IAACI,EAAE,EAAC;EAAmB,gBACnFpB,KAAA,CAAAiB,aAAA,CAACX,IAAI,MAAE,CACJ,CAAC,eACNN,KAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAC;EAAgB,gBAC7BlB,KAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAC;EAAsB,gBACnClB,KAAA,CAAAiB,aAAA,CAACb,MAAM;IAACU,QAAQ,EAAEA;EAAS,CAAE,CAAC,eAC9Bd,KAAA,CAAAiB,aAAA;IAAMC,SAAS,EAAC;EAAW,GAAEJ,QAAe,CACzC,CAAC,eACNd,KAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAC;EAAwB,gBACrClB,KAAA,CAAAiB,aAAA;IACEG,EAAE,EAAC,eAAe;IAClBD,IAAI,EAAC,QAAQ;IACbE,OAAO,EAAE,MAAAA,CAAA,KAAY;MACnB,MAAMhB,YAAY,CAACM,MAAM,CAAC;MAC1BW,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAG,GAAG;IAC5B,CAAE;IACFN,SAAS,EAAC;EAAgB,GAAC,oBAEvB,CACH,CAAC,eACNlB,KAAA,CAAAiB,aAAA;IAAMC,SAAS,EAAC;EAAwB,GAAC,SAAa,CACnD,CACF,CAAC;AAEV,CAAC;AAEDX,OAAO,CAACkB,SAAS,GAAG;EAClBjB,UAAU,EAAEN,SAAS,CAACwB,IAAI,CAACC,UAAU;EACrClB,WAAW,EAAEP,SAAS,CAAC0B,IAAI,CAACD,UAAU;EACtCjB,QAAQ,EAAER,SAAS,CAAC2B,MAAM,CAACF;AAC7B,CAAC;AAED,eAAepB,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"SideBlock.js","names":["React","useState","PropTypes","SideBlockItem","ACTIVE_LABEL","DEFAULT_LABEL","DOWN_ICON","SideBlock","header","items","text","icon","setLabelStatus","clonedItems","firstItems","splice","handleLabelClick","arrowType","createElement","className","map","length","Fragment","type","id","title","htmlFor","onClick","propTypes","string","isRequired","arrayOf","shape","uri","name"],"sources":["../../../../src/components/SideBar/components/SideBlock.js"],"sourcesContent":["/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport SideBlockItem from './SideBlockItem';\nimport { ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON } from '../../../constants';\n\nconst SideBlock = ({ header, items }) => {\n const [{ text, icon }, setLabelStatus] = useState(DEFAULT_LABEL);\n\n const clonedItems = [...items];\n const firstItems = clonedItems.splice(0, 10);\n\n const handleLabelClick = () =>\n icon === DOWN_ICON ? setLabelStatus(ACTIVE_LABEL) : setLabelStatus(DEFAULT_LABEL);\n\n const arrowType = `keyboard_arrow_${icon}`;\n\n return (\n <div className=\"side-nav__block\">\n <div className=\"side-nav__block-heading\">{header}</div>\n <ul className=\"side-nav__list\">\n {firstItems.map(SideBlockItem)}\n {!!clonedItems.length && (\n <>\n <input type=\"checkbox\" className=\"sub-menu-checkbox\" id=\"dropdown\" />\n <div className=\"side-nav__list-dropdown\">{clonedItems.map(SideBlockItem)}</div>\n <li className=\"side-nav__list-item\">\n <label title=\"See more\" htmlFor=\"dropdown\" onClick={handleLabelClick}>\n {text} <i className=\"material-icons\">{arrowType}</i>\n </label>\n </li>\n </>\n )}\n </ul>\n </div>\n );\n};\n\nSideBlock.propTypes = {\n header: PropTypes.string.isRequired,\n items: PropTypes.arrayOf(\n PropTypes.shape({\n uri: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired\n })\n ).isRequired\n};\n\nexport default SideBlock;\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,YAAY,EAAEC,aAAa,EAAEC,SAAS,QAAQ,oBAAoB;AAE3E,MAAMC,SAAS,GAAGA,CAAC;EAAEC,MAAM;EAAE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,CAAK,CAC9C,CACL,CAER,CACE,CACD;AAEV,CAAC;AAEDV,SAAS,CAACqB,SAAS,GAAG;EACpBpB,MAAM,EAAEN,SAAS,CAAC2B,MAAM,CAACC,UAAU;EACnCrB,KAAK,EAAEP,SAAS,CAAC6B,OAAO,CACtB7B,SAAS,CAAC8B,KAAK,CAAC;IACdC,GAAG,EAAE/B,SAAS,CAAC2B,MAAM,CAACC,UAAU;IAChCI,IAAI,EAAEhC,SAAS,CAAC2B,MAAM,CAACC;EACzB,CAAC,CAAC,CACH,CAACA;AACJ,CAAC;AAED,eAAevB,SAAS"}
1
+ {"version":3,"file":"SideBlock.js","names":["React","useState","PropTypes","SideBlockItem","ACTIVE_LABEL","DEFAULT_LABEL","DOWN_ICON","SideBlock","header","items","text","icon","setLabelStatus","clonedItems","firstItems","splice","handleLabelClick","arrowType","createElement","className","map","length","Fragment","type","id","title","htmlFor","onClick","propTypes","string","isRequired","arrayOf","shape","uri","name"],"sources":["../../../../src/components/SideBar/components/SideBlock.js"],"sourcesContent":["/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport SideBlockItem from './SideBlockItem';\nimport { ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON } from '../../../constants';\n\nconst SideBlock = ({ header, items }) => {\n const [{ text, icon }, setLabelStatus] = useState(DEFAULT_LABEL);\n\n const clonedItems = [...items];\n const firstItems = clonedItems.splice(0, 10);\n\n const handleLabelClick = () =>\n icon === DOWN_ICON ? setLabelStatus(ACTIVE_LABEL) : setLabelStatus(DEFAULT_LABEL);\n\n const arrowType = `keyboard_arrow_${icon}`;\n\n return (\n <div className=\"side-nav__block\">\n <div className=\"side-nav__block-heading\">{header}</div>\n <ul className=\"side-nav__list\">\n {firstItems.map(SideBlockItem)}\n {!!clonedItems.length && (\n <>\n <input type=\"checkbox\" className=\"sub-menu-checkbox\" id=\"dropdown\" />\n <div className=\"side-nav__list-dropdown\">{clonedItems.map(SideBlockItem)}</div>\n <li className=\"side-nav__list-item\">\n <label title=\"See more\" htmlFor=\"dropdown\" onClick={handleLabelClick}>\n {text} <i className=\"material-icons\">{arrowType}</i>\n </label>\n </li>\n </>\n )}\n </ul>\n </div>\n );\n};\n\nSideBlock.propTypes = {\n header: PropTypes.string.isRequired,\n items: PropTypes.arrayOf(\n PropTypes.shape({\n uri: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired\n })\n ).isRequired\n};\n\nexport default SideBlock;\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,YAAY,EAAEC,aAAa,EAAEC,SAAS,QAAQ,oBAAoB;AAE3E,MAAMC,SAAS,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAM,CAAC,KAAK;EACvC,MAAM,CAAC;IAAEC,IAAI;IAAEC;EAAK,CAAC,EAAEC,cAAc,CAAC,GAAGX,QAAQ,CAACI,aAAa,CAAC;EAEhE,MAAMQ,WAAW,GAAG,CAAC,GAAGJ,KAAK,CAAC;EAC9B,MAAMK,UAAU,GAAGD,WAAW,CAACE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;EAE5C,MAAMC,gBAAgB,GAAGA,CAAA,KACvBL,IAAI,KAAKL,SAAS,GAAGM,cAAc,CAACR,YAAY,CAAC,GAAGQ,cAAc,CAACP,aAAa,CAAC;EAEnF,MAAMY,SAAS,GAAI,kBAAiBN,IAAK,EAAC;EAE1C,oBACEX,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAiB,gBAC9BnB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAyB,GAAEX,MAAY,CAAC,eACvDR,KAAA,CAAAkB,aAAA;IAAIC,SAAS,EAAC;EAAgB,GAC3BL,UAAU,CAACM,GAAG,CAACjB,aAAa,CAAC,EAC7B,CAAC,CAACU,WAAW,CAACQ,MAAM,iBACnBrB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAsB,QAAA,qBACEtB,KAAA,CAAAkB,aAAA;IAAOK,IAAI,EAAC,UAAU;IAACJ,SAAS,EAAC,mBAAmB;IAACK,EAAE,EAAC;EAAU,CAAE,CAAC,eACrExB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAyB,GAAEN,WAAW,CAACO,GAAG,CAACjB,aAAa,CAAO,CAAC,eAC/EH,KAAA,CAAAkB,aAAA;IAAIC,SAAS,EAAC;EAAqB,gBACjCnB,KAAA,CAAAkB,aAAA;IAAOO,KAAK,EAAC,UAAU;IAACC,OAAO,EAAC,UAAU;IAACC,OAAO,EAAEX;EAAiB,GAClEN,IAAI,EAAC,GAAC,eAAAV,KAAA,CAAAkB,aAAA;IAAGC,SAAS,EAAC;EAAgB,GAAEF,SAAa,CAC9C,CACL,CACJ,CAEF,CACD,CAAC;AAEV,CAAC;AAEDV,SAAS,CAACqB,SAAS,GAAG;EACpBpB,MAAM,EAAEN,SAAS,CAAC2B,MAAM,CAACC,UAAU;EACnCrB,KAAK,EAAEP,SAAS,CAAC6B,OAAO,CACtB7B,SAAS,CAAC8B,KAAK,CAAC;IACdC,GAAG,EAAE/B,SAAS,CAAC2B,MAAM,CAACC,UAAU;IAChCI,IAAI,EAAEhC,SAAS,CAAC2B,MAAM,CAACC;EACzB,CAAC,CACH,CAAC,CAACA;AACJ,CAAC;AAED,eAAevB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"SideBlockItem.js","names":["React","PropTypes","Link","SideBlockItem","uri","name","createElement","key","className","to","propTypes","string","isRequired"],"sources":["../../../../src/components/SideBar/components/SideBlockItem.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router-dom';\n\nconst SideBlockItem = ({ uri, name }) => (\n <li key={name} className=\"side-nav__list-item\">\n <Link to={uri} className=\"side-nav__list-link\">\n {name}\n </Link>\n </li>\n);\n\nSideBlockItem.propTypes = {\n uri: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired\n};\n\nexport default SideBlockItem;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,MAAMC,aAAa,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAAK,CAAC,kBAClCL,KAAA,CAAAM,aAAA;EAAIC,GAAG,EAAEF,IAAK;EAACG,SAAS,EAAC;AAAqB,gBAC5CR,KAAA,CAAAM,aAAA,CAACJ,IAAI;EAACO,EAAE,EAAEL,GAAI;EAACI,SAAS,EAAC;AAAqB,GAC3CH,IAAI,CACA,CAEV;AAEDF,aAAa,CAACO,SAAS,GAAG;EACxBN,GAAG,EAAEH,SAAS,CAACU,MAAM,CAACC,UAAU;EAChCP,IAAI,EAAEJ,SAAS,CAACU,MAAM,CAACC;AACzB,CAAC;AAED,eAAeT,aAAa"}
1
+ {"version":3,"file":"SideBlockItem.js","names":["React","PropTypes","Link","SideBlockItem","uri","name","createElement","key","className","to","propTypes","string","isRequired"],"sources":["../../../../src/components/SideBar/components/SideBlockItem.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router-dom';\n\nconst SideBlockItem = ({ uri, name }) => (\n <li key={name} className=\"side-nav__list-item\">\n <Link to={uri} className=\"side-nav__list-link\">\n {name}\n </Link>\n </li>\n);\n\nSideBlockItem.propTypes = {\n uri: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired\n};\n\nexport default SideBlockItem;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,MAAMC,aAAa,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAAK,CAAC,kBAClCL,KAAA,CAAAM,aAAA;EAAIC,GAAG,EAAEF,IAAK;EAACG,SAAS,EAAC;AAAqB,gBAC5CR,KAAA,CAAAM,aAAA,CAACJ,IAAI;EAACO,EAAE,EAAEL,GAAI;EAACI,SAAS,EAAC;AAAqB,GAC3CH,IACG,CACJ,CACL;AAEDF,aAAa,CAACO,SAAS,GAAG;EACxBN,GAAG,EAAEH,SAAS,CAACU,MAAM,CAACC,UAAU;EAChCP,IAAI,EAAEJ,SAAS,CAACU,MAAM,CAACC;AACzB,CAAC;AAED,eAAeT,aAAa"}
@@ -1,6 +1,6 @@
1
1
  const PLUGIN_NAME = 'admin-core-ui';
2
2
  const LOGO_PROPS = {
3
- src: 'https://images.thisisblaze.com/logo-98-148.png'
3
+ src: process.env.BLAZE_ADMIN_HEAD_LOGO_URL || 'https://images.thisisblaze.com/logo-98-148.png'
4
4
  };
5
5
  const DEFAULT_LABEL = {
6
6
  text: 'See more',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["PLUGIN_NAME","LOGO_PROPS","src","DEFAULT_LABEL","text","icon","ACTIVE_LABEL","DOWN_ICON"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'admin-core-ui';\nconst LOGO_PROPS = { src: 'https://images.thisisblaze.com/logo-98-148.png' };\n\nconst DEFAULT_LABEL = {\n text: 'See more',\n icon: 'down'\n};\n\nconst ACTIVE_LABEL = {\n text: 'See less',\n icon: 'up'\n};\n\nconst DOWN_ICON = 'down';\n\nexport { PLUGIN_NAME, LOGO_PROPS, ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON };\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,eAAe;AACnC,MAAMC,UAAU,GAAG;EAAEC,GAAG,EAAE;AAAiD,CAAC;AAE5E,MAAMC,aAAa,GAAG;EACpBC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,YAAY,GAAG;EACnBF,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAME,SAAS,GAAG,MAAM;AAExB,SAASP,WAAW,EAAEC,UAAU,EAAEK,YAAY,EAAEH,aAAa,EAAEI,SAAS"}
1
+ {"version":3,"file":"constants.js","names":["PLUGIN_NAME","LOGO_PROPS","src","process","env","BLAZE_ADMIN_HEAD_LOGO_URL","DEFAULT_LABEL","text","icon","ACTIVE_LABEL","DOWN_ICON"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'admin-core-ui';\nconst LOGO_PROPS = {\n src: process.env.BLAZE_ADMIN_HEAD_LOGO_URL || 'https://images.thisisblaze.com/logo-98-148.png'\n};\n\nconst DEFAULT_LABEL = {\n text: 'See more',\n icon: 'down'\n};\n\nconst ACTIVE_LABEL = {\n text: 'See less',\n icon: 'up'\n};\n\nconst DOWN_ICON = 'down';\n\nexport { PLUGIN_NAME, LOGO_PROPS, ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON };\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,eAAe;AACnC,MAAMC,UAAU,GAAG;EACjBC,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACC,yBAAyB,IAAI;AAChD,CAAC;AAED,MAAMC,aAAa,GAAG;EACpBC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,YAAY,GAAG;EACnBF,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAME,SAAS,GAAG,MAAM;AAExB,SAASV,WAAW,EAAEC,UAAU,EAAEQ,YAAY,EAAEH,aAAa,EAAEI,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"Home.js","names":["React","Home","createElement","displayName"],"sources":["../../../src/containers/Home/Home.js"],"sourcesContent":["import React from 'react';\n\nconst Home = () => <div />;\n\nHome.displayName = 'Home';\n\nexport default Home;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,IAAI,GAAGA,CAAA,kBAAMD,KAAA,CAAAE,aAAA,aAAO;AAE1BD,IAAI,CAACE,WAAW,GAAG,MAAM;AAEzB,eAAeF,IAAI"}
1
+ {"version":3,"file":"Home.js","names":["React","Home","createElement","displayName"],"sources":["../../../src/containers/Home/Home.js"],"sourcesContent":["import React from 'react';\n\nconst Home = () => <div />;\n\nHome.displayName = 'Home';\n\nexport default Home;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,IAAI,GAAGA,CAAA,kBAAMD,KAAA,CAAAE,aAAA,YAAM,CAAC;AAE1BD,IAAI,CAACE,WAAW,GAAG,MAAM;AAEzB,eAAeF,IAAI"}
package/lib-es/index.js CHANGED
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { Layout } from './components';
3
3
  import pkg from '../package.json';
4
4
  import { PLUGIN_NAME } from './constants';
5
- import getMenuItemsResolver from './utils/get-menu-items-resolver';
5
+ import menuHandler from './utils/menu-handler-singleton';
6
6
  const Home = React.lazy(() => import( /* webpackChunkName: 'Home' */'./containers'));
7
- async function load(app) {
7
+ async function load(app, options = {}) {
8
8
  const home = {
9
9
  path: '/',
10
10
  exact: true,
@@ -12,14 +12,14 @@ async function load(app) {
12
12
  component: Home
13
13
  };
14
14
  app.addRoute(home);
15
- app.addQueryResolver('getMenuItems', getMenuItemsResolver(app));
15
+ menuHandler.setApp(app);
16
16
  app.setLayout(Layout);
17
- app.events.once('load:menu-section', addSection => {
18
- addSection('plugins', {
19
- header: 'plugins',
20
- order: 200
21
- });
22
- });
17
+ const {
18
+ menuConfig = {}
19
+ } = options;
20
+ app.events.once('admin:menu:config:load:after', ({
21
+ addConfig
22
+ }) => addConfig(menuConfig));
23
23
  return {
24
24
  name: PLUGIN_NAME,
25
25
  version: pkg.version
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","Layout","pkg","PLUGIN_NAME","getMenuItemsResolver","Home","lazy","load","app","home","path","exact","key","component","addRoute","addQueryResolver","setLayout","events","once","addSection","header","order","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { Layout } from './components';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\nimport getMenuItemsResolver from './utils/get-menu-items-resolver';\n\nconst Home = React.lazy(() => import(/* webpackChunkName: 'Home' */ './containers'));\n\nasync function load(app) {\n const home = {\n path: '/',\n exact: true,\n key: 'home',\n component: Home\n };\n app.addRoute(home);\n\n app.addQueryResolver('getMenuItems', getMenuItemsResolver(app));\n\n app.setLayout(Layout);\n\n app.events.once('load:menu-section', addSection => {\n addSection('plugins', { header: 'plugins', order: 200 });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n\nexport default load;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,cAAc;AACrC,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AACzC,OAAOC,oBAAoB,MAAM,iCAAiC;AAElE,MAAMC,IAAI,GAAGL,KAAK,CAACM,IAAI,CAAC,MAAM,MAAM,EAAC,8BAA+B,cAAc,CAAC,CAAC;AAEpF,eAAeC,IAAIA,CAACC,GAAG,EAAE;EACvB,MAAMC,IAAI,GAAG;IACXC,IAAI,EAAE,GAAG;IACTC,KAAK,EAAE,IAAI;IACXC,GAAG,EAAE,MAAM;IACXC,SAAS,EAAER;EACb,CAAC;EACDG,GAAG,CAACM,QAAQ,CAACL,IAAI,CAAC;EAElBD,GAAG,CAACO,gBAAgB,CAAC,cAAc,EAAEX,oBAAoB,CAACI,GAAG,CAAC,CAAC;EAE/DA,GAAG,CAACQ,SAAS,CAACf,MAAM,CAAC;EAErBO,GAAG,CAACS,MAAM,CAACC,IAAI,CAAC,mBAAmB,EAAEC,UAAU,IAAI;IACjDA,UAAU,CAAC,SAAS,EAAE;MAAEC,MAAM,EAAE,SAAS;MAAEC,KAAK,EAAE;IAAI,CAAC,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAO;IACLC,IAAI,EAAEnB,WAAW;IACjBoB,OAAO,EAAErB,GAAG,CAACqB;EACf,CAAC;AACH;AAEAhB,IAAI,CAACiB,UAAU,GAAGrB,WAAW;AAE7B,eAAeI,IAAI"}
1
+ {"version":3,"file":"index.js","names":["React","Layout","pkg","PLUGIN_NAME","menuHandler","Home","lazy","load","app","options","home","path","exact","key","component","addRoute","setApp","setLayout","menuConfig","events","once","addConfig","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { Layout } from './components';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\nimport menuHandler from './utils/menu-handler-singleton';\n\nconst Home = React.lazy(() => import(/* webpackChunkName: 'Home' */ './containers'));\n\nasync function load(app, options = {}) {\n const home = {\n path: '/',\n exact: true,\n key: 'home',\n component: Home\n };\n\n app.addRoute(home);\n\n menuHandler.setApp(app);\n\n app.setLayout(Layout);\n\n const { menuConfig = {} } = options;\n\n app.events.once('admin:menu:config:load:after', ({ addConfig }) => addConfig(menuConfig));\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n\nexport default load;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,cAAc;AACrC,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AACzC,OAAOC,WAAW,MAAM,gCAAgC;AAExD,MAAMC,IAAI,GAAGL,KAAK,CAACM,IAAI,CAAC,MAAM,MAAM,EAAC,8BAA+B,cAAc,CAAC,CAAC;AAEpF,eAAeC,IAAIA,CAACC,GAAG,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EACrC,MAAMC,IAAI,GAAG;IACXC,IAAI,EAAE,GAAG;IACTC,KAAK,EAAE,IAAI;IACXC,GAAG,EAAE,MAAM;IACXC,SAAS,EAAET;EACb,CAAC;EAEDG,GAAG,CAACO,QAAQ,CAACL,IAAI,CAAC;EAElBN,WAAW,CAACY,MAAM,CAACR,GAAG,CAAC;EAEvBA,GAAG,CAACS,SAAS,CAAChB,MAAM,CAAC;EAErB,MAAM;IAAEiB,UAAU,GAAG,CAAC;EAAE,CAAC,GAAGT,OAAO;EAEnCD,GAAG,CAACW,MAAM,CAACC,IAAI,CAAC,8BAA8B,EAAE,CAAC;IAAEC;EAAU,CAAC,KAAKA,SAAS,CAACH,UAAU,CAAC,CAAC;EAEzF,OAAO;IACLI,IAAI,EAAEnB,WAAW;IACjBoB,OAAO,EAAErB,GAAG,CAACqB;EACf,CAAC;AACH;AAEAhB,IAAI,CAACiB,UAAU,GAAGrB,WAAW;AAE7B,eAAeI,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-menu-items-resolver.js","names":["menuHandler","getMenuItemsResolver","app","addItem","addSection","getAll","events","emitAsync"],"sources":["../../src/utils/get-menu-items-resolver.js"],"sourcesContent":["import menuHandler from './menu-handler';\n\nexport default function getMenuItemsResolver(app) {\n return async () => {\n const { addItem, addSection, getAll } = menuHandler();\n await app.events.emitAsync('load:menu-section', addSection);\n await app.events.emitAsync('load:menu-items', addItem);\n return getAll();\n };\n}\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,gBAAgB;AAExC,eAAe,SAASC,oBAAoBA,CAACC,GAAG,EAAE;EAChD,OAAO,YAAY;IACjB,MAAM;MAAEC,OAAO;MAAEC,UAAU;MAAEC;IAAO,CAAC,GAAGL,WAAW,EAAE;IACrD,MAAME,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,mBAAmB,EAAEH,UAAU,CAAC;IAC3D,MAAMF,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,iBAAiB,EAAEJ,OAAO,CAAC;IACtD,OAAOE,MAAM,EAAE;EACjB,CAAC;AACH"}
1
+ {"version":3,"file":"get-menu-items-resolver.js","names":["menuHandler","getMenuItemsResolver","app","addItem","addSection","getAll","events","emitAsync"],"sources":["../../src/utils/get-menu-items-resolver.js"],"sourcesContent":["import menuHandler from './menu-handler';\n\nexport default function getMenuItemsResolver(app) {\n return async () => {\n const { addItem, addSection, getAll } = menuHandler();\n await app.events.emitAsync('load:menu-section', addSection);\n await app.events.emitAsync('load:menu-items', addItem);\n return getAll();\n };\n}\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,gBAAgB;AAExC,eAAe,SAASC,oBAAoBA,CAACC,GAAG,EAAE;EAChD,OAAO,YAAY;IACjB,MAAM;MAAEC,OAAO;MAAEC,UAAU;MAAEC;IAAO,CAAC,GAAGL,WAAW,CAAC,CAAC;IACrD,MAAME,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,mBAAmB,EAAEH,UAAU,CAAC;IAC3D,MAAMF,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,iBAAiB,EAAEJ,OAAO,CAAC;IACtD,OAAOE,MAAM,CAAC,CAAC;EACjB,CAAC;AACH"}
@@ -0,0 +1,55 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import merge from 'lodash.merge';
3
+ let instance;
4
+ export class MenuHandler {
5
+ constructor(app) {
6
+ _defineProperty(this, "menuSections", new Map());
7
+ _defineProperty(this, "menuConfig", void 0);
8
+ _defineProperty(this, "app", void 0);
9
+ if (instance) {
10
+ throw new Error('You can only create one instance!');
11
+ }
12
+ instance = this;
13
+ this.menuConfig = {};
14
+ this.app = null;
15
+ }
16
+ setApp(app) {
17
+ this.app = app;
18
+ }
19
+ get app() {
20
+ return this.app;
21
+ }
22
+ get menuConfig() {
23
+ return this.menuConfig;
24
+ }
25
+ addConfig(newConfig) {
26
+ this.menuConfig = merge(this.menuConfig, newConfig);
27
+ }
28
+ async loadConfig() {
29
+ const addConfig = newConfig => {
30
+ this.addConfig(newConfig);
31
+ };
32
+ const {
33
+ menuConfig
34
+ } = this;
35
+ if (this.app && this.app.events) {
36
+ await this.app.events.emitAsync('admin:menu:config:load', {
37
+ addConfig
38
+ });
39
+ await this.app.events.emitAsync('admin:menu:config:load:after', {
40
+ addConfig,
41
+ menuConfig
42
+ });
43
+ }
44
+ }
45
+ getInstance() {
46
+ return this;
47
+ }
48
+ getAll() {
49
+ const sortedByOrder = Object.entries(this.menuConfig).sort((a, b) => a.order > b.order ? 1 : -1);
50
+ return sortedByOrder;
51
+ }
52
+ }
53
+ const menuHandler = new MenuHandler();
54
+ export default menuHandler;
55
+ //# sourceMappingURL=menu-handler-singleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-handler-singleton.js","names":["merge","instance","MenuHandler","constructor","app","_defineProperty","Map","Error","menuConfig","setApp","addConfig","newConfig","loadConfig","events","emitAsync","getInstance","getAll","sortedByOrder","Object","entries","sort","a","b","order","menuHandler"],"sources":["../../src/utils/menu-handler-singleton.js"],"sourcesContent":["import merge from 'lodash.merge';\n\nlet instance;\n\nexport class MenuHandler {\n menuSections = new Map();\n\n menuConfig;\n\n app;\n\n constructor(app) {\n if (instance) {\n throw new Error('You can only create one instance!');\n }\n instance = this;\n this.menuConfig = {};\n this.app = null;\n }\n\n setApp(app) {\n this.app = app;\n }\n\n get app() {\n return this.app;\n }\n\n get menuConfig() {\n return this.menuConfig;\n }\n\n addConfig(newConfig) {\n this.menuConfig = merge(this.menuConfig, newConfig);\n }\n\n async loadConfig() {\n const addConfig = newConfig => {\n this.addConfig(newConfig);\n };\n\n const { menuConfig } = this;\n\n if (this.app && this.app.events) {\n await this.app.events.emitAsync('admin:menu:config:load', { addConfig });\n await this.app.events.emitAsync('admin:menu:config:load:after', { addConfig, menuConfig });\n }\n }\n\n getInstance() {\n return this;\n }\n\n getAll() {\n const sortedByOrder = Object.entries(this.menuConfig).sort(\n (a, b) => (a.order > b.order ? 1 : -1)\n );\n\n return sortedByOrder;\n }\n}\n\nconst menuHandler = new MenuHandler();\nexport default menuHandler;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,cAAc;AAEhC,IAAIC,QAAQ;AAEZ,OAAO,MAAMC,WAAW,CAAC;EAOvBC,WAAWA,CAACC,GAAG,EAAE;IAAAC,eAAA,uBANF,IAAI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AMD,CAAC,CAACE,KAAK,GAAGD,CAAC,CAACC,KAAK,GAAG,CAAC,GAAG,CAAC,CACtC,CAAC;IAED,OAAON,aAAa;EACtB;AACF;AAEA,MAAMO,WAAW,GAAG,IAAItB,WAAW,CAAC,CAAC;AACrC,eAAesB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu-handler.js","names":["menuHandler","menuSections","Map","getSection","key","get","getAll","Array","from","entries","sort","order","order1","order2","addSection","header","validateSection","section","items","set","addItem","item","sectionKey","validateItem","push","has","Error","some","_","_order"],"sources":["../../src/utils/menu-handler.js"],"sourcesContent":["export default function menuHandler() {\n const menuSections = new Map();\n\n function getSection(key) {\n return menuSections.get(key);\n }\n\n function getAll() {\n return Array.from(menuSections.entries()).sort(\n ([, { order: order1 }], [, { order: order2 }]) => (order1 > order2 ? 1 : -1)\n );\n }\n\n function addSection(key, { header, order }) {\n validateSection(key, order);\n const section = {\n header,\n order,\n items: []\n };\n menuSections.set(key, section);\n }\n\n function addItem(item, sectionKey) {\n validateItem(sectionKey);\n const section = menuSections.get(sectionKey);\n section.items.push(item);\n }\n\n function validateItem(key) {\n if (!menuSections.has(key)) throw new Error(`Section ${key} doesn\\'t exist`);\n }\n\n function validateSection(key, order) {\n if (!key) throw new Error('Section requires a key');\n if (menuSections.has(key)) throw new Error(`Section with ${key} has been already added`);\n if (Array.from(menuSections.entries()).some(([_, { order: _order }]) => _order === order)) {\n throw new Error('Section with this order has already been added');\n }\n }\n\n return {\n addSection,\n addItem,\n getSection,\n getAll\n };\n}\n"],"mappings":"AAAA,eAAe,SAASA,WAAWA,CAAA,EAAG;EACpC,MAAMC,YAAY,GAAG,IAAIC,GAAG,EAAE;EAE9B,SAASC,UAAUA,CAACC,GAAG,EAAE;IACvB,OAAOH,YAAY,CAACI,GAAG,CAACD,GAAG,CAAC;EAC9B;EAEA,SAASE,MAAMA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAACP,YAAY,CAACQ,OAAO,EAA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A,MAAM,KAAKlB,KAAK,CAAC,EAAE;MACzF,MAAM,IAAIe,KAAK,CAAC,gDAAgD,CAAC;IACnE;EACF;EAEA,OAAO;IACLZ,UAAU;IACVM,OAAO;IACPjB,UAAU;IACVG;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"menu-handler.js","names":["menuHandler","menuSections","Map","getSection","key","get","getAll","Array","from","entries","sort","order","order1","order2","addSection","header","validateSection","section","items","set","addItem","item","sectionKey","validateItem","push","has","Error","some","_","_order"],"sources":["../../src/utils/menu-handler.js"],"sourcesContent":["export default function menuHandler() {\n const menuSections = new Map();\n\n function getSection(key) {\n return menuSections.get(key);\n }\n\n function getAll() {\n return Array.from(menuSections.entries()).sort(\n ([, { order: order1 }], [, { order: order2 }]) => (order1 > order2 ? 1 : -1)\n );\n }\n\n function addSection(key, { header, order }) {\n validateSection(key, order);\n const section = {\n header,\n order,\n items: []\n };\n menuSections.set(key, section);\n }\n\n function addItem(item, sectionKey) {\n validateItem(sectionKey);\n const section = menuSections.get(sectionKey);\n section.items.push(item);\n }\n\n function validateItem(key) {\n if (!menuSections.has(key)) throw new Error(`Section ${key} doesn\\'t exist`);\n }\n\n function validateSection(key, order) {\n if (!key) throw new Error('Section requires a key');\n if (menuSections.has(key)) throw new Error(`Section with ${key} has been already added`);\n if (Array.from(menuSections.entries()).some(([_, { order: _order }]) => _order === order)) {\n throw new Error('Section with this order has already been added');\n }\n }\n\n return {\n addSection,\n addItem,\n getSection,\n getAll\n };\n}\n"],"mappings":"AAAA,eAAe,SAASA,WAAWA,CAAA,EAAG;EACpC,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAC,CAAC;EAE9B,SAASC,UAAUA,CAACC,GAAG,EAAE;IACvB,OAAOH,YAAY,CAACI,GAAG,CAACD,GAAG,CAAC;EAC9B;EAEA,SAASE,MAAMA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAACP,YAAY,CAACQ,OAAO,CAAC,CAAC,CAAC,CAACC,IAAI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lB,KAAK,CAAC,EAAE;MACzF,MAAM,IAAIe,KAAK,CAAC,gDAAgD,CAAC;IACnE;EACF;EAEA,OAAO;IACLZ,UAAU;IACVM,OAAO;IACPjB,UAAU;IACVG;EACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/plugin-admin-core-ui",
3
- "version": "0.129.0-admin-updates.2",
3
+ "version": "0.129.0-project-admin-customisations.0",
4
4
  "description": "Blaze plugin admin core ui",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "license": "GPL-3.0",
29
29
  "dependencies": {
30
- "@blaze-cms/admin-ui-styles": "0.129.0-admin-updates.1",
31
- "@blaze-cms/admin-ui-utils": "0.129.0-admin-updates.2",
32
- "@blaze-cms/core-ui": "0.129.0-admin-updates.2",
33
- "@blaze-cms/plugin-search-ui": "0.129.0-admin-updates.2",
34
- "@blaze-cms/setup-ui": "0.129.0-admin-updates.0",
30
+ "@blaze-cms/admin-ui-styles": "0.129.0-project-admin-customisations.0",
31
+ "@blaze-cms/admin-ui-utils": "0.129.0-project-admin-customisations.0",
32
+ "@blaze-cms/core-ui": "0.129.0-project-admin-customisations.0",
33
+ "@blaze-cms/plugin-search-ui": "0.129.0-project-admin-customisations.0",
34
+ "@blaze-cms/setup-ui": "0.129.0-project-admin-customisations.0",
35
35
  "@blaze-react/avatar": "0.5.19",
36
36
  "@blaze-react/button": "0.5.19",
37
37
  "@blaze-react/input": "0.5.30",
@@ -47,12 +47,13 @@
47
47
  "react-router-dom": "^5.0.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@blaze-cms/plugin-auth-ui": "0.129.0-admin-updates.2",
50
+ "@blaze-cms/plugin-auth-ui": "0.129.0-project-admin-customisations.0",
51
+ "lodash.merge": "^4.6.2",
51
52
  "waait": "1.0.5"
52
53
  },
53
54
  "eslintIgnore": [
54
55
  "lib/*",
55
56
  "lib-es/*"
56
57
  ],
57
- "gitHead": "70a1f2e5150cbcc3c9351ae5bfdc6315edff87cb"
58
+ "gitHead": "e277f858e06d9e30c22e355ea5b44132ef5e910c"
58
59
  }
@@ -1,56 +1,13 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useApolloClient } from '@apollo/client';
4
- import { getQuery, MainContextProvider } from '@blaze-cms/admin-ui-utils';
5
3
  import SideBar from '../../../SideBar';
6
4
 
7
- const Grid = ({ children, isOpenMenu, onMenuClick, userData }) => {
8
- const [menuItems, setMenuItems] = useState(null);
9
- const client = useApolloClient();
10
-
11
- useEffect(
12
- () => {
13
- (async () => {
14
- const {
15
- data: { getMenuItems }
16
- } = await client.query({ query: getQuery('GET_MENU_ITEMS') });
17
-
18
- const parsedMenuItems = getMenuItems.map(([key, { header, items }]) => [
19
- key,
20
- {
21
- header,
22
- items: items.map(item => ({ ...item, isDisplayedPrompt: true }))
23
- }
24
- ]);
25
-
26
- if (!menuItems) {
27
- setMenuItems(parsedMenuItems);
28
- }
29
- })();
30
- },
31
- [client, menuItems]
32
- );
33
-
34
- const updateItems = items => {
35
- setMenuItems(items);
36
- };
37
-
38
- return menuItems ? (
39
- <MainContextProvider value={{ menuItems, setMenuItems: items => updateItems(items) }}>
40
- <div className="main-content grid grid--main-content">
41
- <SideBar
42
- isOpenMenu={isOpenMenu}
43
- menuItems={menuItems}
44
- onMenuClick={onMenuClick}
45
- userData={userData}
46
- />
47
- <div className="grid--main-content-wrapper">{children}</div>
48
- </div>
49
- </MainContextProvider>
50
- ) : (
51
- 'loading'
52
- );
53
- };
5
+ const Grid = ({ children, isOpenMenu, onMenuClick, userData }) => (
6
+ <div className="main-content grid grid--main-content">
7
+ <SideBar isOpenMenu={isOpenMenu} onMenuClick={onMenuClick} userData={userData} />
8
+ {children}
9
+ </div>
10
+ );
54
11
 
55
12
  Grid.propTypes = {
56
13
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ const ChevronDown = () => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ fill="none"
7
+ viewBox="0 0 24 24"
8
+ strokeWidth={1.5}
9
+ width="20"
10
+ height="20"
11
+ stroke="currentColor">
12
+ <path strokeLinecap="round" strokeLinejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
13
+ </svg>
14
+ );
15
+
16
+ export default ChevronDown;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ const ChevronUp = () => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ fill="none"
7
+ viewBox="0 0 22 22"
8
+ strokeWidth={1.5}
9
+ width="20"
10
+ height="20"
11
+ stroke="currentColor">
12
+ <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 15.75l7.5-7.5 7.5 7.5" />
13
+ </svg>
14
+ );
15
+
16
+ export default ChevronUp;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+
4
+ const MenuActionItem = ({ item }) => {
5
+ const { label, icon: MenuSectionIcon, onClick, uri } = item;
6
+
7
+ const modifier = MenuSectionIcon ? '' : 'side-nav__list-link--noIcon';
8
+
9
+ return (
10
+ <li className="side-nav__list--item" key={item.label}>
11
+ <Link
12
+ to={uri}
13
+ className={`side-nav__list-link ${modifier}`}
14
+ onClick={() => {
15
+ if (onClick) {
16
+ onClick();
17
+ }
18
+ }}>
19
+ {MenuSectionIcon && (
20
+ <div className="side-nav__list-link--icon">
21
+ <MenuSectionIcon />
22
+ </div>
23
+ )}
24
+ <div className="side-nav__list-label">{label}</div>
25
+ </Link>
26
+ </li>
27
+ );
28
+ };
29
+
30
+ export default MenuActionItem;