bootstrap 5.1.3 → 5.3.5

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +61 -0
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +1 -0
  5. data/README.md +35 -14
  6. data/Rakefile +16 -5
  7. data/assets/javascripts/bootstrap/alert.js +22 -167
  8. data/assets/javascripts/bootstrap/base-component.js +34 -133
  9. data/assets/javascripts/bootstrap/button.js +19 -86
  10. data/assets/javascripts/bootstrap/carousel.js +209 -564
  11. data/assets/javascripts/bootstrap/collapse.js +78 -324
  12. data/assets/javascripts/bootstrap/dom/data.js +8 -14
  13. data/assets/javascripts/bootstrap/dom/event-handler.js +89 -174
  14. data/assets/javascripts/bootstrap/dom/manipulator.js +22 -39
  15. data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -71
  16. data/assets/javascripts/bootstrap/dropdown.js +135 -420
  17. data/assets/javascripts/bootstrap/modal.js +115 -837
  18. data/assets/javascripts/bootstrap/offcanvas.js +93 -714
  19. data/assets/javascripts/bootstrap/popover.js +42 -130
  20. data/assets/javascripts/bootstrap/scrollspy.js +180 -296
  21. data/assets/javascripts/bootstrap/tab.js +197 -245
  22. data/assets/javascripts/bootstrap/toast.js +52 -276
  23. data/assets/javascripts/bootstrap/tooltip.js +283 -744
  24. data/assets/javascripts/bootstrap/util/backdrop.js +138 -0
  25. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  26. data/assets/javascripts/bootstrap/util/config.js +67 -0
  27. data/assets/javascripts/bootstrap/util/focustrap.js +112 -0
  28. data/assets/javascripts/bootstrap/util/index.js +280 -0
  29. data/assets/javascripts/bootstrap/util/sanitizer.js +113 -0
  30. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  31. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  32. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  33. data/assets/javascripts/bootstrap-global-this-define.js +1 -1
  34. data/assets/javascripts/bootstrap-sprockets.js +15 -6
  35. data/assets/javascripts/bootstrap.js +2278 -2831
  36. data/assets/javascripts/bootstrap.min.js +3 -3
  37. data/assets/stylesheets/_bootstrap-grid.scss +4 -9
  38. data/assets/stylesheets/_bootstrap-reboot.scss +4 -7
  39. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  40. data/assets/stylesheets/_bootstrap.scss +5 -6
  41. data/assets/stylesheets/bootstrap/_accordion.scss +68 -33
  42. data/assets/stylesheets/bootstrap/_alert.scss +25 -14
  43. data/assets/stylesheets/bootstrap/_badge.scss +14 -5
  44. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -10
  45. data/assets/stylesheets/bootstrap/_button-group.scss +12 -4
  46. data/assets/stylesheets/bootstrap/_buttons.scss +133 -28
  47. data/assets/stylesheets/bootstrap/_card.scss +61 -39
  48. data/assets/stylesheets/bootstrap/_carousel.scss +22 -25
  49. data/assets/stylesheets/bootstrap/_close.scss +36 -10
  50. data/assets/stylesheets/bootstrap/_containers.scss +1 -1
  51. data/assets/stylesheets/bootstrap/_dropdown.scss +86 -76
  52. data/assets/stylesheets/bootstrap/_functions.scss +10 -10
  53. data/assets/stylesheets/bootstrap/_grid.scss +9 -3
  54. data/assets/stylesheets/bootstrap/_helpers.scss +3 -0
  55. data/assets/stylesheets/bootstrap/_list-group.scss +81 -56
  56. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  57. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  58. data/assets/stylesheets/bootstrap/_modal.scss +76 -45
  59. data/assets/stylesheets/bootstrap/_nav.scss +87 -29
  60. data/assets/stylesheets/bootstrap/_navbar.scss +102 -148
  61. data/assets/stylesheets/bootstrap/_offcanvas.scss +125 -61
  62. data/assets/stylesheets/bootstrap/_pagination.scss +66 -21
  63. data/assets/stylesheets/bootstrap/_placeholders.scss +1 -1
  64. data/assets/stylesheets/bootstrap/_popover.scss +90 -52
  65. data/assets/stylesheets/bootstrap/_progress.scss +31 -11
  66. data/assets/stylesheets/bootstrap/_reboot.scss +32 -46
  67. data/assets/stylesheets/bootstrap/_root.scss +155 -22
  68. data/assets/stylesheets/bootstrap/_spinners.scss +38 -22
  69. data/assets/stylesheets/bootstrap/_tables.scss +40 -24
  70. data/assets/stylesheets/bootstrap/_toasts.scss +38 -16
  71. data/assets/stylesheets/bootstrap/_tooltip.scss +60 -56
  72. data/assets/stylesheets/bootstrap/_type.scss +3 -1
  73. data/assets/stylesheets/bootstrap/_utilities.scss +209 -33
  74. data/assets/stylesheets/bootstrap/_variables-dark.scss +102 -0
  75. data/assets/stylesheets/bootstrap/_variables.scss +415 -303
  76. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +39 -5
  77. data/assets/stylesheets/bootstrap/forms/_form-check.scss +51 -14
  78. data/assets/stylesheets/bootstrap/forms/_form-control.scss +36 -41
  79. data/assets/stylesheets/bootstrap/forms/_form-range.scss +3 -3
  80. data/assets/stylesheets/bootstrap/forms/_form-select.scss +12 -4
  81. data/assets/stylesheets/bootstrap/forms/_input-group.scss +20 -9
  82. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  83. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  84. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  85. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  86. data/assets/stylesheets/bootstrap/helpers/_position.scss +7 -1
  87. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  88. data/assets/stylesheets/bootstrap/helpers/_vr.scss +2 -2
  89. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -4
  90. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  91. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +8 -8
  92. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +32 -95
  93. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  94. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  95. data/assets/stylesheets/bootstrap/mixins/_container.scss +4 -2
  96. data/assets/stylesheets/bootstrap/mixins/_forms.scss +38 -19
  97. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  98. data/assets/stylesheets/bootstrap/mixins/_grid.scss +15 -15
  99. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  100. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +4 -25
  101. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  102. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +12 -9
  103. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +14 -6
  104. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +6 -2
  105. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  106. data/bootstrap.gemspec +3 -3
  107. data/lib/bootstrap/engine.rb +17 -2
  108. data/lib/bootstrap/version.rb +2 -2
  109. data/tasks/updater/js.rb +10 -5
  110. data/tasks/updater/network.rb +2 -2
  111. data/tasks/updater/scss.rb +2 -2
  112. data/tasks/updater.rb +2 -2
  113. data/test/dummy_rails/config/application.rb +0 -2
  114. data/test/dummy_rails/public/favicon.ico +0 -0
  115. data/test/gemfiles/rails_4_2.gemfile +2 -1
  116. data/test/gemfiles/rails_5_0.gemfile +1 -2
  117. data/test/gemfiles/rails_5_1.gemfile +1 -2
  118. data/test/gemfiles/rails_5_2.gemfile +7 -0
  119. data/test/gemfiles/rails_6_0.gemfile +1 -1
  120. data/test/gemfiles/rails_6_1.gemfile +1 -1
  121. data/test/gemfiles/rails_7_0_dartsass.gemfile +7 -0
  122. data/test/gemfiles/rails_7_0_sassc.gemfile +7 -0
  123. data/test/rails_test.rb +0 -5
  124. data/test/test_helper.rb +3 -2
  125. metadata +49 -29
  126. data/.travis.yml +0 -32
  127. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 666b108731be39c8122df9a54b7b2a1715f02b92e03caa941c132b3e7ec352ca
