labsense-ui-kit 1.3.40 → 1.3.42
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/index.js +43 -26
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +44 -27
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ var React = require('react');
|
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
5
|
var styled = require('styled-components');
|
|
6
6
|
var styled__default = _interopDefault(styled);
|
|
7
|
+
var reactDom = require('react-dom');
|
|
7
8
|
var reactHotToast = require('react-hot-toast');
|
|
8
9
|
var reactRouterDom = require('react-router-dom');
|
|
9
10
|
var reactI18next = require('react-i18next');
|
|
10
|
-
var reactDom = require('react-dom');
|
|
11
11
|
|
|
12
12
|
function _extends() {
|
|
13
13
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -6333,13 +6333,13 @@ var Modal = function Modal(_ref4) {
|
|
|
6333
6333
|
overflow = _ref4.overflow,
|
|
6334
6334
|
children = _ref4.children;
|
|
6335
6335
|
if (!isOpen) return null;
|
|
6336
|
-
return React__default.createElement(ModalOverlay, null, React__default.createElement(ModalContainer, {
|
|
6336
|
+
return reactDom.createPortal(React__default.createElement(ModalOverlay, null, React__default.createElement(ModalContainer, {
|
|
6337
6337
|
"$maxWidth": maxWidth,
|
|
6338
6338
|
"$overflowY": overflow,
|
|
6339
6339
|
onClick: function onClick(e) {
|
|
6340
6340
|
return e.stopPropagation();
|
|
6341
6341
|
}
|
|
6342
|
-
}, children));
|
|
6342
|
+
}, children)), document.body);
|
|
6343
6343
|
};
|
|
6344
6344
|
|
|
6345
6345
|
var UseCustomModal = function UseCustomModal(_ref) {
|
|
@@ -6378,16 +6378,35 @@ var useTheme = function useTheme() {
|
|
|
6378
6378
|
|
|
6379
6379
|
var useNotification = function useNotification() {
|
|
6380
6380
|
var themeColors = useTheme();
|
|
6381
|
+
var _useToasterStore = reactHotToast.useToasterStore(),
|
|
6382
|
+
toasts = _useToasterStore.toasts;
|
|
6383
|
+
var lastToastRef = React__default.useRef(null);
|
|
6384
|
+
var getDuplicateToastId = function getDuplicateToastId(type, message) {
|
|
6385
|
+
var _toasts$find;
|
|
6386
|
+
return (_toasts$find = toasts.find(function (t) {
|
|
6387
|
+
return t.visible && t.type === type && t.message === message;
|
|
6388
|
+
})) === null || _toasts$find === void 0 ? void 0 : _toasts$find.id;
|
|
6389
|
+
};
|
|
6381
6390
|
var sendNotification = function sendNotification(_ref) {
|
|
6391
|
+
var _lastToastRef$current, _lastToastRef$current2;
|
|
6382
6392
|
var type = _ref.type,
|
|
6383
6393
|
message = _ref.message,
|
|
6384
6394
|
promiseConfig = _ref.promiseConfig,
|
|
6385
6395
|
customStyle = _ref.customStyle,
|
|
6386
6396
|
_ref$clearCurrent = _ref.clearCurrent,
|
|
6387
6397
|
clearCurrent = _ref$clearCurrent === void 0 ? false : _ref$clearCurrent;
|
|
6388
|
-
|
|
6398
|
+
var isSameAsLast = ((_lastToastRef$current = lastToastRef.current) === null || _lastToastRef$current === void 0 ? void 0 : _lastToastRef$current.type) === type && ((_lastToastRef$current2 = lastToastRef.current) === null || _lastToastRef$current2 === void 0 ? void 0 : _lastToastRef$current2.message) === message;
|
|
6399
|
+
var duplicateToastId = getDuplicateToastId(type, message);
|
|
6400
|
+
if (duplicateToastId && !isSameAsLast) {
|
|
6401
|
+
reactHotToast.toast.dismiss(duplicateToastId);
|
|
6402
|
+
}
|
|
6403
|
+
if (clearCurrent && !duplicateToastId) {
|
|
6389
6404
|
reactHotToast.toast.dismiss();
|
|
6390
6405
|
}
|
|
6406
|
+
lastToastRef.current = {
|
|
6407
|
+
type: type,
|
|
6408
|
+
message: message
|
|
6409
|
+
};
|
|
6391
6410
|
switch (type) {
|
|
6392
6411
|
case 'success':
|
|
6393
6412
|
reactHotToast.toast.success(message);
|
|
@@ -6398,16 +6417,15 @@ var useNotification = function useNotification() {
|
|
|
6398
6417
|
case 'info':
|
|
6399
6418
|
reactHotToast.toast(message, {
|
|
6400
6419
|
icon: React__default.createElement(Container, {
|
|
6401
|
-
"$minWidth":
|
|
6402
|
-
"$height":
|
|
6403
|
-
"$width":
|
|
6404
|
-
"$alignItems":
|
|
6405
|
-
"$justifyContent":
|
|
6406
|
-
"$borderRadius":
|
|
6420
|
+
"$minWidth": "20px",
|
|
6421
|
+
"$height": "20px",
|
|
6422
|
+
"$width": "20px",
|
|
6423
|
+
"$alignItems": "center",
|
|
6424
|
+
"$justifyContent": "center",
|
|
6425
|
+
"$borderRadius": "100%",
|
|
6407
6426
|
"$background": themeColors.vms.disabled.info
|
|
6408
6427
|
}, React__default.createElement(Icon, {
|
|
6409
|
-
icon:
|
|
6410
|
-
weight: '0px',
|
|
6428
|
+
icon: "InformationFilled",
|
|
6411
6429
|
size: 20,
|
|
6412
6430
|
color: themeColors.vms["default"].info
|
|
6413
6431
|
})),
|
|
@@ -6445,8 +6463,6 @@ var useNotification = function useNotification() {
|
|
|
6445
6463
|
}
|
|
6446
6464
|
});
|
|
6447
6465
|
break;
|
|
6448
|
-
default:
|
|
6449
|
-
console.error('Invalid notification type or missing configuration!');
|
|
6450
6466
|
}
|
|
6451
6467
|
};
|
|
6452
6468
|
return {
|
|
@@ -10096,8 +10112,9 @@ var Sidebar = function Sidebar(_ref17) {
|
|
|
10096
10112
|
}, [isExpanded]);
|
|
10097
10113
|
var toggleMenu = function toggleMenu(id) {
|
|
10098
10114
|
setOpenMenus(function (prev) {
|
|
10099
|
-
var
|
|
10100
|
-
|
|
10115
|
+
var _ref18;
|
|
10116
|
+
var isCurrentlyOpen = !!prev[id];
|
|
10117
|
+
return isCurrentlyOpen ? {} : (_ref18 = {}, _ref18[id] = true, _ref18);
|
|
10101
10118
|
});
|
|
10102
10119
|
};
|
|
10103
10120
|
var getTotalNotifications = React.useCallback(function (item) {
|
|
@@ -10122,8 +10139,8 @@ var Sidebar = function Sidebar(_ref17) {
|
|
|
10122
10139
|
return currentBase === getBasePath(child.activeUrl) || currentBase === getBasePath(child.url);
|
|
10123
10140
|
}));
|
|
10124
10141
|
};
|
|
10125
|
-
var ChildLink = React__default.memo(function (
|
|
10126
|
-
var child =
|
|
10142
|
+
var ChildLink = React__default.memo(function (_ref19) {
|
|
10143
|
+
var child = _ref19.child;
|
|
10127
10144
|
var themeColors = styled.useTheme();
|
|
10128
10145
|
var location = reactRouterDom.useLocation();
|
|
10129
10146
|
var active = getBasePath(location.pathname) === getBasePath(child.activeUrl) || getBasePath(location.pathname) === getBasePath(child.url);
|
|
@@ -10169,14 +10186,14 @@ var Sidebar = function Sidebar(_ref17) {
|
|
|
10169
10186
|
});
|
|
10170
10187
|
}));
|
|
10171
10188
|
};
|
|
10172
|
-
var SidebarItem = React__default.memo(function (
|
|
10173
|
-
var item =
|
|
10174
|
-
isActive =
|
|
10175
|
-
isOpen =
|
|
10176
|
-
hasChildren =
|
|
10177
|
-
isExpanded =
|
|
10178
|
-
onToggle =
|
|
10179
|
-
renderChildLinks =
|
|
10189
|
+
var SidebarItem = React__default.memo(function (_ref20) {
|
|
10190
|
+
var item = _ref20.item,
|
|
10191
|
+
isActive = _ref20.isActive,
|
|
10192
|
+
isOpen = _ref20.isOpen,
|
|
10193
|
+
hasChildren = _ref20.hasChildren,
|
|
10194
|
+
isExpanded = _ref20.isExpanded,
|
|
10195
|
+
onToggle = _ref20.onToggle,
|
|
10196
|
+
renderChildLinks = _ref20.renderChildLinks;
|
|
10180
10197
|
var themeColors = styled.useTheme();
|
|
10181
10198
|
var activeClass = isActive ? 'active' : '';
|
|
10182
10199
|
var handleClick = React.useCallback(function () {
|