karsten-design-system 1.2.58 → 1.2.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/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4366,12 +4366,27 @@ function Select(props) {
|
|
|
4366
4366
|
}
|
|
4367
4367
|
return allOptions.filter((option) => normalize(option.label).includes(normalize(searchText)));
|
|
4368
4368
|
})();
|
|
4369
|
+
// const handleSelect = (option: Option) => {
|
|
4370
|
+
// if (!option) return
|
|
4371
|
+
// if (props.value?.value === option.value) {
|
|
4372
|
+
// props.onChange(null)
|
|
4373
|
+
// setSearchText('')
|
|
4374
|
+
// } else {
|
|
4375
|
+
// props.onChange(option)
|
|
4376
|
+
// if (!hasOnInputChange) {
|
|
4377
|
+
// setSearchText(option.label)
|
|
4378
|
+
// }
|
|
4379
|
+
// }
|
|
4380
|
+
// handleClose()
|
|
4381
|
+
// }
|
|
4369
4382
|
const handleSelect = (option) => {
|
|
4370
4383
|
if (!option)
|
|
4371
4384
|
return;
|
|
4372
4385
|
if (props.value?.value === option.value) {
|
|
4373
4386
|
props.onChange(null);
|
|
4374
|
-
|
|
4387
|
+
if (!hasOnInputChange) {
|
|
4388
|
+
setSearchText('');
|
|
4389
|
+
}
|
|
4375
4390
|
}
|
|
4376
4391
|
else {
|
|
4377
4392
|
props.onChange(option);
|
|
@@ -4381,6 +4396,12 @@ function Select(props) {
|
|
|
4381
4396
|
}
|
|
4382
4397
|
handleClose();
|
|
4383
4398
|
};
|
|
4399
|
+
const handleClose = () => {
|
|
4400
|
+
setIsOpen(false);
|
|
4401
|
+
if (!hasOnInputChange) {
|
|
4402
|
+
setSearchText('');
|
|
4403
|
+
}
|
|
4404
|
+
};
|
|
4384
4405
|
const toggleDropdown = () => {
|
|
4385
4406
|
if (!disabled && !isLoading) {
|
|
4386
4407
|
const newState = !isOpen;
|
|
@@ -4396,10 +4417,10 @@ function Select(props) {
|
|
|
4396
4417
|
}
|
|
4397
4418
|
}
|
|
4398
4419
|
};
|
|
4399
|
-
const handleClose = () => {
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
}
|
|
4420
|
+
// const handleClose = () => {
|
|
4421
|
+
// setIsOpen(false)
|
|
4422
|
+
// setSearchText('')
|
|
4423
|
+
// }
|
|
4403
4424
|
const hasError = !!error && !disabled;
|
|
4404
4425
|
const isInputDisabled = disabled || isLoading;
|
|
4405
4426
|
useEffect(() => {
|