0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Release v5.0.0 (#33647)

* Bump version to 5.0.0

* Fix npm tag

* Dist
This commit is contained in:
XhmikosR 2021-05-05 22:32:12 +03:00 committed by GitHub
parent 48ae5a7149
commit bf09367486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 2497 additions and 2028 deletions

View File

@ -46,11 +46,11 @@ Our default branch is for development of our upcoming Bootstrap 5 release. Head
Several quick start options are available: Several quick start options are available:
- [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.0.0-beta3.zip) - [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.0.0.zip)
- Clone the repo: `git clone https://github.com/twbs/bootstrap.git` - Clone the repo: `git clone https://github.com/twbs/bootstrap.git`
- Install with [npm](https://www.npmjs.com/): `npm install bootstrap@next` - Install with [npm](https://www.npmjs.com/): `npm install bootstrap`
- Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap@next` - Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap`
- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:5.0.0-beta3` - Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:5.0.0`
- Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass` - Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass`
Read the [Getting started page](https://getbootstrap.com/docs/5.0/getting-started/introduction/) for information on the framework contents, templates and examples, and more. Read the [Getting started page](https://getbootstrap.com/docs/5.0/getting-started/introduction/) for information on the framework contents, templates and examples, and more.

View File

@ -47,8 +47,8 @@ params:
social_image_path: /docs/5.0/assets/brand/bootstrap-social.png social_image_path: /docs/5.0/assets/brand/bootstrap-social.png
social_logo_path: /docs/5.0/assets/brand/bootstrap-social-logo.png social_logo_path: /docs/5.0/assets/brand/bootstrap-social-logo.png
current_version: "5.0.0-beta3" current_version: "5.0.0"
current_ruby_version: "5.0.0.beta3" current_ruby_version: "5.0.0"
docs_version: "5.0" docs_version: "5.0"
rfs_version: "9.0.3" rfs_version: "9.0.3"
github_org: "https://github.com/twbs" github_org: "https://github.com/twbs"
@ -61,19 +61,19 @@ params:
icons: "https://icons.getbootstrap.com/" icons: "https://icons.getbootstrap.com/"
download: download:
source: "https://github.com/twbs/bootstrap/archive/v5.0.0-beta3.zip" source: "https://github.com/twbs/bootstrap/archive/v5.0.0.zip"
dist: "https://github.com/twbs/bootstrap/releases/download/v5.0.0-beta3/bootstrap-5.0.0-beta3-dist.zip" dist: "https://github.com/twbs/bootstrap/releases/download/v5.0.0/bootstrap-5.0.0-dist.zip"
dist_examples: "https://github.com/twbs/bootstrap/releases/download/v5.0.0-beta3/bootstrap-5.0.0-beta3-examples.zip" dist_examples: "https://github.com/twbs/bootstrap/releases/download/v5.0.0/bootstrap-5.0.0-examples.zip"
cdn: cdn:
# See https://www.srihash.org for info on how to generate the hashes # See https://www.srihash.org for info on how to generate the hashes
css: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" css: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css"
css_hash: "sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" css_hash: "sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0"
css_rtl: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.rtl.min.css" css_rtl: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.rtl.min.css"
css_rtl_hash: "sha384-trxYGD5BY4TyBTvU5H23FalSCYwpLA0vWEvXXGm5eytyztxb+97WzzY+IWDOSbav" css_rtl_hash: "sha384-jHiSqEim4+W1UCvv8kTcMbtCZlRF8MxbgKdfpvncia8gdN1UImBnhTpKtufREzv7"
js: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" js: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.min.js"
js_hash: "sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" js_hash: "sha384-lpyLfhYuitXl2zRZ5Bn2fqnhNAKOAaM/0Kr9laMspuaMiZfGmfwRNFh8HlMy49eQ"
js_bundle: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" js_bundle: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"
js_bundle_hash: "sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" js_bundle_hash: "sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8"
popper: "https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" popper: "https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
popper_hash: "sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" popper_hash: "sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Grid v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Grid v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Grid v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Grid v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Grid v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Grid v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Grid v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Grid v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Reboot v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Reboot v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Reboot v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Reboot v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Utilities v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Utilities v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Utilities v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Utilities v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Utilities v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Utilities v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap Utilities v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap Utilities v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
@charset "UTF-8"; @charset "UTF-8";
/*! /*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
@ -2169,7 +2169,10 @@ progress {
.form-control[type=file] { .form-control[type=file] {
overflow: hidden; overflow: hidden;
} }
.form-control[type=file]:not(:disabled):not([readonly]) { .form-control[type=file]:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control[type=file]:not(:disabled):not(:read-only) {
cursor: pointer; cursor: pointer;
} }
.form-control:focus { .form-control:focus {
@ -2190,7 +2193,11 @@ progress {
color: #6c757d; color: #6c757d;
opacity: 1; opacity: 1;
} }
.form-control:disabled, .form-control[readonly] { .form-control:-moz-read-only {
background-color: #e9ecef;
opacity: 1;
}
.form-control:disabled, .form-control:read-only {
background-color: #e9ecef; background-color: #e9ecef;
opacity: 1; opacity: 1;
} }
@ -2214,7 +2221,10 @@ progress {
transition: none; transition: none;
} }
} }
.form-control:hover:not(:disabled):not([readonly])::file-selector-button { .form-control:hover:not(:disabled):not(:-moz-read-only)::file-selector-button {
background-color: #dde0e3;
}
.form-control:hover:not(:disabled):not(:read-only)::file-selector-button {
background-color: #dde0e3; background-color: #dde0e3;
} }
.form-control::-webkit-file-upload-button { .form-control::-webkit-file-upload-button {
@ -2239,7 +2249,7 @@ progress {
transition: none; transition: none;
} }
} }
.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button { .form-control:hover:not(:disabled):not(:read-only)::-webkit-file-upload-button {
background-color: #dde0e3; background-color: #dde0e3;
} }
@ -2312,7 +2322,10 @@ textarea.form-control-lg {
height: auto; height: auto;
padding: 0.375rem; padding: 0.375rem;
} }
.form-control-color:not(:disabled):not([readonly]) { .form-control-color:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control-color:not(:disabled):not(:read-only) {
cursor: pointer; cursor: pointer;
} }
.form-control-color::-moz-color-swatch { .form-control-color::-moz-color-swatch {
@ -2759,6 +2772,8 @@ textarea.form-control-lg {
.was-validated .form-select:valid, .form-select.is-valid { .was-validated .form-select:valid, .form-select.is-valid {
border-color: #198754; border-color: #198754;
}
.was-validated .form-select:valid:not([multiple]):not([size]), .was-validated .form-select:valid:not([multiple])[size="1"], .form-select.is-valid:not([multiple]):not([size]), .form-select.is-valid:not([multiple])[size="1"] {
padding-right: 4.125rem; padding-right: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
background-position: right 0.75rem center, center right 2.25rem; background-position: right 0.75rem center, center right 2.25rem;
@ -2841,6 +2856,8 @@ textarea.form-control-lg {
.was-validated .form-select:invalid, .form-select.is-invalid { .was-validated .form-select:invalid, .form-select.is-invalid {
border-color: #dc3545; border-color: #dc3545;
}
.was-validated .form-select:invalid:not([multiple]):not([size]), .was-validated .form-select:invalid:not([multiple])[size="1"], .form-select.is-invalid:not([multiple]):not([size]), .form-select.is-invalid:not([multiple])[size="1"] {
padding-right: 4.125rem; padding-right: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
background-position: right 0.75rem center, center right 2.25rem; background-position: right 0.75rem center, center right 2.25rem;
@ -3427,7 +3444,6 @@ textarea.form-control-lg {
.dropdown-menu { .dropdown-menu {
position: absolute; position: absolute;
top: 100%;
z-index: 1000; z-index: 1000;
display: none; display: none;
min-width: 10rem; min-width: 10rem;
@ -3443,6 +3459,7 @@ textarea.form-control-lg {
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.dropdown-menu[data-bs-popper] { .dropdown-menu[data-bs-popper] {
top: 100%;
left: 0; left: 0;
margin-top: 0.125rem; margin-top: 0.125rem;
} }
@ -3568,12 +3585,10 @@ textarea.form-control-lg {
margin-left: 0; margin-left: 0;
} }
.dropend .dropdown-menu { .dropend .dropdown-menu[data-bs-popper] {
top: 0; top: 0;
right: auto; right: auto;
left: 100%; left: 100%;
}
.dropend .dropdown-menu[data-bs-popper] {
margin-top: 0; margin-top: 0;
margin-left: 0.125rem; margin-left: 0.125rem;
} }
@ -3594,12 +3609,10 @@ textarea.form-control-lg {
vertical-align: 0; vertical-align: 0;
} }
.dropstart .dropdown-menu { .dropstart .dropdown-menu[data-bs-popper] {
top: 0; top: 0;
right: 100%; right: 100%;
left: auto; left: auto;
}
.dropstart .dropdown-menu[data-bs-popper] {
margin-top: 0; margin-top: 0;
margin-right: 0.125rem; margin-right: 0.125rem;
} }
@ -3818,6 +3831,7 @@ textarea.form-control-lg {
.nav-link { .nav-link {
display: block; display: block;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
color: #0d6efd;
text-decoration: none; text-decoration: none;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
} }
@ -3826,6 +3840,9 @@ textarea.form-control-lg {
transition: none; transition: none;
} }
} }
.nav-link:hover, .nav-link:focus {
color: #0a58ca;
}
.nav-link.disabled { .nav-link.disabled {
color: #6c757d; color: #6c757d;
pointer-events: none; pointer-events: none;
@ -4404,7 +4421,7 @@ textarea.form-control-lg {
} }
.accordion-button:not(.collapsed)::after { .accordion-button:not(.collapsed)::after {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
transform: rotate(180deg); transform: rotate(-180deg);
} }
.accordion-button::after { .accordion-button::after {
flex-shrink: 0; flex-shrink: 0;
@ -4437,7 +4454,6 @@ textarea.form-control-lg {
} }
.accordion-item { .accordion-item {
margin-bottom: -1px;
background-color: #fff; background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.125); border: 1px solid rgba(0, 0, 0, 0.125);
} }
@ -4449,8 +4465,10 @@ textarea.form-control-lg {
border-top-left-radius: calc(0.25rem - 1px); border-top-left-radius: calc(0.25rem - 1px);
border-top-right-radius: calc(0.25rem - 1px); border-top-right-radius: calc(0.25rem - 1px);
} }
.accordion-item:not(:first-of-type) {
border-top: 0;
}
.accordion-item:last-of-type { .accordion-item:last-of-type {
margin-bottom: 0;
border-bottom-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem;
} }
@ -5261,7 +5279,7 @@ textarea.form-control-lg {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1050; z-index: 1040;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #000; background-color: #000;
@ -5314,14 +5332,6 @@ textarea.form-control-lg {
margin: 0.25rem; margin: 0.25rem;
} }
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 576px) { @media (min-width: 576px) {
.modal-dialog { .modal-dialog {
max-width: 500px; max-width: 500px;
@ -5934,7 +5944,7 @@ textarea.form-control-lg {
display: inline-block; display: inline-block;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
vertical-align: text-bottom; vertical-align: -0.125em;
border: 0.25em solid currentColor; border: 0.25em solid currentColor;
border-right-color: transparent; border-right-color: transparent;
border-radius: 50%; border-radius: 50%;
@ -5971,7 +5981,7 @@ textarea.form-control-lg {
display: inline-block; display: inline-block;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
vertical-align: text-bottom; vertical-align: -0.125em;
background-color: currentColor; background-color: currentColor;
border-radius: 50%; border-radius: 50%;
opacity: 0; opacity: 0;
@ -5994,7 +6004,7 @@ textarea.form-control-lg {
.offcanvas { .offcanvas {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 1040; z-index: 1050;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 100%; max-width: 100%;
@ -6012,6 +6022,7 @@ textarea.form-control-lg {
.offcanvas-header { .offcanvas-header {
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 1rem 1rem; padding: 1rem 1rem;
} }
@ -6047,6 +6058,16 @@ textarea.form-control-lg {
transform: translateX(100%); transform: translateX(100%);
} }
.offcanvas-top {
top: 0;
right: 0;
left: 0;
height: 30vh;
max-height: 100%;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
transform: translateY(-100%);
}
.offcanvas-bottom { .offcanvas-bottom {
right: 0; right: 0;
left: 0; left: 0;
@ -6060,17 +6081,6 @@ textarea.form-control-lg {
transform: none; transform: none;
} }
.offcanvas-backdrop::before {
position: fixed;
top: 0;
left: 0;
z-index: 1039;
width: 100vw;
height: 100vh;
content: "";
background-color: rgba(0, 0, 0, 0.5);
}
.clearfix::after { .clearfix::after {
display: block; display: block;
clear: both; clear: both;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
@charset "UTF-8"; @charset "UTF-8";
/*! /*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc. * Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
@ -2167,7 +2167,10 @@ progress {
.form-control[type=file] { .form-control[type=file] {
overflow: hidden; overflow: hidden;
} }
.form-control[type=file]:not(:disabled):not([readonly]) { .form-control[type=file]:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control[type=file]:not(:disabled):not(:read-only) {
cursor: pointer; cursor: pointer;
} }
.form-control:focus { .form-control:focus {
@ -2188,7 +2191,11 @@ progress {
color: #6c757d; color: #6c757d;
opacity: 1; opacity: 1;
} }
.form-control:disabled, .form-control[readonly] { .form-control:-moz-read-only {
background-color: #e9ecef;
opacity: 1;
}
.form-control:disabled, .form-control:read-only {
background-color: #e9ecef; background-color: #e9ecef;
opacity: 1; opacity: 1;
} }
@ -2212,7 +2219,10 @@ progress {
transition: none; transition: none;
} }
} }
.form-control:hover:not(:disabled):not([readonly])::file-selector-button { .form-control:hover:not(:disabled):not(:-moz-read-only)::file-selector-button {
background-color: #dde0e3;
}
.form-control:hover:not(:disabled):not(:read-only)::file-selector-button {
background-color: #dde0e3; background-color: #dde0e3;
} }
.form-control::-webkit-file-upload-button { .form-control::-webkit-file-upload-button {
@ -2237,7 +2247,7 @@ progress {
transition: none; transition: none;
} }
} }
.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button { .form-control:hover:not(:disabled):not(:read-only)::-webkit-file-upload-button {
background-color: #dde0e3; background-color: #dde0e3;
} }
@ -2310,7 +2320,10 @@ textarea.form-control-lg {
height: auto; height: auto;
padding: 0.375rem; padding: 0.375rem;
} }
.form-control-color:not(:disabled):not([readonly]) { .form-control-color:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control-color:not(:disabled):not(:read-only) {
cursor: pointer; cursor: pointer;
} }
.form-control-color::-moz-color-swatch { .form-control-color::-moz-color-swatch {
@ -2757,6 +2770,8 @@ textarea.form-control-lg {
.was-validated .form-select:valid, .form-select.is-valid { .was-validated .form-select:valid, .form-select.is-valid {
border-color: #198754; border-color: #198754;
}
.was-validated .form-select:valid:not([multiple]):not([size]), .was-validated .form-select:valid:not([multiple])[size="1"], .form-select.is-valid:not([multiple]):not([size]), .form-select.is-valid:not([multiple])[size="1"] {
padding-left: 4.125rem; padding-left: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
background-position: left 0.75rem center, center left 2.25rem; background-position: left 0.75rem center, center left 2.25rem;
@ -2839,6 +2854,8 @@ textarea.form-control-lg {
.was-validated .form-select:invalid, .form-select.is-invalid { .was-validated .form-select:invalid, .form-select.is-invalid {
border-color: #dc3545; border-color: #dc3545;
}
.was-validated .form-select:invalid:not([multiple]):not([size]), .was-validated .form-select:invalid:not([multiple])[size="1"], .form-select.is-invalid:not([multiple]):not([size]), .form-select.is-invalid:not([multiple])[size="1"] {
padding-left: 4.125rem; padding-left: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
background-position: left 0.75rem center, center left 2.25rem; background-position: left 0.75rem center, center left 2.25rem;
@ -3425,7 +3442,6 @@ textarea.form-control-lg {
.dropdown-menu { .dropdown-menu {
position: absolute; position: absolute;
top: 100%;
z-index: 1000; z-index: 1000;
display: none; display: none;
min-width: 10rem; min-width: 10rem;
@ -3441,6 +3457,7 @@ textarea.form-control-lg {
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.dropdown-menu[data-bs-popper] { .dropdown-menu[data-bs-popper] {
top: 100%;
right: 0; right: 0;
margin-top: 0.125rem; margin-top: 0.125rem;
} }
@ -3566,12 +3583,10 @@ textarea.form-control-lg {
margin-right: 0; margin-right: 0;
} }
.dropend .dropdown-menu { .dropend .dropdown-menu[data-bs-popper] {
top: 0; top: 0;
left: auto; left: auto;
right: 100%; right: 100%;
}
.dropend .dropdown-menu[data-bs-popper] {
margin-top: 0; margin-top: 0;
margin-right: 0.125rem; margin-right: 0.125rem;
} }
@ -3592,12 +3607,10 @@ textarea.form-control-lg {
vertical-align: 0; vertical-align: 0;
} }
.dropstart .dropdown-menu { .dropstart .dropdown-menu[data-bs-popper] {
top: 0; top: 0;
left: 100%; left: 100%;
right: auto; right: auto;
}
.dropstart .dropdown-menu[data-bs-popper] {
margin-top: 0; margin-top: 0;
margin-left: 0.125rem; margin-left: 0.125rem;
} }
@ -3816,6 +3829,7 @@ textarea.form-control-lg {
.nav-link { .nav-link {
display: block; display: block;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
color: #0d6efd;
text-decoration: none; text-decoration: none;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
} }
@ -3824,6 +3838,9 @@ textarea.form-control-lg {
transition: none; transition: none;
} }
} }
.nav-link:hover, .nav-link:focus {
color: #0a58ca;
}
.nav-link.disabled { .nav-link.disabled {
color: #6c757d; color: #6c757d;
pointer-events: none; pointer-events: none;
@ -4402,7 +4419,7 @@ textarea.form-control-lg {
} }
.accordion-button:not(.collapsed)::after { .accordion-button:not(.collapsed)::after {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
transform: rotate(-180deg); transform: rotate(180deg);
} }
.accordion-button::after { .accordion-button::after {
flex-shrink: 0; flex-shrink: 0;
@ -4435,7 +4452,6 @@ textarea.form-control-lg {
} }
.accordion-item { .accordion-item {
margin-bottom: -1px;
background-color: #fff; background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.125); border: 1px solid rgba(0, 0, 0, 0.125);
} }
@ -4447,8 +4463,10 @@ textarea.form-control-lg {
border-top-right-radius: calc(0.25rem - 1px); border-top-right-radius: calc(0.25rem - 1px);
border-top-left-radius: calc(0.25rem - 1px); border-top-left-radius: calc(0.25rem - 1px);
} }
.accordion-item:not(:first-of-type) {
border-top: 0;
}
.accordion-item:last-of-type { .accordion-item:last-of-type {
margin-bottom: 0;
border-bottom-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
} }
@ -5259,7 +5277,7 @@ textarea.form-control-lg {
position: fixed; position: fixed;
top: 0; top: 0;
right: 0; right: 0;
z-index: 1050; z-index: 1040;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #000; background-color: #000;
@ -5312,14 +5330,6 @@ textarea.form-control-lg {
margin: 0.25rem; margin: 0.25rem;
} }
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 576px) { @media (min-width: 576px) {
.modal-dialog { .modal-dialog {
max-width: 500px; max-width: 500px;
@ -5919,7 +5929,7 @@ textarea.form-control-lg {
display: inline-block; display: inline-block;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
vertical-align: text-bottom; vertical-align: -0.125em;
border: 0.25em solid currentColor; border: 0.25em solid currentColor;
border-left-color: transparent; border-left-color: transparent;
border-radius: 50%; border-radius: 50%;
@ -5956,7 +5966,7 @@ textarea.form-control-lg {
display: inline-block; display: inline-block;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
vertical-align: text-bottom; vertical-align: -0.125em;
background-color: currentColor; background-color: currentColor;
border-radius: 50%; border-radius: 50%;
opacity: 0; opacity: 0;
@ -5979,7 +5989,7 @@ textarea.form-control-lg {
.offcanvas { .offcanvas {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 1040; z-index: 1050;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 100%; max-width: 100%;
@ -5997,6 +6007,7 @@ textarea.form-control-lg {
.offcanvas-header { .offcanvas-header {
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 1rem 1rem; padding: 1rem 1rem;
} }
@ -6032,6 +6043,16 @@ textarea.form-control-lg {
transform: translateX(-100%); transform: translateX(-100%);
} }
.offcanvas-top {
top: 0;
left: 0;
right: 0;
height: 30vh;
max-height: 100%;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
transform: translateY(-100%);
}
.offcanvas-bottom { .offcanvas-bottom {
left: 0; left: 0;
right: 0; right: 0;
@ -6045,17 +6066,6 @@ textarea.form-control-lg {
transform: none; transform: none;
} }
.offcanvas-backdrop::before {
position: fixed;
top: 0;
right: 0;
z-index: 1039;
width: 100vw;
height: 100vh;
content: "";
background-color: rgba(0, 0, 0, 0.5);
}
.clearfix::after { .clearfix::after {
display: block; display: block;
clear: both; clear: both;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -11,7 +11,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -56,7 +56,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -134,7 +134,7 @@
const valueType = value && isElement$1(value) ? 'element' : toType(value); const valueType = value && isElement$1(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -192,7 +192,7 @@
return findShadowRoot(element.parentNode); return findShadowRoot(element.parentNode);
}; };
const noop = () => function () {}; const noop = () => {};
const reflow = element => element.offsetHeight; const reflow = element => element.offsetHeight;
@ -236,9 +236,15 @@
}); });
}; };
const execute = callback => {
if (typeof callback === 'function') {
callback();
}
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/data.js * Bootstrap (v5.0.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -292,7 +298,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/event-handler.js * Bootstrap (v5.0.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -312,6 +318,7 @@
mouseenter: 'mouseover', mouseenter: 'mouseover',
mouseleave: 'mouseout' mouseleave: 'mouseout'
}; };
const customEventsRegex = /^(mouseenter|mouseleave)/i;
const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -355,7 +362,7 @@
if (handler.oneOff) { if (handler.oneOff) {
// eslint-disable-next-line unicorn/consistent-destructuring // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, selector, fn);
} }
return fn.apply(target, [event]); return fn.apply(target, [event]);
@ -384,15 +391,8 @@
function normalizeParams(originalTypeEvent, handler, delegationFn) { function normalizeParams(originalTypeEvent, handler, delegationFn) {
const delegation = typeof handler === 'string'; const delegation = typeof handler === 'string';
const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click') const originalHandler = delegation ? delegationFn : handler;
let typeEvent = getTypeEvent(originalTypeEvent);
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
const custom = customEvents[typeEvent];
if (custom) {
typeEvent = custom;
}
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
if (!isNative) { if (!isNative) {
@ -410,6 +410,24 @@
if (!handler) { if (!handler) {
handler = delegationFn; handler = delegationFn;
delegationFn = null; delegationFn = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (customEventsRegex.test(originalTypeEvent)) {
const wrapFn = fn => {
return function (event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn.call(this, event);
}
};
};
if (delegationFn) {
delegationFn = wrapFn(delegationFn);
} else {
handler = wrapFn(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@ -453,6 +471,12 @@
}); });
} }
function getTypeEvent(event) {
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
event = event.replace(stripNameRegex, '');
return customEvents[event] || event;
}
const EventHandler = { const EventHandler = {
on(element, event, handler, delegationFn) { on(element, event, handler, delegationFn) {
addHandler(element, event, handler, delegationFn, false); addHandler(element, event, handler, delegationFn, false);
@ -505,7 +529,7 @@
} }
const $ = getjQuery(); const $ = getjQuery();
const typeEvent = event.replace(stripNameRegex, ''); const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent; const inNamespace = event !== typeEvent;
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
let jQueryEvent; let jQueryEvent;
@ -563,7 +587,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): base-component.js * Bootstrap (v5.0.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -573,7 +597,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta3'; const VERSION = '5.0.0';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {
@ -589,6 +613,7 @@
dispose() { dispose() {
Data.remove(this._element, this.constructor.DATA_KEY); Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null; this._element = null;
} }
/** Static */ /** Static */
@ -606,7 +631,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): alert.js * Bootstrap (v5.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -616,7 +641,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$b = 'alert'; const NAME$c = 'alert';
const DATA_KEY$b = 'bs.alert'; const DATA_KEY$b = 'bs.alert';
const EVENT_KEY$b = `.${DATA_KEY$b}`; const EVENT_KEY$b = `.${DATA_KEY$b}`;
const DATA_API_KEY$8 = '.data-api'; const DATA_API_KEY$8 = '.data-api';
@ -625,8 +650,8 @@
const EVENT_CLOSED = `closed${EVENT_KEY$b}`; const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`; const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
const CLASS_NAME_ALERT = 'alert'; const CLASS_NAME_ALERT = 'alert';
const CLASS_NAME_FADE$5 = 'fade'; const CLASS_NAME_FADE$6 = 'fade';
const CLASS_NAME_SHOW$8 = 'show'; const CLASS_NAME_SHOW$9 = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -662,9 +687,9 @@
} }
_removeElement(element) { _removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW$8); element.classList.remove(CLASS_NAME_SHOW$9);
if (!element.classList.contains(CLASS_NAME_FADE$5)) { if (!element.classList.contains(CLASS_NAME_FADE$6)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
@ -724,11 +749,11 @@
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$b, Alert); defineJQueryPlugin(NAME$c, Alert);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): button.js * Bootstrap (v5.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -738,7 +763,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$a = 'button'; const NAME$b = 'button';
const DATA_KEY$a = 'bs.button'; const DATA_KEY$a = 'bs.button';
const EVENT_KEY$a = `.${DATA_KEY$a}`; const EVENT_KEY$a = `.${DATA_KEY$a}`;
const DATA_API_KEY$7 = '.data-api'; const DATA_API_KEY$7 = '.data-api';
@ -804,11 +829,11 @@
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$a, Button); defineJQueryPlugin(NAME$b, Button);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/manipulator.js * Bootstrap (v5.0.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -882,7 +907,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Bootstrap (v5.0.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -953,7 +978,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): carousel.js * Bootstrap (v5.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -963,7 +988,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$9 = 'carousel'; const NAME$a = 'carousel';
const DATA_KEY$9 = 'bs.carousel'; const DATA_KEY$9 = 'bs.carousel';
const EVENT_KEY$9 = `.${DATA_KEY$9}`; const EVENT_KEY$9 = `.${DATA_KEY$9}`;
const DATA_API_KEY$6 = '.data-api'; const DATA_API_KEY$6 = '.data-api';
@ -972,7 +997,7 @@
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
const SWIPE_THRESHOLD = 40; const SWIPE_THRESHOLD = 40;
const Default$8 = { const Default$9 = {
interval: 5000, interval: 5000,
keyboard: true, keyboard: true,
slide: false, slide: false,
@ -980,7 +1005,7 @@
wrap: true, wrap: true,
touch: true touch: true
}; };
const DefaultType$8 = { const DefaultType$9 = {
interval: '(number|boolean)', interval: '(number|boolean)',
keyboard: 'boolean', keyboard: 'boolean',
slide: '(boolean|string)', slide: '(boolean|string)',
@ -1051,7 +1076,7 @@
static get Default() { static get Default() {
return Default$8; return Default$9;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1136,7 +1161,6 @@
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$9);
this._items = null; this._items = null;
this._config = null; this._config = null;
this._interval = null; this._interval = null;
@ -1149,10 +1173,10 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$8, config = { ...Default$9,
...config ...config
}; };
typeCheckConfig(NAME$9, config, DefaultType$8); typeCheckConfig(NAME$a, config, DefaultType$9);
return config; return config;
} }
@ -1251,11 +1275,11 @@
if (event.key === ARROW_LEFT_KEY) { if (event.key === ARROW_LEFT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_LEFT); this._slide(DIRECTION_RIGHT);
} else if (event.key === ARROW_RIGHT_KEY) { } else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_RIGHT); this._slide(DIRECTION_LEFT);
} }
} }
@ -1417,10 +1441,10 @@
} }
if (isRTL()) { if (isRTL()) {
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT; return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
} }
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV; return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
} }
_orderToDirection(order) { _orderToDirection(order) {
@ -1429,16 +1453,16 @@
} }
if (isRTL()) { if (isRTL()) {
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT; return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
} }
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT; return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
} // Static } // Static
static carouselInterface(element, config) { static carouselInterface(element, config) {
let data = Data.get(element, DATA_KEY$9); let data = Data.get(element, DATA_KEY$9);
let _config = { ...Default$8, let _config = { ...Default$9,
...Manipulator.getDataAttributes(element) ...Manipulator.getDataAttributes(element)
}; };
@ -1522,11 +1546,11 @@
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$9, Carousel); defineJQueryPlugin(NAME$a, Carousel);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): collapse.js * Bootstrap (v5.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -1536,15 +1560,15 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$8 = 'collapse'; const NAME$9 = 'collapse';
const DATA_KEY$8 = 'bs.collapse'; const DATA_KEY$8 = 'bs.collapse';
const EVENT_KEY$8 = `.${DATA_KEY$8}`; const EVENT_KEY$8 = `.${DATA_KEY$8}`;
const DATA_API_KEY$5 = '.data-api'; const DATA_API_KEY$5 = '.data-api';
const Default$7 = { const Default$8 = {
toggle: true, toggle: true,
parent: '' parent: ''
}; };
const DefaultType$7 = { const DefaultType$8 = {
toggle: 'boolean', toggle: 'boolean',
parent: '(string|element)' parent: '(string|element)'
}; };
@ -1553,7 +1577,7 @@
const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`; const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`; const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
const CLASS_NAME_SHOW$7 = 'show'; const CLASS_NAME_SHOW$8 = 'show';
const CLASS_NAME_COLLAPSE = 'collapse'; const CLASS_NAME_COLLAPSE = 'collapse';
const CLASS_NAME_COLLAPSING = 'collapsing'; const CLASS_NAME_COLLAPSING = 'collapsing';
const CLASS_NAME_COLLAPSED = 'collapsed'; const CLASS_NAME_COLLAPSED = 'collapsed';
@ -1600,7 +1624,7 @@
static get Default() { static get Default() {
return Default$7; return Default$8;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1609,7 +1633,7 @@
toggle() { toggle() {
if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
this.hide(); this.hide();
} else { } else {
this.show(); this.show();
@ -1617,7 +1641,7 @@
} }
show() { show() {
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1687,7 +1711,7 @@
const complete = () => { const complete = () => {
this._element.classList.remove(CLASS_NAME_COLLAPSING); this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
this._element.style[dimension] = ''; this._element.style[dimension] = '';
this.setTransitioning(false); this.setTransitioning(false);
@ -1703,7 +1727,7 @@
} }
hide() { hide() {
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1720,7 +1744,7 @@
this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.classList.add(CLASS_NAME_COLLAPSING);
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
const triggerArrayLength = this._triggerArray.length; const triggerArrayLength = this._triggerArray.length;
@ -1729,7 +1753,7 @@
const trigger = this._triggerArray[i]; const trigger = this._triggerArray[i];
const elem = getElementFromSelector(trigger); const elem = getElementFromSelector(trigger);
if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) { if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
trigger.classList.add(CLASS_NAME_COLLAPSED); trigger.classList.add(CLASS_NAME_COLLAPSED);
trigger.setAttribute('aria-expanded', false); trigger.setAttribute('aria-expanded', false);
} }
@ -1768,12 +1792,12 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$7, config = { ...Default$8,
...config ...config
}; };
config.toggle = Boolean(config.toggle); // Coerce string values config.toggle = Boolean(config.toggle); // Coerce string values
typeCheckConfig(NAME$8, config, DefaultType$7); typeCheckConfig(NAME$9, config, DefaultType$8);
return config; return config;
} }
@ -1809,7 +1833,7 @@
return; return;
} }
const isOpen = element.classList.contains(CLASS_NAME_SHOW$7); const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
triggerArray.forEach(elem => { triggerArray.forEach(elem => {
if (isOpen) { if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED); elem.classList.remove(CLASS_NAME_COLLAPSED);
@ -1824,7 +1848,7 @@
static collapseInterface(element, config) { static collapseInterface(element, config) {
let data = Data.get(element, DATA_KEY$8); let data = Data.get(element, DATA_KEY$8);
const _config = { ...Default$7, const _config = { ...Default$8,
...Manipulator.getDataAttributes(element), ...Manipulator.getDataAttributes(element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -1895,7 +1919,7 @@
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$8, Collapse); defineJQueryPlugin(NAME$9, Collapse);
var top = 'top'; var top = 'top';
var bottom = 'bottom'; var bottom = 'bottom';
@ -2159,6 +2183,17 @@
function getContainingBlock(element) { function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
if (isIE && isHTMLElement(element)) {
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
var elementCss = getComputedStyle$1(element);
if (elementCss.position === 'fixed') {
return null;
}
}
var currentNode = getParentNode(element); var currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
@ -3642,7 +3677,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dropdown.js * Bootstrap (v5.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3652,7 +3687,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$7 = 'dropdown'; const NAME$8 = 'dropdown';
const DATA_KEY$7 = 'bs.dropdown'; const DATA_KEY$7 = 'bs.dropdown';
const EVENT_KEY$7 = `.${DATA_KEY$7}`; const EVENT_KEY$7 = `.${DATA_KEY$7}`;
const DATA_API_KEY$4 = '.data-api'; const DATA_API_KEY$4 = '.data-api';
@ -3672,8 +3707,7 @@
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
const CLASS_NAME_DISABLED = 'disabled'; const CLASS_NAME_SHOW$7 = 'show';
const CLASS_NAME_SHOW$6 = 'show';
const CLASS_NAME_DROPUP = 'dropup'; const CLASS_NAME_DROPUP = 'dropup';
const CLASS_NAME_DROPEND = 'dropend'; const CLASS_NAME_DROPEND = 'dropend';
const CLASS_NAME_DROPSTART = 'dropstart'; const CLASS_NAME_DROPSTART = 'dropstart';
@ -3688,19 +3722,21 @@
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
const Default$6 = { const Default$7 = {
offset: [0, 2], offset: [0, 2],
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
display: 'dynamic', display: 'dynamic',
popperConfig: null popperConfig: null,
autoClose: true
}; };
const DefaultType$6 = { const DefaultType$7 = {
offset: '(array|string|function)', offset: '(array|string|function)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object|function)' popperConfig: '(null|object|function)',
autoClose: '(boolean|string)'
}; };
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -3721,11 +3757,11 @@
static get Default() { static get Default() {
return Default$6; return Default$7;
} }
static get DefaultType() { static get DefaultType() {
return DefaultType$6; return DefaultType$7;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -3734,15 +3770,14 @@
toggle() { toggle() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { if (isDisabled(this._element)) {
return; return;
} }
const isActive = this._element.classList.contains(CLASS_NAME_SHOW$6); const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
Dropdown.clearMenus();
if (isActive) { if (isActive) {
this.hide();
return; return;
} }
@ -3750,7 +3785,7 @@
} }
show() { show() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
@ -3801,48 +3836,33 @@
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
[].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', null, noop())); [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
} }
this._element.focus(); this._element.focus();
this._element.setAttribute('aria-expanded', true); this._element.setAttribute('aria-expanded', true);
this._menu.classList.toggle(CLASS_NAME_SHOW$6); this._menu.classList.toggle(CLASS_NAME_SHOW$7);
this._element.classList.toggle(CLASS_NAME_SHOW$6); this._element.classList.toggle(CLASS_NAME_SHOW$7);
EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
} }
hide() { hide() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element relatedTarget: this._element
}; };
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) { this._completeHide(relatedTarget);
return;
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.toggle(CLASS_NAME_SHOW$6);
this._element.classList.toggle(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$7);
this._menu = null; this._menu = null;
if (this._popper) { if (this._popper) {
@ -3870,16 +3890,43 @@
}); });
} }
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.remove(CLASS_NAME_SHOW$7);
this._element.classList.remove(CLASS_NAME_SHOW$7);
this._element.setAttribute('aria-expanded', 'false');
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
}
_getConfig(config) { _getConfig(config) {
config = { ...this.constructor.Default, config = { ...this.constructor.Default,
...Manipulator.getDataAttributes(this._element), ...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$7, config, this.constructor.DefaultType); typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
// Popper virtual elements require a getBoundingClientRect method // Popper virtual elements require a getBoundingClientRect method
throw new TypeError(`${NAME$7.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
} }
return config; return config;
@ -3956,6 +4003,29 @@
return { ...defaultBsPopperConfig, return { ...defaultBsPopperConfig,
...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
}; };
}
_selectMenuItem(event) {
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} // Static } // Static
@ -3989,7 +4059,7 @@
return; return;
} }
if (/input|select|textarea|form/i.test(event.target.tagName)) { if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return; return;
} }
} }
@ -3998,58 +4068,38 @@
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const context = Data.get(toggles[i], DATA_KEY$7); const context = Data.get(toggles[i], DATA_KEY$7);
if (!context || context._config.autoClose === false) {
continue;
}
if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
continue;
}
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i] relatedTarget: context._element
}; };
if (event && event.type === 'click') {
relatedTarget.clickEvent = event;
}
if (!context) {
continue;
}
const dropdownMenu = context._menu;
if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) {
continue;
}
if (event) { if (event) {
// Don't close the menu if the clicked element or one of its parents is the dropdown button const composedPath = event.composedPath();
if ([context._element].some(element => event.composedPath().includes(element))) { const isMenuTarget = composedPath.includes(context._menu);
if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
continue; continue;
} // Tab navigation through the dropdown menu shouldn't close the menu } // Tab navigation through the dropdown menu shouldn't close the menu
if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) { if (event.type === 'keyup' && event.key === TAB_KEY && context._menu.contains(event.target)) {
continue; continue;
} }
if (event.type === 'click') {
relatedTarget.clickEvent = event;
}
} }
const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget); context._completeHide(relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()));
}
toggles[i].setAttribute('aria-expanded', 'false');
if (context._popper) {
context._popper.destroy();
}
dropdownMenu.classList.remove(CLASS_NAME_SHOW$6);
toggles[i].classList.remove(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(dropdownMenu, 'popper');
EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget);
} }
} }
@ -4069,26 +4119,29 @@
return; return;
} }
event.preventDefault(); const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
event.stopPropagation();
if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { if (!isActive && event.key === ESCAPE_KEY$2) {
return; return;
} }
const parent = Dropdown.getParentFromElement(this); event.preventDefault();
const isActive = this.classList.contains(CLASS_NAME_SHOW$6); event.stopPropagation();
if (isDisabled(this)) {
return;
}
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
if (event.key === ESCAPE_KEY$2) { if (event.key === ESCAPE_KEY$2) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().focus();
button.focus();
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().click();
button.click();
return; return;
} }
@ -4097,26 +4150,7 @@
return; return;
} }
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} }
} }
@ -4142,11 +4176,213 @@
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$7, Dropdown); defineJQueryPlugin(NAME$8, Dropdown);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): modal.js * Bootstrap (v5.0.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
_disableOverFlow(); // give padding to element to balances the hidden scrollbar width
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
};
const _disableOverFlow = () => {
const actualValue = document.body.style.overflow;
if (actualValue) {
Manipulator.setDataAttribute(document.body, 'overflow', actualValue);
}
document.body.style.overflow = 'hidden';
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
});
};
const reset = () => {
_resetElementAttributes('body', 'overflow');
_resetElementAttributes('body', 'paddingRight');
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined') {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Default$6 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: document.body,
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$6 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: 'element',
clickCallback: '(function|null)'
};
const NAME$7 = 'backdrop';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_FADE$5 = 'fade';
const CLASS_NAME_SHOW$6 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
class Backdrop {
constructor(config) {
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
if (this._config.isAnimated) {
reflow(this._getElement());
}
this._getElement().classList.add(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
} // Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE$5);
}
this._element = backdrop;
}
return this._element;
}
_getConfig(config) {
config = { ...Default$6,
...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
this._config.rootElement.appendChild(this._getElement());
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler.off(this._element, EVENT_MOUSEDOWN);
this._getElement().parentNode.removeChild(this._element);
this._isAppended = false;
}
_emulateAnimation(callback) {
if (!this._config.isAnimated) {
execute(callback);
return;
}
const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
EventHandler.one(this._getElement(), 'transitionend', () => execute(callback));
emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
}
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4179,12 +4415,10 @@
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`; const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
const EVENT_RESIZE = `resize${EVENT_KEY$6}`; const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`; const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`; const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
const CLASS_NAME_FADE$4 = 'fade'; const CLASS_NAME_FADE$4 = 'fade';
const CLASS_NAME_SHOW$5 = 'show'; const CLASS_NAME_SHOW$5 = 'show';
@ -4193,8 +4427,6 @@
const SELECTOR_MODAL_BODY = '.modal-body'; const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]'; const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
const SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT$1 = '.sticky-top';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -4206,12 +4438,10 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = null; this._backdrop = this._initializeBackDrop();
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false; this._ignoreBackdropClick = false;
this._isTransitioning = false; this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters } // Getters
@ -4246,10 +4476,8 @@
} }
this._isShown = true; this._isShown = true;
hide();
this._checkScrollbar(); document.body.classList.add(CLASS_NAME_OPEN);
this._setScrollbar();
this._adjustDialog(); this._adjustDialog();
@ -4313,7 +4541,7 @@
} }
dispose() { dispose() {
[window, this._element, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
super.dispose(); super.dispose();
/** /**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@ -4324,12 +4552,13 @@
EventHandler.off(document, EVENT_FOCUSIN$1); EventHandler.off(document, EVENT_FOCUSIN$1);
this._config = null; this._config = null;
this._dialog = null; this._dialog = null;
this._backdrop.dispose();
this._backdrop = null; this._backdrop = null;
this._isShown = null; this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null; this._ignoreBackdropClick = null;
this._isTransitioning = null; this._isTransitioning = null;
this._scrollbarWidth = null;
} }
handleUpdate() { handleUpdate() {
@ -4337,8 +4566,17 @@
} // Private } // Private
_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
// 'static' option will be translated to true, and booleans will keep their value
isAnimated: this._isAnimated()
});
}
_getConfig(config) { _getConfig(config) {
config = { ...Default$5, config = { ...Default$5,
...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$6, config, DefaultType$5); typeCheckConfig(NAME$6, config, DefaultType$5);
@ -4411,7 +4649,7 @@
_setEscapeEvent() { _setEscapeEvent() {
if (this._isShown) { if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY$1) { if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
event.preventDefault(); event.preventDefault();
this.hide(); this.hide();
@ -4420,7 +4658,7 @@
} }
}); });
} else { } else {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
} }
} }
@ -4443,85 +4681,35 @@
this._isTransitioning = false; this._isTransitioning = false;
this._showBackdrop(() => { this._backdrop.hide(() => {
document.body.classList.remove(CLASS_NAME_OPEN); document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments(); this._resetAdjustments();
this._resetScrollbar(); reset();
EventHandler.trigger(this._element, EVENT_HIDDEN$3); EventHandler.trigger(this._element, EVENT_HIDDEN$3);
}); });
} }
_removeBackdrop() {
this._backdrop.parentNode.removeChild(this._backdrop);
this._backdrop = null;
}
_showBackdrop(callback) { _showBackdrop(callback) {
const isAnimated = this._isAnimated(); EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
if (this._isShown && this._config.backdrop) { this._ignoreBackdropClick = false;
this._backdrop = document.createElement('div');
this._backdrop.className = CLASS_NAME_BACKDROP;
if (isAnimated) {
this._backdrop.classList.add(CLASS_NAME_FADE$4);
}
document.body.appendChild(this._backdrop);
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
} else {
this.hide();
}
});
if (isAnimated) {
reflow(this._backdrop);
}
this._backdrop.classList.add(CLASS_NAME_SHOW$5);
if (!isAnimated) {
callback();
return; return;
} }
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); if (event.target !== event.currentTarget) {
EventHandler.one(this._backdrop, 'transitionend', callback); return;
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW$5);
const callbackRemove = () => {
this._removeBackdrop();
callback();
};
if (isAnimated) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else {
callbackRemove();
} }
} else {
callback(); if (this._config.backdrop === true) {
} this.hide();
} else if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
}
});
this._backdrop.show(callback);
} }
_isAnimated() { _isAnimated() {
@ -4565,103 +4753,37 @@
_adjustDialog() { _adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const scrollbarWidth = getWidth();
const isBodyOverflowing = scrollbarWidth > 0;
if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) { if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`; this._element.style.paddingLeft = `${scrollbarWidth}px`;
} }
if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) { if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
this._element.style.paddingRight = `${this._scrollbarWidth}px`; this._element.style.paddingRight = `${scrollbarWidth}px`;
} }
} }
_resetAdjustments() { _resetAdjustments() {
this._element.style.paddingLeft = ''; this._element.style.paddingLeft = '';
this._element.style.paddingRight = ''; this._element.style.paddingRight = '';
}
_checkScrollbar() {
const rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
_setScrollbar() {
if (this._isBodyOverflowing) {
this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
}
document.body.classList.add(CLASS_NAME_OPEN);
}
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() {
this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight');
this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight');
this._resetElementAttributes('body', 'paddingRight');
}
_resetElementAttributes(selector, styleProp) {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style[styleProp] = '';
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
}
_getScrollbarWidth() {
// thx d.walsh
const scrollDiv = document.createElement('div');
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
} // Static } // Static
static jQueryInterface(config, relatedTarget) { static jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$6); const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
const _config = { ...Default$5,
...Manipulator.getDataAttributes(this),
...(typeof config === 'object' && config ? config : {})
};
if (!data) { if (typeof config !== 'string') {
data = new Modal(this, _config); return;
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config](relatedTarget);
} }
data[config](relatedTarget);
}); });
} }
@ -4676,7 +4798,7 @@
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
const target = getElementFromSelector(this); const target = getElementFromSelector(this);
if (this.tagName === 'A' || this.tagName === 'AREA') { if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault(); event.preventDefault();
} }
@ -4692,15 +4814,7 @@
} }
}); });
}); });
let data = Data.get(target, DATA_KEY$6); const data = Modal.getInstance(target) || new Modal(target);
if (!data) {
const config = { ...Manipulator.getDataAttributes(target),
...Manipulator.getDataAttributes(this)
};
data = new Modal(target, config);
}
data.toggle(this); data.toggle(this);
}); });
/** /**
@ -4714,69 +4828,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/scrollBar.js * Bootstrap (v5.0.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
document.body.style.overflow = 'hidden';
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width);
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
};
const reset = () => {
document.body.style.overflow = 'auto';
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
_resetElementAttributes('body', 'paddingRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4802,11 +4854,8 @@
keyboard: 'boolean', keyboard: 'boolean',
scroll: 'boolean' scroll: 'boolean'
}; };
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
const CLASS_NAME_SHOW$4 = 'show'; const CLASS_NAME_SHOW$4 = 'show';
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
const OPEN_SELECTOR = '.offcanvas.show'; const OPEN_SELECTOR = '.offcanvas.show';
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
@ -4814,6 +4863,7 @@
const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`; const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`;
const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`; const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]'; const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
/** /**
@ -4827,6 +4877,7 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._isShown = false; this._isShown = false;
this._backdrop = this._initializeBackDrop();
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -4861,15 +4912,13 @@
this._isShown = true; this._isShown = true;
this._element.style.visibility = 'visible'; this._element.style.visibility = 'visible';
if (this._config.backdrop) { this._backdrop.show();
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
hide(); hide();
}
this._element.classList.add(CLASS_NAME_TOGGLING); this._enforceFocusOnElement(this._element);
}
this._element.removeAttribute('aria-hidden'); this._element.removeAttribute('aria-hidden');
@ -4880,16 +4929,14 @@
this._element.classList.add(CLASS_NAME_SHOW$4); this._element.classList.add(CLASS_NAME_SHOW$4);
const completeCallBack = () => { const completeCallBack = () => {
this._element.classList.remove(CLASS_NAME_TOGGLING);
EventHandler.trigger(this._element, EVENT_SHOWN$2, { EventHandler.trigger(this._element, EVENT_SHOWN$2, {
relatedTarget relatedTarget
}); });
this._enforceFocusOnElement(this._element);
}; };
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
} }
hide() { hide() {
@ -4903,8 +4950,6 @@
return; return;
} }
this._element.classList.add(CLASS_NAME_TOGGLING);
EventHandler.off(document, EVENT_FOCUSIN); EventHandler.off(document, EVENT_FOCUSIN);
this._element.blur(); this._element.blur();
@ -4913,6 +4958,8 @@
this._element.classList.remove(CLASS_NAME_SHOW$4); this._element.classList.remove(CLASS_NAME_SHOW$4);
this._backdrop.hide();
const completeCallback = () => { const completeCallback = () => {
this._element.setAttribute('aria-hidden', true); this._element.setAttribute('aria-hidden', true);
@ -4922,20 +4969,25 @@
this._element.style.visibility = 'hidden'; this._element.style.visibility = 'hidden';
if (this._config.backdrop) {
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
reset(); reset();
} }
EventHandler.trigger(this._element, EVENT_HIDDEN$2); EventHandler.trigger(this._element, EVENT_HIDDEN$2);
this._element.classList.remove(CLASS_NAME_TOGGLING);
}; };
setTimeout(completeCallback, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
} // Private } // Private
@ -4948,6 +5000,15 @@
return config; return config;
} }
_initializeBackDrop() {
return new Backdrop({
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
clickCallback: () => this.hide()
});
}
_enforceFocusOnElement(element) { _enforceFocusOnElement(element) {
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
@ -4961,18 +5022,11 @@
_addEventListeners() { _addEventListeners() {
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide()); EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(document, 'keydown', event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) { if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide(); this.hide();
} }
}); });
EventHandler.on(document, EVENT_CLICK_DATA_API$1, event => {
const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
if (!this._element.contains(event.target) && target !== this._element) {
this.hide();
}
});
} // Static } // Static
@ -5018,10 +5072,10 @@
} }
}); // avoid conflict when clicking a toggler of an offcanvas, while another is open }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR); const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
if (allReadyOpen && allReadyOpen !== target) { if (allReadyOpen && allReadyOpen !== target) {
return; Offcanvas.getInstance(allReadyOpen).hide();
} }
const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target); const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
@ -5040,7 +5094,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/sanitizer.js * Bootstrap (v5.0.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -5153,7 +5207,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tooltip.js * Bootstrap (v5.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -5328,7 +5382,6 @@
dispose() { dispose() {
clearTimeout(this._timeout); clearTimeout(this._timeout);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this.tip && this.tip.parentNode) { if (this.tip && this.tip.parentNode) {
@ -5413,7 +5466,7 @@
if ('ontouchstart' in document.documentElement) { if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(element => { [].concat(...document.body.children).forEach(element => {
EventHandler.on(element, 'mouseover', noop()); EventHandler.on(element, 'mouseover', noop);
}); });
} }
@ -5612,7 +5665,6 @@
modifiers: [{ modifiers: [{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements fallbackPlacements: this.config.fallbackPlacements
} }
}, { }, {
@ -5895,7 +5947,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): popover.js * Bootstrap (v5.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -6045,7 +6097,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): scrollspy.js * Bootstrap (v5.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -6158,6 +6210,7 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$1, config = { ...Default$1,
...Manipulator.getDataAttributes(this._element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -6266,21 +6319,17 @@
static jQueryInterface(config) { static jQueryInterface(config) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$2); const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
const _config = typeof config === 'object' && config; if (typeof config !== 'string') {
return;
if (!data) {
data = new ScrollSpy(this, _config);
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config]();
} }
data[config]();
}); });
} }
@ -6293,7 +6342,7 @@
EventHandler.on(window, EVENT_LOAD_DATA_API, () => { EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy))); SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -6306,7 +6355,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tab.js * Bootstrap (v5.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -6350,7 +6399,7 @@
show() { show() {
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) { if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
return; return;
} }
@ -6438,11 +6487,17 @@
element.classList.add(CLASS_NAME_SHOW$1); element.classList.add(CLASS_NAME_SHOW$1);
} }
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { let parent = element.parentNode;
if (parent && parent.nodeName === 'LI') {
parent = parent.parentNode;
}
if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = element.closest(SELECTOR_DROPDOWN); const dropdownElement = element.closest(SELECTOR_DROPDOWN);
if (dropdownElement) { if (dropdownElement) {
SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);
@ -6477,7 +6532,14 @@
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault(); if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
const data = Data.get(this, DATA_KEY$1) || new Tab(this); const data = Data.get(this, DATA_KEY$1) || new Tab(this);
data.show(); data.show();
}); });
@ -6492,7 +6554,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): toast.js * Bootstrap (v5.0.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -6631,7 +6693,6 @@
this._element.classList.remove(CLASS_NAME_SHOW); this._element.classList.remove(CLASS_NAME_SHOW);
} }
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
super.dispose(); super.dispose();
this._config = null; this._config = null;
} // Private } // Private
@ -6689,7 +6750,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): index.umd.js * Bootstrap (v5.0.0): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -7,7 +7,7 @@ import * as Popper from '@popperjs/core';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -52,7 +52,7 @@ const getSelector = element => {
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -130,7 +130,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -188,7 +188,7 @@ const findShadowRoot = element => {
return findShadowRoot(element.parentNode); return findShadowRoot(element.parentNode);
}; };
const noop = () => function () {}; const noop = () => {};
const reflow = element => element.offsetHeight; const reflow = element => element.offsetHeight;
@ -232,9 +232,15 @@ const defineJQueryPlugin = (name, plugin) => {
}); });
}; };
const execute = callback => {
if (typeof callback === 'function') {
callback();
}
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/data.js * Bootstrap (v5.0.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -288,7 +294,7 @@ var Data = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/event-handler.js * Bootstrap (v5.0.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -308,6 +314,7 @@ const customEvents = {
mouseenter: 'mouseover', mouseenter: 'mouseover',
mouseleave: 'mouseout' mouseleave: 'mouseout'
}; };
const customEventsRegex = /^(mouseenter|mouseleave)/i;
const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -351,7 +358,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
if (handler.oneOff) { if (handler.oneOff) {
// eslint-disable-next-line unicorn/consistent-destructuring // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, selector, fn);
} }
return fn.apply(target, [event]); return fn.apply(target, [event]);
@ -380,15 +387,8 @@ function findHandler(events, handler, delegationSelector = null) {
function normalizeParams(originalTypeEvent, handler, delegationFn) { function normalizeParams(originalTypeEvent, handler, delegationFn) {
const delegation = typeof handler === 'string'; const delegation = typeof handler === 'string';
const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click') const originalHandler = delegation ? delegationFn : handler;
let typeEvent = getTypeEvent(originalTypeEvent);
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
const custom = customEvents[typeEvent];
if (custom) {
typeEvent = custom;
}
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
if (!isNative) { if (!isNative) {
@ -406,6 +406,24 @@ function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
if (!handler) { if (!handler) {
handler = delegationFn; handler = delegationFn;
delegationFn = null; delegationFn = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (customEventsRegex.test(originalTypeEvent)) {
const wrapFn = fn => {
return function (event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn.call(this, event);
}
};
};
if (delegationFn) {
delegationFn = wrapFn(delegationFn);
} else {
handler = wrapFn(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@ -449,6 +467,12 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
}); });
} }
function getTypeEvent(event) {
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
event = event.replace(stripNameRegex, '');
return customEvents[event] || event;
}
const EventHandler = { const EventHandler = {
on(element, event, handler, delegationFn) { on(element, event, handler, delegationFn) {
addHandler(element, event, handler, delegationFn, false); addHandler(element, event, handler, delegationFn, false);
@ -501,7 +525,7 @@ const EventHandler = {
} }
const $ = getjQuery(); const $ = getjQuery();
const typeEvent = event.replace(stripNameRegex, ''); const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent; const inNamespace = event !== typeEvent;
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
let jQueryEvent; let jQueryEvent;
@ -559,7 +583,7 @@ const EventHandler = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): base-component.js * Bootstrap (v5.0.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -569,7 +593,7 @@ const EventHandler = {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta3'; const VERSION = '5.0.0';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {
@ -585,6 +609,7 @@ class BaseComponent {
dispose() { dispose() {
Data.remove(this._element, this.constructor.DATA_KEY); Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null; this._element = null;
} }
/** Static */ /** Static */
@ -602,7 +627,7 @@ class BaseComponent {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): alert.js * Bootstrap (v5.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -612,7 +637,7 @@ class BaseComponent {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$b = 'alert'; const NAME$c = 'alert';
const DATA_KEY$b = 'bs.alert'; const DATA_KEY$b = 'bs.alert';
const EVENT_KEY$b = `.${DATA_KEY$b}`; const EVENT_KEY$b = `.${DATA_KEY$b}`;
const DATA_API_KEY$8 = '.data-api'; const DATA_API_KEY$8 = '.data-api';
@ -621,8 +646,8 @@ const EVENT_CLOSE = `close${EVENT_KEY$b}`;
const EVENT_CLOSED = `closed${EVENT_KEY$b}`; const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`; const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
const CLASS_NAME_ALERT = 'alert'; const CLASS_NAME_ALERT = 'alert';
const CLASS_NAME_FADE$5 = 'fade'; const CLASS_NAME_FADE$6 = 'fade';
const CLASS_NAME_SHOW$8 = 'show'; const CLASS_NAME_SHOW$9 = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -658,9 +683,9 @@ class Alert extends BaseComponent {
} }
_removeElement(element) { _removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW$8); element.classList.remove(CLASS_NAME_SHOW$9);
if (!element.classList.contains(CLASS_NAME_FADE$5)) { if (!element.classList.contains(CLASS_NAME_FADE$6)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
@ -720,11 +745,11 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handle
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$b, Alert); defineJQueryPlugin(NAME$c, Alert);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): button.js * Bootstrap (v5.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -734,7 +759,7 @@ defineJQueryPlugin(NAME$b, Alert);
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$a = 'button'; const NAME$b = 'button';
const DATA_KEY$a = 'bs.button'; const DATA_KEY$a = 'bs.button';
const EVENT_KEY$a = `.${DATA_KEY$a}`; const EVENT_KEY$a = `.${DATA_KEY$a}`;
const DATA_API_KEY$7 = '.data-api'; const DATA_API_KEY$7 = '.data-api';
@ -800,11 +825,11 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$a, Button); defineJQueryPlugin(NAME$b, Button);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/manipulator.js * Bootstrap (v5.0.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -878,7 +903,7 @@ const Manipulator = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Bootstrap (v5.0.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -949,7 +974,7 @@ const SelectorEngine = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): carousel.js * Bootstrap (v5.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -959,7 +984,7 @@ const SelectorEngine = {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$9 = 'carousel'; const NAME$a = 'carousel';
const DATA_KEY$9 = 'bs.carousel'; const DATA_KEY$9 = 'bs.carousel';
const EVENT_KEY$9 = `.${DATA_KEY$9}`; const EVENT_KEY$9 = `.${DATA_KEY$9}`;
const DATA_API_KEY$6 = '.data-api'; const DATA_API_KEY$6 = '.data-api';
@ -968,7 +993,7 @@ const ARROW_RIGHT_KEY = 'ArrowRight';
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
const SWIPE_THRESHOLD = 40; const SWIPE_THRESHOLD = 40;
const Default$8 = { const Default$9 = {
interval: 5000, interval: 5000,
keyboard: true, keyboard: true,
slide: false, slide: false,
@ -976,7 +1001,7 @@ const Default$8 = {
wrap: true, wrap: true,
touch: true touch: true
}; };
const DefaultType$8 = { const DefaultType$9 = {
interval: '(number|boolean)', interval: '(number|boolean)',
keyboard: 'boolean', keyboard: 'boolean',
slide: '(boolean|string)', slide: '(boolean|string)',
@ -1047,7 +1072,7 @@ class Carousel extends BaseComponent {
static get Default() { static get Default() {
return Default$8; return Default$9;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1132,7 +1157,6 @@ class Carousel extends BaseComponent {
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$9);
this._items = null; this._items = null;
this._config = null; this._config = null;
this._interval = null; this._interval = null;
@ -1145,10 +1169,10 @@ class Carousel extends BaseComponent {
_getConfig(config) { _getConfig(config) {
config = { ...Default$8, config = { ...Default$9,
...config ...config
}; };
typeCheckConfig(NAME$9, config, DefaultType$8); typeCheckConfig(NAME$a, config, DefaultType$9);
return config; return config;
} }
@ -1247,11 +1271,11 @@ class Carousel extends BaseComponent {
if (event.key === ARROW_LEFT_KEY) { if (event.key === ARROW_LEFT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_LEFT); this._slide(DIRECTION_RIGHT);
} else if (event.key === ARROW_RIGHT_KEY) { } else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_RIGHT); this._slide(DIRECTION_LEFT);
} }
} }
@ -1413,10 +1437,10 @@ class Carousel extends BaseComponent {
} }
if (isRTL()) { if (isRTL()) {
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT; return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
} }
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV; return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
} }
_orderToDirection(order) { _orderToDirection(order) {
@ -1425,16 +1449,16 @@ class Carousel extends BaseComponent {
} }
if (isRTL()) { if (isRTL()) {
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT; return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
} }
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT; return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
} // Static } // Static
static carouselInterface(element, config) { static carouselInterface(element, config) {
let data = Data.get(element, DATA_KEY$9); let data = Data.get(element, DATA_KEY$9);
let _config = { ...Default$8, let _config = { ...Default$9,
...Manipulator.getDataAttributes(element) ...Manipulator.getDataAttributes(element)
}; };
@ -1518,11 +1542,11 @@ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$9, Carousel); defineJQueryPlugin(NAME$a, Carousel);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): collapse.js * Bootstrap (v5.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -1532,15 +1556,15 @@ defineJQueryPlugin(NAME$9, Carousel);
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$8 = 'collapse'; const NAME$9 = 'collapse';
const DATA_KEY$8 = 'bs.collapse'; const DATA_KEY$8 = 'bs.collapse';
const EVENT_KEY$8 = `.${DATA_KEY$8}`; const EVENT_KEY$8 = `.${DATA_KEY$8}`;
const DATA_API_KEY$5 = '.data-api'; const DATA_API_KEY$5 = '.data-api';
const Default$7 = { const Default$8 = {
toggle: true, toggle: true,
parent: '' parent: ''
}; };
const DefaultType$7 = { const DefaultType$8 = {
toggle: 'boolean', toggle: 'boolean',
parent: '(string|element)' parent: '(string|element)'
}; };
@ -1549,7 +1573,7 @@ const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`; const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`; const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
const CLASS_NAME_SHOW$7 = 'show'; const CLASS_NAME_SHOW$8 = 'show';
const CLASS_NAME_COLLAPSE = 'collapse'; const CLASS_NAME_COLLAPSE = 'collapse';
const CLASS_NAME_COLLAPSING = 'collapsing'; const CLASS_NAME_COLLAPSING = 'collapsing';
const CLASS_NAME_COLLAPSED = 'collapsed'; const CLASS_NAME_COLLAPSED = 'collapsed';
@ -1596,7 +1620,7 @@ class Collapse extends BaseComponent {
static get Default() { static get Default() {
return Default$7; return Default$8;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1605,7 +1629,7 @@ class Collapse extends BaseComponent {
toggle() { toggle() {
if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
this.hide(); this.hide();
} else { } else {
this.show(); this.show();
@ -1613,7 +1637,7 @@ class Collapse extends BaseComponent {
} }
show() { show() {
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1683,7 +1707,7 @@ class Collapse extends BaseComponent {
const complete = () => { const complete = () => {
this._element.classList.remove(CLASS_NAME_COLLAPSING); this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
this._element.style[dimension] = ''; this._element.style[dimension] = '';
this.setTransitioning(false); this.setTransitioning(false);
@ -1699,7 +1723,7 @@ class Collapse extends BaseComponent {
} }
hide() { hide() {
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1716,7 +1740,7 @@ class Collapse extends BaseComponent {
this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.classList.add(CLASS_NAME_COLLAPSING);
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
const triggerArrayLength = this._triggerArray.length; const triggerArrayLength = this._triggerArray.length;
@ -1725,7 +1749,7 @@ class Collapse extends BaseComponent {
const trigger = this._triggerArray[i]; const trigger = this._triggerArray[i];
const elem = getElementFromSelector(trigger); const elem = getElementFromSelector(trigger);
if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) { if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
trigger.classList.add(CLASS_NAME_COLLAPSED); trigger.classList.add(CLASS_NAME_COLLAPSED);
trigger.setAttribute('aria-expanded', false); trigger.setAttribute('aria-expanded', false);
} }
@ -1764,12 +1788,12 @@ class Collapse extends BaseComponent {
_getConfig(config) { _getConfig(config) {
config = { ...Default$7, config = { ...Default$8,
...config ...config
}; };
config.toggle = Boolean(config.toggle); // Coerce string values config.toggle = Boolean(config.toggle); // Coerce string values
typeCheckConfig(NAME$8, config, DefaultType$7); typeCheckConfig(NAME$9, config, DefaultType$8);
return config; return config;
} }
@ -1805,7 +1829,7 @@ class Collapse extends BaseComponent {
return; return;
} }
const isOpen = element.classList.contains(CLASS_NAME_SHOW$7); const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
triggerArray.forEach(elem => { triggerArray.forEach(elem => {
if (isOpen) { if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED); elem.classList.remove(CLASS_NAME_COLLAPSED);
@ -1820,7 +1844,7 @@ class Collapse extends BaseComponent {
static collapseInterface(element, config) { static collapseInterface(element, config) {
let data = Data.get(element, DATA_KEY$8); let data = Data.get(element, DATA_KEY$8);
const _config = { ...Default$7, const _config = { ...Default$8,
...Manipulator.getDataAttributes(element), ...Manipulator.getDataAttributes(element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -1891,11 +1915,11 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, functi
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$8, Collapse); defineJQueryPlugin(NAME$9, Collapse);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dropdown.js * Bootstrap (v5.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -1905,7 +1929,7 @@ defineJQueryPlugin(NAME$8, Collapse);
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$7 = 'dropdown'; const NAME$8 = 'dropdown';
const DATA_KEY$7 = 'bs.dropdown'; const DATA_KEY$7 = 'bs.dropdown';
const EVENT_KEY$7 = `.${DATA_KEY$7}`; const EVENT_KEY$7 = `.${DATA_KEY$7}`;
const DATA_API_KEY$4 = '.data-api'; const DATA_API_KEY$4 = '.data-api';
@ -1925,8 +1949,7 @@ const EVENT_CLICK = `click${EVENT_KEY$7}`;
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
const CLASS_NAME_DISABLED = 'disabled'; const CLASS_NAME_SHOW$7 = 'show';
const CLASS_NAME_SHOW$6 = 'show';
const CLASS_NAME_DROPUP = 'dropup'; const CLASS_NAME_DROPUP = 'dropup';
const CLASS_NAME_DROPEND = 'dropend'; const CLASS_NAME_DROPEND = 'dropend';
const CLASS_NAME_DROPSTART = 'dropstart'; const CLASS_NAME_DROPSTART = 'dropstart';
@ -1941,19 +1964,21 @@ const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
const Default$6 = { const Default$7 = {
offset: [0, 2], offset: [0, 2],
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
display: 'dynamic', display: 'dynamic',
popperConfig: null popperConfig: null,
autoClose: true
}; };
const DefaultType$6 = { const DefaultType$7 = {
offset: '(array|string|function)', offset: '(array|string|function)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object|function)' popperConfig: '(null|object|function)',
autoClose: '(boolean|string)'
}; };
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -1974,11 +1999,11 @@ class Dropdown extends BaseComponent {
static get Default() { static get Default() {
return Default$6; return Default$7;
} }
static get DefaultType() { static get DefaultType() {
return DefaultType$6; return DefaultType$7;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1987,15 +2012,14 @@ class Dropdown extends BaseComponent {
toggle() { toggle() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { if (isDisabled(this._element)) {
return; return;
} }
const isActive = this._element.classList.contains(CLASS_NAME_SHOW$6); const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
Dropdown.clearMenus();
if (isActive) { if (isActive) {
this.hide();
return; return;
} }
@ -2003,7 +2027,7 @@ class Dropdown extends BaseComponent {
} }
show() { show() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
@ -2054,48 +2078,33 @@ class Dropdown extends BaseComponent {
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
[].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', null, noop())); [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
} }
this._element.focus(); this._element.focus();
this._element.setAttribute('aria-expanded', true); this._element.setAttribute('aria-expanded', true);
this._menu.classList.toggle(CLASS_NAME_SHOW$6); this._menu.classList.toggle(CLASS_NAME_SHOW$7);
this._element.classList.toggle(CLASS_NAME_SHOW$6); this._element.classList.toggle(CLASS_NAME_SHOW$7);
EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
} }
hide() { hide() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element relatedTarget: this._element
}; };
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) { this._completeHide(relatedTarget);
return;
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.toggle(CLASS_NAME_SHOW$6);
this._element.classList.toggle(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$7);
this._menu = null; this._menu = null;
if (this._popper) { if (this._popper) {
@ -2123,16 +2132,43 @@ class Dropdown extends BaseComponent {
}); });
} }
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.remove(CLASS_NAME_SHOW$7);
this._element.classList.remove(CLASS_NAME_SHOW$7);
this._element.setAttribute('aria-expanded', 'false');
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
}
_getConfig(config) { _getConfig(config) {
config = { ...this.constructor.Default, config = { ...this.constructor.Default,
...Manipulator.getDataAttributes(this._element), ...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$7, config, this.constructor.DefaultType); typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
// Popper virtual elements require a getBoundingClientRect method // Popper virtual elements require a getBoundingClientRect method
throw new TypeError(`${NAME$7.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
} }
return config; return config;
@ -2209,6 +2245,29 @@ class Dropdown extends BaseComponent {
return { ...defaultBsPopperConfig, return { ...defaultBsPopperConfig,
...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
}; };
}
_selectMenuItem(event) {
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} // Static } // Static
@ -2242,7 +2301,7 @@ class Dropdown extends BaseComponent {
return; return;
} }
if (/input|select|textarea|form/i.test(event.target.tagName)) { if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return; return;
} }
} }
@ -2251,58 +2310,38 @@ class Dropdown extends BaseComponent {
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const context = Data.get(toggles[i], DATA_KEY$7); const context = Data.get(toggles[i], DATA_KEY$7);
if (!context || context._config.autoClose === false) {
continue;
}
if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
continue;
}
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i] relatedTarget: context._element
}; };
if (event && event.type === 'click') {
relatedTarget.clickEvent = event;
}
if (!context) {
continue;
}
const dropdownMenu = context._menu;
if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) {
continue;
}
if (event) { if (event) {
// Don't close the menu if the clicked element or one of its parents is the dropdown button const composedPath = event.composedPath();
if ([context._element].some(element => event.composedPath().includes(element))) { const isMenuTarget = composedPath.includes(context._menu);
if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
continue; continue;
} // Tab navigation through the dropdown menu shouldn't close the menu } // Tab navigation through the dropdown menu shouldn't close the menu
if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) { if (event.type === 'keyup' && event.key === TAB_KEY && context._menu.contains(event.target)) {
continue; continue;
} }
if (event.type === 'click') {
relatedTarget.clickEvent = event;
}
} }
const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget); context._completeHide(relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()));
}
toggles[i].setAttribute('aria-expanded', 'false');
if (context._popper) {
context._popper.destroy();
}
dropdownMenu.classList.remove(CLASS_NAME_SHOW$6);
toggles[i].classList.remove(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(dropdownMenu, 'popper');
EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget);
} }
} }
@ -2322,26 +2361,29 @@ class Dropdown extends BaseComponent {
return; return;
} }
event.preventDefault(); const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
event.stopPropagation();
if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { if (!isActive && event.key === ESCAPE_KEY$2) {
return; return;
} }
const parent = Dropdown.getParentFromElement(this); event.preventDefault();
const isActive = this.classList.contains(CLASS_NAME_SHOW$6); event.stopPropagation();
if (isDisabled(this)) {
return;
}
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
if (event.key === ESCAPE_KEY$2) { if (event.key === ESCAPE_KEY$2) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().focus();
button.focus();
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().click();
button.click();
return; return;
} }
@ -2350,26 +2392,7 @@ class Dropdown extends BaseComponent {
return; return;
} }
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} }
} }
@ -2395,11 +2418,213 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, functi
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$7, Dropdown); defineJQueryPlugin(NAME$8, Dropdown);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): modal.js * Bootstrap (v5.0.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
_disableOverFlow(); // give padding to element to balances the hidden scrollbar width
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
};
const _disableOverFlow = () => {
const actualValue = document.body.style.overflow;
if (actualValue) {
Manipulator.setDataAttribute(document.body, 'overflow', actualValue);
}
document.body.style.overflow = 'hidden';
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
});
};
const reset = () => {
_resetElementAttributes('body', 'overflow');
_resetElementAttributes('body', 'paddingRight');
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined') {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Default$6 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: document.body,
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$6 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: 'element',
clickCallback: '(function|null)'
};
const NAME$7 = 'backdrop';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_FADE$5 = 'fade';
const CLASS_NAME_SHOW$6 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
class Backdrop {
constructor(config) {
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
if (this._config.isAnimated) {
reflow(this._getElement());
}
this._getElement().classList.add(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
} // Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE$5);
}
this._element = backdrop;
}
return this._element;
}
_getConfig(config) {
config = { ...Default$6,
...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
this._config.rootElement.appendChild(this._getElement());
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler.off(this._element, EVENT_MOUSEDOWN);
this._getElement().parentNode.removeChild(this._element);
this._isAppended = false;
}
_emulateAnimation(callback) {
if (!this._config.isAnimated) {
execute(callback);
return;
}
const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
EventHandler.one(this._getElement(), 'transitionend', () => execute(callback));
emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
}
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -2432,12 +2657,10 @@ const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`; const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
const EVENT_RESIZE = `resize${EVENT_KEY$6}`; const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`; const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`; const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
const CLASS_NAME_FADE$4 = 'fade'; const CLASS_NAME_FADE$4 = 'fade';
const CLASS_NAME_SHOW$5 = 'show'; const CLASS_NAME_SHOW$5 = 'show';
@ -2446,8 +2669,6 @@ const SELECTOR_DIALOG = '.modal-dialog';
const SELECTOR_MODAL_BODY = '.modal-body'; const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]'; const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
const SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT$1 = '.sticky-top';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -2459,12 +2680,10 @@ class Modal extends BaseComponent {
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = null; this._backdrop = this._initializeBackDrop();
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false; this._ignoreBackdropClick = false;
this._isTransitioning = false; this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters } // Getters
@ -2499,10 +2718,8 @@ class Modal extends BaseComponent {
} }
this._isShown = true; this._isShown = true;
hide();
this._checkScrollbar(); document.body.classList.add(CLASS_NAME_OPEN);
this._setScrollbar();
this._adjustDialog(); this._adjustDialog();
@ -2566,7 +2783,7 @@ class Modal extends BaseComponent {
} }
dispose() { dispose() {
[window, this._element, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
super.dispose(); super.dispose();
/** /**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@ -2577,12 +2794,13 @@ class Modal extends BaseComponent {
EventHandler.off(document, EVENT_FOCUSIN$1); EventHandler.off(document, EVENT_FOCUSIN$1);
this._config = null; this._config = null;
this._dialog = null; this._dialog = null;
this._backdrop.dispose();
this._backdrop = null; this._backdrop = null;
this._isShown = null; this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null; this._ignoreBackdropClick = null;
this._isTransitioning = null; this._isTransitioning = null;
this._scrollbarWidth = null;
} }
handleUpdate() { handleUpdate() {
@ -2590,8 +2808,17 @@ class Modal extends BaseComponent {
} // Private } // Private
_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
// 'static' option will be translated to true, and booleans will keep their value
isAnimated: this._isAnimated()
});
}
_getConfig(config) { _getConfig(config) {
config = { ...Default$5, config = { ...Default$5,
...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$6, config, DefaultType$5); typeCheckConfig(NAME$6, config, DefaultType$5);
@ -2664,7 +2891,7 @@ class Modal extends BaseComponent {
_setEscapeEvent() { _setEscapeEvent() {
if (this._isShown) { if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY$1) { if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
event.preventDefault(); event.preventDefault();
this.hide(); this.hide();
@ -2673,7 +2900,7 @@ class Modal extends BaseComponent {
} }
}); });
} else { } else {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
} }
} }
@ -2696,85 +2923,35 @@ class Modal extends BaseComponent {
this._isTransitioning = false; this._isTransitioning = false;
this._showBackdrop(() => { this._backdrop.hide(() => {
document.body.classList.remove(CLASS_NAME_OPEN); document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments(); this._resetAdjustments();
this._resetScrollbar(); reset();
EventHandler.trigger(this._element, EVENT_HIDDEN$3); EventHandler.trigger(this._element, EVENT_HIDDEN$3);
}); });
} }
_removeBackdrop() {
this._backdrop.parentNode.removeChild(this._backdrop);
this._backdrop = null;
}
_showBackdrop(callback) { _showBackdrop(callback) {
const isAnimated = this._isAnimated(); EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
if (this._isShown && this._config.backdrop) { this._ignoreBackdropClick = false;
this._backdrop = document.createElement('div');
this._backdrop.className = CLASS_NAME_BACKDROP;
if (isAnimated) {
this._backdrop.classList.add(CLASS_NAME_FADE$4);
}
document.body.appendChild(this._backdrop);
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
} else {
this.hide();
}
});
if (isAnimated) {
reflow(this._backdrop);
}
this._backdrop.classList.add(CLASS_NAME_SHOW$5);
if (!isAnimated) {
callback();
return; return;
} }
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); if (event.target !== event.currentTarget) {
EventHandler.one(this._backdrop, 'transitionend', callback); return;
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW$5);
const callbackRemove = () => {
this._removeBackdrop();
callback();
};
if (isAnimated) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else {
callbackRemove();
} }
} else {
callback(); if (this._config.backdrop === true) {
} this.hide();
} else if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
}
});
this._backdrop.show(callback);
} }
_isAnimated() { _isAnimated() {
@ -2818,103 +2995,37 @@ class Modal extends BaseComponent {
_adjustDialog() { _adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const scrollbarWidth = getWidth();
const isBodyOverflowing = scrollbarWidth > 0;
if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) { if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`; this._element.style.paddingLeft = `${scrollbarWidth}px`;
} }
if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) { if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
this._element.style.paddingRight = `${this._scrollbarWidth}px`; this._element.style.paddingRight = `${scrollbarWidth}px`;
} }
} }
_resetAdjustments() { _resetAdjustments() {
this._element.style.paddingLeft = ''; this._element.style.paddingLeft = '';
this._element.style.paddingRight = ''; this._element.style.paddingRight = '';
}
_checkScrollbar() {
const rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
_setScrollbar() {
if (this._isBodyOverflowing) {
this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
}
document.body.classList.add(CLASS_NAME_OPEN);
}
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() {
this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight');
this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight');
this._resetElementAttributes('body', 'paddingRight');
}
_resetElementAttributes(selector, styleProp) {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style[styleProp] = '';
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
}
_getScrollbarWidth() {
// thx d.walsh
const scrollDiv = document.createElement('div');
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
} // Static } // Static
static jQueryInterface(config, relatedTarget) { static jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$6); const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
const _config = { ...Default$5,
...Manipulator.getDataAttributes(this),
...(typeof config === 'object' && config ? config : {})
};
if (!data) { if (typeof config !== 'string') {
data = new Modal(this, _config); return;
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config](relatedTarget);
} }
data[config](relatedTarget);
}); });
} }
@ -2929,7 +3040,7 @@ class Modal extends BaseComponent {
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
const target = getElementFromSelector(this); const target = getElementFromSelector(this);
if (this.tagName === 'A' || this.tagName === 'AREA') { if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault(); event.preventDefault();
} }
@ -2945,15 +3056,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
} }
}); });
}); });
let data = Data.get(target, DATA_KEY$6); const data = Modal.getInstance(target) || new Modal(target);
if (!data) {
const config = { ...Manipulator.getDataAttributes(target),
...Manipulator.getDataAttributes(this)
};
data = new Modal(target, config);
}
data.toggle(this); data.toggle(this);
}); });
/** /**
@ -2967,69 +3070,7 @@ defineJQueryPlugin(NAME$6, Modal);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/scrollBar.js * Bootstrap (v5.0.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
document.body.style.overflow = 'hidden';
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width);
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
};
const reset = () => {
document.body.style.overflow = 'auto';
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
_resetElementAttributes('body', 'paddingRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3055,11 +3096,8 @@ const DefaultType$4 = {
keyboard: 'boolean', keyboard: 'boolean',
scroll: 'boolean' scroll: 'boolean'
}; };
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
const CLASS_NAME_SHOW$4 = 'show'; const CLASS_NAME_SHOW$4 = 'show';
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
const OPEN_SELECTOR = '.offcanvas.show'; const OPEN_SELECTOR = '.offcanvas.show';
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
@ -3067,6 +3105,7 @@ const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`; const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`;
const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`; const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]'; const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
/** /**
@ -3080,6 +3119,7 @@ class Offcanvas extends BaseComponent {
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._isShown = false; this._isShown = false;
this._backdrop = this._initializeBackDrop();
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -3114,15 +3154,13 @@ class Offcanvas extends BaseComponent {
this._isShown = true; this._isShown = true;
this._element.style.visibility = 'visible'; this._element.style.visibility = 'visible';
if (this._config.backdrop) { this._backdrop.show();
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
hide(); hide();
}
this._element.classList.add(CLASS_NAME_TOGGLING); this._enforceFocusOnElement(this._element);
}
this._element.removeAttribute('aria-hidden'); this._element.removeAttribute('aria-hidden');
@ -3133,16 +3171,14 @@ class Offcanvas extends BaseComponent {
this._element.classList.add(CLASS_NAME_SHOW$4); this._element.classList.add(CLASS_NAME_SHOW$4);
const completeCallBack = () => { const completeCallBack = () => {
this._element.classList.remove(CLASS_NAME_TOGGLING);
EventHandler.trigger(this._element, EVENT_SHOWN$2, { EventHandler.trigger(this._element, EVENT_SHOWN$2, {
relatedTarget relatedTarget
}); });
this._enforceFocusOnElement(this._element);
}; };
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
} }
hide() { hide() {
@ -3156,8 +3192,6 @@ class Offcanvas extends BaseComponent {
return; return;
} }
this._element.classList.add(CLASS_NAME_TOGGLING);
EventHandler.off(document, EVENT_FOCUSIN); EventHandler.off(document, EVENT_FOCUSIN);
this._element.blur(); this._element.blur();
@ -3166,6 +3200,8 @@ class Offcanvas extends BaseComponent {
this._element.classList.remove(CLASS_NAME_SHOW$4); this._element.classList.remove(CLASS_NAME_SHOW$4);
this._backdrop.hide();
const completeCallback = () => { const completeCallback = () => {
this._element.setAttribute('aria-hidden', true); this._element.setAttribute('aria-hidden', true);
@ -3175,20 +3211,25 @@ class Offcanvas extends BaseComponent {
this._element.style.visibility = 'hidden'; this._element.style.visibility = 'hidden';
if (this._config.backdrop) {
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
reset(); reset();
} }
EventHandler.trigger(this._element, EVENT_HIDDEN$2); EventHandler.trigger(this._element, EVENT_HIDDEN$2);
this._element.classList.remove(CLASS_NAME_TOGGLING);
}; };
setTimeout(completeCallback, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
} // Private } // Private
@ -3201,6 +3242,15 @@ class Offcanvas extends BaseComponent {
return config; return config;
} }
_initializeBackDrop() {
return new Backdrop({
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
clickCallback: () => this.hide()
});
}
_enforceFocusOnElement(element) { _enforceFocusOnElement(element) {
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
@ -3214,18 +3264,11 @@ class Offcanvas extends BaseComponent {
_addEventListeners() { _addEventListeners() {
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide()); EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(document, 'keydown', event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) { if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide(); this.hide();
} }
}); });
EventHandler.on(document, EVENT_CLICK_DATA_API$1, event => {
const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
if (!this._element.contains(event.target) && target !== this._element) {
this.hide();
}
});
} // Static } // Static
@ -3271,10 +3314,10 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, functi
} }
}); // avoid conflict when clicking a toggler of an offcanvas, while another is open }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR); const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
if (allReadyOpen && allReadyOpen !== target) { if (allReadyOpen && allReadyOpen !== target) {
return; Offcanvas.getInstance(allReadyOpen).hide();
} }
const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target); const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
@ -3293,7 +3336,7 @@ defineJQueryPlugin(NAME$5, Offcanvas);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/sanitizer.js * Bootstrap (v5.0.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3406,7 +3449,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tooltip.js * Bootstrap (v5.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3581,7 +3624,6 @@ class Tooltip extends BaseComponent {
dispose() { dispose() {
clearTimeout(this._timeout); clearTimeout(this._timeout);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this.tip && this.tip.parentNode) { if (this.tip && this.tip.parentNode) {
@ -3666,7 +3708,7 @@ class Tooltip extends BaseComponent {
if ('ontouchstart' in document.documentElement) { if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(element => { [].concat(...document.body.children).forEach(element => {
EventHandler.on(element, 'mouseover', noop()); EventHandler.on(element, 'mouseover', noop);
}); });
} }
@ -3865,7 +3907,6 @@ class Tooltip extends BaseComponent {
modifiers: [{ modifiers: [{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements fallbackPlacements: this.config.fallbackPlacements
} }
}, { }, {
@ -4148,7 +4189,7 @@ defineJQueryPlugin(NAME$4, Tooltip);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): popover.js * Bootstrap (v5.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4298,7 +4339,7 @@ defineJQueryPlugin(NAME$3, Popover);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): scrollspy.js * Bootstrap (v5.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4411,6 +4452,7 @@ class ScrollSpy extends BaseComponent {
_getConfig(config) { _getConfig(config) {
config = { ...Default$1, config = { ...Default$1,
...Manipulator.getDataAttributes(this._element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -4519,21 +4561,17 @@ class ScrollSpy extends BaseComponent {
static jQueryInterface(config) { static jQueryInterface(config) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$2); const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
const _config = typeof config === 'object' && config; if (typeof config !== 'string') {
return;
if (!data) {
data = new ScrollSpy(this, _config);
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config]();
} }
data[config]();
}); });
} }
@ -4546,7 +4584,7 @@ class ScrollSpy extends BaseComponent {
EventHandler.on(window, EVENT_LOAD_DATA_API, () => { EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy))); SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -4559,7 +4597,7 @@ defineJQueryPlugin(NAME$2, ScrollSpy);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tab.js * Bootstrap (v5.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4603,7 +4641,7 @@ class Tab extends BaseComponent {
show() { show() {
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) { if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
return; return;
} }
@ -4691,11 +4729,17 @@ class Tab extends BaseComponent {
element.classList.add(CLASS_NAME_SHOW$1); element.classList.add(CLASS_NAME_SHOW$1);
} }
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { let parent = element.parentNode;
if (parent && parent.nodeName === 'LI') {
parent = parent.parentNode;
}
if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = element.closest(SELECTOR_DROPDOWN); const dropdownElement = element.closest(SELECTOR_DROPDOWN);
if (dropdownElement) { if (dropdownElement) {
SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);
@ -4730,7 +4774,14 @@ class Tab extends BaseComponent {
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault(); if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
const data = Data.get(this, DATA_KEY$1) || new Tab(this); const data = Data.get(this, DATA_KEY$1) || new Tab(this);
data.show(); data.show();
}); });
@ -4745,7 +4796,7 @@ defineJQueryPlugin(NAME$1, Tab);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): toast.js * Bootstrap (v5.0.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4884,7 +4935,6 @@ class Toast extends BaseComponent {
this._element.classList.remove(CLASS_NAME_SHOW); this._element.classList.remove(CLASS_NAME_SHOW);
} }
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
super.dispose(); super.dispose();
this._config = null; this._config = null;
} // Private } // Private

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -33,7 +33,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -78,7 +78,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -156,7 +156,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -214,7 +214,7 @@
return findShadowRoot(element.parentNode); return findShadowRoot(element.parentNode);
}; };
const noop = () => function () {}; const noop = () => {};
const reflow = element => element.offsetHeight; const reflow = element => element.offsetHeight;
@ -258,9 +258,15 @@
}); });
}; };
const execute = callback => {
if (typeof callback === 'function') {
callback();
}
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/data.js * Bootstrap (v5.0.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -314,7 +320,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/event-handler.js * Bootstrap (v5.0.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -334,6 +340,7 @@
mouseenter: 'mouseover', mouseenter: 'mouseover',
mouseleave: 'mouseout' mouseleave: 'mouseout'
}; };
const customEventsRegex = /^(mouseenter|mouseleave)/i;
const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -377,7 +384,7 @@
if (handler.oneOff) { if (handler.oneOff) {
// eslint-disable-next-line unicorn/consistent-destructuring // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, selector, fn);
} }
return fn.apply(target, [event]); return fn.apply(target, [event]);
@ -406,15 +413,8 @@
function normalizeParams(originalTypeEvent, handler, delegationFn) { function normalizeParams(originalTypeEvent, handler, delegationFn) {
const delegation = typeof handler === 'string'; const delegation = typeof handler === 'string';
const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click') const originalHandler = delegation ? delegationFn : handler;
let typeEvent = getTypeEvent(originalTypeEvent);
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
const custom = customEvents[typeEvent];
if (custom) {
typeEvent = custom;
}
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
if (!isNative) { if (!isNative) {
@ -432,6 +432,24 @@
if (!handler) { if (!handler) {
handler = delegationFn; handler = delegationFn;
delegationFn = null; delegationFn = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (customEventsRegex.test(originalTypeEvent)) {
const wrapFn = fn => {
return function (event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn.call(this, event);
}
};
};
if (delegationFn) {
delegationFn = wrapFn(delegationFn);
} else {
handler = wrapFn(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@ -475,6 +493,12 @@
}); });
} }
function getTypeEvent(event) {
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
event = event.replace(stripNameRegex, '');
return customEvents[event] || event;
}
const EventHandler = { const EventHandler = {
on(element, event, handler, delegationFn) { on(element, event, handler, delegationFn) {
addHandler(element, event, handler, delegationFn, false); addHandler(element, event, handler, delegationFn, false);
@ -527,7 +551,7 @@
} }
const $ = getjQuery(); const $ = getjQuery();
const typeEvent = event.replace(stripNameRegex, ''); const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent; const inNamespace = event !== typeEvent;
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
let jQueryEvent; let jQueryEvent;
@ -585,7 +609,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): base-component.js * Bootstrap (v5.0.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -595,7 +619,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta3'; const VERSION = '5.0.0';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {
@ -611,6 +635,7 @@
dispose() { dispose() {
Data.remove(this._element, this.constructor.DATA_KEY); Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null; this._element = null;
} }
/** Static */ /** Static */
@ -628,7 +653,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): alert.js * Bootstrap (v5.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -638,7 +663,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$b = 'alert'; const NAME$c = 'alert';
const DATA_KEY$b = 'bs.alert'; const DATA_KEY$b = 'bs.alert';
const EVENT_KEY$b = `.${DATA_KEY$b}`; const EVENT_KEY$b = `.${DATA_KEY$b}`;
const DATA_API_KEY$8 = '.data-api'; const DATA_API_KEY$8 = '.data-api';
@ -647,8 +672,8 @@
const EVENT_CLOSED = `closed${EVENT_KEY$b}`; const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`; const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
const CLASS_NAME_ALERT = 'alert'; const CLASS_NAME_ALERT = 'alert';
const CLASS_NAME_FADE$5 = 'fade'; const CLASS_NAME_FADE$6 = 'fade';
const CLASS_NAME_SHOW$8 = 'show'; const CLASS_NAME_SHOW$9 = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -684,9 +709,9 @@
} }
_removeElement(element) { _removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW$8); element.classList.remove(CLASS_NAME_SHOW$9);
if (!element.classList.contains(CLASS_NAME_FADE$5)) { if (!element.classList.contains(CLASS_NAME_FADE$6)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
@ -746,11 +771,11 @@
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$b, Alert); defineJQueryPlugin(NAME$c, Alert);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): button.js * Bootstrap (v5.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -760,7 +785,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$a = 'button'; const NAME$b = 'button';
const DATA_KEY$a = 'bs.button'; const DATA_KEY$a = 'bs.button';
const EVENT_KEY$a = `.${DATA_KEY$a}`; const EVENT_KEY$a = `.${DATA_KEY$a}`;
const DATA_API_KEY$7 = '.data-api'; const DATA_API_KEY$7 = '.data-api';
@ -826,11 +851,11 @@
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$a, Button); defineJQueryPlugin(NAME$b, Button);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/manipulator.js * Bootstrap (v5.0.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -904,7 +929,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Bootstrap (v5.0.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -975,7 +1000,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): carousel.js * Bootstrap (v5.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -985,7 +1010,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$9 = 'carousel'; const NAME$a = 'carousel';
const DATA_KEY$9 = 'bs.carousel'; const DATA_KEY$9 = 'bs.carousel';
const EVENT_KEY$9 = `.${DATA_KEY$9}`; const EVENT_KEY$9 = `.${DATA_KEY$9}`;
const DATA_API_KEY$6 = '.data-api'; const DATA_API_KEY$6 = '.data-api';
@ -994,7 +1019,7 @@
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
const SWIPE_THRESHOLD = 40; const SWIPE_THRESHOLD = 40;
const Default$8 = { const Default$9 = {
interval: 5000, interval: 5000,
keyboard: true, keyboard: true,
slide: false, slide: false,
@ -1002,7 +1027,7 @@
wrap: true, wrap: true,
touch: true touch: true
}; };
const DefaultType$8 = { const DefaultType$9 = {
interval: '(number|boolean)', interval: '(number|boolean)',
keyboard: 'boolean', keyboard: 'boolean',
slide: '(boolean|string)', slide: '(boolean|string)',
@ -1073,7 +1098,7 @@
static get Default() { static get Default() {
return Default$8; return Default$9;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1158,7 +1183,6 @@
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$9);
this._items = null; this._items = null;
this._config = null; this._config = null;
this._interval = null; this._interval = null;
@ -1171,10 +1195,10 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$8, config = { ...Default$9,
...config ...config
}; };
typeCheckConfig(NAME$9, config, DefaultType$8); typeCheckConfig(NAME$a, config, DefaultType$9);
return config; return config;
} }
@ -1273,11 +1297,11 @@
if (event.key === ARROW_LEFT_KEY) { if (event.key === ARROW_LEFT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_LEFT); this._slide(DIRECTION_RIGHT);
} else if (event.key === ARROW_RIGHT_KEY) { } else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_RIGHT); this._slide(DIRECTION_LEFT);
} }
} }
@ -1439,10 +1463,10 @@
} }
if (isRTL()) { if (isRTL()) {
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT; return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
} }
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV; return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
} }
_orderToDirection(order) { _orderToDirection(order) {
@ -1451,16 +1475,16 @@
} }
if (isRTL()) { if (isRTL()) {
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT; return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
} }
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT; return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
} // Static } // Static
static carouselInterface(element, config) { static carouselInterface(element, config) {
let data = Data.get(element, DATA_KEY$9); let data = Data.get(element, DATA_KEY$9);
let _config = { ...Default$8, let _config = { ...Default$9,
...Manipulator.getDataAttributes(element) ...Manipulator.getDataAttributes(element)
}; };
@ -1544,11 +1568,11 @@
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$9, Carousel); defineJQueryPlugin(NAME$a, Carousel);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): collapse.js * Bootstrap (v5.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -1558,15 +1582,15 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$8 = 'collapse'; const NAME$9 = 'collapse';
const DATA_KEY$8 = 'bs.collapse'; const DATA_KEY$8 = 'bs.collapse';
const EVENT_KEY$8 = `.${DATA_KEY$8}`; const EVENT_KEY$8 = `.${DATA_KEY$8}`;
const DATA_API_KEY$5 = '.data-api'; const DATA_API_KEY$5 = '.data-api';
const Default$7 = { const Default$8 = {
toggle: true, toggle: true,
parent: '' parent: ''
}; };
const DefaultType$7 = { const DefaultType$8 = {
toggle: 'boolean', toggle: 'boolean',
parent: '(string|element)' parent: '(string|element)'
}; };
@ -1575,7 +1599,7 @@
const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`; const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`; const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
const CLASS_NAME_SHOW$7 = 'show'; const CLASS_NAME_SHOW$8 = 'show';
const CLASS_NAME_COLLAPSE = 'collapse'; const CLASS_NAME_COLLAPSE = 'collapse';
const CLASS_NAME_COLLAPSING = 'collapsing'; const CLASS_NAME_COLLAPSING = 'collapsing';
const CLASS_NAME_COLLAPSED = 'collapsed'; const CLASS_NAME_COLLAPSED = 'collapsed';
@ -1622,7 +1646,7 @@
static get Default() { static get Default() {
return Default$7; return Default$8;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -1631,7 +1655,7 @@
toggle() { toggle() {
if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
this.hide(); this.hide();
} else { } else {
this.show(); this.show();
@ -1639,7 +1663,7 @@
} }
show() { show() {
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1709,7 +1733,7 @@
const complete = () => { const complete = () => {
this._element.classList.remove(CLASS_NAME_COLLAPSING); this._element.classList.remove(CLASS_NAME_COLLAPSING);
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
this._element.style[dimension] = ''; this._element.style[dimension] = '';
this.setTransitioning(false); this.setTransitioning(false);
@ -1725,7 +1749,7 @@
} }
hide() { hide() {
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) { if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return; return;
} }
@ -1742,7 +1766,7 @@
this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.classList.add(CLASS_NAME_COLLAPSING);
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
const triggerArrayLength = this._triggerArray.length; const triggerArrayLength = this._triggerArray.length;
@ -1751,7 +1775,7 @@
const trigger = this._triggerArray[i]; const trigger = this._triggerArray[i];
const elem = getElementFromSelector(trigger); const elem = getElementFromSelector(trigger);
if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) { if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
trigger.classList.add(CLASS_NAME_COLLAPSED); trigger.classList.add(CLASS_NAME_COLLAPSED);
trigger.setAttribute('aria-expanded', false); trigger.setAttribute('aria-expanded', false);
} }
@ -1790,12 +1814,12 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$7, config = { ...Default$8,
...config ...config
}; };
config.toggle = Boolean(config.toggle); // Coerce string values config.toggle = Boolean(config.toggle); // Coerce string values
typeCheckConfig(NAME$8, config, DefaultType$7); typeCheckConfig(NAME$9, config, DefaultType$8);
return config; return config;
} }
@ -1831,7 +1855,7 @@
return; return;
} }
const isOpen = element.classList.contains(CLASS_NAME_SHOW$7); const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
triggerArray.forEach(elem => { triggerArray.forEach(elem => {
if (isOpen) { if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED); elem.classList.remove(CLASS_NAME_COLLAPSED);
@ -1846,7 +1870,7 @@
static collapseInterface(element, config) { static collapseInterface(element, config) {
let data = Data.get(element, DATA_KEY$8); let data = Data.get(element, DATA_KEY$8);
const _config = { ...Default$7, const _config = { ...Default$8,
...Manipulator.getDataAttributes(element), ...Manipulator.getDataAttributes(element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -1917,11 +1941,11 @@
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$8, Collapse); defineJQueryPlugin(NAME$9, Collapse);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dropdown.js * Bootstrap (v5.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -1931,7 +1955,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME$7 = 'dropdown'; const NAME$8 = 'dropdown';
const DATA_KEY$7 = 'bs.dropdown'; const DATA_KEY$7 = 'bs.dropdown';
const EVENT_KEY$7 = `.${DATA_KEY$7}`; const EVENT_KEY$7 = `.${DATA_KEY$7}`;
const DATA_API_KEY$4 = '.data-api'; const DATA_API_KEY$4 = '.data-api';
@ -1951,8 +1975,7 @@
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`; const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
const CLASS_NAME_DISABLED = 'disabled'; const CLASS_NAME_SHOW$7 = 'show';
const CLASS_NAME_SHOW$6 = 'show';
const CLASS_NAME_DROPUP = 'dropup'; const CLASS_NAME_DROPUP = 'dropup';
const CLASS_NAME_DROPEND = 'dropend'; const CLASS_NAME_DROPEND = 'dropend';
const CLASS_NAME_DROPSTART = 'dropstart'; const CLASS_NAME_DROPSTART = 'dropstart';
@ -1967,19 +1990,21 @@
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
const Default$6 = { const Default$7 = {
offset: [0, 2], offset: [0, 2],
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
display: 'dynamic', display: 'dynamic',
popperConfig: null popperConfig: null,
autoClose: true
}; };
const DefaultType$6 = { const DefaultType$7 = {
offset: '(array|string|function)', offset: '(array|string|function)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object|function)' popperConfig: '(null|object|function)',
autoClose: '(boolean|string)'
}; };
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -2000,11 +2025,11 @@
static get Default() { static get Default() {
return Default$6; return Default$7;
} }
static get DefaultType() { static get DefaultType() {
return DefaultType$6; return DefaultType$7;
} }
static get DATA_KEY() { static get DATA_KEY() {
@ -2013,15 +2038,14 @@
toggle() { toggle() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { if (isDisabled(this._element)) {
return; return;
} }
const isActive = this._element.classList.contains(CLASS_NAME_SHOW$6); const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
Dropdown.clearMenus();
if (isActive) { if (isActive) {
this.hide();
return; return;
} }
@ -2029,7 +2053,7 @@
} }
show() { show() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
@ -2080,48 +2104,33 @@
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
[].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', null, noop())); [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
} }
this._element.focus(); this._element.focus();
this._element.setAttribute('aria-expanded', true); this._element.setAttribute('aria-expanded', true);
this._menu.classList.toggle(CLASS_NAME_SHOW$6); this._menu.classList.toggle(CLASS_NAME_SHOW$7);
this._element.classList.toggle(CLASS_NAME_SHOW$6); this._element.classList.toggle(CLASS_NAME_SHOW$7);
EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
} }
hide() { hide() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) { if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return; return;
} }
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element relatedTarget: this._element
}; };
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) { this._completeHide(relatedTarget);
return;
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.toggle(CLASS_NAME_SHOW$6);
this._element.classList.toggle(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
} }
dispose() { dispose() {
EventHandler.off(this._element, EVENT_KEY$7);
this._menu = null; this._menu = null;
if (this._popper) { if (this._popper) {
@ -2149,16 +2158,43 @@
}); });
} }
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.remove(CLASS_NAME_SHOW$7);
this._element.classList.remove(CLASS_NAME_SHOW$7);
this._element.setAttribute('aria-expanded', 'false');
Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
}
_getConfig(config) { _getConfig(config) {
config = { ...this.constructor.Default, config = { ...this.constructor.Default,
...Manipulator.getDataAttributes(this._element), ...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$7, config, this.constructor.DefaultType); typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
// Popper virtual elements require a getBoundingClientRect method // Popper virtual elements require a getBoundingClientRect method
throw new TypeError(`${NAME$7.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
} }
return config; return config;
@ -2235,6 +2271,29 @@
return { ...defaultBsPopperConfig, return { ...defaultBsPopperConfig,
...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
}; };
}
_selectMenuItem(event) {
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} // Static } // Static
@ -2268,7 +2327,7 @@
return; return;
} }
if (/input|select|textarea|form/i.test(event.target.tagName)) { if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return; return;
} }
} }
@ -2277,58 +2336,38 @@
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const context = Data.get(toggles[i], DATA_KEY$7); const context = Data.get(toggles[i], DATA_KEY$7);
if (!context || context._config.autoClose === false) {
continue;
}
if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
continue;
}
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i] relatedTarget: context._element
}; };
if (event && event.type === 'click') {
relatedTarget.clickEvent = event;
}
if (!context) {
continue;
}
const dropdownMenu = context._menu;
if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) {
continue;
}
if (event) { if (event) {
// Don't close the menu if the clicked element or one of its parents is the dropdown button const composedPath = event.composedPath();
if ([context._element].some(element => event.composedPath().includes(element))) { const isMenuTarget = composedPath.includes(context._menu);
if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
continue; continue;
} // Tab navigation through the dropdown menu shouldn't close the menu } // Tab navigation through the dropdown menu shouldn't close the menu
if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) { if (event.type === 'keyup' && event.key === TAB_KEY && context._menu.contains(event.target)) {
continue; continue;
} }
if (event.type === 'click') {
relatedTarget.clickEvent = event;
}
} }
const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget); context._completeHide(relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()));
}
toggles[i].setAttribute('aria-expanded', 'false');
if (context._popper) {
context._popper.destroy();
}
dropdownMenu.classList.remove(CLASS_NAME_SHOW$6);
toggles[i].classList.remove(CLASS_NAME_SHOW$6);
Manipulator.removeDataAttribute(dropdownMenu, 'popper');
EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget);
} }
} }
@ -2348,26 +2387,29 @@
return; return;
} }
event.preventDefault(); const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
event.stopPropagation();
if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { if (!isActive && event.key === ESCAPE_KEY$2) {
return; return;
} }
const parent = Dropdown.getParentFromElement(this); event.preventDefault();
const isActive = this.classList.contains(CLASS_NAME_SHOW$6); event.stopPropagation();
if (isDisabled(this)) {
return;
}
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
if (event.key === ESCAPE_KEY$2) { if (event.key === ESCAPE_KEY$2) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().focus();
button.focus();
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; getToggleButton().click();
button.click();
return; return;
} }
@ -2376,26 +2418,7 @@
return; return;
} }
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} }
} }
@ -2421,11 +2444,213 @@
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
defineJQueryPlugin(NAME$7, Dropdown); defineJQueryPlugin(NAME$8, Dropdown);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): modal.js * Bootstrap (v5.0.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
_disableOverFlow(); // give padding to element to balances the hidden scrollbar width
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
};
const _disableOverFlow = () => {
const actualValue = document.body.style.overflow;
if (actualValue) {
Manipulator.setDataAttribute(document.body, 'overflow', actualValue);
}
document.body.style.overflow = 'hidden';
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
});
};
const reset = () => {
_resetElementAttributes('body', 'overflow');
_resetElementAttributes('body', 'paddingRight');
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined') {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Default$6 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: document.body,
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$6 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: 'element',
clickCallback: '(function|null)'
};
const NAME$7 = 'backdrop';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_FADE$5 = 'fade';
const CLASS_NAME_SHOW$6 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
class Backdrop {
constructor(config) {
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
if (this._config.isAnimated) {
reflow(this._getElement());
}
this._getElement().classList.add(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
} // Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE$5);
}
this._element = backdrop;
}
return this._element;
}
_getConfig(config) {
config = { ...Default$6,
...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
_append() {
if (this._isAppended) {
return;
}
this._config.rootElement.appendChild(this._getElement());
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler.off(this._element, EVENT_MOUSEDOWN);
this._getElement().parentNode.removeChild(this._element);
this._isAppended = false;
}
_emulateAnimation(callback) {
if (!this._config.isAnimated) {
execute(callback);
return;
}
const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
EventHandler.one(this._getElement(), 'transitionend', () => execute(callback));
emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
}
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -2458,12 +2683,10 @@
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`; const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
const EVENT_RESIZE = `resize${EVENT_KEY$6}`; const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`; const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`; const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
const CLASS_NAME_FADE$4 = 'fade'; const CLASS_NAME_FADE$4 = 'fade';
const CLASS_NAME_SHOW$5 = 'show'; const CLASS_NAME_SHOW$5 = 'show';
@ -2472,8 +2695,6 @@
const SELECTOR_MODAL_BODY = '.modal-body'; const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]'; const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
const SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT$1 = '.sticky-top';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -2485,12 +2706,10 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = null; this._backdrop = this._initializeBackDrop();
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false; this._ignoreBackdropClick = false;
this._isTransitioning = false; this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters } // Getters
@ -2525,10 +2744,8 @@
} }
this._isShown = true; this._isShown = true;
hide();
this._checkScrollbar(); document.body.classList.add(CLASS_NAME_OPEN);
this._setScrollbar();
this._adjustDialog(); this._adjustDialog();
@ -2592,7 +2809,7 @@
} }
dispose() { dispose() {
[window, this._element, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
super.dispose(); super.dispose();
/** /**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@ -2603,12 +2820,13 @@
EventHandler.off(document, EVENT_FOCUSIN$1); EventHandler.off(document, EVENT_FOCUSIN$1);
this._config = null; this._config = null;
this._dialog = null; this._dialog = null;
this._backdrop.dispose();
this._backdrop = null; this._backdrop = null;
this._isShown = null; this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null; this._ignoreBackdropClick = null;
this._isTransitioning = null; this._isTransitioning = null;
this._scrollbarWidth = null;
} }
handleUpdate() { handleUpdate() {
@ -2616,8 +2834,17 @@
} // Private } // Private
_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
// 'static' option will be translated to true, and booleans will keep their value
isAnimated: this._isAnimated()
});
}
_getConfig(config) { _getConfig(config) {
config = { ...Default$5, config = { ...Default$5,
...Manipulator.getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME$6, config, DefaultType$5); typeCheckConfig(NAME$6, config, DefaultType$5);
@ -2690,7 +2917,7 @@
_setEscapeEvent() { _setEscapeEvent() {
if (this._isShown) { if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY$1) { if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
event.preventDefault(); event.preventDefault();
this.hide(); this.hide();
@ -2699,7 +2926,7 @@
} }
}); });
} else { } else {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
} }
} }
@ -2722,85 +2949,35 @@
this._isTransitioning = false; this._isTransitioning = false;
this._showBackdrop(() => { this._backdrop.hide(() => {
document.body.classList.remove(CLASS_NAME_OPEN); document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments(); this._resetAdjustments();
this._resetScrollbar(); reset();
EventHandler.trigger(this._element, EVENT_HIDDEN$3); EventHandler.trigger(this._element, EVENT_HIDDEN$3);
}); });
} }
_removeBackdrop() {
this._backdrop.parentNode.removeChild(this._backdrop);
this._backdrop = null;
}
_showBackdrop(callback) { _showBackdrop(callback) {
const isAnimated = this._isAnimated(); EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
if (this._isShown && this._config.backdrop) { this._ignoreBackdropClick = false;
this._backdrop = document.createElement('div');
this._backdrop.className = CLASS_NAME_BACKDROP;
if (isAnimated) {
this._backdrop.classList.add(CLASS_NAME_FADE$4);
}
document.body.appendChild(this._backdrop);
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
} else {
this.hide();
}
});
if (isAnimated) {
reflow(this._backdrop);
}
this._backdrop.classList.add(CLASS_NAME_SHOW$5);
if (!isAnimated) {
callback();
return; return;
} }
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); if (event.target !== event.currentTarget) {
EventHandler.one(this._backdrop, 'transitionend', callback); return;
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW$5);
const callbackRemove = () => {
this._removeBackdrop();
callback();
};
if (isAnimated) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else {
callbackRemove();
} }
} else {
callback(); if (this._config.backdrop === true) {
} this.hide();
} else if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
}
});
this._backdrop.show(callback);
} }
_isAnimated() { _isAnimated() {
@ -2844,103 +3021,37 @@
_adjustDialog() { _adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const scrollbarWidth = getWidth();
const isBodyOverflowing = scrollbarWidth > 0;
if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) { if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`; this._element.style.paddingLeft = `${scrollbarWidth}px`;
} }
if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) { if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
this._element.style.paddingRight = `${this._scrollbarWidth}px`; this._element.style.paddingRight = `${scrollbarWidth}px`;
} }
} }
_resetAdjustments() { _resetAdjustments() {
this._element.style.paddingLeft = ''; this._element.style.paddingLeft = '';
this._element.style.paddingRight = ''; this._element.style.paddingRight = '';
}
_checkScrollbar() {
const rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
_setScrollbar() {
if (this._isBodyOverflowing) {
this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
}
document.body.classList.add(CLASS_NAME_OPEN);
}
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() {
this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight');
this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight');
this._resetElementAttributes('body', 'paddingRight');
}
_resetElementAttributes(selector, styleProp) {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style[styleProp] = '';
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
}
_getScrollbarWidth() {
// thx d.walsh
const scrollDiv = document.createElement('div');
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
} // Static } // Static
static jQueryInterface(config, relatedTarget) { static jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$6); const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
const _config = { ...Default$5,
...Manipulator.getDataAttributes(this),
...(typeof config === 'object' && config ? config : {})
};
if (!data) { if (typeof config !== 'string') {
data = new Modal(this, _config); return;
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config](relatedTarget);
} }
data[config](relatedTarget);
}); });
} }
@ -2955,7 +3066,7 @@
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
const target = getElementFromSelector(this); const target = getElementFromSelector(this);
if (this.tagName === 'A' || this.tagName === 'AREA') { if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault(); event.preventDefault();
} }
@ -2971,15 +3082,7 @@
} }
}); });
}); });
let data = Data.get(target, DATA_KEY$6); const data = Modal.getInstance(target) || new Modal(target);
if (!data) {
const config = { ...Manipulator.getDataAttributes(target),
...Manipulator.getDataAttributes(this)
};
data = new Modal(target, config);
}
data.toggle(this); data.toggle(this);
}); });
/** /**
@ -2993,69 +3096,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/scrollBar.js * Bootstrap (v5.0.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
document.body.style.overflow = 'hidden';
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width);
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine.find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
};
const reset = () => {
document.body.style.overflow = 'auto';
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
_resetElementAttributes('body', 'paddingRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine.find(selector).forEach(element => {
const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style.removeProperty(styleProp);
} else {
Manipulator.removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3081,11 +3122,8 @@
keyboard: 'boolean', keyboard: 'boolean',
scroll: 'boolean' scroll: 'boolean'
}; };
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
const CLASS_NAME_SHOW$4 = 'show'; const CLASS_NAME_SHOW$4 = 'show';
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
const OPEN_SELECTOR = '.offcanvas.show'; const OPEN_SELECTOR = '.offcanvas.show';
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
@ -3093,6 +3131,7 @@
const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`; const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`;
const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`; const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]'; const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
/** /**
@ -3106,6 +3145,7 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._isShown = false; this._isShown = false;
this._backdrop = this._initializeBackDrop();
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -3140,15 +3180,13 @@
this._isShown = true; this._isShown = true;
this._element.style.visibility = 'visible'; this._element.style.visibility = 'visible';
if (this._config.backdrop) { this._backdrop.show();
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
hide(); hide();
}
this._element.classList.add(CLASS_NAME_TOGGLING); this._enforceFocusOnElement(this._element);
}
this._element.removeAttribute('aria-hidden'); this._element.removeAttribute('aria-hidden');
@ -3159,16 +3197,14 @@
this._element.classList.add(CLASS_NAME_SHOW$4); this._element.classList.add(CLASS_NAME_SHOW$4);
const completeCallBack = () => { const completeCallBack = () => {
this._element.classList.remove(CLASS_NAME_TOGGLING);
EventHandler.trigger(this._element, EVENT_SHOWN$2, { EventHandler.trigger(this._element, EVENT_SHOWN$2, {
relatedTarget relatedTarget
}); });
this._enforceFocusOnElement(this._element);
}; };
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
} }
hide() { hide() {
@ -3182,8 +3218,6 @@
return; return;
} }
this._element.classList.add(CLASS_NAME_TOGGLING);
EventHandler.off(document, EVENT_FOCUSIN); EventHandler.off(document, EVENT_FOCUSIN);
this._element.blur(); this._element.blur();
@ -3192,6 +3226,8 @@
this._element.classList.remove(CLASS_NAME_SHOW$4); this._element.classList.remove(CLASS_NAME_SHOW$4);
this._backdrop.hide();
const completeCallback = () => { const completeCallback = () => {
this._element.setAttribute('aria-hidden', true); this._element.setAttribute('aria-hidden', true);
@ -3201,20 +3237,25 @@
this._element.style.visibility = 'hidden'; this._element.style.visibility = 'hidden';
if (this._config.backdrop) {
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
reset(); reset();
} }
EventHandler.trigger(this._element, EVENT_HIDDEN$2); EventHandler.trigger(this._element, EVENT_HIDDEN$2);
this._element.classList.remove(CLASS_NAME_TOGGLING);
}; };
setTimeout(completeCallback, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
} // Private } // Private
@ -3227,6 +3268,15 @@
return config; return config;
} }
_initializeBackDrop() {
return new Backdrop({
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
clickCallback: () => this.hide()
});
}
_enforceFocusOnElement(element) { _enforceFocusOnElement(element) {
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
@ -3240,18 +3290,11 @@
_addEventListeners() { _addEventListeners() {
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide()); EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(document, 'keydown', event => { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) { if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide(); this.hide();
} }
}); });
EventHandler.on(document, EVENT_CLICK_DATA_API$1, event => {
const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
if (!this._element.contains(event.target) && target !== this._element) {
this.hide();
}
});
} // Static } // Static
@ -3297,10 +3340,10 @@
} }
}); // avoid conflict when clicking a toggler of an offcanvas, while another is open }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR); const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
if (allReadyOpen && allReadyOpen !== target) { if (allReadyOpen && allReadyOpen !== target) {
return; Offcanvas.getInstance(allReadyOpen).hide();
} }
const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target); const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
@ -3319,7 +3362,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/sanitizer.js * Bootstrap (v5.0.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3432,7 +3475,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tooltip.js * Bootstrap (v5.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -3607,7 +3650,6 @@
dispose() { dispose() {
clearTimeout(this._timeout); clearTimeout(this._timeout);
EventHandler.off(this._element, this.constructor.EVENT_KEY);
EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this.tip && this.tip.parentNode) { if (this.tip && this.tip.parentNode) {
@ -3692,7 +3734,7 @@
if ('ontouchstart' in document.documentElement) { if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(element => { [].concat(...document.body.children).forEach(element => {
EventHandler.on(element, 'mouseover', noop()); EventHandler.on(element, 'mouseover', noop);
}); });
} }
@ -3891,7 +3933,6 @@
modifiers: [{ modifiers: [{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements fallbackPlacements: this.config.fallbackPlacements
} }
}, { }, {
@ -4174,7 +4215,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): popover.js * Bootstrap (v5.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4324,7 +4365,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): scrollspy.js * Bootstrap (v5.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4437,6 +4478,7 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default$1, config = { ...Default$1,
...Manipulator.getDataAttributes(this._element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -4545,21 +4587,17 @@
static jQueryInterface(config) { static jQueryInterface(config) {
return this.each(function () { return this.each(function () {
let data = Data.get(this, DATA_KEY$2); const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
const _config = typeof config === 'object' && config; if (typeof config !== 'string') {
return;
if (!data) {
data = new ScrollSpy(this, _config);
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config]();
} }
data[config]();
}); });
} }
@ -4572,7 +4610,7 @@
EventHandler.on(window, EVENT_LOAD_DATA_API, () => { EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy))); SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -4585,7 +4623,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tab.js * Bootstrap (v5.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4629,7 +4667,7 @@
show() { show() {
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) { if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
return; return;
} }
@ -4717,11 +4755,17 @@
element.classList.add(CLASS_NAME_SHOW$1); element.classList.add(CLASS_NAME_SHOW$1);
} }
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { let parent = element.parentNode;
if (parent && parent.nodeName === 'LI') {
parent = parent.parentNode;
}
if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = element.closest(SELECTOR_DROPDOWN); const dropdownElement = element.closest(SELECTOR_DROPDOWN);
if (dropdownElement) { if (dropdownElement) {
SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);
@ -4756,7 +4800,14 @@
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault(); if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
const data = Data.get(this, DATA_KEY$1) || new Tab(this); const data = Data.get(this, DATA_KEY$1) || new Tab(this);
data.show(); data.show();
}); });
@ -4771,7 +4822,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): toast.js * Bootstrap (v5.0.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -4910,7 +4961,6 @@
this._element.classList.remove(CLASS_NAME_SHOW); this._element.classList.remove(CLASS_NAME_SHOW);
} }
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
super.dispose(); super.dispose();
this._config = null; this._config = null;
} // Private } // Private
@ -4968,7 +5018,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): index.umd.js * Bootstrap (v5.0.0): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
js/dist/alert.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap alert.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap alert.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -17,7 +17,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -39,7 +39,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -138,7 +138,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): alert.js * Bootstrap (v5.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

View File

@ -1,21 +1,22 @@
/*! /*!
* Bootstrap base-component.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap base-component.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js')) : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data'], factory) : typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
}(this, (function (Data) { 'use strict'; }(this, (function (Data, EventHandler) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data); var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): base-component.js * Bootstrap (v5.0.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -25,7 +26,7 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta3'; const VERSION = '5.0.0';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {
@ -41,6 +42,7 @@
dispose() { dispose() {
Data__default['default'].remove(this._element, this.constructor.DATA_KEY); Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
EventHandler__default['default'].off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null; this._element = null;
} }
/** Static */ /** Static */

View File

@ -1 +1 @@
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.0.0-beta3'\n\nclass BaseComponent {\n constructor(element) {\n element = typeof element === 'string' ? document.querySelector(element) : element\n\n if (!element) {\n return\n }\n\n this._element = element\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n this._element = null\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.get(element, this.DATA_KEY)\n }\n\n static get VERSION() {\n return VERSION\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","constructor","element","document","querySelector","_element","Data","set","DATA_KEY","dispose","remove","getInstance","get"],"mappings":";;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,OAAO,GAAG,aAAhB;;EAEA,MAAMC,aAAN,CAAoB;EAClBC,EAAAA,WAAW,CAACC,OAAD,EAAU;EACnBA,IAAAA,OAAO,GAAG,OAAOA,OAAP,KAAmB,QAAnB,GAA8BC,QAAQ,CAACC,aAAT,CAAuBF,OAAvB,CAA9B,GAAgEA,OAA1E;;EAEA,QAAI,CAACA,OAAL,EAAc;EACZ;EACD;;EAED,SAAKG,QAAL,GAAgBH,OAAhB;EACAI,IAAAA,wBAAI,CAACC,GAAL,CAAS,KAAKF,QAAd,EAAwB,KAAKJ,WAAL,CAAiBO,QAAzC,EAAmD,IAAnD;EACD;;EAEDC,EAAAA,OAAO,GAAG;EACRH,IAAAA,wBAAI,CAACI,MAAL,CAAY,KAAKL,QAAjB,EAA2B,KAAKJ,WAAL,CAAiBO,QAA5C;EACA,SAAKH,QAAL,GAAgB,IAAhB;EACD;EAED;;;EAEkB,SAAXM,WAAW,CAACT,OAAD,EAAU;EAC1B,WAAOI,wBAAI,CAACM,GAAL,CAASV,OAAT,EAAkB,KAAKM,QAAvB,CAAP;EACD;;EAEiB,aAAPT,OAAO,GAAG;EACnB,WAAOA,OAAP;EACD;;EAzBiB;;;;;;;;"} {"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\nimport EventHandler from './dom/event-handler'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.0.0'\n\nclass BaseComponent {\n constructor(element) {\n element = typeof element === 'string' ? document.querySelector(element) : element\n\n if (!element) {\n return\n }\n\n this._element = element\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`)\n this._element = null\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.get(element, this.DATA_KEY)\n }\n\n static get VERSION() {\n return VERSION\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","constructor","element","document","querySelector","_element","Data","set","DATA_KEY","dispose","remove","EventHandler","off","getInstance","get"],"mappings":";;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAKA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,OAAO,GAAG,OAAhB;;EAEA,MAAMC,aAAN,CAAoB;EAClBC,EAAAA,WAAW,CAACC,OAAD,EAAU;EACnBA,IAAAA,OAAO,GAAG,OAAOA,OAAP,KAAmB,QAAnB,GAA8BC,QAAQ,CAACC,aAAT,CAAuBF,OAAvB,CAA9B,GAAgEA,OAA1E;;EAEA,QAAI,CAACA,OAAL,EAAc;EACZ;EACD;;EAED,SAAKG,QAAL,GAAgBH,OAAhB;EACAI,IAAAA,wBAAI,CAACC,GAAL,CAAS,KAAKF,QAAd,EAAwB,KAAKJ,WAAL,CAAiBO,QAAzC,EAAmD,IAAnD;EACD;;EAEDC,EAAAA,OAAO,GAAG;EACRH,IAAAA,wBAAI,CAACI,MAAL,CAAY,KAAKL,QAAjB,EAA2B,KAAKJ,WAAL,CAAiBO,QAA5C;EACAG,IAAAA,gCAAY,CAACC,GAAb,CAAiB,KAAKP,QAAtB,EAAiC,IAAG,KAAKJ,WAAL,CAAiBO,QAAS,EAA9D;EACA,SAAKH,QAAL,GAAgB,IAAhB;EACD;EAED;;;EAEkB,SAAXQ,WAAW,CAACX,OAAD,EAAU;EAC1B,WAAOI,wBAAI,CAACQ,GAAL,CAASZ,OAAT,EAAkB,KAAKM,QAAvB,CAAP;EACD;;EAEiB,aAAPT,OAAO,GAAG;EACnB,WAAOA,OAAP;EACD;;EA1BiB;;;;;;;;"}

6
js/dist/button.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap button.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap button.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -17,7 +17,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -62,7 +62,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): button.js * Bootstrap (v5.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

23
js/dist/carousel.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap carousel.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap carousel.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -19,7 +19,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -49,7 +49,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -117,7 +117,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -180,7 +180,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): carousel.js * Bootstrap (v5.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -363,7 +363,6 @@
} }
dispose() { dispose() {
EventHandler__default['default'].off(this._element, EVENT_KEY);
this._items = null; this._items = null;
this._config = null; this._config = null;
this._interval = null; this._interval = null;
@ -478,11 +477,11 @@
if (event.key === ARROW_LEFT_KEY) { if (event.key === ARROW_LEFT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_LEFT); this._slide(DIRECTION_RIGHT);
} else if (event.key === ARROW_RIGHT_KEY) { } else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault(); event.preventDefault();
this._slide(DIRECTION_RIGHT); this._slide(DIRECTION_LEFT);
} }
} }
@ -644,10 +643,10 @@
} }
if (isRTL()) { if (isRTL()) {
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT; return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
} }
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV; return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
} }
_orderToDirection(order) { _orderToDirection(order) {
@ -656,10 +655,10 @@
} }
if (isRTL()) { if (isRTL()) {
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT; return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
} }
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT; return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
} // Static } // Static

File diff suppressed because one or more lines are too long

10
js/dist/collapse.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap collapse.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap collapse.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -19,7 +19,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -49,7 +49,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -127,7 +127,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -174,7 +174,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): collapse.js * Bootstrap (v5.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

4
js/dist/dom/data.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap data.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap data.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -11,7 +11,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/data.js * Bootstrap (v5.0.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAJ,EAAnB;AAEA,aAAe;EACbC,EAAAA,GAAG,CAACC,OAAD,EAAUC,GAAV,EAAeC,QAAf,EAAyB;EAC1B,QAAI,CAACL,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5BH,MAAAA,UAAU,CAACE,GAAX,CAAeC,OAAf,EAAwB,IAAIF,GAAJ,EAAxB;EACD;;EAED,UAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB,CAL0B;EAQ1B;;EACA,QAAI,CAACI,WAAW,CAACD,GAAZ,CAAgBF,GAAhB,CAAD,IAAyBG,WAAW,CAACE,IAAZ,KAAqB,CAAlD,EAAqD;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAR,CAAe,+EAA8EC,KAAK,CAACC,IAAN,CAAWN,WAAW,CAACO,IAAZ,EAAX,EAA+B,CAA/B,CAAkC,GAA/H;EACA;EACD;;EAEDP,IAAAA,WAAW,CAACL,GAAZ,CAAgBE,GAAhB,EAAqBC,QAArB;EACD,GAjBY;;EAmBbG,EAAAA,GAAG,CAACL,OAAD,EAAUC,GAAV,EAAe;EAChB,QAAIJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAJ,EAA6B;EAC3B,aAAOH,UAAU,CAACQ,GAAX,CAAeL,OAAf,EAAwBK,GAAxB,CAA4BJ,GAA5B,KAAoC,IAA3C;EACD;;EAED,WAAO,IAAP;EACD,GAzBY;;EA2BbW,EAAAA,MAAM,CAACZ,OAAD,EAAUC,GAAV,EAAe;EACnB,QAAI,CAACJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5B;EACD;;EAED,UAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB;EAEAI,IAAAA,WAAW,CAACS,MAAZ,CAAmBZ,GAAnB,EAPmB;;EAUnB,QAAIG,WAAW,CAACE,IAAZ,KAAqB,CAAzB,EAA4B;EAC1BT,MAAAA,UAAU,CAACgB,MAAX,CAAkBb,OAAlB;EACD;EACF;;EAxCY,CAAf;;;;;;;;"} {"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAJ,EAAnB;AAEA,aAAe;EACbC,EAAAA,GAAG,CAACC,OAAD,EAAUC,GAAV,EAAeC,QAAf,EAAyB;EAC1B,QAAI,CAACL,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5BH,MAAAA,UAAU,CAACE,GAAX,CAAeC,OAAf,EAAwB,IAAIF,GAAJ,EAAxB;EACD;;EAED,UAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB,CAL0B;EAQ1B;;EACA,QAAI,CAACI,WAAW,CAACD,GAAZ,CAAgBF,GAAhB,CAAD,IAAyBG,WAAW,CAACE,IAAZ,KAAqB,CAAlD,EAAqD;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAR,CAAe,+EAA8EC,KAAK,CAACC,IAAN,CAAWN,WAAW,CAACO,IAAZ,EAAX,EAA+B,CAA/B,CAAkC,GAA/H;EACA;EACD;;EAEDP,IAAAA,WAAW,CAACL,GAAZ,CAAgBE,GAAhB,EAAqBC,QAArB;EACD,GAjBY;;EAmBbG,EAAAA,GAAG,CAACL,OAAD,EAAUC,GAAV,EAAe;EAChB,QAAIJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAJ,EAA6B;EAC3B,aAAOH,UAAU,CAACQ,GAAX,CAAeL,OAAf,EAAwBK,GAAxB,CAA4BJ,GAA5B,KAAoC,IAA3C;EACD;;EAED,WAAO,IAAP;EACD,GAzBY;;EA2BbW,EAAAA,MAAM,CAACZ,OAAD,EAAUC,GAAV,EAAe;EACnB,QAAI,CAACJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5B;EACD;;EAED,UAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB;EAEAI,IAAAA,WAAW,CAACS,MAAZ,CAAmBZ,GAAnB,EAPmB;;EAUnB,QAAIG,WAAW,CAACE,IAAZ,KAAqB,CAAzB,EAA4B;EAC1BT,MAAAA,UAAU,CAACgB,MAAX,CAAkBb,OAAlB;EACD;EACF;;EAxCY,CAAf;;;;;;;;"}

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap event-handler.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap event-handler.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -11,7 +11,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -30,7 +30,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/event-handler.js * Bootstrap (v5.0.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -50,6 +50,7 @@
mouseenter: 'mouseover', mouseenter: 'mouseover',
mouseleave: 'mouseout' mouseleave: 'mouseout'
}; };
const customEventsRegex = /^(mouseenter|mouseleave)/i;
const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -93,7 +94,7 @@
if (handler.oneOff) { if (handler.oneOff) {
// eslint-disable-next-line unicorn/consistent-destructuring // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, selector, fn);
} }
return fn.apply(target, [event]); return fn.apply(target, [event]);
@ -122,15 +123,8 @@
function normalizeParams(originalTypeEvent, handler, delegationFn) { function normalizeParams(originalTypeEvent, handler, delegationFn) {
const delegation = typeof handler === 'string'; const delegation = typeof handler === 'string';
const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click') const originalHandler = delegation ? delegationFn : handler;
let typeEvent = getTypeEvent(originalTypeEvent);
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
const custom = customEvents[typeEvent];
if (custom) {
typeEvent = custom;
}
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
if (!isNative) { if (!isNative) {
@ -148,6 +142,24 @@
if (!handler) { if (!handler) {
handler = delegationFn; handler = delegationFn;
delegationFn = null; delegationFn = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (customEventsRegex.test(originalTypeEvent)) {
const wrapFn = fn => {
return function (event) {
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
return fn.call(this, event);
}
};
};
if (delegationFn) {
delegationFn = wrapFn(delegationFn);
} else {
handler = wrapFn(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@ -191,6 +203,12 @@
}); });
} }
function getTypeEvent(event) {
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
event = event.replace(stripNameRegex, '');
return customEvents[event] || event;
}
const EventHandler = { const EventHandler = {
on(element, event, handler, delegationFn) { on(element, event, handler, delegationFn) {
addHandler(element, event, handler, delegationFn, false); addHandler(element, event, handler, delegationFn, false);
@ -243,7 +261,7 @@
} }
const $ = getjQuery(); const $ = getjQuery();
const typeEvent = event.replace(stripNameRegex, ''); const typeEvent = getTypeEvent(event);
const inNamespace = event !== typeEvent; const inNamespace = event !== typeEvent;
const isNative = nativeEvents.has(typeEvent); const isNative = nativeEvents.has(typeEvent);
let jQueryEvent; let jQueryEvent;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap manipulator.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap manipulator.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -11,7 +11,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/manipulator.js * Bootstrap (v5.0.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsBC,GAAG,IAAK,IAAGA,GAAG,CAACC,WAAJ,EAAkB,EAAnD,CAAP;EACD;;QAEKC,WAAW,GAAG;EAClBC,EAAAA,gBAAgB,CAACC,OAAD,EAAUN,GAAV,EAAeO,KAAf,EAAsB;EACpCD,IAAAA,OAAO,CAACE,YAAR,CAAsB,WAAUT,gBAAgB,CAACC,GAAD,CAAM,EAAtD,EAAyDO,KAAzD;EACD,GAHiB;;EAKlBE,EAAAA,mBAAmB,CAACH,OAAD,EAAUN,GAAV,EAAe;EAChCM,IAAAA,OAAO,CAACI,eAAR,CAAyB,WAAUX,gBAAgB,CAACC,GAAD,CAAM,EAAzD;EACD,GAPiB;;EASlBW,EAAAA,iBAAiB,CAACL,OAAD,EAAU;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,UAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACUhB,GAAG,IAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CADjB,EAEGC,OAFH,CAEWlB,GAAG,IAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;;EA2BlBW,EAAAA,gBAAgB,CAACjB,OAAD,EAAUN,GAAV,EAAe;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,CAAsB,WAAUzB,gBAAgB,CAACC,GAAD,CAAM,EAAtD,CAAD,CAApB;EACD,GA7BiB;;EA+BlByB,EAAAA,MAAM,CAACnB,OAAD,EAAU;EACd,UAAMoB,IAAI,GAAGpB,OAAO,CAACqB,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GAtCiB;;EAwClBC,EAAAA,QAAQ,CAAC5B,OAAD,EAAU;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;;EA7CiB;;;;;;;;"} {"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsBC,GAAG,IAAK,IAAGA,GAAG,CAACC,WAAJ,EAAkB,EAAnD,CAAP;EACD;;QAEKC,WAAW,GAAG;EAClBC,EAAAA,gBAAgB,CAACC,OAAD,EAAUN,GAAV,EAAeO,KAAf,EAAsB;EACpCD,IAAAA,OAAO,CAACE,YAAR,CAAsB,WAAUT,gBAAgB,CAACC,GAAD,CAAM,EAAtD,EAAyDO,KAAzD;EACD,GAHiB;;EAKlBE,EAAAA,mBAAmB,CAACH,OAAD,EAAUN,GAAV,EAAe;EAChCM,IAAAA,OAAO,CAACI,eAAR,CAAyB,WAAUX,gBAAgB,CAACC,GAAD,CAAM,EAAzD;EACD,GAPiB;;EASlBW,EAAAA,iBAAiB,CAACL,OAAD,EAAU;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,UAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACUhB,GAAG,IAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CADjB,EAEGC,OAFH,CAEWlB,GAAG,IAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;;EA2BlBW,EAAAA,gBAAgB,CAACjB,OAAD,EAAUN,GAAV,EAAe;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,CAAsB,WAAUzB,gBAAgB,CAACC,GAAD,CAAM,EAAtD,CAAD,CAApB;EACD,GA7BiB;;EA+BlByB,EAAAA,MAAM,CAACnB,OAAD,EAAU;EACd,UAAMoB,IAAI,GAAGpB,OAAO,CAACqB,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GAtCiB;;EAwClBC,EAAAA,QAAQ,CAAC5B,OAAD,EAAU;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;;EA7CiB;;;;;;;;"}

View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap selector-engine.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap selector-engine.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -11,7 +11,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Bootstrap (v5.0.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,SAAS,GAAG,CAAlB;QAEMC,cAAc,GAAG;EACrBC,EAAAA,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,WAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;;EAKrBS,EAAAA,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,WAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,EACJC,MADI,CACGC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CADZ,CAAP;EAED,GAZoB;;EAcrBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;EACzB,UAAMe,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAImB,QAAQ,CAACF,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9Be,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GA5BoB;;EA8BrBO,EAAAA,IAAI,CAACrB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIuB,QAAQ,GAAGtB,OAAO,CAACuB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACT,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACuB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA1CoB;;EA4CrBC,EAAAA,IAAI,CAACxB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIyB,IAAI,GAAGxB,OAAO,CAACyB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAIA,IAAI,CAACX,OAAL,CAAad,QAAb,CAAJ,EAA4B;EAC1B,eAAO,CAACyB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;;EAxDoB;;;;;;;;"} {"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,SAAS,GAAG,CAAlB;QAEMC,cAAc,GAAG;EACrBC,EAAAA,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,WAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;;EAKrBS,EAAAA,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,WAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,EACJC,MADI,CACGC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CADZ,CAAP;EAED,GAZoB;;EAcrBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;EACzB,UAAMe,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAImB,QAAQ,CAACF,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9Be,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GA5BoB;;EA8BrBO,EAAAA,IAAI,CAACrB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIuB,QAAQ,GAAGtB,OAAO,CAACuB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACT,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACuB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA1CoB;;EA4CrBC,EAAAA,IAAI,CAACxB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIyB,IAAI,GAAGxB,OAAO,CAACyB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAIA,IAAI,CAACX,OAAL,CAAad,QAAb,CAAJ,EAA4B;EAC1B,eAAO,CAACyB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;;EAxDoB;;;;;;;;"}

217
js/dist/dropdown.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap dropdown.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap dropdown.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -40,7 +40,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -68,7 +68,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -91,7 +91,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -110,7 +110,23 @@
return false; return false;
}; };
const noop = () => function () {}; const isDisabled = element => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
return true;
}
if (element.classList.contains('disabled')) {
return true;
}
if (typeof element.disabled !== 'undefined') {
return element.disabled;
}
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
};
const noop = () => {};
const getjQuery = () => { const getjQuery = () => {
const { const {
@ -154,7 +170,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dropdown.js * Bootstrap (v5.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -184,7 +200,6 @@
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`; const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`;
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`; const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
const CLASS_NAME_DISABLED = 'disabled';
const CLASS_NAME_SHOW = 'show'; const CLASS_NAME_SHOW = 'show';
const CLASS_NAME_DROPUP = 'dropup'; const CLASS_NAME_DROPUP = 'dropup';
const CLASS_NAME_DROPEND = 'dropend'; const CLASS_NAME_DROPEND = 'dropend';
@ -205,14 +220,16 @@
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
display: 'dynamic', display: 'dynamic',
popperConfig: null popperConfig: null,
autoClose: true
}; };
const DefaultType = { const DefaultType = {
offset: '(array|string|function)', offset: '(array|string|function)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object|function)' popperConfig: '(null|object|function)',
autoClose: '(boolean|string)'
}; };
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -246,15 +263,14 @@
toggle() { toggle() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { if (isDisabled(this._element)) {
return; return;
} }
const isActive = this._element.classList.contains(CLASS_NAME_SHOW); const isActive = this._element.classList.contains(CLASS_NAME_SHOW);
Dropdown.clearMenus();
if (isActive) { if (isActive) {
this.hide();
return; return;
} }
@ -262,7 +278,7 @@
} }
show() { show() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW)) { if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW)) {
return; return;
} }
@ -313,7 +329,7 @@
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
[].concat(...document.body.children).forEach(elem => EventHandler__default['default'].on(elem, 'mouseover', null, noop())); [].concat(...document.body.children).forEach(elem => EventHandler__default['default'].on(elem, 'mouseover', noop));
} }
this._element.focus(); this._element.focus();
@ -328,33 +344,18 @@
} }
hide() { hide() {
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW)) { if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW)) {
return; return;
} }
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element relatedTarget: this._element
}; };
const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) { this._completeHide(relatedTarget);
return;
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.toggle(CLASS_NAME_SHOW);
this._element.classList.toggle(CLASS_NAME_SHOW);
Manipulator__default['default'].removeDataAttribute(this._menu, 'popper');
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN, relatedTarget);
} }
dispose() { dispose() {
EventHandler__default['default'].off(this._element, EVENT_KEY);
this._menu = null; this._menu = null;
if (this._popper) { if (this._popper) {
@ -382,6 +383,33 @@
}); });
} }
_completeHide(relatedTarget) {
const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler__default['default'].off(elem, 'mouseover', noop));
}
if (this._popper) {
this._popper.destroy();
}
this._menu.classList.remove(CLASS_NAME_SHOW);
this._element.classList.remove(CLASS_NAME_SHOW);
this._element.setAttribute('aria-expanded', 'false');
Manipulator__default['default'].removeDataAttribute(this._menu, 'popper');
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN, relatedTarget);
}
_getConfig(config) { _getConfig(config) {
config = { ...this.constructor.Default, config = { ...this.constructor.Default,
...Manipulator__default['default'].getDataAttributes(this._element), ...Manipulator__default['default'].getDataAttributes(this._element),
@ -468,6 +496,29 @@
return { ...defaultBsPopperConfig, return { ...defaultBsPopperConfig,
...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
}; };
}
_selectMenuItem(event) {
const items = SelectorEngine__default['default'].find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} // Static } // Static
@ -501,7 +552,7 @@
return; return;
} }
if (/input|select|textarea|form/i.test(event.target.tagName)) { if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return; return;
} }
} }
@ -510,58 +561,38 @@
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const context = Data__default['default'].get(toggles[i], DATA_KEY); const context = Data__default['default'].get(toggles[i], DATA_KEY);
if (!context || context._config.autoClose === false) {
continue;
}
if (!context._element.classList.contains(CLASS_NAME_SHOW)) {
continue;
}
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i] relatedTarget: context._element
}; };
if (event && event.type === 'click') {
relatedTarget.clickEvent = event;
}
if (!context) {
continue;
}
const dropdownMenu = context._menu;
if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) {
continue;
}
if (event) { if (event) {
// Don't close the menu if the clicked element or one of its parents is the dropdown button const composedPath = event.composedPath();
if ([context._element].some(element => event.composedPath().includes(element))) { const isMenuTarget = composedPath.includes(context._menu);
if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
continue; continue;
} // Tab navigation through the dropdown menu shouldn't close the menu } // Tab navigation through the dropdown menu shouldn't close the menu
if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) { if (event.type === 'keyup' && event.key === TAB_KEY && context._menu.contains(event.target)) {
continue; continue;
} }
if (event.type === 'click') {
relatedTarget.clickEvent = event;
}
} }
const hideEvent = EventHandler__default['default'].trigger(toggles[i], EVENT_HIDE, relatedTarget); context._completeHide(relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(elem => EventHandler__default['default'].off(elem, 'mouseover', null, noop()));
}
toggles[i].setAttribute('aria-expanded', 'false');
if (context._popper) {
context._popper.destroy();
}
dropdownMenu.classList.remove(CLASS_NAME_SHOW);
toggles[i].classList.remove(CLASS_NAME_SHOW);
Manipulator__default['default'].removeDataAttribute(dropdownMenu, 'popper');
EventHandler__default['default'].trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
} }
} }
@ -581,26 +612,29 @@
return; return;
} }
event.preventDefault(); const isActive = this.classList.contains(CLASS_NAME_SHOW);
event.stopPropagation();
if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { if (!isActive && event.key === ESCAPE_KEY) {
return; return;
} }
const parent = Dropdown.getParentFromElement(this); event.preventDefault();
const isActive = this.classList.contains(CLASS_NAME_SHOW); event.stopPropagation();
if (isDisabled(this)) {
return;
}
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
if (event.key === ESCAPE_KEY) { if (event.key === ESCAPE_KEY) {
const button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0]; getToggleButton().focus();
button.focus();
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0]; getToggleButton().click();
button.click();
return; return;
} }
@ -609,26 +643,7 @@
return; return;
} }
const items = SelectorEngine__default['default'].find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
if (!items.length) {
return;
}
let index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) {
index--;
} // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
index++;
} // index is -1 if the first keydown is an ArrowUp
index = index === -1 ? 0 : index;
items[index].focus();
} }
} }

