labsense-ui-kit 1.4.2 → 1.4.3
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/Dropdown/MultiSelectDropdown.d.ts +1 -0
- package/dist/index.js +116 -74
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +116 -74
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8558,7 +8558,7 @@ var LabelText = styled.div(_templateObject5$4 || (_templateObject5$4 = _taggedTe
|
|
|
8558
8558
|
theme = _ref21.theme;
|
|
8559
8559
|
return $labelColor || theme.vms.text.medium;
|
|
8560
8560
|
});
|
|
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) {
|
|
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 \n ", "\n"])), function (_ref22) {
|
|
8562
8562
|
var theme = _ref22.theme;
|
|
8563
8563
|
return "1px solid " + theme.vms.border.light;
|
|
8564
8564
|
}, function (_ref23) {
|
|
@@ -8571,12 +8571,30 @@ var DropdownMenu = styled.div(_templateObject6$4 || (_templateObject6$4 = _tagge
|
|
|
8571
8571
|
var $menuBackground = _ref25.$menuBackground,
|
|
8572
8572
|
theme = _ref25.theme;
|
|
8573
8573
|
return $menuBackground || theme.vms.accent.light_2;
|
|
8574
|
+
}, function (_ref26) {
|
|
8575
|
+
var $position = _ref26.$position;
|
|
8576
|
+
switch ($position) {
|
|
8577
|
+
case 'topLeft':
|
|
8578
|
+
return "\n bottom: calc(100% + 8px);\n left: 0;\n top: auto;\n ";
|
|
8579
|
+
case 'topCenter':
|
|
8580
|
+
return "\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n top: auto;\n ";
|
|
8581
|
+
case 'topRight':
|
|
8582
|
+
return "\n bottom: calc(100% + 8px);\n right: 0;\n top: auto;\n ";
|
|
8583
|
+
case 'bottomLeft':
|
|
8584
|
+
return "\n top: calc(100% + 8px);\n left: 0;\n bottom: auto;\n ";
|
|
8585
|
+
case 'bottomCenter':
|
|
8586
|
+
return "\n top: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n bottom: auto;\n ";
|
|
8587
|
+
case 'bottomRight':
|
|
8588
|
+
return "\n top: calc(100% + 8px);\n right: 0;\n bottom: auto;\n ";
|
|
8589
|
+
default:
|
|
8590
|
+
return '';
|
|
8591
|
+
}
|
|
8574
8592
|
});
|
|
8575
8593
|
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 =
|
|
8594
|
+
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) {
|
|
8595
|
+
var $selectedOptionBackground = _ref27.$selectedOptionBackground,
|
|
8596
|
+
$disabled = _ref27.$disabled,
|
|
8597
|
+
theme = _ref27.theme;
|
|
8580
8598
|
switch ($selectedOptionBackground) {
|
|
8581
8599
|
case 'dark':
|
|
8582
8600
|
return theme.vms.text.dark;
|
|
@@ -8597,9 +8615,9 @@ var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _
|
|
|
8597
8615
|
default:
|
|
8598
8616
|
return $selectedOptionBackground || theme.vms.accent.light_2;
|
|
8599
8617
|
}
|
|
8600
|
-
}, function (
|
|
8601
|
-
var $selectedOptionColor =
|
|
8602
|
-
theme =
|
|
8618
|
+
}, function (_ref28) {
|
|
8619
|
+
var $selectedOptionColor = _ref28.$selectedOptionColor,
|
|
8620
|
+
theme = _ref28.theme;
|
|
8603
8621
|
switch ($selectedOptionColor) {
|
|
8604
8622
|
case 'dark':
|
|
8605
8623
|
return theme.vms.text.dark;
|
|
@@ -8621,88 +8639,94 @@ var SelectedOptionDiv = styled.div(_templateObject8$2 || (_templateObject8$2 = _
|
|
|
8621
8639
|
return $selectedOptionColor;
|
|
8622
8640
|
}
|
|
8623
8641
|
});
|
|
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 =
|
|
8642
|
+
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) {
|
|
8643
|
+
var $disabled = _ref29.$disabled;
|
|
8626
8644
|
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
8645
|
}, function (_ref30) {
|
|
8633
|
-
var
|
|
8646
|
+
var removeIconBackground = _ref30.removeIconBackground,
|
|
8647
|
+
$type = _ref30.$type,
|
|
8648
|
+
theme = _ref30.theme;
|
|
8649
|
+
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8650
|
+
}, function (_ref31) {
|
|
8651
|
+
var $disabled = _ref31.$disabled;
|
|
8634
8652
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8635
8653
|
});
|
|
8636
8654
|
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 =
|
|
8655
|
+
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) {
|
|
8656
|
+
var theme = _ref32.theme;
|
|
8639
8657
|
return theme.vms["default"].error;
|
|
8640
8658
|
});
|
|
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 =
|
|
8659
|
+
var MultiSelectDropdown = function MultiSelectDropdown(_ref33) {
|
|
8660
|
+
var title = _ref33.title,
|
|
8661
|
+
titleWeight = _ref33.titleWeight,
|
|
8662
|
+
titleSize = _ref33.titleSize,
|
|
8663
|
+
titleColor = _ref33.titleColor,
|
|
8664
|
+
_ref33$labelText = _ref33.labelText,
|
|
8665
|
+
labelText = _ref33$labelText === void 0 ? 'Select Cameras' : _ref33$labelText,
|
|
8666
|
+
labelStyle = _ref33.labelStyle,
|
|
8667
|
+
labelColor = _ref33.labelColor,
|
|
8668
|
+
_ref33$replaceLabel = _ref33.replaceLabel,
|
|
8669
|
+
replaceLabel = _ref33$replaceLabel === void 0 ? true : _ref33$replaceLabel,
|
|
8670
|
+
options = _ref33.options,
|
|
8671
|
+
width = _ref33.width,
|
|
8672
|
+
optionWidth = _ref33.optionWidth,
|
|
8673
|
+
height = _ref33.height,
|
|
8674
|
+
placeholder = _ref33.placeholder,
|
|
8675
|
+
border = _ref33.border,
|
|
8676
|
+
background = _ref33.background,
|
|
8677
|
+
selectedOptionBackground = _ref33.selectedOptionBackground,
|
|
8678
|
+
selectedOptionColor = _ref33.selectedOptionColor,
|
|
8679
|
+
menuBackground = _ref33.menuBackground,
|
|
8680
|
+
optionsBorderRadius = _ref33.optionsBorderRadius,
|
|
8681
|
+
borderRadius = _ref33.borderRadius,
|
|
8682
|
+
removeIconBackground = _ref33.removeIconBackground,
|
|
8683
|
+
handleSelectChange = _ref33.handleSelectChange,
|
|
8684
|
+
selectedOptions = _ref33.selectedOptions,
|
|
8685
|
+
placeholderColor = _ref33.placeholderColor,
|
|
8686
|
+
optionBorder = _ref33.optionBorder,
|
|
8687
|
+
optionColor = _ref33.optionColor,
|
|
8688
|
+
searchIcon = _ref33.searchIcon,
|
|
8689
|
+
searchbarTextColor = _ref33.searchbarTextColor,
|
|
8690
|
+
searchBoxBackground = _ref33.searchBoxBackground,
|
|
8691
|
+
searchBoxBorder = _ref33.searchBoxBorder,
|
|
8692
|
+
searchBoxBorderRadius = _ref33.searchBoxBorderRadius,
|
|
8693
|
+
size = _ref33.size,
|
|
8694
|
+
removeIcon = _ref33.removeIcon,
|
|
8695
|
+
type = _ref33.type,
|
|
8696
|
+
icon = _ref33.icon,
|
|
8697
|
+
_ref33$disabled = _ref33.disabled,
|
|
8698
|
+
disabled = _ref33$disabled === void 0 ? false : _ref33$disabled,
|
|
8699
|
+
_ref33$required = _ref33.required,
|
|
8700
|
+
required = _ref33$required === void 0 ? false : _ref33$required,
|
|
8701
|
+
_ref33$searchBox = _ref33.searchBox,
|
|
8702
|
+
searchBox = _ref33$searchBox === void 0 ? true : _ref33$searchBox,
|
|
8703
|
+
_ref33$NoOptionsText = _ref33.NoOptionsText,
|
|
8704
|
+
NoOptionsText = _ref33$NoOptionsText === void 0 ? 'No Options Available' : _ref33$NoOptionsText,
|
|
8705
|
+
_ref33$selectAllOptio = _ref33.selectAllOption,
|
|
8706
|
+
selectAllOption = _ref33$selectAllOptio === void 0 ? false : _ref33$selectAllOptio,
|
|
8707
|
+
_ref33$selectAllLabel = _ref33.selectAllLabel,
|
|
8708
|
+
selectAllLabel = _ref33$selectAllLabel === void 0 ? 'Select All' : _ref33$selectAllLabel,
|
|
8709
|
+
dropdownPosition = _ref33.dropdownPosition;
|
|
8691
8710
|
var themeColors = useTheme();
|
|
8692
8711
|
var _useState = useState(false),
|
|
8693
8712
|
dropUp = _useState[0],
|
|
8694
8713
|
setDropUp = _useState[1];
|
|
8695
|
-
var _useState2 = useState(
|
|
8696
|
-
|
|
8697
|
-
|
|
8714
|
+
var _useState2 = useState('left'),
|
|
8715
|
+
horizontalAlign = _useState2[0],
|
|
8716
|
+
setHorizontalAlign = _useState2[1];
|
|
8717
|
+
var _useState3 = useState(false),
|
|
8718
|
+
isOpen = _useState3[0],
|
|
8719
|
+
setIsOpen = _useState3[1];
|
|
8698
8720
|
var dropdownRef = useRef(null);
|
|
8699
8721
|
var dropdownButtonRef = useRef(null);
|
|
8722
|
+
var dropdownMenuRef = useRef(null);
|
|
8700
8723
|
var toggleDropdown = function toggleDropdown() {
|
|
8701
8724
|
if (disabled) return;
|
|
8702
8725
|
var refToUse = dropdownRef.current;
|
|
8703
|
-
if (refToUse) {
|
|
8726
|
+
if (refToUse && !dropdownPosition) {
|
|
8704
8727
|
var rect = refToUse.getBoundingClientRect();
|
|
8705
8728
|
var windowHeight = window.innerHeight;
|
|
8729
|
+
var windowWidth = window.innerWidth;
|
|
8706
8730
|
var spaceBelow = windowHeight - rect.bottom;
|
|
8707
8731
|
var spaceAbove = rect.top;
|
|
8708
8732
|
var dropdownHeight = 156;
|
|
@@ -8711,6 +8735,19 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8711
8735
|
} else {
|
|
8712
8736
|
setDropUp(false);
|
|
8713
8737
|
}
|
|
8738
|
+
var estimatedDropdownWidth = optionWidth ? parseInt(optionWidth) : 200;
|
|
8739
|
+
var spaceRight = windowWidth - rect.left;
|
|
8740
|
+
var spaceLeft = rect.right;
|
|
8741
|
+
var buttonWidth = rect.width;
|
|
8742
|
+
if (spaceRight >= estimatedDropdownWidth) {
|
|
8743
|
+
setHorizontalAlign('left');
|
|
8744
|
+
} else if (spaceLeft >= estimatedDropdownWidth) {
|
|
8745
|
+
setHorizontalAlign('right');
|
|
8746
|
+
} else if (rect.left + buttonWidth / 2 >= estimatedDropdownWidth / 2 && windowWidth - (rect.left + buttonWidth / 2) >= estimatedDropdownWidth / 2) {
|
|
8747
|
+
setHorizontalAlign('center');
|
|
8748
|
+
} else {
|
|
8749
|
+
setHorizontalAlign('left');
|
|
8750
|
+
}
|
|
8714
8751
|
}
|
|
8715
8752
|
setIsOpen(function (prev) {
|
|
8716
8753
|
return !prev;
|
|
@@ -8850,12 +8887,17 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8850
8887
|
weight: '2px',
|
|
8851
8888
|
color: themeColors.vms.text.medium
|
|
8852
8889
|
})), isOpen && React.createElement(DropdownMenu, {
|
|
8890
|
+
ref: dropdownMenuRef,
|
|
8853
8891
|
"$width": optionWidth,
|
|
8854
8892
|
"$menuBackground": menuBackground || themeColors.vms.text.white,
|
|
8855
8893
|
"$optionsBorderRadius": optionsBorderRadius,
|
|
8856
|
-
|
|
8894
|
+
"$position": dropdownPosition,
|
|
8895
|
+
style: dropdownPosition ? undefined : {
|
|
8857
8896
|
top: dropUp ? 'auto' : 'calc(100% + 8px)',
|
|
8858
|
-
bottom: dropUp ? 'calc(100% + 8px)' : 'auto'
|
|
8897
|
+
bottom: dropUp ? 'calc(100% + 8px)' : 'auto',
|
|
8898
|
+
left: horizontalAlign === 'left' ? '0' : horizontalAlign === 'center' ? '50%' : 'auto',
|
|
8899
|
+
right: horizontalAlign === 'right' ? '0' : 'auto',
|
|
8900
|
+
transform: horizontalAlign === 'center' ? 'translateX(-50%)' : 'none'
|
|
8859
8901
|
}
|
|
8860
8902
|
}, React.createElement(OptionComponent, {
|
|
8861
8903
|
options: computedOptions,
|