bootstrap 4.1.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +17 -2
  3. data/CHANGELOG.md +2 -14
  4. data/README.md +7 -4
  5. data/Rakefile +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +226 -166
  7. data/assets/javascripts/bootstrap/base-component.js +63 -0
  8. data/assets/javascripts/bootstrap/button.js +119 -165
  9. data/assets/javascripts/bootstrap/carousel.js +634 -445
  10. data/assets/javascripts/bootstrap/collapse.js +447 -327
  11. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
  15. data/assets/javascripts/bootstrap/dropdown.js +550 -425
  16. data/assets/javascripts/bootstrap/modal.js +695 -492
  17. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  18. data/assets/javascripts/bootstrap/popover.js +167 -217
  19. data/assets/javascripts/bootstrap/scrollspy.js +319 -302
  20. data/assets/javascripts/bootstrap/tab.js +303 -221
  21. data/assets/javascripts/bootstrap/toast.js +333 -0
  22. data/assets/javascripts/bootstrap/tooltip.js +896 -577
  23. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  24. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  25. data/assets/javascripts/bootstrap-sprockets.js +15 -7
  26. data/assets/javascripts/bootstrap.js +4262 -3163
  27. data/assets/javascripts/bootstrap.min.js +4 -4
  28. data/assets/stylesheets/_bootstrap-grid.scss +54 -21
  29. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  30. data/assets/stylesheets/_bootstrap.scss +21 -11
  31. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  32. data/assets/stylesheets/bootstrap/_alert.scss +15 -9
  33. data/assets/stylesheets/bootstrap/_badge.scss +3 -21
  34. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -18
  35. data/assets/stylesheets/bootstrap/_button-group.scss +29 -62
  36. data/assets/stylesheets/bootstrap/_buttons.scss +33 -65
  37. data/assets/stylesheets/bootstrap/_card.scss +55 -141
  38. data/assets/stylesheets/bootstrap/_carousel.scss +94 -101
  39. data/assets/stylesheets/bootstrap/_close.scss +33 -28
  40. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  41. data/assets/stylesheets/bootstrap/_dropdown.scss +114 -40
  42. data/assets/stylesheets/bootstrap/_forms.scss +9 -333
  43. data/assets/stylesheets/bootstrap/_functions.scss +148 -29
  44. data/assets/stylesheets/bootstrap/_grid.scss +4 -34
  45. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  46. data/assets/stylesheets/bootstrap/_images.scss +4 -4
  47. data/assets/stylesheets/bootstrap/_list-group.scss +86 -27
  48. data/assets/stylesheets/bootstrap/_mixins.scss +17 -16
  49. data/assets/stylesheets/bootstrap/_modal.scss +90 -42
  50. data/assets/stylesheets/bootstrap/_nav.scss +31 -10
  51. data/assets/stylesheets/bootstrap/_navbar.scss +68 -61
  52. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  53. data/assets/stylesheets/bootstrap/_pagination.scss +13 -27
  54. data/assets/stylesheets/bootstrap/_popover.scss +63 -88
  55. data/assets/stylesheets/bootstrap/_progress.scss +20 -6
  56. data/assets/stylesheets/bootstrap/_reboot.scss +349 -211
  57. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  58. data/assets/stylesheets/bootstrap/_spinners.scss +69 -0
  59. data/assets/stylesheets/bootstrap/_tables.scss +79 -116
  60. data/assets/stylesheets/bootstrap/_toasts.scss +51 -0
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +18 -18
  62. data/assets/stylesheets/bootstrap/_transitions.scss +2 -3
  63. data/assets/stylesheets/bootstrap/_type.scss +42 -63
  64. data/assets/stylesheets/bootstrap/_utilities.scss +594 -15
  65. data/assets/stylesheets/bootstrap/_variables.scss +952 -440
  66. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  67. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  71. data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
  72. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  74. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  75. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  76. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  77. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  78. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  79. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  80. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  81. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  82. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  83. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +57 -14
  84. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +14 -1
  85. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +13 -9
  86. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +77 -53
  87. data/assets/stylesheets/bootstrap/mixins/_caret.scss +14 -16
  88. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  89. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  90. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  91. data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
  92. data/assets/stylesheets/bootstrap/mixins/_forms.scss +87 -97
  93. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  94. data/assets/stylesheets/bootstrap/mixins/_grid.scss +106 -33
  95. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  96. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  97. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +18 -9
  98. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  99. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  100. data/assets/stylesheets/bootstrap/mixins/_transition.scss +19 -6
  101. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
  102. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  103. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  104. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +312 -0
  105. data/bootstrap.gemspec +7 -6
  106. data/lib/bootstrap/engine.rb +3 -0
  107. data/lib/bootstrap/version.rb +4 -2
  108. data/lib/bootstrap.rb +10 -7
  109. data/tasks/updater/js.rb +20 -5
  110. data/tasks/updater/network.rb +8 -2
  111. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  112. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  113. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  114. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  115. data/test/dummy_rails/app/views/pages/root.html +89 -0
  116. data/test/dummy_rails/config/application.rb +0 -3
  117. data/test/gemfiles/rails_6_0.gemfile +7 -0
  118. data/test/gemfiles/rails_6_1.gemfile +7 -0
  119. data/test/support/dummy_rails_integration.rb +3 -1
  120. data/test/test_helper.rb +18 -13
  121. metadata +64 -79
  122. data/assets/javascripts/bootstrap/util.js +0 -143
  123. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  124. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -433
  125. data/assets/stylesheets/bootstrap/_input-group.scss +0 -173
  126. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -16
  127. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  128. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  129. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  130. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -12
  131. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -11
  132. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -67
  133. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  134. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  135. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  136. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -6
  137. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -30
  138. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -14
  139. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -13
  140. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -7
  141. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  142. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  143. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -59
  144. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -38
  145. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -52
  146. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  147. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -9
  148. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -37
  149. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  150. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  151. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -12
  152. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -51
  153. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -58
  154. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -11
  155. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  156. /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: 666302012abe7dc8f57c480cf254018e2334cd146471d0a58b5775d86c21c46a
