@three11/accordion
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,2 +0,2 @@ | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t},t.apply(this,arguments)}class s{constructor(s,i={}){var e,h;return this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=t({},this.defaultSettings,i),this.el=s,this.head=(null==(e=this.el)?void 0:e.querySelector(this.settings.headSelector))||null,this.body=(null==(h=this.el)?void 0:h.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}bind(){return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",()=>{!this.isOpen&&this.el&&this.el.classList.add(this.settings.hiddenClass)}),this}setHeight(t){return setTimeout(()=>{this.body&&(this.body.style.maxHeight=`${t}px`)},1),this}toggle(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this}close(){return this.isOpen?(this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=`${this.height}px`),this.setHeight(0),this):this}open(){return this.isOpen||(this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height)),this}}export{s as Accordion,s as default}; | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t},t.apply(this,arguments)}class s{constructor(s,i={}){var e,h;return this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=t({},this.defaultSettings,i),this.el=s,this.head=(null==(e=this.el)?void 0:e.querySelector(this.settings.headSelector))||null,this.body=(null==(h=this.el)?void 0:h.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}bind(){return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",()=>{!this.isOpen&&this.el&&this.el.classList.add(this.settings.hiddenClass)}),this}setHeight(t){return setTimeout(()=>{this.body&&(this.body.style.maxHeight=`${t}px`)},1),this}toggle(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this}close(){return this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=`${this.height}px`),this.setHeight(0),this}open(){return this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height),this}}export{s as Accordion,s as default}; | ||
//# sourceMappingURL=accordion.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=s[e])}return t},t.apply(this,arguments)}var i=/*#__PURE__*/function(){function i(i,s){var e,h;return void 0===s&&(s={}),this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=t({},this.defaultSettings,s),this.el=i,this.head=(null==(e=this.el)?void 0:e.querySelector(this.settings.headSelector))||null,this.body=(null==(h=this.el)?void 0:h.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}var s=i.prototype;return s.bind=function(){var t=this;return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",function(){!t.isOpen&&t.el&&t.el.classList.add(t.settings.hiddenClass)}),this},s.setHeight=function(t){var i=this;return setTimeout(function(){i.body&&(i.body.style.maxHeight=t+"px")},1),this},s.toggle=function(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this},s.close=function(){return this.isOpen?(this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=this.height+"px"),this.setHeight(0),this):this},s.open=function(){return this.isOpen||(this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height)),this},i}();export{i as Accordion,i as default}; | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=s[e])}return t},t.apply(this,arguments)}var i=/*#__PURE__*/function(){function i(i,s){var e,h;return void 0===s&&(s={}),this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=t({},this.defaultSettings,s),this.el=i,this.head=(null==(e=this.el)?void 0:e.querySelector(this.settings.headSelector))||null,this.body=(null==(h=this.el)?void 0:h.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}var s=i.prototype;return s.bind=function(){var t=this;return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",function(){!t.isOpen&&t.el&&t.el.classList.add(t.settings.hiddenClass)}),this},s.setHeight=function(t){var i=this;return setTimeout(function(){i.body&&(i.body.style.maxHeight=t+"px")},1),this},s.toggle=function(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this},s.close=function(){return this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=this.height+"px"),this.setHeight(0),this},s.open=function(){return this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height),this},i}();export{i as Accordion,i as default}; | ||
//# sourceMappingURL=accordion.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t||self).accordion={})}(this,function(t){function i(){return i=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=s[e])}return t},i.apply(this,arguments)}var s=/*#__PURE__*/function(){function t(t,s){var e,n;return void 0===s&&(s={}),this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=i({},this.defaultSettings,s),this.el=t,this.head=(null==(e=this.el)?void 0:e.querySelector(this.settings.headSelector))||null,this.body=(null==(n=this.el)?void 0:n.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}var s=t.prototype;return s.bind=function(){var t=this;return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",function(){!t.isOpen&&t.el&&t.el.classList.add(t.settings.hiddenClass)}),this},s.setHeight=function(t){var i=this;return setTimeout(function(){i.body&&(i.body.style.maxHeight=t+"px")},1),this},s.toggle=function(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this},s.close=function(){return this.isOpen?(this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=this.height+"px"),this.setHeight(0),this):this},s.open=function(){return this.isOpen||(this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height)),this},t}();t.Accordion=s,t.default=s}); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t||self).accordion={})}(this,function(t){function i(){return i=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},i.apply(this,arguments)}var e=/*#__PURE__*/function(){function t(t,e){var s,n;return void 0===e&&(e={}),this.el=void 0,this.head=void 0,this.body=void 0,this.height=0,this.isOpen=!1,this.settings=void 0,this.defaultSettings={headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},this.settings=i({},this.defaultSettings,e),this.el=t,this.head=(null==(s=this.el)?void 0:s.querySelector(this.settings.headSelector))||null,this.body=(null==(n=this.el)?void 0:n.querySelector(this.settings.bodySelector))||null,this.bind().close(),this}var e=t.prototype;return e.bind=function(){var t=this;return this.head&&this.head.addEventListener("click",this.toggle.bind(this)),this.body&&this.body.addEventListener("transitionend",function(){!t.isOpen&&t.el&&t.el.classList.add(t.settings.hiddenClass)}),this},e.setHeight=function(t){var i=this;return setTimeout(function(){i.body&&(i.body.style.maxHeight=t+"px")},1),this},e.toggle=function(){var t;return this.height=(null==(t=this.body)?void 0:t.scrollHeight)||0,this.isOpen?this.close():this.open(),this},e.close=function(){return this.isOpen=!1,this.el&&this.el.classList.remove(this.settings.activeClass),this.body&&(this.body.style.maxHeight=this.height+"px"),this.setHeight(0),this},e.open=function(){return this.isOpen=!0,this.el&&(this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass)),this.body&&(this.body.style.maxHeight="0px"),this.setHeight(this.height),this},t}();t.Accordion=e,t.default=e}); | ||
//# sourceMappingURL=accordion.umd.js.map |
{ | ||
"name": "@three11/accordion", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Front-end Accordion widget using max-height", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -75,6 +75,2 @@ import './accordion.css'; | ||
public close(): Accordion { | ||
if (!this.isOpen) { | ||
return this; | ||
} | ||
this.isOpen = false; | ||
@@ -96,6 +92,2 @@ | ||
public open(): Accordion { | ||
if (this.isOpen) { | ||
return this; | ||
} | ||
this.isOpen = true; | ||
@@ -102,0 +94,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
65564
146