@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.
Files changed (2) hide show
  1. package/index.cjs +5 -3
  2. 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
- setInternalSelectedOption(optionList === null || optionList === void 0 ? void 0 : optionList.find(option => option.id === value));
2705
- return;
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 === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id, optionList, isFirstRender]);
2712
+ }, [currentOptionList, setSelectedOptionOnInputValue, value, internalSelectedOption, optionList, isFirstRender]);
2711
2713
  return jsxRuntime.jsxs(SectionContainer, Object.assign({
2712
2714
  onClick: () => {
2713
2715
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/molecules-dropdown",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "main": "./index.cjs",
5
5
  "type": "commonjs",
6
6
  "types": "./src/index.d.ts",