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