4
- data.tar.gz: 57086f0d9bb88ba6a0abf74a5f0006b6eed21168d37009c2159e8ab9b68385f4
3
+ metadata.gz: b5bca71288a91d860c55563440f48e9df863f1700bf998ed61776d3536e2f397
4
+ data.tar.gz: 01a1490029857cbb450a1c03fdc769c64b1a136abf20091c790f1f0241e531f5
5
5
  SHA512:
6
- metadata.gz: 6171d65c922c486d41a0cb7f4e781e389b2cf0d9e00cf7c350fcdf6ab59b814e8daa7449a9a97d7462e6945f766261466cbf750f0aedc07301f366d2f7731eaf
7
- data.tar.gz: b65871d048cecf29a714362f75348bc167ba158e50197908cde71ff197d834c0d84eb9ead9be4f7c87c22f49da0c164a6aa997843b2bc5998f6b12effc762db7
6
+ metadata.gz: c69ffecb7d28116e379082881823ebeec23bc9bff8496e2fadebb7875dfd24493e92c3066370b2c16136a47072122aa634c540d5c6d7efd271fc720cab138fa9
7
+ data.tar.gz: a3864d7a58c8f85bcccdf06aae34ff2aa10c2a76b84f4d119cd4530a81f29c710635e6d62a281d8e886f6972dfc1dde11af7f17888bcde85723a1c72eeb7f116
@@ -0,0 +1,61 @@
1
+ name: CI
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+ - workflow_dispatch
7
+
8
+ jobs:
9
+ test:
10
+ env:
11
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby_version: ['2.5', '2.6', '2.7', '3.0', '3.1']
16
+ gemfile:
17
+ - test/gemfiles/rails_5_0.gemfile
18
+ - test/gemfiles/rails_5_1.gemfile
19
+ - test/gemfiles/rails_5_2.gemfile
20
+ - test/gemfiles/rails_6_0.gemfile
21
+ - test/gemfiles/rails_6_1.gemfile
22
+ - test/gemfiles/rails_7_0_sassc.gemfile
23
+ - test/gemfiles/rails_7_0_dartsass.gemfile
24
+ include:
25
+ - ruby_version: '2.5'
26
+ gemfile: test/gemfiles/rails_4_2.gemfile
27
+ - ruby_version: '2.6'
28
+ gemfile: test/gemfiles/rails_4_2.gemfile
29
+ exclude:
30
+ - ruby_version: '2.5'
31
+ gemfile: test/gemfiles/rails_7_0_sassc.gemfile
32
+ - ruby_version: '2.5'
33
+ gemfile: test/gemfiles/rails_7_0_dartsass.gemfile
34
+ - ruby_version: '2.6'
35
+ gemfile: test/gemfiles/rails_7_0_sassc.gemfile
36
+ - ruby_version: '2.6'
37
+ gemfile: test/gemfiles/rails_7_0_dartsass.gemfile
38
+ - ruby_version: '3.0'
39
+ gemfile: test/gemfiles/rails_5_0.gemfile
40
+ - ruby_version: '3.0'
41
+ gemfile: test/gemfiles/rails_5_1.gemfile
42
+ - ruby_version: '3.0'
43
+ gemfile: test/gemfiles/rails_5_2.gemfile
44
+ - ruby_version: '3.1'
45
+ gemfile: test/gemfiles/rails_5_0.gemfile
46
+ - ruby_version: '3.1'
47
+ gemfile: test/gemfiles/rails_5_1.gemfile
48
+ - ruby_version: '3.1'
49
+ gemfile: test/gemfiles/rails_5_2.gemfile
50
+ - ruby_version: '3.1'
51
+ gemfile: test/gemfiles/rails_6_0.gemfile
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - uses: actions/checkout@v3
55
+ - name: Set up Ruby
56
+ uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby_version }}
59
+ bundler-cache: true # 'bundle install' and cache
60
+ - name: Build and test with Rake
61
+ run: bundle exec rake --trace
data/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ 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
+ # 5.3.4
10
+
11
+ * Autoprefixer is now optional.
12
+ [#283](https://github.com/twbs/bootstrap-rubygem/pull/283)
13
+
14
+ # 5.3.3
15
+
16
+ * Adds support for other Sass engines: dartsass-sprockets, dartsass-rails, and cssbundling-rails.
17
+
9
18
  # 4.2.1
10
19
 
11
20
  * Bootstrap rubygem now depends on SassC instead of Sass.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem 'popper_js', '>= 1.12.3'
7
+ gem 'dartsass-sprockets'
7
8
  end
8
9
 
9
10
  group :debug do
data/README.md CHANGED
@@ -1,11 +1,12 @@
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)
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 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
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 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.
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.
9
10
 
