bootstrap 4.6.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +7 -4
- data/assets/javascripts/bootstrap/alert.js +192 -115
- data/assets/javascripts/bootstrap/base-component.js +63 -0
- data/assets/javascripts/bootstrap/button.js +96 -179
- data/assets/javascripts/bootstrap/carousel.js +472 -359
- data/assets/javascripts/bootstrap/collapse.js +379 -225
- data/assets/javascripts/bootstrap/dom/data.js +68 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
- data/assets/javascripts/bootstrap/dropdown.js +472 -355
- data/assets/javascripts/bootstrap/modal.js +612 -438
- data/assets/javascripts/bootstrap/offcanvas.js +671 -0
- data/assets/javascripts/bootstrap/popover.js +138 -167
- data/assets/javascripts/bootstrap/scrollspy.js +250 -192
- data/assets/javascripts/bootstrap/tab.js +241 -144
- data/assets/javascripts/bootstrap/toast.js +223 -157
- data/assets/javascripts/bootstrap/tooltip.js +651 -487
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +8 -1
- data/assets/javascripts/bootstrap.js +3277 -2590
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +18 -10
- data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
- data/assets/stylesheets/bootstrap/_alert.scss +15 -10
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
- data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
- data/assets/stylesheets/bootstrap/_card.scss +20 -91
- data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
- data/assets/stylesheets/bootstrap/_close.scss +30 -30
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +84 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
- data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
- data/assets/stylesheets/bootstrap/_modal.scss +45 -57
- data/assets/stylesheets/bootstrap/_nav.scss +20 -6
- data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
- data/assets/stylesheets/bootstrap/_popover.scss +24 -36
- data/assets/stylesheets/bootstrap/_progress.scss +5 -4
- data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
- data/assets/stylesheets/bootstrap/_tables.scss +79 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
- data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
- data/assets/stylesheets/bootstrap/_variables.scss +800 -485
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +1 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +19 -16
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -3
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- metadata +45 -73
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
- /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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab3cae7213a21110421a1bff463a4f8bccfdc085ce03953a9add6330fcc52f6f
|
4
|
+
data.tar.gz: f5e9f214138024c8adafcc459b934119657f9a0989b83c43dacf783ddd01a8a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a54dd7911c5a617cce35d57e7e8543859cd891e82fa919a85e74a7242337c6258175c7cacf09957b016d24a77957d85731a9373e948a9cfd1e85311513b05184
|
7
|
+
data.tar.gz: 63aac9f119c570a9826c14f6e1fefdf1c472bdd3befeac525c1d86c75a01e73e36c85bb238916ba09968b12541472c6f8727f3ca701366c7a72c161a32ff8c18
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
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', '~>
|
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
|
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
|
3
|
-
* Copyright 2011-
|
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('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.
|
10
|
-
}
|
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
|
15
|
-
var
|
14
|
+
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
|
+
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
|
+
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
*
|
163
|
+
* ------------------------------------------------------------------------
|
164
|
+
* Class Definition
|
165
|
+
* ------------------------------------------------------------------------
|
55
166
|
*/
|
56
167
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
70
|
-
|
71
|
-
}
|
175
|
+
close(element) {
|
176
|
+
const rootElement = element ? this._getRootElement(element) : this._element;
|
72
177
|
|
73
|
-
|
178
|
+
const customEvent = this._triggerCloseEvent(rootElement);
|
74
179
|
|
75
|
-
if (customEvent.
|
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
|
-
|
97
|
-
|
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
|
-
|
110
|
-
|
192
|
+
_triggerCloseEvent(element) {
|
193
|
+
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
|
194
|
+
}
|
111
195
|
|
112
|
-
|
196
|
+
_removeElement(element) {
|
197
|
+
element.classList.remove(CLASS_NAME_SHOW);
|
113
198
|
|
114
|
-
if (
|
199
|
+
if (!element.classList.contains(CLASS_NAME_FADE)) {
|
115
200
|
this._destroyElement(element);
|
116
201
|
|
117
202
|
return;
|
118
203
|
}
|
119
204
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
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
|
-
|
127
|
-
$__default["default"](element).detach().trigger(EVENT_CLOSED).remove();
|
215
|
+
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
|
128
216
|
} // Static
|
129
|
-
;
|
130
217
|
|
131
|
-
|
218
|
+
|
219
|
+
static jQueryInterface(config) {
|
132
220
|
return this.each(function () {
|
133
|
-
|
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
|
-
|
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
|
-
|
165
|
-
}();
|
243
|
+
}
|
166
244
|
/**
|
167
|
-
*
|
245
|
+
* ------------------------------------------------------------------------
|
246
|
+
* Data Api implementation
|
247
|
+
* ------------------------------------------------------------------------
|
168
248
|
*/
|
169
249
|
|
170
250
|
|
171
|
-
|
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
|
-
|
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
|
+
})));
|