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
|
@@ -58,6 +58,7 @@ interface MultiSelectDropdownProps {
|
|
|
58
58
|
NoOptionsText?: string;
|
|
59
59
|
selectAllOption?: boolean;
|
|
60
60
|
selectAllLabel?: string;
|
|
61
|
+
dropdownPosition?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
61
62
|
}
|
|
62
63
|
declare const MultiSelectDropdown: React.FC<MultiSelectDropdownProps>;
|
|
63
64
|
export default MultiSelectDropdown;
|
package/dist/index.js
CHANGED
|
@@ -7275,6 +7275,7 @@ var IconTooltip = function IconTooltip(_ref11) {
|
|
|
7275
7275
|
image = _ref11.image,
|
|
7276
7276
|
infoIcon = _ref11.infoIcon,
|
|
7277
7277
|
infoText = _ref11.infoText,
|
|
7278
|
+
iconOnClick = _ref11.iconOnClick,
|
|
7278
7279
|
_ref11$tooltipCSS = _ref11.tooltipCSS,
|
|
7279
7280
|
tooltipCSS = _ref11$tooltipCSS === void 0 ? {
|
|
7280
7281
|
gap: '4px',
|
|
@@ -7290,7 +7291,8 @@ var IconTooltip = function IconTooltip(_ref11) {
|
|
|
7290
7291
|
height: image.height,
|
|
7291
7292
|
draggable: false
|
|
7292
7293
|
}) : React__default.createElement(Icon, Object.assign({}, icon, {
|
|
7293
|
-
cursor: 'pointer'
|
|
7294
|
+
cursor: 'pointer',
|
|
7295
|
+
onClick: iconOnClick
|
|
7294
7296
|
})), React__default.createElement(TooltipContainer, {
|
|
7295
7297
|
"$tooltipPosition": (_tooltipCSS$position = tooltipCSS.position) != null ? _tooltipCSS$position : 'bottomCenter',
|
|
7296
7298
|
"$minWidth": tooltipCSS.minWidth,
|
|
@@ -8562,7 +8564,7 @@ var LabelText = styled__default.div(_templateObject5$4 || (_templateObject5$4 =
|
|
|
8562
8564
|
theme = _ref21.theme;
|
|
8563
8565
|
return $labelColor || theme.vms.text.medium;
|
|
8564
8566
|
});
|
|
8565
|
-
var DropdownMenu = styled__default.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) {
|
|
8567
|
+
var DropdownMenu = styled__default.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) {
|
|
8566
8568
|
var theme = _ref22.theme;
|
|
8567
8569
|
return "1px solid " + theme.vms.border.light;
|
|
8568
8570
|
}, function (_ref23) {
|
|
@@ -8575,12 +8577,30 @@ var DropdownMenu = styled__default.div(_templateObject6$4 || (_templateObject6$4
|
|
|
8575
8577
|
var $menuBackground = _ref25.$menuBackground,
|
|
8576
8578
|
theme = _ref25.theme;
|
|
8577
8579
|
return $menuBackground || theme.vms.accent.light_2;
|
|
8580
|
+
}, function (_ref26) {
|
|
8581
|
+
var $position = _ref26.$position;
|
|
8582
|
+
switch ($position) {
|
|
8583
|
+
case 'topLeft':
|
|
8584
|
+
return "\n bottom: calc(100% + 8px);\n left: 0;\n top: auto;\n ";
|
|
8585
|
+
case 'topCenter':
|
|
8586
|
+
return "\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n top: auto;\n ";
|
|
8587
|
+
case 'topRight':
|
|
8588
|
+
return "\n bottom: calc(100% + 8px);\n right: 0;\n top: auto;\n ";
|
|
8589
|
+
case 'bottomLeft':
|
|
8590
|
+
return "\n top: calc(100% + 8px);\n left: 0;\n bottom: auto;\n ";
|
|
8591
|
+
case 'bottomCenter':
|
|
8592
|
+
return "\n top: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n bottom: auto;\n ";
|
|
8593
|
+
case 'bottomRight':
|
|
8594
|
+
return "\n top: calc(100% + 8px);\n right: 0;\n bottom: auto;\n ";
|
|
8595
|
+
default:
|
|
8596
|
+
return '';
|
|
8597
|
+
}
|
|
8578
8598
|
});
|
|
8579
8599
|
var SelectedOptionsWrapper = styled__default.div(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n height: 100%;\n"])));
|
|
8580
|
-
var SelectedOptionDiv = styled__default.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 (
|
|
8581
|
-
var $selectedOptionBackground =
|
|
8582
|
-
$disabled =
|
|
8583
|
-
theme =
|
|
8600
|
+
var SelectedOptionDiv = styled__default.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) {
|
|
8601
|
+
var $selectedOptionBackground = _ref27.$selectedOptionBackground,
|
|
8602
|
+
$disabled = _ref27.$disabled,
|
|
8603
|
+
theme = _ref27.theme;
|
|
8584
8604
|
switch ($selectedOptionBackground) {
|
|
8585
8605
|
case 'dark':
|
|
8586
8606
|
return theme.vms.text.dark;
|
|
@@ -8601,9 +8621,9 @@ var SelectedOptionDiv = styled__default.div(_templateObject8$2 || (_templateObje
|
|
|
8601
8621
|
default:
|
|
8602
8622
|
return $selectedOptionBackground || theme.vms.accent.light_2;
|
|
8603
8623
|
}
|
|
8604
|
-
}, function (
|
|
8605
|
-
var $selectedOptionColor =
|
|
8606
|
-
theme =
|
|
8624
|
+
}, function (_ref28) {
|
|
8625
|
+
var $selectedOptionColor = _ref28.$selectedOptionColor,
|
|
8626
|
+
theme = _ref28.theme;
|
|
8607
8627
|
switch ($selectedOptionColor) {
|
|
8608
8628
|
case 'dark':
|
|
8609
8629
|
return theme.vms.text.dark;
|
|
@@ -8625,88 +8645,94 @@ var SelectedOptionDiv = styled__default.div(_templateObject8$2 || (_templateObje
|
|
|
8625
8645
|
return $selectedOptionColor;
|
|
8626
8646
|
}
|
|
8627
8647
|
});
|
|
8628
|
-
var RemoveIcon = styled__default.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 (
|
|
8629
|
-
var $disabled =
|
|
8648
|
+
var RemoveIcon = styled__default.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) {
|
|
8649
|
+
var $disabled = _ref29.$disabled;
|
|
8630
8650
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8631
|
-
}, function (_ref29) {
|
|
8632
|
-
var removeIconBackground = _ref29.removeIconBackground,
|
|
8633
|
-
$type = _ref29.$type,
|
|
8634
|
-
theme = _ref29.theme;
|
|
8635
|
-
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8636
8651
|
}, function (_ref30) {
|
|
8637
|
-
var
|
|
8652
|
+
var removeIconBackground = _ref30.removeIconBackground,
|
|
8653
|
+
$type = _ref30.$type,
|
|
8654
|
+
theme = _ref30.theme;
|
|
8655
|
+
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8656
|
+
}, function (_ref31) {
|
|
8657
|
+
var $disabled = _ref31.$disabled;
|
|
8638
8658
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8639
8659
|
});
|
|
8640
8660
|
var TextWrapper = styled__default.div(_templateObject10$2 || (_templateObject10$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));
|
|
8641
|
-
var Asterisk = styled__default.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 (
|
|
8642
|
-
var theme =
|
|
8661
|
+
var Asterisk = styled__default.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) {
|
|
8662
|
+
var theme = _ref32.theme;
|
|
8643
8663
|
return theme.vms["default"].error;
|
|
8644
8664
|
});
|
|
8645
|
-
var MultiSelectDropdown = function MultiSelectDropdown(
|
|
8646
|
-
var title =
|
|
8647
|
-
titleWeight =
|
|
8648
|
-
titleSize =
|
|
8649
|
-
titleColor =
|
|
8650
|
-
|
|
8651
|
-
labelText =
|
|
8652
|
-
labelStyle =
|
|
8653
|
-
labelColor =
|
|
8654
|
-
|
|
8655
|
-
replaceLabel =
|
|
8656
|
-
options =
|
|
8657
|
-
width =
|
|
8658
|
-
optionWidth =
|
|
8659
|
-
height =
|
|
8660
|
-
placeholder =
|
|
8661
|
-
border =
|
|
8662
|
-
background =
|
|
8663
|
-
selectedOptionBackground =
|
|
8664
|
-
selectedOptionColor =
|
|
8665
|
-
menuBackground =
|
|
8666
|
-
optionsBorderRadius =
|
|
8667
|
-
borderRadius =
|
|
8668
|
-
removeIconBackground =
|
|
8669
|
-
handleSelectChange =
|
|
8670
|
-
selectedOptions =
|
|
8671
|
-
placeholderColor =
|
|
8672
|
-
optionBorder =
|
|
8673
|
-
optionColor =
|
|
8674
|
-
searchIcon =
|
|
8675
|
-
searchbarTextColor =
|
|
8676
|
-
searchBoxBackground =
|
|
8677
|
-
searchBoxBorder =
|
|
8678
|
-
searchBoxBorderRadius =
|
|
8679
|
-
size =
|
|
8680
|
-
removeIcon =
|
|
8681
|
-
type =
|
|
8682
|
-
icon =
|
|
8683
|
-
|
|
8684
|
-
disabled =
|
|
8685
|
-
|
|
8686
|
-
required =
|
|
8687
|
-
|
|
8688
|
-
searchBox =
|
|
8689
|
-
|
|
8690
|
-
NoOptionsText =
|
|
8691
|
-
|
|
8692
|
-
selectAllOption =
|
|
8693
|
-
|
|
8694
|
-
selectAllLabel =
|
|
8665
|
+
var MultiSelectDropdown = function MultiSelectDropdown(_ref33) {
|
|
8666
|
+
var title = _ref33.title,
|
|
8667
|
+
titleWeight = _ref33.titleWeight,
|
|
8668
|
+
titleSize = _ref33.titleSize,
|
|
8669
|
+
titleColor = _ref33.titleColor,
|
|
8670
|
+
_ref33$labelText = _ref33.labelText,
|
|
8671
|
+
labelText = _ref33$labelText === void 0 ? 'Select Cameras' : _ref33$labelText,
|
|
8672
|
+
labelStyle = _ref33.labelStyle,
|
|
8673
|
+
labelColor = _ref33.labelColor,
|
|
8674
|
+
_ref33$replaceLabel = _ref33.replaceLabel,
|
|
8675
|
+
replaceLabel = _ref33$replaceLabel === void 0 ? true : _ref33$replaceLabel,
|
|
8676
|
+
options = _ref33.options,
|
|
8677
|
+
width = _ref33.width,
|
|
8678
|
+
optionWidth = _ref33.optionWidth,
|
|
8679
|
+
height = _ref33.height,
|
|
8680
|
+
placeholder = _ref33.placeholder,
|
|
8681
|
+
border = _ref33.border,
|
|
8682
|
+
background = _ref33.background,
|
|
8683
|
+
selectedOptionBackground = _ref33.selectedOptionBackground,
|
|
8684
|
+
selectedOptionColor = _ref33.selectedOptionColor,
|
|
8685
|
+
menuBackground = _ref33.menuBackground,
|
|
8686
|
+
optionsBorderRadius = _ref33.optionsBorderRadius,
|
|
8687
|
+
borderRadius = _ref33.borderRadius,
|
|
8688
|
+
removeIconBackground = _ref33.removeIconBackground,
|
|
8689
|
+
handleSelectChange = _ref33.handleSelectChange,
|
|
8690
|
+
selectedOptions = _ref33.selectedOptions,
|
|
8691
|
+
placeholderColor = _ref33.placeholderColor,
|
|
8692
|
+
optionBorder = _ref33.optionBorder,
|
|
8693
|
+
optionColor = _ref33.optionColor,
|
|
8694
|
+
searchIcon = _ref33.searchIcon,
|
|
8695
|
+
searchbarTextColor = _ref33.searchbarTextColor,
|
|
8696
|
+
searchBoxBackground = _ref33.searchBoxBackground,
|
|
8697
|
+
searchBoxBorder = _ref33.searchBoxBorder,
|
|
8698
|
+
searchBoxBorderRadius = _ref33.searchBoxBorderRadius,
|
|
8699
|
+
size = _ref33.size,
|
|
8700
|
+
removeIcon = _ref33.removeIcon,
|
|
8701
|
+
type = _ref33.type,
|
|
8702
|
+
icon = _ref33.icon,
|
|
8703
|
+
_ref33$disabled = _ref33.disabled,
|
|
8704
|
+
disabled = _ref33$disabled === void 0 ? false : _ref33$disabled,
|
|
8705
|
+
_ref33$required = _ref33.required,
|
|
8706
|
+
required = _ref33$required === void 0 ? false : _ref33$required,
|
|
8707
|
+
_ref33$searchBox = _ref33.searchBox,
|
|
8708
|
+
searchBox = _ref33$searchBox === void 0 ? true : _ref33$searchBox,
|
|
8709
|
+
_ref33$NoOptionsText = _ref33.NoOptionsText,
|
|
8710
|
+
NoOptionsText = _ref33$NoOptionsText === void 0 ? 'No Options Available' : _ref33$NoOptionsText,
|
|
8711
|
+
_ref33$selectAllOptio = _ref33.selectAllOption,
|
|
8712
|
+
selectAllOption = _ref33$selectAllOptio === void 0 ? false : _ref33$selectAllOptio,
|
|
8713
|
+
_ref33$selectAllLabel = _ref33.selectAllLabel,
|
|
8714
|
+
selectAllLabel = _ref33$selectAllLabel === void 0 ? 'Select All' : _ref33$selectAllLabel,
|
|
8715
|
+
dropdownPosition = _ref33.dropdownPosition;
|
|
8695
8716
|
var themeColors = useTheme();
|
|
8696
8717
|
var _useState = React.useState(false),
|
|
8697
8718
|
dropUp = _useState[0],
|
|
8698
8719
|
setDropUp = _useState[1];
|
|
8699
|
-
var _useState2 = React.useState(
|
|
8700
|
-
|
|
8701
|
-
|
|
8720
|
+
var _useState2 = React.useState('left'),
|
|
8721
|
+
horizontalAlign = _useState2[0],
|
|
8722
|
+
setHorizontalAlign = _useState2[1];
|
|
8723
|
+
var _useState3 = React.useState(false),
|
|
8724
|
+
isOpen = _useState3[0],
|
|
8725
|
+
setIsOpen = _useState3[1];
|
|
8702
8726
|
var dropdownRef = React.useRef(null);
|
|
8703
8727
|
var dropdownButtonRef = React.useRef(null);
|
|
8728
|
+
var dropdownMenuRef = React.useRef(null);
|
|
8704
8729
|
var toggleDropdown = function toggleDropdown() {
|
|
8705
8730
|
if (disabled) return;
|
|
8706
8731
|
var refToUse = dropdownRef.current;
|
|
8707
|
-
if (refToUse) {
|
|
8732
|
+
if (refToUse && !dropdownPosition) {
|
|
8708
8733
|
var rect = refToUse.getBoundingClientRect();
|
|
8709
8734
|
var windowHeight = window.innerHeight;
|
|
8735
|
+
var windowWidth = window.innerWidth;
|
|
8710
8736
|
var spaceBelow = windowHeight - rect.bottom;
|
|
8711
8737
|
var spaceAbove = rect.top;
|
|
8712
8738
|
var dropdownHeight = 156;
|
|
@@ -8715,6 +8741,19 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8715
8741
|
} else {
|
|
8716
8742
|
setDropUp(false);
|
|
8717
8743
|
}
|
|
8744
|
+
var estimatedDropdownWidth = optionWidth ? parseInt(optionWidth) : 200;
|
|
8745
|
+
var spaceRight = windowWidth - rect.left;
|
|
8746
|
+
var spaceLeft = rect.right;
|
|
8747
|
+
var buttonWidth = rect.width;
|
|
8748
|
+
if (spaceRight >= estimatedDropdownWidth) {
|
|
8749
|
+
setHorizontalAlign('left');
|
|
8750
|
+
} else if (spaceLeft >= estimatedDropdownWidth) {
|
|
8751
|
+
setHorizontalAlign('right');
|
|
8752
|
+
} else if (rect.left + buttonWidth / 2 >= estimatedDropdownWidth / 2 && windowWidth - (rect.left + buttonWidth / 2) >= estimatedDropdownWidth / 2) {
|
|
8753
|
+
setHorizontalAlign('center');
|
|
8754
|
+
} else {
|
|
8755
|
+
setHorizontalAlign('left');
|
|
8756
|
+
}
|
|
8718
8757
|
}
|
|
8719
8758
|
setIsOpen(function (prev) {
|
|
8720
8759
|
return !prev;
|
|
@@ -8854,12 +8893,17 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
|
8854
8893
|
weight: '2px',
|
|
8855
8894
|
color: themeColors.vms.text.medium
|
|
8856
8895
|
})), isOpen && React__default.createElement(DropdownMenu, {
|
|
8896
|
+
ref: dropdownMenuRef,
|
|
8857
8897
|
"$width": optionWidth,
|
|
8858
8898
|
"$menuBackground": menuBackground || themeColors.vms.text.white,
|
|
8859
8899
|
"$optionsBorderRadius": optionsBorderRadius,
|
|
8860
|
-
|
|
8900
|
+
"$position": dropdownPosition,
|
|
8901
|
+
style: dropdownPosition ? undefined : {
|
|
8861
8902
|
top: dropUp ? 'auto' : 'calc(100% + 8px)',
|
|
8862
|
-
bottom: dropUp ? 'calc(100% + 8px)' : 'auto'
|
|
8903
|
+
bottom: dropUp ? 'calc(100% + 8px)' : 'auto',
|
|
8904
|
+
left: horizontalAlign === 'left' ? '0' : horizontalAlign === 'center' ? '50%' : 'auto',
|
|
8905
|
+
right: horizontalAlign === 'right' ? '0' : 'auto',
|
|
8906
|
+
transform: horizontalAlign === 'center' ? 'translateX(-50%)' : 'none'
|
|
8863
8907
|
}
|
|
8864
8908
|
}, React__default.createElement(OptionComponent, {
|
|
8865
8909
|
options: computedOptions,
|