diff --git a/components/dist/notifications.js b/components/dist/notifications.js
index fbc9c4e..bf68c2e 100644
--- a/components/dist/notifications.js
+++ b/components/dist/notifications.js
@@ -125,6 +125,9 @@ smNotifications.innerHTML = `
cursor: pointer;
}
@media screen and (max-width: 640px){
+ .close{
+ display: none;
+ }
.notification-panel:not(:empty){
padding-bottom: 3rem;
}
@@ -220,17 +223,17 @@ customElements.define('sm-notifications', class extends HTMLElement {
${icon ? `
${icon}
` : ''}
${action ? `` : ''}
- ${pinned ? `
`;
if (action) {
notification.querySelector('.action').addEventListener('click', action.callback)
}
+ notification.querySelector('.close').addEventListener('click', () => {
+ this.removeNotification(notification);
+ });
if (pinned) {
- notification.querySelector('.close').addEventListener('click', () => {
- this.removeNotification(notification);
- });
} else {
setTimeout(() => {
this.removeNotification(notification, this.isBigViewport ? 'left' : 'top');
diff --git a/components/dist/notifications.min.js b/components/dist/notifications.min.js
index ddf1dbe..9200c86 100644
--- a/components/dist/notifications.min.js
+++ b/components/dist/notifications.min.js
@@ -1 +1 @@
-const smNotifications=document.createElement("template");smNotifications.innerHTML="\n \n \n ",customElements.define("sm-notifications",class extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"}).append(smNotifications.content.cloneNode(!0)),this.notificationPanel=this.shadowRoot.querySelector(".notification-panel"),this.animationOptions={duration:300,fill:"forwards",easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"},this.push=this.push.bind(this),this.createNotification=this.createNotification.bind(this),this.removeNotification=this.removeNotification.bind(this),this.clearAll=this.clearAll.bind(this),this.remove=this.remove.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.startX=0,this.currentX=0,this.endX=0,this.swipeDistance=0,this.swipeDirection="",this.swipeThreshold=0,this.startTime=0,this.swipeTime=0,this.swipeTimeThreshold=200,this.currentTarget=null,this.notificationTimeout=5e3,this.mediaQuery=window.matchMedia("(min-width: 640px)"),this.handleOrientationChange=this.handleOrientationChange.bind(this),this.isBigViewport=!1}set timeout(t){isNaN(t)||(this.notificationTimeout=t)}randString(t){let n="";const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e${e}`:""}\n \n ${o?`${o.label}`:""}\n ${i?'\n \n ':""}\n `,o&&r.querySelector(".action").addEventListener("click",o.callback),i?r.querySelector(".close").addEventListener("click",()=>{this.removeNotification(r)}):setTimeout(()=>{this.removeNotification(r,this.isBigViewport?"left":"top")},a),r}push(t,n={}){const i=this.createNotification(t,n);return this.isBigViewport?this.notificationPanel.append(i):this.notificationPanel.prepend(i),i.scrollIntoView({behavior:"smooth"}),this.notificationPanel.animate([{transform:`translateY(${this.isBigViewport?"":"-"}${i.clientHeight}px)`},{transform:"none"}],this.animationOptions),i.animate([{transform:"translateY(-1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions).onfinish=(t=>{t.target.commitStyles(),t.target.cancel()}),i.id}removeNotification(t,n="left"){if(!t)return;const i="left"===n||"top"===n?"-":"+";this.isBigViewport||"top"!==n?t.animate([{transform:this.currentX?`translateX(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateX(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=(()=>{t.remove()}):t.animate([{transform:this.currentX?`translateY(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateY(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=(()=>{t.remove()})}remove(t){const n=this.notificationPanel.querySelector(`#${t}`);n&&this.removeNotification(n)}clearAll(){Array.from(this.notificationPanel.children).forEach(t=>{this.removeNotification(t)})}handleTouchMove(t){this.currentX=t.touches[0].clientX-this.startX,this.currentTarget.style.transform=`translateX(${this.currentX}px)`}handleOrientationChange(t){this.isBigViewport=t.matches,t.matches}connectedCallback(){this.handleOrientationChange(this.mediaQuery),this.mediaQuery.addEventListener("change",this.handleOrientationChange),this.notificationPanel.addEventListener("touchstart",t=>{t.target.closest(".close")?this.removeNotification(t.target.closest(".notification")):t.target.closest(".notification")&&(this.swipeThreshold=t.target.closest(".notification").getBoundingClientRect().width/2,this.currentTarget=t.target.closest(".notification"),this.startTime=Date.now(),this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY,this.notificationPanel.addEventListener("touchmove",this.handleTouchMove,{passive:!0}))},{passive:!0}),this.notificationPanel.addEventListener("touchend",t=>{this.endX=t.changedTouches[0].clientX,this.endY=t.changedTouches[0].clientY,this.swipeDistance=Math.abs(this.endX-this.startX),this.swipeTime=Date.now()-this.startTime,this.endX>this.startX?this.swipeDirection="right":this.swipeDirection="left",this.swipeTime50&&this.removeNotification(this.currentTarget,this.swipeDirection):this.swipeDistance>this.swipeThreshold?this.removeNotification(this.currentTarget,this.swipeDirection):this.currentTarget.animate([{transform:`translateX(${this.currentX}px)`},{transform:"none"}],this.animationOptions).onfinish=(t=>{t.target.commitStyles(),t.target.cancel()}),this.notificationPanel.removeEventListener("touchmove",this.handleTouchMove),this.currentX=0})}disconnectedCallback(){mediaQueryList.removeEventListener("change",handleOrientationChange)}});
\ No newline at end of file
+const smNotifications=document.createElement("template");smNotifications.innerHTML="\n \n \n ",customElements.define("sm-notifications",class extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"}).append(smNotifications.content.cloneNode(!0)),this.notificationPanel=this.shadowRoot.querySelector(".notification-panel"),this.animationOptions={duration:300,fill:"forwards",easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"},this.push=this.push.bind(this),this.createNotification=this.createNotification.bind(this),this.removeNotification=this.removeNotification.bind(this),this.clearAll=this.clearAll.bind(this),this.remove=this.remove.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.startX=0,this.currentX=0,this.endX=0,this.swipeDistance=0,this.swipeDirection="",this.swipeThreshold=0,this.startTime=0,this.swipeTime=0,this.swipeTimeThreshold=200,this.currentTarget=null,this.notificationTimeout=5e3,this.mediaQuery=window.matchMedia("(min-width: 640px)"),this.handleOrientationChange=this.handleOrientationChange.bind(this),this.isBigViewport=!1}set timeout(t){isNaN(t)||(this.notificationTimeout=t)}randString(t){let n="";const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e${e}`:""}\n \n ${o?`${o.label}`:""}\n \n \n \n `,o&&r.querySelector(".action").addEventListener("click",o.callback),r.querySelector(".close").addEventListener("click",()=>{this.removeNotification(r)}),i||setTimeout(()=>{this.removeNotification(r,this.isBigViewport?"left":"top")},a),r}push(t,n={}){const i=this.createNotification(t,n);return this.isBigViewport?this.notificationPanel.append(i):this.notificationPanel.prepend(i),i.scrollIntoView({behavior:"smooth"}),this.notificationPanel.animate([{transform:`translateY(${this.isBigViewport?"":"-"}${i.clientHeight}px)`},{transform:"none"}],this.animationOptions),i.animate([{transform:"translateY(-1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions).onfinish=(t=>{t.target.commitStyles(),t.target.cancel()}),i.id}removeNotification(t,n="left"){if(!t)return;const i="left"===n||"top"===n?"-":"+";this.isBigViewport||"top"!==n?t.animate([{transform:this.currentX?`translateX(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateX(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=(()=>{t.remove()}):t.animate([{transform:this.currentX?`translateY(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateY(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=(()=>{t.remove()})}remove(t){const n=this.notificationPanel.querySelector(`#${t}`);n&&this.removeNotification(n)}clearAll(){Array.from(this.notificationPanel.children).forEach(t=>{this.removeNotification(t)})}handleTouchMove(t){this.currentX=t.touches[0].clientX-this.startX,this.currentTarget.style.transform=`translateX(${this.currentX}px)`}handleOrientationChange(t){this.isBigViewport=t.matches,t.matches}connectedCallback(){this.handleOrientationChange(this.mediaQuery),this.mediaQuery.addEventListener("change",this.handleOrientationChange),this.notificationPanel.addEventListener("touchstart",t=>{t.target.closest(".close")?this.removeNotification(t.target.closest(".notification")):t.target.closest(".notification")&&(this.swipeThreshold=t.target.closest(".notification").getBoundingClientRect().width/2,this.currentTarget=t.target.closest(".notification"),this.startTime=Date.now(),this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY,this.notificationPanel.addEventListener("touchmove",this.handleTouchMove,{passive:!0}))},{passive:!0}),this.notificationPanel.addEventListener("touchend",t=>{this.endX=t.changedTouches[0].clientX,this.endY=t.changedTouches[0].clientY,this.swipeDistance=Math.abs(this.endX-this.startX),this.swipeTime=Date.now()-this.startTime,this.endX>this.startX?this.swipeDirection="right":this.swipeDirection="left",this.swipeTime50&&this.removeNotification(this.currentTarget,this.swipeDirection):this.swipeDistance>this.swipeThreshold?this.removeNotification(this.currentTarget,this.swipeDirection):this.currentTarget.animate([{transform:`translateX(${this.currentX}px)`},{transform:"none"}],this.animationOptions).onfinish=(t=>{t.target.commitStyles(),t.target.cancel()}),this.notificationPanel.removeEventListener("touchmove",this.handleTouchMove),this.currentX=0})}disconnectedCallback(){mediaQueryList.removeEventListener("change",handleOrientationChange)}});
\ No newline at end of file