bootstrap 5.0.0.beta1 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +3 -3
  4. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  5. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  6. data/assets/javascripts/bootstrap-sprockets.js +3 -0
  7. data/assets/javascripts/bootstrap.js +429 -486
  8. data/assets/javascripts/bootstrap.min.js +3 -3
  9. data/assets/javascripts/bootstrap/alert.js +81 -80
  10. data/assets/javascripts/bootstrap/base-component.js +75 -0
  11. data/assets/javascripts/bootstrap/button.js +60 -72
  12. data/assets/javascripts/bootstrap/carousel.js +131 -110
  13. data/assets/javascripts/bootstrap/collapse.js +94 -77
  14. data/assets/javascripts/bootstrap/dom/data.js +3 -3
  15. data/assets/javascripts/bootstrap/dom/event-handler.js +6 -5
  16. data/assets/javascripts/bootstrap/dom/manipulator.js +3 -3
  17. data/assets/javascripts/bootstrap/dom/selector-engine.js +6 -11
  18. data/assets/javascripts/bootstrap/dropdown.js +159 -90
  19. data/assets/javascripts/bootstrap/modal.js +132 -125
  20. data/assets/javascripts/bootstrap/popover.js +73 -25
  21. data/assets/javascripts/bootstrap/scrollspy.js +93 -76
  22. data/assets/javascripts/bootstrap/tab.js +78 -82
  23. data/assets/javascripts/bootstrap/toast.js +79 -75
  24. data/assets/javascripts/bootstrap/tooltip.js +207 -185
  25. data/assets/stylesheets/_bootstrap-grid.scss +3 -3
  26. data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
  27. data/assets/stylesheets/_bootstrap.scss +3 -3
  28. data/assets/stylesheets/bootstrap/_accordion.scss +1 -0
  29. data/assets/stylesheets/bootstrap/_alert.scss +6 -6
  30. data/assets/stylesheets/bootstrap/_carousel.scss +12 -6
  31. data/assets/stylesheets/bootstrap/_close.scss +1 -1
  32. data/assets/stylesheets/bootstrap/_dropdown.scss +29 -15
  33. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  34. data/assets/stylesheets/bootstrap/_nav.scss +5 -0
  35. data/assets/stylesheets/bootstrap/_navbar.scss +12 -1
  36. data/assets/stylesheets/bootstrap/_pagination.scss +2 -2
  37. data/assets/stylesheets/bootstrap/_popover.scss +0 -15
  38. data/assets/stylesheets/bootstrap/_reboot.scss +6 -6
  39. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  40. data/assets/stylesheets/bootstrap/_toasts.scss +1 -0
  41. data/assets/stylesheets/bootstrap/_utilities.scss +6 -0
  42. data/assets/stylesheets/bootstrap/_variables.scss +30 -7
  43. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +5 -5
  44. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -0
  45. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  46. data/assets/stylesheets/bootstrap/forms/_form-select.scss +1 -2
  47. data/assets/stylesheets/bootstrap/forms/_validation.scss +1 -1
  48. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  49. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +1 -1
  50. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +4 -4
  51. data/assets/stylesheets/bootstrap/mixins/_forms.scss +13 -6
  52. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +4 -0
  53. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +3 -2
  54. data/assets/stylesheets/bootstrap/utilities/_api.scss +1 -1
  55. data/bootstrap.gemspec +1 -3
  56. data/lib/bootstrap/version.rb +2 -2
  57. data/tasks/updater/js.rb +15 -2
  58. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  59. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  60. data/test/dummy_rails/app/views/pages/root.html +89 -0
  61. data/test/dummy_rails/config/application.rb +0 -3
  62. data/test/gemfiles/rails_6_1.gemfile +7 -0
  63. metadata +13 -36
  64. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap data.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap data.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta1): dom/data.js
14
+ * Bootstrap (v5.0.0-beta2): dom/data.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap event-handler.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap event-handler.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta1): util/index.js
14
+ * Bootstrap (v5.0.0-beta2): util/index.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -27,11 +27,11 @@
27
27
  return null;
