labsense-ui-kit 1.1.39 → 1.1.41
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/dist/Icons/index.d.ts +1 -1
- package/dist/Sidebar/Sidebar.d.ts +2 -1
- package/dist/index.js +94 -29
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +94 -29
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -6089,33 +6089,32 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
6089
6089
|
})));
|
|
6090
6090
|
};
|
|
6091
6091
|
|
|
6092
|
-
var _templateObject$l, _templateObject2$h, _templateObject3$b, _templateObject4$8, _templateObject5$7
|
|
6093
|
-
var SidebarContainer = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: 100vh;\n background: ", "
|
|
6092
|
+
var _templateObject$l, _templateObject2$h, _templateObject3$b, _templateObject4$8, _templateObject5$7;
|
|
6093
|
+
var SidebarContainer = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: 100vh;\n background: ", ";\n transition: width 0.3s ease-in-out;\n display: flex;\n flex-direction: column;\n align-items: start;\n padding: 20px;\n position: fixed;\n left: 0;\n top: 0;\n overflow: hidden;\n z-index: 10;\n justify-content: space-between;\n"])), function (_ref) {
|
|
6094
6094
|
var $isExpanded = _ref.$isExpanded;
|
|
6095
6095
|
return $isExpanded ? '225px' : '68px';
|
|
6096
6096
|
}, function (_ref2) {
|
|
6097
6097
|
var $background = _ref2.$background;
|
|
6098
|
-
return $background
|
|
6098
|
+
return $background || colorVariables.accent.softBlue;
|
|
6099
6099
|
});
|
|
6100
|
-
var
|
|
6101
|
-
var
|
|
6102
|
-
var IconWrapper$2 = styled.div(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n background: ", "; \n font-weight: bold;\n padding: 4px;\n border-radius: 4px;\n width: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n > div:first-child {\n cursor: pointer;\n }\n"])), function (_ref3) {
|
|
6100
|
+
var SidebarLink = styled(NavLink)(_templateObject2$h || (_templateObject2$h = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: 28px;\n width: 100%;\n gap: 10px;\n cursor: pointer;\n border-radius: 4px;\n color: ", ";\n text-decoration: none;\n transition: background 0.3s;\n\n &:hover {\n background: ", ";\n }\n"])), colorVariables.text.medium, colorVariables["default"].primary);
|
|
6101
|
+
var IconWrapper$2 = styled.div(_templateObject3$b || (_templateObject3$b = _taggedTemplateLiteralLoose(["\n background: ", ";\n padding: 4px;\n border-radius: 4px;\n width: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), function (_ref3) {
|
|
6103
6102
|
var $selected = _ref3.$selected;
|
|
6104
6103
|
return $selected ? colorVariables["default"].primary : colorVariables["default"].tertiary;
|
|
6105
6104
|
});
|
|
6106
|
-
var Logo = styled.div(
|
|
6107
|
-
var TextContainer = styled.span(
|
|
6105
|
+
var Logo = styled.div(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n min-width: max-content;\n height: 32px;\n align-items: center;\n justify-content: start;\n gap: 10px;\n"])));
|
|
6106
|
+
var TextContainer = styled.span(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n padding: ", ";\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n opacity: ", ";\n visibility: ", ";\n transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;\n"])), function (_ref4) {
|
|
6108
6107
|
var $padding = _ref4.$padding;
|
|
6109
6108
|
return $padding;
|
|
6110
6109
|
}, function (_ref5) {
|
|
6111
6110
|
var $fontSize = _ref5.$fontSize;
|
|
6112
|
-
return $fontSize
|
|
6111
|
+
return $fontSize || '20px';
|
|
6113
6112
|
}, function (_ref6) {
|
|
6114
6113
|
var $fontWeight = _ref6.$fontWeight;
|
|
6115
|
-
return $fontWeight
|
|
6114
|
+
return $fontWeight || '500';
|
|
6116
6115
|
}, function (_ref7) {
|
|
6117
6116
|
var $color = _ref7.$color;
|
|
6118
|
-
return $color
|
|
6117
|
+
return $color || colorVariables["default"].primary;
|
|
6119
6118
|
}, function (_ref8) {
|
|
6120
6119
|
var $isExpanded = _ref8.$isExpanded;
|
|
6121
6120
|
return $isExpanded ? 1 : 0;
|
|
@@ -6132,15 +6131,49 @@ var Sidebar = function Sidebar(_ref10) {
|
|
|
6132
6131
|
isExpanded = _ref10$isExpanded === void 0 ? false : _ref10$isExpanded,
|
|
6133
6132
|
setIsExpanded = _ref10.setIsExpanded;
|
|
6134
6133
|
var location = useLocation();
|
|
6135
|
-
var
|
|
6136
|
-
|
|
6137
|
-
|
|
6134
|
+
var _useState = useState({}),
|
|
6135
|
+
openMenus = _useState[0],
|
|
6136
|
+
setOpenMenus = _useState[1];
|
|
6137
|
+
useEffect(function () {
|
|
6138
|
+
if (!isExpanded) setOpenMenus({});
|
|
6139
|
+
}, [isExpanded]);
|
|
6140
|
+
var toggleMenu = function toggleMenu(id) {
|
|
6141
|
+
setOpenMenus(function (prev) {
|
|
6142
|
+
var _extends2;
|
|
6143
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[id] = !prev[id], _extends2));
|
|
6144
|
+
});
|
|
6138
6145
|
};
|
|
6139
|
-
var
|
|
6140
|
-
var
|
|
6141
|
-
return
|
|
6146
|
+
var isRouteActive = function isRouteActive(item) {
|
|
6147
|
+
var _item$children;
|
|
6148
|
+
return (item.url ? location.pathname.startsWith(item.url) : false) || ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.some(function (child) {
|
|
6149
|
+
return child.url && location.pathname.startsWith(child.url);
|
|
6150
|
+
}));
|
|
6151
|
+
};
|
|
6152
|
+
var renderChildLinks = function renderChildLinks(children) {
|
|
6153
|
+
return React.createElement(Container, {
|
|
6154
|
+
"$padding": '0px 0px 0px 16px',
|
|
6155
|
+
"$flexDirection": 'column',
|
|
6156
|
+
"$gap": '10px'
|
|
6157
|
+
}, children.map(function (child) {
|
|
6158
|
+
var active = location.pathname.startsWith(child.url || '');
|
|
6159
|
+
return React.createElement(SidebarLink, {
|
|
6160
|
+
to: child.url || '#',
|
|
6161
|
+
key: child.id
|
|
6162
|
+
}, React.createElement(IconWrapper$2, {
|
|
6163
|
+
"$selected": active
|
|
6164
|
+
}, React.createElement(Icon, {
|
|
6165
|
+
icon: child.icon,
|
|
6166
|
+
size: 18,
|
|
6167
|
+
weight: child.iconWeight,
|
|
6168
|
+
color: active ? colorVariables.text.white : colorVariables.text.medium
|
|
6169
|
+
})), React.createElement(TextContainer, {
|
|
6170
|
+
"$isExpanded": isExpanded,
|
|
6171
|
+
"$fontSize": '12px',
|
|
6172
|
+
"$padding": '0px 10px 0px 0px',
|
|
6173
|
+
"$color": colorVariables.text.medium
|
|
6174
|
+
}, child.label));
|
|
6175
|
+
}));
|
|
6142
6176
|
};
|
|
6143
|
-
var topLevelPath = getTopLevelPathWithSlash(location.pathname) || getTopLevelPath(location.pathname);
|
|
6144
6177
|
return React.createElement(SidebarContainer, {
|
|
6145
6178
|
"$background": background,
|
|
6146
6179
|
"$isExpanded": isExpanded,
|
|
@@ -6150,30 +6183,62 @@ var Sidebar = function Sidebar(_ref10) {
|
|
|
6150
6183
|
onMouseLeave: function onMouseLeave() {
|
|
6151
6184
|
return setIsExpanded(false);
|
|
6152
6185
|
}
|
|
6186
|
+
}, React.createElement(Container, {
|
|
6187
|
+
"$flexDirection": 'column',
|
|
6188
|
+
"$gap": '28px',
|
|
6189
|
+
"$width": '100%'
|
|
6153
6190
|
}, logo && React.createElement(Logo, null, React.createElement(Icon, {
|
|
6154
6191
|
icon: logo.icon
|
|
6155
6192
|
}), React.createElement(TextContainer, {
|
|
6156
6193
|
"$isExpanded": isExpanded,
|
|
6157
|
-
"$fontWeight":
|
|
6158
|
-
}, logo.name)), React.createElement(
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6194
|
+
"$fontWeight": '700'
|
|
6195
|
+
}, logo.name)), React.createElement(Container, {
|
|
6196
|
+
"$flexDirection": 'column',
|
|
6197
|
+
"$gap": '16px',
|
|
6198
|
+
"$width": '100%'
|
|
6199
|
+
}, content.map(function (item) {
|
|
6200
|
+
var _item$children2;
|
|
6201
|
+
var active = isRouteActive(item);
|
|
6202
|
+
var hasChildren = !!((_item$children2 = item.children) !== null && _item$children2 !== void 0 && _item$children2.length);
|
|
6203
|
+
var isOpen = openMenus[item.id];
|
|
6204
|
+
var ContentLayout = React.createElement(Container, {
|
|
6205
|
+
"$alignItems": 'center',
|
|
6206
|
+
"$gap": '8px',
|
|
6207
|
+
"$width": '100%',
|
|
6208
|
+
"$cursor": 'pointer',
|
|
6209
|
+
"$borderRadius": '4px',
|
|
6210
|
+
"$hoverBackground": colorVariables["default"].primary,
|
|
6211
|
+
onClick: function onClick() {
|
|
6212
|
+
return hasChildren && toggleMenu(item.id);
|
|
6213
|
+
}
|
|
6163
6214
|
}, React.createElement(IconWrapper$2, {
|
|
6164
|
-
"$selected":
|
|
6215
|
+
"$selected": !!active
|
|
6165
6216
|
}, React.createElement(Icon, {
|
|
6166
6217
|
icon: item.icon,
|
|
6167
6218
|
size: 20,
|
|
6168
6219
|
weight: item.iconWeight,
|
|
6169
|
-
color:
|
|
6220
|
+
color: active ? colorVariables.text.white : colorVariables.text.medium
|
|
6170
6221
|
})), React.createElement(TextContainer, {
|
|
6171
6222
|
"$isExpanded": isExpanded,
|
|
6172
|
-
"$fontSize":
|
|
6223
|
+
"$fontSize": '14px',
|
|
6173
6224
|
"$padding": '0px 10px 0px 0px',
|
|
6174
6225
|
"$color": colorVariables.text.medium
|
|
6175
|
-
}, item.label)
|
|
6176
|
-
|
|
6226
|
+
}, item.label), hasChildren && React.createElement(Icon, {
|
|
6227
|
+
icon: isOpen ? 'UpArrow' : 'DownArrow',
|
|
6228
|
+
size: 10,
|
|
6229
|
+
color: colorVariables.border.extraBold,
|
|
6230
|
+
onClick: function onClick() {}
|
|
6231
|
+
}));
|
|
6232
|
+
return item.url ? React.createElement(SidebarLink, {
|
|
6233
|
+
key: item.id,
|
|
6234
|
+
to: item.url
|
|
6235
|
+
}, ContentLayout) : React.createElement(Container, {
|
|
6236
|
+
key: item.id,
|
|
6237
|
+
"$flexDirection": 'column',
|
|
6238
|
+
"$alignItems": 'start',
|
|
6239
|
+
"$gap": '8px'
|
|
6240
|
+
}, ContentLayout, hasChildren && isExpanded && isOpen && renderChildLinks(item.children));
|
|
6241
|
+
}))), ProfileContent);
|
|
6177
6242
|
};
|
|
6178
6243
|
|
|
6179
6244
|
var _templateObject$m, _templateObject2$i, _templateObject3$c, _templateObject4$9;
|