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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26f3252ccbfe53a40fd0cdf9d0d9f3d717dcf854d19a9535c903cd072796313d
4
- data.tar.gz: bce01fe328a2cd98599d10c0ee56a356754159bc49ecf99593652ae227f29210
3
+ metadata.gz: ab3cae7213a21110421a1bff463a4f8bccfdc085ce03953a9add6330fcc52f6f
4
+ data.tar.gz: f5e9f214138024c8adafcc459b934119657f9a0989b83c43dacf783ddd01a8a6
5
5
  SHA512:
6
- metadata.gz: c303b1722240f8db43117ae7b11680738e3f5dc1a0f41d65e3e0ddda579ec10d13f80e210e8e15819e56230844962325fd470b3fc0add59ee44441f0b15f7681
7
- data.tar.gz: 3e74aa08bcbdf56c5ee25eda907c2b4a57a67abc2bef1ce02485e4aab3c3067e7119f847fb3bb6d3c7278680c0ce46b7950d614e899ccbb8e701b9f06fccfafc
6
+ metadata.gz: a54dd7911c5a617cce35d57e7e8543859cd891e82fa919a85e74a7242337c6258175c7cacf09957b016d24a77957d85731a9373e948a9cfd1e85311513b05184
7
+ data.tar.gz: 63aac9f119c570a9826c14f6e1fefdf1c472bdd3befeac525c1d86c75a01e73e36c85bb238916ba09968b12541472c6f8727f3ca701366c7a72c161a32ff8c18
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
- sudo: false
2
+ dist: focal
3
3
  addons:
4
4
  apt:
5
5
  packages:
@@ -14,6 +14,7 @@ gemfile:
14
14
  - test/gemfiles/rails_5_0.gemfile
15
15
  - test/gemfiles/rails_5_1.gemfile
16
16
  - test/gemfiles/rails_6_0.gemfile
17
+ - test/gemfiles/rails_6_1.gemfile
17
18
 
18
19
  jobs:
