@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/cjs/index.cjs.js
CHANGED
@@ -7569,13 +7569,17 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
7569
7569
|
return this.getAttribute('size') || 'md';
|
7570
7570
|
}
|
7571
7571
|
|
7572
|
+
get allowDeselect() {
|
7573
|
+
return this.getAttribute('allow-deselect') === 'true';
|
7574
|
+
}
|
7575
|
+
|
7572
7576
|
removeSelected() {
|
7573
7577
|
this.getSelectedNode()?.removeAttribute('selected');
|
7574
7578
|
}
|
7575
7579
|
|
7576
7580
|
onClick(e) {
|
7577
|
-
if (
|
7578
|
-
if (e.target === this.getSelectedNode()) {
|
7581
|
+
if (e.target !== e.currentTarget) {
|
7582
|
+
if (e.target === this.getSelectedNode() && this.allowDeselect) {
|
7579
7583
|
this.removeSelected();
|
7580
7584
|
} else {
|
7581
7585
|
this.setSelected(e.target);
|
@@ -7620,6 +7624,10 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
7620
7624
|
});
|
7621
7625
|
}
|
7622
7626
|
|
7627
|
+
onReadOnlyChange() {
|
7628
|
+
this.querySelector('slot').toggleAttribute('inert', this.isReadonly);
|
7629
|
+
}
|
7630
|
+
|
7623
7631
|
getValidity() {
|
7624
7632
|
if (this.isRequired && !this.value) {
|
7625
7633
|
return { valueMissing: true };
|
@@ -7634,6 +7642,9 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
7634
7642
|
case 'size':
|
7635
7643
|
this.onSizeChange();
|
7636
7644
|
break;
|
7645
|
+
case 'readonly':
|
7646
|
+
this.onReadOnlyChange();
|
7647
|
+
break;
|
7637
7648
|
}
|
7638
7649
|
});
|
7639
7650
|
}
|
@@ -7643,14 +7654,16 @@ class ButtonSelectionGroupInternalClass extends createBaseInputClass({
|
|
7643
7654
|
this.addEventListener('focus', (e) => {
|
7644
7655
|
// we want to ignore focus events we are dispatching
|
7645
7656
|
if (e.isTrusted) {
|
7646
|
-
this.items[0]
|
7657
|
+
this.items[0]?.focus();
|
7647
7658
|
}
|
7648
7659
|
});
|
7649
7660
|
|
7650
7661
|
super.init?.();
|
7651
7662
|
this.setDefaultValue();
|
7652
7663
|
|
7653
|
-
observeAttributes(this, this.onObservedAttributeChange.bind(this), {
|
7664
|
+
observeAttributes(this, this.onObservedAttributeChange.bind(this), {
|
7665
|
+
includeAttrs: ['size', 'readonly'],
|
7666
|
+
});
|
7654
7667
|
|
7655
7668
|
this.querySelector('slot').addEventListener('click', this.onClick.bind(this));
|
7656
7669
|
}
|
@@ -7744,7 +7757,9 @@ const customMixin = (superclass) =>
|
|
7744
7757
|
|
7745
7758
|
this.inputElement = this.shadowRoot.querySelector(componentName$2);
|
7746
7759
|
|
7747
|
-
forwardAttrs(this, this.inputElement, {
|
7760
|
+
forwardAttrs(this, this.inputElement, {
|
7761
|
+
includeAttrs: ['size', 'default-value', 'allow-deselect'],
|
7762
|
+
});
|
7748
7763
|
|
7749
7764
|
this.renderItems();
|
7750
7765
|
|