bootstrap 4.6.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/README.md +7 -4
  4. data/assets/javascripts/bootstrap/alert.js +192 -115
  5. data/assets/javascripts/bootstrap/base-component.js +63 -0
  6. data/assets/javascripts/bootstrap/button.js +96 -179
  7. data/assets/javascripts/bootstrap/carousel.js +472 -359
  8. data/assets/javascripts/bootstrap/collapse.js +379 -225
  9. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +472 -355
  14. data/assets/javascripts/bootstrap/modal.js +612 -438
  15. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  16. data/assets/javascripts/bootstrap/popover.js +138 -167
  17. data/assets/javascripts/bootstrap/scrollspy.js +250 -192
  18. data/assets/javascripts/bootstrap/tab.js +241 -144
  19. data/assets/javascripts/bootstrap/toast.js +223 -157
  20. data/assets/javascripts/bootstrap/tooltip.js +651 -487
  21. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  22. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  23. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  24. data/assets/javascripts/bootstrap.js +3277 -2590
  25. data/assets/javascripts/bootstrap.min.js +3 -3
  26. data/assets/stylesheets/_bootstrap-grid.scss +53 -18
  27. data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
  28. data/assets/stylesheets/_bootstrap.scss +18 -10
  29. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  30. data/assets/stylesheets/bootstrap/_alert.scss +15 -10
  31. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  32. data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
  33. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  34. data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
  35. data/assets/stylesheets/bootstrap/_card.scss +20 -91
  36. data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
  37. data/assets/stylesheets/bootstrap/_close.scss +30 -30
  38. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  39. data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
  40. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  41. data/assets/stylesheets/bootstrap/_functions.scss +84 -69
  42. data/assets/stylesheets/bootstrap/_grid.scss +3 -54
  43. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  44. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  45. data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
  46. data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
  47. data/assets/stylesheets/bootstrap/_modal.scss +45 -57
  48. data/assets/stylesheets/bootstrap/_nav.scss +20 -6
  49. data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
  50. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  51. data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
  52. data/assets/stylesheets/bootstrap/_popover.scss +24 -36
  53. data/assets/stylesheets/bootstrap/_progress.scss +5 -4
  54. data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
  55. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  56. data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
  57. data/assets/stylesheets/bootstrap/_tables.scss +79 -114
  58. data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
  59. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  60. data/assets/stylesheets/bootstrap/_transitions.scss +2 -7
  61. data/assets/stylesheets/bootstrap/_type.scss +38 -59
  62. data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
  63. data/assets/stylesheets/bootstrap/_variables.scss +800 -485
  64. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  65. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
  66. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  67. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  71. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  72. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  73. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  74. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  75. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  76. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  77. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  78. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  79. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  80. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  81. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  82. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  83. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  84. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
  85. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  86. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  87. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  88. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  89. data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
  90. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  91. data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
  92. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  93. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  94. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  95. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  96. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  97. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  98. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  99. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
  100. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  101. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  102. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
  103. data/bootstrap.gemspec +1 -3
  104. data/lib/bootstrap/version.rb +2 -2
  105. data/tasks/updater/js.rb +19 -16
  106. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  107. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  108. data/test/dummy_rails/app/views/pages/root.html +89 -0
  109. data/test/dummy_rails/config/application.rb +0 -3
  110. data/test/gemfiles/rails_6_1.gemfile +7 -0
  111. metadata +45 -73
  112. data/assets/javascripts/bootstrap/util.js +0 -189
  113. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  114. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  115. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  116. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  117. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  118. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  119. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  120. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  121. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  122. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  123. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  124. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  125. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  126. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  127. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  128. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  129. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  130. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  131. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  132. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  133. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  134. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  135. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  136. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  137. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  138. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  139. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  140. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  141. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  142. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  143. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  144. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  145. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  146. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  147. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  148. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  149. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,106 +1,234 @@