19
20
  exclude:
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Bootstrap Ruby Gem [![Build Status](https://travis-ci.org/twbs/bootstrap-rubygem.svg?branch=master)](https://travis-ci.org/twbs/bootstrap-rubygem) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
2
2
 
3
- [Bootstrap 4][bootstrap-home] ruby gem for Ruby on Rails (Sprockets) and Hanami (formerly Lotus).
3
+ [Bootstrap 4][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
4
4
 
5
5
  For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.
6
6
 
7
+ **Ruby on Rails 6 Note:**:
8
+ With the release of Rails 6 there have been some minor changes made to the default configuration for The Asset Pipeline. In specific, by default _Sprockets no longer processes JavaScript_ and instead Webpack is set as the default. The `twbs/bootstrap-rubygem` is for use with Sprockets not Webpack.
9
+
7
10
  ## Installation
8
11
 
9
12
  Please see the appropriate guide for your environment of choice:
@@ -17,7 +20,7 @@ Please see the appropriate guide for your environment of choice:
17
20
  Add `bootstrap` to your Gemfile:
18
21
 
19
22
  ```ruby
20
- gem 'bootstrap', '~> 4.6.2'
23
+ gem 'bootstrap', '~> 5.0.0'
21
24
  ```
22
25
 
23
26
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -44,8 +47,8 @@ Then, remove all the `*= require` and `*= require_tree` statements from the Sass
44
47
 
45
48
  Do not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.
46
49
 
47
- Bootstrap JavaScript depends on jQuery.
48
- If you're using Rails 5.1+, add the `jquery-rails` gem to your Gemfile:
50
+ Bootstrap JavaScript can optionally use jQuery.
51
+ If you're using Rails 5.1+, you can add the `jquery-rails` gem to your Gemfile:
49
52
 
50
53
  ```ruby
51
54
  gem 'jquery-rails'
@@ -1,150 +1,236 @@
1
1
  /*!
2
- * Bootstrap alert.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap alert.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.Alert = 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('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Data, global.EventHandler, global.Base));
10
+ }(this, (function (Data, EventHandler, 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 BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
17
 
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);
18
+ /**
19
+ * --------------------------------------------------------------------------
20
+ * Bootstrap (v5.0.0): util/index.js
21
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
+ * --------------------------------------------------------------------------
23
+ */
24
+ const MILLISECONDS_MULTIPLIER = 1000;
25
+ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
26
+
27
+ const getSelector = element => {
28
+ let selector = element.getAttribute('data-bs-target');
29
+
30
+ if (!selector || selector === '#') {
31
+ let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
32
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
33
+ // `document.querySelector` will rightfully complain it is invalid.
34
+ // See https://github.com/twbs/bootstrap/issues/32273
35
+
36
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
37
+ return null;
38
+ } // Just in case some CMS puts out a full URL with the anchor appended
39
+
40
+
41
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
42
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
43
+ }
44
+
45
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
24
46
  }
25
- }
26
47
 
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
48
+ return selector;
49
+ };
50
+
51
+ const getElementFromSelector = element => {
52
+ const selector = getSelector(element);
53
+ return selector ? document.querySelector(selector) : null;
54
+ };
55
+
56
+ const getTransitionDurationFromElement = element => {
57
+ if (!element) {
58
+ return 0;
59
+ } // Get transition-duration of the element
60
+
61
+
62
+ let {
63
+ transitionDuration,
64
+ transitionDelay
65
+ } = window.getComputedStyle(element);
66
+ const floatTransitionDuration = Number.parseFloat(transitionDuration);
67
+ const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
68
+
69
+ if (!floatTransitionDuration && !floatTransitionDelay) {
70
+ return 0;
71
+ } // If multiple durations are defined, take the first
72
+
73
+
74
+ transitionDuration = transitionDuration.split(',')[0];
75
+ transitionDelay = transitionDelay.split(',')[0];
76
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
77
+ };
78
+
79
+ const triggerTransitionEnd = element => {
80
+ element.dispatchEvent(new Event(TRANSITION_END));
81
+ };
82
+
83
+ const emulateTransitionEnd = (element, duration) => {
84
+ let called = false;
85
+ const durationPadding = 5;
86
+ const emulatedDuration = duration + durationPadding;
87
+
88
+ function listener() {
89
+ called = true;
90
+ element.removeEventListener(TRANSITION_END, listener);
91
+ }
92
+
93
+ element.addEventListener(TRANSITION_END, listener);
94
+ setTimeout(() => {
95
+ if (!called) {
96
+ triggerTransitionEnd(element);
97
+ }
98
+ }, emulatedDuration);
99
+ };
100
+
101
+ const getjQuery = () => {
102
+ const {
103
+ jQuery
104
+ } = window;
105
+
106
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
107
+ return jQuery;
108
+ }
109
+
110
+ return null;
111
+ };
112
+
113
+ const onDOMContentLoaded = callback => {
114
+ if (document.readyState === 'loading') {
115
+ document.addEventListener('DOMContentLoaded', callback);
116
+ } else {
117
+ callback();
118
+ }
119
+ };
120
+
121
+ const defineJQueryPlugin = (name, plugin) => {
122
+ onDOMContentLoaded(() => {
123
+ const $ = getjQuery();
124
+ /* istanbul ignore if */
125
+
126
+ if ($) {
127
+ const JQUERY_NO_CONFLICT = $.fn[name];
128
+ $.fn[name] = plugin.jQueryInterface;
129
+ $.fn[name].Constructor = plugin;
130
+
131
+ $.fn[name].noConflict = () => {
132
+ $.fn[name] = JQUERY_NO_CONFLICT;
133
+ return plugin.jQueryInterface;
134
+ };
135
+ }
32
136
  });
33
- return Constructor;
34
- }
137
+ };
35
138
 
36
139
  /**
140
+ * --------------------------------------------------------------------------
141
+ * Bootstrap (v5.0.0): alert.js
142
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
143
+ * --------------------------------------------------------------------------
144
+ */
145
+ /**
146
+ * ------------------------------------------------------------------------
37
147
  * Constants
148
+ * ------------------------------------------------------------------------
38
149
  */
39
150
 
40
- var NAME = 'alert';
41
- var VERSION = '4.6.2';
42
- var DATA_KEY = 'bs.alert';
43
- var EVENT_KEY = "." + DATA_KEY;
44
- var DATA_API_KEY = '.data-api';
45
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
46
- var CLASS_NAME_ALERT = 'alert';
47
- var CLASS_NAME_FADE = 'fade';
48
- var CLASS_NAME_SHOW = 'show';
49
- var EVENT_CLOSE = "close" + EVENT_KEY;
50
- var EVENT_CLOSED = "closed" + EVENT_KEY;
51
- var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
52
- var SELECTOR_DISMISS = '[data-dismiss="alert"]';
151
+ const NAME = 'alert';
152
+ const DATA_KEY = 'bs.alert';
153
+ const EVENT_KEY = `.${DATA_KEY}`;
154
+ const DATA_API_KEY = '.data-api';
155
+ const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
156
+ const EVENT_CLOSE = `close${EVENT_KEY}`;
157
+ const EVENT_CLOSED = `closed${EVENT_KEY}`;
158
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
159
+ const CLASS_NAME_ALERT = 'alert';
160
+ const CLASS_NAME_FADE = 'fade';
161
+ const CLASS_NAME_SHOW = 'show';
53
162
  /**
54
- * Class definition
163
+ * ------------------------------------------------------------------------
164
+ * Class Definition
165
+ * ------------------------------------------------------------------------
55
166
  */
56
167
 
57
- var Alert = /*#__PURE__*/function () {
58
- function Alert(element) {
59
- this._element = element;
60
- } // Getters
61
-
62
-
63
- var _proto = Alert.prototype;
168
+ class Alert extends BaseComponent__default['default'] {
169
+ // Getters
170
+ static get DATA_KEY() {
171
+ return DATA_KEY;
172
+ } // Public
64
173
 
65
- // Public
66
- _proto.close = function close(element) {
67
- var rootElement = this._element;
68
174
 
69
- if (element) {
70
- rootElement = this._getRootElement(element);
71
- }
175
+ close(element) {
176
+ const rootElement = element ? this._getRootElement(element) : this._element;
72
177
 
73
- var customEvent = this._triggerCloseEvent(rootElement);
178
+ const customEvent = this._triggerCloseEvent(rootElement);
74
179
 
75
- if (customEvent.isDefaultPrevented()) {
180
+ if (customEvent === null || customEvent.defaultPrevented) {
76
181
  return;
77
182
  }
78
183
 
79
184
  this._removeElement(rootElement);
80
- };
81
-
82
- _proto.dispose = function dispose() {
83
- $__default["default"].removeData(this._element, DATA_KEY);
84
- this._element = null;
85
185
  } // Private
86
- ;
87
186
 
88
- _proto._getRootElement = function _getRootElement(element) {
89
- var selector = Util__default["default"].getSelectorFromElement(element);
90
- var parent = false;
91
-
92
- if (selector) {
93
- parent = document.querySelector(selector);
94
- }
95
187
 
96
- if (!parent) {
97
- parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0];
98
- }
99
-
100
- return parent;
101
- };
102
-
103
- _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
104
- var closeEvent = $__default["default"].Event(EVENT_CLOSE);
105
- $__default["default"](element).trigger(closeEvent);
106
- return closeEvent;
107
- };
188
+ _getRootElement(element) {
189
+ return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
190
+ }
108
191
 
109
- _proto._removeElement = function _removeElement(element) {
110
- var _this = this;
192
+ _triggerCloseEvent(element) {
193
+ return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
194
+ }
111
195
 
112
- $__default["default"](element).removeClass(CLASS_NAME_SHOW);
196
+ _removeElement(element) {
197
+ element.classList.remove(CLASS_NAME_SHOW);
113
198
 
114
- if (!$__default["default"](element).hasClass(CLASS_NAME_FADE)) {
199
+ if (!element.classList.contains(CLASS_NAME_FADE)) {
115
200
  this._destroyElement(element);
116
201
 
117
202
  return;
118
203
  }
119
204
 
120
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(element);
121
- $__default["default"](element).one(Util__default["default"].TRANSITION_END, function (event) {
122
- return _this._destroyElement(element, event);
123
- }).emulateTransitionEnd(transitionDuration);
124
- };
205
+ const transitionDuration = getTransitionDurationFromElement(element);
206
+ EventHandler__default['default'].one(element, 'transitionend', () => this._destroyElement(element));
207
+ emulateTransitionEnd(element, transitionDuration);
208
+ }
209
+
210
+ _destroyElement(element) {
211
+ if (element.parentNode) {
212
+ element.parentNode.removeChild(element);
213
+ }
125
214
 
126
- _proto._destroyElement = function _destroyElement(element) {
127
- $__default["default"](element).detach().trigger(EVENT_CLOSED).remove();
215
+ EventHandler__default['default'].trigger(element, EVENT_CLOSED);
128
216
  } // Static
129
- ;
130
217
 
131
- Alert._jQueryInterface = function _jQueryInterface(config) {
218
+
219
+ static jQueryInterface(config) {
132
220
  return this.each(function () {
133
- var $element = $__default["default"](this);
134
- var data = $element.data(DATA_KEY);
221
+ let data = Data__default['default'].get(this, DATA_KEY);
135
222
 
136
223
  if (!data) {
137
224
  data = new Alert(this);
138
- $element.data(DATA_KEY, data);
139
225
  }
140
226
 
141
227
  if (config === 'close') {
142
228
  data[config](this);
143
229
  }
144
230
  });
145
- };
231
+ }
146
232
 
147
- Alert._handleDismiss = function _handleDismiss(alertInstance) {
233
+ static handleDismiss(alertInstance) {
148
234
  return function (event) {
149
235
  if (event) {
150
236
  event.preventDefault();
@@ -152,35 +238,26 @@
152
238
 
153
239
  alertInstance.close(this);
154
240
  };
155
- };
156
-
157
- _createClass(Alert, null, [{
158
- key: "VERSION",
159
- get: function get() {
160
- return VERSION;
161
- }
162
- }]);
241
+ }
163
242
 
164
- return Alert;
165
- }();
243
+ }
166
244
  /**
167
- * Data API implementation
245
+ * ------------------------------------------------------------------------
246
+ * Data Api implementation
247
+ * ------------------------------------------------------------------------
168
248
  */
169
249
 
170
250
 
171
- $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
251
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
172
252
  /**
253
+ * ------------------------------------------------------------------------
173
254
  * jQuery
255
+ * ------------------------------------------------------------------------
256
+ * add .Alert to jQuery only if jQuery is present
174
257
  */
175
258
 
176
- $__default["default"].fn[NAME] = Alert._jQueryInterface;
177
- $__default["default"].fn[NAME].Constructor = Alert;
178
-
179
- $__default["default"].fn[NAME].noConflict = function () {
180
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
181
- return Alert._jQueryInterface;
182
- };
259
+ defineJQueryPlugin(NAME, Alert);
183
260
 
184
261
  return Alert;
185
262
 
186
- }));
263
+ })));
@@ -0,0 +1,63 @@
1
+ /*!
2
+ * Bootstrap base-component.js v5.0.0 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
10
+ }(this, (function (Data, EventHandler) { 'use strict';
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+
17
+ /**
18
+ * --------------------------------------------------------------------------
19
+ * Bootstrap (v5.0.0): base-component.js
20
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
+ * --------------------------------------------------------------------------
22
+ */
23
+ /**
24
+ * ------------------------------------------------------------------------
25
+ * Constants
26
+ * ------------------------------------------------------------------------
27
+ */
28
+
29
+ const VERSION = '5.0.0';
30
+
31
+ class BaseComponent {
32
+ constructor(element) {
33
+ element = typeof element === 'string' ? document.querySelector(element) : element;
34
+
35
+ if (!element) {
36
+ return;
37
+ }
38
+
39
+ this._element = element;
40
+ Data__default['default'].set(this._element, this.constructor.DATA_KEY, this);
41
+ }
42
+
43
+ dispose() {
44
+ Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
45
+ EventHandler__default['default'].off(this._element, `.${this.constructor.DATA_KEY}`);
46
+ this._element = null;
47
+ }
48
+ /** Static */
49
+
50
+
51
+ static getInstance(element) {
52
+ return Data__default['default'].get(element, this.DATA_KEY);
53
+ }
54
+
55
+ static get VERSION() {
56
+ return VERSION;
57
+ }
58
+
59
+ }
60
+
61
+ return BaseComponent;
62
+
63
+ })));