@ni/spright-components 4.1.19 → 4.1.21

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.
@@ -8602,18 +8602,20 @@
8602
8602
  * @internal
8603
8603
  */
8604
8604
  clickHandler(e) {
8605
- if (this.disabled) {
8605
+ const captured = e.target.closest(`option,[role=option]`);
8606
+ if (this.disabled || (captured === null || captured === void 0 ? void 0 : captured.disabled)) {
8606
8607
  return;
8607
8608
  }
8608
8609
  if (this.open) {
8609
- const captured = e.target.closest(`option,[role=option]`);
8610
- if (!captured || captured.disabled) {
8610
+ if (e.composedPath()[0] === this.control) {
8611
8611
  return;
8612
8612
  }
8613
- this.selectedOptions = [captured];
8614
- this.control.value = captured.text;
8615
- this.clearSelectionRange();
8616
- this.updateValue(true);
8613
+ if (captured) {
8614
+ this.selectedOptions = [captured];
8615
+ this.control.value = captured.text;
8616
+ this.clearSelectionRange();
8617
+ this.updateValue(true);
8618
+ }
8617
8619
  }
8618
8620
  this.open = !this.open;
8619
8621
  if (this.open) {
@@ -9442,7 +9444,12 @@
9442
9444
  * @internal
9443
9445
  */
9444
9446
  handleChange() {
9445
- this.node.store.set(this.token, this.observer.observe(this.node.target, defaultExecutionContext));
9447
+ try {
9448
+ this.node.store.set(this.token, this.observer.observe(this.node.target, defaultExecutionContext));
9449
+ }
9450
+ catch (e) {
9451
+ console.error(e);
9452
+ }
9446
9453
  }
9447
9454
  }
9448
9455
  /**
@@ -9464,6 +9471,7 @@
9464
9471
  }
9465
9472
  delete(token) {
9466
9473
  this.values.delete(token);
9474
+ Observable.getNotifier(this).notify(token.id);
9467
9475
  }
9468
9476
  all() {
9469
9477
  return this.values.entries();
@@ -9689,6 +9697,9 @@
9689
9697
  const parent = childToParent.get(this);
9690
9698
  parent.removeChild(this);
9691
9699
  }
9700
+ for (const token of this.bindingObservers.keys()) {
9701
+ this.tearDownBindingObserver(token);
9702
+ }
9692
9703
  }
9693
9704
  /**
9694
9705
  * Appends a child to a parent DesignTokenNode.
@@ -9706,6 +9717,8 @@
9706
9717
  // How can we not notify *every* subscriber?
9707
9718
  for (const [token, value] of this.store.all()) {
9708
9719
  child.hydrate(token, this.bindingObservers.has(token) ? this.getRaw(token) : value);
9720
+ // Need to stop reflecting any tokens that can now be inherited
9721
+ child.updateCSSTokenReflection(child.store, token);
9709
9722
  }
9710
9723
  }
9711
9724
  /**
@@ -9718,7 +9731,16 @@
9718
9731
  this.children.splice(childIndex, 1);
9719
9732
  }
9720
9733
  Observable.getNotifier(this.store).unsubscribe(child);
9721
- return child.parent === this ? childToParent.delete(child) : false;
9734
+ if (child.parent !== this) {
9735
+ return false;
9736
+ }
9737
+ const deleted = childToParent.delete(child);
9738
+ for (const [token] of this.store.all()) {
9739
+ child.hydrate(token, child.getRaw(token));
9740
+ // Need to start reflecting any assigned values that were previously inherited
9741
+ child.updateCSSTokenReflection(child.store, token);
9742
+ }
9743
+ return deleted;
9722
9744
  }
9723
9745
  /**
9724
9746
  * Tests whether a provided node is contained by