@uxf/cms 10.0.0-beta.36 → 10.0.0-beta.38

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.
@@ -29,7 +29,7 @@ const menu_1 = require("../menu");
29
29
  const styles_1 = require("./styles");
30
30
  const user_menu_1 = require("../menu/ui/user-menu");
31
31
  const mobile_bar_1 = require("../menu/mobile-bar");
32
- const useOnMount_1 = require("@uxf/core/hooks/useOnMount");
32
+ const tw_screens_1 = require("../../ui/tw-tokens/tw-screens");
33
33
  const uxfLogo = (react_1.default.createElement("svg", { width: "134", height: "30", viewBox: "0 0 179 40" },
34
34
  react_1.default.createElement("path", { fill: "#FFF", fillRule: "evenodd", d: "M33.563 12.874a9.103 9.103 0 0 0 0-12.874L20.69 12.874l.107.105a9.103 9.103 0 0 0 12.766-.105Zm-20.69-6.437a9.103 9.103 0 0 1 .106 12.766l-.105.107L0 6.437a9.103 9.103 0 0 1 12.874 0ZM40 33.563 27.127 20.69l-.106.107a9.103 9.103 0 0 0 12.98 12.766Zm-20.69-6.437-.107-.105A9.103 9.103 0 0 0 6.437 40l12.874-12.874Z", clipRule: "evenodd" }),
35
35
  react_1.default.createElement("path", { fill: "#FFF", fillRule: "evenodd", d: "m84.325 7.295 5.133 8.675h.199l5.158-8.675h6.078l-7.768 12.727 7.942 12.727h-6.19l-5.22-8.687h-.199l-5.22 8.687h-6.165l7.967-12.727-7.818-12.727h6.103Zm-24.194 0v16.07c0 .97.214 1.832.64 2.586a4.58 4.58 0 0 0 1.809 1.777c.779.431 1.686.647 2.722.647 1.044 0 1.953-.216 2.728-.647a4.591 4.591 0 0 0 1.802-1.777c.427-.754.64-1.616.64-2.585V7.296h5.382v16.53c0 1.856-.441 3.48-1.324 4.872-.882 1.392-2.115 2.475-3.697 3.25-1.583.775-3.426 1.162-5.531 1.162-2.113 0-3.96-.387-5.543-1.162-1.583-.775-2.813-1.858-3.692-3.25-.878-1.392-1.317-3.016-1.317-4.872V7.296h5.381ZM170.25 13.41c2.411 0 4.311.51 5.698 1.529 1.388 1.019 2.198 2.407 2.43 4.164l-4.847.298a2.555 2.555 0 0 0-.534-1.125 2.942 2.942 0 0 0-1.075-.808c-.444-.203-.972-.304-1.585-.304-.821 0-1.512.172-2.076.515-.563.344-.845.802-.845 1.374 0 .456.182.84.547 1.156.364.315.99.567 1.877.758l3.455.696c1.856.381 3.24.994 4.151 1.84.912.845 1.367 1.955 1.367 3.33 0 1.252-.366 2.35-1.1 3.294-.733.945-1.736 1.68-3.007 2.206-1.272.526-2.737.79-4.394.79-2.527 0-4.539-.529-6.034-1.585-1.496-1.057-2.372-2.496-2.629-4.32l5.208-.273c.157.77.538 1.357 1.143 1.759.605.402 1.38.603 2.324.603.928 0 1.676-.18 2.244-.54.567-.361.855-.827.864-1.4-.009-.48-.212-.875-.609-1.186-.398-.31-1.011-.55-1.84-.715l-3.306-.659c-1.864-.372-3.25-1.019-4.157-1.938-.908-.92-1.361-2.093-1.361-3.518 0-1.226.333-2.283 1-3.17.667-.886 1.608-1.57 2.821-2.05 1.214-.48 2.637-.72 4.27-.72Zm-36.686.373a12.285 12.285 0 0 0-3.051-.373c-1.525 0-2.865.23-4.021.69-1.156.46-2.098 1.114-2.827 1.964-.73.849-1.219 1.854-1.467 3.014l4.897.397c.182-.63.555-1.153 1.119-1.572.563-.418 1.321-.627 2.274-.627.903 0 1.601.215 2.094.646.493.43.74 1.04.74 1.827v.075c0 .405-.153.712-.46.92-.307.206-.8.362-1.479.465-.68.104-1.574.214-2.685.33-.944.09-1.845.248-2.703.472a7.698 7.698 0 0 0-2.293.994 4.727 4.727 0 0 0-1.591 1.74c-.39.721-.584 1.612-.584 2.673 0 1.259.275 2.31.826 3.15a5.147 5.147 0 0 0 2.256 1.902c.953.427 2.038.64 3.257.64.944 0 1.777-.126 2.498-.38a5.55 5.55 0 0 0 1.852-1.055 5.31 5.31 0 0 0 1.23-1.573h.149v2.648h5.022V19.873c0-1.135-.22-2.11-.659-2.927a5.655 5.655 0 0 0-1.796-2.007 8.039 8.039 0 0 0-2.598-1.156Zm-13.424-2.05V7.294h-16.853v25.454h5.381V22.235h10.354v-4.438h-10.354v-6.065h11.472Zm32.603 1.677c1.326 0 2.482.29 3.468.87.986.58 1.753 1.407 2.3 2.48.546 1.073.82 2.35.82 3.834V32.75h-5.295V21.539c.008-1.169-.29-2.082-.895-2.74-.605-.66-1.437-.989-2.498-.989-.713 0-1.34.153-1.883.46a3.166 3.166 0 0 0-1.268 1.336c-.302.584-.458 1.286-.466 2.107V32.75h-5.295V13.659h5.047v3.368H147a5.358 5.358 0 0 1 2.126-2.641c.994-.65 2.2-.976 3.616-.976Zm-20.061 10.782c.286-.087.512-.184.678-.292v2.026c0 .671-.17 1.272-.51 1.802-.34.53-.808.951-1.404 1.262-.597.31-1.285.466-2.064.466-.812 0-1.481-.189-2.007-.566-.526-.377-.789-.925-.789-1.646 0-.497.128-.914.385-1.25.257-.335.617-.602 1.082-.801a6.547 6.547 0 0 1 1.628-.435l.969-.143a24.15 24.15 0 0 0 1.069-.186c.356-.071.677-.15.963-.237Z", clipRule: "evenodd" })));
