code7-leia 0.1.123 → 0.1.124
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/code7-leia.cjs.development.js +17 -15
- package/dist/code7-leia.cjs.development.js.map +1 -1
- package/dist/code7-leia.cjs.production.min.js +1 -1
- package/dist/code7-leia.cjs.production.min.js.map +1 -1
- package/dist/code7-leia.esm.js +17 -15
- package/dist/code7-leia.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/MultiSelect/index.tsx +15 -17
|
@@ -1009,11 +1009,12 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1009
1009
|
var handleInputKeyPress = function handleInputKeyPress(event) {
|
|
1010
1010
|
if (event.key === 'Enter') {
|
|
1011
1011
|
event.preventDefault();
|
|
1012
|
-
|
|
1013
|
-
|
|
1012
|
+
var trimmedOption = newOption.trim();
|
|
1013
|
+
if (trimmedOption !== '' && !options.some(function (option) {
|
|
1014
|
+
return option.value === trimmedOption;
|
|
1014
1015
|
})) {
|
|
1015
1016
|
setPresset(function (prevPresset) {
|
|
1016
|
-
return [].concat(prevPresset, [
|
|
1017
|
+
return [].concat(prevPresset, [trimmedOption]);
|
|
1017
1018
|
});
|
|
1018
1019
|
}
|
|
1019
1020
|
setNewOption('');
|
|
@@ -1021,7 +1022,18 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1021
1022
|
};
|
|
1022
1023
|
return React__default.createElement("form", null, React__default.createElement(MultiSelectWrapper, null, React__default.createElement(SelectBox, {
|
|
1023
1024
|
onClick: showCheckboxes
|
|
1024
|
-
}, React__default.createElement("select", null,
|
|
1025
|
+
}, React__default.createElement("select", null, presset.map(function (option, index) {
|
|
1026
|
+
return React__default.createElement("option", {
|
|
1027
|
+
key: index,
|
|
1028
|
+
value: option
|
|
1029
|
+
}, option);
|
|
1030
|
+
})), React__default.createElement(OverSelect, null, React__default.createElement("input", {
|
|
1031
|
+
type: "text",
|
|
1032
|
+
placeholder: "Add new option",
|
|
1033
|
+
value: newOption,
|
|
1034
|
+
onChange: handleInputChange,
|
|
1035
|
+
onKeyPress: handleInputKeyPress
|
|
1036
|
+
}))), React__default.createElement(Checkboxes, {
|
|
1025
1037
|
style: {
|
|
1026
1038
|
display: expanded ? 'block' : 'none'
|
|
1027
1039
|
}
|
|
@@ -1037,17 +1049,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1037
1049
|
return handleCheckboxChange(option.value);
|
|
1038
1050
|
}
|
|
1039
1051
|
}), option.label);
|
|
1040
|
-
})
|
|
1041
|
-
type: "text",
|
|
1042
|
-
placeholder: "Add new option",
|
|
1043
|
-
value: newOption,
|
|
1044
|
-
onChange: handleInputChange,
|
|
1045
|
-
onKeyPress: handleInputKeyPress
|
|
1046
|
-
}))), React__default.createElement("div", null, "Selected Options:", presset.map(function (selectedOption, index) {
|
|
1047
|
-
return React__default.createElement("span", {
|
|
1048
|
-
key: index
|
|
1049
|
-
}, selectedOption, ", ");
|
|
1050
|
-
})));
|
|
1052
|
+
}))));
|
|
1051
1053
|
};
|
|
1052
1054
|
|
|
1053
1055
|
var _templateObject$7;
|