28
28
  };
29
29
 
30
- var isRTL = document.documentElement.dir === 'rtl';
30
+ document.documentElement.dir === 'rtl';
31
31
 
32
32
  /**
33
33
  * --------------------------------------------------------------------------
34
- * Bootstrap (v5.0.0-beta1): dom/event-handler.js
34
+ * Bootstrap (v5.0.0-beta2): dom/event-handler.js
35
35
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
36
36
  * --------------------------------------------------------------------------
37
37
  */
@@ -91,6 +91,7 @@
91
91
  event.delegateTarget = target;
92
92
 
93
93
  if (handler.oneOff) {
94
+ // eslint-disable-next-line unicorn/consistent-destructuring
94
95
  EventHandler.off(element, event.type, fn);
95
96
  }
96
97
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap manipulator.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap manipulator.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta1): dom/manipulator.js
14
+ * Bootstrap (v5.0.0-beta2): dom/manipulator.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap selector-engine.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap selector-engine.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta1): dom/selector-engine.js
14
+ * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -23,9 +23,6 @@
23
23
  */
24
24
  var NODE_TEXT = 3;
25
25
  var SelectorEngine = {
26
- matches: function matches(element, selector) {
27
- return element.matches(selector);
28
- },
29
26
  find: function find(selector, element) {
30
27
  var _ref;
31
28
 
@@ -45,9 +42,7 @@
45
42
  children: function children(element, selector) {
46
43
  var _ref2;
47
44
 
48
- var children = (_ref2 = []).concat.apply(_ref2, element.children);
49
-
50
- return children.filter(function (child) {
45
+ return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) {
51
46
  return child.matches(selector);
52
47
  });
53
48
  },
@@ -56,7 +51,7 @@
56
51
  var ancestor = element.parentNode;
57
52
 
58
53
  while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
59
- if (this.matches(ancestor, selector)) {
54
+ if (ancestor.matches(selector)) {
60
55
  parents.push(ancestor);
61
56
  }
62
57
 
@@ -82,7 +77,7 @@
82
77
  var next = element.nextElementSibling;
83
78
 
84
79
  while (next) {
85
- if (this.matches(next, selector)) {
80
+ if (next.matches(selector)) {
86
81
  return [next];
87
82
  }
88
83
 
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * Bootstrap dropdown.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap dropdown.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
8
- typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
10
- }(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
10
+ }(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
@@ -36,10 +36,61 @@
36
36
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
37
37
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
38
38
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
39
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
40
+
41
+ function _defineProperties(target, props) {
42
+ for (var i = 0; i < props.length; i++) {
43
+ var descriptor = props[i];
44
+ descriptor.enumerable = descriptor.enumerable || false;
45
+ descriptor.configurable = true;
46
+ if ("value" in descriptor) descriptor.writable = true;
47
+ Object.defineProperty(target, descriptor.key, descriptor);
48
+ }
49
+ }
50
+
51
+ function _createClass(Constructor, protoProps, staticProps) {
52
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
53
+ if (staticProps) _defineProperties(Constructor, staticProps);
54
+ return Constructor;
55
+ }
56
+
57
+ function _extends() {
58
+ _extends = Object.assign || function (target) {
59
+ for (var i = 1; i < arguments.length; i++) {
60
+ var source = arguments[i];
61
+
62
+ for (var key in source) {
63
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
64
+ target[key] = source[key];
65
+ }
66
+ }
67
+ }
68
+
69
+ return target;
70
+ };
71
+
72
+ return _extends.apply(this, arguments);
73
+ }
74
+
75
+ function _inheritsLoose(subClass, superClass) {
76
+ subClass.prototype = Object.create(superClass.prototype);
77
+ subClass.prototype.constructor = subClass;
78
+
79
+ _setPrototypeOf(subClass, superClass);
80
+ }
81
+
82
+ function _setPrototypeOf(o, p) {
83
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
84
+ o.__proto__ = p;
85
+ return o;
86
+ };
87
+
88
+ return _setPrototypeOf(o, p);
89
+ }
39
90
 
40
91
  /**
41
92
  * --------------------------------------------------------------------------
42
- * Bootstrap (v5.0.0-beta1): util/index.js
93
+ * Bootstrap (v5.0.0-beta2): util/index.js
43
94
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
44
95
  * --------------------------------------------------------------------------
45
96
  */
@@ -56,7 +107,20 @@
56
107
  var selector = element.getAttribute('data-bs-target');
57
108
 
58
109
  if (!selector || selector === '#') {
59
- var hrefAttr = element.getAttribute('href');
110
+ var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
111
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
112
+ // `document.querySelector` will rightfully complain it is invalid.
113
+ // See https://github.com/twbs/bootstrap/issues/32273
114
+
115
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
116
+ return null;
117
+ } // Just in case some CMS puts out a full URL with the anchor appended
118
+
119
+
120
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
121
+ hrefAttr = '#' + hrefAttr.split('#')[1];
122
+ }
123
+
60
124
  selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
61
125
  }
62
126
 
@@ -79,7 +143,7 @@
79
143
  var valueType = value && isElement(value) ? 'element' : toType(value);
80
144
 
81
145
  if (!new RegExp(expectedTypes).test(valueType)) {
82
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
146
+ throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
83
147
  }
84
148
  });
