@descope/web-components-ui 1.0.196 → 1.0.198

Sign up to get free protection for your applications and to get access to all the features.
@@ -7571,9 +7571,13 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
7571
7571
  this.getSelectedNode()?.removeAttribute('selected');
7572
7572
  }
7573
7573
 
7574
- onNodeClick(e) {
7575
- if (!this.isReadonly) {
7576
- this.setSelected(e.target);
7574
+ onClick(e) {
7575
+ if (!this.isReadonly && e.target !== e.currentTarget) {
7576
+ if (e.target === this.getSelectedNode()) {
7577
+ this.removeSelected();
7578
+ } else {
7579
+ this.setSelected(e.target);
7580
+ }
7577
7581
  this.#dispatchChange();
7578
7582
  }
7579
7583
  }
@@ -7586,7 +7590,7 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
7586
7590
  }
7587
7591
 
7588
7592
  get value() {
7589
- return this.getSelectedNode()?.value;
7593
+ return this.getSelectedNode()?.value || '';
7590
7594
  }
7591
7595
 
7592
7596
  set value(value) {
@@ -7646,12 +7650,7 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
7646
7650
 
7647
7651
  observeAttributes(this, this.onObservedAttributeChange.bind(this), { includeAttrs: ['size'] });
7648
7652
 
7649
- observeChildren(this, ({ addedNodes }) => {
7650
- addedNodes.forEach((node) => {
7651
- node.addEventListener('click', this.onNodeClick.bind(this));
7652
- node.setAttribute('size', this.size);
7653
- });
7654
- });
7653
+ this.querySelector('slot').addEventListener('click', this.onClick.bind(this));
7655
7654
  }
7656
7655
  }
7657
7656
 
@@ -7674,6 +7673,10 @@ const customMixin = (superclass) =>
7674
7673
  this.renderItems();
7675
7674
  }
7676
7675
 
7676
+ get size() {
7677
+ return this.inputElement?.size;
7678
+ }
7679
+
7677
7680
  get data() {
7678
7681
  if (this.#data) return this.#data;
7679
7682
 
@@ -7744,6 +7747,13 @@ const customMixin = (superclass) =>
7744
7747
  this.renderItems();
7745
7748
 
7746
7749
  observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
7750
+
7751
+ // we want new items to get the size
7752
+ observeChildren(this, ({ addedNodes }) => {
7753
+ addedNodes.forEach((node) => {
7754
+ node.setAttribute('size', this.size);
7755
+ });
7756
+ });
7747
7757
  }
7748
7758
  };
7749
7759