labsense-ui-kit 1.4.2 → 1.4.4
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/Badge/IconTooltip.d.ts +1 -0
- package/dist/Dropdown/MultiSelectDropdown.d.ts +1 -0
- package/dist/index.js +119 -75
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +119 -75
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -7271,6 +7271,7 @@ var IconTooltip = function IconTooltip(_ref11) {
|
|
|
7271
7271
|
image = _ref11.image,
|
|
7272
7272
|
infoIcon = _ref11.infoIcon,
|
|
7273
7273
|
infoText = _ref11.infoText,
|
|
7274
|
+
iconOnClick = _ref11.iconOnClick,
|
|
7274
7275
|
_ref11$tooltipCSS = _ref11.tooltipCSS,
|
|
7275
7276
|
tooltipCSS = _ref11$tooltipCSS === void 0 ? {
|
|
7276
7277
|
gap: '4px',
|
|
@@ -7286,7 +7287,8 @@ var IconTooltip = function IconTooltip(_ref11) {
|
|
|
7286
7287
|
height: image.height,
|
|
7287
7288
|
draggable: false
|
|
7288
7289
|
}) : React.createElement(Icon, Object.assign({}, icon, {
|
|
7289
|
-
cursor: 'pointer'
|
|
7290
|
+
cursor: 'pointer',
|
|
7291
|
+
onClick: iconOnClick
|
|
7290
7292
|
})), React.createElement(TooltipContainer, {
|
|
7291
7293
|
"$tooltipPosition": (_tooltipCSS$position = tooltipCSS.position) != null ? _tooltipCSS$position : 'bottomCenter',
|
|
7292
7294
|
"$minWidth": tooltipCSS.minWidth,
|
|
@@ -8558,7 +8560,7 @@ var LabelText = styled.div(_templateObject5$4 || (_templateObject5$4 = _taggedTe
|
|
|
8558
8560
|
theme = _ref21.theme;
|
|
8559
8561
|
return $labelColor || theme.vms.text.medium;
|
|
8560
8562
|
});
|
|
8561
|
-
var DropdownMenu = styled.div(_templateObject6$4 || (_templateObject6$4 = _taggedTemplateLiteralLoose(["\n max-height: 156px;\n padding: 4px;\n box-sizing: border-box;\n border: ", ";\n border-radius: ", ";\n width: ", ";\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: 4px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n margin-top: 8px;\n overflow-y: auto;\n position: absolute;\n z-index: 2;\n scrollbar-width: thin;\n"])), function (_ref22) {
|
|
8563
|
+
var DropdownMenu = styled.div(_templateObject6$4 || (_templateObject6$4 = _taggedTemplateLiteralLoose(["\n max-height: 156px;\n padding: 4px;\n box-sizing: border-box;\n border: ", ";\n border-radius: ", ";\n width: ", ";\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: 4px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n margin-top: 8px;\n overflow-y: auto;\n position: absolute;\n z-index: 2;\n scrollbar-width: thin;\n \n ", "\n"])), function (_ref22) {
|
|
8562
8564
|
var theme = _ref22.theme;
|
|
8563
8565
|
return "1px solid " + theme.vms.border.light;
|
|
8564
8566
|
}, function (_ref23) {
|
|
@@ -8571,12 +8573,30 @@ var DropdownMenu = styled.div(_templateObject6$4 || (_templateObject6$4 = _tagge
|
|
|
8571
8573
|
var $menuBackground = _ref25.$menuBackground,
|
|
8572
8574
|
theme = _ref25.theme;
|
|
8573
8575
|
return $menuBackground || theme.vms.accent.light_2;
|
|
8576
|
+
}, function (_ref26) {
|
|
8577
|
+
var $position = _ref26.$position;
|
|
8578
|
+
switch ($position) {
|
|
8579
|
+
case 'topLeft':
|
|
8580
|
+
return "\n bottom: calc(100% + 8px);\n left: 0;\n top: auto;\n ";
|
|
8581
|
+
case 'topCenter':
|
|
8582
|
+
return "\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n top: auto;\n ";
|
|
8583
|
+
case 'topRight':
|
|
8584
|
+
return "\n bottom: calc(100% + 8px);\n right: 0;\n top: auto;\n ";
|
|
8585
|
+
case 'bottomLeft':
|
|
8586
|
+
return "\n top: calc(100% + 8px);\n left: 0;\n bottom: auto;\n ";
|
|
8587
|
+
case 'bottomCenter':
|
|
8588
|
+
return "\n top: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n bottom: auto;\n ";
|
|
8589
|
+
case 'bottomRight':
|
|
8590
|
+
return "\n top: calc(100% + 8px);\n right: 0;\n bottom: auto;\n ";
|
|
8591
|
+
default:
|
|
8592
|
+
return '';
|
|
8593
|
+
}
|
|
8574
8594
|
});
|
|
8575
8595
|
var SelectedOptionsWrapper = styled.div(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n height: 100%;\n"])));
|
|
8576
|
-
var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n background: ", ";\n border-radius: 4px;\n padding: 6px 8px;\n box-sizing: border-box;\n gap: 6px;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 12px;\n color: ", ";\n"])), function (
|
|
8577
|
-
var $selectedOptionBackground =
|
|
8578
|
-
$disabled =
|
|
8579
|
-
theme =
|
|
8596
|
+
var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n background: ", ";\n border-radius: 4px;\n padding: 6px 8px;\n box-sizing: border-box;\n gap: 6px;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 12px;\n color: ", ";\n"])), function (_ref27) {
|
|
8597
|
+
var $selectedOptionBackground = _ref27.$selectedOptionBackground,
|
|
8598
|
+
$disabled = _ref27.$disabled,
|
|
8599
|
+
theme = _ref27.theme;
|
|
8580
8600
|
switch ($selectedOptionBackground) {
|
|
8581
8601
|
case 'dark':
|
|
8582
8602
|
return theme.vms.text.dark;
|
|
@@ -8597,9 +8617,9 @@ var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _
|
|
|
8597
8617
|
default:
|
|
8598
8618
|
return $selectedOptionBackground || theme.vms.accent.light_2;
|
|
8599
8619
|
}
|
|
8600
|
-
}, function (
|
|
8601
|
-
var $selectedOptionColor =
|
|
8602
|
-
theme =
|
|
8620
|
+
}, function (_ref28) {
|
|
8621
|
+
var $selectedOptionColor = _ref28.$selectedOptionColor,
|
|
8622
|
+
theme = _ref28.theme;
|
|
8603
8623
|
switch ($selectedOptionColor) {
|
|
8604
8624
|
case 'dark':
|
|
8605
8625
|
return theme.vms.text.dark;
|
|
@@ -8621,88 +8641,94 @@ var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _
|
|
|
8621
8641
|
return $selectedOptionColor;
|
|
8622
8642
|
}
|
|
8623
8643
|
});
|
|
8624
|
-
var RemoveIcon = styled.div(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n border-radius: 50%;\n box-sizing: border-box;\n background: ", ";\n > div {\n cursor: ", ";\n }\n"])), function (
|
|
8625
|
-
var $disabled =
|
|
8644
|
+
var RemoveIcon = styled.div(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n border-radius: 50%;\n box-sizing: border-box;\n background: ", ";\n > div {\n cursor: ", ";\n }\n"])), function (_ref29) {
|
|
8645
|
+
var $disabled = _ref29.$disabled;
|
|
8626
8646
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8627
|
-
}, function (_ref29) {
|
|
8628
|
-
var removeIconBackground = _ref29.removeIconBackground,
|
|
8629
|
-
$type = _ref29.$type,
|
|
8630
|
-
theme = _ref29.theme;
|
|
8631
|
-
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8632
8647
|
}, function (_ref30) {
|
|
8633
|
-
var
|
|
8648
|
+
var removeIconBackground = _ref30.removeIconBackground,
|
|
8649
|
+
$type = _ref30.$type,
|
|
8650
|
+
theme = _ref30.theme;
|
|
8651
|
+
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8652
|
+
}, function (_ref31) {
|
|
8653
|
+
var $disabled = _ref31.$disabled;
|
|
8634
8654
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8635
8655
|
});
|
|
8636
8656
|
var TextWrapper = styled.div(_templateObject10$2 || (_templateObject10$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));
|
|
8637
|
-
var Asterisk = styled.span(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-size: 10px;\n height: fit-content;\n position: absolute;\n top: -2px;\n right: -8px;\n"])), function (
|
|
8638
|
-
var theme =
|
|
8657
|
+
var Asterisk = styled.span(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-size: 10px;\n height: fit-content;\n position: absolute;\n top: -2px;\n right: -8px;\n"])), function (_ref32) {
|
|
8658
|
+
var theme = _ref32.theme;
|
|
8639
8659
|
return theme.vms["default"].error;
|
|
8640
8660
|
});
|
|
8641
|
-
var MultiSelectDropdown = function MultiSelectDropdown(
|
|
8642
|
-
var title =
|
|
8643
|
-
titleWeight =
|
|
8644
|
-
titleSize =
|
|
8645
|
-
titleColor =
|
|
8646
|
-
|
|
8647
|
-
labelText =
|
|
8648
|
-
labelStyle =
|
|
8649
|
-
labelColor =
|
|
8650
|
-
|
|
8651
|
-
replaceLabel =
|
|
8652
|
-
options =
|
|
8653
|
-
width =
|
|
8654
|
-
optionWidth =
|
|
8655
|
-
height =
|
|
8656
|
-
placeholder =
|
|
8657
|
-
border =
|
|
8658
|
-
background =
|
|
8659
|
-
selectedOptionBackground =
|
|
8660
|
-
selectedOptionColor =
|
|
8661
|
-
menuBackground =
|
|
8662
|
-
optionsBorderRadius =
|
|
8663
|
-
borderRadius =
|
|
8664
|
-
removeIconBackground =
|
|
8665
|
-
handleSelectChange =
|
|
8666
|
-
selectedOptions =
|
|
8667
|
-
placeholderColor =
|
|
8668
|
-
optionBorder =
|
|
8669
|
-
optionColor =
|
|
8670
|
-
searchIcon =
|
|
8671
|
-
searchbarTextColor =
|
|
8672
|
-
searchBoxBackground =
|
|
8673
|
-
searchBoxBorder =
|
|
8674
|
-
searchBoxBorderRadius =
|
|
8675
|
-
size =
|
|
8676
|
-
removeIcon =
|
|
8677
|
-
type =
|
|
8678
|
-
icon =
|
|
8679
|
-
|
|
8680
|
-
disabled =
|
|
8681
|
-
|
|
8682
|
-
required =
|
|
8683
|
-
|
|
8684
|
-
searchBox =
|
|
8685
|
-
|
|
8686
|
-
NoOptionsText =
|
|
8687
|
-
|
|
8688
|
-
selectAllOption =
|
|
8689
|
-
|
|
8690
|
-
selectAllLabel =
|
|
8661
|
+
var MultiSelectDropdown = function MultiSelectDropdown(_ref33) {
|
|
8662
|
+
var title = _ref33.title,
|
|
8663
|
+
titleWeight = _ref33.titleWeight,
|
|
8664
|
+
titleSize = _ref33.titleSize,
|
|
8665
|
+
titleColor = _ref33.titleColor,
|
|
8666
|
+
_ref33$labelText = _ref33.labelText,
|
|
8667
|
+
labelText = _ref33$labelText === void 0 ? 'Select Cameras' : _ref33$labelText,
|
|
8668
|
+
labelStyle = _ref33.labelStyle,
|
|
8669
|
+
labelColor = _ref33.labelColor,
|
|
8670
|
+
_ref33$replaceLabel = _ref33.replaceLabel,
|
|
8671
|
+
replaceLabel = _ref33$replaceLabel === void 0 ? true : _ref33$replaceLabel,
|
|
8672
|
+
options = _ref33.options,
|
|
8673
|
+
width = _ref33.width,
|
|
8674
|
+
optionWidth = _ref33.optionWidth,
|
|
8675
|
+
height = _ref33.height,
|
|
8676
|
+
placeholder = _ref33.placeholder,
|
|
8677
|
+
border = _ref33.border,
|
|
8678
|
+
background = _ref33.background,
|
|
8679
|
+
selectedOptionBackground = _ref33.selectedOptionBackground,
|
|
8680
|
+
selectedOptionColor = _ref33.selectedOptionColor,
|
|
8681
|
+
menuBackground = _ref33.menuBackground,
|
|
8682
|
+
optionsBorderRadius = _ref33.optionsBorderRadius,
|
|
8683
|
+
borderRadius = _ref33.borderRadius,
|
|
8684
|
+
removeIconBackground = _ref33.removeIconBackground,
|
|
8685
|
+
handleSelectChange = _ref33.handleSelectChange,
|
|
8686
|
+
selectedOptions = _ref33.selectedOptions,
|
|
8687
|
+
placeholderColor = _ref33.placeholderColor,
|
|
8688
|
+
optionBorder = _ref33.optionBorder,
|
|
8689
|
+
optionColor = _ref33.optionColor,
|
|
8690
|
+
searchIcon = _ref33.searchIcon,
|
|
8691
|
+
searchbarTextColor = _ref33.searchbarTextColor,
|
|
8692
|
+
searchBoxBackground = _ref33.searchBoxBackground,
|
|
8693
|
+
searchBoxBorder = _ref33.searchBoxBorder,
|
|
8694
|
+
searchBoxBorderRadius = _ref33.searchBoxBorderRadius,
|
|
8695
|
+
size = _ref33.size,
|
|
8696
|
+
removeIcon = _ref33.removeIcon,
|
|
8697
|
+
type = _ref33.type,
|
|
8698
|
+
icon = _ref33.icon,
|
|
8699
|
+
_ref33$disabled = _ref33.disabled,
|
|
8700
|
+
disabled = _ref33$disabled === void 0 ? false : _ref33$disabled,
|
|
8701
|
+
_ref33$required = _ref33.required,
|
|
8702
|
+
required = _ref33$required === void 0 ? false : _ref33$required,
|
|
8703
|
+
_ref33$searchBox = _ref33.searchBox,
|
|
8704
|
+
searchBox = _ref33$searchBox === void 0 ? true : _ref33$searchBox,
|
|
8705
|
+
_ref33$NoOptionsText = _ref33.NoOptionsText,
|
|
8706
|
+
NoOptionsText = _ref33$NoOptionsText === void 0 ? 'No Options Available' : _ref33$NoOptionsText,
|
|
8707
|
+
_ref33$selectAllOptio = _ref33.selectAllOption,
|
|
8708
|
+
selectAllOption = _ref33$selectAllOptio === void 0 ? false : _ref33$selectAllOptio,
|
|
8709
|
+
_ref33$selectAllLabel = _ref33.selectAllLabel,
|
|
8710
|
+
selectAllLabel = _ref33$selectAllLabel === void 0 ? 'Select All' : _ref33$selectAllLabel,
|
|
8711
|
+
dropdownPosition = _ref33.dropdownPosition;
|
|
8691
8712
|
var themeColors = useTheme();
|
|
8692
8713
|
var _useState = useState(false),
|
|
8693
8714
|
dropUp = _useState[0],
|
|
8694
8715
|
setDropUp = _useState[1];
|
|
8695
|
-
var _useState2 = useState(
|
|
8696
|
-
|
|
8697
|
-
|
|
8716
|
+
var _useState2 = useState('left'),
|
|
8717
|
+
horizontalAlign = _useState2[0],
|
|
8718
|
+
setHorizontalAlign = _useState2[1];
|
|
8719
|
+
var _useState3 = useState(false),
|
|
8720
|
+
isOpen = _useState3[0],
|
|
8721
|
+
setIsOpen = _useState3[1];
|
|
8698
8722
|
var dropdownRef = useRef(null);
|
|
8699
8723
|
var dropdownButtonRef = useRef(null);
|
|
8724
|
+
var dropdownMenuRef = useRef(null);
|
|
8700
8725
|
var toggleDropdown = function toggleDropdown() {
|
|
8701
8726
|
if (disabled) return;
|
|
8702
8727
|
var refToUse = dropdownRef.current;
|
|
8703
|
-
if (refToUse) {
|
|
8728
|
+
if (refToUse && !dropdownPosition) {
|
|
8704
8729
|
var rect = refToUse.getBoundingClientRect();
|
|
8705
8730
|
var windowHeight = window.innerHeight;
|
|
8731
|
+
var windowWidth = window.innerWidth;
|
|
8706
8732
|
var spaceBelow = windowHeight - rect.bottom;
|
|
8707
8733
|
var spaceAbove = rect.top;
|
|
8708
8734
|
var dropdownHeight = 156;
|
|
@@ -8711,6 +8737,19 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8711
8737
|
} else {
|
|
8712
8738
|
setDropUp(false);
|
|
8713
8739
|
}
|
|
8740
|
+
var estimatedDropdownWidth = optionWidth ? parseInt(optionWidth) : 200;
|
|
8741
|
+
var spaceRight = windowWidth - rect.left;
|
|
8742
|
+
var spaceLeft = rect.right;
|
|
8743
|
+
var buttonWidth = rect.width;
|
|
8744
|
+
if (spaceRight >= estimatedDropdownWidth) {
|
|
8745
|
+
setHorizontalAlign('left');
|
|
8746
|
+
} else if (spaceLeft >= estimatedDropdownWidth) {
|
|
8747
|
+
setHorizontalAlign('right');
|
|
8748
|
+
} else if (rect.left + buttonWidth / 2 >= estimatedDropdownWidth / 2 && windowWidth - (rect.left + buttonWidth / 2) >= estimatedDropdownWidth / 2) {
|
|
8749
|
+
setHorizontalAlign('center');
|
|
8750
|
+
} else {
|
|
8751
|
+
setHorizontalAlign('left');
|
|
8752
|
+
}
|
|
8714
8753
|
}
|
|
8715
8754
|
setIsOpen(function (prev) {
|
|
8716
8755
|
return !prev;
|
|
@@ -8850,12 +8889,17 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8850
8889
|
weight: '2px',
|
|
8851
8890
|
color: themeColors.vms.text.medium
|
|
8852
8891
|
})), isOpen && React.createElement(DropdownMenu, {
|
|
8892
|
+
ref: dropdownMenuRef,
|
|
8853
8893
|
"$width": optionWidth,
|
|
8854
8894
|
"$menuBackground": menuBackground || themeColors.vms.text.white,
|
|
8855
8895
|
"$optionsBorderRadius": optionsBorderRadius,
|
|
8856
|
-
|
|
8896
|
+
"$position": dropdownPosition,
|
|
8897
|
+
style: dropdownPosition ? undefined : {
|
|
8857
8898
|
top: dropUp ? 'auto' : 'calc(100% + 8px)',
|
|
8858
|
-
bottom: dropUp ? 'calc(100% + 8px)' : 'auto'
|
|
8899
|
+
bottom: dropUp ? 'calc(100% + 8px)' : 'auto',
|
|
8900
|
+
left: horizontalAlign === 'left' ? '0' : horizontalAlign === 'center' ? '50%' : 'auto',
|
|
8901
|
+
right: horizontalAlign === 'right' ? '0' : 'auto',
|
|
8902
|
+
transform: horizontalAlign === 'center' ? 'translateX(-50%)' : 'none'
|
|
8859
8903
|
}
|
|
8860
8904
|
}, React.createElement(OptionComponent, {
|
|
8861
8905
|
options: computedOptions,
|