flystyles
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -5,2 +5,20 @@ // | ||
// Closest polyfill | ||
if (!Element.prototype.matches) | ||
Element.prototype.matches = | ||
Element.prototype.msMatchesSelector || | ||
Element.prototype.webkitMatchesSelector; | ||
if (!Element.prototype.closest) | ||
Element.prototype.closest = function(s) { | ||
var el = this; | ||
if (!document.documentElement.contains(el)) return null; | ||
do { | ||
if (el.matches(s)) return el; | ||
el = el.parentElement; | ||
} while (el !== null); | ||
return null; | ||
}; | ||
// Main nav | ||
document | ||
@@ -13,3 +31,4 @@ .querySelector('[data-js="mobile-menu"]') | ||
var formFields = Array.from( | ||
// Add `has-value` and `is-focused` clases to FormGroup | ||
var formFields = Array.prototype.slice.call( | ||
document.querySelectorAll( | ||
@@ -45,1 +64,20 @@ ".FormGroup .Input, .FormGroup .Select, .FormGroup .Textarea, .FormGroup .Autocomplete-search" | ||
} | ||
// Simulate accordion behaviour | ||
var accordionTriggers = Array.prototype.slice.call( | ||
document.querySelectorAll('[data-js="accordion-trigger"]') | ||
); | ||
if (accordionTriggers.length) { | ||
accordionTriggers.forEach(function(element) { | ||
element.addEventListener("click", function(e) { | ||
var section = e.target; | ||
accordionTriggers.forEach(function(element) { | ||
element.closest(".Accordion-section").classList.remove("is-active"); | ||
}); | ||
section.closest(".Accordion-section").classList.add("is-active"); | ||
}); | ||
}); | ||
} |
{ | ||
"name": "flystyles", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Flywire UI Framework", | ||
@@ -5,0 +5,0 @@ "author": "Javier Arques <javier.arques@flywire.com>", |
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
1363310
128
4387