1
1
  /*!
2
- * Bootstrap collapse.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap collapse.js v5.0.0 (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('jquery'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', './util'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.jQuery, global.Util));
10
- })(this, (function ($, Util) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(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(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
10
+ }(this, (function (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
 
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
14
+ var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+ var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
18
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
19
 
17
- function _defineProperties(target, props) {
18
- for (var i = 0; i < props.length; i++) {
19
- var descriptor = props[i];
20
- descriptor.enumerable = descriptor.enumerable || false;
21
- descriptor.configurable = true;
22
- if ("value" in descriptor) descriptor.writable = true;
23
- Object.defineProperty(target, descriptor.key, descriptor);
20
+ /**
21
+ * --------------------------------------------------------------------------
22
+ * Bootstrap (v5.0.0): util/index.js
23
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
24
+ * --------------------------------------------------------------------------
25
+ */
26
+ const MILLISECONDS_MULTIPLIER = 1000;
27
+ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
28
+
29
+ const toType = obj => {
30
+ if (obj === null || obj === undefined) {
31
+ return `${obj}`;
24
32
  }
25
- }
26
33
 
27
- function _createClass(Constructor, protoProps, staticProps) {
28
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29
- if (staticProps) _defineProperties(Constructor, staticProps);
30
- Object.defineProperty(Constructor, "prototype", {
31
- writable: false
32
- });
33
- return Constructor;
34
- }
34
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
35
+ };
35
36
 
36
- function _extends() {
37
- _extends = Object.assign ? Object.assign.bind() : function (target) {
38
- for (var i = 1; i < arguments.length; i++) {
39
- var source = arguments[i];
37
+ const getSelector = element => {
38
+ let selector = element.getAttribute('data-bs-target');
40
39
 
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
40
+ if (!selector || selector === '#') {
41
+ let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
42
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
43
+ // `document.querySelector` will rightfully complain it is invalid.
44
+ // See https://github.com/twbs/bootstrap/issues/32273
45
+
46
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
47
+ return null;
48
+ } // Just in case some CMS puts out a full URL with the anchor appended
49
+
50
+
51
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
52
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
46
53
  }
47
54
 
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
55
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
56
+ }
57
+
58
+ return selector;
59
+ };
52
60
 
61
+ const getSelectorFromElement = element => {
62
+ const selector = getSelector(element);
63
+
64
+ if (selector) {
65
+ return document.querySelector(selector) ? selector : null;
66
+ }
67
+
68
+ return null;
69
+ };
70
+
71
+ const getElementFromSelector = element => {
72
+ const selector = getSelector(element);
73
+ return selector ? document.querySelector(selector) : null;
74
+ };
75
+
76
+ const getTransitionDurationFromElement = element => {
77
+ if (!element) {
78
+ return 0;
79
+ } // Get transition-duration of the element
80
+
81
+
82
+ let {
83
+ transitionDuration,
84
+ transitionDelay
85
+ } = window.getComputedStyle(element);
86
+ const floatTransitionDuration = Number.parseFloat(transitionDuration);
87
+ const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
88
+
89
+ if (!floatTransitionDuration && !floatTransitionDelay) {
90
+ return 0;
91
+ } // If multiple durations are defined, take the first
92
+
93
+
94
+ transitionDuration = transitionDuration.split(',')[0];
95
+ transitionDelay = transitionDelay.split(',')[0];
96
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
97
+ };
98
+
99
+ const triggerTransitionEnd = element => {
100
+ element.dispatchEvent(new Event(TRANSITION_END));
101
+ };
102
+
103
+ const isElement = obj => (obj[0] || obj).nodeType;
104
+
105
+ const emulateTransitionEnd = (element, duration) => {
106
+ let called = false;
107
+ const durationPadding = 5;
108
+ const emulatedDuration = duration + durationPadding;
109
+
110
+ function listener() {
111
+ called = true;
112
+ element.removeEventListener(TRANSITION_END, listener);
113
+ }
114
+
115
+ element.addEventListener(TRANSITION_END, listener);
116
+ setTimeout(() => {
117
+ if (!called) {
118
+ triggerTransitionEnd(element);
119
+ }
120
+ }, emulatedDuration);
121
+ };
122
+
123
+ const typeCheckConfig = (componentName, config, configTypes) => {
124
+ Object.keys(configTypes).forEach(property => {
125
+ const expectedTypes = configTypes[property];
126
+ const value = config[property];
127
+ const valueType = value && isElement(value) ? 'element' : toType(value);
128
+
129
+ if (!new RegExp(expectedTypes).test(valueType)) {
130
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
131
+ }
132
+ });
133
+ };
134
+
135
+ const reflow = element => element.offsetHeight;
136
+
137
+ const getjQuery = () => {
138
+ const {
139
+ jQuery
140
+ } = window;
141
+
142
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
143
+ return jQuery;
144
+ }
145
+
146
+ return null;
147
+ };
148
+
149
+ const onDOMContentLoaded = callback => {
150
+ if (document.readyState === 'loading') {
151
+ document.addEventListener('DOMContentLoaded', callback);
152
+ } else {
153
+ callback();
154
+ }
155
+ };
156
+
157
+ const defineJQueryPlugin = (name, plugin) => {
158
+ onDOMContentLoaded(() => {
159
+ const $ = getjQuery();
160
+ /* istanbul ignore if */
161
+
162
+ if ($) {
163
+ const JQUERY_NO_CONFLICT = $.fn[name];
164
+ $.fn[name] = plugin.jQueryInterface;
165
+ $.fn[name].Constructor = plugin;
166
+
167
+ $.fn[name].noConflict = () => {
168
+ $.fn[name] = JQUERY_NO_CONFLICT;
169
+ return plugin.jQueryInterface;
170
+ };
171
+ }
172
+ });
173
+ };
174
+
175
+ /**
176
+ * --------------------------------------------------------------------------
177
+ * Bootstrap (v5.0.0): collapse.js
178
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
179
+ * --------------------------------------------------------------------------
180
+ */
53
181
  /**
182
+ * ------------------------------------------------------------------------
54
183
  * Constants
184
+ * ------------------------------------------------------------------------
55
185
  */