4
- data.tar.gz: 5a6d73d0053d9e5b87197c8a621e94c2a50f8ef596c182d392a629d83190d9c3
3
+ metadata.gz: ab3cae7213a21110421a1bff463a4f8bccfdc085ce03953a9add6330fcc52f6f
4
+ data.tar.gz: f5e9f214138024c8adafcc459b934119657f9a0989b83c43dacf783ddd01a8a6
5
5
  SHA512:
6
- metadata.gz: cf64f69e154ff6d2accee675911b704663a46d3135605f8f8adc359a944dab1c9f7efbb0a5dd8f65d1de84fe3b07a4dd8942c32d12bfd0da738ab1b2acf04b79
7
- data.tar.gz: 5a906e556f5f81d05f22135ebac265614c3c1931edc6978b00e6f7e6f42f543c15fc612851504ba3c8713c7d598cde90fa33bbf9574c439fb47b748e59febdd4
6
+ metadata.gz: a54dd7911c5a617cce35d57e7e8543859cd891e82fa919a85e74a7242337c6258175c7cacf09957b016d24a77957d85731a9373e948a9cfd1e85311513b05184
7
+ data.tar.gz: 63aac9f119c570a9826c14f6e1fefdf1c472bdd3befeac525c1d86c75a01e73e36c85bb238916ba09968b12541472c6f8727f3ca701366c7a72c161a32ff8c18
data/.travis.yml CHANGED
@@ -1,11 +1,26 @@
1
1
  language: ruby
2
- sudo: false
2
+ dist: focal
3
+ addons:
4
+ apt:
5
+ packages:
6
+ - chromium-browser
3
7
  rvm:
4
- - 2.3.1
8
+ - 2.5
9
+ - 2.6
10
+ - 2.7
11
+
5
12
  gemfile:
6
13
  - test/gemfiles/rails_4_2.gemfile
7
14
  - test/gemfiles/rails_5_0.gemfile
8
15
  - test/gemfiles/rails_5_1.gemfile
16
+ - test/gemfiles/rails_6_0.gemfile
17
+ - test/gemfiles/rails_6_1.gemfile
18
+
19
+ jobs:
20
+ exclude:
21
+ rvm: 2.7
22
+ gemfile: test/gemfiles/rails_4_2.gemfile
23
+
9
24
  cache: bundler
