linear-react-components-ui 1.1.17 → 1.1.18-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/lib/assets/styles/sidenav.scss +10 -4
- package/lib/menus/sidenav/NavMenuGroup.d.ts +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +4 -2
- package/lib/menus/sidenav/NavMenuItem.js +13 -3
- package/lib/menus/sidenav/index.js +3 -3
- package/lib/menus/sidenav/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -8,12 +8,19 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
8
8
|
@import "colors.scss";
|
|
9
9
|
|
|
10
10
|
.sidenav-component {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
11
13
|
height: 100%;
|
|
12
14
|
width: 100%;
|
|
13
15
|
overflow: hidden;
|
|
14
16
|
background-color: transparent;
|
|
15
17
|
border: 1px solid #eee;
|
|
16
18
|
|
|
19
|
+
&.-expanded {
|
|
20
|
+
display: block;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
&.-blocked {
|
|
18
25
|
opacity: 0.4;
|
|
19
26
|
pointer-events: none;
|
|
@@ -74,7 +81,6 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
74
81
|
>.expandedmenu.customscroll,
|
|
75
82
|
>.collapsedmenu.customscroll {
|
|
76
83
|
overflow-y: auto;
|
|
77
|
-
height: 100%;
|
|
78
84
|
|
|
79
85
|
&::-webkit-scrollbar {
|
|
80
86
|
width: 5px;
|
|
@@ -308,13 +314,13 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
308
314
|
width: 5px;
|
|
309
315
|
}
|
|
310
316
|
&::-webkit-scrollbar-track {
|
|
311
|
-
box-shadow: inset 0 0 5px grey;
|
|
317
|
+
box-shadow: inset 0 0 5px grey;
|
|
312
318
|
border-radius: 10px;
|
|
313
319
|
}
|
|
314
320
|
&::-webkit-scrollbar-thumb {
|
|
315
|
-
background: rgb(151, 142, 142);
|
|
321
|
+
background: rgb(151, 142, 142);
|
|
316
322
|
border-radius: 10px;
|
|
317
|
-
}
|
|
323
|
+
}
|
|
318
324
|
}
|
|
319
325
|
}
|
|
320
326
|
|
|
@@ -7,6 +7,6 @@ import '../../@types/Position.js';
|
|
|
7
7
|
import '../../@types/Icon.js';
|
|
8
8
|
import '../../icons/helper.js';
|
|
9
9
|
|
|
10
|
-
declare const NavMenuGroup: ({ children, scrollable }: INavMenuGroupProps) => JSX.Element;
|
|
10
|
+
declare const NavMenuGroup: ({ children, scrollable, style }: INavMenuGroupProps) => JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { NavMenuGroup as default };
|
|
@@ -11,14 +11,16 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
11
11
|
const NavMenuGroup = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
children,
|
|
14
|
-
scrollable
|
|
14
|
+
scrollable,
|
|
15
|
+
style
|
|
15
16
|
} = _ref;
|
|
16
17
|
const {
|
|
17
18
|
isExpanded,
|
|
18
19
|
menuSize
|
|
19
20
|
} = (0, _react.useContext)(_helpers.SideNavContext);
|
|
20
21
|
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
21
|
-
|
|
22
|
+
style: style,
|
|
23
|
+
className: "".concat(scrollable && 'customscroll', " ").concat((0, _helpers.default)(isExpanded, menuSize))
|
|
22
24
|
}, children);
|
|
23
25
|
};
|
|
24
26
|
var _default = exports.default = NavMenuGroup;
|
|
@@ -30,6 +30,7 @@ const NavMenuItem = props => {
|
|
|
30
30
|
} = props;
|
|
31
31
|
const [showSubMenu, setShowSubMenu] = (0, _react.useState)(false);
|
|
32
32
|
const [targetDimensions, setTargetDimensions] = (0, _react.useState)({});
|
|
33
|
+
const [isFinalWindow, setIsFinalWindow] = (0, _react.useState)(false);
|
|
33
34
|
const submenuContainerRef = (0, _react.useRef)(null);
|
|
34
35
|
const submenuContentRef = (0, _react.useRef)(null);
|
|
35
36
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
@@ -44,9 +45,12 @@ const NavMenuItem = props => {
|
|
|
44
45
|
disabled
|
|
45
46
|
} = onDenied;
|
|
46
47
|
const onMouseEnter = e => {
|
|
48
|
+
const windowHeight = window.innerHeight;
|
|
47
49
|
const eventTarget = e.target;
|
|
50
|
+
const position = eventTarget.getBoundingClientRect();
|
|
48
51
|
setShowSubMenu(true);
|
|
49
|
-
setTargetDimensions(
|
|
52
|
+
setTargetDimensions(position);
|
|
53
|
+
if (position.bottom >= windowHeight - 150) setIsFinalWindow(true);
|
|
50
54
|
};
|
|
51
55
|
const toggleSubMenu = () => {
|
|
52
56
|
setShowSubMenu(!showSubMenu);
|
|
@@ -58,7 +62,7 @@ const NavMenuItem = props => {
|
|
|
58
62
|
var _submenuContainerRef$, _submenuContentRef$cu, _submenuContentRef$cu2;
|
|
59
63
|
const heigthSubmenuContainer = ((_submenuContainerRef$ = submenuContainerRef.current) === null || _submenuContainerRef$ === void 0 ? void 0 : _submenuContainerRef$.clientHeight) || 0;
|
|
60
64
|
const heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
|
|
61
|
-
const maxHeigthSubMenu = (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
65
|
+
const maxHeigthSubMenu = isFinalWindow ? '100%' : (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
62
66
|
(_submenuContentRef$cu2 = submenuContentRef.current) === null || _submenuContentRef$cu2 === void 0 ? void 0 : _submenuContentRef$cu2.style.setProperty('max-height', maxHeigthSubMenu);
|
|
63
67
|
}, [showSubMenu]);
|
|
64
68
|
if (unvisible) return null;
|
|
@@ -72,6 +76,7 @@ const NavMenuItem = props => {
|
|
|
72
76
|
},
|
|
73
77
|
onMouseLeave: () => {
|
|
74
78
|
setShowSubMenu(false);
|
|
79
|
+
setIsFinalWindow(false);
|
|
75
80
|
}
|
|
76
81
|
}, /*#__PURE__*/_react.default.createElement(_MenuLink.default, _extends({
|
|
77
82
|
disabled: disabled
|
|
@@ -87,7 +92,12 @@ const NavMenuItem = props => {
|
|
|
87
92
|
}, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
|
|
88
93
|
ref: submenuContainerRef,
|
|
89
94
|
className: "submenu-container",
|
|
90
|
-
style: {
|
|
95
|
+
style: isFinalWindow ? {
|
|
96
|
+
marginLeft: targetDimensions.width,
|
|
97
|
+
bottom: '0',
|
|
98
|
+
paddingBottom: '10px',
|
|
99
|
+
position: 'fixed'
|
|
100
|
+
} : {
|
|
91
101
|
marginLeft: targetDimensions.width,
|
|
92
102
|
top: targetDimensions.top,
|
|
93
103
|
minWidth,
|
|
@@ -93,12 +93,12 @@ const SideNav = props => {
|
|
|
93
93
|
childrenProps.forEach(child => {
|
|
94
94
|
if (child) {
|
|
95
95
|
compareChild(child);
|
|
96
|
-
if (child.props.children) scanChildrenContent(child.props.children);
|
|
96
|
+
if (child.props && child.props.children) scanChildrenContent(child.props.children);
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
} else if (childrenProps) {
|
|
100
100
|
compareChild(childrenProps);
|
|
101
|
-
if (childrenProps.props.children) scanChildrenContent(childrenProps.props.children);
|
|
101
|
+
if (childrenProps.props && childrenProps.props.children) scanChildrenContent(childrenProps.props.children);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
const openSearchMenu = () => {
|
|
@@ -165,7 +165,7 @@ const SideNav = props => {
|
|
|
165
165
|
return /*#__PURE__*/_react.default.createElement(_helpers.SideNavContext.Provider, {
|
|
166
166
|
value: contextValues
|
|
167
167
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
className: "sidenav-component ".concat(openSearchMenuPopup ? '-blocked' : '', " ").concat(customClass),
|
|
168
|
+
className: "sidenav-component ".concat(isExpanded ? '-expanded' : '', " ").concat(openSearchMenuPopup ? '-blocked' : '', " ").concat(customClass),
|
|
169
169
|
ref: sideNavRef
|
|
170
170
|
}, showExpandMenu && /*#__PURE__*/_react.default.createElement(_ExpandMenu.default, {
|
|
171
171
|
expandMenuCustomClass: "".concat(isExpanded && 'closefromexpanded', " ").concat(expandMenuCustomClass),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, ReactElement,
|
|
1
|
+
import { ReactNode, ReactElement, CSSProperties, Ref } from 'react';
|
|
2
2
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
3
3
|
import { Size } from '../../@types/Size.js';
|
|
4
4
|
import { WithTooltipProps } from '../../internals/types.js';
|
|
@@ -38,6 +38,7 @@ interface IMenuLinkProps extends WithTooltipProps {
|
|
|
38
38
|
interface INavMenuGroupProps {
|
|
39
39
|
children: ReactNode;
|
|
40
40
|
scrollable?: boolean;
|
|
41
|
+
style?: CSSProperties;
|
|
41
42
|
}
|
|
42
43
|
interface INavMenuItemProps extends WithTooltipProps {
|
|
43
44
|
children?: ReactNode;
|