@descope/web-components-ui 1.0.197 → 1.0.199

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -4825,7 +4825,7 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$3 {
4825
4825
  init() {
4826
4826
  this.addEventListener('focus', (e) => {
4827
4827
  // we want to ignore focus events we are dispatching
4828
- if (e.isTrusted) this.inputs[0].focus();
4828
+ if (e.isTrusted) this.inputs[1].focus();
4829
4829
  });
4830
4830
 
4831
4831
  super.init?.();
@@ -6208,9 +6208,13 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
6208
6208
  this.getSelectedNode()?.removeAttribute('selected');
6209
6209
  }
6210
6210
 
6211
- onNodeClick(e) {
6212
- if (!this.isReadonly) {
6213
- this.setSelected(e.target);
6211
+ onClick(e) {
6212
+ if (!this.isReadonly && e.target !== e.currentTarget) {
6213
+ if (e.target === this.getSelectedNode()) {
6214
+ this.removeSelected();
6215
+ } else {
6216
+ this.setSelected(e.target);
6217
+ }
6214
6218
  this.#dispatchChange();
6215
6219
  }
6216
6220
  }
@@ -6223,7 +6227,7 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
6223
6227
  }
6224
6228
 
6225
6229
  get value() {
6226
- return this.getSelectedNode()?.value;
6230
+ return this.getSelectedNode()?.value || '';
6227
6231
  }
6228
6232
 
6229
6233
  set value(value) {
@@ -6283,12 +6287,7 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
6283
6287
 
6284
6288
  observeAttributes(this, this.onObservedAttributeChange.bind(this), { includeAttrs: ['size'] });
6285
6289
 
6286
- observeChildren(this, ({ addedNodes }) => {
6287
- addedNodes.forEach((node) => {
6288
- node.addEventListener('click', this.onNodeClick.bind(this));
6289
- node.setAttribute('size', this.size);
6290
- });
6291
- });
6290
+ this.querySelector('slot').addEventListener('click', this.onClick.bind(this));
6292
6291
  }
6293
6292
  }
6294
6293
 
@@ -6311,6 +6310,10 @@ const customMixin = (superclass) =>
6311
6310
  this.renderItems();
6312
6311
  }
6313
6312
 
6313
+ get size() {
6314
+ return this.inputElement?.size;
6315
+ }
6316
+
6314
6317
  get data() {
6315
6318
  if (this.#data) return this.#data;
6316
6319
 
@@ -6381,6 +6384,13 @@ const customMixin = (superclass) =>
6381
6384
  this.renderItems();
6382
6385
 
6383
6386
  observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
6387
+
6388
+ // we want new items to get the size
6389
+ observeChildren(this, ({ addedNodes }) => {
6390
+ addedNodes.forEach((node) => {
6391
+ node.setAttribute('size', this.size);
6392
+ });
6393
+ });
6384
6394
  }
6385
6395
  };
6386
6396