@kodaris/krubble-components 1.0.3 → 1.0.4

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.
@@ -624,9 +624,12 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
624
624
  max-height: 90vh;
625
625
  overflow: auto;
626
626
  }
627
- `,Ce([ue()],e.KRDialog.prototype,"contentElement",void 0),e.KRDialog=Ce([de("kr-dialog")],e.KRDialog);var Pe,Te=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSnackbar=Pe=class extends ae{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.message="",this.duration=5e3}static show(e,t){const i=document.createElement("kr-snackbar");return i.message=e,i.type=t?.type??"info",i.duration=t?.duration??5e3,document.body.appendChild(i),i}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),Pe.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout(()=>{this.dismiss()},this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Pe.activeSnackbars.indexOf(this);e>-1&&Pe.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=16;for(const t of Pe.activeSnackbars)t.style.bottom=`${e}px`,e+=t.offsetHeight+8}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()},{once:!0})}render(){const e={info:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return F`
627
+ `,Ce([ue()],e.KRDialog.prototype,"contentElement",void 0),e.KRDialog=Ce([de("kr-dialog")],e.KRDialog);var Pe,Te=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSnackbar=Pe=class extends ae{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),Pe.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout(()=>{this.dismiss()},this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Pe.activeSnackbars.indexOf(this);e>-1&&Pe.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=24;for(const t of Pe.activeSnackbars)t.style.bottom=`${e}px`,e+=t.offsetHeight+8}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()},{once:!0})}render(){const e={info:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return F`
628
628
  ${e[this.type]}
629
- <div class="message">${this.message}</div>
629
+ <div class="content">
630
+ ${this.title?F`<div class="title">${this.title}</div>`:""}
631
+ <div class="message">${this.message}</div>
632
+ </div>
630
633
  <button
631
634
  class="dismiss"
632
635
  type="button"
@@ -650,7 +653,7 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
650
653
  left: 16px;
651
654
  z-index: 10000;
652
655
  display: flex;
653
- align-items: center;
656
+ align-items: flex-start;
654
657
  gap: 12px;
655
658
  padding: 14px 12px 14px 16px;
656
659
  border-radius: 8px;
@@ -734,10 +737,22 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
734
737
  flex-shrink: 0;
735
738
  width: 20px;
736
739
  height: 20px;
740
+ margin-top: 1px;
737
741
  }
738
742
 
739
- .message {
743
+ .content {
740
744
  flex: 1;
745
+ min-width: 0;
746
+ }
747
+
748
+ .title {
749
+ font-size: 14px;
750
+ font-weight: 600;
751
+ color: #000000;
752
+ margin: 0 0 2px 0;
753
+ }
754
+
755
+ .message {
741
756
  font-size: 14px;
742
757
  color: #000000;
743
758
  margin: 0;
@@ -768,7 +783,7 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
768
783
  outline: 2px solid #3b82f6;
769
784
  outline-offset: 2px;
770
785
  }
771
- `,e.KRSnackbar.activeSnackbars=[],Te([pe({type:String})],e.KRSnackbar.prototype,"type",void 0),Te([pe({type:String})],e.KRSnackbar.prototype,"message",void 0),Te([pe({type:Number})],e.KRSnackbar.prototype,"duration",void 0),e.KRSnackbar=Pe=Te([de("kr-snackbar")],e.KRSnackbar);
786
+ `,e.KRSnackbar.activeSnackbars=[],Te([pe({type:String})],e.KRSnackbar.prototype,"type",void 0),Te([pe({type:String})],e.KRSnackbar.prototype,"title",void 0),Te([pe({type:String})],e.KRSnackbar.prototype,"message",void 0),Te([pe({type:Number})],e.KRSnackbar.prototype,"duration",void 0),e.KRSnackbar=Pe=Te([de("kr-snackbar")],e.KRSnackbar);
772
787
  /**
773
788
  * @license
774
789
  * Copyright 2020 Google LLC