@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.
package/dist/index.esm.js CHANGED
@@ -4704,10 +4704,10 @@ var CountryCodes = [
4704
4704
  },
4705
4705
  ].sort((a, b) => (a.name < b.name ? -1 : 1));
4706
4706
 
4707
- // We use JSDelivr in order to fetch the images as image file from this library (svg-country-flags)
4707
+ // We use JSDelivr (proxy by static.descope.com) in order to fetch the images as image file from this library (svg-country-flags)
4708
4708
  // This reduces our bundle size, and we use it as a static remote resource.
4709
4709
  const getCountryFlag = (code) =>
4710
- `https://cdn.jsdelivr.net/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
4710
+ `https://static.descope.com/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
4711
4711
 
4712
4712
  const comboBoxItem = ({ code, dialCode, name: country }) => `
4713
4713
  <div
@@ -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