@bolttech/molecules-dropdown 0.17.2 → 0.17.3
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 +5 -3
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2701,13 +2701,15 @@ const Dropdown = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
2701
2701
|
}, [internalSelectedOption]);
|
|
2702
2702
|
react.useEffect(() => {
|
|
2703
2703
|
if (value !== (internalSelectedOption === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id)) {
|
|
2704
|
-
|
|
2705
|
-
|
|
2704
|
+
const foundOption = optionList === null || optionList === void 0 ? void 0 : optionList.find(option => option.id === value);
|
|
2705
|
+
setInternalSelectedOption(foundOption);
|
|
2706
|
+
setInputValue((foundOption === null || foundOption === void 0 ? void 0 : foundOption.value) || '');
|
|
2707
|
+
setInputLabel((foundOption === null || foundOption === void 0 ? void 0 : foundOption.label) || '');
|
|
2706
2708
|
}
|
|
2707
2709
|
if (!isFirstRender || currentOptionList.length === 0) return;
|
|
2708
2710
|
setInternalSelectedOption(currentOptionList.find(option => option.id === value));
|
|
2709
2711
|
setIsFirstRender(false);
|
|
2710
|
-
}, [currentOptionList, setSelectedOptionOnInputValue, value, internalSelectedOption
|
|
2712
|
+
}, [currentOptionList, setSelectedOptionOnInputValue, value, internalSelectedOption, optionList, isFirstRender]);
|
|
2711
2713
|
return jsxRuntime.jsxs(SectionContainer, Object.assign({
|
|
2712
2714
|
onClick: () => {
|
|
2713
2715
|
var _a;
|