foundation6-jekyll-base 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/_includes/footer.html +1 -0
- data/_includes/head.html +16 -0
- data/_includes/header.html +1 -0
- data/_includes/javascripts.html +4 -0
- data/_layouts/default.html +18 -0
- data/_layouts/home.html +26 -0
- data/_layouts/page.html +15 -0
- data/_layouts/post.html +25 -0
- data/_sass/_vendor/normalize-scss/sass/_normalize.scss +3 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
- data/_sass/foundation/_global.scss +219 -0
- data/_sass/foundation/components/_accordion-menu.scss +36 -0
- data/_sass/foundation/components/_accordion.scss +150 -0
- data/_sass/foundation/components/_badge.scss +63 -0
- data/_sass/foundation/components/_breadcrumbs.scss +97 -0
- data/_sass/foundation/components/_button-group.scss +249 -0
- data/_sass/foundation/components/_button.scss +303 -0
- data/_sass/foundation/components/_callout.scss +106 -0
- data/_sass/foundation/components/_card.scss +121 -0
- data/_sass/foundation/components/_close-button.scss +102 -0
- data/_sass/foundation/components/_drilldown.scss +93 -0
- data/_sass/foundation/components/_dropdown-menu.scss +226 -0
- data/_sass/foundation/components/_dropdown.scss +72 -0
- data/_sass/foundation/components/_flex-video.scss +1 -0
- data/_sass/foundation/components/_flex.scss +28 -0
- data/_sass/foundation/components/_float.scss +27 -0
- data/_sass/foundation/components/_label.scss +64 -0
- data/_sass/foundation/components/_media-object.scss +114 -0
- data/_sass/foundation/components/_menu-icon.scss +9 -0
- data/_sass/foundation/components/_menu.scss +371 -0
- data/_sass/foundation/components/_off-canvas.scss +329 -0
- data/_sass/foundation/components/_orbit.scss +196 -0
- data/_sass/foundation/components/_pagination.scss +193 -0
- data/_sass/foundation/components/_progress-bar.scss +64 -0
- data/_sass/foundation/components/_responsive-embed.scss +67 -0
- data/_sass/foundation/components/_reveal.scss +178 -0
- data/_sass/foundation/components/_slider.scss +138 -0
- data/_sass/foundation/components/_sticky.scss +38 -0
- data/_sass/foundation/components/_switch.scss +247 -0
- data/_sass/foundation/components/_table.scss +329 -0
- data/_sass/foundation/components/_tabs.scss +196 -0
- data/_sass/foundation/components/_thumbnail.scss +67 -0
- data/_sass/foundation/components/_title-bar.scss +84 -0
- data/_sass/foundation/components/_tooltip.scss +107 -0
- data/_sass/foundation/components/_top-bar.scss +173 -0
- data/_sass/foundation/components/_visibility.scss +132 -0
- data/_sass/foundation/forms/_checkbox.scss +41 -0
- data/_sass/foundation/forms/_error.scss +88 -0
- data/_sass/foundation/forms/_fieldset.scss +54 -0
- data/_sass/foundation/forms/_forms.scss +34 -0
- data/_sass/foundation/forms/_help-text.scss +30 -0
- data/_sass/foundation/forms/_input-group.scss +135 -0
- data/_sass/foundation/forms/_label.scss +50 -0
- data/_sass/foundation/forms/_meter.scss +110 -0
- data/_sass/foundation/forms/_progress.scss +94 -0
- data/_sass/foundation/forms/_range.scss +149 -0
- data/_sass/foundation/forms/_select.scss +85 -0
- data/_sass/foundation/forms/_text.scss +170 -0
- data/_sass/foundation/foundation.scss +118 -0
- data/_sass/foundation/grid/_classes.scss +176 -0
- data/_sass/foundation/grid/_column.scss +112 -0
- data/_sass/foundation/grid/_flex-grid.scss +307 -0
- data/_sass/foundation/grid/_grid.scss +44 -0
- data/_sass/foundation/grid/_gutter.scss +82 -0
- data/_sass/foundation/grid/_layout.scss +76 -0
- data/_sass/foundation/grid/_position.scss +76 -0
- data/_sass/foundation/grid/_row.scss +99 -0
- data/_sass/foundation/grid/_size.scss +24 -0
- data/_sass/foundation/settings/_settings.scss +621 -0
- data/_sass/foundation/typography/_alignment.scss +22 -0
- data/_sass/foundation/typography/_base.scss +509 -0
- data/_sass/foundation/typography/_helpers.scss +78 -0
- data/_sass/foundation/typography/_print.scss +81 -0
- data/_sass/foundation/typography/_typography.scss +26 -0
- data/_sass/foundation/util/_breakpoint.scss +281 -0
- data/_sass/foundation/util/_color.scss +126 -0
- data/_sass/foundation/util/_direction.scss +31 -0
- data/_sass/foundation/util/_flex.scss +85 -0
- data/_sass/foundation/util/_math.scss +72 -0
- data/_sass/foundation/util/_mixins.scss +276 -0
- data/_sass/foundation/util/_selector.scss +41 -0
- data/_sass/foundation/util/_unit.scss +152 -0
- data/_sass/foundation/util/_util.scss +13 -0
- data/_sass/foundation/util/_value.scss +140 -0
- data/assets/js/app.js +1 -0
- data/assets/js/vendor/foundation/foundation.d.ts +496 -0
- data/assets/js/vendor/foundation/foundation.js +10207 -0
- data/assets/js/vendor/foundation/foundation.min.js +4 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.js +637 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.js +252 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.js +318 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.js +386 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.js +565 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.js +465 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.js +486 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.js +374 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.js +285 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.js +474 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.js +566 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.js +177 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.js +633 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.js +762 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.js +518 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.js +512 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.js +492 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.js +196 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.js +163 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.js +103 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.js +74 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.js +90 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.js +352 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.js +261 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.js +262 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.min.js +1 -0
- data/assets/main.scss +6 -0
- metadata +232 -0
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();!function(e){var t=function(){function t(a){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t),this.$element=a,this.options=e.extend({},t.defaults,this.$element.data(),r),this._init(),Foundation.registerPlugin(this,"Abide")}return _createClass(t,[{key:"_init",value:function(){this.$inputs=this.$element.find("input, textarea, select"),this._events()}},{key:"_events",value:function(){var t=this;this.$element.off(".abide").on("reset.zf.abide",function(){t.resetForm()}).on("submit.zf.abide",function(){return t.validateForm()}),"fieldChange"===this.options.validateOn&&this.$inputs.off("change.zf.abide").on("change.zf.abide",function(a){t.validateInput(e(a.target))}),this.options.liveValidate&&this.$inputs.off("input.zf.abide").on("input.zf.abide",function(a){t.validateInput(e(a.target))}),this.options.validateOnBlur&&this.$inputs.off("blur.zf.abide").on("blur.zf.abide",function(a){t.validateInput(e(a.target))})}},{key:"_reflow",value:function(){this._init()}},{key:"requiredCheck",value:function(e){if(!e.attr("required"))return!0;var t=!0;switch(e[0].type){case"checkbox":t=e[0].checked;break;case"select":case"select-one":case"select-multiple":var a=e.find("option:selected");a.length&&a.val()||(t=!1);break;default:e.val()&&e.val().length||(t=!1)}return t}},{key:"findFormError",value:function(e){var t=e.siblings(this.options.formErrorSelector);return t.length||(t=e.parent().find(this.options.formErrorSelector)),t}},{key:"findLabel",value:function(e){var t=e[0].id,a=this.$element.find('label[for="'+t+'"]');return a.length?a:e.closest("label")}},{key:"findRadioLabels",value:function(t){var a=this,r=t.map(function(t,r){var i=r.id,n=a.$element.find('label[for="'+i+'"]');return n.length||(n=e(r).closest("label")),n[0]});return e(r)}},{key:"addErrorClasses",value:function(e){var t=this.findLabel(e),a=this.findFormError(e);t.length&&t.addClass(this.options.labelErrorClass),a.length&&a.addClass(this.options.formErrorClass),e.addClass(this.options.inputErrorClass).attr("data-invalid","")}},{key:"removeRadioErrorClasses",value:function(e){var t=this.$element.find(':radio[name="'+e+'"]'),a=this.findRadioLabels(t),r=this.findFormError(t);a.length&&a.removeClass(this.options.labelErrorClass),r.length&&r.removeClass(this.options.formErrorClass),t.removeClass(this.options.inputErrorClass).removeAttr("data-invalid")}},{key:"removeErrorClasses",value:function(e){if("radio"==e[0].type)return this.removeRadioErrorClasses(e.attr("name"));var t=this.findLabel(e),a=this.findFormError(e);t.length&&t.removeClass(this.options.labelErrorClass),a.length&&a.removeClass(this.options.formErrorClass),e.removeClass(this.options.inputErrorClass).removeAttr("data-invalid")}},{key:"validateInput",value:function(t){var a=this,r=this.requiredCheck(t),i=!1,n=!0,s=t.attr("data-validator"),o=!0;if(t.is("[data-abide-ignore]")||t.is('[type="hidden"]')||t.is("[disabled]"))return!0;switch(t[0].type){case"radio":i=this.validateRadio(t.attr("name"));break;case"checkbox":i=r;break;case"select":case"select-one":case"select-multiple":i=r;break;default:i=this.validateText(t)}s&&(n=this.matchValidation(t,s,t.attr("required"))),t.attr("data-equalto")&&(o=this.options.validators.equalTo(t));var l=[r,i,n,o].indexOf(!1)===-1,u=(l?"valid":"invalid")+".zf.abide";if(l){var d=this.$element.find('[data-equalto="'+t.attr("id")+'"]');d.length&&!function(){var t=a;d.each(function(){e(this).val()&&t.validateInput(e(this))})}()}return this[l?"removeErrorClasses":"addErrorClasses"](t),t.trigger(u,[t]),l}},{key:"validateForm",value:function(){var t=[],a=this;this.$inputs.each(function(){t.push(a.validateInput(e(this)))});var r=t.indexOf(!1)===-1;return this.$element.find("[data-abide-error]").css("display",r?"none":"block"),this.$element.trigger((r?"formvalid":"forminvalid")+".zf.abide",[this.$element]),r}},{key:"validateText",value:function(e,t){t=t||e.attr("pattern")||e.attr("type");var a=e.val(),r=!1;return a.length?r=this.options.patterns.hasOwnProperty(t)?this.options.patterns[t].test(a):t===e.attr("type")||new RegExp(t).test(a):e.prop("required")||(r=!0),r}},{key:"validateRadio",value:function(t){var a=this.$element.find(':radio[name="'+t+'"]'),r=!1,i=!1;return a.each(function(t,a){e(a).attr("required")&&(i=!0)}),i||(r=!0),r||a.each(function(t,a){e(a).prop("checked")&&(r=!0)}),r}},{key:"matchValidation",value:function(e,t,a){var r=this;a=!!a;var i=t.split(" ").map(function(t){return r.options.validators[t](e,a,e.parent())});return i.indexOf(!1)===-1}},{key:"resetForm",value:function(){var t=this.$element,a=this.options;e("."+a.labelErrorClass,t).not("small").removeClass(a.labelErrorClass),e("."+a.inputErrorClass,t).not("small").removeClass(a.inputErrorClass),e(a.formErrorSelector+"."+a.formErrorClass).removeClass(a.formErrorClass),t.find("[data-abide-error]").css("display","none"),e(":input",t).not(":button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]").val("").removeAttr("data-invalid"),e(":input:radio",t).not("[data-abide-ignore]").prop("checked",!1).removeAttr("data-invalid"),e(":input:checkbox",t).not("[data-abide-ignore]").prop("checked",!1).removeAttr("data-invalid"),t.trigger("formreset.zf.abide",[t])}},{key:"destroy",value:function(){var t=this;this.$element.off(".abide").find("[data-abide-error]").css("display","none"),this.$inputs.off(".abide").each(function(){t.removeErrorClasses(e(this))}),Foundation.unregisterPlugin(this)}}]),t}();t.defaults={validateOn:"fieldChange",labelErrorClass:"is-invalid-label",inputErrorClass:"is-invalid-input",formErrorSelector:".form-error",formErrorClass:"is-visible",liveValidate:!1,validateOnBlur:!1,patterns:{alpha:/^[a-zA-Z]+$/,alpha_numeric:/^[a-zA-Z0-9]+$/,integer:/^[-+]?\d+$/,number:/^[-+]?\d*(?:[\.\,]\d+)?$/,card:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,cvv:/^([0-9]){3,4}$/,email:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,url:/^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,domain:/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,datetime:/^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,date:/(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,time:/^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,dateISO:/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,month_day_year:/^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,day_month_year:/^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,color:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/},validators:{equalTo:function(t,a,r){return e("#"+t.attr("data-equalto")).val()===t.val()}}},Foundation.plugin(t,"Abide")}(jQuery);
|
@@ -0,0 +1,252 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
|
7
|
+
!function ($) {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Accordion module.
|
11
|
+
* @module foundation.accordion
|
12
|
+
* @requires foundation.util.keyboard
|
13
|
+
* @requires foundation.util.motion
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Accordion = function () {
|
17
|
+
/**
|
18
|
+
* Creates a new instance of an accordion.
|
19
|
+
* @class
|
20
|
+
* @fires Accordion#init
|
21
|
+
* @param {jQuery} element - jQuery object to make into an accordion.
|
22
|
+
* @param {Object} options - a plain object with settings to override the default options.
|
23
|
+
*/
|
24
|
+
function Accordion(element, options) {
|
25
|
+
_classCallCheck(this, Accordion);
|
26
|
+
|
27
|
+
this.$element = element;
|
28
|
+
this.options = $.extend({}, Accordion.defaults, this.$element.data(), options);
|
29
|
+
|
30
|
+
this._init();
|
31
|
+
|
32
|
+
Foundation.registerPlugin(this, 'Accordion');
|
33
|
+
Foundation.Keyboard.register('Accordion', {
|
34
|
+
'ENTER': 'toggle',
|
35
|
+
'SPACE': 'toggle',
|
36
|
+
'ARROW_DOWN': 'next',
|
37
|
+
'ARROW_UP': 'previous'
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Initializes the accordion by animating the preset active pane(s).
|
43
|
+
* @private
|
44
|
+
*/
|
45
|
+
|
46
|
+
|
47
|
+
_createClass(Accordion, [{
|
48
|
+
key: '_init',
|
49
|
+
value: function _init() {
|
50
|
+
this.$element.attr('role', 'tablist');
|
51
|
+
this.$tabs = this.$element.children('[data-accordion-item]');
|
52
|
+
|
53
|
+
this.$tabs.each(function (idx, el) {
|
54
|
+
var $el = $(el),
|
55
|
+
$content = $el.children('[data-tab-content]'),
|
56
|
+
id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'),
|
57
|
+
linkId = el.id || id + '-label';
|
58
|
+
|
59
|
+
$el.find('a:first').attr({
|
60
|
+
'aria-controls': id,
|
61
|
+
'role': 'tab',
|
62
|
+
'id': linkId,
|
63
|
+
'aria-expanded': false,
|
64
|
+
'aria-selected': false
|
65
|
+
});
|
66
|
+
|
67
|
+
$content.attr({ 'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id });
|
68
|
+
});
|
69
|
+
var $initActive = this.$element.find('.is-active').children('[data-tab-content]');
|
70
|
+
if ($initActive.length) {
|
71
|
+
this.down($initActive, true);
|
72
|
+
}
|
73
|
+
this._events();
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Adds event handlers for items within the accordion.
|
78
|
+
* @private
|
79
|
+
*/
|
80
|
+
|
81
|
+
}, {
|
82
|
+
key: '_events',
|
83
|
+
value: function _events() {
|
84
|
+
var _this = this;
|
85
|
+
|
86
|
+
this.$tabs.each(function () {
|
87
|
+
var $elem = $(this);
|
88
|
+
var $tabContent = $elem.children('[data-tab-content]');
|
89
|
+
if ($tabContent.length) {
|
90
|
+
$elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) {
|
91
|
+
e.preventDefault();
|
92
|
+
_this.toggle($tabContent);
|
93
|
+
}).on('keydown.zf.accordion', function (e) {
|
94
|
+
Foundation.Keyboard.handleKey(e, 'Accordion', {
|
95
|
+
toggle: function () {
|
96
|
+
_this.toggle($tabContent);
|
97
|
+
},
|
98
|
+
next: function () {
|
99
|
+
var $a = $elem.next().find('a').focus();
|
100
|
+
if (!_this.options.multiExpand) {
|
101
|
+
$a.trigger('click.zf.accordion');
|
102
|
+
}
|
103
|
+
},
|
104
|
+
previous: function () {
|
105
|
+
var $a = $elem.prev().find('a').focus();
|
106
|
+
if (!_this.options.multiExpand) {
|
107
|
+
$a.trigger('click.zf.accordion');
|
108
|
+
}
|
109
|
+
},
|
110
|
+
handled: function () {
|
111
|
+
e.preventDefault();
|
112
|
+
e.stopPropagation();
|
113
|
+
}
|
114
|
+
});
|
115
|
+
});
|
116
|
+
}
|
117
|
+
});
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Toggles the selected content pane's open/close state.
|
122
|
+
* @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`).
|
123
|
+
* @function
|
124
|
+
*/
|
125
|
+
|
126
|
+
}, {
|
127
|
+
key: 'toggle',
|
128
|
+
value: function toggle($target) {
|
129
|
+
if ($target.parent().hasClass('is-active')) {
|
130
|
+
this.up($target);
|
131
|
+
} else {
|
132
|
+
this.down($target);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Opens the accordion tab defined by `$target`.
|
138
|
+
* @param {jQuery} $target - Accordion pane to open (`.accordion-content`).
|
139
|
+
* @param {Boolean} firstTime - flag to determine if reflow should happen.
|
140
|
+
* @fires Accordion#down
|
141
|
+
* @function
|
142
|
+
*/
|
143
|
+
|
144
|
+
}, {
|
145
|
+
key: 'down',
|
146
|
+
value: function down($target, firstTime) {
|
147
|
+
var _this2 = this;
|
148
|
+
|
149
|
+
$target.attr('aria-hidden', false).parent('[data-tab-content]').addBack().parent().addClass('is-active');
|
150
|
+
|
151
|
+
if (!this.options.multiExpand && !firstTime) {
|
152
|
+
var $currentActive = this.$element.children('.is-active').children('[data-tab-content]');
|
153
|
+
if ($currentActive.length) {
|
154
|
+
this.up($currentActive.not($target));
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
$target.slideDown(this.options.slideSpeed, function () {
|
159
|
+
/**
|
160
|
+
* Fires when the tab is done opening.
|
161
|
+
* @event Accordion#down
|
162
|
+
*/
|
163
|
+
_this2.$element.trigger('down.zf.accordion', [$target]);
|
164
|
+
});
|
165
|
+
|
166
|
+
$('#' + $target.attr('aria-labelledby')).attr({
|
167
|
+
'aria-expanded': true,
|
168
|
+
'aria-selected': true
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Closes the tab defined by `$target`.
|
174
|
+
* @param {jQuery} $target - Accordion tab to close (`.accordion-content`).
|
175
|
+
* @fires Accordion#up
|
176
|
+
* @function
|
177
|
+
*/
|
178
|
+
|
179
|
+
}, {
|
180
|
+
key: 'up',
|
181
|
+
value: function up($target) {
|
182
|
+
var $aunts = $target.parent().siblings(),
|
183
|
+
_this = this;
|
184
|
+
|
185
|
+
if (!this.options.allowAllClosed && !$aunts.hasClass('is-active') || !$target.parent().hasClass('is-active')) {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
189
|
+
// Foundation.Move(this.options.slideSpeed, $target, function(){
|
190
|
+
$target.slideUp(_this.options.slideSpeed, function () {
|
191
|
+
/**
|
192
|
+
* Fires when the tab is done collapsing up.
|
193
|
+
* @event Accordion#up
|
194
|
+
*/
|
195
|
+
_this.$element.trigger('up.zf.accordion', [$target]);
|
196
|
+
});
|
197
|
+
// });
|
198
|
+
|
199
|
+
$target.attr('aria-hidden', true).parent().removeClass('is-active');
|
200
|
+
|
201
|
+
$('#' + $target.attr('aria-labelledby')).attr({
|
202
|
+
'aria-expanded': false,
|
203
|
+
'aria-selected': false
|
204
|
+
});
|
205
|
+
}
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Destroys an instance of an accordion.
|
209
|
+
* @fires Accordion#destroyed
|
210
|
+
* @function
|
211
|
+
*/
|
212
|
+
|
213
|
+
}, {
|
214
|
+
key: 'destroy',
|
215
|
+
value: function destroy() {
|
216
|
+
this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', '');
|
217
|
+
this.$element.find('a').off('.zf.accordion');
|
218
|
+
|
219
|
+
Foundation.unregisterPlugin(this);
|
220
|
+
}
|
221
|
+
}]);
|
222
|
+
|
223
|
+
return Accordion;
|
224
|
+
}();
|
225
|
+
|
226
|
+
Accordion.defaults = {
|
227
|
+
/**
|
228
|
+
* Amount of time to animate the opening of an accordion pane.
|
229
|
+
* @option
|
230
|
+
* @type {number}
|
231
|
+
* @default 250
|
232
|
+
*/
|
233
|
+
slideSpeed: 250,
|
234
|
+
/**
|
235
|
+
* Allow the accordion to have multiple open panes.
|
236
|
+
* @option
|
237
|
+
* @type {boolean}
|
238
|
+
* @default false
|
239
|
+
*/
|
240
|
+
multiExpand: false,
|
241
|
+
/**
|
242
|
+
* Allow the accordion to close all panes.
|
243
|
+
* @option
|
244
|
+
* @type {boolean}
|
245
|
+
* @default false
|
246
|
+
*/
|
247
|
+
allowAllClosed: false
|
248
|
+
};
|
249
|
+
|
250
|
+
// Window exports
|
251
|
+
Foundation.plugin(Accordion, 'Accordion');
|
252
|
+
}(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,n,a){return n&&t(e.prototype,n),a&&t(e,a),e}}();!function(t){var e=function(){function e(n,a){_classCallCheck(this,e),this.$element=n,this.options=t.extend({},e.defaults,this.$element.data(),a),this._init(),Foundation.registerPlugin(this,"Accordion"),Foundation.Keyboard.register("Accordion",{ENTER:"toggle",SPACE:"toggle",ARROW_DOWN:"next",ARROW_UP:"previous"})}return _createClass(e,[{key:"_init",value:function(){this.$element.attr("role","tablist"),this.$tabs=this.$element.children("[data-accordion-item]"),this.$tabs.each(function(e,n){var a=t(n),i=a.children("[data-tab-content]"),o=i[0].id||Foundation.GetYoDigits(6,"accordion"),r=n.id||o+"-label";a.find("a:first").attr({"aria-controls":o,role:"tab",id:r,"aria-expanded":!1,"aria-selected":!1}),i.attr({role:"tabpanel","aria-labelledby":r,"aria-hidden":!0,id:o})});var e=this.$element.find(".is-active").children("[data-tab-content]");e.length&&this.down(e,!0),this._events()}},{key:"_events",value:function(){var e=this;this.$tabs.each(function(){var n=t(this),a=n.children("[data-tab-content]");a.length&&n.children("a").off("click.zf.accordion keydown.zf.accordion").on("click.zf.accordion",function(t){t.preventDefault(),e.toggle(a)}).on("keydown.zf.accordion",function(t){Foundation.Keyboard.handleKey(t,"Accordion",{toggle:function(){e.toggle(a)},next:function(){var t=n.next().find("a").focus();e.options.multiExpand||t.trigger("click.zf.accordion")},previous:function(){var t=n.prev().find("a").focus();e.options.multiExpand||t.trigger("click.zf.accordion")},handled:function(){t.preventDefault(),t.stopPropagation()}})})})}},{key:"toggle",value:function(t){t.parent().hasClass("is-active")?this.up(t):this.down(t)}},{key:"down",value:function(e,n){var a=this;if(e.attr("aria-hidden",!1).parent("[data-tab-content]").addBack().parent().addClass("is-active"),!this.options.multiExpand&&!n){var i=this.$element.children(".is-active").children("[data-tab-content]");i.length&&this.up(i.not(e))}e.slideDown(this.options.slideSpeed,function(){a.$element.trigger("down.zf.accordion",[e])}),t("#"+e.attr("aria-labelledby")).attr({"aria-expanded":!0,"aria-selected":!0})}},{key:"up",value:function(e){var n=e.parent().siblings(),a=this;(this.options.allowAllClosed||n.hasClass("is-active"))&&e.parent().hasClass("is-active")&&(e.slideUp(a.options.slideSpeed,function(){a.$element.trigger("up.zf.accordion",[e])}),e.attr("aria-hidden",!0).parent().removeClass("is-active"),t("#"+e.attr("aria-labelledby")).attr({"aria-expanded":!1,"aria-selected":!1}))}},{key:"destroy",value:function(){this.$element.find("[data-tab-content]").stop(!0).slideUp(0).css("display",""),this.$element.find("a").off(".zf.accordion"),Foundation.unregisterPlugin(this)}}]),e}();e.defaults={slideSpeed:250,multiExpand:!1,allowAllClosed:!1},Foundation.plugin(e,"Accordion")}(jQuery);
|
@@ -0,0 +1,318 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
|
7
|
+
!function ($) {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* AccordionMenu module.
|
11
|
+
* @module foundation.accordionMenu
|
12
|
+
* @requires foundation.util.keyboard
|
13
|
+
* @requires foundation.util.motion
|
14
|
+
* @requires foundation.util.nest
|
15
|
+
*/
|
16
|
+
|
17
|
+
var AccordionMenu = function () {
|
18
|
+
/**
|
19
|
+
* Creates a new instance of an accordion menu.
|
20
|
+
* @class
|
21
|
+
* @fires AccordionMenu#init
|
22
|
+
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
23
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
24
|
+
*/
|
25
|
+
function AccordionMenu(element, options) {
|
26
|
+
_classCallCheck(this, AccordionMenu);
|
27
|
+
|
28
|
+
this.$element = element;
|
29
|
+
this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options);
|
30
|
+
|
31
|
+
Foundation.Nest.Feather(this.$element, 'accordion');
|
32
|
+
|
33
|
+
this._init();
|
34
|
+
|
35
|
+
Foundation.registerPlugin(this, 'AccordionMenu');
|
36
|
+
Foundation.Keyboard.register('AccordionMenu', {
|
37
|
+
'ENTER': 'toggle',
|
38
|
+
'SPACE': 'toggle',
|
39
|
+
'ARROW_RIGHT': 'open',
|
40
|
+
'ARROW_UP': 'up',
|
41
|
+
'ARROW_DOWN': 'down',
|
42
|
+
'ARROW_LEFT': 'close',
|
43
|
+
'ESCAPE': 'closeAll'
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Initializes the accordion menu by hiding all nested menus.
|
49
|
+
* @private
|
50
|
+
*/
|
51
|
+
|
52
|
+
|
53
|
+
_createClass(AccordionMenu, [{
|
54
|
+
key: '_init',
|
55
|
+
value: function _init() {
|
56
|
+
this.$element.find('[data-submenu]').not('.is-active').slideUp(0); //.find('a').css('padding-left', '1rem');
|
57
|
+
this.$element.attr({
|
58
|
+
'role': 'menu',
|
59
|
+
'aria-multiselectable': this.options.multiOpen
|
60
|
+
});
|
61
|
+
|
62
|
+
this.$menuLinks = this.$element.find('.is-accordion-submenu-parent');
|
63
|
+
this.$menuLinks.each(function () {
|
64
|
+
var linkId = this.id || Foundation.GetYoDigits(6, 'acc-menu-link'),
|
65
|
+
$elem = $(this),
|
66
|
+
$sub = $elem.children('[data-submenu]'),
|
67
|
+
subId = $sub[0].id || Foundation.GetYoDigits(6, 'acc-menu'),
|
68
|
+
isActive = $sub.hasClass('is-active');
|
69
|
+
$elem.attr({
|
70
|
+
'aria-controls': subId,
|
71
|
+
'aria-expanded': isActive,
|
72
|
+
'role': 'menuitem',
|
73
|
+
'id': linkId
|
74
|
+
});
|
75
|
+
$sub.attr({
|
76
|
+
'aria-labelledby': linkId,
|
77
|
+
'aria-hidden': !isActive,
|
78
|
+
'role': 'menu',
|
79
|
+
'id': subId
|
80
|
+
});
|
81
|
+
});
|
82
|
+
var initPanes = this.$element.find('.is-active');
|
83
|
+
if (initPanes.length) {
|
84
|
+
var _this = this;
|
85
|
+
initPanes.each(function () {
|
86
|
+
_this.down($(this));
|
87
|
+
});
|
88
|
+
}
|
89
|
+
this._events();
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Adds event handlers for items within the menu.
|
94
|
+
* @private
|
95
|
+
*/
|
96
|
+
|
97
|
+
}, {
|
98
|
+
key: '_events',
|
99
|
+
value: function _events() {
|
100
|
+
var _this = this;
|
101
|
+
|
102
|
+
this.$element.find('li').each(function () {
|
103
|
+
var $submenu = $(this).children('[data-submenu]');
|
104
|
+
|
105
|
+
if ($submenu.length) {
|
106
|
+
$(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) {
|
107
|
+
e.preventDefault();
|
108
|
+
|
109
|
+
_this.toggle($submenu);
|
110
|
+
});
|
111
|
+
}
|
112
|
+
}).on('keydown.zf.accordionmenu', function (e) {
|
113
|
+
var $element = $(this),
|
114
|
+
$elements = $element.parent('ul').children('li'),
|
115
|
+
$prevElement,
|
116
|
+
$nextElement,
|
117
|
+
$target = $element.children('[data-submenu]');
|
118
|
+
|
119
|
+
$elements.each(function (i) {
|
120
|
+
if ($(this).is($element)) {
|
121
|
+
$prevElement = $elements.eq(Math.max(0, i - 1)).find('a').first();
|
122
|
+
$nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)).find('a').first();
|
123
|
+
|
124
|
+
if ($(this).children('[data-submenu]:visible').length) {
|
125
|
+
// has open sub menu
|
126
|
+
$nextElement = $element.find('li:first-child').find('a').first();
|
127
|
+
}
|
128
|
+
if ($(this).is(':first-child')) {
|
129
|
+
// is first element of sub menu
|
130
|
+
$prevElement = $element.parents('li').first().find('a').first();
|
131
|
+
} else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) {
|
132
|
+
// if previous element has open sub menu
|
133
|
+
$prevElement = $prevElement.parents('li').find('li:last-child').find('a').first();
|
134
|
+
}
|
135
|
+
if ($(this).is(':last-child')) {
|
136
|
+
// is last element of sub menu
|
137
|
+
$nextElement = $element.parents('li').first().next('li').find('a').first();
|
138
|
+
}
|
139
|
+
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
});
|
143
|
+
|
144
|
+
Foundation.Keyboard.handleKey(e, 'AccordionMenu', {
|
145
|
+
open: function () {
|
146
|
+
if ($target.is(':hidden')) {
|
147
|
+
_this.down($target);
|
148
|
+
$target.find('li').first().find('a').first().focus();
|
149
|
+
}
|
150
|
+
},
|
151
|
+
close: function () {
|
152
|
+
if ($target.length && !$target.is(':hidden')) {
|
153
|
+
// close active sub of this item
|
154
|
+
_this.up($target);
|
155
|
+
} else if ($element.parent('[data-submenu]').length) {
|
156
|
+
// close currently open sub
|
157
|
+
_this.up($element.parent('[data-submenu]'));
|
158
|
+
$element.parents('li').first().find('a').first().focus();
|
159
|
+
}
|
160
|
+
},
|
161
|
+
up: function () {
|
162
|
+
$prevElement.focus();
|
163
|
+
return true;
|
164
|
+
},
|
165
|
+
down: function () {
|
166
|
+
$nextElement.focus();
|
167
|
+
return true;
|
168
|
+
},
|
169
|
+
toggle: function () {
|
170
|
+
if ($element.children('[data-submenu]').length) {
|
171
|
+
_this.toggle($element.children('[data-submenu]'));
|
172
|
+
}
|
173
|
+
},
|
174
|
+
closeAll: function () {
|
175
|
+
_this.hideAll();
|
176
|
+
},
|
177
|
+
handled: function (preventDefault) {
|
178
|
+
if (preventDefault) {
|
179
|
+
e.preventDefault();
|
180
|
+
}
|
181
|
+
e.stopImmediatePropagation();
|
182
|
+
}
|
183
|
+
});
|
184
|
+
}); //.attr('tabindex', 0);
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* Closes all panes of the menu.
|
189
|
+
* @function
|
190
|
+
*/
|
191
|
+
|
192
|
+
}, {
|
193
|
+
key: 'hideAll',
|
194
|
+
value: function hideAll() {
|
195
|
+
this.up(this.$element.find('[data-submenu]'));
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Opens all panes of the menu.
|
200
|
+
* @function
|
201
|
+
*/
|
202
|
+
|
203
|
+
}, {
|
204
|
+
key: 'showAll',
|
205
|
+
value: function showAll() {
|
206
|
+
this.down(this.$element.find('[data-submenu]'));
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Toggles the open/close state of a submenu.
|
211
|
+
* @function
|
212
|
+
* @param {jQuery} $target - the submenu to toggle
|
213
|
+
*/
|
214
|
+
|
215
|
+
}, {
|
216
|
+
key: 'toggle',
|
217
|
+
value: function toggle($target) {
|
218
|
+
if (!$target.is(':animated')) {
|
219
|
+
if (!$target.is(':hidden')) {
|
220
|
+
this.up($target);
|
221
|
+
} else {
|
222
|
+
this.down($target);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Opens the sub-menu defined by `$target`.
|
229
|
+
* @param {jQuery} $target - Sub-menu to open.
|
230
|
+
* @fires AccordionMenu#down
|
231
|
+
*/
|
232
|
+
|
233
|
+
}, {
|
234
|
+
key: 'down',
|
235
|
+
value: function down($target) {
|
236
|
+
var _this = this;
|
237
|
+
|
238
|
+
if (!this.options.multiOpen) {
|
239
|
+
this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target)));
|
240
|
+
}
|
241
|
+
|
242
|
+
$target.addClass('is-active').attr({ 'aria-hidden': false }).parent('.is-accordion-submenu-parent').attr({ 'aria-expanded': true });
|
243
|
+
|
244
|
+
//Foundation.Move(this.options.slideSpeed, $target, function() {
|
245
|
+
$target.slideDown(_this.options.slideSpeed, function () {
|
246
|
+
/**
|
247
|
+
* Fires when the menu is done opening.
|
248
|
+
* @event AccordionMenu#down
|
249
|
+
*/
|
250
|
+
_this.$element.trigger('down.zf.accordionMenu', [$target]);
|
251
|
+
});
|
252
|
+
//});
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well.
|
257
|
+
* @param {jQuery} $target - Sub-menu to close.
|
258
|
+
* @fires AccordionMenu#up
|
259
|
+
*/
|
260
|
+
|
261
|
+
}, {
|
262
|
+
key: 'up',
|
263
|
+
value: function up($target) {
|
264
|
+
var _this = this;
|
265
|
+
//Foundation.Move(this.options.slideSpeed, $target, function(){
|
266
|
+
$target.slideUp(_this.options.slideSpeed, function () {
|
267
|
+
/**
|
268
|
+
* Fires when the menu is done collapsing up.
|
269
|
+
* @event AccordionMenu#up
|
270
|
+
*/
|
271
|
+
_this.$element.trigger('up.zf.accordionMenu', [$target]);
|
272
|
+
});
|
273
|
+
//});
|
274
|
+
|
275
|
+
var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true);
|
276
|
+
|
277
|
+
$menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false);
|
278
|
+
}
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Destroys an instance of accordion menu.
|
282
|
+
* @fires AccordionMenu#destroyed
|
283
|
+
*/
|
284
|
+
|
285
|
+
}, {
|
286
|
+
key: 'destroy',
|
287
|
+
value: function destroy() {
|
288
|
+
this.$element.find('[data-submenu]').slideDown(0).css('display', '');
|
289
|
+
this.$element.find('a').off('click.zf.accordionMenu');
|
290
|
+
|
291
|
+
Foundation.Nest.Burn(this.$element, 'accordion');
|
292
|
+
Foundation.unregisterPlugin(this);
|
293
|
+
}
|
294
|
+
}]);
|
295
|
+
|
296
|
+
return AccordionMenu;
|
297
|
+
}();
|
298
|
+
|
299
|
+
AccordionMenu.defaults = {
|
300
|
+
/**
|
301
|
+
* Amount of time to animate the opening of a submenu in ms.
|
302
|
+
* @option
|
303
|
+
* @type {number}
|
304
|
+
* @default 250
|
305
|
+
*/
|
306
|
+
slideSpeed: 250,
|
307
|
+
/**
|
308
|
+
* Allow the menu to have multiple open panes.
|
309
|
+
* @option
|
310
|
+
* @type {boolean}
|
311
|
+
* @default true
|
312
|
+
*/
|
313
|
+
multiOpen: true
|
314
|
+
};
|
315
|
+
|
316
|
+
// Window exports
|
317
|
+
Foundation.plugin(AccordionMenu, 'AccordionMenu');
|
318
|
+
}(jQuery);
|