bootstrap 4.0.0.alpha1

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.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +14 -0
  3. data/.gitignore +19 -0
  4. data/.travis.yml +16 -0
  5. data/CHANGELOG.md +7 -0
  6. data/Gemfile +13 -0
  7. data/LICENSE +21 -0
  8. data/README.md +143 -0
  9. data/Rakefile +75 -0
  10. data/assets/javascripts/bootstrap-sprockets.js +11 -0
  11. data/assets/javascripts/bootstrap.js +3560 -0
  12. data/assets/javascripts/bootstrap.min.js +220 -0
  13. data/assets/javascripts/bootstrap/alert.js +192 -0
  14. data/assets/javascripts/bootstrap/button.js +172 -0
  15. data/assets/javascripts/bootstrap/carousel.js +478 -0
  16. data/assets/javascripts/bootstrap/collapse.js +364 -0
  17. data/assets/javascripts/bootstrap/dropdown.js +293 -0
  18. data/assets/javascripts/bootstrap/modal.js +536 -0
  19. data/assets/javascripts/bootstrap/popover.js +201 -0
  20. data/assets/javascripts/bootstrap/scrollspy.js +320 -0
  21. data/assets/javascripts/bootstrap/tab.js +263 -0
  22. data/assets/javascripts/bootstrap/tooltip.js +619 -0
  23. data/assets/javascripts/bootstrap/util.js +157 -0
  24. data/assets/stylesheets/_bootstrap-flex.scss +8 -0
  25. data/assets/stylesheets/_bootstrap-grid.scss +62 -0
  26. data/assets/stylesheets/_bootstrap-reboot.scss +10 -0
  27. data/assets/stylesheets/_bootstrap.scss +55 -0
  28. data/assets/stylesheets/bootstrap/_alert.scss +65 -0
  29. data/assets/stylesheets/bootstrap/_animation.scss +27 -0
  30. data/assets/stylesheets/bootstrap/_breadcrumb.scss +23 -0
  31. data/assets/stylesheets/bootstrap/_button-group.scss +224 -0
  32. data/assets/stylesheets/bootstrap/_buttons.scss +174 -0
  33. data/assets/stylesheets/bootstrap/_card.scss +293 -0
  34. data/assets/stylesheets/bootstrap/_carousel.scss +252 -0
  35. data/assets/stylesheets/bootstrap/_close.scss +28 -0
  36. data/assets/stylesheets/bootstrap/_code.scss +58 -0
  37. data/assets/stylesheets/bootstrap/_custom-forms.scss +225 -0
  38. data/assets/stylesheets/bootstrap/_dropdown.scss +191 -0
  39. data/assets/stylesheets/bootstrap/_forms.scss +454 -0
  40. data/assets/stylesheets/bootstrap/_grid.scss +76 -0
  41. data/assets/stylesheets/bootstrap/_images.scss +28 -0
  42. data/assets/stylesheets/bootstrap/_input-group.scss +181 -0
  43. data/assets/stylesheets/bootstrap/_jumbotron.scss +22 -0
  44. data/assets/stylesheets/bootstrap/_labels.scss +75 -0
  45. data/assets/stylesheets/bootstrap/_list-group.scss +128 -0
  46. data/assets/stylesheets/bootstrap/_media.scss +90 -0
  47. data/assets/stylesheets/bootstrap/_mixins.scss +54 -0
  48. data/assets/stylesheets/bootstrap/_modal.scss +146 -0
  49. data/assets/stylesheets/bootstrap/_nav.scss +155 -0
  50. data/assets/stylesheets/bootstrap/_navbar.scss +230 -0
  51. data/assets/stylesheets/bootstrap/_normalize.scss +428 -0
  52. data/assets/stylesheets/bootstrap/_pager.scss +57 -0
  53. data/assets/stylesheets/bootstrap/_pagination.scss +82 -0
  54. data/assets/stylesheets/bootstrap/_popover.scss +140 -0
  55. data/assets/stylesheets/bootstrap/_print.scss +88 -0
  56. data/assets/stylesheets/bootstrap/_progress.scss +156 -0
  57. data/assets/stylesheets/bootstrap/_reboot.scss +298 -0
  58. data/assets/stylesheets/bootstrap/_responsive-embed.scss +38 -0
  59. data/assets/stylesheets/bootstrap/_tables.scss +193 -0
  60. data/assets/stylesheets/bootstrap/_tooltip.scss +85 -0
  61. data/assets/stylesheets/bootstrap/_type.scss +192 -0
  62. data/assets/stylesheets/bootstrap/_utilities-responsive.scss +49 -0
  63. data/assets/stylesheets/bootstrap/_utilities-spacing.scss +78 -0
  64. data/assets/stylesheets/bootstrap/_utilities.scss +117 -0
  65. data/assets/stylesheets/bootstrap/_variables.scss +632 -0
  66. data/assets/stylesheets/bootstrap/mixins/_alert.scss +14 -0
  67. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +13 -0
  68. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +35 -0
  69. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +76 -0
  70. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +100 -0
  71. data/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  72. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +7 -0
  73. data/assets/stylesheets/bootstrap/mixins/_forms.scss +89 -0
  74. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +43 -0
  75. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +44 -0
  76. data/assets/stylesheets/bootstrap/mixins/_grid.scss +75 -0
  77. data/assets/stylesheets/bootstrap/mixins/_hover.scss +59 -0
  78. data/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
  79. data/assets/stylesheets/bootstrap/mixins/_label.scss +11 -0
  80. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +30 -0
  81. data/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
  82. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  83. data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +9 -0
  84. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
  85. data/assets/stylesheets/bootstrap/mixins/_progress.scss +18 -0
  86. data/assets/stylesheets/bootstrap/mixins/_pulls.scss +6 -0
  87. data/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  88. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
  89. data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  90. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +32 -0
  91. data/assets/stylesheets/bootstrap/mixins/_size.scss +6 -0
  92. data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  93. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +30 -0
  94. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
  95. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +8 -0
  96. data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
  97. data/bootstrap.gemspec +36 -0
  98. data/lib/bootstrap.rb +76 -0
  99. data/lib/bootstrap/engine.rb +11 -0
  100. data/lib/bootstrap/version.rb +4 -0
  101. data/tasks/updater.rb +67 -0
  102. data/tasks/updater/js.rb +37 -0
  103. data/tasks/updater/logger.rb +57 -0
  104. data/tasks/updater/network.rb +101 -0
  105. data/tasks/updater/scss.rb +34 -0
  106. data/templates/project/_bootstrap-variables.scss +633 -0
  107. data/templates/project/manifest.rb +18 -0
  108. data/templates/project/styles.scss +10 -0
  109. data/test/compass_test.rb +9 -0
  110. data/test/dummy_rails/README.rdoc +3 -0
  111. data/test/dummy_rails/Rakefile +6 -0
  112. data/test/dummy_rails/app/assets/images/.keep +0 -0
  113. data/test/dummy_rails/app/assets/javascripts/application.js +7 -0
  114. data/test/dummy_rails/app/assets/stylesheets/application.sass +1 -0
  115. data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
  116. data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
  117. data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
  118. data/test/dummy_rails/app/views/layouts/application.html.erb +14 -0
  119. data/test/dummy_rails/app/views/pages/root.html.slim +58 -0
  120. data/test/dummy_rails/config.ru +4 -0
  121. data/test/dummy_rails/config/application.rb +34 -0
  122. data/test/dummy_rails/config/boot.rb +5 -0
  123. data/test/dummy_rails/config/environment.rb +5 -0
  124. data/test/dummy_rails/config/environments/development.rb +23 -0
  125. data/test/dummy_rails/config/environments/production.rb +82 -0
  126. data/test/dummy_rails/config/environments/test.rb +38 -0
  127. data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
  128. data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
  129. data/test/dummy_rails/config/initializers/inflections.rb +16 -0
  130. data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
  131. data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
  132. data/test/dummy_rails/config/initializers/session_store.rb +3 -0
  133. data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
  134. data/test/dummy_rails/config/locales/en.yml +3 -0
  135. data/test/dummy_rails/config/locales/es.yml +3 -0
  136. data/test/dummy_rails/config/routes.rb +3 -0
  137. data/test/dummy_rails/log/.keep +0 -0
  138. data/test/gemfiles/rails_4_2.gemfile +11 -0
  139. data/test/gemfiles/rails_head.gemfile +19 -0
  140. data/test/rails_test.rb +19 -0
  141. data/test/support/dummy_rails_integration.rb +22 -0
  142. data/test/support/reporting.rb +27 -0
  143. data/test/test_helper.rb +35 -0
  144. data/test/test_helper_rails.rb +6 -0
  145. metadata +433 -0