File diff suppressed because one or more lines are too long

443
js/dist/modal.js vendored
View File

@ -1,17 +1,16 @@
/*! /*!
* Bootstrap modal.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap modal.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) : typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict'; }(this, (function (EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
@ -19,7 +18,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -49,7 +48,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -117,7 +116,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -178,9 +177,217 @@
}); });
}; };
const execute = callback => {
if (typeof callback === 'function') {
callback();
}
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): modal.js * Bootstrap (v5.0.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
const documentWidth = document.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
};
const hide = (width = getWidth()) => {
_disableOverFlow(); // give padding to element to balances the hidden scrollbar width
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
};
const _disableOverFlow = () => {
const actualValue = document.body.style.overflow;
if (actualValue) {
Manipulator__default['default'].setDataAttribute(document.body, 'overflow', actualValue);
}
document.body.style.overflow = 'hidden';
};
const _setElementAttributes = (selector, styleProp, callback) => {
const scrollbarWidth = getWidth();
SelectorEngine__default['default'].find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
});
};
const reset = () => {
_resetElementAttributes('body', 'overflow');
_resetElementAttributes('body', 'paddingRight');
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
};
const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine__default['default'].find(selector).forEach(element => {
const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
if (typeof value === 'undefined') {
element.style.removeProperty(styleProp);
} else {
Manipulator__default['default'].removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Default$1 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: document.body,
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$1 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: 'element',
clickCallback: '(function|null)'
};
const NAME$1 = 'backdrop';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_FADE$1 = 'fade';
const CLASS_NAME_SHOW$1 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$1}`;
class Backdrop {
constructor(config) {
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
if (this._config.isAnimated) {
reflow(this._getElement());
}
this._getElement().classList.add(CLASS_NAME_SHOW$1);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$1);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
} // Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE$1);
}
this._element = backdrop;
}
return this._element;
}
_getConfig(config) {
config = { ...Default$1,
...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME$1, config, DefaultType$1);
return config;
}
_append() {
if (this._isAppended) {
return;
}
this._config.rootElement.appendChild(this._getElement());
EventHandler__default['default'].on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler__default['default'].off(this._element, EVENT_MOUSEDOWN);
this._getElement().parentNode.removeChild(this._element);
this._isAppended = false;
}
_emulateAnimation(callback) {
if (!this._config.isAnimated) {
execute(callback);
return;
}
const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
EventHandler__default['default'].one(this._getElement(), 'transitionend', () => execute(callback));
emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
}
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -217,8 +424,6 @@
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY}`; const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`; const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
const CLASS_NAME_FADE = 'fade'; const CLASS_NAME_FADE = 'fade';
const CLASS_NAME_SHOW = 'show'; const CLASS_NAME_SHOW = 'show';
@ -227,8 +432,6 @@
const SELECTOR_MODAL_BODY = '.modal-body'; const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]';
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]'; const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -240,12 +443,10 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, this._element); this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, this._element);
this._backdrop = null; this._backdrop = this._initializeBackDrop();
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false; this._ignoreBackdropClick = false;
this._isTransitioning = false; this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters } // Getters
@ -280,10 +481,8 @@
} }
this._isShown = true; this._isShown = true;
hide();
this._checkScrollbar(); document.body.classList.add(CLASS_NAME_OPEN);
this._setScrollbar();
this._adjustDialog(); this._adjustDialog();
@ -347,7 +546,7 @@
} }
dispose() { dispose() {
[window, this._element, this._dialog].forEach(htmlElement => EventHandler__default['default'].off(htmlElement, EVENT_KEY)); [window, this._dialog].forEach(htmlElement => EventHandler__default['default'].off(htmlElement, EVENT_KEY));
super.dispose(); super.dispose();
/** /**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@ -358,12 +557,13 @@
EventHandler__default['default'].off(document, EVENT_FOCUSIN); EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._config = null; this._config = null;
this._dialog = null; this._dialog = null;
this._backdrop.dispose();
this._backdrop = null; this._backdrop = null;
this._isShown = null; this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null; this._ignoreBackdropClick = null;
this._isTransitioning = null; this._isTransitioning = null;
this._scrollbarWidth = null;
} }
handleUpdate() { handleUpdate() {
@ -371,8 +571,17 @@
} // Private } // Private
_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop),
// 'static' option will be translated to true, and booleans will keep their value
isAnimated: this._isAnimated()
});
}
_getConfig(config) { _getConfig(config) {
config = { ...Default, config = { ...Default,
...Manipulator__default['default'].getDataAttributes(this._element),
...config ...config
}; };
typeCheckConfig(NAME, config, DefaultType); typeCheckConfig(NAME, config, DefaultType);
@ -477,85 +686,35 @@
this._isTransitioning = false; this._isTransitioning = false;
this._showBackdrop(() => { this._backdrop.hide(() => {
document.body.classList.remove(CLASS_NAME_OPEN); document.body.classList.remove(CLASS_NAME_OPEN);
this._resetAdjustments(); this._resetAdjustments();
this._resetScrollbar(); reset();
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN); EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
}); });
} }
_removeBackdrop() {
this._backdrop.parentNode.removeChild(this._backdrop);
this._backdrop = null;
}
_showBackdrop(callback) { _showBackdrop(callback) {
const isAnimated = this._isAnimated(); EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, event => {
if (this._ignoreBackdropClick) {
if (this._isShown && this._config.backdrop) { this._ignoreBackdropClick = false;
this._backdrop = document.createElement('div');
this._backdrop.className = CLASS_NAME_BACKDROP;
if (isAnimated) {
this._backdrop.classList.add(CLASS_NAME_FADE);
}
document.body.appendChild(this._backdrop);
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, event => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
} else {
this.hide();
}
});
if (isAnimated) {
reflow(this._backdrop);
}
this._backdrop.classList.add(CLASS_NAME_SHOW);
if (!isAnimated) {
callback();
return; return;
} }
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); if (event.target !== event.currentTarget) {
EventHandler__default['default'].one(this._backdrop, 'transitionend', callback); return;
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW);
const callbackRemove = () => {
this._removeBackdrop();
callback();
};
if (isAnimated) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler__default['default'].one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else {
callbackRemove();
} }
} else {
callback(); if (this._config.backdrop === true) {
} this.hide();
} else if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
}
});
this._backdrop.show(callback);
} }
_isAnimated() { _isAnimated() {
@ -599,103 +758,37 @@
_adjustDialog() { _adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
const scrollbarWidth = getWidth();
const isBodyOverflowing = scrollbarWidth > 0;
if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) { if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`; this._element.style.paddingLeft = `${scrollbarWidth}px`;
} }
if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) { if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
this._element.style.paddingRight = `${this._scrollbarWidth}px`; this._element.style.paddingRight = `${scrollbarWidth}px`;
} }
} }
_resetAdjustments() { _resetAdjustments() {
this._element.style.paddingLeft = ''; this._element.style.paddingLeft = '';
this._element.style.paddingRight = ''; this._element.style.paddingRight = '';
}
_checkScrollbar() {
const rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
_setScrollbar() {
if (this._isBodyOverflowing) {
this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
}
document.body.classList.add(CLASS_NAME_OPEN);
}
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine__default['default'].find(selector).forEach(element => {
if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
return;
}
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() {
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
this._resetElementAttributes('body', 'paddingRight');
}
_resetElementAttributes(selector, styleProp) {
SelectorEngine__default['default'].find(selector).forEach(element => {
const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) {
element.style[styleProp] = '';
} else {
Manipulator__default['default'].removeDataAttribute(element, styleProp);
element.style[styleProp] = value;
}
});
}
_getScrollbarWidth() {
// thx d.walsh
const scrollDiv = document.createElement('div');
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
} // Static } // Static
static jQueryInterface(config, relatedTarget) { static jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
let data = Data__default['default'].get(this, DATA_KEY); const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
const _config = { ...Default,
...Manipulator__default['default'].getDataAttributes(this),
...(typeof config === 'object' && config ? config : {})
};
if (!data) { if (typeof config !== 'string') {
data = new Modal(this, _config); return;
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config](relatedTarget);
} }
data[config](relatedTarget);
}); });
} }
@ -710,7 +803,7 @@
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
const target = getElementFromSelector(this); const target = getElementFromSelector(this);
if (this.tagName === 'A' || this.tagName === 'AREA') { if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault(); event.preventDefault();
} }
@ -726,15 +819,7 @@
} }
}); });
}); });
let data = Data__default['default'].get(target, DATA_KEY); const data = Modal.getInstance(target) || new Modal(target);
if (!data) {
const config = { ...Manipulator__default['default'].getDataAttributes(target),
...Manipulator__default['default'].getDataAttributes(this)
};
data = new Modal(target, config);
}
data.toggle(this); data.toggle(this);
}); });
/** /**

File diff suppressed because one or more lines are too long

275
js/dist/offcanvas.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap offcanvas.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap offcanvas.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -19,11 +19,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
const MILLISECONDS_MULTIPLIER = 1000; const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = obj => { const toType = obj => {
if (obj === null || obj === undefined) { if (obj === null || obj === undefined) {
@ -48,7 +49,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -57,16 +58,6 @@
return selector; return selector;
}; };
const getSelectorFromElement = element => {
const selector = getSelector(element);
if (selector) {
return document.querySelector(selector) ? selector : null;
}
return null;
};
const getElementFromSelector = element => { const getElementFromSelector = element => {
const selector = getSelector(element); const selector = getSelector(element);
return selector ? document.querySelector(selector) : null; return selector ? document.querySelector(selector) : null;
@ -95,8 +86,30 @@
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
}; };
const triggerTransitionEnd = element => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = obj => (obj[0] || obj).nodeType; const isElement = obj => (obj[0] || obj).nodeType;
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
};
const typeCheckConfig = (componentName, config, configTypes) => { const typeCheckConfig = (componentName, config, configTypes) => {
Object.keys(configTypes).forEach(property => { Object.keys(configTypes).forEach(property => {
const expectedTypes = configTypes[property]; const expectedTypes = configTypes[property];
@ -104,7 +117,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -139,6 +152,8 @@
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
}; };
const reflow = element => element.offsetHeight;
const getjQuery = () => { const getjQuery = () => {
const { const {
jQuery jQuery
@ -177,13 +192,19 @@
}); });
}; };
const execute = callback => {
if (typeof callback === 'function') {
callback();
}
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/scrollBar.js * Bootstrap (v5.0.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed'; const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top'; const SELECTOR_STICKY_CONTENT = '.sticky-top';
const getWidth = () => { const getWidth = () => {
@ -193,13 +214,25 @@
}; };
const hide = (width = getWidth()) => { const hide = (width = getWidth()) => {
document.body.style.overflow = 'hidden'; _disableOverFlow(); // give padding to element to balances the hidden scrollbar width
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
_setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width); _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
_setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width); _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
};
_setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); const _disableOverFlow = () => {
const actualValue = document.body.style.overflow;
if (actualValue) {
Manipulator__default['default'].setDataAttribute(document.body, 'overflow', actualValue);
}
document.body.style.overflow = 'hidden';
}; };
const _setElementAttributes = (selector, styleProp, callback) => { const _setElementAttributes = (selector, styleProp, callback) => {
@ -212,25 +245,25 @@
const actualValue = element.style[styleProp]; const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp]; const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue); Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'; element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
}); });
}; };
const reset = () => { const reset = () => {
document.body.style.overflow = 'auto'; _resetElementAttributes('body', 'overflow');
_resetElementAttributes('body', 'paddingRight');
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
_resetElementAttributes('body', 'paddingRight');
}; };
const _resetElementAttributes = (selector, styleProp) => { const _resetElementAttributes = (selector, styleProp) => {
SelectorEngine__default['default'].find(selector).forEach(element => { SelectorEngine__default['default'].find(selector).forEach(element => {
const value = Manipulator__default['default'].getDataAttribute(element, styleProp); const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
if (typeof value === 'undefined' && element === document.body) { if (typeof value === 'undefined') {
element.style.removeProperty(styleProp); element.style.removeProperty(styleProp);
} else { } else {
Manipulator__default['default'].removeDataAttribute(element, styleProp); Manipulator__default['default'].removeDataAttribute(element, styleProp);
@ -241,7 +274,135 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): offcanvas.js * Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Default$1 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
rootElement: document.body,
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$1 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: 'element',
clickCallback: '(function|null)'
};
const NAME$1 = 'backdrop';
const CLASS_NAME_BACKDROP = 'modal-backdrop';
const CLASS_NAME_FADE = 'fade';
const CLASS_NAME_SHOW$1 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$1}`;
class Backdrop {
constructor(config) {
this._config = this._getConfig(config);
this._isAppended = false;
this._element = null;
}
show(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._append();
if (this._config.isAnimated) {
reflow(this._getElement());
}
this._getElement().classList.add(CLASS_NAME_SHOW$1);
this._emulateAnimation(() => {
execute(callback);
});
}
hide(callback) {
if (!this._config.isVisible) {
execute(callback);
return;
}
this._getElement().classList.remove(CLASS_NAME_SHOW$1);
this._emulateAnimation(() => {
this.dispose();
execute(callback);
});
} // Private
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
backdrop.classList.add(CLASS_NAME_FADE);
}
this._element = backdrop;
}
return this._element;
}
_getConfig(config) {
config = { ...Default$1,
...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME$1, config, DefaultType$1);
return config;
}
_append() {
if (this._isAppended) {
return;
}
this._config.rootElement.appendChild(this._getElement());
EventHandler__default['default'].on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
});
this._isAppended = true;
}
dispose() {
if (!this._isAppended) {
return;
}
EventHandler__default['default'].off(this._element, EVENT_MOUSEDOWN);
this._getElement().parentNode.removeChild(this._element);
this._isAppended = false;
}
_emulateAnimation(callback) {
if (!this._config.isAnimated) {
execute(callback);
return;
}
const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
EventHandler__default['default'].one(this._getElement(), 'transitionend', () => execute(callback));
emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
}
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -267,11 +428,8 @@
keyboard: 'boolean', keyboard: 'boolean',
scroll: 'boolean' scroll: 'boolean'
}; };
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
const CLASS_NAME_SHOW = 'show'; const CLASS_NAME_SHOW = 'show';
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
const OPEN_SELECTOR = '.offcanvas.show'; const OPEN_SELECTOR = '.offcanvas.show';
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
const EVENT_SHOW = `show${EVENT_KEY}`; const EVENT_SHOW = `show${EVENT_KEY}`;
const EVENT_SHOWN = `shown${EVENT_KEY}`; const EVENT_SHOWN = `shown${EVENT_KEY}`;
const EVENT_HIDE = `hide${EVENT_KEY}`; const EVENT_HIDE = `hide${EVENT_KEY}`;
@ -279,6 +437,7 @@
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`; const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`;
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]'; const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]';
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]'; const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]';
/** /**
@ -292,6 +451,7 @@
super(element); super(element);
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._isShown = false; this._isShown = false;
this._backdrop = this._initializeBackDrop();
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -326,15 +486,13 @@
this._isShown = true; this._isShown = true;
this._element.style.visibility = 'visible'; this._element.style.visibility = 'visible';
if (this._config.backdrop) { this._backdrop.show();
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
hide(); hide();
}
this._element.classList.add(CLASS_NAME_TOGGLING); this._enforceFocusOnElement(this._element);
}
this._element.removeAttribute('aria-hidden'); this._element.removeAttribute('aria-hidden');
@ -345,16 +503,14 @@
this._element.classList.add(CLASS_NAME_SHOW); this._element.classList.add(CLASS_NAME_SHOW);
const completeCallBack = () => { const completeCallBack = () => {
this._element.classList.remove(CLASS_NAME_TOGGLING);
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, { EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, {
relatedTarget relatedTarget
}); });
this._enforceFocusOnElement(this._element);
}; };
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
} }
hide() { hide() {
@ -368,8 +524,6 @@
return; return;
} }
this._element.classList.add(CLASS_NAME_TOGGLING);
EventHandler__default['default'].off(document, EVENT_FOCUSIN); EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._element.blur(); this._element.blur();
@ -378,6 +532,8 @@
this._element.classList.remove(CLASS_NAME_SHOW); this._element.classList.remove(CLASS_NAME_SHOW);
this._backdrop.hide();
const completeCallback = () => { const completeCallback = () => {
this._element.setAttribute('aria-hidden', true); this._element.setAttribute('aria-hidden', true);
@ -387,20 +543,25 @@
this._element.style.visibility = 'hidden'; this._element.style.visibility = 'hidden';
if (this._config.backdrop) {
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
}
if (!this._config.scroll) { if (!this._config.scroll) {
reset(); reset();
} }
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN); EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
this._element.classList.remove(CLASS_NAME_TOGGLING);
}; };
setTimeout(completeCallback, getTransitionDurationFromElement(this._element)); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
} // Private } // Private
@ -413,6 +574,15 @@
return config; return config;
} }
_initializeBackDrop() {
return new Backdrop({
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
clickCallback: () => this.hide()
});
}
_enforceFocusOnElement(element) { _enforceFocusOnElement(element) {
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
@ -426,18 +596,11 @@
_addEventListeners() { _addEventListeners() {
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide()); EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
EventHandler__default['default'].on(document, 'keydown', event => { EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) { if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide(); this.hide();
} }
}); });
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, event => {
const target = SelectorEngine__default['default'].findOne(getSelectorFromElement(event.target));
if (!this._element.contains(event.target) && target !== this._element) {
this.hide();
}
});
} // Static } // Static
@ -483,10 +646,10 @@
} }
}); // avoid conflict when clicking a toggler of an offcanvas, while another is open }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
const allReadyOpen = SelectorEngine__default['default'].findOne(ACTIVE_SELECTOR); const allReadyOpen = SelectorEngine__default['default'].findOne(OPEN_SELECTOR);
if (allReadyOpen && allReadyOpen !== target) { if (allReadyOpen && allReadyOpen !== target) {
return; Offcanvas.getInstance(allReadyOpen).hide();
} }
const data = Data__default['default'].get(target, DATA_KEY) || new Offcanvas(target); const data = Data__default['default'].get(target, DATA_KEY) || new Offcanvas(target);

File diff suppressed because one or more lines are too long

6
js/dist/popover.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap popover.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap popover.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -17,7 +17,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -62,7 +62,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): popover.js * Bootstrap (v5.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

File diff suppressed because one or more lines are too long

40
js/dist/scrollspy.js vendored
View File

@ -1,17 +1,16 @@
/*! /*!
* Bootstrap scrollspy.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap scrollspy.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) : typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict'; }(this, (function (EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
@ -19,7 +18,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -62,7 +61,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -90,7 +89,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -135,7 +134,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): scrollspy.js * Bootstrap (v5.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -248,6 +247,7 @@
_getConfig(config) { _getConfig(config) {
config = { ...Default, config = { ...Default,
...Manipulator__default['default'].getDataAttributes(this._element),
...(typeof config === 'object' && config ? config : {}) ...(typeof config === 'object' && config ? config : {})
}; };
@ -356,21 +356,17 @@
static jQueryInterface(config) { static jQueryInterface(config) {
return this.each(function () { return this.each(function () {
let data = Data__default['default'].get(this, DATA_KEY); const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
const _config = typeof config === 'object' && config; if (typeof config !== 'string') {
return;
if (!data) {
data = new ScrollSpy(this, _config);
} }
if (typeof config === 'string') { if (typeof data[config] === 'undefined') {
if (typeof data[config] === 'undefined') { throw new TypeError(`No method named "${config}"`);
throw new TypeError(`No method named "${config}"`);
}
data[config]();
} }
data[config]();
}); });
} }
@ -383,7 +379,7 @@
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => { EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy))); SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

29
js/dist/tab.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap tab.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap tab.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -18,7 +18,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -40,7 +40,7 @@
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1]; hrefAttr = `#${hrefAttr.split('#')[1]}`;
} }
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@ -157,7 +157,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tab.js * Bootstrap (v5.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -201,7 +201,7 @@
show() { show() {
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) { if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
return; return;
} }
@ -289,11 +289,17 @@
element.classList.add(CLASS_NAME_SHOW); element.classList.add(CLASS_NAME_SHOW);
} }
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { let parent = element.parentNode;
if (parent && parent.nodeName === 'LI') {
parent = parent.parentNode;
}
if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = element.closest(SELECTOR_DROPDOWN); const dropdownElement = element.closest(SELECTOR_DROPDOWN);
if (dropdownElement) { if (dropdownElement) {
SelectorEngine__default['default'].find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); SelectorEngine__default['default'].find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);
@ -328,7 +334,14 @@
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault(); if (['A', 'AREA'].includes(this.tagName)) {
event.preventDefault();
}
if (isDisabled(this)) {
return;
}
const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this); const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
data.show(); data.show();
}); });

2
js/dist/tab.js.map vendored

File diff suppressed because one or more lines are too long

9
js/dist/toast.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap toast.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap toast.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -18,7 +18,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -87,7 +87,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -134,7 +134,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): toast.js * Bootstrap (v5.0.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -273,7 +273,6 @@
this._element.classList.remove(CLASS_NAME_SHOW); this._element.classList.remove(CLASS_NAME_SHOW);
} }
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
super.dispose(); super.dispose();
this._config = null; this._config = null;
} // Private } // Private

File diff suppressed because one or more lines are too long

16
js/dist/tooltip.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* Bootstrap tooltip.js v5.0.0-beta3 (https://getbootstrap.com/) * Bootstrap tooltip.js v5.0.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@ -40,7 +40,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/index.js * Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -124,7 +124,7 @@
const valueType = value && isElement(value) ? 'element' : toType(value); const valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`); throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
} }
}); });
}; };
@ -152,7 +152,7 @@
return findShadowRoot(element.parentNode); return findShadowRoot(element.parentNode);
}; };
const noop = () => function () {}; const noop = () => {};
const getjQuery = () => { const getjQuery = () => {
const { const {
@ -196,7 +196,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/sanitizer.js * Bootstrap (v5.0.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -309,7 +309,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tooltip.js * Bootstrap (v5.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -484,7 +484,6 @@
dispose() { dispose() {
clearTimeout(this._timeout); clearTimeout(this._timeout);
EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this.tip && this.tip.parentNode) { if (this.tip && this.tip.parentNode) {
@ -569,7 +568,7 @@
if ('ontouchstart' in document.documentElement) { if ('ontouchstart' in document.documentElement) {
[].concat(...document.body.children).forEach(element => { [].concat(...document.body.children).forEach(element => {
EventHandler__default['default'].on(element, 'mouseover', noop()); EventHandler__default['default'].on(element, 'mouseover', noop);
}); });
} }
@ -768,7 +767,6 @@
modifiers: [{ modifiers: [{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements fallbackPlacements: this.config.fallbackPlacements
} }
}, { }, {

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): index.esm.js * Bootstrap (v5.0.0): index.esm.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): index.umd.js * Bootstrap (v5.0.0): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): alert.js * Bootstrap (v5.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): base-component.js * Bootstrap (v5.0.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -14,7 +14,7 @@ import EventHandler from './dom/event-handler'
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta3' const VERSION = '5.0.0'
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): button.js * Bootstrap (v5.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): carousel.js * Bootstrap (v5.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): collapse.js * Bootstrap (v5.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/data.js * Bootstrap (v5.0.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/event-handler.js * Bootstrap (v5.0.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/manipulator.js * Bootstrap (v5.0.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Bootstrap (v5.0.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): dropdown.js * Bootstrap (v5.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): modal.js * Bootstrap (v5.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): offcanvas.js * Bootstrap (v5.0.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): popover.js * Bootstrap (v5.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): scrollspy.js * Bootstrap (v5.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tab.js * Bootstrap (v5.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): toast.js * Bootstrap (v5.0.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): tooltip.js * Bootstrap (v5.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta3): util/backdrop.js * Bootstrap (v5.0.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

Some files were not shown because too many files have changed in this diff Show More