carbon-react 133.0.3 → 133.0.5

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.
@@ -335,7 +335,10 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
335
335
  });
336
336
  }, [childrenList, filterText, getIndexOfMatch, virtualizer]);
337
337
  useEffect(() => {
338
- if (!highlightedValue) {
338
+ // remove the current selected option if the value is cleared
339
+ // this prevents it from remaining highlighted when the list is re-opened
340
+ if ((!highlightedValue || Object.keys(highlightedValue).length === 0) && !isOpen) {
341
+ setCurrentOptionsListIndex(-1);
339
342
  return;
340
343
  }
341
344
  const indexOfMatch = getIndexOfMatch(highlightedValue);
@@ -343,7 +346,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
343
346
  return;
344
347
  }
345
348
  setCurrentOptionsListIndex(indexOfMatch);
346
- }, [getIndexOfMatch, highlightedValue]);
349
+ }, [getIndexOfMatch, highlightedValue, isOpen]);
347
350
 
348
351
  // ensure that the currently-selected option is always visible immediately after
349
352
  // it has been changed
@@ -68,8 +68,9 @@ const StyledSelect = styled.div`
68
68
  ${!hasTextCursor && css`
69
69
  ${StyledInput} {
70
70
  position: absolute;
71
- width: auto;
71
+ width: inherit;
72
72
  opacity: 0;
73
+ padding: 0;
73
74
  }
74
75
  `}
75
76
  `}
@@ -344,7 +344,10 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
344
344
  });
345
345
  }, [childrenList, filterText, getIndexOfMatch, virtualizer]);
346
346
  (0, _react.useEffect)(() => {
347
- if (!highlightedValue) {
347
+ // remove the current selected option if the value is cleared
348
+ // this prevents it from remaining highlighted when the list is re-opened
349
+ if ((!highlightedValue || Object.keys(highlightedValue).length === 0) && !isOpen) {
350
+ setCurrentOptionsListIndex(-1);
348
351
  return;
349
352
  }
350
353
  const indexOfMatch = getIndexOfMatch(highlightedValue);
@@ -352,7 +355,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
352
355
  return;
353
356
  }
354
357
  setCurrentOptionsListIndex(indexOfMatch);
355
- }, [getIndexOfMatch, highlightedValue]);
358
+ }, [getIndexOfMatch, highlightedValue, isOpen]);
356
359
 
357
360
  // ensure that the currently-selected option is always visible immediately after
358
361
  // it has been changed
@@ -77,8 +77,9 @@ const StyledSelect = _styledComponents.default.div`
77
77
  ${!hasTextCursor && (0, _styledComponents.css)`
78
78
  ${_input.default} {
79
79
  position: absolute;
80
- width: auto;
80
+ width: inherit;
81
81
  opacity: 0;
82
+ padding: 0;
82
83
  }
83
84
  `}
84
85
  `}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "133.0.3",
3
+ "version": "133.0.5",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",