bootstrap 4.0.0.beta → 4.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bootstrap might be problematic. Click here for more details.

Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +1 -1
  4. data/README.md +10 -43
  5. data/Rakefile +1 -1
  6. data/assets/javascripts/bootstrap-sprockets.js +5 -5
  7. data/assets/javascripts/bootstrap.js +1561 -1542
  8. data/assets/javascripts/bootstrap.min.js +6 -5
  9. data/assets/javascripts/bootstrap/alert.js +31 -38
  10. data/assets/javascripts/bootstrap/button.js +23 -30
  11. data/assets/javascripts/bootstrap/carousel.js +72 -81
  12. data/assets/javascripts/bootstrap/collapse.js +72 -68
  13. data/assets/javascripts/bootstrap/dropdown.js +97 -85
  14. data/assets/javascripts/bootstrap/modal.js +104 -101
  15. data/assets/javascripts/bootstrap/popover.js +55 -68
  16. data/assets/javascripts/bootstrap/scrollspy.js +63 -68
  17. data/assets/javascripts/bootstrap/tab.js +54 -49
  18. data/assets/javascripts/bootstrap/tooltip.js +102 -116
  19. data/assets/javascripts/bootstrap/util.js +20 -30
  20. data/assets/stylesheets/_bootstrap-grid.scss +7 -9
  21. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  22. data/assets/stylesheets/_bootstrap.scss +2 -1
  23. data/assets/stylesheets/bootstrap/_alert.scss +4 -3
  24. data/assets/stylesheets/bootstrap/_badge.scss +1 -2
  25. data/assets/stylesheets/bootstrap/_breadcrumb.scss +4 -4
  26. data/assets/stylesheets/bootstrap/_button-group.scss +33 -24
  27. data/assets/stylesheets/bootstrap/_buttons.scss +24 -29
  28. data/assets/stylesheets/bootstrap/_card.scss +58 -22
  29. data/assets/stylesheets/bootstrap/_carousel.scss +6 -0
  30. data/assets/stylesheets/bootstrap/_close.scss +2 -2
  31. data/assets/stylesheets/bootstrap/_custom-forms.scss +11 -8
  32. data/assets/stylesheets/bootstrap/_dropdown.scss +16 -41
  33. data/assets/stylesheets/bootstrap/_forms.scss +12 -44
  34. data/assets/stylesheets/bootstrap/_functions.scss +6 -10
  35. data/assets/stylesheets/bootstrap/_grid.scss +0 -1
  36. data/assets/stylesheets/bootstrap/_input-group.scss +17 -7
  37. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  38. data/assets/stylesheets/bootstrap/_modal.scss +12 -1
  39. data/assets/stylesheets/bootstrap/_nav.scss +5 -5
  40. data/assets/stylesheets/bootstrap/_navbar.scss +27 -5
  41. data/assets/stylesheets/bootstrap/_pagination.scss +2 -4
  42. data/assets/stylesheets/bootstrap/_popover.scss +16 -17
  43. data/assets/stylesheets/bootstrap/_print.scss +2 -3
  44. data/assets/stylesheets/bootstrap/_progress.scss +4 -6
  45. data/assets/stylesheets/bootstrap/_reboot.scss +39 -16
  46. data/assets/stylesheets/bootstrap/_root.scss +19 -0
  47. data/assets/stylesheets/bootstrap/_tables.scss +40 -28
  48. data/assets/stylesheets/bootstrap/_tooltip.scss +6 -6
  49. data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
  50. data/assets/stylesheets/bootstrap/_type.scss +2 -0
  51. data/assets/stylesheets/bootstrap/_variables.scss +467 -476
  52. data/assets/stylesheets/bootstrap/mixins/_alert.scss +1 -1
  53. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +8 -0
  54. data/assets/stylesheets/bootstrap/mixins/_badge.scss +2 -2
  55. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +18 -4
  56. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +27 -16
  57. data/assets/stylesheets/bootstrap/mixins/_caret.scss +35 -0
  58. data/assets/stylesheets/bootstrap/mixins/_float.scss +2 -0
  59. data/assets/stylesheets/bootstrap/mixins/_forms.scss +31 -4
  60. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +8 -0
  61. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +14 -1
  62. data/assets/stylesheets/bootstrap/mixins/_grid.scss +10 -5
  63. data/assets/stylesheets/bootstrap/mixins/_hover.scss +13 -12
  64. data/assets/stylesheets/bootstrap/mixins/_image.scss +3 -3
  65. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +0 -2
  66. data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +2 -1
  67. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -2
  68. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +2 -2
  69. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -0
  70. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +2 -0
  71. data/assets/stylesheets/bootstrap/utilities/_align.scss +2 -0
  72. data/assets/stylesheets/bootstrap/utilities/_background.scss +16 -3
  73. data/assets/stylesheets/bootstrap/utilities/_borders.scss +5 -3
  74. data/assets/stylesheets/bootstrap/utilities/_display.scss +3 -0
  75. data/assets/stylesheets/bootstrap/utilities/_flex.scss +2 -0
  76. data/assets/stylesheets/bootstrap/utilities/_position.scss +12 -1
  77. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +2 -0
  78. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +24 -14
  79. data/assets/stylesheets/bootstrap/utilities/_text.scss +7 -4
  80. data/bootstrap.gemspec +2 -3
  81. data/lib/bootstrap.rb +0 -16
  82. data/lib/bootstrap/version.rb +2 -2
  83. data/tasks/updater/js.rb +31 -4
  84. data/tasks/updater/scss.rb +0 -12
  85. data/test/dummy_rails/config/application.rb +0 -1
  86. metadata +16 -27
  87. data/templates/project/_bootstrap-variables.scss +0 -834
  88. data/templates/project/manifest.rb +0 -18
  89. data/templates/project/styles.scss +0 -10
  90. data/test/compass_test.rb +0 -14
