diff --git a/dist/bootstrap-native-v4.js b/dist/bootstrap-native-v4.js index 04769064..475544f3 100644 --- a/dist/bootstrap-native-v4.js +++ b/dist/bootstrap-native-v4.js @@ -18,6 +18,7 @@ root.Popover = bsn.Popover; root.ScrollSpy = bsn.ScrollSpy; root.Tab = bsn.Tab; + root.Toast = bsn.Toast; root.Tooltip = bsn.Tooltip; } }(this, function () { @@ -51,8 +52,10 @@ stringScrollSpy = 'ScrollSpy', stringTab = 'Tab', stringTooltip = 'Tooltip', + stringToast = 'Toast', // options DATA API + dataAutohide = 'data-autohide', databackdrop = 'data-backdrop', dataKeyboard = 'data-keyboard', dataTarget = 'data-target', @@ -1623,6 +1626,104 @@ supports[push]( [ stringTab, Tab, '['+dataToggle+'="tab"]' ] ); + /* Native Javascript for Bootstrap 4 | Toast + ---------------------------------------------*/ + + // TOAST DEFINITION + // ================== + var Toast = function( element,options ) { + + // initialization element + element = queryElement(element); + + // set options + options = options || {}; + + // DATA API + var animationData = element[getAttribute](dataAnimation), + autohideData = element[getAttribute](dataAutohide), + delayData = element[getAttribute](dataDelay), + + // strings + component = 'toast', + autohide = 'autohide', + animation = 'animation', + showing = 'showing', + hide = 'hide', + fade = 'fade'; + + // set instance options + this[animation] = options[animation] === false || animationData === 'false' ? 0 : 1; // true by default + this[autohide] = options[autohide] === false || autohideData === 'false' ? 0 : 1; // true by default + this[delay] = parseInt(options[delay] || delayData) || 500; // 500ms default + + // bind,toast and timer + var self = this, timer = 0, + // get the toast element + toast = getClosest(element,'.toast'); + + // private methods + // animation complete + var showComplete = function() { + removeClass( toast, showing ); + addClass( toast, showClass ); + bootstrapCustomEvent.call(toast, shownEvent, component); + if (self[autohide]) { self.hide(); } + }, + hideComplete = function() { + addClass( toast, hide ); + bootstrapCustomEvent.call(toast, hiddenEvent, component); + }, + close = function() { + removeClass( toast,showClass ); + self[animation] ? emulateTransitionEnd(toast, hideComplete) : hideComplete(); + }; + + // public methods + this.show = function() { + if (toast) { + bootstrapCustomEvent.call(toast, showEvent, component); + self[animation] && addClass( toast,fade ); + removeClass( toast,hide); + addClass( toast,showing); + + self[animation] ? emulateTransitionEnd(toast, showComplete) : showComplete(); + } + }; + this.hide = function(noTimer) { + if (toast && hasClass(toast,showClass)) { + bootstrapCustomEvent.call(toast, hideEvent, component); + + if (noTimer) { + close(); + } else { + timer = setTimeout( close, self[delay]); + } + } + }; + this.dispose = function() { + clearTimeout(timer); timer = null; + if ( toast && hasClass(toast,showClass) ) { + removeClass( toast,showClass ); + } + off(element, clickEvent, self.hide); + element[stringToast] = null; + element = null; + toast = null; + }; + + // init + if ( !(stringToast in element) ) { // prevent adding event handlers twice + on(element, clickEvent, self.hide); + } + element[stringToast] = self; + }; + + // TOAST DATA API + // ================= + supports[push]( [ stringToast, Toast, '['+dataDismiss+'="toast"]' ] ); + + /* Native Javascript for Bootstrap 4 | Tooltip ---------------------------------------------*/ @@ -1761,23 +1862,23 @@ supports[push]( [ stringTooltip, Tooltip, '['+dataToggle+'="tooltip"]' ] ); - - /* Native Javascript for Bootstrap 4 | Initialize Data API - --------------------------------------------------------*/ - var initializeDataAPI = function( constructor, collection ){ - for (var i=0, l=collection[length]; i=v,A=m[Qt]+d.h/2+w.h/2>=p,k=m[Qt]-d.h<0,I=m[Jt]-d.w<0,N=m[Qt]+d.h+w.h>=p,E=m[Jt]+d.w+w.w>=v;a=(a===Jt||a===Kt)&&I&&E?Qt:a,a=a===Qt&&k?Vt:a,a=a===Vt&&N?Qt:a,a=a===Jt&&I?Kt:a,a=a===Kt&&E?Jt:a,o.className[Mt](a)===-1&&(o.className=o.className.replace($t,a)),f=y[Z],h=y[$],a===Jt||a===Kt?(c=a===Jt?m[Jt]+g.x-d.w-(b?f:0):m[Jt]+g.x+w.w,T?(r=m[Qt]+g.y,u=w.h/2-f):A?(r=m[Qt]+g.y-d.h+w.h,u=d.h-w.h/2-f):(r=m[Qt]+g.y-d.h/2+w.h/2,u=d.h/2-(b?.9*h:h/2))):a!==Qt&&a!==Vt||(r=a===Qt?m[Qt]+g.y-d.h-(b?h:0):m[Qt]+g.y+w.h,x?(c=0,s=m[Jt]+w.w/2-f):C?(c=v-1.01*d.w,s=d.w-(v-m[Jt])+w.w/2-f/2):(c=m[Jt]+g.x-d.w/2+w.w/2,s=d.w/2-f/2)),o[Rt][Qt]=r+"px",o[Rt][Jt]=c+"px",u&&(y[Rt][Qt]=u+"px"),s&&(y[Rt][Jt]=s+"px")};o.version="2.0.25";var ye=function(t){t=se(t);var e=this,n="alert",i=fe(t,"."+n),o=function(){ce(i,"fade")?me(i,l):l()},a=function(o){i=fe(o[j],"."+n),t=se("["+r+'="'+n+'"]',i),t&&i&&(t===o[j]||t[Ft](o[j]))&&e.close()},l=function(){ge.call(i,gt,n),de(t,lt,a),i[Pt].removeChild(i)};this.close=function(){i&&t&&ce(i,Yt)&&(ge.call(i,mt,n),re(i,Yt),i&&o())},s in t||he(t,lt,a),t[s]=e};a[Ut]([s,ye,"["+r+'="alert"]']);var Te=function(t){t=se(t);var n=!1,i="button",o="checked",a="LABEL",l="INPUT",r=function(t){var n=t.which||t.keyCode;32===n&&t[j]===e.activeElement&&u(t)},c=function(t){var e=t.which||t.keyCode;32===e&&t[Et]()},u=function(e){var r=e[j].tagName===a?e[j]:e[j][Pt].tagName===a?e[j][Pt]:null;if(r){var c=e[j],u=ue(c[Pt],"btn"),s=r[Nt](l)[0];if(s){if("checkbox"===s.type&&(s[o]?(re(r,Xt),s[Tt](o),s.removeAttribute(o),s[o]=!1):(le(r,Xt),s[Tt](o),s[xt](o,o),s[o]=!0),n||(n=!0,ge.call(s,yt,i),ge.call(t,yt,i))),"radio"===s.type&&!n&&!s[o]){le(r,Xt),s[xt](o,o),s[o]=!0,ge.call(s,yt,i),ge.call(t,yt,i),n=!0;for(var f=0,h=u[Ht];f=0},W=function(t){for(var e=0,n=L[Ht];et||o===x-1&&0===t)&&(A=m[d]=Kt),t<0?t=x-1:t>=x&&(t=0),g=t,n=A===Jt?"next":"prev",ge.call(i,bt,s,y[t]),b=!0,clearInterval(w),w=null,W(t),ne&&ce(i,"slide")?(le(y[t],v+"-"+n),y[t][Z],le(y[t],v+"-"+A),le(y[o],v+"-"+A),ve(y[t],ie,function(a){var l=a[j]!==y[t]?1e3*a.elapsedTime+100:20;b&&setTimeout(function(){b=!1,le(y[t],Xt),re(y[o],Xt),re(y[t],v+"-"+n),re(y[t],v+"-"+A),re(y[o],v+"-"+A),ge.call(i,wt,s,y[t]),e.hidden||!m[R]||ce(i,f)||m.cycle()},l)})):(le(y[t],Xt),y[t][Z],re(y[o],Xt),setTimeout(function(){b=!1,m[R]&&!ce(i,f)&&m.cycle(),ge.call(i,wt,s,y[t])},100)))}},this.getActiveIndex=function(){return y[Mt](ue(i,v+" active")[0])||0},h in i||(m[U]&&m[R]&&(he(i,Zt[0],S),he(i,Zt[1],B),he(i,"touchstart",S),he(i,"touchend",B)),N&&he(N,lt,M),I&&he(I,lt,M),E&&he(E,lt,D),m[H]===!0&&he(t,ct,P)),m.getActiveIndex()<0&&(y[Ht]&&le(y[0],Xt),L[Ht]&&W(0)),m[R]&&m.cycle(),i[h]=m}};a[Ut]([h,xe,"["+u+'="carousel"]']);var Ce=function(t,e){t=se(t),e=e||{};var n,i,o=null,a=null,r=this,c=t[Tt]("data-parent"),u="collapse",s="collapsed",f="isAnimating",h=function(t,e){ge.call(t,ht,u),t[f]=!0,le(t,Gt),re(t,u),t[Rt][nt]=t[et]+"px",me(t,function(){t[f]=!1,t[xt](it,"true"),e[xt](it,"true"),re(t,Gt),le(t,u),le(t,Yt),t[Rt][nt]="",ge.call(t,dt,u)})},v=function(t,e){ge.call(t,vt,u),t[f]=!0,t[Rt][nt]=t[et]+"px",re(t,u),re(t,Yt),le(t,Gt),t[Z],t[Rt][nt]="0px",me(t,function(){t[f]=!1,t[xt](it,"false"),e[xt](it,"false"),re(t,Gt),le(t,u),t[Rt][nt]="",ge.call(t,pt,u)})},p=function(){var e=t.href&&t[Tt]("href"),n=t[Tt](x),i=e||n&&"#"===n.charAt(0)&&n;return i&&se(i)};this.toggle=function(t){t[Et](),ce(a,Yt)?r.hide():r.show()},this.hide=function(){a[f]||(v(a,t),le(t,s))},this.show=function(){o&&(n=se("."+u+"."+Yt,o),i=n&&(se("["+l+'="'+u+'"]['+x+'="#'+n.id+'"]',o)||se("["+l+'="'+u+'"][href="#'+n.id+'"]',o))),(!a[f]||n&&!n[f])&&(i&&n!==a&&(v(n,i),le(i,s)),h(a,t),re(t,s))},d in t||he(t,lt,r.toggle),a=p(),a[f]=!1,o=se(e.parent)||c&&fe(t,c),t[d]=r};a[Ut]([d,Ce,"["+l+'="collapse"]']);var Ae=function(t,n){t=se(t),this.persist=n===!0||"true"===t[Tt]("data-persist")||!1;var i=this,o="children",a=t[Pt],l="dropdown",r="open",c=null,u=se(".dropdown-menu",a),s=function(){for(var t=u[o],e=[],n=0;n1?l-1:0:40===o&&l×',T=se(o[X]),x=se(s),C=fe(n,".modal"),A=fe(n,"."+te),k=fe(n,"."+ee);this[h]=o[h]?o[h]:null,this[d]=o[d]?o[d]:a||rt,this[z]=o[z]&&o[z]!==g?o[z]:l||g,this[F]=o[F]?o[F]:r||Qt,this[O]=parseInt(o[O]||u)||200,this[b]=!(!o[b]&&"true"!==c),this[X]=T?T:x?x:A?A:k?k:C?C:e[i];var N=this,P=n[Tt](I)||null,H=n[Tt](w)||null;if(H||this[h]){var W=null,q=0,R=this[F],U=function(t){null!==W&&t[j]===se(".close",W)&&N.hide()},Y=function(){N[X].removeChild(W),q=null,W=null},G=function(){P=n[Tt](I),H=n[Tt](w),W=e[At](p);var t=e[At](p);if(t[xt](v,"arrow"),W[kt](t),null!==H&&null===N[h]){if(W[xt]("role","tooltip"),null!==P){var i=e[At]("h3");i[xt](v,f+"-header"),i[It]=N[b]?P+y:P,W[kt](i)}var o=e[At](p);o[xt](v,f+"-body"),o[It]=N[b]&&null===P?H+y:H,W[kt](o)}else{var a=e[At](p);a[It]=N[h],W[It]=a.firstChild[It]}N[X][kt](W),W[Rt].display="block",W[xt](v,f+" bs-"+f+"-"+R+" "+N[z])},J=function(){!ce(W,Yt)&&le(W,Yt)},K=function(){be(n,W,R,N[X])},Q=function(i){lt!=N[d]&&"focus"!=N[d]||!N[b]&&i(n,"blur",N.hide),N[b]&&i(e,lt,U),i(t,st,N.hide)},V=function(){Q(he),ge.call(n,dt,f)},Z=function(){Q(de),Y(),ge.call(n,pt,f)};this.toggle=function(){null===W?N.show():N.hide()},this.show=function(){clearTimeout(q),q=setTimeout(function(){null===W&&(R=N[F],G(),K(),J(),ge.call(n,ht,f),N[z]?me(W,V):V())},20)},this.hide=function(){clearTimeout(q),q=setTimeout(function(){W&&null!==W&&ce(W,Yt)&&(ge.call(n,vt,f),re(W,Yt),N[z]?me(W,Z):Z())},N[O])},m in n||(N[d]===rt?(he(n,Zt[0],N.show),N[b]||he(n,Zt[1],N.hide)):lt!=N[d]&&"focus"!=N[d]||he(n,N[d],N.toggle)),n[m]=N}};a[Ut]([m,Ie,"["+l+'="popover"]']);var Ne=function(e,n){e=se(e);var i=se(e[Tt](x)),o=e[Tt]("data-offset");if(n=n||{},n[j]||i){for(var a,l=this,r=n[j]&&se(n[j])||i,c=r&&r[Nt]("A"),u=parseInt(o||n.offset)||10,s=[],f=[],h=e[$]=h&&v>a;if(!c&&p)ce(n,Xt)||(le(n,Xt),l&&!ce(l,Xt)&&le(l,Xt),ge.call(e,"activate","scrollspy",s[t]));else if(p){if(!p&&!c||c&&p)return}else ce(n,Xt)&&(re(n,Xt),l&&ce(l,Xt)&&!ue(n[Pt],Xt).length&&re(l,Xt))},y=function(){a=d?we().y:e[J];for(var t=0,n=s[Ht];t1&&(t=e[e[Ht]-1]):t=e[0],t},C=function(){return se(x()[Tt]("href"))},k=function(t){t[Et](),r=t[q],!p[l]&&!ce(r,Xt)&&v.show()};this.show=function(){r=r||t,s=se(r[Tt]("href")),c=x(),u=C(),p[l]=!0,re(c,Xt),c[xt](at,"false"),le(r,Xt),r[xt](at,"true"),g&&(ce(t[Pt],"dropdown-menu")?ce(g,Xt)||le(g,Xt):ce(g,Xt)&&re(g,Xt)),ge.call(c,vt,i,r),ce(u,"fade")?(re(u,Yt),me(u,T)):T()},w in t||he(t,lt,k),v[o]&&(m=C()[Pt]),t[w]=v}};a[Ut]([w,Ee,"["+l+'="tab"]']);var Le=function(n,o){n=se(n),o=o||{};var a=n[Tt](S),l=n[Tt](D),r=n[Tt](M),c=n[Tt](B),u="tooltip",s="class",f="title",h="fade",d="div",v=se(o[X]),p=se(c),m=fe(n,".modal"),g=fe(n,"."+te),w=fe(n,"."+ee);this[z]=o[z]&&o[z]!==h?o[z]:a||h,this[F]=o[F]?o[F]:l||Qt,this[O]=parseInt(o[O]||r)||200,this[X]=v?v:p?p:g?g:w?w:m?m:e[i];var y=this,T=0,x=this[F],C=null,A=n[Tt](f)||n[Tt](I)||n[Tt](N);if(A&&""!=A){var k=function(){y[X].removeChild(C),C=null,T=null},E=function(){if(A=n[Tt](f)||n[Tt](I)||n[Tt](N),!A||""==A)return!1;C=e[At](d),C[xt]("role",u);var t=e[At](d);t[xt](s,"arrow"),C[kt](t);var i=e[At](d);i[xt](s,u+"-inner"),C[kt](i),i[It]=A,y[X][kt](C),C[xt](s,u+" bs-"+u+"-"+x+" "+y[z])},L=function(){be(n,C,x,y[X])},P=function(){!ce(C,Yt)&&le(C,Yt)},H=function(){he(t,st,y.hide),ge.call(n,dt,u)},W=function(){de(t,st,y.hide),k(),ge.call(n,pt,u)};this.show=function(){clearTimeout(T),T=setTimeout(function(){if(null===C){if(x=y[F],0==E())return;L(),P(),ge.call(n,ht,u),y[z]?me(C,H):H()}},20)},this.hide=function(){clearTimeout(T),T=setTimeout(function(){C&&ce(C,Yt)&&(ge.call(n,vt,u),re(C,Yt),y[z]?me(C,W):W())},y[O])},this.toggle=function(){C?y.hide():y.show()},b in n||(n[xt](N,A),n.removeAttribute(f),he(n,Zt[0],y.show),he(n,Zt[1],y.hide)),n[b]=y}};a[Ut]([b,Le,"["+l+'="tooltip"]']);var Se=function(t,e){for(var n=0,i=e[Ht];n=v,A=m[Zt]+d.h/2+w.h/2>=p,k=m[Zt]-d.h<0,I=m[Qt]-d.w<0,N=m[Zt]+d.h+w.h>=p,E=m[Qt]+d.w+w.w>=v;a=(a===Qt||a===Vt)&&I&&E?Zt:a,a=a===Zt&&k?$t:a,a=a===$t&&N?Zt:a,a=a===Qt&&I?Vt:a,a=a===Vt&&E?Qt:a,o.className[Ht](a)===-1&&(o.className=o.className.replace(te,a)),f=y[_],h=y[tt],a===Qt||a===Vt?(c=a===Qt?m[Qt]+g.x-d.w-(b?f:0):m[Qt]+g.x+w.w,T?(r=m[Zt]+g.y,u=w.h/2-f):A?(r=m[Zt]+g.y-d.h+w.h,u=d.h-w.h/2-f):(r=m[Zt]+g.y-d.h/2+w.h/2,u=d.h/2-(b?.9*h:h/2))):a!==Zt&&a!==$t||(r=a===Zt?m[Zt]+g.y-d.h-(b?h:0):m[Zt]+g.y+w.h,x?(c=0,s=m[Qt]+w.w/2-f):C?(c=v-1.01*d.w,s=d.w-(v-m[Qt])+w.w/2-f/2):(c=m[Qt]+g.x-d.w/2+w.w/2,s=d.w/2-f/2)),o[zt][Zt]=r+"px",o[zt][Qt]=c+"px",u&&(y[zt][Zt]=u+"px"),s&&(y[zt][Qt]=s+"px")};o.version="2.0.25";var xe=function(t){t=he(t);var e=this,n="alert",i=de(t,"."+n),o=function(){se(i,"fade")?we(i,l):l()},a=function(o){i=de(o[R],"."+n),t=he("["+r+'="'+n+'"]',i),t&&i&&(t===o[R]||t[Yt](o[R]))&&e.close()},l=function(){be.call(i,bt,n),pe(t,ct,a),i[Ot].removeChild(i)};this.close=function(){i&&t&&se(i,Jt)&&(be.call(i,wt,n),ue(i,Jt),i&&o())},s in t||ve(t,ct,a),t[s]=e};a[Ft]([s,xe,"["+r+'="alert"]']);var Ce=function(t){t=he(t);var n=!1,i="button",o="checked",a="LABEL",l="INPUT",r=function(t){var n=t.which||t.keyCode;32===n&&t[R]===e.activeElement&&u(t)},c=function(t){var e=t.which||t.keyCode;32===e&&t[St]()},u=function(e){var r=e[R].tagName===a?e[R]:e[R][Ot].tagName===a?e[R][Ot]:null;if(r){var c=e[R],u=fe(c[Ot],"btn"),s=r[Lt](l)[0];if(s){if("checkbox"===s.type&&(s[o]?(ue(r,Gt),s[Ct](o),s.removeAttribute(o),s[o]=!1):(ce(r,Gt),s[Ct](o),s[At](o,o),s[o]=!0),n||(n=!0,be.call(s,xt,i),be.call(t,xt,i))),"radio"===s.type&&!n&&!s[o]){ce(r,Gt),s[At](o,o),s[o]=!0,be.call(s,xt,i),be.call(t,xt,i),n=!0;for(var f=0,h=u[Wt];f=0},O=function(t){for(var e=0,n=L[Wt];et||o===T-1&&0===t)&&(x=m[d]=Vt),t<0?t=T-1:t>=T&&(t=0),g=t,n=x===Qt?"next":"prev",be.call(i,Tt,s,y[t]),b=!0,clearInterval(w),w=null,O(t),oe&&se(i,"slide")?(ce(y[t],v+"-"+n),y[t][_],ce(y[t],v+"-"+x),ce(y[o],v+"-"+x),me(y[t],ae,function(a){var l=a[R]!==y[t]?1e3*a.elapsedTime+100:20;b&&setTimeout(function(){b=!1,ce(y[t],Gt),ue(y[o],Gt),ue(y[t],v+"-"+n),ue(y[t],v+"-"+x),ue(y[o],v+"-"+x),be.call(i,yt,s,y[t]),e.hidden||!m[z]||se(i,f)||m.cycle()},l)})):(ce(y[t],Gt),y[t][_],ue(y[o],Gt),setTimeout(function(){b=!1,m[z]&&!se(i,f)&&m.cycle(),be.call(i,yt,s,y[t])},100)))}},this.getActiveIndex=function(){return y[Ht](fe(i,v+" active")[0])||0},h in i||(m[F]&&m[z]&&(ve(i,_t[0],S),ve(i,_t[1],B),ve(i,"touchstart",S),ve(i,"touchend",B)),I&&ve(I,ct,M),A&&ve(A,ct,M),E&&ve(E,ct,D),m[W]===!0&&ve(t,st,P)),m.getActiveIndex()<0&&(y[Wt]&&ce(y[0],Gt),L[Wt]&&O(0)),m[z]&&m.cycle(),i[h]=m}};a[Ft]([h,Ae,"["+u+'="carousel"]']);var ke=function(t,e){t=he(t),e=e||{};var n,i,o=null,a=null,r=this,c=t[Ct]("data-parent"),u="collapse",s="collapsed",f="isAnimating",h=function(t,e){be.call(t,vt,u),t[f]=!0,ce(t,Kt),ue(t,u),t[zt][ot]=t[it]+"px",we(t,function(){t[f]=!1,t[At](at,"true"),e[At](at,"true"),ue(t,Kt),ce(t,u),ce(t,Jt),t[zt][ot]="",be.call(t,pt,u)})},v=function(t,e){be.call(t,mt,u),t[f]=!0,t[zt][ot]=t[it]+"px",ue(t,u),ue(t,Jt),ce(t,Kt),t[_],t[zt][ot]="0px",we(t,function(){t[f]=!1,t[At](at,"false"),e[At](at,"false"),ue(t,Kt),ce(t,u),t[zt][ot]="",be.call(t,gt,u)})},p=function(){var e=t.href&&t[Ct]("href"),n=t[Ct](A),i=e||n&&"#"===n.charAt(0)&&n;return i&&he(i)};this.toggle=function(t){t[St](),se(a,Jt)?r.hide():r.show()},this.hide=function(){a[f]||(v(a,t),ce(t,s))},this.show=function(){o&&(n=he("."+u+"."+Jt,o),i=n&&(he("["+l+'="'+u+'"]['+A+'="#'+n.id+'"]',o)||he("["+l+'="'+u+'"][href="#'+n.id+'"]',o))),(!a[f]||n&&!n[f])&&(i&&n!==a&&(v(n,i),ce(i,s)),h(a,t),ue(t,s))},d in t||ve(t,ct,r.toggle),a=p(),a[f]=!1,o=he(e.parent)||c&&de(t,c),t[d]=r};a[Ft]([d,ke,"["+l+'="collapse"]']);var Ie=function(t,n){t=he(t),this.persist=n===!0||"true"===t[Ct]("data-persist")||!1;var i=this,o="children",a=t[Ot],l="dropdown",r="open",c=null,u=he(".dropdown-menu",a),s=function(){for(var t=u[o],e=[],n=0;n1?l-1:0:40===o&&l×',T=he(o[G]),x=he(s),C=de(n,".modal"),A=de(n,"."+ne),k=de(n,"."+ie);this[h]=o[h]?o[h]:null,this[d]=o[d]?o[d]:a||ut,this[X]=o[X]&&o[X]!==g?o[X]:l||g,this[Y]=o[Y]?o[Y]:r||Zt,this[j]=parseInt(o[j]||u)||200,this[b]=!(!o[b]&&"true"!==c),this[G]=T?T:x?x:A?A:k?k:C?C:e[i];var I=this,N=n[Ct](E)||null,L=n[Ct](w)||null;if(L||this[h]){var O=null,W=0,q=this[Y],U=function(t){null!==O&&t[R]===he(".close",O)&&I.hide()},z=function(){I[G].removeChild(O),W=null,O=null},F=function(){N=n[Ct](E),L=n[Ct](w),O=e[It](p);var t=e[It](p);if(t[At](v,"arrow"),O[Nt](t),null!==L&&null===I[h]){if(O[At]("role","tooltip"),null!==N){var i=e[It]("h3");i[At](v,f+"-header"),i[Et]=I[b]?N+y:N,O[Nt](i)}var o=e[It](p);o[At](v,f+"-body"),o[Et]=I[b]&&null===N?L+y:L,O[Nt](o)}else{var a=e[It](p);a[Et]=I[h],O[Et]=a.firstChild[Et]}I[G][Nt](O),O[zt].display="block",O[At](v,f+" bs-"+f+"-"+q+" "+I[X])},J=function(){!se(O,Jt)&&ce(O,Jt)},K=function(){Te(n,O,q,I[G])},Q=function(i){ct!=I[d]&&"focus"!=I[d]||!I[b]&&i(n,"blur",I.hide),I[b]&&i(e,ct,U),i(t,ht,I.hide)},V=function(){Q(ve),be.call(n,pt,f)},Z=function(){Q(pe),z(),be.call(n,gt,f)};this.toggle=function(){null===O?I.show():I.hide()},this.show=function(){clearTimeout(W),W=setTimeout(function(){null===O&&(q=I[Y],F(),K(),J(),be.call(n,vt,f),I[X]?we(O,V):V())},20)},this.hide=function(){clearTimeout(W),W=setTimeout(function(){O&&null!==O&&se(O,Jt)&&(be.call(n,mt,f),ue(O,Jt),I[X]?we(O,Z):Z())},I[j])},m in n||(I[d]===ut?(ve(n,_t[0],I.show),I[b]||ve(n,_t[1],I.hide)):ct!=I[d]&&"focus"!=I[d]||ve(n,I[d],I.toggle)),n[m]=I}};a[Ft]([m,Ee,"["+l+'="popover"]']);var Le=function(e,n){e=he(e);var i=he(e[Ct](A)),o=e[Ct]("data-offset");if(n=n||{},n[R]||i){for(var a,l=this,r=n[R]&&he(n[R])||i,c=r&&r[Lt]("A"),u=parseInt(o||n.offset)||10,s=[],f=[],h=e[tt]=h&&v>a;if(!c&&p)se(n,Gt)||(ce(n,Gt),l&&!se(l,Gt)&&ce(l,Gt),be.call(e,"activate","scrollspy",s[t]));else if(p){if(!p&&!c||c&&p)return}else se(n,Gt)&&(ue(n,Gt),l&&se(l,Gt)&&!fe(n[Ot],Gt).length&&ue(l,Gt))},y=function(){a=d?ye().y:e[Q];for(var t=0,n=s[Wt];t1&&(t=e[e[Wt]-1]):t=e[0],t},C=function(){return he(x()[Ct]("href"))},A=function(t){t[St](),r=t[U],!p[l]&&!se(r,Gt)&&v.show()};this.show=function(){r=r||t,s=he(r[Ct]("href")),c=x(),u=C(),p[l]=!0,ue(c,Gt),c[At](rt,"false"),ce(r,Gt),r[At](rt,"true"),g&&(se(t[Ot],"dropdown-menu")?se(g,Gt)||ce(g,Gt):se(g,Gt)&&ue(g,Gt)),be.call(c,mt,i,r),se(u,"fade")?(ue(u,Jt),we(u,T)):T()},w in t||ve(t,ct,A),v[o]&&(m=C()[Ot]),t[w]=v}};a[Ft]([w,Se,"["+l+'="tab"]']);var Be=function(t,e){t=he(t),e=e||{};var n=t[Ct](D),i=t[Ct](T),o=t[Ct](H),a="toast",l="autohide",r="animation",c="showing",u="hide",s="fade";this[r]=e[r]===!1||"false"===n?0:1,this[l]=e[l]===!1||"false"===i?0:1,this[j]=parseInt(e[j]||o)||500;var f=this,h=0,d=de(t,".toast"),v=function(){ue(d,c),ce(d,Jt),be.call(d,pt,a),f[l]&&f.hide()},p=function(){ue(d,u),be.call(d,gt,a)},m=function(){ue(t,Jt),f[r]?we(d,p):p()};this.show=function(){d&&(be.call(d,vt,a),f[r]&&ce(d,s),ue(d,u),ce(d,c),f[r]?we(d,v):v())},this.hide=function(t){d&&se(d,Jt)&&(be.call(d,mt,a),t?m():h=setTimeout(m,f[j]))},this.dispose=function(){clearTimeout(h),h=null,d&&se(d,Jt)&&ue(d,Jt),pe(t,ct,f.hide),t[y]=null,t=null,d=null},y in t||ve(t,ct,f.hide),t[y]=f};a[Ft]([y,Be,"["+r+'="toast"]']);var De=function(n,o){n=he(n),o=o||{};var a=n[Ct](D),l=n[Ct](P),r=n[Ct](H),c=n[Ct](M),u="tooltip",s="class",f="title",h="fade",d="div",v=he(o[G]),p=he(c),m=de(n,".modal"),g=de(n,"."+ne),w=de(n,"."+ie);this[X]=o[X]&&o[X]!==h?o[X]:a||h,this[Y]=o[Y]?o[Y]:l||Zt,this[j]=parseInt(o[j]||r)||200,this[G]=v?v:p?p:g?g:w?w:m?m:e[i];var y=this,T=0,x=this[Y],C=null,A=n[Ct](f)||n[Ct](E)||n[Ct](L);if(A&&""!=A){var k=function(){y[G].removeChild(C),C=null,T=null},I=function(){if(A=n[Ct](f)||n[Ct](E)||n[Ct](L),!A||""==A)return!1;C=e[It](d),C[At]("role",u);var t=e[It](d);t[At](s,"arrow"),C[Nt](t);var i=e[It](d);i[At](s,u+"-inner"),C[Nt](i),i[Et]=A,y[G][Nt](C),C[At](s,u+" bs-"+u+"-"+x+" "+y[X])},N=function(){Te(n,C,x,y[G])},S=function(){!se(C,Jt)&&ce(C,Jt)},B=function(){ve(t,ht,y.hide),be.call(n,pt,u)},O=function(){pe(t,ht,y.hide),k(),be.call(n,gt,u)};this.show=function(){clearTimeout(T),T=setTimeout(function(){if(null===C){if(x=y[Y],0==I())return;N(),S(),be.call(n,vt,u),y[X]?we(C,B):B()}},20)},this.hide=function(){clearTimeout(T),T=setTimeout(function(){C&&se(C,Jt)&&(be.call(n,mt,u),ue(C,Jt),y[X]?we(C,O):O())},y[j])},this.toggle=function(){C?y.hide():y.show()},b in n||(n[At](L,A),n.removeAttribute(f),ve(n,_t[0],y.show),ve(n,_t[1],y.hide)),n[b]=y}};a[Ft]([b,De,"["+l+'="tooltip"]']);var Me=function(t,e){for(var n=0,i=e[Wt];nNative JavaScript for Bootstrap 4 - + @@ -591,6 +591,41 @@

Tooltip

Tooltip on left </button> +

Toast BETA

+
+ +
+ +
+ +
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
+  <div class="toast-header">
+    <img src="..." class="rounded mr-2" alt="...">
+    <strong class="mr-auto">Bootstrap</strong>
+    <small>11 mins ago</small>
+    <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
+      <span aria-hidden="true">&times;</span>
+    </button>
+  </div>
+  <div class="toast-body">
+    Hello, world! This is a toast message.
+  </div>
+</div>
+ +
+

Tab