@@ -0,0 +1,263 @@
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
+ /**
8
+ * --------------------------------------------------------------------------
9
+ * Bootstrap (v4.0.0): tab.js
10
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
+ * --------------------------------------------------------------------------
12
+ */
13
+
14
+ var Tab = (function ($) {
15
+
16
+ /**
17
+ * ------------------------------------------------------------------------
18
+ * Constants
19
+ * ------------------------------------------------------------------------
20
+ */
21
+
22
+ var NAME = 'tab';
23
+ var VERSION = '4.0.0';
24
+ var DATA_KEY = 'bs.tab';
25
+ var EVENT_KEY = '.' + DATA_KEY;
26
+ var DATA_API_KEY = '.data-api';
27
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
28
+ var TRANSITION_DURATION = 150;
29
+
30
+ var Event = {
31
+ HIDE: 'hide' + EVENT_KEY,
32
+ HIDDEN: 'hidden' + EVENT_KEY,
33
+ SHOW: 'show' + EVENT_KEY,
34
+ SHOWN: 'shown' + EVENT_KEY,
35
+ CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
36
+ };
37
+
38
+ var ClassName = {
39
+ DROPDOWN_MENU: 'dropdown-menu',
40
+ ACTIVE: 'active',
41
+ FADE: 'fade',
42
+ IN: 'in'
43
+ };
44
+
45
+ var Selector = {
46
+ A: 'a',
47
+ LI: 'li',
48
+ DROPDOWN: '.dropdown',
49
+ UL: 'ul:not(.dropdown-menu)',
50
+ FADE_CHILD: '> .nav-item .fade, > .fade',
51
+ ACTIVE: '.active',
52
+ ACTIVE_CHILD: '> .nav-item > .active, > .active',
53
+ DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
54
+ DROPDOWN_TOGGLE: '.dropdown-toggle',
55
+ DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
56
+ };
57
+
58
+ /**
59
+ * ------------------------------------------------------------------------
60
+ * Class Definition
61
+ * ------------------------------------------------------------------------
62
+ */
63
+
64
+ var Tab = (function () {
65
+ function Tab(element) {
66
+ _classCallCheck(this, Tab);
67
+
68
+ this._element = element;
69
+ }
70
+
71
+ /**
72
+ * ------------------------------------------------------------------------
73
+ * Data Api implementation
74
+ * ------------------------------------------------------------------------
75
+ */
76
+
77
+ // getters
78
+
79
+ _createClass(Tab, [{
80
+ key: 'show',
81
+
82
+ // public
83
+
84
+ value: function show() {
85
+ var _this = this;
86
+
87
+ if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
88
+ return;
89
+ }
90
+
91
+ var target = undefined;
92
+ var previous = undefined;
93
+ var ulElement = $(this._element).closest(Selector.UL)[0];
94
+ var selector = Util.getSelectorFromElement(this._element);
95
+
96
+ if (ulElement) {
97
+ previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
98
+ previous = previous[previous.length - 1];
99
+ }
100
+
101
+ var hideEvent = $.Event(Event.HIDE, {
102
+ relatedTarget: this._element
103
+ });
104
+
105
+ var showEvent = $.Event(Event.SHOW, {
106
+ relatedTarget: previous
107
+ });
108
+
109
+ if (previous) {
110
+ $(previous).trigger(hideEvent);
111
+ }
112
+
113
+ $(this._element).trigger(showEvent);
114
+
115
+ if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
116
+ return;
117
+ }
118
+
119
+ if (selector) {
120
+ target = $(selector)[0];
121
+ }
122
+
123
+ this._activate(this._element, ulElement);
124
+
125
+ var complete = function complete() {
126
+ var hiddenEvent = $.Event(Event.HIDDEN, {
127
+ relatedTarget: _this._element
128
+ });
129
+
130
+ var shownEvent = $.Event(Event.SHOWN, {
131
+ relatedTarget: previous
132
+ });
133
+
134
+ $(previous).trigger(hiddenEvent);
135
+ $(_this._element).trigger(shownEvent);
136
+ };
137
+
138
+ if (target) {
139
+ this._activate(target, target.parentNode, complete);
140
+ } else {
141
+ complete();
142
+ }
143
+ }
144
+ }, {
145
+ key: 'dispose',
146
+ value: function dispose() {
147
+ $.removeClass(this._element, DATA_KEY);
148
+ this._element = null;
149
+ }
150
+
151
+ // private
152
+
153
+ }, {
154
+ key: '_activate',
155
+ value: function _activate(element, container, callback) {
156
+ var active = $(container).find(Selector.ACTIVE_CHILD)[0];
157
+ var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
158
+
159
+ var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
160
+
161
+ if (active && isTransitioning) {
162
+ $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
163
+ } else {
164
+ complete();
165
+ }
166
+
167
+ if (active) {
168
+ $(active).removeClass(ClassName.IN);
169
+ }
170
+ }
171
+ }, {
172
+ key: '_transitionComplete',
173
+ value: function _transitionComplete(element, active, isTransitioning, callback) {
174
+ if (active) {
175
+ $(active).removeClass(ClassName.ACTIVE);
176
+
177
+ var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
178
+
179
+ if (dropdownChild) {
180
+ $(dropdownChild).removeClass(ClassName.ACTIVE);
181
+ }
182
+
183
+ active.setAttribute('aria-expanded', false);
184
+ }
185
+
186
+ $(element).addClass(ClassName.ACTIVE);
187
+ element.setAttribute('aria-expanded', true);
188
+
189
+ if (isTransitioning) {
190
+ Util.reflow(element);
191
+ $(element).addClass(ClassName.IN);
192
+ } else {
193
+ $(element).removeClass(ClassName.FADE);
194
+ }
195
+
196
+ if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
197
+
198
+ var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
199
+ if (dropdownElement) {
200
+ $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
201
+ }
202
+
203
+ element.setAttribute('aria-expanded', true);
204
+ }
205
+
206
+ if (callback) {
207
+ callback();
208
+ }
209
+ }
210
+
211
+ // static
212
+
213
+ }], [{
214
+ key: '_jQueryInterface',
215
+ value: function _jQueryInterface(config) {
216
+ return this.each(function () {
217
+ var $this = $(this);
218
+ var data = $this.data(DATA_KEY);
219
+
220
+ if (!data) {
221
+ data = data = new Tab(this);
222
+ $this.data(DATA_KEY, data);
223
+ }
224
+
225
+ if (typeof config === 'string') {
226
+ if (data[config] === undefined) {
227
+ throw new Error('No method named "' + config + '"');
228
+ }
229
+ data[config]();
230
+ }
231
+ });
232
+ }
233
+ }, {
234
+ key: 'VERSION',
235
+ get: function get() {
236
+ return VERSION;
237
+ }
238
+ }]);
239
+
240
+ return Tab;
241
+ })();
242
+
243
+ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
244
+ event.preventDefault();
245
+ Tab._jQueryInterface.call($(this), 'show');
246
+ });
247
+
248
+ /**
249
+ * ------------------------------------------------------------------------
250
+ * jQuery
251
+ * ------------------------------------------------------------------------
252
+ */
253
+
254
+ $.fn[NAME] = Tab._jQueryInterface;
255
+ $.fn[NAME].Constructor = Tab;
256
+ $.fn[NAME].noConflict = function () {
257
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
258
+ return Tab._jQueryInterface;
259
+ };
260
+
261
+ return Tab;
262
+ })(jQuery);
263
+ //# sourceMappingURL=tab.js.map
@@ -0,0 +1,619 @@
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
+ /**
8
+ * --------------------------------------------------------------------------
9
+ * Bootstrap (v4.0.0): tooltip.js
10
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
+ * --------------------------------------------------------------------------
12
+ */
13
+
14
+ var Tooltip = (function ($) {
15
+
16
+ /**
17
+ * ------------------------------------------------------------------------
18
+ * Constants
19
+ * ------------------------------------------------------------------------
20
+ */
21
+
22
+ var NAME = 'tooltip';
23
+ var VERSION = '4.0.0';
24
+ var DATA_KEY = 'bs.tooltip';
25
+ var EVENT_KEY = '.' + DATA_KEY;
26
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
27
+ var TRANSITION_DURATION = 150;
28
+ var CLASS_PREFIX = 'bs-tether';
29
+
30
+ var Default = {
31
+ animation: true,
32
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
33
+ trigger: 'hover focus',
34
+ title: '',
35
+ delay: 0,
36
+ html: false,
37
+ selector: false,
38
+ placement: 'top',
39
+ offset: '0 0',
40
+ constraints: []
41
+ };
42
+
43
+ var DefaultType = {
44
+ animation: 'boolean',
45
+ template: 'string',
46
+ title: '(string|element|function)',
47
+ trigger: 'string',
48
+ delay: '(number|object)',
49
+ html: 'boolean',
50
+ selector: '(string|boolean)',
51
+ placement: '(string|function)',
52
+ offset: 'string',
53
+ constraints: 'array'
54
+ };
55
+
56
+ var AttachmentMap = {
57
+ TOP: 'bottom center',
58
+ RIGHT: 'middle left',
59
+ BOTTOM: 'top center',
60
+ LEFT: 'middle right'
61
+ };
62
+
63
+ var HoverState = {
64
+ IN: 'in',
65
+ OUT: 'out'
66
+ };
67
+
68
+ var Event = {
69
+ HIDE: 'hide' + EVENT_KEY,
70
+ HIDDEN: 'hidden' + EVENT_KEY,
71
+ SHOW: 'show' + EVENT_KEY,
72
+ SHOWN: 'shown' + EVENT_KEY,
73
+ INSERTED: 'inserted' + EVENT_KEY,
74
+ CLICK: 'click' + EVENT_KEY,
75
+ FOCUSIN: 'focusin' + EVENT_KEY,
76
+ FOCUSOUT: 'focusout' + EVENT_KEY,
77
+ MOUSEENTER: 'mouseenter' + EVENT_KEY,
78
+ MOUSELEAVE: 'mouseleave' + EVENT_KEY
79
+ };
80
+
81
+ var ClassName = {
82
+ FADE: 'fade',
83
+ IN: 'in'
84
+ };
85
+
86
+ var Selector = {
87
+ TOOLTIP: '.tooltip',
88
+ TOOLTIP_INNER: '.tooltip-inner'
89
+ };
90
+
91
+ var TetherClass = {
92
+ element: false,
93
+ enabled: false
94
+ };
95
+
96
+ var Trigger = {
97
+ HOVER: 'hover',
98
+ FOCUS: 'focus',
99
+ CLICK: 'click',
100
+ MANUAL: 'manual'
101
+ };
102
+
103
+ /**
104
+ * ------------------------------------------------------------------------
105
+ * Class Definition
106
+ * ------------------------------------------------------------------------
107
+ */
108
+
109
+ var Tooltip = (function () {
110
+ function Tooltip(element, config) {
111
+ _classCallCheck(this, Tooltip);
112
+
113
+ // private
114
+ this._isEnabled = true;
115
+ this._timeout = 0;
116
+ this._hoverState = '';
117
+ this._activeTrigger = {};
118
+ this._tether = null;
119
+
120
+ // protected
121
+ this.element = element;
122
+ this.config = this._getConfig(config);
123
+ this.tip = null;
124
+
125
+ this._setListeners();
126
+ }
127
+
128
+ /**
129
+ * ------------------------------------------------------------------------
130
+ * jQuery
131
+ * ------------------------------------------------------------------------
132
+ */
133
+
134
+ // getters
135
+
136
+ _createClass(Tooltip, [{
137
+ key: 'enable',
138
+
139
+ // public
140
+
141
+ value: function enable() {
142
+ this._isEnabled = true;
143
+ }
144
+ }, {
145
+ key: 'disable',
146
+ value: function disable() {
147
+ this._isEnabled = false;
148
+ }
149
+ }, {
150
+ key: 'toggleEnabled',
151
+ value: function toggleEnabled() {
152
+ this._isEnabled = !this._isEnabled;
153
+ }
154
+ }, {
155
+ key: 'toggle',
156
+ value: function toggle(event) {
157
+ if (event) {
158
+ var dataKey = this.constructor.DATA_KEY;
159
+ var context = $(event.currentTarget).data(dataKey);
160
+
161
+ if (!context) {
162
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
163
+ $(event.currentTarget).data(dataKey, context);
164
+ }
165
+
166
+ context._activeTrigger.click = !context._activeTrigger.click;
167
+
168
+ if (context._isWithActiveTrigger()) {
169
+ context._enter(null, context);
170
+ } else {
171
+ context._leave(null, context);
172
+ }
173
+ } else {
174
+
175
+ if ($(this.getTipElement()).hasClass(ClassName.IN)) {
176
+ this._leave(null, this);
177
+ return;
178
+ }
179
+
180
+ this._enter(null, this);
181
+ }
182
+ }
183
+ }, {
184
+ key: 'dispose',
185
+ value: function dispose() {
186
+ clearTimeout(this._timeout);
187
+
188
+ this.cleanupTether();
189
+
190
+ $.removeData(this.element, this.constructor.DATA_KEY);
191
+
192
+ $(this.element).off(this.constructor.EVENT_KEY);
193
+
194
+ if (this.tip) {
195
+ $(this.tip).remove();
196
+ }
197
+
198
+ this._isEnabled = null;
199
+ this._timeout = null;
200
+ this._hoverState = null;
201
+ this._activeTrigger = null;
202
+ this._tether = null;
203
+
204
+ this.element = null;
205
+ this.config = null;
206
+ this.tip = null;
207
+ }
208
+ }, {
209
+ key: 'show',
210
+ value: function show() {
211
+ var _this = this;
212
+
213
+ var showEvent = $.Event(this.constructor.Event.SHOW);
214
+
215
+ if (this.isWithContent() && this._isEnabled) {
216
+ $(this.element).trigger(showEvent);
217
+
218
+ var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
219
+
220
+ if (showEvent.isDefaultPrevented() || !isInTheDom) {
221
+ return;
222
+ }
223
+
224
+ var tip = this.getTipElement();
225
+ var tipId = Util.getUID(this.constructor.NAME);
226
+
227
+ tip.setAttribute('id', tipId);
228
+ this.element.setAttribute('aria-describedby', tipId);
229
+
230
+ this.setContent();
231
+
232
+ if (this.config.animation) {
233
+ $(tip).addClass(ClassName.FADE);
234
+ }
235
+
236
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
237
+
238
+ var attachment = this._getAttachment(placement);
239
+
240
+ $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
241
+
242
+ $(this.element).trigger(this.constructor.Event.INSERTED);
243
+
244
+ this._tether = new Tether({
245
+ attachment: attachment,
246
+ element: tip,
247
+ target: this.element,
248
+ classes: TetherClass,
249
+ classPrefix: CLASS_PREFIX,
250
+ offset: this.config.offset,
251
+ constraints: this.config.constraints
252
+ });
253
+
254
+ Util.reflow(tip);
255
+ this._tether.position();
256
+
257
+ $(tip).addClass(ClassName.IN);
258
+
259
+ var complete = function complete() {
260
+ var prevHoverState = _this._hoverState;
261
+ _this._hoverState = null;
262
+
263
+ $(_this.element).trigger(_this.constructor.Event.SHOWN);
264
+
265
+ if (prevHoverState === HoverState.OUT) {
266
+ _this._leave(null, _this);
267
+ }
268
+ };
269
+
270
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
271
+ $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
272
+ return;
273
+ }
274
+
275
+ complete();
276
+ }
277
+ }
278
+ }, {
279
+ key: 'hide',
280
+ value: function hide(callback) {
281
+ var _this2 = this;
282
+
283
+ var tip = this.getTipElement();
284
+ var hideEvent = $.Event(this.constructor.Event.HIDE);
285
+ var complete = function complete() {
286
+ if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
287
+ tip.parentNode.removeChild(tip);
288
+ }
289
+
290
+ _this2.element.removeAttribute('aria-describedby');
291
+ $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
292
+ _this2.cleanupTether();
293
+
294
+ if (callback) {
295
+ callback();
296
+ }
297
+ };
298
+
299
+ $(this.element).trigger(hideEvent);
300
+
301
+ if (hideEvent.isDefaultPrevented()) {
302
+ return;
303
+ }
304
+
305
+ $(tip).removeClass(ClassName.IN);
306
+
307
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
308
+
309
+ $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
310
+ } else {
311
+ complete();
312
+ }
313
+
314
+ this._hoverState = '';
315
+ }
316
+
317
+ // protected
318
+
319
+ }, {
320
+ key: 'isWithContent',
321
+ value: function isWithContent() {
322
+ return Boolean(this.getTitle());
323
+ }
324
+ }, {
325
+ key: 'getTipElement',
326
+ value: function getTipElement() {
327
+ return this.tip = this.tip || $(this.config.template)[0];
328
+ }
329
+ }, {
330
+ key: 'setContent',
331
+ value: function setContent() {
332
+ var $tip = $(this.getTipElement());
333
+
334
+ this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
335
+
336
+ $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
337
+
338
+ this.cleanupTether();
339
+ }
340
+ }, {
341
+ key: 'setElementContent',
342
+ value: function setElementContent($element, content) {
343
+ var html = this.config.html;
344
+ if (typeof content === 'object' && (content.nodeType || content.jquery)) {
345
+ // content is a DOM node or a jQuery
346
+ if (html) {
347
+ if (!$(content).parent().is($element)) {
348
+ $element.empty().append(content);
349
+ }
350
+ } else {
351
+ $element.text($(content).text());
352
+ }
353
+ } else {
354
+ $element[html ? 'html' : 'text'](content);
355
+ }
356
+ }
357
+ }, {
358
+ key: 'getTitle',
359
+ value: function getTitle() {
360
+ var title = this.element.getAttribute('data-original-title');
361
+
362
+ if (!title) {
363
+ title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
364
+ }
365
+
366
+ return title;
367
+ }
368
+ }, {
369
+ key: 'cleanupTether',
370
+ value: function cleanupTether() {
371
+ if (this._tether) {
372
+ this._tether.destroy();
373
+
374
+ // clean up after tether's junk classes
375
+ // remove after they fix issue
376
+ // (https://github.com/HubSpot/tether/issues/36)
377
+ $(this.element).removeClass(this._removeTetherClasses);
378
+ $(this.tip).removeClass(this._removeTetherClasses);
379
+ }
380
+ }
381
+
382
+ // private
383
+
384
+ }, {
385
+ key: '_getAttachment',
386
+ value: function _getAttachment(placement) {
387
+ return AttachmentMap[placement.toUpperCase()];
388
+ }
389
+ }, {
390
+ key: '_setListeners',
391
+ value: function _setListeners() {
392
+ var _this3 = this;
393
+
394
+ var triggers = this.config.trigger.split(' ');
395
+
396
+ triggers.forEach(function (trigger) {
397
+ if (trigger === 'click') {
398
+ $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
399
+ } else if (trigger !== Trigger.MANUAL) {
400
+ var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
401
+ var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
402
+
403
+ $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
404
+ }
405
+ });
406
+
407
+ if (this.config.selector) {
408
+ this.config = $.extend({}, this.config, {
409
+ trigger: 'manual',
410
+ selector: ''
411
+ });
412
+ } else {
413
+ this._fixTitle();
414
+ }
415
+ }
416
+ }, {
417
+ key: '_removeTetherClasses',
418
+ value: function _removeTetherClasses(i, css) {
419
+ return ((css.baseVal || css).match(new RegExp('(^|\\s)' + CLASS_PREFIX + '-\\S+', 'g')) || []).join(' ');
420
+ }
421
+ }, {
422
+ key: '_fixTitle',
423
+ value: function _fixTitle() {
424
+ var titleType = typeof this.element.getAttribute('data-original-title');
425
+ if (this.element.getAttribute('title') || titleType !== 'string') {
426
+ this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
427
+ this.element.setAttribute('title', '');
428
+ }
429
+ }
430
+ }, {
431
+ key: '_enter',
432
+ value: function _enter(event, context) {
433
+ var dataKey = this.constructor.DATA_KEY;
434
+
435
+ context = context || $(event.currentTarget).data(dataKey);
436
+
437
+ if (!context) {
438
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
439
+ $(event.currentTarget).data(dataKey, context);
440
+ }
441
+
442
+ if (event) {
443
+ context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
444
+ }
445
+
446
+ if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
447
+ context._hoverState = HoverState.IN;
448
+ return;
449
+ }
450
+
451
+ clearTimeout(context._timeout);
452
+
453
+ context._hoverState = HoverState.IN;
454
+
455
+ if (!context.config.delay || !context.config.delay.show) {
456
+ context.show();
457
+ return;
458
+ }
459
+
460
+ context._timeout = setTimeout(function () {
461
+ if (context._hoverState === HoverState.IN) {
462
+ context.show();
463
+ }
464
+ }, context.config.delay.show);
465
+ }
466
+ }, {
467
+ key: '_leave',
468
+ value: function _leave(event, context) {
469
+ var dataKey = this.constructor.DATA_KEY;
470
+
471
+ context = context || $(event.currentTarget).data(dataKey);
472
+
473
+ if (!context) {
474
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
475
+ $(event.currentTarget).data(dataKey, context);
476
+ }
477
+
478
+ if (event) {
479
+ context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
480
+ }
481
+
482
+ if (context._isWithActiveTrigger()) {
483
+ return;
484
+ }
485
+
486
+ clearTimeout(context._timeout);
487
+
488
+ context._hoverState = HoverState.OUT;
489
+
490
+ if (!context.config.delay || !context.config.delay.hide) {
491
+ context.hide();
492
+ return;
493
+ }
494
+
495
+ context._timeout = setTimeout(function () {
496
+ if (context._hoverState === HoverState.OUT) {
497
+ context.hide();
498
+ }
499
+ }, context.config.delay.hide);
500
+ }
501
+ }, {
502
+ key: '_isWithActiveTrigger',
503
+ value: function _isWithActiveTrigger() {
504
+ for (var trigger in this._activeTrigger) {
505
+ if (this._activeTrigger[trigger]) {
506
+ return true;
507
+ }
508
+ }
509
+
510
+ return false;
511
+ }
512
+ }, {
513
+ key: '_getConfig',
514
+ value: function _getConfig(config) {
515
+ config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
516
+
517
+ if (config.delay && typeof config.delay === 'number') {
518
+ config.delay = {
519
+ show: config.delay,
520
+ hide: config.delay
521
+ };
522
+ }
523
+
524
+ Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
525
+
526
+ return config;
527
+ }
528
+ }, {
529
+ key: '_getDelegateConfig',
530
+ value: function _getDelegateConfig() {
531
+ var config = {};
532
+
533
+ if (this.config) {
534
+ for (var key in this.config) {
535
+ if (this.constructor.Default[key] !== this.config[key]) {
536
+ config[key] = this.config[key];
537
+ }
538
+ }
539
+ }
540
+
541
+ return config;
542
+ }
543
+
544
+ // static
545
+
546
+ }], [{
547
+ key: '_jQueryInterface',
548
+ value: function _jQueryInterface(config) {
549
+ return this.each(function () {
550
+ var data = $(this).data(DATA_KEY);
551
+ var _config = typeof config === 'object' ? config : null;
552
+
553
+ if (!data && /destroy|hide/.test(config)) {
554
+ return;
555
+ }
556
+
557
+ if (!data) {
558
+ data = new Tooltip(this, _config);
559
+ $(this).data(DATA_KEY, data);
560
+ }
561
+
562
+ if (typeof config === 'string') {
563
+ if (data[config] === undefined) {
564
+ throw new Error('No method named "' + config + '"');
565
+ }
566
+ data[config]();
567
+ }
568
+ });
569
+ }
570
+ }, {
571
+ key: 'VERSION',
572
+ get: function get() {
573
+ return VERSION;
574
+ }
575
+ }, {
576
+ key: 'Default',
577
+ get: function get() {
578
+ return Default;
579
+ }
580
+ }, {
581
+ key: 'NAME',
582
+ get: function get() {
583
+ return NAME;
584
+ }
585
+ }, {
586
+ key: 'DATA_KEY',
587
+ get: function get() {
588
+ return DATA_KEY;
589
+ }
590
+ }, {
591
+ key: 'Event',
592
+ get: function get() {
593
+ return Event;
594
+ }
595
+ }, {
596
+ key: 'EVENT_KEY',
597
+ get: function get() {
598
+ return EVENT_KEY;
599
+ }
600
+ }, {
601
+ key: 'DefaultType',
602
+ get: function get() {
603
+ return DefaultType;
604
+ }
605
+ }]);
606
+
607
+ return Tooltip;
608
+ })();
609
+
610
+ $.fn[NAME] = Tooltip._jQueryInterface;
611
+ $.fn[NAME].Constructor = Tooltip;
612
+ $.fn[NAME].noConflict = function () {
613
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
614
+ return Tooltip._jQueryInterface;
615
+ };
616
+
617
+ return Tooltip;
618
+ })(jQuery);
619
+ //# sourceMappingURL=tooltip.js.map