@@ -1,38 +1,33 @@
1
- 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; }; }();
1
+ 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); } }
2
2
 
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
4
4
 
5
5
  /**
6
6
  * --------------------------------------------------------------------------
7
- * Bootstrap (v4.0.0-beta): tab.js
7
+ * Bootstrap (v4.0.0-beta.2): tab.js
8
8
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
9
9
  * --------------------------------------------------------------------------
10
10
  */
11
-
12
- var Tab = function ($) {
13
-
11
+ var Tab = function () {
14
12
  /**
15
13
  * ------------------------------------------------------------------------
16
14
  * Constants
17
15
  * ------------------------------------------------------------------------
18
16
  */
19
-
20
17
  var NAME = 'tab';
21
- var VERSION = '4.0.0-beta';
18
+ var VERSION = '4.0.0-beta.2';
22
19
  var DATA_KEY = 'bs.tab';
23
- var EVENT_KEY = '.' + DATA_KEY;
20
+ var EVENT_KEY = "." + DATA_KEY;
24
21
  var DATA_API_KEY = '.data-api';
25
22
  var JQUERY_NO_CONFLICT = $.fn[NAME];
26
23
  var TRANSITION_DURATION = 150;
27
-
28
24
  var Event = {
29
- HIDE: 'hide' + EVENT_KEY,
30
- HIDDEN: 'hidden' + EVENT_KEY,
31
- SHOW: 'show' + EVENT_KEY,
32
- SHOWN: 'shown' + EVENT_KEY,
33
- CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
25
+ HIDE: "hide" + EVENT_KEY,
26
+ HIDDEN: "hidden" + EVENT_KEY,
27
+ SHOW: "show" + EVENT_KEY,
28
+ SHOWN: "shown" + EVENT_KEY,
29
+ CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
34
30
  };
35
-
36
31
  var ClassName = {
37
32
  DROPDOWN_MENU: 'dropdown-menu',
38
33
  ACTIVE: 'active',
@@ -40,15 +35,14 @@ var Tab = function ($) {
40
35
  FADE: 'fade',
41
36
  SHOW: 'show'
42
37
  };
43
-
44
38
  var Selector = {
45
39
  DROPDOWN: '.dropdown',
46
40
  NAV_LIST_GROUP: '.nav, .list-group',
47
41
  ACTIVE: '.active',
42
+ ACTIVE_UL: '> li > .active',
48
43
  DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
49
44
  DROPDOWN_TOGGLE: '.dropdown-toggle',
50
45
  DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
51
-
52
46
  /**
53
47
  * ------------------------------------------------------------------------
54
48
  * Class Definition
@@ -56,38 +50,39 @@ var Tab = function ($) {
56
50
  */
57
51
 
58
52
  };
59
- var Tab = function () {
60
- function Tab(element) {
61
- _classCallCheck(this, Tab);
62
53
 
54
+ var Tab =
55
+ /*#__PURE__*/
56
+ function () {
57
+ function Tab(element) {
63
58
  this._element = element;
64
- }
59
+ } // getters
65
60
 
66
- // getters
67
61
 
68
- // public
62
+ var _proto = Tab.prototype;
69
63
 
70
- Tab.prototype.show = function show() {
64
+ // public
65
+ _proto.show = function show() {
71
66
  var _this = this;
72
67
 
73
68
  if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
74
69
  return;
75
70
  }
76
71
 
77
- var target = void 0;
78
- var previous = void 0;
72
+ var target;
73
+ var previous;
79
74
  var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
80
75
  var selector = Util.getSelectorFromElement(this._element);
81
76
 
82
77
  if (listElement) {
83
- previous = $.makeArray($(listElement).find(Selector.ACTIVE));
78
+ var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
79
+ previous = $.makeArray($(listElement).find(itemSelector));
84
80
  previous = previous[previous.length - 1];
85
81
  }
86
82
 
87
83
  var hideEvent = $.Event(Event.HIDE, {
88
84
  relatedTarget: this._element
89
85
  });
90
-
91
86
  var showEvent = $.Event(Event.SHOW, {
92
87
  relatedTarget: previous
93
88
  });
@@ -112,11 +107,9 @@ var Tab = function ($) {
112
107
  var hiddenEvent = $.Event(Event.HIDDEN, {
113
108
  relatedTarget: _this._element
114
109
  });
115
-
116
110
  var shownEvent = $.Event(Event.SHOWN, {
117
111
  relatedTarget: previous
118
112
  });
119
-
120
113
  $(previous).trigger(hiddenEvent);
121
114
  $(_this._element).trigger(shownEvent);
122
115
  };
@@ -128,17 +121,24 @@ var Tab = function ($) {
128
121
  }
129
122
  };
130
123
 
131
- Tab.prototype.dispose = function dispose() {
124
+ _proto.dispose = function dispose() {
132
125
  $.removeData(this._element, DATA_KEY);
133
126
  this._element = null;
134
- };
127
+ }; // private
135
128
 
136
- // private
137
129
 
138
- Tab.prototype._activate = function _activate(element, container, callback) {
130
+ _proto._activate = function _activate(element, container, callback) {
139
131
  var _this2 = this;
140
132
 
141
- var active = $(container).find(Selector.ACTIVE)[0];
133
+ var activeElements;
134
+
135
+ if (container.nodeName === 'UL') {
136
+ activeElements = $(container).find(Selector.ACTIVE_UL);
137
+ } else {
138
+ activeElements = $(container).children(Selector.ACTIVE);
139
+ }
140
+
141
+ var active = activeElements[0];
142
142
  var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
143
143
 
144
144
  var complete = function complete() {
@@ -156,21 +156,25 @@ var Tab = function ($) {
156
156
  }
157
157
  };
158
158
 
159
- Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
159
+ _proto._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
160
160
  if (active) {
161
161
  $(active).removeClass(ClassName.ACTIVE);
162
-
163
162
  var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
164
163
 
165
164
  if (dropdownChild) {
166
165
  $(dropdownChild).removeClass(ClassName.ACTIVE);
167
166
  }
168
167
 
169
- active.setAttribute('aria-expanded', false);
168
+ if (active.getAttribute('role') === 'tab') {
169
+ active.setAttribute('aria-selected', false);
170
+ }
170
171
  }
171
172
 
172
173
  $(element).addClass(ClassName.ACTIVE);
173
- element.setAttribute('aria-expanded', true);
174
+
175
+ if (element.getAttribute('role') === 'tab') {
176
+ element.setAttribute('aria-selected', true);
177
+ }
174
178
 
175
179
  if (isTransitioning) {
176
180
  Util.reflow(element);
@@ -180,8 +184,8 @@ var Tab = function ($) {
180
184
  }
181
185
 
182
186
  if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
183
-
184
187
  var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
188
+
185
189
  if (dropdownElement) {
186
190
  $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
187
191
  }
@@ -192,9 +196,8 @@ var Tab = function ($) {
192
196
  if (callback) {
193
197
  callback();
194
198
  }
195
- };
199
+ }; // static
196
200
 
197
- // static
198
201
 
199
202
  Tab._jQueryInterface = function _jQueryInterface(config) {
200
203
  return this.each(function () {
@@ -207,16 +210,17 @@ var Tab = function ($) {
207
210
  }
208
211
 
209
212
  if (typeof config === 'string') {
210
- if (data[config] === undefined) {
211
- throw new Error('No method named "' + config + '"');
213
+ if (typeof data[config] === 'undefined') {
214
+ throw new Error("No method named \"" + config + "\"");
212
215
  }
216
+
213
217
  data[config]();
214
218
  }
215
219
  });
216
220
  };
217
221
 
218
222
  _createClass(Tab, null, [{
219
- key: 'VERSION',
223
+ key: "VERSION",
220
224
  get: function get() {
221
225
  return VERSION;
222
226
  }
@@ -224,18 +228,18 @@ var Tab = function ($) {
224
228
 
225
229
  return Tab;
226
230
  }();
227
-
228
231
  /**
229
232
  * ------------------------------------------------------------------------
230
233
  * Data Api implementation
231
234
  * ------------------------------------------------------------------------
232
235
  */
233
236
 
237
+
234
238
  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
235
239
  event.preventDefault();
240
+
236
241
  Tab._jQueryInterface.call($(this), 'show');
237
242
  });
238
-
239
243
  /**
240
244
  * ------------------------------------------------------------------------
241
245
  * jQuery
@@ -244,10 +248,11 @@ var Tab = function ($) {
244
248
 
245
249
  $.fn[NAME] = Tab._jQueryInterface;
246
250
  $.fn[NAME].Constructor = Tab;
251
+
247
252
  $.fn[NAME].noConflict = function () {
248
253
  $.fn[NAME] = JQUERY_NO_CONFLICT;
249
254
  return Tab._jQueryInterface;
250
255
  };
251
256
 
252
257
  return Tab;
253
- }(jQuery);
258
+ }($);
@@ -1,18 +1,14 @@
1
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1
+ 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); } }
2
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"); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6
4
 
7
5
  /**
8
6
  * --------------------------------------------------------------------------
9
- * Bootstrap (v4.0.0-beta): tooltip.js
7
+ * Bootstrap (v4.0.0-beta.2): tooltip.js
10
8
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
9
  * --------------------------------------------------------------------------
12
10
  */
13
-
14
- var Tooltip = function ($) {
15
-
11
+ var Tooltip = function () {
16
12
  /**
17
13
  * Check for Popper dependency
18
14
  * Popper - https://popper.js.org
@@ -20,22 +16,21 @@ var Tooltip = function ($) {
20
16
  if (typeof Popper === 'undefined') {
21
17
  throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)');
22
18
  }
23
-
24
19
  /**
25
20
  * ------------------------------------------------------------------------
26
21
  * Constants
27
22
  * ------------------------------------------------------------------------
28
23
  */
29
24
 
25
+
30
26
  var NAME = 'tooltip';
31
- var VERSION = '4.0.0-beta';
27
+ var VERSION = '4.0.0-beta.2';
32
28
  var DATA_KEY = 'bs.tooltip';
33
- var EVENT_KEY = '.' + DATA_KEY;
29
+ var EVENT_KEY = "." + DATA_KEY;
34
30
  var JQUERY_NO_CONFLICT = $.fn[NAME];
35
31
  var TRANSITION_DURATION = 150;
36
32
  var CLASS_PREFIX = 'bs-tooltip';
37
- var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
38
-
33
+ var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
39
34
  var DefaultType = {
40
35
  animation: 'boolean',
41
36
  template: 'string',
@@ -49,7 +44,6 @@ var Tooltip = function ($) {
49
44
  container: '(string|element|boolean)',
50
45
  fallbackPlacement: '(string|array)'
51
46
  };
52
-
53
47
  var AttachmentMap = {
54
48
  AUTO: 'auto',
55
49
  TOP: 'top',
@@ -57,7 +51,6 @@ var Tooltip = function ($) {
57
51
  BOTTOM: 'bottom',
58
52
  LEFT: 'left'
59
53
  };
60
-
61
54
  var Default = {
62
55
  animation: true,
63
56
  template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
@@ -71,42 +64,36 @@ var Tooltip = function ($) {
71
64
  container: false,
72
65
  fallbackPlacement: 'flip'
73
66
  };
74
-
75
67
  var HoverState = {
76
68
  SHOW: 'show',
77
69
  OUT: 'out'
78
70
  };
79
-
80
71
  var Event = {
81
- HIDE: 'hide' + EVENT_KEY,
82
- HIDDEN: 'hidden' + EVENT_KEY,
83
- SHOW: 'show' + EVENT_KEY,
84
- SHOWN: 'shown' + EVENT_KEY,
85
- INSERTED: 'inserted' + EVENT_KEY,
86
- CLICK: 'click' + EVENT_KEY,
87
- FOCUSIN: 'focusin' + EVENT_KEY,
88
- FOCUSOUT: 'focusout' + EVENT_KEY,
89
- MOUSEENTER: 'mouseenter' + EVENT_KEY,
90
- MOUSELEAVE: 'mouseleave' + EVENT_KEY
72
+ HIDE: "hide" + EVENT_KEY,
73
+ HIDDEN: "hidden" + EVENT_KEY,
74
+ SHOW: "show" + EVENT_KEY,
75
+ SHOWN: "shown" + EVENT_KEY,
76
+ INSERTED: "inserted" + EVENT_KEY,
77
+ CLICK: "click" + EVENT_KEY,
78
+ FOCUSIN: "focusin" + EVENT_KEY,
79
+ FOCUSOUT: "focusout" + EVENT_KEY,
80
+ MOUSEENTER: "mouseenter" + EVENT_KEY,
81
+ MOUSELEAVE: "mouseleave" + EVENT_KEY
91
82
  };
92
-
93
83
  var ClassName = {
94
84
  FADE: 'fade',
95
85
  SHOW: 'show'
96
86
  };
97
-
98
87
  var Selector = {
99
88
  TOOLTIP: '.tooltip',
100
89
  TOOLTIP_INNER: '.tooltip-inner',
101
90
  ARROW: '.arrow'
102
91
  };
103
-
104
92
  var Trigger = {
105
93
  HOVER: 'hover',
106
94
  FOCUS: 'focus',
107
95
  CLICK: 'click',
108
96
  MANUAL: 'manual'
109
-
110
97
  /**
111
98
  * ------------------------------------------------------------------------
112
99
  * Class Definition
@@ -114,42 +101,46 @@ var Tooltip = function ($) {
114
101
  */
115
102
 
116
103
  };
117
- var Tooltip = function () {
118
- function Tooltip(element, config) {
119
- _classCallCheck(this, Tooltip);
120
104
 
105
+ var Tooltip =
106
+ /*#__PURE__*/
107
+ function () {
108
+ function Tooltip(element, config) {
121
109
  // private
122
110
  this._isEnabled = true;
123
111
  this._timeout = 0;
124
112
  this._hoverState = '';
125
113
  this._activeTrigger = {};
126
- this._popper = null;
114
+ this._popper = null; // protected
127
115
 
128
- // protected
129
116
  this.element = element;
130
117
  this.config = this._getConfig(config);
131
118
  this.tip = null;
132
119
 
133
120
  this._setListeners();
134
- }
121
+ } // getters
135
122
 
136
- // getters
137
123
 
138
- // public
124
+ var _proto = Tooltip.prototype;
139
125
 
140
- Tooltip.prototype.enable = function enable() {
126
+ // public
127
+ _proto.enable = function enable() {
141
128
  this._isEnabled = true;
142
129
  };
143
130
 
144
- Tooltip.prototype.disable = function disable() {
131
+ _proto.disable = function disable() {
145
132
  this._isEnabled = false;
146
133
  };
147
134
 
148
- Tooltip.prototype.toggleEnabled = function toggleEnabled() {
135
+ _proto.toggleEnabled = function toggleEnabled() {
149
136
  this._isEnabled = !this._isEnabled;
150
137
  };
151
138
 
152
- Tooltip.prototype.toggle = function toggle(event) {
139
+ _proto.toggle = function toggle(event) {
140
+ if (!this._isEnabled) {
141
+ return;
142
+ }
143
+
153
144
  if (event) {
154
145
  var dataKey = this.constructor.DATA_KEY;
155
146
  var context = $(event.currentTarget).data(dataKey);
@@ -167,9 +158,9 @@ var Tooltip = function ($) {
167
158
  context._leave(null, context);
168
159
  }
169
160
  } else {
170
-
171
161
  if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
172
162
  this._leave(null, this);
163
+
173
164
  return;
174
165
  }
175
166
 
@@ -177,11 +168,9 @@ var Tooltip = function ($) {
177
168
  }
178
169
  };
179
170
 
180
- Tooltip.prototype.dispose = function dispose() {
171
+ _proto.dispose = function dispose() {
181
172
  clearTimeout(this._timeout);
182
-
183
173
  $.removeData(this.element, this.constructor.DATA_KEY);
184
-
185
174
  $(this.element).off(this.constructor.EVENT_KEY);
186
175
  $(this.element).closest('.modal').off('hide.bs.modal');
187
176
 
@@ -193,17 +182,18 @@ var Tooltip = function ($) {
193
182
  this._timeout = null;
194
183
  this._hoverState = null;
195
184
  this._activeTrigger = null;
185
+
196
186
  if (this._popper !== null) {
197
187
  this._popper.destroy();
198
188
  }
199
- this._popper = null;
200
189
 
190
+ this._popper = null;
201
191
  this.element = null;
202
192
  this.config = null;
203
193
  this.tip = null;
204
194
  };
205
195
 
206
- Tooltip.prototype.show = function show() {
196
+ _proto.show = function show() {
207
197
  var _this = this;
208
198
 
209
199
  if ($(this.element).css('display') === 'none') {
@@ -211,9 +201,9 @@ var Tooltip = function ($) {
211
201
  }
212
202
 
213
203
  var showEvent = $.Event(this.constructor.Event.SHOW);
204
+
214
205
  if (this.isWithContent() && this._isEnabled) {
215
206
  $(this.element).trigger(showEvent);
216
-
217
207
  var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
218
208
 
219
209
  if (showEvent.isDefaultPrevented() || !isInTheDom) {
@@ -222,10 +212,8 @@ var Tooltip = function ($) {
222
212
 
223
213
  var tip = this.getTipElement();
224
214
  var tipId = Util.getUID(this.constructor.NAME);
225
-
226
215
  tip.setAttribute('id', tipId);
227
216
  this.element.setAttribute('aria-describedby', tipId);
228
-
229
217
  this.setContent();
230
218
 
231
219
  if (this.config.animation) {
@@ -235,10 +223,9 @@ var Tooltip = function ($) {
235
223
  var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
236
224
 
237
225
  var attachment = this._getAttachment(placement);
238
- this.addAttachmentClass(attachment);
239
226
 
227
+ this.addAttachmentClass(attachment);
240
228
  var container = this.config.container === false ? document.body : $(this.config.container);
241
-
242
229
  $(tip).data(this.constructor.DATA_KEY, this);
243
230
 
244
231
  if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
@@ -246,7 +233,6 @@ var Tooltip = function ($) {
246
233
  }
247
234
 
248
235
  $(this.element).trigger(this.constructor.Event.INSERTED);
249
-
250
236
  this._popper = new Popper(this.element, tip, {
251
237
  placement: attachment,
252
238
  modifiers: {
@@ -269,13 +255,11 @@ var Tooltip = function ($) {
269
255
  _this._handlePopperPlacementChange(data);
270
256
  }
271
257
  });
272
-
273
- $(tip).addClass(ClassName.SHOW);
274
-
275
- // if this is a touch-enabled device we add extra
258
+ $(tip).addClass(ClassName.SHOW); // if this is a touch-enabled device we add extra
276
259
  // empty mouseover listeners to the body's immediate children;
277
260
  // only needed because of broken event delegation on iOS
278
261
  // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
262
+
279
263
  if ('ontouchstart' in document.documentElement) {
280
264
  $('body').children().on('mouseover', null, $.noop);
281
265
  }
@@ -284,9 +268,9 @@ var Tooltip = function ($) {
284
268
  if (_this.config.animation) {
285
269
  _this._fixTransition();
286
270
  }
271
+
287
272
  var prevHoverState = _this._hoverState;
288
273
  _this._hoverState = null;
289
-
290
274
  $(_this.element).trigger(_this.constructor.Event.SHOWN);
291
275
 
292
276
  if (prevHoverState === HoverState.OUT) {
@@ -302,19 +286,23 @@ var Tooltip = function ($) {
302
286
  }
303
287
  };
304
288
 
305
- Tooltip.prototype.hide = function hide(callback) {
289
+ _proto.hide = function hide(callback) {
306
290
  var _this2 = this;
307
291
 
308
292
  var tip = this.getTipElement();
309
293
  var hideEvent = $.Event(this.constructor.Event.HIDE);
294
+
310
295
  var complete = function complete() {
311
296
  if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
312
297
  tip.parentNode.removeChild(tip);
313
298
  }
314
299
 
315
300
  _this2._cleanTipClass();
301
+
316
302
  _this2.element.removeAttribute('aria-describedby');
303
+
317
304
  $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
305
+
318
306
  if (_this2._popper !== null) {
319
307
  _this2._popper.destroy();
320
308
  }
@@ -330,10 +318,9 @@ var Tooltip = function ($) {
330
318
  return;
331
319
  }
332
320
 
333
- $(tip).removeClass(ClassName.SHOW);
334
-
335
- // if this is a touch-enabled device we remove the extra
321
+ $(tip).removeClass(ClassName.SHOW); // if this is a touch-enabled device we remove the extra
336
322
  // empty mouseover listeners we added for iOS support
323
+
337
324
  if ('ontouchstart' in document.documentElement) {
338
325
  $('body').children().off('mouseover', null, $.noop);
339
326
  }
@@ -343,7 +330,6 @@ var Tooltip = function ($) {
343
330
  this._activeTrigger[Trigger.HOVER] = false;
344
331
 
345
332
  if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
346
-
347
333
  $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
348
334
  } else {
349
335
  complete();
@@ -352,35 +338,36 @@ var Tooltip = function ($) {
352
338
  this._hoverState = '';
353
339
  };
354
340
 
355
- Tooltip.prototype.update = function update() {
341
+ _proto.update = function update() {
356
342
  if (this._popper !== null) {
357
343
  this._popper.scheduleUpdate();
358
344
  }
359
- };
345
+ }; // protected
360
346
 
361
- // protected
362
347
 
363
- Tooltip.prototype.isWithContent = function isWithContent() {
348
+ _proto.isWithContent = function isWithContent() {
364
349
  return Boolean(this.getTitle());
365
350
  };
366
351
 
367
- Tooltip.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
368
- $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
352
+ _proto.addAttachmentClass = function addAttachmentClass(attachment) {
353
+ $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
369
354
  };
370
355
 
371
- Tooltip.prototype.getTipElement = function getTipElement() {
372
- return this.tip = this.tip || $(this.config.template)[0];
356
+ _proto.getTipElement = function getTipElement() {
357
+ this.tip = this.tip || $(this.config.template)[0];
358
+ return this.tip;
373
359
  };
374
360
 
375
- Tooltip.prototype.setContent = function setContent() {
361
+ _proto.setContent = function setContent() {
376
362
  var $tip = $(this.getTipElement());
377
363
  this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
378
- $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
364
+ $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
379
365
  };
380
366
 
381
- Tooltip.prototype.setElementContent = function setElementContent($element, content) {
367
+ _proto.setElementContent = function setElementContent($element, content) {
382
368
  var html = this.config.html;
383
- if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
369
+
370
+ if (typeof content === 'object' && (content.nodeType || content.jquery)) {
384
371
  // content is a DOM node or a jQuery
385
372
  if (html) {
386
373
  if (!$(content).parent().is($element)) {
@@ -394,7 +381,7 @@ var Tooltip = function ($) {
394
381
  }
395
382
  };
396
383
 
397
- Tooltip.prototype.getTitle = function getTitle() {
384
+ _proto.getTitle = function getTitle() {
398
385
  var title = this.element.getAttribute('data-original-title');
399
386
 
400
387
  if (!title) {
@@ -402,19 +389,17 @@ var Tooltip = function ($) {
402
389
  }
403
390
 
404
391
  return title;
405
- };
392
+ }; // private
406
393
 
407
- // private
408
394
 
409
- Tooltip.prototype._getAttachment = function _getAttachment(placement) {
395
+ _proto._getAttachment = function _getAttachment(placement) {
410
396
  return AttachmentMap[placement.toUpperCase()];
411
397
  };
412
398
 
413
- Tooltip.prototype._setListeners = function _setListeners() {
399
+ _proto._setListeners = function _setListeners() {
414
400
  var _this3 = this;
415
401
 
416
402
  var triggers = this.config.trigger.split(' ');
417
-
418
403
  triggers.forEach(function (trigger) {
419
404
  if (trigger === 'click') {
420
405
  $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
@@ -423,7 +408,6 @@ var Tooltip = function ($) {
423
408
  } else if (trigger !== Trigger.MANUAL) {
424
409
  var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
425
410
  var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
426
-
427
411
  $(_this3.element).on(eventIn, _this3.config.selector, function (event) {
428
412
  return _this3._enter(event);
429
413
  }).on(eventOut, _this3.config.selector, function (event) {
@@ -446,17 +430,17 @@ var Tooltip = function ($) {
446
430
  }
447
431
  };
448
432
 
449
- Tooltip.prototype._fixTitle = function _fixTitle() {
450
- var titleType = _typeof(this.element.getAttribute('data-original-title'));
433
+ _proto._fixTitle = function _fixTitle() {
434
+ var titleType = typeof this.element.getAttribute('data-original-title');
435
+
451
436
  if (this.element.getAttribute('title') || titleType !== 'string') {
452
437
  this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
453
438
  this.element.setAttribute('title', '');
454
439
  }
455
440
  };
456
441
 
457
- Tooltip.prototype._enter = function _enter(event, context) {
442
+ _proto._enter = function _enter(event, context) {
458
443
  var dataKey = this.constructor.DATA_KEY;
459
-
460
444
  context = context || $(event.currentTarget).data(dataKey);
461
445
 
462
446
  if (!context) {
@@ -474,7 +458,6 @@ var Tooltip = function ($) {
474
458
  }
475
459
 
476
460
  clearTimeout(context._timeout);
477
-
478
461
  context._hoverState = HoverState.SHOW;
479
462
 
480
463
  if (!context.config.delay || !context.config.delay.show) {
@@ -489,9 +472,8 @@ var Tooltip = function ($) {
489
472
  }, context.config.delay.show);
490
473
  };
491
474
 
492
- Tooltip.prototype._leave = function _leave(event, context) {
475
+ _proto._leave = function _leave(event, context) {
493
476
  var dataKey = this.constructor.DATA_KEY;
494
-
495
477
  context = context || $(event.currentTarget).data(dataKey);
496
478
 
497
479
  if (!context) {
@@ -508,7 +490,6 @@ var Tooltip = function ($) {
508
490
  }
509
491
 
510
492
  clearTimeout(context._timeout);
511
-
512
493
  context._hoverState = HoverState.OUT;
513
494
 
514
495
  if (!context.config.delay || !context.config.delay.hide) {
@@ -523,7 +504,7 @@ var Tooltip = function ($) {
523
504
  }, context.config.delay.hide);
524
505
  };
525
506
 
526
- Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
507
+ _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
527
508
  for (var trigger in this._activeTrigger) {
528
509
  if (this._activeTrigger[trigger]) {
529
510
  return true;
@@ -533,30 +514,29 @@ var Tooltip = function ($) {
533
514
  return false;
534
515
  };
535
516
 
536
- Tooltip.prototype._getConfig = function _getConfig(config) {
517
+ _proto._getConfig = function _getConfig(config) {
537
518
  config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
538
519
 
539
- if (config.delay && typeof config.delay === 'number') {
520
+ if (typeof config.delay === 'number') {
540
521
  config.delay = {
541
522
  show: config.delay,
542
523
  hide: config.delay
543
524
  };
544
525
  }
545
526
 
546
- if (config.title && typeof config.title === 'number') {
527
+ if (typeof config.title === 'number') {
547
528
  config.title = config.title.toString();
548
529
  }
549
530
 
550
- if (config.content && typeof config.content === 'number') {
531
+ if (typeof config.content === 'number') {
551
532
  config.content = config.content.toString();
552
533
  }
553
534
 
554
535
  Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
555
-
556
536
  return config;
557
537
  };
558
538
 
559
- Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
539
+ _proto._getDelegateConfig = function _getDelegateConfig() {
560
540
  var config = {};
561
541
 
562
542
  if (this.config) {
@@ -570,38 +550,42 @@ var Tooltip = function ($) {
570
550
  return config;
571
551
  };
572
552
 
573
- Tooltip.prototype._cleanTipClass = function _cleanTipClass() {
553
+ _proto._cleanTipClass = function _cleanTipClass() {
574
554
  var $tip = $(this.getTipElement());
575
555
  var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
556
+
576
557
  if (tabClass !== null && tabClass.length > 0) {
577
558
  $tip.removeClass(tabClass.join(''));
578
559
  }
579
560
  };
580
561
 
581
- Tooltip.prototype._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
562
+ _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
582
563
  this._cleanTipClass();
564
+
583
565
  this.addAttachmentClass(this._getAttachment(data.placement));
584
566
  };
585
567
 
586
- Tooltip.prototype._fixTransition = function _fixTransition() {
568
+ _proto._fixTransition = function _fixTransition() {
587
569
  var tip = this.getTipElement();
588
570
  var initConfigAnimation = this.config.animation;
571
+
589
572
  if (tip.getAttribute('x-placement') !== null) {
590
573
  return;
591
574
  }
575
+
592
576
  $(tip).removeClass(ClassName.FADE);
593
577
  this.config.animation = false;
594
578
  this.hide();
595
579
  this.show();
596
580
  this.config.animation = initConfigAnimation;
597
- };
581
+ }; // static
598
582
 
599
- // static
600
583
 
601
584
  Tooltip._jQueryInterface = function _jQueryInterface(config) {
602
585
  return this.each(function () {
603
586
  var data = $(this).data(DATA_KEY);
604
- var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
587
+
588
+ var _config = typeof config === 'object' && config;
605
589
 
606
590
  if (!data && /dispose|hide/.test(config)) {
607
591
  return;
@@ -613,46 +597,47 @@ var Tooltip = function ($) {
613
597
  }
614
598
 
615
599
  if (typeof config === 'string') {
616
- if (data[config] === undefined) {
617
- throw new Error('No method named "' + config + '"');
600
+ if (typeof data[config] === 'undefined') {
601
+ throw new Error("No method named \"" + config + "\"");
618
602
  }
603
+
619
604
  data[config]();
620
605
  }
621
606
  });
622
607
  };
623
608
 
624
609
  _createClass(Tooltip, null, [{
625
- key: 'VERSION',
610
+ key: "VERSION",
626
611
  get: function get() {
627
612
  return VERSION;
628
613
  }
629
614
  }, {
630
- key: 'Default',
615
+ key: "Default",
631
616
  get: function get() {
632
617
  return Default;
633
618
  }
634
619
  }, {
635
- key: 'NAME',
620
+ key: "NAME",
636
621
  get: function get() {
637
622
  return NAME;
638
623
  }
639
624
  }, {
640
- key: 'DATA_KEY',
625
+ key: "DATA_KEY",
641
626
  get: function get() {
642
627
  return DATA_KEY;
643
628
  }
644
629
  }, {
645
- key: 'Event',
630
+ key: "Event",
646
631
  get: function get() {
647
632
  return Event;
648
633
  }
649
634
  }, {
650
- key: 'EVENT_KEY',
635
+ key: "EVENT_KEY",
651
636
  get: function get() {
652
637
  return EVENT_KEY;
653
638
  }
654
639
  }, {
655
- key: 'DefaultType',
640
+ key: "DefaultType",
656
641
  get: function get() {
657
642
  return DefaultType;
658
643
  }
@@ -660,19 +645,20 @@ var Tooltip = function ($) {
660
645
 
661
646
  return Tooltip;
662
647
  }();
663
-
664
648
  /**
665
649
  * ------------------------------------------------------------------------
666
650
  * jQuery
667
651
  * ------------------------------------------------------------------------
668
652
  */
669
653
 
654
+
670
655
  $.fn[NAME] = Tooltip._jQueryInterface;
671
656
  $.fn[NAME].Constructor = Tooltip;
657
+
672
658
  $.fn[NAME].noConflict = function () {
673
659
  $.fn[NAME] = JQUERY_NO_CONFLICT;
674
660
  return Tooltip._jQueryInterface;
675
661
  };
676
662
 
677
663
  return Tooltip;
678
- }(jQuery); /* global Popper */
664
+ }($, Popper);