@bolttech/molecules-dropdown 0.33.0 → 0.33.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.
Files changed (2) hide show
  1. package/index.cjs +25 -11
  2. package/package.json +2 -2
package/index.cjs CHANGED
@@ -2272,7 +2272,7 @@ const ClickableElement = /*#__PURE__*/styled__default["default"].div.withConfig(
2272
2272
  const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withConfig({
2273
2273
  displayName: "molecules-dropdownstyles__ContainerDropdown",
2274
2274
  componentId: "sc-3wugi4-1"
2275
- })(["display:flex;padding-top:", ";padding-bottom:", ";padding-right:", ";padding-left:", ";gap:", ";background-color:", ";outline:", ";border-radius:", ";box-shadow:", ";margin-bottom:", ";input{display:inline-block;text-overflow:ellipsis;white-space:nowrap;width:100%;overflow-x:hidden;}.fieldLabel{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}.requiredLabel{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}label.material-symbols-sharp{color:", ";}&:focus-within{background-color:", ";outline:", ";", "}", " ", ""], ({
2275
+ })(["display:flex;padding-top:", ";padding-bottom:", ";padding-right:", ";padding-left:", ";gap:", ";background-color:", ";outline:", ";outline-offset:calc(", "* -1);border-radius:", ";box-shadow:", ";margin-bottom:", ";input{display:inline-block;text-overflow:ellipsis;white-space:nowrap;width:100%;overflow-x:hidden;}.fieldLabel{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}.requiredLabel{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}label.material-symbols-sharp{color:", ";}&:focus-within{background-color:", ";outline:", ";", "}", " ", ""], ({
2276
2276
  theme
2277
2277
  }) => theme.components.dropdown.paddingVertical, ({
2278
2278
  theme
@@ -2290,6 +2290,8 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2290
2290
  $variant
2291
2291
  }) => `${theme.components.dropdown.borderWidth.default} solid ${theme.components.dropdown[$variant].container.border.default}`, ({
2292
2292
  theme
2293
+ }) => theme.components.dropdown.borderWidth.default, ({
2294
+ theme
2293
2295
  }) => theme.components.dropdown.borderRadius, ({
2294
2296
  theme: {
2295
2297
  effects: {
@@ -2764,12 +2766,18 @@ const Dropdown = /*#__PURE__*/react.forwardRef((_a, ref) => {
2764
2766
  // eslint-disable-next-line react-hooks/exhaustive-deps
2765
2767
  }, [internalSelectedOption]);
2766
2768
  react.useEffect(() => {
2767
- if (value && value !== (internalSelectedOption === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id)) {
2769
+ if (value !== (internalSelectedOption === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id)) {
2768
2770
  const foundOption = optionList === null || optionList === void 0 ? void 0 : optionList.find(option => option.id === value);
2769
- setInternalSelectedOption(foundOption);
2770
- setInputValue((foundOption === null || foundOption === void 0 ? void 0 : foundOption.value) || '');
2771
- if (!asyncOptionList) {
2772
- setInputLabel((foundOption === null || foundOption === void 0 ? void 0 : foundOption.label) || '');
2771
+ if (!value && internalSelectedOption) {
2772
+ setInternalSelectedOption(undefined);
2773
+ setInputValue('');
2774
+ setInputLabel('');
2775
+ } else if (foundOption) {
2776
+ setInternalSelectedOption(foundOption);
2777
+ setInputValue((foundOption === null || foundOption === void 0 ? void 0 : foundOption.value) || '');
2778
+ if (!asyncOptionList) {
2779
+ setInputLabel((foundOption === null || foundOption === void 0 ? void 0 : foundOption.label) || '');
2780
+ }
2773
2781
  }
2774
2782
  }
2775
2783
  if (!isFirstRender || currentOptionList.length === 0) return;
@@ -2915,14 +2923,20 @@ const DropdownWithHeaders = /*#__PURE__*/react.forwardRef((_a, ref) => {
2915
2923
  // eslint-disable-next-line react-hooks/exhaustive-deps
2916
2924
  }, [internalSelectedOption]);
2917
2925
  react.useEffect(() => {
2918
- if (value && value !== (internalSelectedOption === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id)) {
2926
+ if (value !== (internalSelectedOption === null || internalSelectedOption === void 0 ? void 0 : internalSelectedOption.id)) {
2919
2927
  const option = optionList === null || optionList === void 0 ? void 0 : optionList.map(currentOptionsList => {
2920
2928
  return currentOptionsList.options.find(option => option.id === value);
2921
2929
  }).find(item => !!item);
2922
- setInternalSelectedOption(option);
2923
- setInputValue((option === null || option === void 0 ? void 0 : option.value) || '');
2924
- if (!asyncOptionList) {
2925
- setInputLabel((option === null || option === void 0 ? void 0 : option.label) || '');
2930
+ if (!value && internalSelectedOption) {
2931
+ setInternalSelectedOption(undefined);
2932
+ setInputValue('');
2933
+ setInputLabel('');
2934
+ } else if (option) {
2935
+ setInternalSelectedOption(option);
2936
+ setInputValue((option === null || option === void 0 ? void 0 : option.value) || '');
2937
+ if (!asyncOptionList) {
2938
+ setInputLabel((option === null || option === void 0 ? void 0 : option.label) || '');
2939
+ }
2926
2940
  }
2927
2941
  return;
2928
2942
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/molecules-dropdown",
3
- "version": "0.33.0",
3
+ "version": "0.33.2",
4
4
  "main": "./index.cjs",
5
5
  "type": "commonjs",
6
6
  "types": "./src/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "@bolttech/atoms-input": "0.27.0",
10
10
  "@bolttech/atoms-select": "0.24.0",
11
11
  "@bolttech/default-theme": "0.10.0",
12
- "@bolttech/form-engine": "3.1.0-beta.13",
12
+ "@bolttech/form-engine": "3.1.0-beta.21",
13
13
  "@bolttech/frontend-foundations": "0.10.0",
14
14
  "@bolttech/ui-utils": "0.5.0",
15
15
  "react": "18.2.0",