@topconsultnpm/sdkui-react-beta 6.10.3 → 6.10.5
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.
|
@@ -4,7 +4,6 @@ export type ITMRightSidebarItem = {
|
|
|
4
4
|
icon: any;
|
|
5
5
|
visibleName: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
primary?: boolean;
|
|
8
7
|
isActive?: boolean;
|
|
9
8
|
visible?: boolean;
|
|
10
9
|
beginGroup?: boolean;
|
|
@@ -14,7 +13,6 @@ export interface ITMRightSidebarProps {
|
|
|
14
13
|
onItemClick?: (id: string, isActive: boolean) => void;
|
|
15
14
|
selectedItem?: string;
|
|
16
15
|
showPanel?: boolean;
|
|
17
|
-
allowMultipleActive?: boolean;
|
|
18
16
|
}
|
|
19
17
|
declare const TMRightSidebar: React.FC<ITMRightSidebarProps>;
|
|
20
18
|
export default TMRightSidebar;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import styled, { keyframes } from 'styled-components';
|
|
4
4
|
import { TMColors } from '../../utils/theme';
|
|
5
|
-
const TMRightSidebar = ({ items = [], onItemClick, selectedItem, showPanel = false
|
|
5
|
+
const TMRightSidebar = ({ items = [], onItemClick, selectedItem, showPanel = false }) => {
|
|
6
6
|
const [hoveredItem, setHoveredItem] = useState(null);
|
|
7
7
|
const [activeItems, setActiveItems] = useState(new Set());
|
|
8
8
|
useEffect(() => {
|
|
@@ -10,15 +10,9 @@ const TMRightSidebar = ({ items = [], onItemClick, selectedItem, showPanel = fal
|
|
|
10
10
|
}, [items]);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (selectedItem) {
|
|
13
|
-
setActiveItems(
|
|
14
|
-
const newActiveItems = new Set(prev);
|
|
15
|
-
if (!allowMultipleActive)
|
|
16
|
-
newActiveItems.clear();
|
|
17
|
-
newActiveItems.add(selectedItem);
|
|
18
|
-
return newActiveItems;
|
|
19
|
-
});
|
|
13
|
+
setActiveItems(new Set([selectedItem]));
|
|
20
14
|
}
|
|
21
|
-
}, [selectedItem
|
|
15
|
+
}, [selectedItem]);
|
|
22
16
|
const toggleItem = (id) => {
|
|
23
17
|
setActiveItems(prev => {
|
|
24
18
|
const newActiveItems = new Set(prev);
|
|
@@ -26,8 +20,6 @@ const TMRightSidebar = ({ items = [], onItemClick, selectedItem, showPanel = fal
|
|
|
26
20
|
newActiveItems.delete(id);
|
|
27
21
|
}
|
|
28
22
|
else {
|
|
29
|
-
if (!allowMultipleActive)
|
|
30
|
-
newActiveItems.clear();
|
|
31
23
|
newActiveItems.add(id);
|
|
32
24
|
}
|
|
33
25
|
return newActiveItems;
|
|
@@ -39,7 +31,7 @@ const TMRightSidebar = ({ items = [], onItemClick, selectedItem, showPanel = fal
|
|
|
39
31
|
onItemClick && onItemClick(item.id, activeItems.has(item.id));
|
|
40
32
|
}
|
|
41
33
|
};
|
|
42
|
-
return (_jsx(SidebarContainer, { children: items.map((item, index) => (item.visible !== false && (_jsxs(StyledMenuItem, { "$disabled": item.disabled, style: { paddingTop:
|
|
34
|
+
return (_jsx(SidebarContainer, { children: items.map((item, index) => (item.visible !== false && (_jsxs(StyledMenuItem, { "$disabled": item.disabled, style: { paddingTop: '10px', borderTop: item.beginGroup ? '2px solid #9c9c9c' : 'none' }, "$isHovered": hoveredItem === item.id, "$isSelected": item.isActive, onMouseEnter: () => setHoveredItem(item.id), onMouseLeave: () => setHoveredItem(null), onClick: () => onClickHandler(item), children: [_jsx(StyledAnimatedComponentScaleColor, { "$delay": `${(index * 150) + 650}ms`, children: item.icon }), _jsx("span", { children: item.visibleName })] }, item.id)))) }));
|
|
43
35
|
};
|
|
44
36
|
export default TMRightSidebar;
|
|
45
37
|
// Styled Components
|
|
@@ -67,7 +59,7 @@ const StyledMenuItem = styled.div `
|
|
|
67
59
|
display: flex;
|
|
68
60
|
align-items: center;
|
|
69
61
|
padding: 8px 0;
|
|
70
|
-
color: ${props => !props.$disabled ? (props.$isSelected ? props.$selectedColor ??
|
|
62
|
+
color: ${props => !props.$disabled ? (props.$isSelected ? props.$selectedColor ?? (TMColors.tertiary) : '#fff') : '#929292'};
|
|
71
63
|
cursor: ${props => props.$disabled ? 'default' : 'pointer'};
|
|
72
64
|
position: relative;
|
|
73
65
|
justify-content: center;
|
|
@@ -75,7 +67,7 @@ const StyledMenuItem = styled.div `
|
|
|
75
67
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
76
68
|
|
|
77
69
|
&:hover {
|
|
78
|
-
background-color: ${props => !props.$disabled && (
|
|
70
|
+
background-color: ${props => !props.$disabled && (TMColors.primaryColor)};
|
|
79
71
|
}
|
|
80
72
|
|
|
81
73
|
svg {
|