@descope/web-components-ui 1.0.200 → 1.0.202
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.
- package/dist/cjs/index.cjs.js +20 -5
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/descope-button-selection-group-descope-button-selection-group-internal-index-js.js +1 -1
- package/dist/umd/descope-button-selection-group-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-button-selection-group/ButtonSelectionGroupClass.js +3 -1
- package/src/components/descope-button-selection-group/descope-button-selection-group-internal/ButtonSelectionGroupInternalClass.js +17 -4
package/dist/index.esm.js
CHANGED
@@ -6211,13 +6211,17 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
6211
6211
|
return this.getAttribute('size') || 'md';
|
6212
6212
|
}
|
6213
6213
|
|
6214
|
+
get allowDeselect() {
|
6215
|
+
return this.getAttribute('allow-deselect') === 'true';
|
6216
|
+
}
|
6217
|
+
|
6214
6218
|
removeSelected() {
|
6215
6219
|
this.getSelectedNode()?.removeAttribute('selected');
|
6216
6220
|
}
|
6217
6221
|
|
6218
6222
|
onClick(e) {
|
6219
|
-
if (
|
6220
|
-
if (e.target === this.getSelectedNode()) {
|
6223
|
+
if (e.target !== e.currentTarget) {
|
6224
|
+
if (e.target === this.getSelectedNode() && this.allowDeselect) {
|
6221
6225
|
this.removeSelected();
|
6222
6226
|
} else {
|
6223
6227
|
this.setSelected(e.target);
|
@@ -6262,6 +6266,10 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
6262
6266
|
});
|
6263
6267
|
}
|
6264
6268
|
|
6269
|
+
onReadOnlyChange() {
|
6270
|
+
this.querySelector('slot').toggleAttribute('inert', this.isReadonly);
|
6271
|
+
}
|
6272
|
+
|
6265
6273
|
getValidity() {
|
6266
6274
|
if (this.isRequired && !this.value) {
|
6267
6275
|
return { valueMissing: true };
|
@@ -6276,6 +6284,9 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
6276
6284
|
case 'size':
|
6277
6285
|
this.onSizeChange();
|
6278
6286
|
break;
|
6287
|
+
case 'readonly':
|
6288
|
+
this.onReadOnlyChange();
|
6289
|
+
break;
|
6279
6290
|
}
|
6280
6291
|
});
|
6281
6292
|
}
|
@@ -6285,14 +6296,16 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
6285
6296
|
this.addEventListener('focus', (e) => {
|
6286
6297
|
// we want to ignore focus events we are dispatching
|
6287
6298
|
if (e.isTrusted) {
|
6288
|
-
this.items[0]
|
6299
|
+
this.items[0]?.focus();
|
6289
6300
|
}
|
6290
6301
|
});
|
6291
6302
|
|
6292
6303
|
super.init?.();
|
6293
6304
|
this.setDefaultValue();
|
6294
6305
|
|
6295
|
-
observeAttributes(this, this.onObservedAttributeChange.bind(this), {
|
6306
|
+
observeAttributes(this, this.onObservedAttributeChange.bind(this), {
|
6307
|
+
includeAttrs: ['size', 'readonly'],
|
6308
|
+
});
|
6296
6309
|
|
6297
6310
|
this.querySelector('slot').addEventListener('click', this.onClick.bind(this));
|
6298
6311
|
}
|
@@ -6386,7 +6399,9 @@ const customMixin = (superclass) =>
|
|
6386
6399
|
|
6387
6400
|
this.inputElement = this.shadowRoot.querySelector(componentName$3);
|
6388
6401
|
|
6389
|
-
forwardAttrs(this, this.inputElement, {
|
6402
|
+
forwardAttrs(this, this.inputElement, {
|
6403
|
+
includeAttrs: ['size', 'default-value', 'allow-deselect'],
|
6404
|
+
});
|
6390
6405
|
|
6391
6406
|
this.renderItems();
|
6392
6407
|
|