@momentum-design/components 0.102.5 → 0.102.7

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.
@@ -4502,7 +4502,7 @@
4502
4502
  :host::part(required-indicator) {
4503
4503
  display: none;
4504
4504
  }
4505
- `,...xt(!0)],Df=ZE;var Eo=class extends Oe(re(Ee)){constructor(){super(...arguments);this.checked=!1;this.readonly=!1;this.autofocus=!1;this.renderLabelAndHelperText=()=>this.label?C`<div class="mdc-radio__label-container">${this.renderLabel()} ${this.renderHelperText()}</div>`:W}connectedCallback(){super.connectedCallback(),this.helpTextType=void 0}firstUpdated(){this.updateTabIndex()}getAllRadiosWithinSameGroup(){return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`))}dispatchChangeEvent(t){let o=t.constructor;this.dispatchEvent(new o(t.type,t))}formResetCallback(){this.getAllRadiosWithinSameGroup().forEach(o=>{o.checked=!1}),this.updateComplete.then(()=>{this.setActualFormValue()}).catch(o=>{this.onerror&&this.onerror(o)})}formStateRestoreCallback(t){this.value===t&&t!==""&&(this.checked=!0)}setComponentValidity(t){t?this.internals.setValidity({}):this.required&&!this.checked&&(this.validationMessage?this.inputElement.setCustomValidity(this.validationMessage):this.inputElement.setCustomValidity(""),this.setValidity()),this.updateTabIndex()}setGroupValidity(t,o){this.updateComplete.then(()=>{t.forEach(a=>{a.setComponentValidity(o)})}).catch(a=>{this.onerror&&this.onerror(a)})}setActualFormValue(){let t="";this.checked?t=this.value?this.value:"on":t=null;let o=this.getAllRadiosWithinSameGroup();if(this.checked)this.setGroupValidity(o,!0);else{let a=o.some(T=>T.required),h=!!o.find(T=>T.checked),m=a&&!h;this.setGroupValidity(o,!m)}this.internals.setFormValue(t)}handleChange(t){var h;if(this.disabled||this.readonly)return;this.getAllRadiosWithinSameGroup().forEach(m=>{var R;let T=(R=m.shadowRoot)==null?void 0:R.querySelector("input");T&&(m.checked=!1,T.checked=!1)}),this.checked=!0;let a=(h=this.shadowRoot)==null?void 0:h.querySelector("input");a&&(a.checked=!0),this.dispatchChangeEvent(t)}updateRadio(t,o,a){var h,m;(m=(h=t[o].shadowRoot)==null?void 0:h.querySelector("input"))==null||m.focus(),t[o].handleChange(a)}handleKeyDown(t){var m;if(this.disabled)return;let a=this.getAllRadiosWithinSameGroup().filter(T=>!T.disabled),h=a.indexOf(this);if(["ArrowDown","ArrowRight"].includes(t.key)){let T=(h+1)%a.length;this.updateRadio(a,T,t)}else if(["ArrowUp","ArrowLeft"].includes(t.key)){let T=(h-1+a.length)%a.length;this.updateRadio(a,T,t)}else t.key===J.SPACE&&this.updateRadio(a,h,t);this.updateTabIndex(),t.key===J.ENTER&&((m=this.form)==null||m.requestSubmit())}updateTabIndex(){let t=this.getAllRadiosWithinSameGroup(),o=t.find(h=>h.checked),a=t.find(h=>!h.disabled);t.forEach(h=>{var T;let m=(T=h.shadowRoot)==null?void 0:T.querySelector("input");m&&(m.tabIndex=-1,(h===o||!o&&h===a)&&(m.tabIndex=0))})}update(t){super.update(t),t.has("checked")&&this.setActualFormValue()}render(){var t;return C`
4505
+ `,...xt(!0)],Df=ZE;var Eo=class extends Oe(re(Ee)){constructor(){super(...arguments);this.checked=!1;this.readonly=!1;this.autofocus=!1;this.renderLabelAndHelperText=()=>this.label?C`<div class="mdc-radio__label-container">${this.renderLabel()} ${this.renderHelperText()}</div>`:W}connectedCallback(){super.connectedCallback(),this.helpTextType=void 0}firstUpdated(){this.updateTabIndex()}getAllRadiosWithinSameGroup(){return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`))}formResetCallback(){this.getAllRadiosWithinSameGroup().forEach(o=>{o.checked=!1}),this.updateComplete.then(()=>{this.setActualFormValue()}).catch(o=>{this.onerror&&this.onerror(o)})}formStateRestoreCallback(t){this.value===t&&t!==""&&(this.checked=!0)}setComponentValidity(t){t?this.internals.setValidity({}):this.required&&!this.checked&&(this.validationMessage?this.inputElement.setCustomValidity(this.validationMessage):this.inputElement.setCustomValidity(""),this.setValidity()),this.updateTabIndex()}setGroupValidity(t,o){this.updateComplete.then(()=>{t.forEach(a=>{a.setComponentValidity(o)})}).catch(a=>{this.onerror&&this.onerror(a)})}setActualFormValue(){let t="";this.checked?t=this.value?this.value:"on":t=null;let o=this.getAllRadiosWithinSameGroup();if(this.checked)this.setGroupValidity(o,!0);else{let a=o.some(T=>T.required),h=!!o.find(T=>T.checked),m=a&&!h;this.setGroupValidity(o,!m)}this.internals.setFormValue(t)}handleChange(){var a;if(this.disabled||this.readonly)return;this.getAllRadiosWithinSameGroup().forEach(h=>{var T;let m=(T=h.shadowRoot)==null?void 0:T.querySelector("input");m&&(h.checked=!1,m.checked=!1)}),this.checked=!0;let o=(a=this.shadowRoot)==null?void 0:a.querySelector("input");o&&(o.checked=!0),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}updateRadio(t,o){var a,h;(h=(a=t[o].shadowRoot)==null?void 0:a.querySelector("input"))==null||h.focus(),t[o].handleChange()}handleKeyDown(t){var m;if(this.disabled)return;let a=this.getAllRadiosWithinSameGroup().filter(T=>!T.disabled),h=a.indexOf(this);if(["ArrowDown","ArrowRight"].includes(t.key)){let T=(h+1)%a.length;this.updateRadio(a,T)}else if(["ArrowUp","ArrowLeft"].includes(t.key)){let T=(h-1+a.length)%a.length;this.updateRadio(a,T)}else t.key===J.SPACE&&this.updateRadio(a,h);this.updateTabIndex(),t.key===J.ENTER&&((m=this.form)==null||m.requestSubmit())}updateTabIndex(){let t=this.getAllRadiosWithinSameGroup(),o=t.find(h=>h.checked),a=t.find(h=>!h.disabled);t.forEach(h=>{var T;let m=(T=h.shadowRoot)==null?void 0:T.querySelector("input");m&&(m.tabIndex=-1,(h===o||!o&&h===a)&&(m.tabIndex=0))})}update(t){super.update(t),t.has("checked")&&this.setActualFormValue()}render(){var t;return C`
4506
4506
  <mdc-staticradio
4507
4507
  class="mdc-focus-ring"
4508
4508
  ?checked="${this.checked}"