10
11
  ## Installation
11
12
 
@@ -20,10 +21,19 @@ Please see the appropriate guide for your environment of choice:
20
21
  Add `bootstrap` to your Gemfile:
21
22
 
22
23
  ```ruby
23
- gem 'bootstrap', '~> 5.1.3'
24
+ gem 'bootstrap', '~> 5.3.3'
24
25
  ```
25
26
 
26
- Ensure that `sprockets-rails` is at least v2.3.2.
27
+ This gem requires a Sass engine, so make sure you have **one** of these gems in your Gemfile:
28
+ - [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+
29
+ - [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft
30
+ - [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine
31
+ - [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4
32
+
33
+ Also ensure that `sprockets-rails` is at least v2.3.2.
34
+
35
+ For wider browser compatibility, use [Autoprefixer][autoprefixer].
36
+ If you are using Rails, add the `autoprefixer-rails` gem to your app and ensure you have a JavaScript runtime (e.g. NodeJS).
27
37
 
28
38
  `bundle install` and restart your server to make the files available through the pipeline.
29
39
 
@@ -58,6 +68,25 @@ Bootstrap tooltips and popovers depend on [popper.js] for positioning.
58
68
  The `bootstrap` gem already depends on the
59
69
  [popper_js](https://github.com/glebm/popper_js-rubygem) gem.
60
70
 
71
+ #### Importmaps
72
+
73
+ You can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb`
74
+ as well as `popper.js`:
75
+
76
+ ```ruby
77
+ pin "bootstrap", to: "bootstrap.min.js", preload: true
78
+ pin "@popperjs/core", to: "popper.js", preload: true
79
+ ```
80
+
81
+ Whichever files you pin will need to be added to `config.assets.precompile`:
82
+
83
+ ```ruby
84
+ # config/initializers/assets.rb
85
+ Rails.application.config.assets.precompile += %w(bootstrap.min.js popper.js)
86
+ ```
87
+
88
+ #### Sprockets
89
+
61
90
  Add Bootstrap dependencies and Bootstrap to your `application.js`:
62
91
 
63
92
  ```js
@@ -87,14 +116,6 @@ Refer to your framework's documentation on the subject.
87
116
 
88
117
  ## Configuration
89
118
 
90
- ### Sass: Autoprefixer
91
-
92
- Bootstrap requires the use of [Autoprefixer][autoprefixer].
93
- [Autoprefixer][autoprefixer] adds vendor prefixes to CSS rules using values from [Can I Use](http://caniuse.com/).
94
-
95
- If you are using bootstrap with Rails, autoprefixer is set up for you automatically.
96
- Otherwise, please consult the [Autoprefixer documentation][autoprefixer].
97
-
98
119
  ### Sass: Individual components
99
120
 
100
121
  By default all of Bootstrap is imported.
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'bundler/setup'
2
3
 
3
4
  lib_path = File.join(File.dirname(__FILE__), 'lib')
4
5
  $:.unshift(lib_path) unless $:.include?(lib_path)
@@ -45,16 +46,26 @@ end
45
46
 
46
47
  desc 'Dumps output to a CSS file for testing'
47
48
  task :debug do
48
- require 'sassc'
49
+ begin
50
+ require 'sass-embedded'
51
+ rescue LoadError
52
+ begin
53
+ require 'sassc'
54
+ rescue LoadError
55
+ raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets or sassc-rails to your dependencies.")
56
+ end
57
+ end
49
58
  require './lib/bootstrap'
50
59
  require 'term/ansicolor'
51
- require 'autoprefixer-rails'
52
60
  path = Bootstrap.stylesheets_path
53
61
  %w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
54
- engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path])
62
+ filename = "#{path}/#{file}.scss"
63
+ css = if defined?(SassC::Engine)
64
+ SassC::Engine.new(File.read(filename), filename: filename, syntax: :scss).render
65
+ else
66
+ Sass.compile(filename).css
67
+ end
55
68
  out = File.join('tmp', "#{file[1..-1]}.css")
56
- css = engine.render
57
- css = AutoprefixerRails.process(css)
58
69
  File.write(out, css)
59
70
  $stderr.puts Term::ANSIColor.green "Compiled #{out}"
60
71
  end
@@ -1,155 +1,24 @@
1
1
  /*!
2
- * Bootstrap alert.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap alert.js v5.3.5 (https://getbootstrap.com/)
3
+ * Copyright 2011-2025 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('./dom/event-handler.js'), require('./base-component.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base));
10
- })(this, (function (EventHandler, BaseComponent) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
-
17
- /**
18
- * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.3): util/index.js
20
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
- * --------------------------------------------------------------------------
22
- */
23
-
24
- const getSelector = element => {
25
- let selector = element.getAttribute('data-bs-target');
26
-
27
- if (!selector || selector === '#') {
28
- let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
29
- // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
30
- // `document.querySelector` will rightfully complain it is invalid.
31
- // See https://github.com/twbs/bootstrap/issues/32273
32
-
33
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
34
- return null;
35
- } // Just in case some CMS puts out a full URL with the anchor appended
36
-
37
-
38
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
39
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
40
- }
41
-
42
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
43
- }
44
-
45
- return selector;
46
- };
47
-
48
- const getElementFromSelector = element => {
49
- const selector = getSelector(element);
50
- return selector ? document.querySelector(selector) : null;
51
- };
52
-
53
- const isDisabled = element => {
54
- if (!element || element.nodeType !== Node.ELEMENT_NODE) {
55
- return true;
56
- }
57
-
58
- if (element.classList.contains('disabled')) {
59
- return true;
60
- }
61
-
62
- if (typeof element.disabled !== 'undefined') {
63
- return element.disabled;
64
- }
65
-
66
- return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
67
- };
68
-
69
- const getjQuery = () => {
70
- const {
71
- jQuery
72
- } = window;
73
-
74
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
75
- return jQuery;
76
- }
77
-
78
- return null;
79
- };
80
-
81
- const DOMContentLoadedCallbacks = [];
82
-
83
- const onDOMContentLoaded = callback => {
84
- if (document.readyState === 'loading') {
85
- // add listener on the first call when the document is in loading state
86
- if (!DOMContentLoadedCallbacks.length) {
87
- document.addEventListener('DOMContentLoaded', () => {
88
- DOMContentLoadedCallbacks.forEach(callback => callback());
89
- });
90
- }
91
-
92
- DOMContentLoadedCallbacks.push(callback);
93
- } else {
94
- callback();
95
- }
96
- };
97
-
98
- const defineJQueryPlugin = plugin => {
99
- onDOMContentLoaded(() => {
100
- const $ = getjQuery();
101
- /* istanbul ignore if */
102
-
103
- if ($) {
104
- const name = plugin.NAME;
105
- const JQUERY_NO_CONFLICT = $.fn[name];
106
- $.fn[name] = plugin.jQueryInterface;
107
- $.fn[name].Constructor = plugin;
108
-
109
- $.fn[name].noConflict = () => {
110
- $.fn[name] = JQUERY_NO_CONFLICT;
111
- return plugin.jQueryInterface;
112
- };
113
- }
114
- });
115
- };
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./util/component-functions.js'), require('./util/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './util/component-functions', './util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.BaseComponent, global.EventHandler, global.ComponentFunctions, global.Index));
10
+ })(this, (function (BaseComponent, EventHandler, componentFunctions_js, index_js) { 'use strict';
116
11
 
117
12
  /**
118
13
  * --------------------------------------------------------------------------
119
- * Bootstrap (v5.1.3): util/component-functions.js
14
+ * Bootstrap alert.js
120
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
121
16
  * --------------------------------------------------------------------------
122
17
  */
123
18
 
124
- const enableDismissTrigger = (component, method = 'hide') => {
125
- const clickEvent = `click.dismiss${component.EVENT_KEY}`;
126
- const name = component.NAME;
127
- EventHandler__default.default.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
128
- if (['A', 'AREA'].includes(this.tagName)) {
129
- event.preventDefault();
130
- }
131
-
132
- if (isDisabled(this)) {
133
- return;
134
- }
135
19
 
136
- const target = getElementFromSelector(this) || this.closest(`.${name}`);
137
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
138
-
139
- instance[method]();
140
- });
141
- };
142
-
143
- /**
144
- * --------------------------------------------------------------------------
145
- * Bootstrap (v5.1.3): alert.js
146
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
147
- * --------------------------------------------------------------------------
148
- */
149
20
  /**
150
- * ------------------------------------------------------------------------
151
21
  * Constants
152
- * ------------------------------------------------------------------------
153
22
  */
154
23
 
155
24
  const NAME = 'alert';
@@ -159,75 +28,61 @@
159
28
  const EVENT_CLOSED = `closed${EVENT_KEY}`;
160
29
  const CLASS_NAME_FADE = 'fade';
161
30
  const CLASS_NAME_SHOW = 'show';
31
+
162
32
  /**
163
- * ------------------------------------------------------------------------
164
- * Class Definition
165
- * ------------------------------------------------------------------------
33
+ * Class definition
166
34
  */
167
35
 
168
- class Alert extends BaseComponent__default.default {
36
+ class Alert extends BaseComponent {
169
37
  // Getters
170
38
  static get NAME() {
171
39
  return NAME;
172
- } // Public
173
-
40
+ }
174
41
 
42
+ // Public
175
43
  close() {
176
- const closeEvent = EventHandler__default.default.trigger(this._element, EVENT_CLOSE);
177
-
44
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
178
45
  if (closeEvent.defaultPrevented) {
179
46
  return;
180
47
  }
181
-
182
48
  this._element.classList.remove(CLASS_NAME_SHOW);
183
-
184
49
  const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
185
-
186
50
  this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
187
- } // Private
188
-
51
+ }
189
52
 
53
+ // Private
190
54
  _destroyElement() {
191
55
  this._element.remove();
192
-
193
- EventHandler__default.default.trigger(this._element, EVENT_CLOSED);
56
+ EventHandler.trigger(this._element, EVENT_CLOSED);
194
57
  this.dispose();
195
- } // Static
196
-
58
+ }
197
59
 
60
+ // Static
198
61
  static jQueryInterface(config) {
199
62
  return this.each(function () {
200
63
  const data = Alert.getOrCreateInstance(this);
201
-
202
64
  if (typeof config !== 'string') {
203
65
  return;
204
66
  }
205
-
206
67
  if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
207
68
  throw new TypeError(`No method named "${config}"`);
208
69
  }
209
-
210
70
  data[config](this);
211
71
  });
212
72
  }
213
-
214
73
  }
74
+
215
75
  /**
216
- * ------------------------------------------------------------------------
217
- * Data Api implementation
218
- * ------------------------------------------------------------------------
76
+ * Data API implementation
219
77
  */
220
78
 
79
+ componentFunctions_js.enableDismissTrigger(Alert, 'close');
221
80
 
222
- enableDismissTrigger(Alert, 'close');
223
81
  /**
224
- * ------------------------------------------------------------------------
225
82
  * jQuery
226
- * ------------------------------------------------------------------------
227
- * add .Alert to jQuery only if jQuery is present
228
83
  */
229
84
 
230
- defineJQueryPlugin(Alert);
85
+ index_js.defineJQueryPlugin(Alert);
231
86
 
232
87
  return Alert;
233
88