@ni/spright-components 5.5.2 → 5.5.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.
@@ -11476,7 +11476,7 @@
11476
11476
  return;
11477
11477
  }
11478
11478
  if (this.control && !this.isUserInput) {
11479
- this.control.value = this.value;
11479
+ this.syncValueToInnerControl();
11480
11480
  }
11481
11481
  super.valueChanged(previous, this.value);
11482
11482
  if (previous !== undefined && !this.isUserInput) {
@@ -11551,7 +11551,7 @@
11551
11551
  super.connectedCallback();
11552
11552
  this.proxy.setAttribute("type", "number");
11553
11553
  this.validate();
11554
- this.control.value = this.value;
11554
+ this.syncValueToInnerControl();
11555
11555
  if (this.autofocus) {
11556
11556
  DOM.queueUpdate(() => {
11557
11557
  this.focus();
@@ -11578,9 +11578,9 @@
11578
11578
  * @internal
11579
11579
  */
11580
11580
  handleTextInput() {
11581
- this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, "");
11581
+ this.control.value = this.sanitizeInput(this.control.value);
11582
11582
  this.isUserInput = true;
11583
- this.value = this.control.value;
11583
+ this.syncValueFromInnerControl();
11584
11584
  }
11585
11585
  /**
11586
11586
  * Change event handler for inner control.
@@ -11616,6 +11616,26 @@
11616
11616
  * @internal
11617
11617
  */
11618
11618
  handleBlur() {
11619
+ this.syncValueToInnerControl();
11620
+ }
11621
+ /**
11622
+ * Sanitizes the text input by the user.
11623
+ * @param inputText The user-input text to sanitize
11624
+ * @returns The sanitized text, containing only valid characters for a number field
11625
+ */
11626
+ sanitizeInput(inputText) {
11627
+ return inputText.replace(/[^0-9\-+e.]/g, "");
11628
+ }
11629
+ /**
11630
+ * Synchronizes the value from the input control in the shadow DOM to the host component.
11631
+ */
11632
+ syncValueFromInnerControl() {
11633
+ this.value = this.control.value;
11634
+ }
11635
+ /**
11636
+ * Synchronizes the value from the host component to the input control in the shadow DOM.
11637
+ */
11638
+ syncValueToInnerControl() {
11619
11639
  this.control.value = this.value;
11620
11640
  }
11621
11641
  };
@@ -16257,7 +16277,7 @@
16257
16277
  const end = getColorForTheme(element, hexToRgbaCssColor(Black15, 0), hexToRgbaCssColor(Black82, 0), hexToRgbaCssColor(ForestGreen, 0));
16258
16278
  return `linear-gradient(${start}, ${end})`;
16259
16279
  });
16260
- DesignToken.create(styleNameFromTokenName(tokenNames.dividerBackgroundColor)).withDefault((element) => getColorForTheme(element, hexToRgbaCssColor(Black91, 0.2), hexToRgbaCssColor(Black15, 0.2), hexToRgbaCssColor(White, 0.2)));
16280
+ DesignToken.create(styleNameFromTokenName(tokenNames.dividerBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
16261
16281
  const fillSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.2));
16262
16282
  const fillSelectedRgbPartialColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillSelectedRgbPartialColor)).withDefault((element) => hexToRgbPartial(getFillSelectedColorForTheme(element)));
16263
16283
  const fillHoverSelectedColor = DesignToken.create(styleNameFromTokenName(tokenNames.fillHoverSelectedColor)).withDefault((element) => hexToRgbaCssColor(getFillSelectedColorForTheme(element), 0.15));