10
25
  bundler_args: --path ../../vendor/bundle --without debug
11
26
  notifications:
data/CHANGELOG.md CHANGED
@@ -6,21 +6,9 @@ The changelog only includes changes specific to the RubyGem.
6
6
  The Bootstrap framework changes can be found in [the Releases section of twbs/bootstrap](https://github.com/twbs/bootstrap/releases).
7
7
  Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release of Bootstrap.
8
8
 
9
- # 4.1.1
9
+ # 4.2.1
10
10
 
11
- No gem-specific changes.
12
-
13
- # 4.1.0
14
-
15
- No gem-specific changes.
16
-
17
- # 4.0.0
18
-
19
- No gem-specific changes.
20
-
21
- # 4.0.0.beta3
22
-
23
- No gem-specific changes.
11
+ * Bootstrap rubygem now depends on SassC instead of Sass.
24
12
 
25
13
  # 4.0.0.beta2.1
26
14
 
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.1.3'
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'
data/Rakefile CHANGED
@@ -45,13 +45,13 @@ end
45
45
 
46
46
  desc 'Dumps output to a CSS file for testing'
47
47
  task :debug do
48
- require 'sass'
48
+ require 'sassc'
49
49
  require './lib/bootstrap'
50
50
  require 'term/ansicolor'
51
51
  require 'autoprefixer-rails'
52
52
  path = Bootstrap.stylesheets_path
53
53
  %w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
54
- engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
54
+ engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path])
55
55
  out = File.join('tmp', "#{file[1..-1]}.css")
56
56
  css = engine.render
57
57
  css = AutoprefixerRails.process(css)
