karsten-design-system 1.1.79 → 1.1.80
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/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4165,17 +4165,29 @@ function Select(props) {
|
|
|
4165
4165
|
.normalize('NFD')
|
|
4166
4166
|
.replace(/[\u0300-\u036f]/g, '')
|
|
4167
4167
|
.toLowerCase();
|
|
4168
|
+
// const filteredOptions = (() => {
|
|
4169
|
+
// if (!hasOnInputChange || (isOpen && searchText.length > 0)) {
|
|
4170
|
+
// return options.filter((option) =>
|
|
4171
|
+
// normalize(option.label).includes(normalize(searchText))
|
|
4172
|
+
// )
|
|
4173
|
+
// }
|
|
4174
|
+
// if (isOpen && props.value) {
|
|
4175
|
+
// return [props.value]
|
|
4176
|
+
// }
|
|
4177
|
+
// return []
|
|
4178
|
+
// })()
|
|
4168
4179
|
const filteredOptions = (() => {
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4180
|
+
const hasSearch = searchText.length > 0;
|
|
4181
|
+
if (hasOnInputChange) {
|
|
4182
|
+
if (isOpen) {
|
|
4183
|
+
if (hasSearch) {
|
|
4184
|
+
return options.filter((option) => normalize(option.label).includes(normalize(searchText)));
|
|
4185
|
+
}
|
|
4186
|
+
return props.value ? [props.value] : [];
|
|
4187
|
+
}
|
|
4188
|
+
return [];
|
|
4177
4189
|
}
|
|
4178
|
-
return
|
|
4190
|
+
return options.filter((option) => normalize(option.label).includes(normalize(searchText)));
|
|
4179
4191
|
})();
|
|
4180
4192
|
const toggleDropdown = () => {
|
|
4181
4193
|
if (!disabled && !isLoading) {
|
|
@@ -4186,7 +4198,6 @@ function Select(props) {
|
|
|
4186
4198
|
setTimeout(() => {
|
|
4187
4199
|
inputRef.current?.focus();
|
|
4188
4200
|
}, 0);
|
|
4189
|
-
setSearchText('');
|
|
4190
4201
|
}
|
|
4191
4202
|
else {
|
|
4192
4203
|
setSearchText(props.value?.label ?? '');
|