@bolttech/molecules-dropdown 0.22.1 → 0.22.2
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/index.cjs +7 -3
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2733,12 +2733,14 @@ const Dropdown = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2733
2733
|
const foundOption = optionList === null || optionList === void 0 ? void 0 : optionList.find(option => option.id === value);
|
|
2734
2734
|
setInternalSelectedOption(foundOption);
|
|
2735
2735
|
setInputValue((foundOption === null || foundOption === void 0 ? void 0 : foundOption.value) || '');
|
|
2736
|
-
|
|
2736
|
+
if (!onKeyUp && !onKeyDown) {
|
|
2737
|
+
setInputLabel((foundOption === null || foundOption === void 0 ? void 0 : foundOption.label) || '');
|
|
2738
|
+
}
|
|
2737
2739
|
}
|
|
2738
2740
|
if (!isFirstRender || currentOptionList.length === 0) return;
|
|
2739
2741
|
setInternalSelectedOption(currentOptionList.find(option => option.id === value));
|
|
2740
2742
|
setIsFirstRender(false);
|
|
2741
|
-
}, [currentOptionList, setSelectedOptionOnInputValue, value, internalSelectedOption, optionList, isFirstRender]);
|
|
2743
|
+
}, [currentOptionList, setSelectedOptionOnInputValue, value, internalSelectedOption, optionList, isFirstRender, onKeyUp, onKeyDown]);
|
|
2742
2744
|
return jsxRuntime.jsxs(SectionContainer, Object.assign({
|
|
2743
2745
|
"$variant": variant,
|
|
2744
2746
|
id: `${id}-container`,
|
|
@@ -2860,7 +2862,9 @@ const DropdownWithHeaders = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2860
2862
|
})[0]) || undefined;
|
|
2861
2863
|
setInternalSelectedOption(option);
|
|
2862
2864
|
setInputValue((option === null || option === void 0 ? void 0 : option.value) || '');
|
|
2863
|
-
|
|
2865
|
+
if (!onKeyUp && !onKeyDown) {
|
|
2866
|
+
setInputLabel((option === null || option === void 0 ? void 0 : option.label) || '');
|
|
2867
|
+
}
|
|
2864
2868
|
return;
|
|
2865
2869
|
}
|
|
2866
2870
|
if (!isFirstRender || currentOptionList.length === 0) return;
|