labsense-ui-kit 1.3.57 → 1.3.59
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 +2 -0
- package/dist/index.js +161 -122
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +161 -122
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,8 @@ interface MultiSelectDropdownProps {
|
|
|
56
56
|
required?: boolean;
|
|
57
57
|
searchBox?: boolean;
|
|
58
58
|
NoOptionsText?: string;
|
|
59
|
+
selectAllOption?: boolean;
|
|
60
|
+
selectAllLabel?: string;
|
|
59
61
|
}
|
|
60
62
|
declare const MultiSelectDropdown: React.FC<MultiSelectDropdownProps>;
|
|
61
63
|
export default MultiSelectDropdown;
|
package/dist/index.js
CHANGED
|
@@ -7945,11 +7945,16 @@ var OptionComponent = function OptionComponent(_ref9) {
|
|
|
7945
7945
|
}) : [].concat(selectedOptions, [currentOption]);
|
|
7946
7946
|
onChange === null || onChange === void 0 ? void 0 : onChange(newOption);
|
|
7947
7947
|
};
|
|
7948
|
-
var
|
|
7949
|
-
return a.labelText.localeCompare(b.labelText);
|
|
7950
|
-
}).filter(function (option) {
|
|
7948
|
+
var filteredOptions = options.filter(function (option) {
|
|
7951
7949
|
return option.labelText.toLowerCase().includes(searchQuery.toLowerCase());
|
|
7952
7950
|
});
|
|
7951
|
+
var firstOption = filteredOptions[0],
|
|
7952
|
+
restOptions = filteredOptions.slice(1);
|
|
7953
|
+
var finalOptions = (firstOption === null || firstOption === void 0 ? void 0 : firstOption.value) === '__SELECT_ALL__' ? [firstOption].concat(restOptions.sort(function (a, b) {
|
|
7954
|
+
return a.labelText.localeCompare(b.labelText);
|
|
7955
|
+
})) : filteredOptions.sort(function (a, b) {
|
|
7956
|
+
return a.labelText.localeCompare(b.labelText);
|
|
7957
|
+
});
|
|
7953
7958
|
return React__default.createElement(Container, {
|
|
7954
7959
|
"$flexDirection": 'column',
|
|
7955
7960
|
"$gap": '8px',
|
|
@@ -7970,18 +7975,22 @@ var OptionComponent = function OptionComponent(_ref9) {
|
|
|
7970
7975
|
onChange: handleSearchChange,
|
|
7971
7976
|
"$inputColor": searchbarTextColor,
|
|
7972
7977
|
"$placeholderColor": placeholderColor
|
|
7973
|
-
})), React__default.createElement(OptionContainer, null,
|
|
7978
|
+
})), React__default.createElement(OptionContainer, null, finalOptions.length > 0 ? finalOptions.map(function (option, id) {
|
|
7974
7979
|
return React__default.createElement(OptionItem, {
|
|
7975
7980
|
key: option.value,
|
|
7976
7981
|
"$optionBorder": optionBorder,
|
|
7977
|
-
"$isborder": id !==
|
|
7982
|
+
"$isborder": id !== finalOptions.length - 1
|
|
7978
7983
|
}, React__default.createElement(OptionLabel, {
|
|
7979
7984
|
htmlFor: option.value,
|
|
7980
7985
|
"$optionColor": optionColor
|
|
7981
7986
|
}, React__default.createElement("input", {
|
|
7982
7987
|
id: option.value,
|
|
7983
7988
|
type: 'checkbox',
|
|
7984
|
-
checked:
|
|
7989
|
+
checked: option.value === '__SELECT_ALL__' ? options.filter(function (o) {
|
|
7990
|
+
return o.value !== '__SELECT_ALL__';
|
|
7991
|
+
}).every(function (o) {
|
|
7992
|
+
return selectedOptions.includes(o.value);
|
|
7993
|
+
}) : selectedOptions.includes(option.value),
|
|
7985
7994
|
onChange: function onChange() {
|
|
7986
7995
|
return handleOptionToggle(option.value);
|
|
7987
7996
|
}
|
|
@@ -7994,7 +8003,7 @@ var OptionComponent = function OptionComponent(_ref9) {
|
|
|
7994
8003
|
};
|
|
7995
8004
|
|
|
7996
8005
|
var _templateObject$b, _templateObject2$8, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$4, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject10$2, _templateObject11$2;
|
|
7997
|
-
var DropdownContainer = styled__default.div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n max-width: 100%;\n position: relative;\n max-height: ", ";\n"])), function (_ref) {
|
|
8006
|
+
var DropdownContainer = styled__default.div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n max-width: 100%;\n position: relative;\n // max-height: ", ";\n max-height: ", ";\n"])), function (_ref) {
|
|
7998
8007
|
var $width = _ref.$width;
|
|
7999
8008
|
return $width || '100%';
|
|
8000
8009
|
}, function (_ref2) {
|
|
@@ -8003,12 +8012,15 @@ var DropdownContainer = styled__default.div(_templateObject$b || (_templateObjec
|
|
|
8003
8012
|
}, function (_ref3) {
|
|
8004
8013
|
var $replaceLabel = _ref3.$replaceLabel;
|
|
8005
8014
|
return $replaceLabel ? 'calc(100% - 22px)' : '';
|
|
8015
|
+
}, function (_ref4) {
|
|
8016
|
+
var $hasTitle = _ref4.$hasTitle;
|
|
8017
|
+
return $hasTitle ? 'calc(100% - 22px)' : '100%';
|
|
8006
8018
|
});
|
|
8007
|
-
var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2$8 = _taggedTemplateLiteralLoose(["\n overflow: ", ";\n padding: ", ";\n gap: 8px;\n box-sizing: border-box;\n transition: all 0.3s ease;\n width: ", ";\n height: ", ";\n border: ", ";\n border-radius: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: ", ";\n background: ", ";\n color: ", ";\n font-weight: 400;\n font-size: ", ";\n line-height: ", ";\n"])), function (
|
|
8008
|
-
var $replaceLabel =
|
|
8019
|
+
var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2$8 = _taggedTemplateLiteralLoose(["\n overflow: ", ";\n padding: ", ";\n gap: 8px;\n box-sizing: border-box;\n transition: all 0.3s ease;\n width: ", ";\n height: ", ";\n border: ", ";\n border-radius: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: ", ";\n background: ", ";\n color: ", ";\n font-weight: 400;\n font-size: ", ";\n line-height: ", ";\n"])), function (_ref5) {
|
|
8020
|
+
var $replaceLabel = _ref5.$replaceLabel;
|
|
8009
8021
|
return $replaceLabel ? 'auto' : '';
|
|
8010
|
-
}, function (
|
|
8011
|
-
var $size =
|
|
8022
|
+
}, function (_ref6) {
|
|
8023
|
+
var $size = _ref6.$size;
|
|
8012
8024
|
switch ($size) {
|
|
8013
8025
|
case 'small':
|
|
8014
8026
|
return '9px 12px';
|
|
@@ -8017,27 +8029,27 @@ var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2
|
|
|
8017
8029
|
default:
|
|
8018
8030
|
return '14px 12px';
|
|
8019
8031
|
}
|
|
8020
|
-
}, function (_ref6) {
|
|
8021
|
-
var $width = _ref6.$width;
|
|
8022
|
-
return $width ? $width : '100%';
|
|
8023
8032
|
}, function (_ref7) {
|
|
8024
|
-
var $
|
|
8025
|
-
return $
|
|
8033
|
+
var $width = _ref7.$width;
|
|
8034
|
+
return $width ? $width : '100%';
|
|
8026
8035
|
}, function (_ref8) {
|
|
8027
|
-
var $
|
|
8028
|
-
|
|
8029
|
-
theme = _ref8.theme;
|
|
8030
|
-
return $isOpen ? "1px solid " + theme.vms.text.dark : $border || "1px solid " + theme.vms.border.light;
|
|
8036
|
+
var $height = _ref8.$height;
|
|
8037
|
+
return $height || '100%';
|
|
8031
8038
|
}, function (_ref9) {
|
|
8032
|
-
var $
|
|
8033
|
-
|
|
8039
|
+
var $border = _ref9.$border,
|
|
8040
|
+
$isOpen = _ref9.$isOpen,
|
|
8041
|
+
theme = _ref9.theme;
|
|
8042
|
+
return $isOpen ? "1px solid " + theme.vms.text.dark : $border || "1px solid " + theme.vms.border.light;
|
|
8034
8043
|
}, function (_ref10) {
|
|
8035
|
-
var $
|
|
8036
|
-
return $
|
|
8044
|
+
var $borderRadius = _ref10.$borderRadius;
|
|
8045
|
+
return $borderRadius || '8px';
|
|
8037
8046
|
}, function (_ref11) {
|
|
8038
|
-
var $
|
|
8039
|
-
|
|
8040
|
-
|
|
8047
|
+
var $disabled = _ref11.$disabled;
|
|
8048
|
+
return $disabled ? 'not-allowed' : 'pointer';
|
|
8049
|
+
}, function (_ref12) {
|
|
8050
|
+
var $background = _ref12.$background,
|
|
8051
|
+
$disabled = _ref12.$disabled,
|
|
8052
|
+
theme = _ref12.theme;
|
|
8041
8053
|
switch ($background) {
|
|
8042
8054
|
case 'dark':
|
|
8043
8055
|
return $disabled ? theme.vms.disabled.secondary : theme.vms.text.dark;
|
|
@@ -8058,12 +8070,12 @@ var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2
|
|
|
8058
8070
|
default:
|
|
8059
8071
|
return $disabled ? theme.vms.disabled.secondary : $background;
|
|
8060
8072
|
}
|
|
8061
|
-
}, function (_ref12) {
|
|
8062
|
-
var $color = _ref12.$color,
|
|
8063
|
-
theme = _ref12.theme;
|
|
8064
|
-
return $color || theme.vms.text.medium;
|
|
8065
8073
|
}, function (_ref13) {
|
|
8066
|
-
var $
|
|
8074
|
+
var $color = _ref13.$color,
|
|
8075
|
+
theme = _ref13.theme;
|
|
8076
|
+
return $color || theme.vms.text.medium;
|
|
8077
|
+
}, function (_ref14) {
|
|
8078
|
+
var $size = _ref14.$size;
|
|
8067
8079
|
switch ($size) {
|
|
8068
8080
|
case 'small':
|
|
8069
8081
|
return '12px';
|
|
@@ -8072,8 +8084,8 @@ var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2
|
|
|
8072
8084
|
default:
|
|
8073
8085
|
return '14px';
|
|
8074
8086
|
}
|
|
8075
|
-
}, function (
|
|
8076
|
-
var $size =
|
|
8087
|
+
}, function (_ref15) {
|
|
8088
|
+
var $size = _ref15.$size;
|
|
8077
8089
|
switch ($size) {
|
|
8078
8090
|
case 'small':
|
|
8079
8091
|
return '12px';
|
|
@@ -8083,20 +8095,20 @@ var DropdownButton = styled__default.div(_templateObject2$8 || (_templateObject2
|
|
|
8083
8095
|
return '14px';
|
|
8084
8096
|
}
|
|
8085
8097
|
});
|
|
8086
|
-
var TitleText = styled__default.div(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n width: max-content;\n position: relative;\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n color: ", ";\n"])), function (
|
|
8087
|
-
var $titleWeight =
|
|
8098
|
+
var TitleText = styled__default.div(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n width: max-content;\n position: relative;\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n color: ", ";\n"])), function (_ref16) {
|
|
8099
|
+
var $titleWeight = _ref16.$titleWeight;
|
|
8088
8100
|
return $titleWeight != null ? $titleWeight : '500';
|
|
8089
|
-
}, function (_ref16) {
|
|
8090
|
-
var $titleSize = _ref16.$titleSize,
|
|
8091
|
-
$size = _ref16.$size;
|
|
8092
|
-
return $titleSize ? $titleSize + "px" : $size === 'small' ? '14px' : $size === 'large' ? '18px' : '16px';
|
|
8093
8101
|
}, function (_ref17) {
|
|
8094
8102
|
var $titleSize = _ref17.$titleSize,
|
|
8095
8103
|
$size = _ref17.$size;
|
|
8096
8104
|
return $titleSize ? $titleSize + "px" : $size === 'small' ? '14px' : $size === 'large' ? '18px' : '16px';
|
|
8097
8105
|
}, function (_ref18) {
|
|
8098
|
-
var $
|
|
8099
|
-
|
|
8106
|
+
var $titleSize = _ref18.$titleSize,
|
|
8107
|
+
$size = _ref18.$size;
|
|
8108
|
+
return $titleSize ? $titleSize + "px" : $size === 'small' ? '14px' : $size === 'large' ? '18px' : '16px';
|
|
8109
|
+
}, function (_ref19) {
|
|
8110
|
+
var $titleColor = _ref19.$titleColor,
|
|
8111
|
+
theme = _ref19.theme;
|
|
8100
8112
|
switch ($titleColor) {
|
|
8101
8113
|
case 'dark':
|
|
8102
8114
|
return theme.vms.text.dark;
|
|
@@ -8119,33 +8131,33 @@ var TitleText = styled__default.div(_templateObject3$5 || (_templateObject3$5 =
|
|
|
8119
8131
|
}
|
|
8120
8132
|
});
|
|
8121
8133
|
var Container$2 = styled__default.div(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 8px;\n"])));
|
|
8122
|
-
var LabelText = styled__default.div(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 400;\n font-style:", ";\n color: ", ";\n"])), function (
|
|
8123
|
-
var $labelStyle =
|
|
8134
|
+
var LabelText = styled__default.div(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 400;\n font-style:", ";\n color: ", ";\n"])), function (_ref20) {
|
|
8135
|
+
var $labelStyle = _ref20.$labelStyle;
|
|
8124
8136
|
return $labelStyle;
|
|
8125
|
-
}, function (
|
|
8126
|
-
var $labelColor =
|
|
8127
|
-
theme =
|
|
8137
|
+
}, function (_ref21) {
|
|
8138
|
+
var $labelColor = _ref21.$labelColor,
|
|
8139
|
+
theme = _ref21.theme;
|
|
8128
8140
|
return $labelColor || theme.vms.text.medium;
|
|
8129
8141
|
});
|
|
8130
|
-
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 (
|
|
8131
|
-
var theme =
|
|
8142
|
+
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) {
|
|
8143
|
+
var theme = _ref22.theme;
|
|
8132
8144
|
return "1px solid " + theme.vms.border.light;
|
|
8133
|
-
}, function (_ref22) {
|
|
8134
|
-
var $optionsBorderRadius = _ref22.$optionsBorderRadius;
|
|
8135
|
-
return $optionsBorderRadius || '8px';
|
|
8136
8145
|
}, function (_ref23) {
|
|
8137
|
-
var $
|
|
8138
|
-
return $
|
|
8146
|
+
var $optionsBorderRadius = _ref23.$optionsBorderRadius;
|
|
8147
|
+
return $optionsBorderRadius || '8px';
|
|
8139
8148
|
}, function (_ref24) {
|
|
8140
|
-
var $
|
|
8141
|
-
|
|
8149
|
+
var $width = _ref24.$width;
|
|
8150
|
+
return $width ? $width : 'max-content';
|
|
8151
|
+
}, function (_ref25) {
|
|
8152
|
+
var $menuBackground = _ref25.$menuBackground,
|
|
8153
|
+
theme = _ref25.theme;
|
|
8142
8154
|
return $menuBackground || theme.vms.accent.light_2;
|
|
8143
8155
|
});
|
|
8144
8156
|
var SelectedOptionsWrapper = styled__default.div(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n height: 100%;\n"])));
|
|
8145
|
-
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 (
|
|
8146
|
-
var $selectedOptionBackground =
|
|
8147
|
-
$disabled =
|
|
8148
|
-
theme =
|
|
8157
|
+
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 (_ref26) {
|
|
8158
|
+
var $selectedOptionBackground = _ref26.$selectedOptionBackground,
|
|
8159
|
+
$disabled = _ref26.$disabled,
|
|
8160
|
+
theme = _ref26.theme;
|
|
8149
8161
|
switch ($selectedOptionBackground) {
|
|
8150
8162
|
case 'dark':
|
|
8151
8163
|
return theme.vms.text.dark;
|
|
@@ -8166,9 +8178,9 @@ var SelectedOptionDiv = styled__default.div(_templateObject8$2 || (_templateObje
|
|
|
8166
8178
|
default:
|
|
8167
8179
|
return $selectedOptionBackground || theme.vms.accent.light_2;
|
|
8168
8180
|
}
|
|
8169
|
-
}, function (
|
|
8170
|
-
var $selectedOptionColor =
|
|
8171
|
-
theme =
|
|
8181
|
+
}, function (_ref27) {
|
|
8182
|
+
var $selectedOptionColor = _ref27.$selectedOptionColor,
|
|
8183
|
+
theme = _ref27.theme;
|
|
8172
8184
|
switch ($selectedOptionColor) {
|
|
8173
8185
|
case 'dark':
|
|
8174
8186
|
return theme.vms.text.dark;
|
|
@@ -8190,69 +8202,73 @@ var SelectedOptionDiv = styled__default.div(_templateObject8$2 || (_templateObje
|
|
|
8190
8202
|
return $selectedOptionColor;
|
|
8191
8203
|
}
|
|
8192
8204
|
});
|
|
8193
|
-
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 (
|
|
8194
|
-
var $disabled =
|
|
8205
|
+
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 (_ref28) {
|
|
8206
|
+
var $disabled = _ref28.$disabled;
|
|
8195
8207
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8196
|
-
}, function (_ref28) {
|
|
8197
|
-
var removeIconBackground = _ref28.removeIconBackground,
|
|
8198
|
-
$type = _ref28.$type,
|
|
8199
|
-
theme = _ref28.theme;
|
|
8200
|
-
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8201
8208
|
}, function (_ref29) {
|
|
8202
|
-
var
|
|
8209
|
+
var removeIconBackground = _ref29.removeIconBackground,
|
|
8210
|
+
$type = _ref29.$type,
|
|
8211
|
+
theme = _ref29.theme;
|
|
8212
|
+
return removeIconBackground ? removeIconBackground : $type === 'remove' ? '#5E5E5E24' : theme.vms.disabled.primary;
|
|
8213
|
+
}, function (_ref30) {
|
|
8214
|
+
var $disabled = _ref30.$disabled;
|
|
8203
8215
|
return $disabled ? 'not-allowed' : 'pointer';
|
|
8204
8216
|
});
|
|
8205
8217
|
var TextWrapper = styled__default.div(_templateObject10$2 || (_templateObject10$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));
|
|
8206
|
-
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 (
|
|
8207
|
-
var theme =
|
|
8218
|
+
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 (_ref31) {
|
|
8219
|
+
var theme = _ref31.theme;
|
|
8208
8220
|
return theme.vms["default"].error;
|
|
8209
8221
|
});
|
|
8210
|
-
var MultiSelectDropdown = function MultiSelectDropdown(
|
|
8211
|
-
var title =
|
|
8212
|
-
titleWeight =
|
|
8213
|
-
titleSize =
|
|
8214
|
-
titleColor =
|
|
8215
|
-
|
|
8216
|
-
labelText =
|
|
8217
|
-
labelStyle =
|
|
8218
|
-
labelColor =
|
|
8219
|
-
|
|
8220
|
-
replaceLabel =
|
|
8221
|
-
options =
|
|
8222
|
-
width =
|
|
8223
|
-
optionWidth =
|
|
8224
|
-
height =
|
|
8225
|
-
placeholder =
|
|
8226
|
-
border =
|
|
8227
|
-
background =
|
|
8228
|
-
selectedOptionBackground =
|
|
8229
|
-
selectedOptionColor =
|
|
8230
|
-
menuBackground =
|
|
8231
|
-
optionsBorderRadius =
|
|
8232
|
-
borderRadius =
|
|
8233
|
-
removeIconBackground =
|
|
8234
|
-
handleSelectChange =
|
|
8235
|
-
selectedOptions =
|
|
8236
|
-
placeholderColor =
|
|
8237
|
-
optionBorder =
|
|
8238
|
-
optionColor =
|
|
8239
|
-
searchIcon =
|
|
8240
|
-
searchbarTextColor =
|
|
8241
|
-
searchBoxBackground =
|
|
8242
|
-
searchBoxBorder =
|
|
8243
|
-
searchBoxBorderRadius =
|
|
8244
|
-
size =
|
|
8245
|
-
removeIcon =
|
|
8246
|
-
type =
|
|
8247
|
-
icon =
|
|
8248
|
-
|
|
8249
|
-
disabled =
|
|
8250
|
-
|
|
8251
|
-
required =
|
|
8252
|
-
|
|
8253
|
-
searchBox =
|
|
8254
|
-
|
|
8255
|
-
NoOptionsText =
|
|
8222
|
+
var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
|
|
8223
|
+
var title = _ref32.title,
|
|
8224
|
+
titleWeight = _ref32.titleWeight,
|
|
8225
|
+
titleSize = _ref32.titleSize,
|
|
8226
|
+
titleColor = _ref32.titleColor,
|
|
8227
|
+
_ref32$labelText = _ref32.labelText,
|
|
8228
|
+
labelText = _ref32$labelText === void 0 ? 'Select Cameras' : _ref32$labelText,
|
|
8229
|
+
labelStyle = _ref32.labelStyle,
|
|
8230
|
+
labelColor = _ref32.labelColor,
|
|
8231
|
+
_ref32$replaceLabel = _ref32.replaceLabel,
|
|
8232
|
+
replaceLabel = _ref32$replaceLabel === void 0 ? true : _ref32$replaceLabel,
|
|
8233
|
+
options = _ref32.options,
|
|
8234
|
+
width = _ref32.width,
|
|
8235
|
+
optionWidth = _ref32.optionWidth,
|
|
8236
|
+
height = _ref32.height,
|
|
8237
|
+
placeholder = _ref32.placeholder,
|
|
8238
|
+
border = _ref32.border,
|
|
8239
|
+
background = _ref32.background,
|
|
8240
|
+
selectedOptionBackground = _ref32.selectedOptionBackground,
|
|
8241
|
+
selectedOptionColor = _ref32.selectedOptionColor,
|
|
8242
|
+
menuBackground = _ref32.menuBackground,
|
|
8243
|
+
optionsBorderRadius = _ref32.optionsBorderRadius,
|
|
8244
|
+
borderRadius = _ref32.borderRadius,
|
|
8245
|
+
removeIconBackground = _ref32.removeIconBackground,
|
|
8246
|
+
handleSelectChange = _ref32.handleSelectChange,
|
|
8247
|
+
selectedOptions = _ref32.selectedOptions,
|
|
8248
|
+
placeholderColor = _ref32.placeholderColor,
|
|
8249
|
+
optionBorder = _ref32.optionBorder,
|
|
8250
|
+
optionColor = _ref32.optionColor,
|
|
8251
|
+
searchIcon = _ref32.searchIcon,
|
|
8252
|
+
searchbarTextColor = _ref32.searchbarTextColor,
|
|
8253
|
+
searchBoxBackground = _ref32.searchBoxBackground,
|
|
8254
|
+
searchBoxBorder = _ref32.searchBoxBorder,
|
|
8255
|
+
searchBoxBorderRadius = _ref32.searchBoxBorderRadius,
|
|
8256
|
+
size = _ref32.size,
|
|
8257
|
+
removeIcon = _ref32.removeIcon,
|
|
8258
|
+
type = _ref32.type,
|
|
8259
|
+
icon = _ref32.icon,
|
|
8260
|
+
_ref32$disabled = _ref32.disabled,
|
|
8261
|
+
disabled = _ref32$disabled === void 0 ? false : _ref32$disabled,
|
|
8262
|
+
_ref32$required = _ref32.required,
|
|
8263
|
+
required = _ref32$required === void 0 ? false : _ref32$required,
|
|
8264
|
+
_ref32$searchBox = _ref32.searchBox,
|
|
8265
|
+
searchBox = _ref32$searchBox === void 0 ? true : _ref32$searchBox,
|
|
8266
|
+
_ref32$NoOptionsText = _ref32.NoOptionsText,
|
|
8267
|
+
NoOptionsText = _ref32$NoOptionsText === void 0 ? 'No Options Available' : _ref32$NoOptionsText,
|
|
8268
|
+
_ref32$selectAllOptio = _ref32.selectAllOption,
|
|
8269
|
+
selectAllOption = _ref32$selectAllOptio === void 0 ? false : _ref32$selectAllOptio,
|
|
8270
|
+
_ref32$selectAllLabel = _ref32.selectAllLabel,
|
|
8271
|
+
selectAllLabel = _ref32$selectAllLabel === void 0 ? 'Select All' : _ref32$selectAllLabel;
|
|
8256
8272
|
var themeColors = useTheme();
|
|
8257
8273
|
var _useState = React.useState(false),
|
|
8258
8274
|
dropUp = _useState[0],
|
|
@@ -8303,6 +8319,29 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref31) {
|
|
|
8303
8319
|
}));
|
|
8304
8320
|
}
|
|
8305
8321
|
};
|
|
8322
|
+
var SELECT_ALL_VALUE = '__SELECT_ALL__';
|
|
8323
|
+
var computedOptions = React__default.useMemo(function () {
|
|
8324
|
+
if (!selectAllOption) return options;
|
|
8325
|
+
return [{
|
|
8326
|
+
value: SELECT_ALL_VALUE,
|
|
8327
|
+
labelText: selectAllLabel
|
|
8328
|
+
}].concat(options);
|
|
8329
|
+
}, [options, selectAllOption, selectAllLabel]);
|
|
8330
|
+
var allOptionValues = options.map(function (opt) {
|
|
8331
|
+
return opt.value;
|
|
8332
|
+
});
|
|
8333
|
+
var handleOptionChange = function handleOptionChange(values) {
|
|
8334
|
+
if (values.includes(SELECT_ALL_VALUE)) {
|
|
8335
|
+
var isAllSelected = allOptionValues.every(function (v) {
|
|
8336
|
+
return selectedOptions.includes(v);
|
|
8337
|
+
});
|
|
8338
|
+
handleSelectChange(isAllSelected ? [] : allOptionValues);
|
|
8339
|
+
return;
|
|
8340
|
+
}
|
|
8341
|
+
handleSelectChange(values.filter(function (v) {
|
|
8342
|
+
return v !== SELECT_ALL_VALUE;
|
|
8343
|
+
}));
|
|
8344
|
+
};
|
|
8306
8345
|
return React__default.createElement(Container$2, null, title && React__default.createElement(TitleText, {
|
|
8307
8346
|
"$titleColor": titleColor || themeColors.vms.text.dark,
|
|
8308
8347
|
"$titleSize": titleSize,
|
|
@@ -8312,7 +8351,7 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref31) {
|
|
|
8312
8351
|
ref: dropdownRef,
|
|
8313
8352
|
"$width": width,
|
|
8314
8353
|
"$height": height,
|
|
8315
|
-
"$
|
|
8354
|
+
"$hasTitle": !!title
|
|
8316
8355
|
}, React__default.createElement(DropdownButton, {
|
|
8317
8356
|
onClick: toggleDropdown,
|
|
8318
8357
|
"$height": height,
|
|
@@ -8368,9 +8407,9 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref31) {
|
|
|
8368
8407
|
bottom: dropUp ? 'calc(100% + 8px)' : 'auto'
|
|
8369
8408
|
}
|
|
8370
8409
|
}, React__default.createElement(OptionComponent, {
|
|
8371
|
-
options:
|
|
8410
|
+
options: computedOptions,
|
|
8372
8411
|
selectedOptions: selectedOptions,
|
|
8373
|
-
onChange:
|
|
8412
|
+
onChange: handleOptionChange,
|
|
8374
8413
|
placeholder: placeholder,
|
|
8375
8414
|
placeholderColor: placeholderColor,
|
|
8376
8415
|
optionBorder: optionBorder,
|