@@ -38,22 +38,37 @@ const Sidebar = (props) => {
38
38
  const [deviceHeight, setDeviceHeight] = (0, react_1.useState)(0);
39
39
  const [isMenuOpen, setIsMenuOpen] = (0, react_1.useState)(false);
40
40
  const toggleMenu = () => setIsMenuOpen((prev) => !prev);
41
- (0, useOnMount_1.useOnMount)(() => {
42
- const handleDeviceHeight = () => {
43
- var _a, _b;
44
- setDeviceHeight((_b = (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : window.innerHeight);
41
+ (0, react_1.useEffect)(() => {
42
+ const handler = () => { var _a, _b; return setDeviceHeight((_b = (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : window.innerHeight); };
43
+ handler();
44
+ window.addEventListener("resize", handler);
45
+ return () => {
46
+ window.removeEventListener("resize", handler);
47
+ };
48
+ }, []);
49
+ (0, react_1.useEffect)(() => {
50
+ const handler = () => {
51
+ if (!window.matchMedia(`(min-width: ${tw_screens_1.twScreens.md})`).matches && isMenuOpen) {
52
+ document.body.style.overflow = "hidden";
53
+ }
54
+ else {
55
+ document.body.style.overflow = "";
56
+ }
45
57
  };
46
- handleDeviceHeight();
47
- window.addEventListener("resize", handleDeviceHeight);
58
+ handler();
59
+ window.addEventListener("resize", handler);
48
60
  return () => {
49
- window.removeEventListener("resize", handleDeviceHeight);
61
+ document.body.style.overflow = "";
62
+ window.removeEventListener("resize", handler);
50
63
  };
51
- });
64
+ }, [isMenuOpen]);
52
65
  return ((_a = props.CustomSidebar) !== null && _a !== void 0 ? _a : (react_1.default.createElement("div", { className: "uxf-cms-sidebar", style: { "--drawer-width": `${styles_1.drawerWidth}px` } },
53
66
  react_1.default.createElement("div", { className: `uxf-cms-sidebar__content ${isMenuOpen ? "uxf-cms-sidebar__content--open" : "uxf-cms-sidebar__content--closed"}`, style: { "--device-height": `${deviceHeight}px` } },
54
67
  react_1.default.createElement("div", { className: "uxf-cms-sidebar__logo" }, (_b = props.Logo) !== null && _b !== void 0 ? _b : uxfLogo),
55
68
  props.menuConfiguration && props.menuConfiguration.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null,
56
- react_1.default.createElement("div", { className: `uxf-cms-sidebar__nav ${props.menuConfiguration[0].type === "super-section" ? "mt-4" : "mt-8"}` },
69
+ react_1.default.createElement("div", { className: `uxf-cms-sidebar__nav ${props.menuConfiguration[0].type === "super-section"
70
+ ? "uxf-cms-sidebar__nav--super-section"
71
+ : ""}` },
57
72
  react_1.default.createElement(menu_1.Menu, { menu: props.menuConfiguration })),
58
73
  react_1.default.createElement(user_menu_1.UserMenu, { menu: props.menuConfiguration })))),
59
74
  props.menuConfiguration && (react_1.default.createElement(mobile_bar_1.MobileBar, { menuConfiguration: props.menuConfiguration, toggleMenu: toggleMenu })))));
@@ -12,6 +12,6 @@ const MenuCustomItem = (props) => {
12
12
  if (!props.item.isVisible(loggedUser)) {
13
13
  return null;
14
14
  }
15
- return react_1.default.createElement("div", null, props.item.content);
15
+ return react_1.default.createElement("div", { className: "uxf-cms-menu__item-wrapper uxf-cms-menu__item-wrapper--custom" }, props.item.content);
16
16
  };
17
17
  exports.MenuCustomItem = MenuCustomItem;
@@ -45,9 +45,9 @@ const MenuItem = (props) => {
45
45
  (props.item.children.length !== 0 && !props.item.hasVisibleChildren(loggedUser))) {
46
46
  return null;
47
47
  }
48
- return (react_1.default.createElement(react_1.default.Fragment, null,
48
+ return (react_1.default.createElement("div", { className: "uxf-cms-menu__item-wrapper uxf-cms-menu__item-wrapper--basic" },
49
49
  react_1.default.createElement(list_item_1.ListItem, { label: props.item.title, icon: props.item.icon, href: (_a = props.item.url) !== null && _a !== void 0 ? _a : firstVisibleChild === null || firstVisibleChild === void 0 ? void 0 : firstVisibleChild.url, route: (_b = props.item.route) !== null && _b !== void 0 ? _b : firstVisibleChild === null || firstVisibleChild === void 0 ? void 0 : firstVisibleChild.route, params: (_d = (_c = props.item.routeParams) !== null && _c !== void 0 ? _c : firstVisibleChild === null || firstVisibleChild === void 0 ? void 0 : firstVisibleChild.routeParams) !== null && _d !== void 0 ? _d : null, selected: isActive, subMenu: props.item.children, isOpen: isSubmenuOpen, toggle: toggle, isInitiallyOpen: isInitiallyOpen, isExternal: props.item.isExternal }),
50
- isSubmenuOpen && (react_1.default.createElement("div", null, visibleChildren.map((i) => {
50
+ isSubmenuOpen && (react_1.default.createElement("div", { className: "uxf-cms-menu__submenu-list" }, visibleChildren.map((i) => {
51
51
  const isSelected = i.isActive(router, activeRoute);
52
52
  return (react_1.default.createElement(list_item_1.ListItem, { key: i.title, label: i.title, href: i.url, icon: i.icon, route: i.route, params: i.routeParams, level: 1, selected: isSelected, isExternal: i.isExternal }));
53
53
  })))));
@@ -31,7 +31,7 @@ const menu_custom_item_1 = require("./menu-custom-item");
31
31
  const MenuSuperSectionItem = (props) => {
32
32
  const useLoggedUser = config_1.container.get("useLoggedUser");
33
33
  const loggedUser = useLoggedUser();
34
- return (react_1.default.createElement("div", { className: props.item.userMenuData ? "md:hidden" : undefined },
34
+ return (react_1.default.createElement("div", { className: `uxf-cms-menu__item-wrapper uxf-cms-menu__item-wrapper--super ${props.item.userMenuData ? "uxf-cms-menu__item-wrapper--user-menu" : ""}` },
35
35
  props.item.isVisible(loggedUser) && (react_1.default.createElement("p", { className: "uxf-cms-menu__item uxf-cms-menu__item--super" }, props.item.title)),
36
36
  props.item.children.map((i, index) => (react_1.default.createElement(react_1.Fragment, { key: index },
37
37
  i.type === "custom" && react_1.default.createElement(menu_custom_item_1.MenuCustomItem, { item: i }),
@@ -7,7 +7,7 @@ function useSubMenu(options) {
7
7
  const [open, setOpen] = (0, react_1.useState)(false);
8
8
  const data = (0, react_2.useFloating)({
9
9
  middleware: [
10
- (0, react_2.offset)(options.isMobile ? 24 : 16),
10
+ (0, react_2.offset)(options.isMobile ? 12 : 16),
11
11
  (0, react_2.flip)(),
12
12
  (0, react_2.shift)({ padding: 8 }),
13
13
  (0, react_2.size)({
@@ -33,7 +33,7 @@ const Component = (props) => {
33
33
  const [isSubmenuOpen, setIsSubmenuOpen] = (0, react_1.useState)(false);
34
34
  const hasSubmenu = props.submenu.length > 0;
35
35
  const toggle = hasSubmenu ? () => setIsSubmenuOpen((prev) => !prev) : undefined;
36
- return (react_1.default.createElement("div", { className: "uxf-cms-user-menu" },
36
+ return (react_1.default.createElement("div", { className: `uxf-cms-user-menu ${isSubmenuOpen ? classes_1.CLASSES.IS_OPEN : ""}` },
37
37
  react_1.default.createElement("button", { className: "uxf-cms-user-menu__button", onClick: toggle },
38
38
  react_1.default.createElement(avatar_1.Avatar, { className: "uxf-cms-user-menu__avatar", src: props.avatar }),
39
39
  react_1.default.createElement("div", { className: "uxf-cms-user-menu__label-wrapper" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/cms",
3
- "version": "10.0.0-beta.36",
3
+ "version": "10.0.0-beta.38",
4
4
  "description": "UXF Cms",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/cms#readme",
@@ -40,13 +40,13 @@
40
40
  "@types/qs": "^6.9.7",
41
41
  "@types/react": "18.2.6",
42
42
  "@types/react-dom": "18.2.4",
43
- "@uxf/core": "10.0.0-beta.35",
44
- "@uxf/data-grid": "10.0.0-beta.36",
45
- "@uxf/form": "10.0.0-beta.35",
43
+ "@uxf/core": "10.0.0-beta.37",
44
+ "@uxf/data-grid": "10.0.0-beta.38",
45
+ "@uxf/form": "10.0.0-beta.38",
46
46
  "@uxf/icons-generator": "10.0.0-beta.19",
47
47
  "@uxf/router": "10.0.0-beta.15",
48
- "@uxf/ui": "10.0.0-beta.35",
49
- "@uxf/wysiwyg": "10.0.0-beta.35",
48
+ "@uxf/ui": "10.0.0-beta.38",
49
+ "@uxf/wysiwyg": "10.0.0-beta.38",
50
50
  "axios": "^1.4.0",
51
51
  "axios-hooks": "^4.0.0",
52
52
  "coordinate-parser": "1.0.7",
@@ -58,11 +58,11 @@
58
58
  "react-dom": "^18.2.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "@uxf/core": "10.0.0-beta.35",
62
- "@uxf/data-grid": "10.0.0-beta.36",
63
- "@uxf/form": "10.0.0-beta.35",
64
- "@uxf/ui": "10.0.0-beta.35",
65
- "@uxf/wysiwyg": "10.0.0-beta.35",
61
+ "@uxf/core": "10.0.0-beta.37",
62
+ "@uxf/data-grid": "10.0.0-beta.38",
63
+ "@uxf/form": "10.0.0-beta.38",
64
+ "@uxf/ui": "10.0.0-beta.38",
65
+ "@uxf/wysiwyg": "10.0.0-beta.38",
66
66
  "axios": "^1.4.0",
67
67
  "axios-hooks": "^4.0.0",
68
68
  "dayjs": "^1.11.7",
@@ -2,6 +2,22 @@
2
2
  background-color: theme('colors.sidebar.background');
3
3
  padding: 0 theme('spacing.2') theme('spacing.4');
4
4
 
5
+ &__item-wrapper {
6
+ &--super {
7
+ &:first-child {
8
+ & > .uxf-cms-menu__item--super {
9
+ margin-top: 0;
10
+ }
11
+ }
12
+ }
13
+
14
+ &--user-menu {
15
+ @media screen(md) {
16
+ display: none;
17
+ }
18
+ }
19
+ }
20
+
5
21
  &__item {
6
22
  &--super {
7
23
  @apply uxf-typo-overline;
@@ -52,6 +68,10 @@
52
68
  }
53
69
  }
54
70
 
71
+ &__icon-wrapper {
72
+ flex-shrink: 0;
73
+ }
74
+
55
75
  &__submenu-button {
56
76
  width: 100%;
57
77
 
@@ -70,20 +90,24 @@
70
90
  }
71
91
 
72
92
  .uxf-cms-user-menu {
93
+ border-top: 1px solid theme('colors.darkBorder');
73
94
  color: theme('colors.darkMedium');
74
95
  display: none;
75
- padding: theme('spacing.3') theme('spacing.5') theme('spacing.3') theme('spacing.3');
76
96
 
77
- :root .light & {
78
- border-top: 1px solid theme('colors.darkLow/10');
97
+ @media screen(md) {
98
+ display: block;
79
99
  }
80
100
 
81
- :root .dark & {
82
- border-top: 1px solid theme('colors.gray.700/10');
83
- }
101
+ &.is-open {
102
+ background-color: theme('colors.sidebar.hover');
84
103
 
85
- @media screen(md) {
86
- display: block;
104
+ .uxf-cms-menu__item {
105
+ background-color: theme('colors.sidebar.hover');
106
+
107
+ &:hover {
108
+ background-color: theme('colors.sidebar.background');
109
+ }
110
+ }
87
111
  }
88
112
 
89
113
  &__button {
@@ -91,11 +115,18 @@
91
115
  display: flex;
92
116
  text-align: left;
93
117
  width: 100%;
118
+ padding: theme("spacing.3") theme("spacing.4");
119
+
120
+ &:hover {
121
+ background-color: theme('colors.sidebar.hover');
122
+ }
94
123
  }
95
124
 
96
125
  &__avatar {
97
126
  flex-shrink: 0;
127
+ height: 32px;
98
128
  margin-right: theme('spacing.3');
129
+ width: 32px;
99
130
  }
100
131
 
101
132
  &__label-wrapper {
@@ -104,8 +135,6 @@
104
135
 
105
136
  &__name {
106
137
  @apply uxf-typo-body2;
107
-
108
- margin-bottom: theme('spacing.1');
109
138
  }
110
139
 
111
140
  &__roles {
@@ -127,7 +156,7 @@
127
156
  }
128
157
 
129
158
  &__sub-menu {
130
- margin-top: theme('spacing.4');
159
+ padding: 0 theme("spacing.3") theme("spacing.4");
131
160
  }
132
161
  }
133
162
 
@@ -1,13 +1,12 @@
1
1
  .uxf-cms-mobile-bar {
2
2
  align-items: center;
3
- background-color: theme('colors.sidebar.background');
4
- border-top: 1px solid theme('colors.gray.700');
3
+ background-color: theme("colors.sidebar.background");
5
4
  bottom: 0;
6
- color: theme('colors.darkMedium');
5
+ color: theme("colors.darkMedium");
7
6
  display: flex;
8
- height: theme('spacing.16');
7
+ height: 52px;
9
8
  left: 0;
10
- padding: 0 theme('spacing.1');
9
+ padding: 0 theme("spacing.1");
11
10
  position: fixed;
12
11
  right: 0;
13
12
 
@@ -20,16 +19,16 @@
20
19
  display: flex;
21
20
  flex-grow: 1;
22
21
  flex-shrink: 0;
23
- height: theme('spacing.10');
22
+ height: theme("spacing.11");
24
23
  justify-content: center;
25
24
  }
26
25
 
27
26
  &__avatar {
28
- height: theme('spacing.7');
29
- width: theme('spacing.7');
27
+ height: theme("spacing.7");
28
+ width: theme("spacing.7");
30
29
  }
31
30
 
32
31
  &__caret {
33
- margin-left: theme('spacing.1');
32
+ margin-left: theme("spacing.1");
34
33
  }
35
34
  }
@@ -5,21 +5,30 @@
5
5
  width: 100%;
6
6
  z-index: 15;
7
7
 
8
- @media screen(md) {
8
+ @screen xs {
9
+ right: 0;
9
10
  width: var(--drawer-width);
11
+ }
12
+
13
+ @screen md {
14
+ left: 0;
15
+ right: unset;
10
16
  z-index: 1;
17
+ border-bottom: none;
11
18
  }
12
19
 
13
20
  &__content {
14
- --device-height: 1000px;
21
+ --device-height: 100vh;
15
22
 
16
23
  background-color: theme("colors.sidebar.background");
24
+ border-bottom: 1px solid theme("colors.gray.700");
17
25
  flex-direction: column;
18
- height: calc(var(--device-height) - 48px);
26
+ height: calc(var(--device-height) - 52px);
19
27
  padding-top: theme("spacing.5");
20
28
 
21
29
  @media screen(md) {
22
30
  height: 100vh;
31
+ border-bottom: none;
23
32
  }
24
33
 
25
34
  &--open {
@@ -41,17 +50,21 @@
41
50
 
42
51
  &__nav {
43
52
  flex-grow: 1;
53
+ margin-top: theme("spacing.8");
44
54
  overflow: auto;
45
- padding: 0 theme("spacing.2");
55
+ padding: 0 0 theme("spacing.4");
46
56
 
47
57
  @media screen(md) {
48
- padding-left: 0;
49
- padding-right: 0;
58
+ padding: 0;
59
+ }
60
+
61
+ &--super-section {
62
+ margin-top: theme("spacing.4");
50
63
  }
51
64
 
52
65
  /* width */
53
66
  &::-webkit-scrollbar {
54
- width: 4px;
67
+ width: 8px;
55
68
  }
56
69
 
57
70
  /* Track */
@@ -62,6 +75,7 @@
62
75
  /* Handle */
63
76
  &::-webkit-scrollbar-thumb {
64
77
  background: theme("colors.sidebar.highlight");
78
+ border-radius: 999px;
65
79
  }
66
80
 
67
81
  /* Handle on hover */
@@ -87,7 +101,7 @@
87
101
 
88
102
  &::-webkit-scrollbar-thumb {
89
103
  background-color: var(--scrollbar-color);
90
- border-radius: 100%;
104
+ border-radius: 999px;
91
105
  border: none;
92
106
  }
93
107
  }