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(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 i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}();!function(t){var e=function(){function e(i,n){_classCallCheck(this,e),this.$element=i,this.options=t.extend({},e.defaults,this.$element.data(),n),this._init(),Foundation.registerPlugin(this,"Tabs"),Foundation.Keyboard.register("Tabs",{ENTER:"open",SPACE:"open",ARROW_RIGHT:"next",ARROW_UP:"previous",ARROW_DOWN:"next",ARROW_LEFT:"previous"})}return _createClass(e,[{key:"_init",value:function(){var e=this,i=this;if(this.$element.attr({role:"tablist"}),this.$tabTitles=this.$element.find("."+this.options.linkClass),this.$tabContent=t('[data-tabs-content="'+this.$element[0].id+'"]'),this.$tabTitles.each(function(){var e=t(this),n=e.find("a"),a=e.hasClass(""+i.options.linkActiveClass),s=n[0].hash.slice(1),o=n[0].id?n[0].id:s+"-label",l=t("#"+s);e.attr({role:"presentation"}),n.attr({role:"tab","aria-controls":s,"aria-selected":a,id:o}),l.attr({role:"tabpanel","aria-hidden":!a,"aria-labelledby":o}),a&&i.options.autoFocus&&t(window).load(function(){t("html, body").animate({scrollTop:e.offset().top},i.options.deepLinkSmudgeDelay,function(){n.focus()})})}),this.options.matchHeight){var n=this.$tabContent.find("img");n.length?Foundation.onImagesLoaded(n,this._setHeight.bind(this)):this._setHeight()}this._checkDeepLink=function(){var i=window.location.hash;if(i.length){var n=e.$element.find('[href="'+i+'"]');if(n.length){if(e.selectTab(t(i),!0),e.options.deepLinkSmudge){var a=e.$element.offset();t("html, body").animate({scrollTop:a.top},e.options.deepLinkSmudgeDelay)}e.$element.trigger("deeplink.zf.tabs",[n,t(i)])}}},this.options.deepLink&&this._checkDeepLink(),this._events()}},{key:"_events",value:function(){this._addKeyHandler(),this._addClickHandler(),this._setHeightMqHandler=null,this.options.matchHeight&&(this._setHeightMqHandler=this._setHeight.bind(this),t(window).on("changed.zf.mediaquery",this._setHeightMqHandler)),this.options.deepLink&&t(window).on("popstate",this._checkDeepLink)}},{key:"_addClickHandler",value:function(){var e=this;this.$element.off("click.zf.tabs").on("click.zf.tabs","."+this.options.linkClass,function(i){i.preventDefault(),i.stopPropagation(),e._handleTabChange(t(this))})}},{key:"_addKeyHandler",value:function(){var e=this;this.$tabTitles.off("keydown.zf.tabs").on("keydown.zf.tabs",function(i){if(9!==i.which){var n,a,s=t(this),o=s.parent("ul").children("li");o.each(function(i){if(t(this).is(s))return void(e.options.wrapOnKeys?(n=0===i?o.last():o.eq(i-1),a=i===o.length-1?o.first():o.eq(i+1)):(n=o.eq(Math.max(0,i-1)),a=o.eq(Math.min(i+1,o.length-1))))}),Foundation.Keyboard.handleKey(i,"Tabs",{open:function(){s.find('[role="tab"]').focus(),e._handleTabChange(s)},previous:function(){n.find('[role="tab"]').focus(),e._handleTabChange(n)},next:function(){a.find('[role="tab"]').focus(),e._handleTabChange(a)},handled:function(){i.stopPropagation(),i.preventDefault()}})}})}},{key:"_handleTabChange",value:function(t,e){if(t.hasClass(""+this.options.linkActiveClass))return void(this.options.activeCollapse&&(this._collapseTab(t),this.$element.trigger("collapse.zf.tabs",[t])));var i=this.$element.find("."+this.options.linkClass+"."+this.options.linkActiveClass),n=t.find('[role="tab"]'),a=n[0].hash,s=this.$tabContent.find(a);if(this._collapseTab(i),this._openTab(t),this.options.deepLink&&!e){var o=t.find("a").attr("href");this.options.updateHistory?history.pushState({},"",o):history.replaceState({},"",o)}this.$element.trigger("change.zf.tabs",[t,s]),s.find("[data-mutate]").trigger("mutateme.zf.trigger")}},{key:"_openTab",value:function(t){var e=t.find('[role="tab"]'),i=e[0].hash,n=this.$tabContent.find(i);t.addClass(""+this.options.linkActiveClass),e.attr({"aria-selected":"true"}),n.addClass(""+this.options.panelActiveClass).attr({"aria-hidden":"false"})}},{key:"_collapseTab",value:function(e){var i=e.removeClass(""+this.options.linkActiveClass).find('[role="tab"]').attr({"aria-selected":"false"});t("#"+i.attr("aria-controls")).removeClass(""+this.options.panelActiveClass).attr({"aria-hidden":"true"})}},{key:"selectTab",value:function(t,e){var i;i="object"==typeof t?t[0].id:t,i.indexOf("#")<0&&(i="#"+i);var n=this.$tabTitles.find('[href="'+i+'"]').parent("."+this.options.linkClass);this._handleTabChange(n,e)}},{key:"_setHeight",value:function(){var e=0,i=this;this.$tabContent.find("."+this.options.panelClass).css("height","").each(function(){var n=t(this),a=n.hasClass(""+i.options.panelActiveClass);a||n.css({visibility:"hidden",display:"block"});var s=this.getBoundingClientRect().height;a||n.css({visibility:"",display:""}),e=s>e?s:e}).css("height",e+"px")}},{key:"destroy",value:function(){this.$element.find("."+this.options.linkClass).off(".zf.tabs").hide().end().find("."+this.options.panelClass).hide(),this.options.matchHeight&&null!=this._setHeightMqHandler&&t(window).off("changed.zf.mediaquery",this._setHeightMqHandler),this.options.deepLink&&t(window).off("popstate",this._checkDeepLink),Foundation.unregisterPlugin(this)}}]),e}();e.defaults={deepLink:!1,deepLinkSmudge:!1,deepLinkSmudgeDelay:300,updateHistory:!1,autoFocus:!1,wrapOnKeys:!0,matchHeight:!1,activeCollapse:!1,linkClass:"tabs-title",linkActiveClass:"is-active",panelClass:"tabs-panel",panelActiveClass:"is-active"},Foundation.plugin(e,"Tabs")}(jQuery);
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
* Toggler module.
|
|
11
|
+
* @module foundation.toggler
|
|
12
|
+
* @requires foundation.util.motion
|
|
13
|
+
* @requires foundation.util.triggers
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var Toggler = function () {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of Toggler.
|
|
19
|
+
* @class
|
|
20
|
+
* @fires Toggler#init
|
|
21
|
+
* @param {Object} element - jQuery object to add the trigger to.
|
|
22
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
|
23
|
+
*/
|
|
24
|
+
function Toggler(element, options) {
|
|
25
|
+
_classCallCheck(this, Toggler);
|
|
26
|
+
|
|
27
|
+
this.$element = element;
|
|
28
|
+
this.options = $.extend({}, Toggler.defaults, element.data(), options);
|
|
29
|
+
this.className = '';
|
|
30
|
+
|
|
31
|
+
this._init();
|
|
32
|
+
this._events();
|
|
33
|
+
|
|
34
|
+
Foundation.registerPlugin(this, 'Toggler');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate.
|
|
39
|
+
* @function
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
_createClass(Toggler, [{
|
|
45
|
+
key: '_init',
|
|
46
|
+
value: function _init() {
|
|
47
|
+
var input;
|
|
48
|
+
// Parse animation classes if they were set
|
|
49
|
+
if (this.options.animate) {
|
|
50
|
+
input = this.options.animate.split(' ');
|
|
51
|
+
|
|
52
|
+
this.animationIn = input[0];
|
|
53
|
+
this.animationOut = input[1] || null;
|
|
54
|
+
}
|
|
55
|
+
// Otherwise, parse toggle class
|
|
56
|
+
else {
|
|
57
|
+
input = this.$element.data('toggler');
|
|
58
|
+
// Allow for a . at the beginning of the string
|
|
59
|
+
this.className = input[0] === '.' ? input.slice(1) : input;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Add ARIA attributes to triggers
|
|
63
|
+
var id = this.$element[0].id;
|
|
64
|
+
$('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id);
|
|
65
|
+
// If the target is hidden, add aria-hidden
|
|
66
|
+
this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Initializes events for the toggle trigger.
|
|
71
|
+
* @function
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
}, {
|
|
76
|
+
key: '_events',
|
|
77
|
+
value: function _events() {
|
|
78
|
+
this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off".
|
|
83
|
+
* @function
|
|
84
|
+
* @fires Toggler#on
|
|
85
|
+
* @fires Toggler#off
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
}, {
|
|
89
|
+
key: 'toggle',
|
|
90
|
+
value: function toggle() {
|
|
91
|
+
this[this.options.animate ? '_toggleAnimate' : '_toggleClass']();
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: '_toggleClass',
|
|
95
|
+
value: function _toggleClass() {
|
|
96
|
+
this.$element.toggleClass(this.className);
|
|
97
|
+
|
|
98
|
+
var isOn = this.$element.hasClass(this.className);
|
|
99
|
+
if (isOn) {
|
|
100
|
+
/**
|
|
101
|
+
* Fires if the target element has the class after a toggle.
|
|
102
|
+
* @event Toggler#on
|
|
103
|
+
*/
|
|
104
|
+
this.$element.trigger('on.zf.toggler');
|
|
105
|
+
} else {
|
|
106
|
+
/**
|
|
107
|
+
* Fires if the target element does not have the class after a toggle.
|
|
108
|
+
* @event Toggler#off
|
|
109
|
+
*/
|
|
110
|
+
this.$element.trigger('off.zf.toggler');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this._updateARIA(isOn);
|
|
114
|
+
this.$element.find('[data-mutate]').trigger('mutateme.zf.trigger');
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: '_toggleAnimate',
|
|
118
|
+
value: function _toggleAnimate() {
|
|
119
|
+
var _this = this;
|
|
120
|
+
|
|
121
|
+
if (this.$element.is(':hidden')) {
|
|
122
|
+
Foundation.Motion.animateIn(this.$element, this.animationIn, function () {
|
|
123
|
+
_this._updateARIA(true);
|
|
124
|
+
this.trigger('on.zf.toggler');
|
|
125
|
+
this.find('[data-mutate]').trigger('mutateme.zf.trigger');
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
Foundation.Motion.animateOut(this.$element, this.animationOut, function () {
|
|
129
|
+
_this._updateARIA(false);
|
|
130
|
+
this.trigger('off.zf.toggler');
|
|
131
|
+
this.find('[data-mutate]').trigger('mutateme.zf.trigger');
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: '_updateARIA',
|
|
137
|
+
value: function _updateARIA(isOn) {
|
|
138
|
+
this.$element.attr('aria-expanded', isOn ? true : false);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Destroys the instance of Toggler on the element.
|
|
143
|
+
* @function
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
}, {
|
|
147
|
+
key: 'destroy',
|
|
148
|
+
value: function destroy() {
|
|
149
|
+
this.$element.off('.zf.toggler');
|
|
150
|
+
Foundation.unregisterPlugin(this);
|
|
151
|
+
}
|
|
152
|
+
}]);
|
|
153
|
+
|
|
154
|
+
return Toggler;
|
|
155
|
+
}();
|
|
156
|
+
|
|
157
|
+
Toggler.defaults = {
|
|
158
|
+
/**
|
|
159
|
+
* Tells the plugin if the element should animated when toggled.
|
|
160
|
+
* @option
|
|
161
|
+
* @type {boolean}
|
|
162
|
+
* @default false
|
|
163
|
+
*/
|
|
164
|
+
animate: false
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Window exports
|
|
168
|
+
Foundation.plugin(Toggler, 'Toggler');
|
|
169
|
+
}(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 i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}();!function(t){var e=function(){function e(i,n){_classCallCheck(this,e),this.$element=i,this.options=t.extend({},e.defaults,i.data(),n),this.className="",this._init(),this._events(),Foundation.registerPlugin(this,"Toggler")}return _createClass(e,[{key:"_init",value:function(){var e;this.options.animate?(e=this.options.animate.split(" "),this.animationIn=e[0],this.animationOut=e[1]||null):(e=this.$element.data("toggler"),this.className="."===e[0]?e.slice(1):e);var i=this.$element[0].id;t('[data-open="'+i+'"], [data-close="'+i+'"], [data-toggle="'+i+'"]').attr("aria-controls",i),this.$element.attr("aria-expanded",!this.$element.is(":hidden"))}},{key:"_events",value:function(){this.$element.off("toggle.zf.trigger").on("toggle.zf.trigger",this.toggle.bind(this))}},{key:"toggle",value:function(){this[this.options.animate?"_toggleAnimate":"_toggleClass"]()}},{key:"_toggleClass",value:function(){this.$element.toggleClass(this.className);var t=this.$element.hasClass(this.className);t?this.$element.trigger("on.zf.toggler"):this.$element.trigger("off.zf.toggler"),this._updateARIA(t),this.$element.find("[data-mutate]").trigger("mutateme.zf.trigger")}},{key:"_toggleAnimate",value:function(){var t=this;this.$element.is(":hidden")?Foundation.Motion.animateIn(this.$element,this.animationIn,function(){t._updateARIA(!0),this.trigger("on.zf.toggler"),this.find("[data-mutate]").trigger("mutateme.zf.trigger")}):Foundation.Motion.animateOut(this.$element,this.animationOut,function(){t._updateARIA(!1),this.trigger("off.zf.toggler"),this.find("[data-mutate]").trigger("mutateme.zf.trigger")})}},{key:"_updateARIA",value:function(t){this.$element.attr("aria-expanded",!!t)}},{key:"destroy",value:function(){this.$element.off(".zf.toggler"),Foundation.unregisterPlugin(this)}}]),e}();e.defaults={animate:!1},Foundation.plugin(e,"Toggler")}(jQuery);
|
|
@@ -0,0 +1,492 @@
|
|
|
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
|
+
* Tooltip module.
|
|
11
|
+
* @module foundation.tooltip
|
|
12
|
+
* @requires foundation.util.box
|
|
13
|
+
* @requires foundation.util.mediaQuery
|
|
14
|
+
* @requires foundation.util.triggers
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var Tooltip = function () {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of a Tooltip.
|
|
20
|
+
* @class
|
|
21
|
+
* @fires Tooltip#init
|
|
22
|
+
* @param {jQuery} element - jQuery object to attach a tooltip to.
|
|
23
|
+
* @param {Object} options - object to extend the default configuration.
|
|
24
|
+
*/
|
|
25
|
+
function Tooltip(element, options) {
|
|
26
|
+
_classCallCheck(this, Tooltip);
|
|
27
|
+
|
|
28
|
+
this.$element = element;
|
|
29
|
+
this.options = $.extend({}, Tooltip.defaults, this.$element.data(), options);
|
|
30
|
+
|
|
31
|
+
this.isActive = false;
|
|
32
|
+
this.isClick = false;
|
|
33
|
+
this._init();
|
|
34
|
+
|
|
35
|
+
Foundation.registerPlugin(this, 'Tooltip');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor.
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
_createClass(Tooltip, [{
|
|
45
|
+
key: '_init',
|
|
46
|
+
value: function _init() {
|
|
47
|
+
var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip');
|
|
48
|
+
|
|
49
|
+
this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element);
|
|
50
|
+
this.options.tipText = this.options.tipText || this.$element.attr('title');
|
|
51
|
+
this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId);
|
|
52
|
+
|
|
53
|
+
if (this.options.allowHtml) {
|
|
54
|
+
this.template.appendTo(document.body).html(this.options.tipText).hide();
|
|
55
|
+
} else {
|
|
56
|
+
this.template.appendTo(document.body).text(this.options.tipText).hide();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.$element.attr({
|
|
60
|
+
'title': '',
|
|
61
|
+
'aria-describedby': elemId,
|
|
62
|
+
'data-yeti-box': elemId,
|
|
63
|
+
'data-toggle': elemId,
|
|
64
|
+
'data-resize': elemId
|
|
65
|
+
}).addClass(this.options.triggerClass);
|
|
66
|
+
|
|
67
|
+
//helper variables to track movement on collisions
|
|
68
|
+
this.usedPositions = [];
|
|
69
|
+
this.counter = 4;
|
|
70
|
+
this.classChanged = false;
|
|
71
|
+
|
|
72
|
+
this._events();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Grabs the current positioning class, if present, and returns the value or an empty string.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
}, {
|
|
81
|
+
key: '_getPositionClass',
|
|
82
|
+
value: function _getPositionClass(element) {
|
|
83
|
+
if (!element) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
// var position = element.attr('class').match(/top|left|right/g);
|
|
87
|
+
var position = element[0].className.match(/\b(top|left|right)\b/g);
|
|
88
|
+
position = position ? position[0] : '';
|
|
89
|
+
return position;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: '_buildTemplate',
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* builds the tooltip element, adds attributes, and returns the template.
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
value: function _buildTemplate(id) {
|
|
99
|
+
var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim();
|
|
100
|
+
var $template = $('<div></div>').addClass(templateClasses).attr({
|
|
101
|
+
'role': 'tooltip',
|
|
102
|
+
'aria-hidden': true,
|
|
103
|
+
'data-is-active': false,
|
|
104
|
+
'data-is-focus': false,
|
|
105
|
+
'id': id
|
|
106
|
+
});
|
|
107
|
+
return $template;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Function that gets called if a collision event is detected.
|
|
112
|
+
* @param {String} position - positioning class to try
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
}, {
|
|
117
|
+
key: '_reposition',
|
|
118
|
+
value: function _reposition(position) {
|
|
119
|
+
this.usedPositions.push(position ? position : 'bottom');
|
|
120
|
+
|
|
121
|
+
//default, try switching to opposite side
|
|
122
|
+
if (!position && this.usedPositions.indexOf('top') < 0) {
|
|
123
|
+
this.template.addClass('top');
|
|
124
|
+
} else if (position === 'top' && this.usedPositions.indexOf('bottom') < 0) {
|
|
125
|
+
this.template.removeClass(position);
|
|
126
|
+
} else if (position === 'left' && this.usedPositions.indexOf('right') < 0) {
|
|
127
|
+
this.template.removeClass(position).addClass('right');
|
|
128
|
+
} else if (position === 'right' && this.usedPositions.indexOf('left') < 0) {
|
|
129
|
+
this.template.removeClass(position).addClass('left');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//if default change didn't work, try bottom or left first
|
|
133
|
+
else if (!position && this.usedPositions.indexOf('top') > -1 && this.usedPositions.indexOf('left') < 0) {
|
|
134
|
+
this.template.addClass('left');
|
|
135
|
+
} else if (position === 'top' && this.usedPositions.indexOf('bottom') > -1 && this.usedPositions.indexOf('left') < 0) {
|
|
136
|
+
this.template.removeClass(position).addClass('left');
|
|
137
|
+
} else if (position === 'left' && this.usedPositions.indexOf('right') > -1 && this.usedPositions.indexOf('bottom') < 0) {
|
|
138
|
+
this.template.removeClass(position);
|
|
139
|
+
} else if (position === 'right' && this.usedPositions.indexOf('left') > -1 && this.usedPositions.indexOf('bottom') < 0) {
|
|
140
|
+
this.template.removeClass(position);
|
|
141
|
+
}
|
|
142
|
+
//if nothing cleared, set to bottom
|
|
143
|
+
else {
|
|
144
|
+
this.template.removeClass(position);
|
|
145
|
+
}
|
|
146
|
+
this.classChanged = true;
|
|
147
|
+
this.counter--;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding.
|
|
152
|
+
* if the tooltip is larger than the screen width, default to full width - any user selected margin
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
}, {
|
|
157
|
+
key: '_setPosition',
|
|
158
|
+
value: function _setPosition() {
|
|
159
|
+
var position = this._getPositionClass(this.template),
|
|
160
|
+
$tipDims = Foundation.Box.GetDimensions(this.template),
|
|
161
|
+
$anchorDims = Foundation.Box.GetDimensions(this.$element),
|
|
162
|
+
direction = position === 'left' ? 'left' : position === 'right' ? 'left' : 'top',
|
|
163
|
+
param = direction === 'top' ? 'height' : 'width',
|
|
164
|
+
offset = param === 'height' ? this.options.vOffset : this.options.hOffset,
|
|
165
|
+
_this = this;
|
|
166
|
+
|
|
167
|
+
if ($tipDims.width >= $tipDims.windowDims.width || !this.counter && !Foundation.Box.ImNotTouchingYou(this.template)) {
|
|
168
|
+
this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
|
|
169
|
+
// this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
|
|
170
|
+
'width': $anchorDims.windowDims.width - this.options.hOffset * 2,
|
|
171
|
+
'height': 'auto'
|
|
172
|
+
});
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset));
|
|
177
|
+
|
|
178
|
+
while (!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) {
|
|
179
|
+
this._reposition(position);
|
|
180
|
+
this._setPosition();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* reveals the tooltip, and fires an event to close any other open tooltips on the page
|
|
186
|
+
* @fires Tooltip#closeme
|
|
187
|
+
* @fires Tooltip#show
|
|
188
|
+
* @function
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
}, {
|
|
192
|
+
key: 'show',
|
|
193
|
+
value: function show() {
|
|
194
|
+
if (this.options.showOn !== 'all' && !Foundation.MediaQuery.is(this.options.showOn)) {
|
|
195
|
+
// console.error('The screen is too small to display this tooltip');
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
var _this = this;
|
|
200
|
+
this.template.css('visibility', 'hidden').show();
|
|
201
|
+
this._setPosition();
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Fires to close all other open tooltips on the page
|
|
205
|
+
* @event Closeme#tooltip
|
|
206
|
+
*/
|
|
207
|
+
this.$element.trigger('closeme.zf.tooltip', this.template.attr('id'));
|
|
208
|
+
|
|
209
|
+
this.template.attr({
|
|
210
|
+
'data-is-active': true,
|
|
211
|
+
'aria-hidden': false
|
|
212
|
+
});
|
|
213
|
+
_this.isActive = true;
|
|
214
|
+
// console.log(this.template);
|
|
215
|
+
this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () {
|
|
216
|
+
//maybe do stuff?
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Fires when the tooltip is shown
|
|
220
|
+
* @event Tooltip#show
|
|
221
|
+
*/
|
|
222
|
+
this.$element.trigger('show.zf.tooltip');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Hides the current tooltip, and resets the positioning class if it was changed due to collision
|
|
227
|
+
* @fires Tooltip#hide
|
|
228
|
+
* @function
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
}, {
|
|
232
|
+
key: 'hide',
|
|
233
|
+
value: function hide() {
|
|
234
|
+
// console.log('hiding', this.$element.data('yeti-box'));
|
|
235
|
+
var _this = this;
|
|
236
|
+
this.template.stop().attr({
|
|
237
|
+
'aria-hidden': true,
|
|
238
|
+
'data-is-active': false
|
|
239
|
+
}).fadeOut(this.options.fadeOutDuration, function () {
|
|
240
|
+
_this.isActive = false;
|
|
241
|
+
_this.isClick = false;
|
|
242
|
+
if (_this.classChanged) {
|
|
243
|
+
_this.template.removeClass(_this._getPositionClass(_this.template)).addClass(_this.options.positionClass);
|
|
244
|
+
|
|
245
|
+
_this.usedPositions = [];
|
|
246
|
+
_this.counter = 4;
|
|
247
|
+
_this.classChanged = false;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* fires when the tooltip is hidden
|
|
252
|
+
* @event Tooltip#hide
|
|
253
|
+
*/
|
|
254
|
+
this.$element.trigger('hide.zf.tooltip');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* adds event listeners for the tooltip and its anchor
|
|
259
|
+
* TODO combine some of the listeners like focus and mouseenter, etc.
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
}, {
|
|
264
|
+
key: '_events',
|
|
265
|
+
value: function _events() {
|
|
266
|
+
var _this = this;
|
|
267
|
+
var $template = this.template;
|
|
268
|
+
var isFocus = false;
|
|
269
|
+
|
|
270
|
+
if (!this.options.disableHover) {
|
|
271
|
+
|
|
272
|
+
this.$element.on('mouseenter.zf.tooltip', function (e) {
|
|
273
|
+
if (!_this.isActive) {
|
|
274
|
+
_this.timeout = setTimeout(function () {
|
|
275
|
+
_this.show();
|
|
276
|
+
}, _this.options.hoverDelay);
|
|
277
|
+
}
|
|
278
|
+
}).on('mouseleave.zf.tooltip', function (e) {
|
|
279
|
+
clearTimeout(_this.timeout);
|
|
280
|
+
if (!isFocus || _this.isClick && !_this.options.clickOpen) {
|
|
281
|
+
_this.hide();
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (this.options.clickOpen) {
|
|
287
|
+
this.$element.on('mousedown.zf.tooltip', function (e) {
|
|
288
|
+
e.stopImmediatePropagation();
|
|
289
|
+
if (_this.isClick) {
|
|
290
|
+
//_this.hide();
|
|
291
|
+
// _this.isClick = false;
|
|
292
|
+
} else {
|
|
293
|
+
_this.isClick = true;
|
|
294
|
+
if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) {
|
|
295
|
+
_this.show();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
} else {
|
|
300
|
+
this.$element.on('mousedown.zf.tooltip', function (e) {
|
|
301
|
+
e.stopImmediatePropagation();
|
|
302
|
+
_this.isClick = true;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (!this.options.disableForTouch) {
|
|
307
|
+
this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) {
|
|
308
|
+
_this.isActive ? _this.hide() : _this.show();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this.$element.on({
|
|
313
|
+
// 'toggle.zf.trigger': this.toggle.bind(this),
|
|
314
|
+
// 'close.zf.trigger': this.hide.bind(this)
|
|
315
|
+
'close.zf.trigger': this.hide.bind(this)
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
this.$element.on('focus.zf.tooltip', function (e) {
|
|
319
|
+
isFocus = true;
|
|
320
|
+
if (_this.isClick) {
|
|
321
|
+
// If we're not showing open on clicks, we need to pretend a click-launched focus isn't
|
|
322
|
+
// a real focus, otherwise on hover and come back we get bad behavior
|
|
323
|
+
if (!_this.options.clickOpen) {
|
|
324
|
+
isFocus = false;
|
|
325
|
+
}
|
|
326
|
+
return false;
|
|
327
|
+
} else {
|
|
328
|
+
_this.show();
|
|
329
|
+
}
|
|
330
|
+
}).on('focusout.zf.tooltip', function (e) {
|
|
331
|
+
isFocus = false;
|
|
332
|
+
_this.isClick = false;
|
|
333
|
+
_this.hide();
|
|
334
|
+
}).on('resizeme.zf.trigger', function () {
|
|
335
|
+
if (_this.isActive) {
|
|
336
|
+
_this._setPosition();
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* adds a toggle method, in addition to the static show() & hide() functions
|
|
343
|
+
* @function
|
|
344
|
+
*/
|
|
345
|
+
|
|
346
|
+
}, {
|
|
347
|
+
key: 'toggle',
|
|
348
|
+
value: function toggle() {
|
|
349
|
+
if (this.isActive) {
|
|
350
|
+
this.hide();
|
|
351
|
+
} else {
|
|
352
|
+
this.show();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Destroys an instance of tooltip, removes template element from the view.
|
|
358
|
+
* @function
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
}, {
|
|
362
|
+
key: 'destroy',
|
|
363
|
+
value: function destroy() {
|
|
364
|
+
this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tooltip').removeClass('has-tip top right left').removeAttr('aria-describedby aria-haspopup data-disable-hover data-resize data-toggle data-tooltip data-yeti-box');
|
|
365
|
+
|
|
366
|
+
this.template.remove();
|
|
367
|
+
|
|
368
|
+
Foundation.unregisterPlugin(this);
|
|
369
|
+
}
|
|
370
|
+
}]);
|
|
371
|
+
|
|
372
|
+
return Tooltip;
|
|
373
|
+
}();
|
|
374
|
+
|
|
375
|
+
Tooltip.defaults = {
|
|
376
|
+
disableForTouch: false,
|
|
377
|
+
/**
|
|
378
|
+
* Time, in ms, before a tooltip should open on hover.
|
|
379
|
+
* @option
|
|
380
|
+
* @type {number}
|
|
381
|
+
* @default 200
|
|
382
|
+
*/
|
|
383
|
+
hoverDelay: 200,
|
|
384
|
+
/**
|
|
385
|
+
* Time, in ms, a tooltip should take to fade into view.
|
|
386
|
+
* @option
|
|
387
|
+
* @type {number}
|
|
388
|
+
* @default 150
|
|
389
|
+
*/
|
|
390
|
+
fadeInDuration: 150,
|
|
391
|
+
/**
|
|
392
|
+
* Time, in ms, a tooltip should take to fade out of view.
|
|
393
|
+
* @option
|
|
394
|
+
* @type {number}
|
|
395
|
+
* @default 150
|
|
396
|
+
*/
|
|
397
|
+
fadeOutDuration: 150,
|
|
398
|
+
/**
|
|
399
|
+
* Disables hover events from opening the tooltip if set to true
|
|
400
|
+
* @option
|
|
401
|
+
* @type {boolean}
|
|
402
|
+
* @default false
|
|
403
|
+
*/
|
|
404
|
+
disableHover: false,
|
|
405
|
+
/**
|
|
406
|
+
* Optional addtional classes to apply to the tooltip template on init.
|
|
407
|
+
* @option
|
|
408
|
+
* @type {string}
|
|
409
|
+
* @default ''
|
|
410
|
+
*/
|
|
411
|
+
templateClasses: '',
|
|
412
|
+
/**
|
|
413
|
+
* Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
|
|
414
|
+
* @option
|
|
415
|
+
* @type {string}
|
|
416
|
+
* @default 'tooltip'
|
|
417
|
+
*/
|
|
418
|
+
tooltipClass: 'tooltip',
|
|
419
|
+
/**
|
|
420
|
+
* Class applied to the tooltip anchor element.
|
|
421
|
+
* @option
|
|
422
|
+
* @type {string}
|
|
423
|
+
* @default 'has-tip'
|
|
424
|
+
*/
|
|
425
|
+
triggerClass: 'has-tip',
|
|
426
|
+
/**
|
|
427
|
+
* Minimum breakpoint size at which to open the tooltip.
|
|
428
|
+
* @option
|
|
429
|
+
* @type {string}
|
|
430
|
+
* @default 'small'
|
|
431
|
+
*/
|
|
432
|
+
showOn: 'small',
|
|
433
|
+
/**
|
|
434
|
+
* Custom template to be used to generate markup for tooltip.
|
|
435
|
+
* @option
|
|
436
|
+
* @type {string}
|
|
437
|
+
* @default ''
|
|
438
|
+
*/
|
|
439
|
+
template: '',
|
|
440
|
+
/**
|
|
441
|
+
* Text displayed in the tooltip template on open.
|
|
442
|
+
* @option
|
|
443
|
+
* @type {string}
|
|
444
|
+
* @default ''
|
|
445
|
+
*/
|
|
446
|
+
tipText: '',
|
|
447
|
+
touchCloseText: 'Tap to close.',
|
|
448
|
+
/**
|
|
449
|
+
* Allows the tooltip to remain open if triggered with a click or touch event.
|
|
450
|
+
* @option
|
|
451
|
+
* @type {boolean}
|
|
452
|
+
* @default true
|
|
453
|
+
*/
|
|
454
|
+
clickOpen: true,
|
|
455
|
+
/**
|
|
456
|
+
* Additional positioning classes, set by the JS
|
|
457
|
+
* @option
|
|
458
|
+
* @type {string}
|
|
459
|
+
* @default ''
|
|
460
|
+
*/
|
|
461
|
+
positionClass: '',
|
|
462
|
+
/**
|
|
463
|
+
* Distance, in pixels, the template should push away from the anchor on the Y axis.
|
|
464
|
+
* @option
|
|
465
|
+
* @type {number}
|
|
466
|
+
* @default 10
|
|
467
|
+
*/
|
|
468
|
+
vOffset: 10,
|
|
469
|
+
/**
|
|
470
|
+
* Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
|
|
471
|
+
* @option
|
|
472
|
+
* @type {number}
|
|
473
|
+
* @default 12
|
|
474
|
+
*/
|
|
475
|
+
hOffset: 12,
|
|
476
|
+
/**
|
|
477
|
+
* Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips,
|
|
478
|
+
* allowing HTML may open yourself up to XSS attacks.
|
|
479
|
+
* @option
|
|
480
|
+
* @type {boolean}
|
|
481
|
+
* @default false
|
|
482
|
+
*/
|
|
483
|
+
allowHtml: false
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* TODO utilize resize event trigger
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
// Window exports
|
|
491
|
+
Foundation.plugin(Tooltip, 'Tooltip');
|
|
492
|
+
}(jQuery);
|