85
149
  };
@@ -123,57 +187,24 @@
123
187
 
124
188
  var isRTL = document.documentElement.dir === 'rtl';
125
189
 
126
- 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); } }
127
-
128
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
129
- /**
130
- * ------------------------------------------------------------------------
131
- * Constants
132
- * ------------------------------------------------------------------------
133
- */
134
-
135
- var VERSION = '5.0.0-beta1';
136
-
137
- var BaseComponent = /*#__PURE__*/function () {
138
- function BaseComponent(element) {
139
- if (!element) {
140
- return;
141
- }
142
-
143
- this._element = element;
144
- Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
145
- }
146
-
147
- var _proto = BaseComponent.prototype;
148
-
149
- _proto.dispose = function dispose() {
150
- Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
151
- this._element = null;
152
- }
153
- /** Static */
154
- ;
190
+ var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
191
+ onDOMContentLoaded(function () {
192
+ var $ = getjQuery();
193
+ /* istanbul ignore if */
155
194
 
156
- BaseComponent.getInstance = function getInstance(element) {
157
- return Data__default['default'].getData(element, this.DATA_KEY);
158
- };
195
+ if ($) {
196
+ var JQUERY_NO_CONFLICT = $.fn[name];
197
+ $.fn[name] = plugin.jQueryInterface;
198
+ $.fn[name].Constructor = plugin;
159
199
 
160
- _createClass(BaseComponent, null, [{
161
- key: "VERSION",
162
- get: function get() {
163
- return VERSION;
200
+ $.fn[name].noConflict = function () {
201
+ $.fn[name] = JQUERY_NO_CONFLICT;
202
+ return plugin.jQueryInterface;
203
+ };
164
204
  }
165
- }]);
166
-
167
- return BaseComponent;
168
- }();
169
-
170
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
171
-
172
- function _defineProperties$1(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); } }
173
-
174
- function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
205
+ });
206
+ };
175
207
 