@@ -1,202 +1,262 @@
1
+ /*!
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
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ */
1
6
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
3
- typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
4
- (global.Alert = factory(global.jQuery,global.Util));
5
- }(this, (function ($,Util) { 'use strict';
6
-
7
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
8
- Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
9
-
10
- function _defineProperties(target, props) {
11
- for (var i = 0; i < props.length; i++) {
12
- var descriptor = props[i];
13
- descriptor.enumerable = descriptor.enumerable || false;
14
- descriptor.configurable = true;
15
- if ("value" in descriptor) descriptor.writable = true;
16
- Object.defineProperty(target, descriptor.key, descriptor);
17
- }
18
- }
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';
19
11
 
20
- function _createClass(Constructor, protoProps, staticProps) {
21
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22
- if (staticProps) _defineProperties(Constructor, staticProps);
23
- return Constructor;
24
- }
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
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
25
17
 
26
18
  /**
27
19
  * --------------------------------------------------------------------------
28
- * Bootstrap (v4.1.3): alert.js
29
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
20
+ * Bootstrap (v5.0.0): util/index.js
21
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
30
22
  * --------------------------------------------------------------------------
31
23
  */
24
+ const MILLISECONDS_MULTIPLIER = 1000;
25
+ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
32
26
 
33
- var Alert = function ($$$1) {
34
- /**
35
- * ------------------------------------------------------------------------
36
- * Constants
37
- * ------------------------------------------------------------------------
38
- */
39
- var NAME = 'alert';
40
- var VERSION = '4.1.3';
41
- var DATA_KEY = 'bs.alert';
42
- var EVENT_KEY = "." + DATA_KEY;
43
- var DATA_API_KEY = '.data-api';
44
- var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
45
- var Selector = {
46
- DISMISS: '[data-dismiss="alert"]'
47
- };
48
- var Event = {
49
- CLOSE: "close" + EVENT_KEY,
50
- CLOSED: "closed" + EVENT_KEY,
51
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
52
- };
53
- var ClassName = {
54
- ALERT: 'alert',
55
- FADE: 'fade',
56
- SHOW: 'show'
57
- /**
58
- * ------------------------------------------------------------------------
59
- * Class Definition
60
- * ------------------------------------------------------------------------
61
- */
62
-
63
- };
64
-
65
- var Alert =
66
- /*#__PURE__*/
67
- function () {
68
- function Alert(element) {
69
- this._element = element;
70
- } // Getters
71
-
72
-
73
- var _proto = Alert.prototype;
74
-
75
- // Public
76
- _proto.close = function close(element) {
77
- var rootElement = this._element;
78
-
79
- if (element) {
80
- rootElement = this._getRootElement(element);
81
- }
27
+ const getSelector = element => {
28
+ let selector = element.getAttribute('data-bs-target');
82
29
 
83
- var customEvent = this._triggerCloseEvent(rootElement);
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
84
35
 
85
- if (customEvent.isDefaultPrevented()) {
86
- return;
87
- }
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
88
39
 
89
- this._removeElement(rootElement);
90
- };
91
40
 
92
- _proto.dispose = function dispose() {
93
- $$$1.removeData(this._element, DATA_KEY);
94
- this._element = null;
95
- }; // Private
41
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
42
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
43
+ }
96
44
 
45
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
46
+ }
97
47
 
98
- _proto._getRootElement = function _getRootElement(element) {
99
- var selector = Util.getSelectorFromElement(element);
100
- var parent = false;
48
+ return selector;
49
+ };
101
50
 
102
- if (selector) {
103
- parent = document.querySelector(selector);
104
- }
51
+ const getElementFromSelector = element => {
52
+ const selector = getSelector(element);
53
+ return selector ? document.querySelector(selector) : null;
54
+ };
105
55
 
106
- if (!parent) {
107
- parent = $$$1(element).closest("." + ClassName.ALERT)[0];
108
- }
56
+ const getTransitionDurationFromElement = element => {
57
+ if (!element) {
58
+ return 0;
59
+ } // Get transition-duration of the element
109
60
 
110
- return parent;
111
- };
112
61
 
113
- _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
114
- var closeEvent = $$$1.Event(Event.CLOSE);
115
- $$$1(element).trigger(closeEvent);
116
- return closeEvent;
117
- };
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
118
68
 
119
- _proto._removeElement = function _removeElement(element) {
120
- var _this = this;
69
+ if (!floatTransitionDuration && !floatTransitionDelay) {
70
+ return 0;
71
+ } // If multiple durations are defined, take the first
121
72
 
122
- $$$1(element).removeClass(ClassName.SHOW);
123
73
 
124
- if (!$$$1(element).hasClass(ClassName.FADE)) {
125
- this._destroyElement(element);
74
+ transitionDuration = transitionDuration.split(',')[0];
75
+ transitionDelay = transitionDelay.split(',')[0];
76
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
77
+ };
126
78
 
127
- return;
128
- }
79
+ const triggerTransitionEnd = element => {
80
+ element.dispatchEvent(new Event(TRANSITION_END));
81
+ };
129
82
 
130
- var transitionDuration = Util.getTransitionDurationFromElement(element);
131
- $$$1(element).one(Util.TRANSITION_END, function (event) {
132
- return _this._destroyElement(element, event);
133
- }).emulateTransitionEnd(transitionDuration);
134
- };
83
+ const emulateTransitionEnd = (element, duration) => {
84
+ let called = false;
85
+ const durationPadding = 5;
86
+ const emulatedDuration = duration + durationPadding;
135
87
 
136
- _proto._destroyElement = function _destroyElement(element) {
137
- $$$1(element).detach().trigger(Event.CLOSED).remove();
138
- }; // Static
88
+ function listener() {
89
+ called = true;
90
+ element.removeEventListener(TRANSITION_END, listener);
91
+ }
139
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
+ }
140
109
 
141
- Alert._jQueryInterface = function _jQueryInterface(config) {
142
- return this.each(function () {
143
- var $element = $$$1(this);
144
- var data = $element.data(DATA_KEY);
110
+ return null;
111
+ };
145
112
 
146
- if (!data) {
147
- data = new Alert(this);
148
- $element.data(DATA_KEY, data);
149
- }
113
+ const onDOMContentLoaded = callback => {
114
+ if (document.readyState === 'loading') {
115
+ document.addEventListener('DOMContentLoaded', callback);
116
+ } else {
117
+ callback();
118
+ }
119
+ };
150
120
 
151
- if (config === 'close') {
152
- data[config](this);
153
- }
154
- });
155
- };
121
+ const defineJQueryPlugin = (name, plugin) => {
122
+ onDOMContentLoaded(() => {
123
+ const $ = getjQuery();
124
+ /* istanbul ignore if */
156
125
 
157
- Alert._handleDismiss = function _handleDismiss(alertInstance) {
158
- return function (event) {
159
- if (event) {
160
- event.preventDefault();
161
- }
126
+ if ($) {
127
+ const JQUERY_NO_CONFLICT = $.fn[name];
128
+ $.fn[name] = plugin.jQueryInterface;
129
+ $.fn[name].Constructor = plugin;
162
130
 
163
- alertInstance.close(this);
131
+ $.fn[name].noConflict = () => {
132
+ $.fn[name] = JQUERY_NO_CONFLICT;
133
+ return plugin.jQueryInterface;
164
134
  };
165
- };
135
+ }
136
+ });
137
+ };
138
+
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
+ * ------------------------------------------------------------------------
147
+ * Constants
148
+ * ------------------------------------------------------------------------
149
+ */
150
+
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';
162
+ /**
163
+ * ------------------------------------------------------------------------
164
+ * Class Definition
165
+ * ------------------------------------------------------------------------
166
+ */
167
+
168
+ class Alert extends BaseComponent__default['default'] {
169
+ // Getters
170
+ static get DATA_KEY() {
171
+ return DATA_KEY;
172
+ } // Public
173
+
174
+
175
+ close(element) {
176
+ const rootElement = element ? this._getRootElement(element) : this._element;
177
+
178
+ const customEvent = this._triggerCloseEvent(rootElement);
166
179
 
167
- _createClass(Alert, null, [{
168
- key: "VERSION",
169
- get: function get() {
170
- return VERSION;
180
+ if (customEvent === null || customEvent.defaultPrevented) {
181
+ return;
182
+ }
183
+
184
+ this._removeElement(rootElement);
185
+ } // Private
186
+
187
+
188
+ _getRootElement(element) {
189
+ return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
190
+ }
191
+
192
+ _triggerCloseEvent(element) {
193
+ return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
194
+ }
195
+
196
+ _removeElement(element) {
197
+ element.classList.remove(CLASS_NAME_SHOW);
198
+
199
+ if (!element.classList.contains(CLASS_NAME_FADE)) {
200
+ this._destroyElement(element);
201
+
202
+ return;
203
+ }
204
+
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
+ }
214
+
215
+ EventHandler__default['default'].trigger(element, EVENT_CLOSED);
216
+ } // Static
217
+
218
+
219
+ static jQueryInterface(config) {
220
+ return this.each(function () {
221
+ let data = Data__default['default'].get(this, DATA_KEY);
222
+
223
+ if (!data) {
224
+ data = new Alert(this);
171
225
  }
172
- }]);
173
-
174
- return Alert;
175
- }();
176
- /**
177
- * ------------------------------------------------------------------------
178
- * Data Api implementation
179
- * ------------------------------------------------------------------------
180
- */
181
-
182
-
183
- $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
184
- /**
185
- * ------------------------------------------------------------------------
186
- * jQuery
187
- * ------------------------------------------------------------------------
188
- */
189
-
190
- $$$1.fn[NAME] = Alert._jQueryInterface;
191
- $$$1.fn[NAME].Constructor = Alert;
192
-
193
- $$$1.fn[NAME].noConflict = function () {
194
- $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
195
- return Alert._jQueryInterface;
196
- };
197
-
198
- return Alert;
199
- }($);
226
+
227
+ if (config === 'close') {
228
+ data[config](this);
229
+ }
230
+ });
231
+ }
232
+
233
+ static handleDismiss(alertInstance) {
234
+ return function (event) {
235
+ if (event) {
236
+ event.preventDefault();
237
+ }
238
+
239
+ alertInstance.close(this);
240
+ };
241
+ }
242
+
243
+ }
244
+ /**
245
+ * ------------------------------------------------------------------------
246
+ * Data Api implementation
247
+ * ------------------------------------------------------------------------
248
+ */
249
+
250
+
251
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
252
+ /**
253
+ * ------------------------------------------------------------------------
254
+ * jQuery
255
+ * ------------------------------------------------------------------------
256
+ * add .Alert to jQuery only if jQuery is present
257
+ */
258
+
259
+ defineJQueryPlugin(NAME, Alert);
200
260
 
201
261
  return Alert;
202
262
 
@@ -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
+ })));