@ni/nimble-components 11.8.2 → 11.8.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.
@@ -14700,7 +14700,7 @@
14700
14700
  DesignToken.create(styleNameFromTokenName(tokenNames.sectionBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
14701
14701
  DesignToken.create(styleNameFromTokenName(tokenNames.dividerBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
14702
14702
  const fillSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.2));
14703
- const fillSelectedRgbPartialColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedRgbPartialColor)).withDefault((element) => hexToRgbPartial(getFillSelectedColorForTheme(element)));
14703
+ DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedRgbPartialColor)).withDefault((element) => hexToRgbPartial(getFillSelectedColorForTheme(element)));
14704
14704
  const fillHoverSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillHoverSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.15));
14705
14705
  const fillHoverColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillHoverColor)).withDefault((element) => hexToRgbaCssColor(getFillHoverColorForTheme(element), 0.1));
14706
14706
  DesignToken.create(styleNameFromTokenName(tokenNames.fillDownColor)).withDefault((element) => hexToRgbaCssColor(getFillDownColorForTheme(element), 0.15));
@@ -16739,9 +16739,7 @@
16739
16739
  class Combobox extends Combobox$1 {
16740
16740
  constructor() {
16741
16741
  super(...arguments);
16742
- this.focusOutHandler = () => {
16743
- this.open = false;
16744
- };
16742
+ this.valueUpdatedByInput = false;
16745
16743
  }
16746
16744
  // Workaround for https://github.com/microsoft/fast/issues/5123
16747
16745
  setPositioning() {
@@ -16765,10 +16763,6 @@
16765
16763
  // Call setPositioning() after this.forcedPosition is initialized.
16766
16764
  this.setPositioning();
16767
16765
  this.updateInputAriaLabel();
16768
- this.addEventListener('focusout', this.focusOutHandler);
16769
- }
16770
- disconnectedCallback() {
16771
- this.removeEventListener('focusout', this.focusOutHandler);
16772
16766
  }
16773
16767
  toggleButtonClickHandler(e) {
16774
16768
  e.stopImmediatePropagation();
@@ -16795,6 +16789,50 @@
16795
16789
  const enabledOptions = this.filteredOptions.filter(o => !o.disabled);
16796
16790
  this.filteredOptions = enabledOptions;
16797
16791
  }
16792
+ /**
16793
+ * This is a workaround for the issue described here: https://github.com/microsoft/fast/issues/6267
16794
+ * For now, we will update the value ourselves while a user types in text. Note that there is other
16795
+ * implementation related to this (like the 'keydownEventHandler') needed to create the complete set
16796
+ * of desired behavior described in the issue noted above.
16797
+ */
16798
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
16799
+ inputHandler(e) {
16800
+ const returnValue = super.inputHandler(e);
16801
+ if (!this.valueUpdatedByInput) {
16802
+ this.valueBeforeTextUpdate = this.value;
16803
+ }
16804
+ this.value = this.control.value;
16805
+ this.valueUpdatedByInput = true;
16806
+ return returnValue;
16807
+ }
16808
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
16809
+ keydownHandler(e) {
16810
+ const returnValue = super.keydownHandler(e);
16811
+ if (e.ctrlKey || e.altKey) {
16812
+ return returnValue;
16813
+ }
16814
+ switch (e.key) {
16815
+ case keyEnter:
16816
+ this.emitChangeIfValueUpdated();
16817
+ break;
16818
+ case keyArrowDown:
16819
+ case keyArrowUp:
16820
+ if (this.open && this.valueUpdatedByInput) {
16821
+ this.valueUpdatedByInput = false;
16822
+ }
16823
+ break;
16824
+ default:
16825
+ return returnValue;
16826
+ }
16827
+ return returnValue;
16828
+ }
16829
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
16830
+ focusoutHandler(e) {
16831
+ const returnValue = super.focusoutHandler(e);
16832
+ this.open = false;
16833
+ this.emitChangeIfValueUpdated();
16834
+ return returnValue;
16835
+ }
16798
16836
  openChanged() {
16799
16837
  super.openChanged();
16800
16838
  if (this.dropdownButton) {
@@ -16814,6 +16852,24 @@
16814
16852
  inputElement?.removeAttribute('aria-label');
16815
16853
  }
16816
16854
  }
16855
+ /**
16856
+ * This will only emit a `change` event after text entry where the text in the input prior to
16857
+ * typing is different than the text present upon an attempt to commit (e.g. pressing <Enter>).
16858
+ * So, for a concrete example:
16859
+ * 1) User types 'Sue' (when Combobox input was blank).
16860
+ * 2) User presses <Enter> -> 'change' event fires
16861
+ * 3) User deletes 'Sue'
16862
+ * 4) User re-types 'Sue'
16863
+ * 5) User presses <Enter> -> NO 'change' event is fired
16864
+ */
16865
+ emitChangeIfValueUpdated() {
16866
+ if (this.valueUpdatedByInput) {
16867
+ if (this.value !== this.valueBeforeTextUpdate) {
16868
+ this.$emit('change');
16869
+ }
16870
+ this.valueUpdatedByInput = false;
16871
+ }
16872
+ }
16817
16873
  }
16818
16874
  __decorate([
16819
16875
  observable
@@ -16848,6 +16904,7 @@
16848
16904
  part="button"
16849
16905
  aria-haspopup="true"
16850
16906
  aria-expanded="${x => x.open}"
16907
+ tabindex="-1"
16851
16908
  >
16852
16909
  <nimble-icon-arrow-expander-down
16853
16910
  slot="start"
@@ -20521,11 +20578,6 @@
20521
20578
  outline: none;
20522
20579
  }
20523
20580
 
20524
- .control::selection {
20525
- color: ${controlLabelFontColor};
20526
- background: rgba(${fillSelectedRgbPartialColor}, 0.3);
20527
- }
20528
-
20529
20581
  .control::placeholder {
20530
20582
  color: ${controlLabelFontColor};
20531
20583
  }
@@ -21249,11 +21301,6 @@
21249
21301
  box-shadow: none;
21250
21302
  }
21251
21303
 
21252
- .control::selection {
21253
- color: ${controlLabelFontColor};
21254
- background: rgba(${fillSelectedRgbPartialColor}, 0.3);
21255
- }
21256
-
21257
21304
  .control::placeholder {
21258
21305
  color: ${controlLabelFontColor};
21259
21306
  }
@@ -21469,11 +21516,6 @@
21469
21516
  text-overflow: clip;
21470
21517
  }
21471
21518
 
21472
- .control::selection {
21473
- color: ${controlLabelFontColor};
21474
- background: rgba(${fillSelectedRgbPartialColor}, 0.3);
21475
- }
21476
-
21477
21519
  .control::placeholder {
21478
21520
  color: ${controlLabelFontColor};
21479
21521
  }