foundation6-jekyll-base 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}();!function(e){var n=function(){function n(t,i){_classCallCheck(this,n),this.$element=t,this.options=e.extend({},n.defaults,this.$element.data(),i),Foundation.Nest.Feather(this.$element,"drilldown"),this._init(),Foundation.registerPlugin(this,"Drilldown"),Foundation.Keyboard.register("Drilldown",{ENTER:"open",SPACE:"open",ARROW_RIGHT:"next",ARROW_UP:"up",ARROW_DOWN:"down",ARROW_LEFT:"previous",ESCAPE:"close",TAB:"down",SHIFT_TAB:"up"})}return _createClass(n,[{key:"_init",value:function(){this.$submenuAnchors=this.$element.find("li.is-drilldown-submenu-parent").children("a"),this.$submenus=this.$submenuAnchors.parent("li").children("[data-submenu]"),this.$menuItems=this.$element.find("li").not(".js-drilldown-back").attr("role","menuitem").find("a"),this.$element.attr("data-mutate",this.$element.attr("data-drilldown")||Foundation.GetYoDigits(6,"drilldown")),this._prepareMenu(),this._registerEvents(),this._keyboardEvents()}},{key:"_prepareMenu",value:function(){var n=this;this.$submenuAnchors.each(function(){var t=e(this),i=t.parent();n.options.parentLink&&t.clone().prependTo(i.children("[data-submenu]")).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>'),t.data("savedHref",t.attr("href")).removeAttr("href").attr("tabindex",0),t.children("[data-submenu]").attr({"aria-hidden":!0,tabindex:0,role:"menu"}),n._events(t)}),this.$submenus.each(function(){var t=e(this),i=t.find(".js-drilldown-back");if(!i.length)switch(n.options.backButtonPosition){case"bottom":t.append(n.options.backButton);break;case"top":t.prepend(n.options.backButton);break;default:console.error("Unsupported backButtonPosition value '"+n.options.backButtonPosition+"'")}n._back(t)}),this.$submenus.addClass("invisible"),this.options.autoHeight||this.$submenus.addClass("drilldown-submenu-cover-previous"),this.$element.parent().hasClass("is-drilldown")||(this.$wrapper=e(this.options.wrapper).addClass("is-drilldown"),this.options.animateHeight&&this.$wrapper.addClass("animate-height"),this.$element.wrap(this.$wrapper)),this.$wrapper=this.$element.parent(),this.$wrapper.css(this._getMaxDims())}},{key:"_resize",value:function(){this.$wrapper.css({"max-width":"none","min-height":"none"}),this.$wrapper.css(this._getMaxDims())}},{key:"_events",value:function(n){var t=this;n.off("click.zf.drilldown").on("click.zf.drilldown",function(i){if(e(i.target).parentsUntil("ul","li").hasClass("is-drilldown-submenu-parent")&&(i.stopImmediatePropagation(),i.preventDefault()),t._show(n.parent("li")),t.options.closeOnClick){var s=e("body");s.off(".zf.drilldown").on("click.zf.drilldown",function(n){n.target===t.$element[0]||e.contains(t.$element[0],n.target)||(n.preventDefault(),t._hideAll(),s.off(".zf.drilldown"))})}}),this.$element.on("mutateme.zf.trigger",this._resize.bind(this))}},{key:"_registerEvents",value:function(){this.options.scrollTop&&(this._bindHandler=this._scrollTop.bind(this),this.$element.on("open.zf.drilldown hide.zf.drilldown closed.zf.drilldown",this._bindHandler))}},{key:"_scrollTop",value:function(){var n=this,t=""!=n.options.scrollTopElement?e(n.options.scrollTopElement):n.$element,i=parseInt(t.offset().top+n.options.scrollTopOffset);e("html, body").stop(!0).animate({scrollTop:i},n.options.animationDuration,n.options.animationEasing,function(){this===e("html")[0]&&n.$element.trigger("scrollme.zf.drilldown")})}},{key:"_keyboardEvents",value:function(){var n=this;this.$menuItems.add(this.$element.find(".js-drilldown-back > a, .is-submenu-parent-item > a")).on("keydown.zf.drilldown",function(t){var i,s,a=e(this),o=a.parent("li").parent("ul").children("li").children("a");o.each(function(n){if(e(this).is(a))return i=o.eq(Math.max(0,n-1)),void(s=o.eq(Math.min(n+1,o.length-1)))}),Foundation.Keyboard.handleKey(t,"Drilldown",{next:function(){if(a.is(n.$submenuAnchors))return n._show(a.parent("li")),a.parent("li").one(Foundation.transitionend(a),function(){a.parent("li").find("ul li a").filter(n.$menuItems).first().focus()}),!0},previous:function(){return n._hide(a.parent("li").parent("ul")),a.parent("li").parent("ul").one(Foundation.transitionend(a),function(){setTimeout(function(){a.parent("li").parent("ul").parent("li").children("a").first().focus()},1)}),!0},up:function(){return i.focus(),!a.is(n.$element.find("> li:first-child > a"))},down:function(){return s.focus(),!a.is(n.$element.find("> li:last-child > a"))},close:function(){a.is(n.$element.find("> li > a"))||(n._hide(a.parent().parent()),a.parent().parent().siblings("a").focus())},open:function(){return a.is(n.$menuItems)?a.is(n.$submenuAnchors)?(n._show(a.parent("li")),a.parent("li").one(Foundation.transitionend(a),function(){a.parent("li").find("ul li a").filter(n.$menuItems).first().focus()}),!0):void 0:(n._hide(a.parent("li").parent("ul")),a.parent("li").parent("ul").one(Foundation.transitionend(a),function(){setTimeout(function(){a.parent("li").parent("ul").parent("li").children("a").first().focus()},1)}),!0)},handled:function(e){e&&t.preventDefault(),t.stopImmediatePropagation()}})})}},{key:"_hideAll",value:function(){var e=this.$element.find(".is-drilldown-submenu.is-active").addClass("is-closing");this.options.autoHeight&&this.$wrapper.css({height:e.parent().closest("ul").data("calcHeight")}),e.one(Foundation.transitionend(e),function(n){e.removeClass("is-active is-closing")}),this.$element.trigger("closed.zf.drilldown")}},{key:"_back",value:function(e){var n=this;e.off("click.zf.drilldown"),e.children(".js-drilldown-back").on("click.zf.drilldown",function(t){t.stopImmediatePropagation(),n._hide(e);var i=e.parent("li").parent("ul").parent("li");i.length&&n._show(i)})}},{key:"_menuLinkEvents",value:function(){var e=this;this.$menuItems.not(".is-drilldown-submenu-parent").off("click.zf.drilldown").on("click.zf.drilldown",function(n){setTimeout(function(){e._hideAll()},0)})}},{key:"_show",value:function(e){this.options.autoHeight&&this.$wrapper.css({height:e.children("[data-submenu]").data("calcHeight")}),e.attr("aria-expanded",!0),e.children("[data-submenu]").addClass("is-active").removeClass("invisible").attr("aria-hidden",!1),this.$element.trigger("open.zf.drilldown",[e])}},{key:"_hide",value:function(e){this.options.autoHeight&&this.$wrapper.css({height:e.parent().closest("ul").data("calcHeight")});e.parent("li").attr("aria-expanded",!1),e.attr("aria-hidden",!0).addClass("is-closing"),e.addClass("is-closing").one(Foundation.transitionend(e),function(){e.removeClass("is-active is-closing"),e.blur().addClass("invisible")}),e.trigger("hide.zf.drilldown",[e])}},{key:"_getMaxDims",value:function(){var n=0,t={},i=this;return this.$submenus.add(this.$element).each(function(){var s=(e(this).children("li").length,Foundation.Box.GetDimensions(this).height);n=s>n?s:n,i.options.autoHeight&&(e(this).data("calcHeight",s),e(this).hasClass("is-drilldown-submenu")||(t.height=s))}),this.options.autoHeight||(t["min-height"]=n+"px"),t["max-width"]=this.$element[0].getBoundingClientRect().width+"px",t}},{key:"destroy",value:function(){this.options.scrollTop&&this.$element.off(".zf.drilldown",this._bindHandler),this._hideAll(),this.$element.off("mutateme.zf.trigger"),Foundation.Nest.Burn(this.$element,"drilldown"),this.$element.unwrap().find(".js-drilldown-back, .is-submenu-parent-item").remove().end().find(".is-active, .is-closing, .is-drilldown-submenu").removeClass("is-active is-closing is-drilldown-submenu").end().find("[data-submenu]").removeAttr("aria-hidden tabindex role"),this.$submenuAnchors.each(function(){e(this).off(".zf.drilldown")}),this.$submenus.removeClass("drilldown-submenu-cover-previous"),this.$element.find("a").each(function(){var n=e(this);n.removeAttr("tabindex"),n.data("savedHref")&&n.attr("href",n.data("savedHref")).removeData("savedHref")}),Foundation.unregisterPlugin(this)}}]),n}();n.defaults={backButton:'<li class="js-drilldown-back"><a tabindex="0">Back</a></li>',backButtonPosition:"top",wrapper:"<div></div>",parentLink:!1,closeOnClick:!1,autoHeight:!1,animateHeight:!1,scrollTop:!1,scrollTopElement:"",scrollTopOffset:0,animationDuration:500,animationEasing:"swing"},Foundation.plugin(n,"Drilldown")}(jQuery);
|
|
@@ -0,0 +1,465 @@
|
|
|
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
|
+
* Dropdown module.
|
|
11
|
+
* @module foundation.dropdown
|
|
12
|
+
* @requires foundation.util.keyboard
|
|
13
|
+
* @requires foundation.util.box
|
|
14
|
+
* @requires foundation.util.triggers
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var Dropdown = function () {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of a dropdown.
|
|
20
|
+
* @class
|
|
21
|
+
* @param {jQuery} element - jQuery object to make into a dropdown.
|
|
22
|
+
* Object should be of the dropdown panel, rather than its anchor.
|
|
23
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
|
24
|
+
*/
|
|
25
|
+
function Dropdown(element, options) {
|
|
26
|
+
_classCallCheck(this, Dropdown);
|
|
27
|
+
|
|
28
|
+
this.$element = element;
|
|
29
|
+
this.options = $.extend({}, Dropdown.defaults, this.$element.data(), options);
|
|
30
|
+
this._init();
|
|
31
|
+
|
|
32
|
+
Foundation.registerPlugin(this, 'Dropdown');
|
|
33
|
+
Foundation.Keyboard.register('Dropdown', {
|
|
34
|
+
'ENTER': 'open',
|
|
35
|
+
'SPACE': 'open',
|
|
36
|
+
'ESCAPE': 'close'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor.
|
|
42
|
+
* @function
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
_createClass(Dropdown, [{
|
|
48
|
+
key: '_init',
|
|
49
|
+
value: function _init() {
|
|
50
|
+
var $id = this.$element.attr('id');
|
|
51
|
+
|
|
52
|
+
this.$anchor = $('[data-toggle="' + $id + '"]').length ? $('[data-toggle="' + $id + '"]') : $('[data-open="' + $id + '"]');
|
|
53
|
+
this.$anchor.attr({
|
|
54
|
+
'aria-controls': $id,
|
|
55
|
+
'data-is-focus': false,
|
|
56
|
+
'data-yeti-box': $id,
|
|
57
|
+
'aria-haspopup': true,
|
|
58
|
+
'aria-expanded': false
|
|
59
|
+
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (this.options.parentClass) {
|
|
63
|
+
this.$parent = this.$element.parents('.' + this.options.parentClass);
|
|
64
|
+
} else {
|
|
65
|
+
this.$parent = null;
|
|
66
|
+
}
|
|
67
|
+
this.options.positionClass = this.getPositionClass();
|
|
68
|
+
this.counter = 4;
|
|
69
|
+
this.usedPositions = [];
|
|
70
|
+
this.$element.attr({
|
|
71
|
+
'aria-hidden': 'true',
|
|
72
|
+
'data-yeti-box': $id,
|
|
73
|
+
'data-resize': $id,
|
|
74
|
+
'aria-labelledby': this.$anchor[0].id || Foundation.GetYoDigits(6, 'dd-anchor')
|
|
75
|
+
});
|
|
76
|
+
this._events();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to determine current orientation of dropdown pane.
|
|
81
|
+
* @function
|
|
82
|
+
* @returns {String} position - string value of a position class.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
}, {
|
|
86
|
+
key: 'getPositionClass',
|
|
87
|
+
value: function getPositionClass() {
|
|
88
|
+
var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g);
|
|
89
|
+
verticalPosition = verticalPosition ? verticalPosition[0] : '';
|
|
90
|
+
var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className);
|
|
91
|
+
horizontalPosition = horizontalPosition ? horizontalPosition[1] : '';
|
|
92
|
+
var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition;
|
|
93
|
+
|
|
94
|
+
return position;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Adjusts the dropdown panes orientation by adding/removing positioning classes.
|
|
99
|
+
* @function
|
|
100
|
+
* @private
|
|
101
|
+
* @param {String} position - position class to remove.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
}, {
|
|
105
|
+
key: '_reposition',
|
|
106
|
+
value: function _reposition(position) {
|
|
107
|
+
this.usedPositions.push(position ? position : 'bottom');
|
|
108
|
+
//default, try switching to opposite side
|
|
109
|
+
if (!position && this.usedPositions.indexOf('top') < 0) {
|
|
110
|
+
this.$element.addClass('top');
|
|
111
|
+
} else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) {
|
|
112
|
+
this.$element.removeClass(position);
|
|
113
|
+
} else if (position === 'left' && this.usedPositions.indexOf('right') < 0) {
|
|
114
|
+
this.$element.removeClass(position).addClass('right');
|
|
115
|
+
} else if (position === 'right' && this.usedPositions.indexOf('left') < 0) {
|
|
116
|
+
this.$element.removeClass(position).addClass('left');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//if default change didn't work, try bottom or left first
|
|
120
|
+
else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) {
|
|
121
|
+
this.$element.addClass('left');
|
|
122
|
+
} else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) {
|
|
123
|
+
this.$element.removeClass(position).addClass('left');
|
|
124
|
+
} else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) {
|
|
125
|
+
this.$element.removeClass(position);
|
|
126
|
+
} else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) {
|
|
127
|
+
this.$element.removeClass(position);
|
|
128
|
+
}
|
|
129
|
+
//if nothing cleared, set to bottom
|
|
130
|
+
else {
|
|
131
|
+
this.$element.removeClass(position);
|
|
132
|
+
}
|
|
133
|
+
this.classChanged = true;
|
|
134
|
+
this.counter--;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Sets the position and orientation of the dropdown pane, checks for collisions.
|
|
139
|
+
* Recursively calls itself if a collision is detected, with a new position class.
|
|
140
|
+
* @function
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
}, {
|
|
145
|
+
key: '_setPosition',
|
|
146
|
+
value: function _setPosition() {
|
|
147
|
+
if (this.$anchor.attr('aria-expanded') === 'false') {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
var position = this.getPositionClass(),
|
|
151
|
+
$eleDims = Foundation.Box.GetDimensions(this.$element),
|
|
152
|
+
$anchorDims = Foundation.Box.GetDimensions(this.$anchor),
|
|
153
|
+
_this = this,
|
|
154
|
+
direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top',
|
|
155
|
+
param = direction === 'top' ? 'height' : 'width',
|
|
156
|
+
offset = param === 'height' ? this.options.vOffset : this.options.hOffset;
|
|
157
|
+
|
|
158
|
+
if ($eleDims.width >= $eleDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.$element, this.$parent)) {
|
|
159
|
+
var newWidth = $eleDims.windowDims.width,
|
|
160
|
+
parentHOffset = 0;
|
|
161
|
+
if (this.$parent) {
|
|
162
|
+
var $parentDims = Foundation.Box.GetDimensions(this.$parent),
|
|
163
|
+
parentHOffset = $parentDims.offset.left;
|
|
164
|
+
if ($parentDims.width < newWidth) {
|
|
165
|
+
newWidth = $parentDims.width;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset + parentHOffset, true)).css({
|
|
170
|
+
'width': newWidth - this.options.hOffset * 2,
|
|
171
|
+
'height': 'auto'
|
|
172
|
+
});
|
|
173
|
+
this.classChanged = true;
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset));
|
|
178
|
+
|
|
179
|
+
while (!Foundation.Box.ImNotTouchingYou(this.$element, this.$parent, true) && this.counter) {
|
|
180
|
+
this._reposition(position);
|
|
181
|
+
this._setPosition();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Adds event listeners to the element utilizing the triggers utility library.
|
|
187
|
+
* @function
|
|
188
|
+
* @private
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
}, {
|
|
192
|
+
key: '_events',
|
|
193
|
+
value: function _events() {
|
|
194
|
+
var _this = this;
|
|
195
|
+
this.$element.on({
|
|
196
|
+
'open.zf.trigger': this.open.bind(this),
|
|
197
|
+
'close.zf.trigger': this.close.bind(this),
|
|
198
|
+
'toggle.zf.trigger': this.toggle.bind(this),
|
|
199
|
+
'resizeme.zf.trigger': this._setPosition.bind(this)
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
if (this.options.hover) {
|
|
203
|
+
this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () {
|
|
204
|
+
var bodyData = $('body').data();
|
|
205
|
+
if (typeof bodyData.whatinput === 'undefined' || bodyData.whatinput === 'mouse') {
|
|
206
|
+
clearTimeout(_this.timeout);
|
|
207
|
+
_this.timeout = setTimeout(function () {
|
|
208
|
+
_this.open();
|
|
209
|
+
_this.$anchor.data('hover', true);
|
|
210
|
+
}, _this.options.hoverDelay);
|
|
211
|
+
}
|
|
212
|
+
}).on('mouseleave.zf.dropdown', function () {
|
|
213
|
+
clearTimeout(_this.timeout);
|
|
214
|
+
_this.timeout = setTimeout(function () {
|
|
215
|
+
_this.close();
|
|
216
|
+
_this.$anchor.data('hover', false);
|
|
217
|
+
}, _this.options.hoverDelay);
|
|
218
|
+
});
|
|
219
|
+
if (this.options.hoverPane) {
|
|
220
|
+
this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () {
|
|
221
|
+
clearTimeout(_this.timeout);
|
|
222
|
+
}).on('mouseleave.zf.dropdown', function () {
|
|
223
|
+
clearTimeout(_this.timeout);
|
|
224
|
+
_this.timeout = setTimeout(function () {
|
|
225
|
+
_this.close();
|
|
226
|
+
_this.$anchor.data('hover', false);
|
|
227
|
+
}, _this.options.hoverDelay);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
this.$anchor.add(this.$element).on('keydown.zf.dropdown', function (e) {
|
|
232
|
+
|
|
233
|
+
var $target = $(this),
|
|
234
|
+
visibleFocusableElements = Foundation.Keyboard.findFocusable(_this.$element);
|
|
235
|
+
|
|
236
|
+
Foundation.Keyboard.handleKey(e, 'Dropdown', {
|
|
237
|
+
open: function () {
|
|
238
|
+
if ($target.is(_this.$anchor)) {
|
|
239
|
+
_this.open();
|
|
240
|
+
_this.$element.attr('tabindex', -1).focus();
|
|
241
|
+
e.preventDefault();
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
close: function () {
|
|
245
|
+
_this.close();
|
|
246
|
+
_this.$anchor.focus();
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Adds an event handler to the body to close any dropdowns on a click.
|
|
254
|
+
* @function
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
}, {
|
|
259
|
+
key: '_addBodyHandler',
|
|
260
|
+
value: function _addBodyHandler() {
|
|
261
|
+
var $body = $(document.body).not(this.$element),
|
|
262
|
+
_this = this;
|
|
263
|
+
$body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) {
|
|
264
|
+
if (_this.$anchor.is(e.target) || _this.$anchor.find(e.target).length) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (_this.$element.find(e.target).length) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
_this.close();
|
|
271
|
+
$body.off('click.zf.dropdown');
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Opens the dropdown pane, and fires a bubbling event to close other dropdowns.
|
|
277
|
+
* @function
|
|
278
|
+
* @fires Dropdown#closeme
|
|
279
|
+
* @fires Dropdown#show
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
}, {
|
|
283
|
+
key: 'open',
|
|
284
|
+
value: function open() {
|
|
285
|
+
// var _this = this;
|
|
286
|
+
/**
|
|
287
|
+
* Fires to close other open dropdowns, typically when dropdown is opening
|
|
288
|
+
* @event Dropdown#closeme
|
|
289
|
+
*/
|
|
290
|
+
this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id'));
|
|
291
|
+
this.$anchor.addClass('hover').attr({ 'aria-expanded': true });
|
|
292
|
+
// this.$element/*.show()*/;
|
|
293
|
+
this._setPosition();
|
|
294
|
+
this.$element.addClass('is-open').attr({ 'aria-hidden': false });
|
|
295
|
+
|
|
296
|
+
if (this.options.autoFocus) {
|
|
297
|
+
var $focusable = Foundation.Keyboard.findFocusable(this.$element);
|
|
298
|
+
if ($focusable.length) {
|
|
299
|
+
$focusable.eq(0).focus();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (this.options.closeOnClick) {
|
|
304
|
+
this._addBodyHandler();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (this.options.trapFocus) {
|
|
308
|
+
Foundation.Keyboard.trapFocus(this.$element);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Fires once the dropdown is visible.
|
|
313
|
+
* @event Dropdown#show
|
|
314
|
+
*/
|
|
315
|
+
this.$element.trigger('show.zf.dropdown', [this.$element]);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Closes the open dropdown pane.
|
|
320
|
+
* @function
|
|
321
|
+
* @fires Dropdown#hide
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
}, {
|
|
325
|
+
key: 'close',
|
|
326
|
+
value: function close() {
|
|
327
|
+
if (!this.$element.hasClass('is-open')) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
this.$element.removeClass('is-open').attr({ 'aria-hidden': true });
|
|
331
|
+
|
|
332
|
+
this.$anchor.removeClass('hover').attr('aria-expanded', false);
|
|
333
|
+
|
|
334
|
+
if (this.classChanged) {
|
|
335
|
+
var curPositionClass = this.getPositionClass();
|
|
336
|
+
if (curPositionClass) {
|
|
337
|
+
this.$element.removeClass(curPositionClass);
|
|
338
|
+
}
|
|
339
|
+
this.$element.addClass(this.options.positionClass)
|
|
340
|
+
/*.hide()*/.css({ height: '', width: '' });
|
|
341
|
+
this.classChanged = false;
|
|
342
|
+
this.counter = 4;
|
|
343
|
+
this.usedPositions.length = 0;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Fires once the dropdown is no longer visible.
|
|
347
|
+
* @event Dropdown#hide
|
|
348
|
+
*/
|
|
349
|
+
this.$element.trigger('hide.zf.dropdown', [this.$element]);
|
|
350
|
+
|
|
351
|
+
if (this.options.trapFocus) {
|
|
352
|
+
Foundation.Keyboard.releaseFocus(this.$element);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Toggles the dropdown pane's visibility.
|
|
358
|
+
* @function
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
}, {
|
|
362
|
+
key: 'toggle',
|
|
363
|
+
value: function toggle() {
|
|
364
|
+
if (this.$element.hasClass('is-open')) {
|
|
365
|
+
if (this.$anchor.data('hover')) return;
|
|
366
|
+
this.close();
|
|
367
|
+
} else {
|
|
368
|
+
this.open();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Destroys the dropdown.
|
|
374
|
+
* @function
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
}, {
|
|
378
|
+
key: 'destroy',
|
|
379
|
+
value: function destroy() {
|
|
380
|
+
this.$element.off('.zf.trigger').hide();
|
|
381
|
+
this.$anchor.off('.zf.dropdown');
|
|
382
|
+
|
|
383
|
+
Foundation.unregisterPlugin(this);
|
|
384
|
+
}
|
|
385
|
+
}]);
|
|
386
|
+
|
|
387
|
+
return Dropdown;
|
|
388
|
+
}();
|
|
389
|
+
|
|
390
|
+
Dropdown.defaults = {
|
|
391
|
+
/**
|
|
392
|
+
* Class that designates bounding container of Dropdown (default: window)
|
|
393
|
+
* @option
|
|
394
|
+
* @type {?string}
|
|
395
|
+
* @default null
|
|
396
|
+
*/
|
|
397
|
+
parentClass: null,
|
|
398
|
+
/**
|
|
399
|
+
* Amount of time to delay opening a submenu on hover event.
|
|
400
|
+
* @option
|
|
401
|
+
* @type {number}
|
|
402
|
+
* @default 250
|
|
403
|
+
*/
|
|
404
|
+
hoverDelay: 250,
|
|
405
|
+
/**
|
|
406
|
+
* Allow submenus to open on hover events
|
|
407
|
+
* @option
|
|
408
|
+
* @type {boolean}
|
|
409
|
+
* @default false
|
|
410
|
+
*/
|
|
411
|
+
hover: false,
|
|
412
|
+
/**
|
|
413
|
+
* Don't close dropdown when hovering over dropdown pane
|
|
414
|
+
* @option
|
|
415
|
+
* @type {boolean}
|
|
416
|
+
* @default false
|
|
417
|
+
*/
|
|
418
|
+
hoverPane: false,
|
|
419
|
+
/**
|
|
420
|
+
* Number of pixels between the dropdown pane and the triggering element on open.
|
|
421
|
+
* @option
|
|
422
|
+
* @type {number}
|
|
423
|
+
* @default 1
|
|
424
|
+
*/
|
|
425
|
+
vOffset: 1,
|
|
426
|
+
/**
|
|
427
|
+
* Number of pixels between the dropdown pane and the triggering element on open.
|
|
428
|
+
* @option
|
|
429
|
+
* @type {number}
|
|
430
|
+
* @default 1
|
|
431
|
+
*/
|
|
432
|
+
hOffset: 1,
|
|
433
|
+
/**
|
|
434
|
+
* Class applied to adjust open position. JS will test and fill this in.
|
|
435
|
+
* @option
|
|
436
|
+
* @type {string}
|
|
437
|
+
* @default ''
|
|
438
|
+
*/
|
|
439
|
+
positionClass: '',
|
|
440
|
+
/**
|
|
441
|
+
* Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands.
|
|
442
|
+
* @option
|
|
443
|
+
* @type {boolean}
|
|
444
|
+
* @default false
|
|
445
|
+
*/
|
|
446
|
+
trapFocus: false,
|
|
447
|
+
/**
|
|
448
|
+
* Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening.
|
|
449
|
+
* @option
|
|
450
|
+
* @type {boolean}
|
|
451
|
+
* @default false
|
|
452
|
+
*/
|
|
453
|
+
autoFocus: false,
|
|
454
|
+
/**
|
|
455
|
+
* Allows a click on the body to close the dropdown.
|
|
456
|
+
* @option
|
|
457
|
+
* @type {boolean}
|
|
458
|
+
* @default false
|
|
459
|
+
*/
|
|
460
|
+
closeOnClick: false
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
// Window exports
|
|
464
|
+
Foundation.plugin(Dropdown, 'Dropdown');
|
|
465
|
+
}(jQuery);
|