@momentum-design/components 0.133.0 → 0.133.1

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.
@@ -343,9 +343,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
343
343
  this.lastCommittedValue = value;
344
344
  this.internals.setFormValue(this.value);
345
345
  this.updateHiddenOptions();
346
- if (option) {
347
- this.updateSelectedOption(option);
348
- }
346
+ this.updateSelectedOption(option);
347
+ this.resetFocusedOption();
349
348
  this.setInputValidity();
350
349
  this.resetHelpText();
351
350
  if (emitEvents && !updateFromValue && option) {
@@ -388,21 +387,25 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
388
387
  // keep value-attribute based default selection working for both
389
388
  // controlled and uncontrolled modes, while avoiding change/input events
390
389
  // by delegating to setSelectedValue with updateFromValue=true.
391
- if (name === 'value' && newValue !== '' && this.navItems.length) {
392
- const firstSelectedOption = this.getFirstSelectedOption();
393
- const valueBasedOption = this.navItems.find(option => option.value === newValue);
390
+ // Skip the initial paint (oldValue === null with empty newValue) but allow
391
+ // programmatic clears (oldValue is a string when the attribute was already set).
392
+ if (name === 'value' && this.navItems.length && !(oldValue === null && newValue === '')) {
394
393
  let optionToSelect = null;
395
- if (valueBasedOption) {
396
- optionToSelect = valueBasedOption;
397
- }
398
- else if (this.placeholder) {
399
- optionToSelect = null;
400
- }
401
- else if (firstSelectedOption) {
402
- optionToSelect = firstSelectedOption;
403
- }
404
- else {
405
- return;
394
+ if (newValue !== '') {
395
+ const firstSelectedOption = this.getFirstSelectedOption();
396
+ const valueBasedOption = this.navItems.find(option => option.value === newValue);
397
+ if (valueBasedOption) {
398
+ optionToSelect = valueBasedOption;
399
+ }
400
+ else if (firstSelectedOption) {
401
+ optionToSelect = firstSelectedOption;
402
+ }
403
+ else if (this.placeholder) {
404
+ optionToSelect = null;
405
+ }
406
+ else {
407
+ return;
408
+ }
406
409
  }
407
410
  this.updateComplete
408
411
  .then(() => {
@@ -827,12 +830,9 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
827
830
  if (this.disabled || this.readonly) {
828
831
  return false;
829
832
  }
830
- if (optionsLength) {
833
+ if (optionsLength || this.noResultText) {
831
834
  return this.isOpen;
832
835
  }
833
- if (this.noResultText) {
834
- return true;
835
- }
836
836
  return false;
837
837
  }
838
838
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.133.0",
4
+ "version": "0.133.1",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"