56
186
 
57
- var NAME = 'collapse';
58
- var VERSION = '4.6.2';
59
- var DATA_KEY = 'bs.collapse';
60
- var EVENT_KEY = "." + DATA_KEY;
61
- var DATA_API_KEY = '.data-api';
62
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
63
- var CLASS_NAME_SHOW = 'show';
64
- var CLASS_NAME_COLLAPSE = 'collapse';
65
- var CLASS_NAME_COLLAPSING = 'collapsing';
66
- var CLASS_NAME_COLLAPSED = 'collapsed';
67
- var DIMENSION_WIDTH = 'width';
68
- var DIMENSION_HEIGHT = 'height';
69
- var EVENT_SHOW = "show" + EVENT_KEY;
70
- var EVENT_SHOWN = "shown" + EVENT_KEY;
71
- var EVENT_HIDE = "hide" + EVENT_KEY;
72
- var EVENT_HIDDEN = "hidden" + EVENT_KEY;
73
- var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
74
- var SELECTOR_ACTIVES = '.show, .collapsing';
75
- var SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
76
- var Default = {
187
+ const NAME = 'collapse';
188
+ const DATA_KEY = 'bs.collapse';
189
+ const EVENT_KEY = `.${DATA_KEY}`;
190
+ const DATA_API_KEY = '.data-api';
191
+ const Default = {
77
192
  toggle: true,
78
193
  parent: ''
79
194
  };
80
- var DefaultType = {
195
+ const DefaultType = {
81
196
  toggle: 'boolean',
82
197
  parent: '(string|element)'
83
198
  };
199
+ const EVENT_SHOW = `show${EVENT_KEY}`;
200
+ const EVENT_SHOWN = `shown${EVENT_KEY}`;
201
+ const EVENT_HIDE = `hide${EVENT_KEY}`;
202
+ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
203
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
204
+ const CLASS_NAME_SHOW = 'show';
205
+ const CLASS_NAME_COLLAPSE = 'collapse';
206
+ const CLASS_NAME_COLLAPSING = 'collapsing';
207
+ const CLASS_NAME_COLLAPSED = 'collapsed';
208
+ const WIDTH = 'width';
209
+ const HEIGHT = 'height';
210
+ const SELECTOR_ACTIVES = '.show, .collapsing';
211
+ const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
84
212
  /**
85
- * Class definition
213
+ * ------------------------------------------------------------------------
214
+ * Class Definition
215
+ * ------------------------------------------------------------------------
86
216
  */
87
217
 
88
- var Collapse = /*#__PURE__*/function () {
89
- function Collapse(element, config) {
218
+ class Collapse extends BaseComponent__default['default'] {
219
+ constructor(element, config) {
220
+ super(element);
90
221
  this._isTransitioning = false;
91
- this._element = element;
92
222
  this._config = this._getConfig(config);
93
- this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
94
- var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
95
-
96
- for (var i = 0, len = toggleList.length; i < len; i++) {
97
- var elem = toggleList[i];
98
- var selector = Util__default["default"].getSelectorFromElement(elem);
99
- var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
100
- return foundElem === element;
101
- });
223
+ this._triggerArray = SelectorEngine__default['default'].find(`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`);
224
+ const toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
225
+
226
+ for (let i = 0, len = toggleList.length; i < len; i++) {
227
+ const elem = toggleList[i];
228
+ const selector = getSelectorFromElement(elem);
229
+ const filterElement = SelectorEngine__default['default'].find(selector).filter(foundElem => foundElem === this._element);
102
230
 
103
- if (selector !== null && filterElement.length > 0) {
231
+ if (selector !== null && filterElement.length) {
104
232
  this._selector = selector;
105
233
 
106
234
  this._triggerArray.push(elem);
@@ -119,31 +247,35 @@
119
247
  } // Getters
120
248
 
121
249
 
122
- var _proto = Collapse.prototype;
250
+ static get Default() {
251
+ return Default;
252
+ }
253
+
254
+ static get DATA_KEY() {
255
+ return DATA_KEY;
256
+ } // Public
257
+
123
258
 
124
- // Public
125
- _proto.toggle = function toggle() {
126
- if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW)) {
259
+ toggle() {
260
+ if (this._element.classList.contains(CLASS_NAME_SHOW)) {
127
261
  this.hide();
128
262
  } else {
129
263
  this.show();
130
264
  }
131
- };
132
-
133
- _proto.show = function show() {
134
- var _this = this;
265
+ }
135
266
 
136
- if (this._isTransitioning || $__default["default"](this._element).hasClass(CLASS_NAME_SHOW)) {
267
+ show() {
268
+ if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
137
269
  return;
138
270
  }
139
271
 
140
- var actives;
141
- var activesData;
272
+ let actives;
273
+ let activesData;
142
274
 
143
275
  if (this._parent) {
144
- actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
145
- if (typeof _this._config.parent === 'string') {
146
- return elem.getAttribute('data-parent') === _this._config.parent;
276
+ actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(elem => {
277
+ if (typeof this._config.parent === 'string') {
278
+ return elem.getAttribute('data-bs-parent') === this._config.parent;
147
279
  }
148
280
 
149
281
  return elem.classList.contains(CLASS_NAME_COLLAPSE);
@@ -154,243 +286,265 @@
154
286
  }
155
287
  }
156
288
 
289
+ const container = SelectorEngine__default['default'].findOne(this._selector);
290
+
157
291
  if (actives) {
158
- activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY);
292
+ const tempActiveData = actives.find(elem => container !== elem);
293
+ activesData = tempActiveData ? Data__default['default'].get(tempActiveData, DATA_KEY) : null;
159
294
 
160
295
  if (activesData && activesData._isTransitioning) {
161
296
  return;
162
297
  }
163
298
  }
164
299
 
165
- var startEvent = $__default["default"].Event(EVENT_SHOW);
166
- $__default["default"](this._element).trigger(startEvent);
300
+ const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
167
301
 
168
- if (startEvent.isDefaultPrevented()) {
302
+ if (startEvent.defaultPrevented) {
169
303
  return;
170
304
  }
171
305
 
172
306
  if (actives) {
173
- Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide');
307
+ actives.forEach(elemActive => {
308
+ if (container !== elemActive) {
309
+ Collapse.collapseInterface(elemActive, 'hide');
310
+ }
174
311
 
175
- if (!activesData) {
176
- $__default["default"](actives).data(DATA_KEY, null);
177
- }
312
+ if (!activesData) {
313
+ Data__default['default'].set(elemActive, DATA_KEY, null);
314
+ }
315
+ });
178
316
  }
179
317
 
180
- var dimension = this._getDimension();
318
+ const dimension = this._getDimension();
319
+
320
+ this._element.classList.remove(CLASS_NAME_COLLAPSE);
321
+
322
+ this._element.classList.add(CLASS_NAME_COLLAPSING);
181
323
 
182
- $__default["default"](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
183
324
  this._element.style[dimension] = 0;
184
325
 
185
326
  if (this._triggerArray.length) {
186
- $__default["default"](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
327
+ this._triggerArray.forEach(element => {
328
+ element.classList.remove(CLASS_NAME_COLLAPSED);
329
+ element.setAttribute('aria-expanded', true);
330
+ });
187
331
  }
188
332
 
189
333
  this.setTransitioning(true);
190
334
 
191
- var complete = function complete() {
192
- $__default["default"](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
193
- _this._element.style[dimension] = '';
335
+ const complete = () => {
336
+ this._element.classList.remove(CLASS_NAME_COLLAPSING);
194
337
 
195
- _this.setTransitioning(false);
338
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
196
339
 
197
- $__default["default"](_this._element).trigger(EVENT_SHOWN);
340
+ this._element.style[dimension] = '';
341
+ this.setTransitioning(false);
342
+ EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
198
343
  };
199
344
 
200
- var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
201
- var scrollSize = "scroll" + capitalizedDimension;
202
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._element);
203
- $__default["default"](this._element).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
204
- this._element.style[dimension] = this._element[scrollSize] + "px";
205
- };
206
-
207
- _proto.hide = function hide() {
208
- var _this2 = this;
345
+ const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
346
+ const scrollSize = `scroll${capitalizedDimension}`;
347
+ const transitionDuration = getTransitionDurationFromElement(this._element);
348
+ EventHandler__default['default'].one(this._element, 'transitionend', complete);
349
+ emulateTransitionEnd(this._element, transitionDuration);
350
+ this._element.style[dimension] = `${this._element[scrollSize]}px`;
351
+ }
209
352
 
210
- if (this._isTransitioning || !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW)) {
353
+ hide() {
354
+ if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
211
355
  return;
212
356
  }
213
357
 
214
- var startEvent = $__default["default"].Event(EVENT_HIDE);
215
- $__default["default"](this._element).trigger(startEvent);
358
+ const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
216
359
 
217
- if (startEvent.isDefaultPrevented()) {
360
+ if (startEvent.defaultPrevented) {
218
361
  return;
219
362
  }
220
363
 
221
- var dimension = this._getDimension();
364
+ const dimension = this._getDimension();
222
365
 
223
- this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
224
- Util__default["default"].reflow(this._element);
225
- $__default["default"](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
226
- var triggerArrayLength = this._triggerArray.length;
366
+ this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
367
+ reflow(this._element);
227
368
 
228
- if (triggerArrayLength > 0) {
229
- for (var i = 0; i < triggerArrayLength; i++) {
230
- var trigger = this._triggerArray[i];
231
- var selector = Util__default["default"].getSelectorFromElement(trigger);
369
+ this._element.classList.add(CLASS_NAME_COLLAPSING);
370
+
371
+ this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
232
372
 
233
- if (selector !== null) {
234
- var $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector)));
373
+ const triggerArrayLength = this._triggerArray.length;
235
374
 
236
- if (!$elem.hasClass(CLASS_NAME_SHOW)) {
237
- $__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
238
- }
375
+ if (triggerArrayLength > 0) {
376
+ for (let i = 0; i < triggerArrayLength; i++) {
377
+ const trigger = this._triggerArray[i];
378
+ const elem = getElementFromSelector(trigger);
379
+
380
+ if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
381
+ trigger.classList.add(CLASS_NAME_COLLAPSED);
382
+ trigger.setAttribute('aria-expanded', false);
239
383
  }
240
384
  }
241
385
  }
242
386
 
243
387
  this.setTransitioning(true);
244
388
 
245
- var complete = function complete() {
246
- _this2.setTransitioning(false);
389
+ const complete = () => {
390
+ this.setTransitioning(false);
391
+
392
+ this._element.classList.remove(CLASS_NAME_COLLAPSING);
393
+
394
+ this._element.classList.add(CLASS_NAME_COLLAPSE);
247
395
 
248
- $__default["default"](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
396
+ EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
249
397
  };
250
398
 
251
399
  this._element.style[dimension] = '';
252
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._element);
253
- $__default["default"](this._element).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
254
- };
400
+ const transitionDuration = getTransitionDurationFromElement(this._element);
401
+ EventHandler__default['default'].one(this._element, 'transitionend', complete);
402
+ emulateTransitionEnd(this._element, transitionDuration);
403
+ }
255
404
 
256
- _proto.setTransitioning = function setTransitioning(isTransitioning) {
405
+ setTransitioning(isTransitioning) {
257
406
  this._isTransitioning = isTransitioning;
258
- };
407
+ }
259
408
 
260
- _proto.dispose = function dispose() {
261
- $__default["default"].removeData(this._element, DATA_KEY);
409
+ dispose() {
410
+ super.dispose();
262
411
  this._config = null;
263
412
  this._parent = null;
264
- this._element = null;
265
413
  this._triggerArray = null;
266
414
  this._isTransitioning = null;
267
415
  } // Private
268
- ;
269
416
 
270
- _proto._getConfig = function _getConfig(config) {
271
- config = _extends({}, Default, config);
417
+
418
+ _getConfig(config) {
419
+ config = { ...Default,
420
+ ...config
421
+ };
272
422
  config.toggle = Boolean(config.toggle); // Coerce string values
273
423
 
274
- Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
424
+ typeCheckConfig(NAME, config, DefaultType);
275
425
  return config;
276
- };
277
-
278
- _proto._getDimension = function _getDimension() {
279
- var hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH);
280
- return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
281
- };
282
-
283
- _proto._getParent = function _getParent() {
284
- var _this3 = this;
426
+ }
285
427
 
286
- var parent;
428
+ _getDimension() {
429
+ return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
430
+ }
287
431
 
288
- if (Util__default["default"].isElement(this._config.parent)) {
289
- parent = this._config.parent; // It's a jQuery object
432
+ _getParent() {
433
+ let {
434
+ parent
435
+ } = this._config;
290
436
 
291
- if (typeof this._config.parent.jquery !== 'undefined') {
292
- parent = this._config.parent[0];
437
+ if (isElement(parent)) {
438
+ // it's a jQuery object
439
+ if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
440
+ parent = parent[0];
293
441
  }
294
442
  } else {
295
- parent = document.querySelector(this._config.parent);
443
+ parent = SelectorEngine__default['default'].findOne(parent);
296
444
  }
297
445
 
298
- var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
299
- var children = [].slice.call(parent.querySelectorAll(selector));
300
- $__default["default"](children).each(function (i, element) {
301
- _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
446
+ const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
447
+ SelectorEngine__default['default'].find(selector, parent).forEach(element => {
448
+ const selected = getElementFromSelector(element);
449
+
450
+ this._addAriaAndCollapsedClass(selected, [element]);
302
451
  });
303
452
  return parent;
304
- };
305
-
306
- _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
307
- var isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW);
453
+ }
308
454
 
309
- if (triggerArray.length) {
310
- $__default["default"](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
455
+ _addAriaAndCollapsedClass(element, triggerArray) {
456
+ if (!element || !triggerArray.length) {
457
+ return;
311
458
  }
312
- } // Static
313
- ;
314
459
 
315
- Collapse._getTargetFromElement = function _getTargetFromElement(element) {
316
- var selector = Util__default["default"].getSelectorFromElement(element);
317
- return selector ? document.querySelector(selector) : null;
318
- };
460
+ const isOpen = element.classList.contains(CLASS_NAME_SHOW);
461
+ triggerArray.forEach(elem => {
462
+ if (isOpen) {
463
+ elem.classList.remove(CLASS_NAME_COLLAPSED);
464
+ } else {
465
+ elem.classList.add(CLASS_NAME_COLLAPSED);
466
+ }
319
467
 
320
- Collapse._jQueryInterface = function _jQueryInterface(config) {
321
- return this.each(function () {
322
- var $element = $__default["default"](this);
323
- var data = $element.data(DATA_KEY);
468
+ elem.setAttribute('aria-expanded', isOpen);
469
+ });
470
+ } // Static
324
471
 
325
- var _config = _extends({}, Default, $element.data(), typeof config === 'object' && config ? config : {});
326
472
 
327
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
328
- _config.toggle = false;
329
- }
473
+ static collapseInterface(element, config) {
474
+ let data = Data__default['default'].get(element, DATA_KEY);
475
+ const _config = { ...Default,
476
+ ...Manipulator__default['default'].getDataAttributes(element),
477
+ ...(typeof config === 'object' && config ? config : {})
478
+ };
330
479
 
331
- if (!data) {
332
- data = new Collapse(this, _config);
333
- $element.data(DATA_KEY, data);
334
- }
480
+ if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
481
+ _config.toggle = false;
482
+ }
335
483
 
336
- if (typeof config === 'string') {
337
- if (typeof data[config] === 'undefined') {
338
- throw new TypeError("No method named \"" + config + "\"");
339
- }
484
+ if (!data) {
485
+ data = new Collapse(element, _config);
486
+ }
340
487
 
341
- data[config]();
488
+ if (typeof config === 'string') {
489
+ if (typeof data[config] === 'undefined') {
490
+ throw new TypeError(`No method named "${config}"`);
342
491
  }
343
- });
344
- };
345
492
 
346
- _createClass(Collapse, null, [{
347
- key: "VERSION",
348
- get: function get() {
349
- return VERSION;
493
+ data[config]();
350
494
  }
351
- }, {
352
- key: "Default",
353
- get: function get() {
354
- return Default;
355
- }
356
- }]);
495
+ }
496
+
497
+ static jQueryInterface(config) {
498
+ return this.each(function () {
499
+ Collapse.collapseInterface(this, config);
500
+ });
501
+ }
357
502
 
358
- return Collapse;
359
- }();
503
+ }
360
504
  /**
361
- * Data API implementation
505
+ * ------------------------------------------------------------------------
506
+ * Data Api implementation
507
+ * ------------------------------------------------------------------------
362
508
  */
363
509
 
364
510
 
365
- $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
511
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
366
512
  // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
367
- if (event.currentTarget.tagName === 'A') {
513
+ if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
368
514
  event.preventDefault();
369
515
  }
370
516
 
371
- var $trigger = $__default["default"](this);
372
- var selector = Util__default["default"].getSelectorFromElement(this);
373
- var selectors = [].slice.call(document.querySelectorAll(selector));
374
- $__default["default"](selectors).each(function () {
375
- var $target = $__default["default"](this);
376
- var data = $target.data(DATA_KEY);
377
- var config = data ? 'toggle' : $trigger.data();
517
+ const triggerData = Manipulator__default['default'].getDataAttributes(this);
518
+ const selector = getSelectorFromElement(this);
519
+ const selectorElements = SelectorEngine__default['default'].find(selector);
520
+ selectorElements.forEach(element => {
521
+ const data = Data__default['default'].get(element, DATA_KEY);
522
+ let config;
523
+
524
+ if (data) {
525
+ // update parent attribute
526
+ if (data._parent === null && typeof triggerData.parent === 'string') {
527
+ data._config.parent = triggerData.parent;
528
+ data._parent = data._getParent();
529
+ }
378
530
 
379
- Collapse._jQueryInterface.call($target, config);
531
+ config = 'toggle';
532
+ } else {
533
+ config = triggerData;
534
+ }
535
+
536
+ Collapse.collapseInterface(element, config);
380
537
  });
381
538
  });
382
539
  /**
540
+ * ------------------------------------------------------------------------
383
541
  * jQuery
542
+ * ------------------------------------------------------------------------
543
+ * add .Collapse to jQuery only if jQuery is present
384
544
  */
385
545
 
386
- $__default["default"].fn[NAME] = Collapse._jQueryInterface;
387
- $__default["default"].fn[NAME].Constructor = Collapse;
388
-
389
- $__default["default"].fn[NAME].noConflict = function () {
390
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
391
- return Collapse._jQueryInterface;
392
- };
546
+ defineJQueryPlugin(NAME, Collapse);
393
547
 
394
548
  return Collapse;
395
549
 
396
- }));
550
+ })));