@coreui/coreui-pro
Advanced tools
Comparing version 2.0.0-beta.6 to 2.0.0-beta.8
/*! | ||
* CoreUI Pro v2.0.0-beta.6 (https://coreui.io/pro/) | ||
* CoreUI Pro v2.0.0-beta.8 (https://coreui.io/pro/) | ||
* Copyright 2018 Łukasz Holeczek | ||
@@ -33,3 +33,3 @@ * Licensed under MIT (https://coreui.io/pro/) | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): ajax-load.js | ||
* CoreUI (v2.0.0-beta.8): ajax-load.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -46,3 +46,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'ajaxLoad'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.ajaxLoad'; | ||
@@ -76,5 +76,9 @@ var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; | ||
this._element = element; | ||
var url = location.hash.replace(/^#/, ''); // eslint-disable-next-line no-unused-expressions | ||
var url = location.hash.replace(/^#/, ''); | ||
url !== '' ? this.setUpUrl(url) : this.setUpUrl(this._config.defaultPage); | ||
if (url !== '') { | ||
this.setUpUrl(url); | ||
} else { | ||
this.setUpUrl(this._config.defaultPage); | ||
} | ||
@@ -98,7 +102,2 @@ this._addEventListeners(); | ||
success: function success() { | ||
if (typeof Pace !== 'undefined') { | ||
// eslint-disable-next-line no-undef | ||
Pace.restart(); | ||
} | ||
$$$1('body').animate({ | ||
@@ -119,7 +118,5 @@ scrollTop: 0 | ||
$$$1(Selector.NAV_LINK).removeClass(ClassName.ACTIVE); | ||
$$$1(Selector.NAV_DROPDOWN).removeClass(ClassName.OPEN); // eslint-disable-next-line prefer-template | ||
$$$1(Selector.NAV_DROPDOWN + ':has(a[href="' + url.replace(/^\//, '').split('?')[0] + '"])').addClass(ClassName.OPEN); // eslint-disable-next-line prefer-template | ||
$$$1(Selector.NAV_ITEM + ' a[href="' + url.replace(/^\//, '').split('?')[0] + '"]').addClass(ClassName.ACTIVE); | ||
$$$1(Selector.NAV_DROPDOWN).removeClass(ClassName.OPEN); | ||
$$$1(Selector.NAV_DROPDOWN + ":has(a[href=\"" + url.replace(/^\//, '').split('?')[0] + "\"])").addClass(ClassName.OPEN); | ||
$$$1(Selector.NAV_ITEM + " a[href=\"" + url.replace(/^\//, '').split('?')[0] + "\"]").addClass(ClassName.ACTIVE); | ||
this.loadPage(url); | ||
@@ -145,4 +142,3 @@ }; | ||
// eslint-disable-next-line prefer-template | ||
$$$1(document).on(Event.CLICK, Selector.NAV_LINK + '[href!="#"]', function (event) { | ||
$$$1(document).on(Event.CLICK, Selector.NAV_LINK + "[href!=\"#\"]", function (event) { | ||
event.preventDefault(); | ||
@@ -209,23 +205,22 @@ event.stopPropagation(); | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): toggle-classes.js | ||
* CoreUI (v2.0.0-beta.8): toggle-classes.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
var RemoveClasses = function RemoveClasses(NewClassNames) { | ||
var MatchClasses = NewClassNames.map(function (Class) { | ||
return document.body.classList.contains(Class); | ||
}); | ||
return MatchClasses.indexOf(true) !== -1; | ||
var removeClasses = function removeClasses(classNames) { | ||
return classNames.map(function (className) { | ||
return document.body.classList.contains(className); | ||
}).indexOf(true) !== -1; | ||
}; | ||
var ToggleClasses = function ToggleClasses(Toggle, ClassNames) { | ||
var Level = ClassNames.indexOf(Toggle); | ||
var NewClassNames = ClassNames.slice(0, Level + 1); | ||
var toggleClasses = function toggleClasses(toggleClass, classNames) { | ||
var breakpoint = classNames.indexOf(toggleClass); | ||
var newClassNames = classNames.slice(0, breakpoint + 1); | ||
if (RemoveClasses(NewClassNames)) { | ||
NewClassNames.map(function (Class) { | ||
return document.body.classList.remove(Class); | ||
if (removeClasses(newClassNames)) { | ||
newClassNames.map(function (className) { | ||
return document.body.classList.remove(className); | ||
}); | ||
} else { | ||
document.body.classList.add(Toggle); | ||
document.body.classList.add(toggleClass); | ||
} | ||
@@ -236,3 +231,3 @@ }; | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): aside-menu.js | ||
* CoreUI (v2.0.0-beta.8): aside-menu.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -249,3 +244,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'aside-menu'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.aside-menu'; | ||
@@ -290,3 +285,3 @@ var EVENT_KEY = "." + DATA_KEY; | ||
var toggle = event.currentTarget.dataset.toggle; | ||
ToggleClasses(toggle, ShowClassNames); | ||
toggleClasses(toggle, ShowClassNames); | ||
}); | ||
@@ -348,3 +343,3 @@ }; // Static | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): sidebar.js | ||
* CoreUI (v2.0.0-beta.8): sidebar.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -361,3 +356,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'sidebar'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.sidebar'; | ||
@@ -495,3 +490,3 @@ var EVENT_KEY = "." + DATA_KEY; | ||
var toggle = event.currentTarget.dataset.toggle; | ||
ToggleClasses(toggle, ShowClassNames); | ||
toggleClasses(toggle, ShowClassNames); | ||
}); | ||
@@ -553,3 +548,3 @@ }; // Static | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): get-style.js | ||
* CoreUI Utilities (v2.0.0-beta.8): get-style.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -568,3 +563,3 @@ * -------------------------------------------------------------------------- | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgb.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgb.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -576,8 +571,27 @@ * -------------------------------------------------------------------------- | ||
var hexToRgb = function hexToRgb(color) { | ||
var hex = color.replace('#', ''); | ||
var r = parseInt(hex.substring(0, 2), 16); | ||
var g = parseInt(hex.substring(2, 4), 16); | ||
var b = parseInt(hex.substring(4, 6), 16); | ||
var result = "rgba(" + r + ", " + g + ", " + b; | ||
return result; | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i); | ||
if (!hex) { | ||
throw new Error(color + " is not a valid hex color"); | ||
} | ||
var r; | ||
var g; | ||
var b; | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16); | ||
g = parseInt(color.substring(3, 5), 16); | ||
b = parseInt(color.substring(5, 7), 16); | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16); | ||
g = parseInt(color.substring(2, 3), 16); | ||
b = parseInt(color.substring(3, 5), 16); | ||
} | ||
return "rgba(" + r + ", " + g + ", " + b; | ||
}; | ||
@@ -587,3 +601,3 @@ | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgba.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgba.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -599,8 +613,27 @@ * -------------------------------------------------------------------------- | ||
var hex = color.replace('#', ''); | ||
var r = parseInt(hex.substring(0, 2), 16); | ||
var g = parseInt(hex.substring(2, 4), 16); | ||
var b = parseInt(hex.substring(4, 6), 16); | ||
var result = "rgba(" + r + ", " + g + ", " + b + ", " + opacity / 100; | ||
return result; | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i); | ||
if (!hex) { | ||
throw new Error(color + " is not a valid hex color"); | ||
} | ||
var r; | ||
var g; | ||
var b; | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16); | ||
g = parseInt(color.substring(3, 5), 16); | ||
b = parseInt(color.substring(5, 7), 16); | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16); | ||
g = parseInt(color.substring(2, 3), 16); | ||
b = parseInt(color.substring(3, 5), 16); | ||
} | ||
return "rgba(" + r + ", " + g + ", " + b + ", " + opacity / 100; | ||
}; | ||
@@ -610,3 +643,3 @@ | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): rgb-to-hex.js | ||
* CoreUI (v2.0.0-beta.8): rgb-to-hex.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -618,7 +651,16 @@ * -------------------------------------------------------------------------- | ||
var rgbToHex = function rgbToHex(color) { | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var rgb = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); | ||
if (!rgb) { | ||
throw new Error(color + " is not a valid rgb color"); | ||
} | ||
var r = "0" + parseInt(rgb[1], 10).toString(16); | ||
var g = "0" + parseInt(rgb[2], 10).toString(16); | ||
var b = "0" + parseInt(rgb[3], 10).toString(16); | ||
return rgb ? "#" + r.slice(-2) + g.slice(-2) + b.slice(-2) : ''; | ||
return "#" + r.slice(-2) + g.slice(-2) + b.slice(-2); | ||
}; | ||
@@ -628,3 +670,3 @@ | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): index.js | ||
* CoreUI (v2.0.0-beta.8): index.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -631,0 +673,0 @@ * -------------------------------------------------------------------------- |
/*! | ||
* CoreUI Pro v2.0.0-beta.6 (https://coreui.io/pro/) | ||
* CoreUI Pro v2.0.0-beta.8 (https://coreui.io/pro/) | ||
* Copyright 2018 Łukasz Holeczek | ||
* Licensed under MIT (https://coreui.io/pro/) | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery"),require("perfect-scrollbar")):"function"==typeof define&&define.amd?define(["exports","jquery","perfect-scrollbar"],t):t(e.coreui={},e.jQuery,e.PerfectScrollbar)}(this,function(e,t,r){"use strict";function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r;var i,n,s,u,c,d,l,f,p,g,h,b,v,y,m,w,I,_,C,L,T,j,S,P,A,D,O,E,k,Q,x,q,U,G,K,R,N,z,V,X,J,B,M=(n="ajaxLoad",s="coreui.ajaxLoad",u=(i=t).fn[n],c="active",d="open",l="click",f=".sidebar-nav .nav-dropdown",p=".sidebar-nav .nav-link",g=".sidebar-nav .nav-item",h={defaultPage:"main.html",errorPage:"404.html",subpagesDirectory:"views/"},b=function(){function n(e,t){this._config=this._getConfig(t),this._element=e;var n=location.hash.replace(/^#/,"");""!==n?this.setUpUrl(n):this.setUpUrl(this._config.defaultPage),this._addEventListeners()}var e=n.prototype;return e.loadPage=function(e){var t=this._element,n=this._config;i.ajax({type:"GET",url:n.subpagesDirectory+e,dataType:"html",cache:!1,async:!1,success:function(){"undefined"!=typeof Pace&&Pace.restart(),i("body").animate({scrollTop:0},0),i(t).load(n.subpagesDirectory+e,null,function(){window.location.hash=e})},error:function(){window.location.href=n.errorPage}})},e.setUpUrl=function(e){i(p).removeClass(c),i(f).removeClass(d),i(f+':has(a[href="'+e.replace(/^\//,"").split("?")[0]+'"])').addClass(d),i(g+' a[href="'+e.replace(/^\//,"").split("?")[0]+'"]').addClass(c),this.loadPage(e)},e.loadBlank=function(e){window.open(e)},e.loadTop=function(e){window.location=e},e._getConfig=function(e){return e=Object.assign({},h,e)},e._addEventListeners=function(){var t=this;i(document).on(l,p+'[href!="#"]',function(e){e.preventDefault(),e.stopPropagation(),"_top"===e.currentTarget.target?t.loadTop(e.currentTarget.href):"_blank"===e.currentTarget.target?t.loadBlank(e.currentTarget.href):t.setUpUrl(e.currentTarget.pathname)})},n._jQueryInterface=function(t){return this.each(function(){var e=i(this).data(s);e||(e=new n(this,"object"==typeof t&&t),i(this).data(s,e))})},o(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.6"}},{key:"Default",get:function(){return h}}]),n}(),i.fn[n]=b._jQueryInterface,i.fn[n].Constructor=b,i.fn[n].noConflict=function(){return i.fn[n]=u,b._jQueryInterface},b),Y=function(e,t){var n=t.indexOf(e),r=t.slice(0,n+1);-1!==r.map(function(e){return document.body.classList.contains(e)}).indexOf(!0)?r.map(function(e){return document.body.classList.remove(e)}):document.body.classList.add(e)},H=(y="aside-menu",m="coreui.aside-menu",w=(v=t).fn[y],I={CLICK:"click",LOAD_DATA_API:"load.coreui.aside-menu.data-api",TOGGLE:"toggle"},_=".aside-menu",C=".aside-menu-toggler",L=["aside-menu-show","aside-menu-sm-show","aside-menu-md-show","aside-menu-lg-show","aside-menu-xl-show"],T=function(){function n(e){this._element=e,this._addEventListeners()}return n.prototype._addEventListeners=function(){v(C).on(I.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget.dataset.toggle;Y(t,L)})},n._jQueryInterface=function(){return this.each(function(){var e=v(this),t=e.data(m);t||(t=new n(this),e.data(m,t))})},o(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.6"}}]),n}(),v(window).on(I.LOAD_DATA_API,function(){var e=v(_);T._jQueryInterface.call(e)}),v.fn[y]=T._jQueryInterface,v.fn[y].Constructor=T,v.fn[y].noConflict=function(){return v.fn[y]=w,T._jQueryInterface},T),F=(S="sidebar",P="coreui.sidebar",A=(j=t).fn[S],D="active",O="brand-minimized",E="open",k="sidebar-minimized",Q={CLICK:"click",DESTROY:"destroy",INIT:"init",LOAD_DATA_API:"load.coreui.sidebar.data-api",TOGGLE:"toggle"},x="body",q=".brand-minimizer",U=".nav-dropdown-toggle",G=".nav-dropdown-items",K=".nav-link",R=".sidebar-nav",N=".sidebar-nav > .nav",z=".sidebar",V=".sidebar-minimizer",X=".sidebar-toggler",J=["sidebar-show","sidebar-sm-show","sidebar-md-show","sidebar-lg-show","sidebar-xl-show"],B=function(){function n(e){this._element=e,this.perfectScrollbar(Q.INIT),this.setActiveLink(),this._addEventListeners()}var e=n.prototype;return e.perfectScrollbar=function(e){"undefined"!=typeof r&&(e!==Q.INIT||document.body.classList.contains(k)||new r(document.querySelector(R),{suppressScrollX:!0}),e===Q.DESTROY&&new r(document.querySelector(R),{suppressScrollX:!0}).destroy(),e===Q.TOGGLE&&(document.body.classList.contains(k)?new r(document.querySelector(R),{suppressScrollX:!0}).destroy():new r(document.querySelector(R),{suppressScrollX:!0})))},e.setActiveLink=function(){j(N).find(K).each(function(e,t){var n=t,r=String(window.location).split("?")[0];"#"===r.substr(r.length-1)&&(r=r.slice(0,-1)),j(j(n))[0].href===r&&j(n).addClass(D).parents(G).add(n).each(function(e,t){j(n=t).parent().addClass(E)})})},e._addEventListeners=function(){var t=this;j(q).on(Q.CLICK,function(e){e.preventDefault(),e.stopPropagation(),j(x).toggleClass(O)}),j(U).on(Q.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.target;j(t).parent().toggleClass(E)}),j(V).on(Q.CLICK,function(e){e.preventDefault(),e.stopPropagation(),j(x).toggleClass(k),t.perfectScrollbar(Q.TOGGLE)}),j(X).on(Q.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget.dataset.toggle;Y(t,J)})},n._jQueryInterface=function(){return this.each(function(){var e=j(this),t=e.data(P);t||(t=new n(this),e.data(P,t))})},o(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.6"}}]),n}(),j(window).on(Q.LOAD_DATA_API,function(){var e=j(z);B._jQueryInterface.call(e)}),j.fn[S]=B._jQueryInterface,j.fn[S].Constructor=B,j.fn[S].noConflict=function(){return j.fn[S]=A,B._jQueryInterface},B);!function(e){if("undefined"==typeof e)throw new TypeError("CoreUI's JavaScript requires jQuery. jQuery must be included before CoreUI's JavaScript.");var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1===t[0]&&9===t[1]&&t[2]<1||4<=t[0])throw new Error("CoreUI's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(t),window.getStyle=function(e,t){return void 0===t&&(t=document.body),window.getComputedStyle(t,null).getPropertyValue(e).replace(/^\s/,"")},window.hexToRgb=function(e){var t=e.replace("#","");return"rgba("+parseInt(t.substring(0,2),16)+", "+parseInt(t.substring(2,4),16)+", "+parseInt(t.substring(4,6),16)},window.hexToRgba=function(e,t){void 0===t&&(t=100);var n=e.replace("#","");return"rgba("+parseInt(n.substring(0,2),16)+", "+parseInt(n.substring(2,4),16)+", "+parseInt(n.substring(4,6),16)+", "+t/100},window.rgbToHex=function(e){var t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),n="0"+parseInt(t[1],10).toString(16),r="0"+parseInt(t[2],10).toString(16),a="0"+parseInt(t[3],10).toString(16);return t?"#"+n.slice(-2)+r.slice(-2)+a.slice(-2):""},e.AjaxLoad=M,e.AsideMenu=H,e.Sidebar=F,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery"),require("perfect-scrollbar")):"function"==typeof define&&define.amd?define(["exports","jquery","perfect-scrollbar"],t):t(e.coreui={},e.jQuery,e.PerfectScrollbar)}(this,function(e,t,r){"use strict";function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r;var i,n,s,u,c,d,l,f,p,g,h,b,v,y,w,m,I,_,C,L,T,j,S,E,P,A,D,O,x,k,Q,q,U,G,K,R,N,z,H,V,X,J,B=(n="ajaxLoad",s="coreui.ajaxLoad",u=(i=t).fn[n],c="active",d="open",l="click",f=".sidebar-nav .nav-dropdown",p=".sidebar-nav .nav-link",g=".sidebar-nav .nav-item",h={defaultPage:"main.html",errorPage:"404.html",subpagesDirectory:"views/"},b=function(){function n(e,t){this._config=this._getConfig(t),this._element=e;var n=location.hash.replace(/^#/,"");""!==n?this.setUpUrl(n):this.setUpUrl(this._config.defaultPage),this._addEventListeners()}var e=n.prototype;return e.loadPage=function(e){var t=this._element,n=this._config;i.ajax({type:"GET",url:n.subpagesDirectory+e,dataType:"html",cache:!1,async:!1,success:function(){i("body").animate({scrollTop:0},0),i(t).load(n.subpagesDirectory+e,null,function(){window.location.hash=e})},error:function(){window.location.href=n.errorPage}})},e.setUpUrl=function(e){i(p).removeClass(c),i(f).removeClass(d),i(f+':has(a[href="'+e.replace(/^\//,"").split("?")[0]+'"])').addClass(d),i(g+' a[href="'+e.replace(/^\//,"").split("?")[0]+'"]').addClass(c),this.loadPage(e)},e.loadBlank=function(e){window.open(e)},e.loadTop=function(e){window.location=e},e._getConfig=function(e){return e=Object.assign({},h,e)},e._addEventListeners=function(){var t=this;i(document).on(l,p+'[href!="#"]',function(e){e.preventDefault(),e.stopPropagation(),"_top"===e.currentTarget.target?t.loadTop(e.currentTarget.href):"_blank"===e.currentTarget.target?t.loadBlank(e.currentTarget.href):t.setUpUrl(e.currentTarget.pathname)})},n._jQueryInterface=function(t){return this.each(function(){var e=i(this).data(s);e||(e=new n(this,"object"==typeof t&&t),i(this).data(s,e))})},a(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.8"}},{key:"Default",get:function(){return h}}]),n}(),i.fn[n]=b._jQueryInterface,i.fn[n].Constructor=b,i.fn[n].noConflict=function(){return i.fn[n]=u,b._jQueryInterface},b),M=function(e,t){var n=t.indexOf(e),r=t.slice(0,n+1);-1!==r.map(function(e){return document.body.classList.contains(e)}).indexOf(!0)?r.map(function(e){return document.body.classList.remove(e)}):document.body.classList.add(e)},Y=(y="aside-menu",w="coreui.aside-menu",m=(v=t).fn[y],I={CLICK:"click",LOAD_DATA_API:"load.coreui.aside-menu.data-api",TOGGLE:"toggle"},_=".aside-menu",C=".aside-menu-toggler",L=["aside-menu-show","aside-menu-sm-show","aside-menu-md-show","aside-menu-lg-show","aside-menu-xl-show"],T=function(){function n(e){this._element=e,this._addEventListeners()}return n.prototype._addEventListeners=function(){v(C).on(I.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget.dataset.toggle;M(t,L)})},n._jQueryInterface=function(){return this.each(function(){var e=v(this),t=e.data(w);t||(t=new n(this),e.data(w,t))})},a(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.8"}}]),n}(),v(window).on(I.LOAD_DATA_API,function(){var e=v(_);T._jQueryInterface.call(e)}),v.fn[y]=T._jQueryInterface,v.fn[y].Constructor=T,v.fn[y].noConflict=function(){return v.fn[y]=m,T._jQueryInterface},T),$=(S="sidebar",E="coreui.sidebar",P=(j=t).fn[S],A="active",D="brand-minimized",O="open",x="sidebar-minimized",k={CLICK:"click",DESTROY:"destroy",INIT:"init",LOAD_DATA_API:"load.coreui.sidebar.data-api",TOGGLE:"toggle"},Q="body",q=".brand-minimizer",U=".nav-dropdown-toggle",G=".nav-dropdown-items",K=".nav-link",R=".sidebar-nav",N=".sidebar-nav > .nav",z=".sidebar",H=".sidebar-minimizer",V=".sidebar-toggler",X=["sidebar-show","sidebar-sm-show","sidebar-md-show","sidebar-lg-show","sidebar-xl-show"],J=function(){function n(e){this._element=e,this.perfectScrollbar(k.INIT),this.setActiveLink(),this._addEventListeners()}var e=n.prototype;return e.perfectScrollbar=function(e){"undefined"!=typeof r&&(e!==k.INIT||document.body.classList.contains(x)||new r(document.querySelector(R),{suppressScrollX:!0}),e===k.DESTROY&&new r(document.querySelector(R),{suppressScrollX:!0}).destroy(),e===k.TOGGLE&&(document.body.classList.contains(x)?new r(document.querySelector(R),{suppressScrollX:!0}).destroy():new r(document.querySelector(R),{suppressScrollX:!0})))},e.setActiveLink=function(){j(N).find(K).each(function(e,t){var n=t,r=String(window.location).split("?")[0];"#"===r.substr(r.length-1)&&(r=r.slice(0,-1)),j(j(n))[0].href===r&&j(n).addClass(A).parents(G).add(n).each(function(e,t){j(n=t).parent().addClass(O)})})},e._addEventListeners=function(){var t=this;j(q).on(k.CLICK,function(e){e.preventDefault(),e.stopPropagation(),j(Q).toggleClass(D)}),j(U).on(k.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.target;j(t).parent().toggleClass(O)}),j(H).on(k.CLICK,function(e){e.preventDefault(),e.stopPropagation(),j(Q).toggleClass(x),t.perfectScrollbar(k.TOGGLE)}),j(V).on(k.CLICK,function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget.dataset.toggle;M(t,X)})},n._jQueryInterface=function(){return this.each(function(){var e=j(this),t=e.data(E);t||(t=new n(this),e.data(E,t))})},a(n,null,[{key:"VERSION",get:function(){return"2.0.0-beta.8"}}]),n}(),j(window).on(k.LOAD_DATA_API,function(){var e=j(z);J._jQueryInterface.call(e)}),j.fn[S]=J._jQueryInterface,j.fn[S].Constructor=J,j.fn[S].noConflict=function(){return j.fn[S]=P,J._jQueryInterface},J);!function(e){if("undefined"==typeof e)throw new TypeError("CoreUI's JavaScript requires jQuery. jQuery must be included before CoreUI's JavaScript.");var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1===t[0]&&9===t[1]&&t[2]<1||4<=t[0])throw new Error("CoreUI's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(t),window.getStyle=function(e,t){return void 0===t&&(t=document.body),window.getComputedStyle(t,null).getPropertyValue(e).replace(/^\s/,"")},window.hexToRgb=function(e){if("undefined"==typeof e)throw new Error("Hex color is not defined");var t,n,r;if(!e.match(/^#(?:[0-9a-f]{3}){1,2}$/i))throw new Error(e+" is not a valid hex color");return 7===e.length?(t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16)):(t=parseInt(e.substring(1,2),16),n=parseInt(e.substring(2,3),16),r=parseInt(e.substring(3,5),16)),"rgba("+t+", "+n+", "+r},window.hexToRgba=function(e,t){if(void 0===t&&(t=100),"undefined"==typeof e)throw new Error("Hex color is not defined");var n,r,o;if(!e.match(/^#(?:[0-9a-f]{3}){1,2}$/i))throw new Error(e+" is not a valid hex color");return 7===e.length?(n=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),o=parseInt(e.substring(5,7),16)):(n=parseInt(e.substring(1,2),16),r=parseInt(e.substring(2,3),16),o=parseInt(e.substring(3,5),16)),"rgba("+n+", "+r+", "+o+", "+t/100},window.rgbToHex=function(e){if("undefined"==typeof e)throw new Error("Hex color is not defined");var t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);if(!t)throw new Error(e+" is not a valid rgb color");var n="0"+parseInt(t[1],10).toString(16),r="0"+parseInt(t[2],10).toString(16),o="0"+parseInt(t[3],10).toString(16);return"#"+n.slice(-2)+r.slice(-2)+o.slice(-2)},e.AjaxLoad=B,e.AsideMenu=Y,e.Sidebar=$,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=coreui.min.js.map |
@@ -7,3 +7,3 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): ajax-load.js | ||
* CoreUI (v2.0.0-beta.8): ajax-load.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -19,3 +19,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'ajaxLoad'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.ajaxLoad'; | ||
@@ -49,5 +49,9 @@ var JQUERY_NO_CONFLICT = $.fn[NAME]; | ||
this._element = element; | ||
var url = location.hash.replace(/^#/, ''); // eslint-disable-next-line no-unused-expressions | ||
var url = location.hash.replace(/^#/, ''); | ||
url !== '' ? this.setUpUrl(url) : this.setUpUrl(this._config.defaultPage); | ||
if (url !== '') { | ||
this.setUpUrl(url); | ||
} else { | ||
this.setUpUrl(this._config.defaultPage); | ||
} | ||
@@ -71,7 +75,2 @@ this._addEventListeners(); | ||
success: function success() { | ||
if (typeof Pace !== 'undefined') { | ||
// eslint-disable-next-line no-undef | ||
Pace.restart(); | ||
} | ||
$('body').animate({ | ||
@@ -92,7 +91,5 @@ scrollTop: 0 | ||
$(Selector.NAV_LINK).removeClass(ClassName.ACTIVE); | ||
$(Selector.NAV_DROPDOWN).removeClass(ClassName.OPEN); // eslint-disable-next-line prefer-template | ||
$(Selector.NAV_DROPDOWN + ':has(a[href="' + url.replace(/^\//, '').split('?')[0] + '"])').addClass(ClassName.OPEN); // eslint-disable-next-line prefer-template | ||
$(Selector.NAV_ITEM + ' a[href="' + url.replace(/^\//, '').split('?')[0] + '"]').addClass(ClassName.ACTIVE); | ||
$(Selector.NAV_DROPDOWN).removeClass(ClassName.OPEN); | ||
$(Selector.NAV_DROPDOWN + ":has(a[href=\"" + url.replace(/^\//, '').split('?')[0] + "\"])").addClass(ClassName.OPEN); | ||
$(Selector.NAV_ITEM + " a[href=\"" + url.replace(/^\//, '').split('?')[0] + "\"]").addClass(ClassName.ACTIVE); | ||
this.loadPage(url); | ||
@@ -118,4 +115,3 @@ }; | ||
// eslint-disable-next-line prefer-template | ||
$(document).on(Event.CLICK, Selector.NAV_LINK + '[href!="#"]', function (event) { | ||
$(document).on(Event.CLICK, Selector.NAV_LINK + "[href!=\"#\"]", function (event) { | ||
event.preventDefault(); | ||
@@ -122,0 +118,0 @@ event.stopPropagation(); |
@@ -7,3 +7,3 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): aside-menu.js | ||
* CoreUI (v2.0.0-beta.8): aside-menu.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -19,3 +19,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'aside-menu'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.aside-menu'; | ||
@@ -60,3 +60,3 @@ var EVENT_KEY = "." + DATA_KEY; | ||
var toggle = event.currentTarget.dataset.toggle; | ||
ToggleClasses(toggle, ShowClassNames); | ||
toggleClasses(toggle, ShowClassNames); | ||
}); | ||
@@ -63,0 +63,0 @@ }; // Static |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): index.js | ||
* CoreUI (v2.0.0-beta.8): index.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -5,0 +5,0 @@ * -------------------------------------------------------------------------- |
@@ -7,3 +7,3 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): sidebar.js | ||
* CoreUI (v2.0.0-beta.8): sidebar.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -19,3 +19,3 @@ * -------------------------------------------------------------------------- | ||
var NAME = 'sidebar'; | ||
var VERSION = '2.0.0-beta.6'; | ||
var VERSION = '2.0.0-beta.8'; | ||
var DATA_KEY = 'coreui.sidebar'; | ||
@@ -153,3 +153,3 @@ var EVENT_KEY = "." + DATA_KEY; | ||
var toggle = event.currentTarget.dataset.toggle; | ||
ToggleClasses(toggle, ShowClassNames); | ||
toggleClasses(toggle, ShowClassNames); | ||
}); | ||
@@ -156,0 +156,0 @@ }; // Static |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): toggle-classes.js | ||
* CoreUI (v2.0.0-beta.8): toggle-classes.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
var RemoveClasses = function RemoveClasses(NewClassNames) { | ||
var MatchClasses = NewClassNames.map(function (Class) { | ||
return document.body.classList.contains(Class); | ||
}); | ||
return MatchClasses.indexOf(true) !== -1; | ||
var removeClasses = function removeClasses(classNames) { | ||
return classNames.map(function (className) { | ||
return document.body.classList.contains(className); | ||
}).indexOf(true) !== -1; | ||
}; | ||
var ToggleClasses = function ToggleClasses(Toggle, ClassNames) { | ||
var Level = ClassNames.indexOf(Toggle); | ||
var NewClassNames = ClassNames.slice(0, Level + 1); | ||
var toggleClasses = function toggleClasses(toggleClass, classNames) { | ||
var breakpoint = classNames.indexOf(toggleClass); | ||
var newClassNames = classNames.slice(0, breakpoint + 1); | ||
if (RemoveClasses(NewClassNames)) { | ||
NewClassNames.map(function (Class) { | ||
return document.body.classList.remove(Class); | ||
if (removeClasses(newClassNames)) { | ||
newClassNames.map(function (className) { | ||
return document.body.classList.remove(className); | ||
}); | ||
} else { | ||
document.body.classList.add(Toggle); | ||
document.body.classList.add(toggleClass); | ||
} | ||
}; | ||
//# sourceMappingURL=toggle-classes.js.map |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): get-style.js | ||
* CoreUI Utilities (v2.0.0-beta.8): get-style.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -5,0 +5,0 @@ * -------------------------------------------------------------------------- |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgb.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgb.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -10,9 +10,28 @@ * -------------------------------------------------------------------------- | ||
var hexToRgb = function hexToRgb(color) { | ||
var hex = color.replace('#', ''); | ||
var r = parseInt(hex.substring(0, 2), 16); | ||
var g = parseInt(hex.substring(2, 4), 16); | ||
var b = parseInt(hex.substring(4, 6), 16); | ||
var result = "rgba(" + r + ", " + g + ", " + b; | ||
return result; | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i); | ||
if (!hex) { | ||
throw new Error(color + " is not a valid hex color"); | ||
} | ||
var r; | ||
var g; | ||
var b; | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16); | ||
g = parseInt(color.substring(3, 5), 16); | ||
b = parseInt(color.substring(5, 7), 16); | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16); | ||
g = parseInt(color.substring(2, 3), 16); | ||
b = parseInt(color.substring(3, 5), 16); | ||
} | ||
return "rgba(" + r + ", " + g + ", " + b; | ||
}; | ||
//# sourceMappingURL=hex-to-rgb.js.map |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgba.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgba.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -14,9 +14,28 @@ * -------------------------------------------------------------------------- | ||
var hex = color.replace('#', ''); | ||
var r = parseInt(hex.substring(0, 2), 16); | ||
var g = parseInt(hex.substring(2, 4), 16); | ||
var b = parseInt(hex.substring(4, 6), 16); | ||
var result = "rgba(" + r + ", " + g + ", " + b + ", " + opacity / 100; | ||
return result; | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i); | ||
if (!hex) { | ||
throw new Error(color + " is not a valid hex color"); | ||
} | ||
var r; | ||
var g; | ||
var b; | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16); | ||
g = parseInt(color.substring(3, 5), 16); | ||
b = parseInt(color.substring(5, 7), 16); | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16); | ||
g = parseInt(color.substring(2, 3), 16); | ||
b = parseInt(color.substring(3, 5), 16); | ||
} | ||
return "rgba(" + r + ", " + g + ", " + b + ", " + opacity / 100; | ||
}; | ||
//# sourceMappingURL=hex-to-rgba.js.map |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): rgb-to-hex.js | ||
* CoreUI (v2.0.0-beta.8): rgb-to-hex.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -10,8 +10,17 @@ * -------------------------------------------------------------------------- | ||
var rgbToHex = function rgbToHex(color) { | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined'); | ||
} | ||
var rgb = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); | ||
if (!rgb) { | ||
throw new Error(color + " is not a valid rgb color"); | ||
} | ||
var r = "0" + parseInt(rgb[1], 10).toString(16); | ||
var g = "0" + parseInt(rgb[2], 10).toString(16); | ||
var b = "0" + parseInt(rgb[3], 10).toString(16); | ||
return rgb ? "#" + r.slice(-2) + g.slice(-2) + b.slice(-2) : ''; | ||
return "#" + r.slice(-2) + g.slice(-2) + b.slice(-2); | ||
}; | ||
//# sourceMappingURL=rgb-to-hex.js.map |
@@ -5,3 +5,3 @@ import $ from 'jquery' | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): ajax-load.js | ||
* CoreUI (v2.0.0-beta.8): ajax-load.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -20,3 +20,3 @@ * -------------------------------------------------------------------------- | ||
const NAME = 'ajaxLoad' | ||
const VERSION = '2.0.0-beta.6' | ||
const VERSION = '2.0.0-beta.8' | ||
const DATA_KEY = 'coreui.ajaxLoad' | ||
@@ -54,4 +54,8 @@ const JQUERY_NO_CONFLICT = $.fn[NAME] | ||
const url = location.hash.replace(/^#/, '') | ||
// eslint-disable-next-line no-unused-expressions | ||
url !== '' ? this.setUpUrl(url) : this.setUpUrl(this._config.defaultPage) | ||
if (url !== '') { | ||
this.setUpUrl(url) | ||
} else { | ||
this.setUpUrl(this._config.defaultPage) | ||
} | ||
this._addEventListeners() | ||
@@ -83,6 +87,2 @@ } | ||
success: function success() { | ||
if (typeof Pace !== 'undefined') { | ||
// eslint-disable-next-line no-undef | ||
Pace.restart() | ||
} | ||
$('body').animate({ | ||
@@ -104,7 +104,6 @@ scrollTop: 0 | ||
$(Selector.NAV_DROPDOWN).removeClass(ClassName.OPEN) | ||
// eslint-disable-next-line prefer-template | ||
$(Selector.NAV_DROPDOWN + ':has(a[href="' + url.replace(/^\//, '').split('?')[0] + '"])').addClass(ClassName.OPEN) | ||
// eslint-disable-next-line prefer-template | ||
$(Selector.NAV_ITEM + ' a[href="' + url.replace(/^\//, '').split('?')[0] + '"]').addClass(ClassName.ACTIVE) | ||
$(`${Selector.NAV_DROPDOWN}:has(a[href="${url.replace(/^\//, '').split('?')[0]}"])`).addClass(ClassName.OPEN) | ||
$(`${Selector.NAV_ITEM} a[href="${url.replace(/^\//, '').split('?')[0]}"]`).addClass(ClassName.ACTIVE) | ||
this.loadPage(url) | ||
@@ -132,4 +131,3 @@ } | ||
_addEventListeners() { | ||
// eslint-disable-next-line prefer-template | ||
$(document).on(Event.CLICK, Selector.NAV_LINK + '[href!="#"]', (event) => { | ||
$(document).on(Event.CLICK, `${Selector.NAV_LINK}[href!="#"]`, (event) => { | ||
event.preventDefault() | ||
@@ -136,0 +134,0 @@ event.stopPropagation() |
import $ from 'jquery' | ||
import ToggleClasses from './toggle-classes' | ||
import toggleClasses from './toggle-classes' | ||
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): aside-menu.js | ||
* CoreUI (v2.0.0-beta.8): aside-menu.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -19,3 +19,3 @@ * -------------------------------------------------------------------------- | ||
const NAME = 'aside-menu' | ||
const VERSION = '2.0.0-beta.6' | ||
const VERSION = '2.0.0-beta.8' | ||
const DATA_KEY = 'coreui.aside-menu' | ||
@@ -71,3 +71,3 @@ const EVENT_KEY = `.${DATA_KEY}` | ||
const toggle = event.currentTarget.dataset.toggle | ||
ToggleClasses(toggle, ShowClassNames) | ||
toggleClasses(toggle, ShowClassNames) | ||
}) | ||
@@ -74,0 +74,0 @@ } |
@@ -8,3 +8,3 @@ import $ from 'jquery' | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): index.js | ||
* CoreUI (v2.0.0-beta.8): index.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -11,0 +11,0 @@ * -------------------------------------------------------------------------- |
import $ from 'jquery' | ||
import PerfectScrollbar from 'perfect-scrollbar' | ||
import ToggleClasses from './toggle-classes' | ||
import toggleClasses from './toggle-classes' | ||
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): sidebar.js | ||
* CoreUI (v2.0.0-beta.8): sidebar.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -20,3 +20,3 @@ * -------------------------------------------------------------------------- | ||
const NAME = 'sidebar' | ||
const VERSION = '2.0.0-beta.6' | ||
const VERSION = '2.0.0-beta.8' | ||
const DATA_KEY = 'coreui.sidebar' | ||
@@ -167,3 +167,3 @@ const EVENT_KEY = `.${DATA_KEY}` | ||
const toggle = event.currentTarget.dataset.toggle | ||
ToggleClasses(toggle, ShowClassNames) | ||
toggleClasses(toggle, ShowClassNames) | ||
}) | ||
@@ -170,0 +170,0 @@ } |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): toggle-classes.js | ||
* CoreUI (v2.0.0-beta.8): toggle-classes.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -8,18 +8,15 @@ * -------------------------------------------------------------------------- | ||
const RemoveClasses = (NewClassNames) => { | ||
const MatchClasses = NewClassNames.map((Class) => document.body.classList.contains(Class)) | ||
return MatchClasses.indexOf(true) !== -1 | ||
} | ||
const removeClasses = (classNames) => classNames.map((className) => document.body.classList.contains(className)).indexOf(true) !== -1 | ||
const ToggleClasses = (Toggle, ClassNames) => { | ||
const Level = ClassNames.indexOf(Toggle) | ||
const NewClassNames = ClassNames.slice(0, Level + 1) | ||
const toggleClasses = (toggleClass, classNames) => { | ||
const breakpoint = classNames.indexOf(toggleClass) | ||
const newClassNames = classNames.slice(0, breakpoint + 1) | ||
if (RemoveClasses(NewClassNames)) { | ||
NewClassNames.map((Class) => document.body.classList.remove(Class)) | ||
if (removeClasses(newClassNames)) { | ||
newClassNames.map((className) => document.body.classList.remove(className)) | ||
} else { | ||
document.body.classList.add(Toggle) | ||
document.body.classList.add(toggleClass) | ||
} | ||
} | ||
export default ToggleClasses | ||
export default toggleClasses |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): get-style.js | ||
* CoreUI Utilities (v2.0.0-beta.8): get-style.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -5,0 +5,0 @@ * -------------------------------------------------------------------------- |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgb.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgb.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -10,11 +10,25 @@ * -------------------------------------------------------------------------- | ||
const hexToRgb = (color) => { | ||
const hex = color.replace('#', '') | ||
const r = parseInt(hex.substring(0, 2), 16) | ||
const g = parseInt(hex.substring(2, 4), 16) | ||
const b = parseInt(hex.substring(4, 6), 16) | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined') | ||
} | ||
const hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i) | ||
if (!hex) { | ||
throw new Error(`${color} is not a valid hex color`) | ||
} | ||
let r | ||
let g | ||
let b | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16) | ||
g = parseInt(color.substring(3, 5), 16) | ||
b = parseInt(color.substring(5, 7), 16) | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16) | ||
g = parseInt(color.substring(2, 3), 16) | ||
b = parseInt(color.substring(3, 5), 16) | ||
} | ||
const result = `rgba(${r}, ${g}, ${b}` | ||
return result | ||
return `rgba(${r}, ${g}, ${b}` | ||
} | ||
export default hexToRgb |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI Utilities (v2.0.0-beta.6): hex-to-rgba.js | ||
* CoreUI Utilities (v2.0.0-beta.8): hex-to-rgba.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -10,11 +10,25 @@ * -------------------------------------------------------------------------- | ||
const hexToRgba = (color, opacity = 100) => { | ||
const hex = color.replace('#', '') | ||
const r = parseInt(hex.substring(0, 2), 16) | ||
const g = parseInt(hex.substring(2, 4), 16) | ||
const b = parseInt(hex.substring(4, 6), 16) | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined') | ||
} | ||
const hex = color.match(/^#(?:[0-9a-f]{3}){1,2}$/i) | ||
if (!hex) { | ||
throw new Error(`${color} is not a valid hex color`) | ||
} | ||
let r | ||
let g | ||
let b | ||
if (color.length === 7) { | ||
r = parseInt(color.substring(1, 3), 16) | ||
g = parseInt(color.substring(3, 5), 16) | ||
b = parseInt(color.substring(5, 7), 16) | ||
} else { | ||
r = parseInt(color.substring(1, 2), 16) | ||
g = parseInt(color.substring(2, 3), 16) | ||
b = parseInt(color.substring(3, 5), 16) | ||
} | ||
const result = `rgba(${r}, ${g}, ${b}, ${opacity / 100}` | ||
return result | ||
return `rgba(${r}, ${g}, ${b}, ${opacity / 100}` | ||
} | ||
export default hexToRgba |
/** | ||
* -------------------------------------------------------------------------- | ||
* CoreUI (v2.0.0-beta.6): rgb-to-hex.js | ||
* CoreUI (v2.0.0-beta.8): rgb-to-hex.js | ||
* Licensed under MIT (https://coreui.io/license) | ||
@@ -10,3 +10,9 @@ * -------------------------------------------------------------------------- | ||
const rgbToHex = (color) => { | ||
if (typeof color === 'undefined') { | ||
throw new Error('Hex color is not defined') | ||
} | ||
const rgb = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i) | ||
if (!rgb) { | ||
throw new Error(`${color} is not a valid rgb color`) | ||
} | ||
const r = `0${parseInt(rgb[1], 10).toString(16)}` | ||
@@ -16,5 +22,5 @@ const g = `0${parseInt(rgb[2], 10).toString(16)}` | ||
return rgb ? `#${r.slice(-2)}${g.slice(-2)}${b.slice(-2)}` : '' | ||
return `#${r.slice(-2)}${g.slice(-2)}${b.slice(-2)}` | ||
} | ||
export default rgbToHex |
{ | ||
"name": "@coreui/coreui-pro", | ||
"version": "2.0.0-beta.6", | ||
"version": "2.0.0-beta.8", | ||
"description": "UI Kit built on top of Bootstrap 4", | ||
@@ -76,2 +76,3 @@ "keywords": [ | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.44", | ||
"@babel/plugin-proposal-throw-expressions": "^7.0.0-beta.44", | ||
"@babel/preset-env": "7.0.0-beta.44", | ||
@@ -92,3 +93,3 @@ "autoprefixer": "^8.2.0", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-babel": "4.0.0-beta.2", | ||
"rollup-plugin-babel": "^4.0.0-beta.4", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
@@ -103,3 +104,3 @@ "semver": "^5.5.0", | ||
"stylelint-scss": "^3.0.0", | ||
"uglify-js": "^3.3.20" | ||
"uglify-js": "^3.3.21" | ||
}, | ||
@@ -106,0 +107,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103
4370120
30
28585