@momentum-design/components 0.131.5 → 0.131.6
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/browser/index.js +2 -2
- package/dist/browser/index.js.map +2 -2
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.d.ts +39 -6
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +43 -10
- package/dist/custom-elements.json +10 -27
- package/dist/react/screenreaderannouncer/index.d.ts +24 -1
- package/dist/react/screenreaderannouncer/index.js +24 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -2757,7 +2757,7 @@
|
|
|
2757
2757
|
display: none;
|
|
2758
2758
|
visibility: hidden;
|
|
2759
2759
|
}
|
|
2760
|
-
`],zv=Ux;var Qr=class extends X{constructor(){super(...arguments);this.announcement="";this.identity="";this.dataAriaLive=jo.ARIA_LIVE;this.delay=jo.DELAY;this.timeout=jo.TIMEOUT;this.debounceTime=jo.DEBOUNCE;this.timeOutIds=[];this.ariaLiveAnnouncementIds=[]}announce(t,r,s,l){var c;if(t.length>0){let f=`mdc-screenreaderannouncer-announcement-${Le()}`,y=document.createElement("div");y.setAttribute("id",f),y.setAttribute("aria-live",l),(c=this.getElementByIdAcrossShadowRoot(this.identity))==null||c.appendChild(y);let A=window.setTimeout(()=>{let F=document.createElement("p");F.textContent=t,y.appendChild(F),this.ariaLiveAnnouncementIds.push(f);let W=window.setTimeout(()=>{y.remove()},s);this.timeOutIds.push(W)},r);this.timeOutIds.push(A)}}clearTimeOutsAndAnnouncements(){this.timeOutIds.forEach(t=>{window.clearTimeout(t)}),this.ariaLiveAnnouncementIds.forEach(t=>{var r;(r=this.getElementByIdAcrossShadowRoot(t))==null||r.remove()})}getElementByIdAcrossShadowRoot(t){var l;let r=document.getElementById(t);if(r)return r;let s=this.findModalAncestor();return((l=s==null?void 0:s.shadowRoot)==null?void 0:l.getElementById(t))||null}createAnnouncementAriaLiveRegion(){let t=this.getElementByIdAcrossShadowRoot(this.identity);if(!t){t=document.createElement("div"),t.id=this.identity;let r=document.createElement("style");r.textContent=`
|
|
2760
|
+
`],zv=Ux;var Qr=class extends X{constructor(){super(...arguments);this.announcement="";this.identity="";this.dataAriaLive=jo.ARIA_LIVE;this.delay=jo.DELAY;this.timeout=jo.TIMEOUT;this.debounceTime=jo.DEBOUNCE;this.timeOutIds=[];this.ariaLiveAnnouncementIds=[]}announce({announcement:t,delay:r,timeout:s,ariaLive:l}){var c;if(t.length>0){let f=`mdc-screenreaderannouncer-announcement-${Le()}`,y=document.createElement("div");y.setAttribute("id",f),y.setAttribute("aria-live",l!=null?l:this.dataAriaLive),(c=this.getElementByIdAcrossShadowRoot(this.identity))==null||c.appendChild(y);let A=window.setTimeout(()=>{let F=document.createElement("p");F.textContent=t,y.appendChild(F),this.ariaLiveAnnouncementIds.push(f);let W=window.setTimeout(()=>{y.remove()},s!=null?s:this.timeout);this.timeOutIds.push(W)},r!=null?r:this.delay);this.timeOutIds.push(A)}}clearTimeOutsAndAnnouncements(){this.timeOutIds.forEach(t=>{window.clearTimeout(t)}),this.ariaLiveAnnouncementIds.forEach(t=>{var r;(r=this.getElementByIdAcrossShadowRoot(t))==null||r.remove()})}getElementByIdAcrossShadowRoot(t){var l;let r=document.getElementById(t);if(r)return r;let s=this.findModalAncestor();return((l=s==null?void 0:s.shadowRoot)==null?void 0:l.getElementById(t))||null}createAnnouncementAriaLiveRegion(){let t=this.getElementByIdAcrossShadowRoot(this.identity);if(!t){t=document.createElement("div"),t.id=this.identity;let r=document.createElement("style");r.textContent=`
|
|
2761
2761
|
.mdc-screenreaderannouncer__visually-hidden {
|
|
2762
2762
|
clip: rect(0 0 0 0);
|
|
2763
2763
|
clip-path: inset(50%);
|
|
@@ -2767,7 +2767,7 @@
|
|
|
2767
2767
|
white-space: nowrap;
|
|
2768
2768
|
width: 1px;
|
|
2769
2769
|
}
|
|
2770
|
-
`,t.appendChild(r),t.classList.add("mdc-screenreaderannouncer__visually-hidden");let s=this.findModalAncestor();s!=null&&s.shadowRoot?s.shadowRoot.appendChild(t):document.body.appendChild(t)}}findModalAncestor(){let t=this;for(;t;){let r=t.closest('[aria-modal="true"]');if(r)return r;let s=t.getRootNode();if(s instanceof ShadowRoot&&s.host)t=s.host;else break}return null}setupDebouncedAnnounce(){this.debouncedAnnounce=ad(()=>{this.announcement&&this.announcement.length>0&&(this.announce(this.announcement,this.delay,this.timeout,this.dataAriaLive),this.announcement="")},this.debounceTime)}connectedCallback(){super.connectedCallback(),this.identity.length===0&&(this.identity=jo.IDENTITY),this.createAnnouncementAriaLiveRegion(),this.setupDebouncedAnnounce()}disconnectedCallback(){var t;super.disconnectedCallback(),this.clearTimeOutsAndAnnouncements(),(t=this.debouncedAnnounce)==null||t.cancel()}updated(t){var r;t.has("identity")&&this.identity.length===0&&(this.identity=jo.IDENTITY,this.createAnnouncementAriaLiveRegion()),t.has("debounceTime")&&this.setupDebouncedAnnounce(),t.has("announcement")&&this.announcement&&this.announcement.length>0&&((r=this.debouncedAnnounce)==null||r.call(this))}};Qr.styles=[...X.styles,...zv],m([u({type:String,reflect:!0})],Qr.prototype,"announcement",2),m([u({type:String,reflect:!0})],Qr.prototype,"identity",2),m([u({type:String,reflect:!0,attribute:"data-aria-live"})],Qr.prototype,"dataAriaLive",2),m([u({type:Number,reflect:!0})],Qr.prototype,"delay",2),m([u({type:Number,reflect:!0})],Qr.prototype,"timeout",2),m([u({type:Number,reflect:!0,attribute:"debounce-time"})],Qr.prototype,"debounceTime",2);var Eh=Qr;Eh.register(Vv);var Gx=Eh;yh.register(Fv);var Kx=yh;var ge=a=>{class o extends a{constructor(){super(...arguments);this.name="";this.value="";this.internals=this.attachInternals()}get form(){return this.internals.form}get validity(){return this.internals.validity}get willValidate(){return this.internals.willValidate}setValidity(){this.inputElement&&this.internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement)}checkValidity(){return this.setValidity(),this.internals.checkValidity()}reportValidity(){return this.setValidity(),this.internals.reportValidity()}}return o.formAssociated=!0,m([u({reflect:!0,type:String})],o.prototype,"name",2),m([u({reflect:!0,type:String})],o.prototype,"value",2),m([u({reflect:!0,type:String,attribute:"validation-message"})],o.prototype,"validationMessage",2),m([Kt("input")],o.prototype,"inputElement",2),o};var Wx=H`
|
|
2770
|
+
`,t.appendChild(r),t.classList.add("mdc-screenreaderannouncer__visually-hidden");let s=this.findModalAncestor();s!=null&&s.shadowRoot?s.shadowRoot.appendChild(t):document.body.appendChild(t)}}findModalAncestor(){let t=this;for(;t;){let r=t.closest('[aria-modal="true"]');if(r)return r;let s=t.getRootNode();if(s instanceof ShadowRoot&&s.host)t=s.host;else break}return null}setupDebouncedAnnounce(){this.debouncedAnnounce=ad(()=>{this.announcement&&this.announcement.length>0&&(this.announce({announcement:this.announcement,delay:this.delay,timeout:this.timeout,ariaLive:this.dataAriaLive}),this.announcement="")},this.debounceTime)}connectedCallback(){super.connectedCallback(),this.identity.length===0&&(this.identity=jo.IDENTITY),this.createAnnouncementAriaLiveRegion(),this.setupDebouncedAnnounce()}disconnectedCallback(){var t;super.disconnectedCallback(),this.clearTimeOutsAndAnnouncements(),(t=this.debouncedAnnounce)==null||t.cancel()}updated(t){var r;t.has("identity")&&this.identity.length===0&&(this.identity=jo.IDENTITY,this.createAnnouncementAriaLiveRegion()),t.has("debounceTime")&&this.setupDebouncedAnnounce(),t.has("announcement")&&this.announcement&&this.announcement.length>0&&((r=this.debouncedAnnounce)==null||r.call(this))}};Qr.styles=[...X.styles,...zv],m([u({type:String,reflect:!0})],Qr.prototype,"announcement",2),m([u({type:String,reflect:!0})],Qr.prototype,"identity",2),m([u({type:String,reflect:!0,attribute:"data-aria-live"})],Qr.prototype,"dataAriaLive",2),m([u({type:Number,reflect:!0})],Qr.prototype,"delay",2),m([u({type:Number,reflect:!0})],Qr.prototype,"timeout",2),m([u({type:Number,reflect:!0,attribute:"debounce-time"})],Qr.prototype,"debounceTime",2);var Eh=Qr;Eh.register(Vv);var Gx=Eh;yh.register(Fv);var Kx=yh;var ge=a=>{class o extends a{constructor(){super(...arguments);this.name="";this.value="";this.internals=this.attachInternals()}get form(){return this.internals.form}get validity(){return this.internals.validity}get willValidate(){return this.internals.willValidate}setValidity(){this.inputElement&&this.internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement)}checkValidity(){return this.setValidity(),this.internals.checkValidity()}reportValidity(){return this.setValidity(),this.internals.reportValidity()}}return o.formAssociated=!0,m([u({reflect:!0,type:String})],o.prototype,"name",2),m([u({reflect:!0,type:String})],o.prototype,"value",2),m([u({reflect:!0,type:String,attribute:"validation-message"})],o.prototype,"validationMessage",2),m([Kt("input")],o.prototype,"inputElement",2),o};var Wx=H`
|
|
2771
2771
|
:host {
|
|
2772
2772
|
--mdc-label-font-size: var(--mds-font-apps-body-midsize-medium-font-size);
|
|
2773
2773
|
--mdc-label-font-weight: var(--mds-font-apps-body-midsize-medium-font-weight);
|