176
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
177
208
  /**
178
209
  * ------------------------------------------------------------------------
179
210
  * Constants
@@ -218,7 +249,7 @@
218
249
  var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
219
250
  var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
220
251
  var Default = {
221
- offset: 0,
252
+ offset: [0, 2],
222
253
  flip: true,
223
254
  boundary: 'clippingParents',
224
255
  reference: 'toggle',
@@ -226,12 +257,12 @@
226
257
  popperConfig: null
227
258
  };
228
259
  var DefaultType = {
229
- offset: '(number|string|function)',
260
+ offset: '(array|string|function)',
230
261
  flip: 'boolean',
231
262
  boundary: '(string|element)',
232
- reference: '(string|element)',
263
+ reference: '(string|element|object)',
233
264
  display: 'string',
234
- popperConfig: '(null|object)'
265
+ popperConfig: '(null|object|function)'
235
266
  };
236
267
  /**
237
268
  * ------------------------------------------------------------------------
@@ -292,7 +323,9 @@
292
323
  } // Totally disable Popper for Dropdowns in Navbar
293
324
 
294
325
 
295
- if (!this._inNavbar) {
326
+ if (this._inNavbar) {
327
+ Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'none');
328
+ } else {
296
329
  if (typeof Popper__namespace === 'undefined') {
297
330
  throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
298
331
  }
@@ -307,9 +340,20 @@
307
340
  if (typeof this._config.reference.jquery !== 'undefined') {
308
341
  referenceElement = this._config.reference[0];
309
342
  }
343
+ } else if (typeof this._config.reference === 'object') {
344
+ referenceElement = this._config.reference;
310
345
  }
311
346
 
312
- this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig());
347
+ var popperConfig = this._getPopperConfig();
348
+
349
+ var isDisplayStatic = popperConfig.modifiers.find(function (modifier) {
350
+ return modifier.name === 'applyStyles' && modifier.enabled === false;
351
+ });
352
+ this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
353
+
354
+ if (isDisplayStatic) {
355
+ Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
356
+ }
313
357
  } // If this is a touch-enabled device we add extra
314
358
  // empty mouseover listeners to the body's immediate children;
315
359
  // only needed because of broken event delegation on iOS
@@ -332,7 +376,7 @@
332
376
 
333
377
  this._element.classList.toggle(CLASS_NAME_SHOW);
334
378
 
335
- EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget);
379
+ EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, relatedTarget);
336
380
  };
337
381
 
338
382
  _proto.hide = function hide() {
@@ -340,11 +384,10 @@
340
384
  return;
341
385
  }
342
386
 
343
- var parent = Dropdown.getParentFromElement(this._element);
344
387
  var relatedTarget = {
345
388
  relatedTarget: this._element
346
389
  };
347
- var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
390
+ var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE, relatedTarget);
348
391
 
349
392
  if (hideEvent.defaultPrevented) {
350
393
  return;
@@ -358,7 +401,8 @@
358
401
 
359
402
  this._element.classList.toggle(CLASS_NAME_SHOW);
360
403
 
361
- EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
404
+ Manipulator__default['default'].removeDataAttribute(this._menu, 'popper');
405
+ EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN, relatedTarget);
362
406
  };
363
407
 
364
408
  _proto.dispose = function dispose() {
@@ -397,6 +441,12 @@
397
441
  _proto._getConfig = function _getConfig(config) {
398
442
  config = _extends({}, this.constructor.Default, Manipulator__default['default'].getDataAttributes(this._element), config);
399
443
  typeCheckConfig(NAME, config, this.constructor.DefaultType);
444
+
445
+ if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
446
+ // Popper virtual elements require a getBoundingClientRect method
447
+ throw new TypeError(NAME.toUpperCase() + ": Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.");
448
+ }
449
+
400
450
  return config;
401
451
  };
402
452
 
@@ -429,26 +479,51 @@
429
479
  return this._element.closest("." + CLASS_NAME_NAVBAR) !== null;
430
480
  };
431
481
 
482
+ _proto._getOffset = function _getOffset() {
483
+ var _this3 = this;
484
+
485
+ var offset = this._config.offset;
486
+
487
+ if (typeof offset === 'string') {
488
+ return offset.split(',').map(function (val) {
489
+ return Number.parseInt(val, 10);
490
+ });
491
+ }
492
+
493
+ if (typeof offset === 'function') {
494
+ return function (popperData) {
495
+ return offset(popperData, _this3._element);
496
+ };
497
+ }
498
+
499
+ return offset;
500
+ };
501
+
432
502
  _proto._getPopperConfig = function _getPopperConfig() {
433
- var popperConfig = {
503
+ var defaultBsPopperConfig = {
434
504
  placement: this._getPlacement(),
435
505
  modifiers: [{
436
506
  name: 'preventOverflow',
437
507
  options: {
438
508
  altBoundary: this._config.flip,
439
- rootBoundary: this._config.boundary
509
+ boundary: this._config.boundary
510
+ }
511
+ }, {
512
+ name: 'offset',
513
+ options: {
514
+ offset: this._getOffset()
440
515
  }
441
516
  }]
442
517
  }; // Disable Popper if we have a static display
443
518
 
444
519
  if (this._config.display === 'static') {
445
- popperConfig.modifiers = [{
520
+ defaultBsPopperConfig.modifiers = [{
446
521
  name: 'applyStyles',
447
522
  enabled: false
448
523
  }];
449
524
  }
450
525
 
451
- return _extends({}, popperConfig, this._config.popperConfig);
526
+ return _extends({}, defaultBsPopperConfig, typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig);
452
527
  } // Static
453
528
  ;
454
529
 
@@ -484,7 +559,6 @@
484
559
  var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
485
560
 
486
561
  for (var i = 0, len = toggles.length; i < len; i++) {
487
- var parent = Dropdown.getParentFromElement(toggles[i]);
488
562
  var context = Data__default['default'].getData(toggles[i], DATA_KEY);
489
563
  var relatedTarget = {
490
564
  relatedTarget: toggles[i]
@@ -508,7 +582,7 @@
508
582
  continue;
509
583
  }
510
584
 
511
- var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
585
+ var hideEvent = EventHandler__default['default'].trigger(toggles[i], EVENT_HIDE, relatedTarget);
512
586
 
513
587
  if (hideEvent.defaultPrevented) {
514
588
  continue;
@@ -532,7 +606,8 @@
532
606
 
533
607
  dropdownMenu.classList.remove(CLASS_NAME_SHOW);
534
608
  toggles[i].classList.remove(CLASS_NAME_SHOW);
535
- EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
609
+ Manipulator__default['default'].removeDataAttribute(dropdownMenu, 'popper');
610
+ EventHandler__default['default'].trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
536
611
  }
537
612
  };
538
613
 
@@ -569,6 +644,14 @@
569
644
  return;
570
645
  }
571
646
 
647
+ if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
648
+ var _button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
649
+
650
+ _button.click();
651
+
652
+ return;
653
+ }
654
+
572
655
  if (!isActive || event.key === SPACE_KEY) {
573
656
  Dropdown.clearMenus();
574
657
  return;
@@ -596,7 +679,7 @@
596
679
  items[index].focus();
597
680
  };
598
681
 
599
- _createClass$1(Dropdown, null, [{
682
+ _createClass(Dropdown, null, [{
600
683
  key: "Default",
601
684
  get: function get() {
602
685
  return Default;
@@ -614,7 +697,7 @@
614
697
  }]);
615
698
 
616
699
  return Dropdown;
617
- }(BaseComponent);
700
+ }(BaseComponent__default['default']);
618
701
  /**
619
702
  * ------------------------------------------------------------------------
620
703
  * Data Api implementation
@@ -641,21 +724,7 @@
641
724
  * add .Dropdown to jQuery only if jQuery is present
642
725
  */
643
726
 
644
- onDOMContentLoaded(function () {
645
- var $ = getjQuery();
646
- /* istanbul ignore if */
647
-
648
- if ($) {
649
- var JQUERY_NO_CONFLICT = $.fn[NAME];
650
- $.fn[NAME] = Dropdown.jQueryInterface;
651
- $.fn[NAME].Constructor = Dropdown;
652
-
653
- $.fn[NAME].noConflict = function () {
654
- $.fn[NAME] = JQUERY_NO_CONFLICT;
655
- return Dropdown.jQueryInterface;
656
- };
657
- }
658
- });
727
+ defineJQueryPlugin(NAME, Dropdown);
659
728
 
660
729
  return Dropdown;
661
730