bootstrap 4.5.3 → 5.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +55 -0
- data/README.md +28 -5
- data/assets/javascripts/bootstrap/alert.js +54 -133
- data/assets/javascripts/bootstrap/base-component.js +99 -0
- data/assets/javascripts/bootstrap/button.js +44 -183
- data/assets/javascripts/bootstrap/carousel.js +308 -450
- data/assets/javascripts/bootstrap/collapse.js +180 -243
- data/assets/javascripts/bootstrap/dom/data.js +66 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +283 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +84 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
- data/assets/javascripts/bootstrap/dropdown.js +320 -387
- data/assets/javascripts/bootstrap/modal.js +238 -478
- data/assets/javascripts/bootstrap/offcanvas.js +297 -0
- data/assets/javascripts/bootstrap/popover.js +58 -163
- data/assets/javascripts/bootstrap/scrollspy.js +223 -228
- data/assets/javascripts/bootstrap/tab.js +251 -166
- data/assets/javascripts/bootstrap/toast.js +147 -149
- data/assets/javascripts/bootstrap/tooltip.js +434 -646
- data/assets/javascripts/bootstrap/util/backdrop.js +165 -0
- data/assets/javascripts/bootstrap/util/component-functions.js +46 -0
- data/assets/javascripts/bootstrap/util/config.js +79 -0
- data/assets/javascripts/bootstrap/util/focustrap.js +129 -0
- data/assets/javascripts/bootstrap/util/index.js +350 -0
- data/assets/javascripts/bootstrap/util/sanitizer.js +122 -0
- data/assets/javascripts/bootstrap/util/scrollbar.js +138 -0
- data/assets/javascripts/bootstrap/util/swipe.js +155 -0
- data/assets/javascripts/bootstrap/util/template-factory.js +177 -0
- 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 +24 -8
- data/assets/javascripts/bootstrap.js +4037 -3206
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +56 -21
- data/assets/stylesheets/_bootstrap-reboot.scss +4 -7
- data/assets/stylesheets/_bootstrap.scss +20 -13
- data/assets/stylesheets/bootstrap/_accordion.scss +149 -0
- data/assets/stylesheets/bootstrap/_alert.scss +33 -14
- data/assets/stylesheets/bootstrap/_badge.scss +15 -31
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +23 -27
- data/assets/stylesheets/bootstrap/_button-group.scss +25 -46
- data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
- data/assets/stylesheets/bootstrap/_card.scss +61 -113
- 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 +128 -71
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +181 -23
- data/assets/stylesheets/bootstrap/_grid.scss +13 -53
- data/assets/stylesheets/bootstrap/_helpers.scss +10 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +72 -34
- data/assets/stylesheets/bootstrap/_maps.scss +54 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +9 -13
- data/assets/stylesheets/bootstrap/_modal.scss +107 -110
- data/assets/stylesheets/bootstrap/_nav.scss +72 -23
- data/assets/stylesheets/bootstrap/_navbar.scss +127 -173
- data/assets/stylesheets/bootstrap/_offcanvas.scss +144 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +99 -73
- data/assets/stylesheets/bootstrap/_progress.scss +26 -14
- data/assets/stylesheets/bootstrap/_reboot.scss +326 -200
- data/assets/stylesheets/bootstrap/_root.scss +62 -9
- data/assets/stylesheets/bootstrap/_spinners.scss +51 -22
- data/assets/stylesheets/bootstrap/_tables.scss +94 -115
- data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
- data/assets/stylesheets/bootstrap/_tooltip.scss +68 -63
- data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
- data/assets/stylesheets/bootstrap/_type.scss +40 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +647 -18
- data/assets/stylesheets/bootstrap/_variables.scss +1018 -526
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +75 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +175 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +194 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +71 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +10 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -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/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +8 -6
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_banner.scss +9 -0
- 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 +20 -16
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
- 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 +11 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +48 -74
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +119 -37
- 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 +7 -19
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -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 +278 -128
- data/bootstrap.gemspec +3 -5
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +31 -7
- data/tasks/updater/network.rb +9 -3
- data/tasks/updater.rb +2 -2
- 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_5_2.gemfile +8 -0
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- data/test/gemfiles/rails_7_0.gemfile +7 -0
- data/test/test_helper.rb +3 -2
- metadata +70 -78
- data/.travis.yml +0 -31
- data/assets/javascripts/bootstrap/util.js +0 -192
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -524
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -192
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -141
- 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: 5b9b76b3a8107fa8c73e4b760273a561e05e569e150a086196903c4ccb49ddbc
|
4
|
+
data.tar.gz: 116115a60a5315e39b3bb6d5df9fe3568d48c139682d17f6de88b48762ddb06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '054324796db1631c6ad2dc41451f8b39dfcede1a4526a665c87d51549190dba106641fc4cf4716bd3e28f3332039369eb37f0806a5a4617acb08617373ea2bb3'
|
7
|
+
data.tar.gz: c53409f131522034f9d02b5d4b18b6f69460be5ccfb232639132f5939ac63b3aa2ee7de91c6ac119c6c656ca91f2656579e20e9e50be6568564da9c3aa5f8263
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
env:
|
10
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby_version: ['2.5', '2.6', '2.7', '3.0', '3.1']
|
15
|
+
gemfile:
|
16
|
+
- test/gemfiles/rails_5_0.gemfile
|
17
|
+
- test/gemfiles/rails_5_1.gemfile
|
18
|
+
- test/gemfiles/rails_5_2.gemfile
|
19
|
+
- test/gemfiles/rails_6_0.gemfile
|
20
|
+
- test/gemfiles/rails_6_1.gemfile
|
21
|
+
- test/gemfiles/rails_7_0.gemfile
|
22
|
+
include:
|
23
|
+
- ruby_version: '2.5'
|
24
|
+
gemfile: test/gemfiles/rails_4_2.gemfile
|
25
|
+
- ruby_version: '2.6'
|
26
|
+
gemfile: test/gemfiles/rails_4_2.gemfile
|
27
|
+
exclude:
|
28
|
+
- ruby_version: '2.5'
|
29
|
+
gemfile: test/gemfiles/rails_7_0.gemfile
|
30
|
+
- ruby_version: '2.6'
|
31
|
+
gemfile: test/gemfiles/rails_7_0.gemfile
|
32
|
+
- ruby_version: '3.0'
|
33
|
+
gemfile: test/gemfiles/rails_5_0.gemfile
|
34
|
+
- ruby_version: '3.0'
|
35
|
+
gemfile: test/gemfiles/rails_5_1.gemfile
|
36
|
+
- ruby_version: '3.0'
|
37
|
+
gemfile: test/gemfiles/rails_5_2.gemfile
|
38
|
+
- ruby_version: '3.1'
|
39
|
+
gemfile: test/gemfiles/rails_5_0.gemfile
|
40
|
+
- ruby_version: '3.1'
|
41
|
+
gemfile: test/gemfiles/rails_5_1.gemfile
|
42
|
+
- ruby_version: '3.1'
|
43
|
+
gemfile: test/gemfiles/rails_5_2.gemfile
|
44
|
+
- ruby_version: '3.1'
|
45
|
+
gemfile: test/gemfiles/rails_6_0.gemfile
|
46
|
+
runs-on: ubuntu-latest
|
47
|
+
steps:
|
48
|
+
- uses: actions/checkout@v3
|
49
|
+
- name: Set up Ruby
|
50
|
+
uses: ruby/setup-ruby@v1
|
51
|
+
with:
|
52
|
+
ruby-version: ${{ matrix.ruby_version }}
|
53
|
+
bundler-cache: true # 'bundle install' and cache
|
54
|
+
- name: Build and test with Rake
|
55
|
+
run: bundle exec rake --trace
|
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
# Bootstrap Ruby Gem [![
|
1
|
+
# Bootstrap Ruby Gem [![CI](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml/badge.svg)](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
|
2
2
|
|
3
|
-
[Bootstrap
|
3
|
+
[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) 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 Note**: Newer releases of Rails have added additional ways for
|
8
|
+
assets to be processed. The `twbs/bootstrap-rubygem` is for use with Importmaps
|
9
|
+
or Sprockets, but not Webpack.
|
10
|
+
|
7
11
|
## Installation
|
8
12
|
|
9
13
|
Please see the appropriate guide for your environment of choice:
|
@@ -17,7 +21,7 @@ Please see the appropriate guide for your environment of choice:
|
|
17
21
|
Add `bootstrap` to your Gemfile:
|
18
22
|
|
19
23
|
```ruby
|
20
|
-
gem 'bootstrap', '~>
|
24
|
+
gem 'bootstrap', '~> 5.2.2'
|
21
25
|
```
|
22
26
|
|
23
27
|
Ensure that `sprockets-rails` is at least v2.3.2.
|
@@ -44,8 +48,8 @@ Then, remove all the `*= require` and `*= require_tree` statements from the Sass
|
|
44
48
|
|
45
49
|
Do not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.
|
46
50
|
|
47
|
-
Bootstrap JavaScript
|
48
|
-
If you're using Rails 5.1+, add the `jquery-rails` gem to your Gemfile:
|
51
|
+
Bootstrap JavaScript can optionally use jQuery.
|
52
|
+
If you're using Rails 5.1+, you can add the `jquery-rails` gem to your Gemfile:
|
49
53
|
|
50
54
|
```ruby
|
51
55
|
gem 'jquery-rails'
|
@@ -55,6 +59,25 @@ Bootstrap tooltips and popovers depend on [popper.js] for positioning.
|
|
55
59
|
The `bootstrap` gem already depends on the
|
56
60
|
[popper_js](https://github.com/glebm/popper_js-rubygem) gem.
|
57
61
|
|
62
|
+
#### Importmaps
|
63
|
+
|
64
|
+
You can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb`
|
65
|
+
as well as `popper.js`:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
pin "bootstrap", to: "bootstrap.min.js", preload: true
|
69
|
+
pin "@popperjs/core", to: "popper.js", preload: true
|
70
|
+
```
|
71
|
+
|
72
|
+
Whichever files you pin will need to be added to `config.assets.precompile`:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
# config/initializers/assets.rb
|
76
|
+
Rails.application.config.assets.precompile += %w(bootstrap.min.js popper.js)
|
77
|
+
```
|
78
|
+
|
79
|
+
#### Sprockets
|
80
|
+
|
58
81
|
Add Bootstrap dependencies and Bootstrap to your `application.js`:
|
59
82
|
|
60
83
|
```js
|
@@ -1,178 +1,99 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap alert.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap alert.js v5.2.3 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2022 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
|
-
}(this, (function (
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./base-component'), require('./util/component-functions')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component', './util/component-functions'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Index, global.EventHandler, global.BaseComponent, global.ComponentFunctions));
|
10
|
+
})(this, (function (index, EventHandler, BaseComponent, componentFunctions) { 'use strict';
|
11
11
|
|
12
|
-
|
12
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
15
|
+
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
16
16
|
|
17
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
18
|
-
|
19
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
20
17
|
/**
|
21
|
-
*
|
18
|
+
* --------------------------------------------------------------------------
|
19
|
+
* Bootstrap (v5.2.3): alert.js
|
20
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
21
|
+
* --------------------------------------------------------------------------
|
22
|
+
*/
|
23
|
+
/**
|
22
24
|
* Constants
|
23
|
-
* ------------------------------------------------------------------------
|
24
25
|
*/
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
var EVENT_CLOSE = "close" + EVENT_KEY;
|
34
|
-
var EVENT_CLOSED = "closed" + EVENT_KEY;
|
35
|
-
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
|
36
|
-
var CLASS_NAME_ALERT = 'alert';
|
37
|
-
var CLASS_NAME_FADE = 'fade';
|
38
|
-
var CLASS_NAME_SHOW = 'show';
|
27
|
+
const NAME = 'alert';
|
28
|
+
const DATA_KEY = 'bs.alert';
|
29
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
30
|
+
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
31
|
+
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
32
|
+
const CLASS_NAME_FADE = 'fade';
|
33
|
+
const CLASS_NAME_SHOW = 'show';
|
39
34
|
/**
|
40
|
-
*
|
41
|
-
* Class Definition
|
42
|
-
* ------------------------------------------------------------------------
|
35
|
+
* Class definition
|
43
36
|
*/
|
44
37
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
class Alert extends BaseComponent__default.default {
|
39
|
+
// Getters
|
40
|
+
static get NAME() {
|
41
|
+
return NAME;
|
42
|
+
} // Public
|
50
43
|
|
51
|
-
var _proto = Alert.prototype;
|
52
|
-
|
53
|
-
// Public
|
54
|
-
_proto.close = function close(element) {
|
55
|
-
var rootElement = this._element;
|
56
|
-
|
57
|
-
if (element) {
|
58
|
-
rootElement = this._getRootElement(element);
|
59
|
-
}
|
60
44
|
|
61
|
-
|
45
|
+
close() {
|
46
|
+
const closeEvent = EventHandler__default.default.trigger(this._element, EVENT_CLOSE);
|
62
47
|
|
63
|
-
if (
|
48
|
+
if (closeEvent.defaultPrevented) {
|
64
49
|
return;
|
65
50
|
}
|
66
51
|
|
67
|
-
this.
|
68
|
-
};
|
69
|
-
|
70
|
-
_proto.dispose = function dispose() {
|
71
|
-
$__default['default'].removeData(this._element, DATA_KEY);
|
72
|
-
this._element = null;
|
73
|
-
} // Private
|
74
|
-
;
|
75
|
-
|
76
|
-
_proto._getRootElement = function _getRootElement(element) {
|
77
|
-
var selector = Util__default['default'].getSelectorFromElement(element);
|
78
|
-
var parent = false;
|
79
|
-
|
80
|
-
if (selector) {
|
81
|
-
parent = document.querySelector(selector);
|
82
|
-
}
|
83
|
-
|
84
|
-
if (!parent) {
|
85
|
-
parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0];
|
86
|
-
}
|
87
|
-
|
88
|
-
return parent;
|
89
|
-
};
|
52
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
90
53
|
|
91
|
-
|
92
|
-
var closeEvent = $__default['default'].Event(EVENT_CLOSE);
|
93
|
-
$__default['default'](element).trigger(closeEvent);
|
94
|
-
return closeEvent;
|
95
|
-
};
|
54
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
|
96
55
|
|
97
|
-
|
98
|
-
|
56
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
57
|
+
} // Private
|
99
58
|
|
100
|
-
$__default['default'](element).removeClass(CLASS_NAME_SHOW);
|
101
59
|
|
102
|
-
|
103
|
-
|
60
|
+
_destroyElement() {
|
61
|
+
this._element.remove();
|
104
62
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
var transitionDuration = Util__default['default'].getTransitionDurationFromElement(element);
|
109
|
-
$__default['default'](element).one(Util__default['default'].TRANSITION_END, function (event) {
|
110
|
-
return _this._destroyElement(element, event);
|
111
|
-
}).emulateTransitionEnd(transitionDuration);
|
112
|
-
};
|
113
|
-
|
114
|
-
_proto._destroyElement = function _destroyElement(element) {
|
115
|
-
$__default['default'](element).detach().trigger(EVENT_CLOSED).remove();
|
63
|
+
EventHandler__default.default.trigger(this._element, EVENT_CLOSED);
|
64
|
+
this.dispose();
|
116
65
|
} // Static
|
117
|
-
;
|
118
66
|
|
119
|
-
Alert._jQueryInterface = function _jQueryInterface(config) {
|
120
|
-
return this.each(function () {
|
121
|
-
var $element = $__default['default'](this);
|
122
|
-
var data = $element.data(DATA_KEY);
|
123
67
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
68
|
+
static jQueryInterface(config) {
|
69
|
+
return this.each(function () {
|
70
|
+
const data = Alert.getOrCreateInstance(this);
|
128
71
|
|
129
|
-
if (config
|
130
|
-
|
72
|
+
if (typeof config !== 'string') {
|
73
|
+
return;
|
131
74
|
}
|
132
|
-
});
|
133
|
-
};
|
134
75
|
|
135
|
-
|
136
|
-
|
137
|
-
if (event) {
|
138
|
-
event.preventDefault();
|
76
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
77
|
+
throw new TypeError(`No method named "${config}"`);
|
139
78
|
}
|
140
79
|
|
141
|
-
|
142
|
-
};
|
143
|
-
}
|
144
|
-
|
145
|
-
_createClass(Alert, null, [{
|
146
|
-
key: "VERSION",
|
147
|
-
get: function get() {
|
148
|
-
return VERSION;
|
149
|
-
}
|
150
|
-
}]);
|
80
|
+
data[config](this);
|
81
|
+
});
|
82
|
+
}
|
151
83
|
|
152
|
-
|
153
|
-
}();
|
84
|
+
}
|
154
85
|
/**
|
155
|
-
*
|
156
|
-
* Data Api implementation
|
157
|
-
* ------------------------------------------------------------------------
|
86
|
+
* Data API implementation
|
158
87
|
*/
|
159
88
|
|
160
89
|
|
161
|
-
|
90
|
+
componentFunctions.enableDismissTrigger(Alert, 'close');
|
162
91
|
/**
|
163
|
-
* ------------------------------------------------------------------------
|
164
92
|
* jQuery
|
165
|
-
* ------------------------------------------------------------------------
|
166
93
|
*/
|
167
94
|
|
168
|
-
|
169
|
-
$__default['default'].fn[NAME].Constructor = Alert;
|
170
|
-
|
171
|
-
$__default['default'].fn[NAME].noConflict = function () {
|
172
|
-
$__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
|
173
|
-
return Alert._jQueryInterface;
|
174
|
-
};
|
95
|
+
index.defineJQueryPlugin(Alert);
|
175
96
|
|
176
97
|
return Alert;
|
177
98
|
|
178
|
-
}))
|
99
|
+
}));
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap base-component.js v5.2.3 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2022 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'), require('./util/index'), require('./dom/event-handler'), require('./util/config')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data', './util/index', './dom/event-handler', './util/config'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BaseComponent = factory(global.Data, global.Index, global.EventHandler, global.Config));
|
10
|
+
})(this, (function (Data, index, EventHandler, Config) { 'use strict';
|
11
|
+
|
12
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
|
+
|
14
|
+
const Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
|
+
const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
|
17
|
+
|
18
|
+
/**
|
19
|
+
* --------------------------------------------------------------------------
|
20
|
+
* Bootstrap (v5.2.3): base-component.js
|
21
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
22
|
+
* --------------------------------------------------------------------------
|
23
|
+
*/
|
24
|
+
/**
|
25
|
+
* Constants
|
26
|
+
*/
|
27
|
+
|
28
|
+
const VERSION = '5.2.3';
|
29
|
+
/**
|
30
|
+
* Class definition
|
31
|
+
*/
|
32
|
+
|
33
|
+
class BaseComponent extends Config__default.default {
|
34
|
+
constructor(element, config) {
|
35
|
+
super();
|
36
|
+
element = index.getElement(element);
|
37
|
+
|
38
|
+
if (!element) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
this._element = element;
|
43
|
+
this._config = this._getConfig(config);
|
44
|
+
Data__default.default.set(this._element, this.constructor.DATA_KEY, this);
|
45
|
+
} // Public
|
46
|
+
|
47
|
+
|
48
|
+
dispose() {
|
49
|
+
Data__default.default.remove(this._element, this.constructor.DATA_KEY);
|
50
|
+
EventHandler__default.default.off(this._element, this.constructor.EVENT_KEY);
|
51
|
+
|
52
|
+
for (const propertyName of Object.getOwnPropertyNames(this)) {
|
53
|
+
this[propertyName] = null;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
_queueCallback(callback, element, isAnimated = true) {
|
58
|
+
index.executeAfterTransition(callback, element, isAnimated);
|
59
|
+
}
|
60
|
+
|
61
|
+
_getConfig(config) {
|
62
|
+
config = this._mergeConfigObj(config, this._element);
|
63
|
+
config = this._configAfterMerge(config);
|
64
|
+
|
65
|
+
this._typeCheckConfig(config);
|
66
|
+
|
67
|
+
return config;
|
68
|
+
} // Static
|
69
|
+
|
70
|
+
|
71
|
+
static getInstance(element) {
|
72
|
+
return Data__default.default.get(index.getElement(element), this.DATA_KEY);
|
73
|
+
}
|
74
|
+
|
75
|
+
static getOrCreateInstance(element, config = {}) {
|
76
|
+
return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
|
77
|
+
}
|
78
|
+
|
79
|
+
static get VERSION() {
|
80
|
+
return VERSION;
|
81
|
+
}
|
82
|
+
|
83
|
+
static get DATA_KEY() {
|
84
|
+
return `bs.${this.NAME}`;
|
85
|
+
}
|
86
|
+
|
87
|
+
static get EVENT_KEY() {
|
88
|
+
return `.${this.DATA_KEY}`;
|
89
|
+
}
|
90
|
+
|
91
|
+
static eventName(name) {
|
92
|
+
return `${name}${this.EVENT_KEY}`;
|
93
|
+
}
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
return BaseComponent;
|
98
|
+
|
99
|
+
}));
|