bootstrap-italia 2.12.1 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.EN.md +1 -1
- package/README.md +1 -1
- package/dist/bootstrap-italia.esm.js +1 -1
- package/dist/css/bootstrap-italia.min.css +9 -1
- package/dist/css/bootstrap-italia.min.css.map +1 -1
- package/dist/js/bootstrap-italia.bundle.min.js +19 -23
- package/dist/js/bootstrap-italia.min.js +18 -2
- package/dist/plugins/accept-overlay.js +19 -9
- package/dist/plugins/accept-overlay.js.map +1 -1
- package/dist/plugins/accordion.js +19 -24
- package/dist/plugins/accordion.js.map +1 -1
- package/dist/plugins/alert.js +67 -2
- package/dist/plugins/alert.js.map +1 -1
- package/dist/plugins/{backToTop.js → back-to-top.js} +14 -5
- package/dist/plugins/back-to-top.js.map +1 -0
- package/dist/plugins/base-component.js +91 -0
- package/dist/plugins/base-component.js.map +1 -0
- package/dist/plugins/button.js +58 -2
- package/dist/plugins/button.js.map +1 -1
- package/dist/plugins/carousel-bi.js +19 -9
- package/dist/plugins/carousel-bi.js.map +1 -1
- package/dist/plugins/carousel.js +445 -2
- package/dist/plugins/carousel.js.map +1 -1
- package/dist/plugins/collapse.js +273 -2
- package/dist/plugins/collapse.js.map +1 -1
- package/dist/plugins/cookiebar.js +39 -52
- package/dist/plugins/cookiebar.js.map +1 -1
- package/dist/plugins/dimmer.js +19 -8
- package/dist/plugins/dimmer.js.map +1 -1
- package/dist/plugins/dom/data.js +61 -0
- package/dist/plugins/dom/data.js.map +1 -0
- package/dist/plugins/dom/event-handler.js +296 -0
- package/dist/plugins/dom/event-handler.js.map +1 -0
- package/dist/plugins/dom/manipulator.js +76 -0
- package/dist/plugins/dom/manipulator.js.map +1 -0
- package/dist/plugins/dom/selector-engine.js +82 -0
- package/dist/plugins/dom/selector-engine.js.map +1 -0
- package/dist/plugins/dropdown.js +433 -2
- package/dist/plugins/dropdown.js.map +1 -1
- package/dist/plugins/fonts-loader.js +9 -1
- package/dist/plugins/fonts-loader.js.map +1 -1
- package/dist/plugins/form-validate.js +22 -8
- package/dist/plugins/form-validate.js.map +1 -1
- package/dist/plugins/forward.js +21 -18
- package/dist/plugins/forward.js.map +1 -1
- package/dist/plugins/header-sticky.js +11 -2
- package/dist/plugins/header-sticky.js.map +1 -1
- package/dist/plugins/history-back.js +17 -17
- package/dist/plugins/history-back.js.map +1 -1
- package/dist/plugins/init.js +9 -0
- package/dist/plugins/init.js.map +1 -1
- package/dist/plugins/input-label.js +14 -3
- package/dist/plugins/input-label.js.map +1 -1
- package/dist/plugins/input-number.js +13 -4
- package/dist/plugins/input-number.js.map +1 -1
- package/dist/plugins/input-password.js +48 -37
- package/dist/plugins/input-password.js.map +1 -1
- package/dist/plugins/input-search-autocomplete.js +9 -11
- package/dist/plugins/input-search-autocomplete.js.map +1 -1
- package/dist/plugins/input.js +12 -3
- package/dist/plugins/input.js.map +1 -1
- package/dist/plugins/list.js +23 -12
- package/dist/plugins/list.js.map +1 -1
- package/dist/plugins/masonry.js +29 -29
- package/dist/plugins/masonry.js.map +1 -1
- package/dist/plugins/modal.js +358 -2
- package/dist/plugins/modal.js.map +1 -1
- package/dist/plugins/navbar-collapsible.js +55 -45
- package/dist/plugins/navbar-collapsible.js.map +1 -1
- package/dist/plugins/navscroll.js +16 -23
- package/dist/plugins/navscroll.js.map +1 -1
- package/dist/plugins/notification.js +34 -23
- package/dist/plugins/notification.js.map +1 -1
- package/dist/plugins/offcanvas.js +259 -2
- package/dist/plugins/offcanvas.js.map +1 -1
- package/dist/plugins/popover.js +76 -2
- package/dist/plugins/popover.js.map +1 -1
- package/dist/plugins/progress-donut.js +19 -12
- package/dist/plugins/progress-donut.js.map +1 -1
- package/dist/plugins/scrollspy.js +273 -2
- package/dist/plugins/scrollspy.js.map +1 -1
- package/dist/plugins/select-autocomplete.js +10 -1
- package/dist/plugins/select-autocomplete.js.map +1 -1
- package/dist/plugins/sticky.js +21 -18
- package/dist/plugins/sticky.js.map +1 -1
- package/dist/plugins/tab.js +244 -27
- package/dist/plugins/tab.js.map +1 -1
- package/dist/plugins/toast.js +203 -2
- package/dist/plugins/toast.js.map +1 -1
- package/dist/plugins/tooltip.js +602 -2
- package/dist/plugins/tooltip.js.map +1 -1
- package/dist/plugins/track-focus.js +8 -0
- package/dist/plugins/track-focus.js.map +1 -1
- package/dist/plugins/transfer.js +11 -16
- package/dist/plugins/transfer.js.map +1 -1
- package/dist/plugins/upload-dragdrop.js +13 -4
- package/dist/plugins/upload-dragdrop.js.map +1 -1
- package/dist/plugins/util/backdrop.js +155 -0
- package/dist/plugins/util/backdrop.js.map +1 -0
- package/dist/plugins/util/component-functions.js +38 -0
- package/dist/plugins/util/component-functions.js.map +1 -0
- package/dist/plugins/util/config.js +70 -0
- package/dist/plugins/util/config.js.map +1 -0
- package/dist/plugins/util/cookies.js +8 -0
- package/dist/plugins/util/cookies.js.map +1 -1
- package/dist/plugins/util/device.js +0 -3
- package/dist/plugins/util/device.js.map +1 -1
- package/dist/plugins/util/dom.js +8 -0
- package/dist/plugins/util/dom.js.map +1 -1
- package/dist/plugins/util/focustrap.js +121 -0
- package/dist/plugins/util/focustrap.js.map +1 -0
- package/dist/plugins/util/index.js +280 -0
- package/dist/plugins/util/index.js.map +1 -0
- package/dist/plugins/util/observer.js +8 -0
- package/dist/plugins/util/observer.js.map +1 -1
- package/dist/plugins/util/on-document-scroll.js +20 -9
- package/dist/plugins/util/on-document-scroll.js.map +1 -1
- package/dist/plugins/util/pageScroll.js +8 -0
- package/dist/plugins/util/pageScroll.js.map +1 -1
- package/dist/plugins/util/sanitizer.js +115 -0
- package/dist/plugins/util/sanitizer.js.map +1 -0
- package/dist/plugins/util/scrollbar.js +120 -0
- package/dist/plugins/util/scrollbar.js.map +1 -0
- package/dist/plugins/util/swipe.js +150 -0
- package/dist/plugins/util/swipe.js.map +1 -0
- package/dist/plugins/util/template-factory.js +166 -0
- package/dist/plugins/util/template-factory.js.map +1 -0
- package/dist/plugins/util/tween.js +10 -1
- package/dist/plugins/util/tween.js.map +1 -1
- package/dist/plugins/util/youtube-video.js +12 -21
- package/dist/plugins/util/youtube-video.js.map +1 -1
- package/dist/plugins/videoplayer.js +19 -8
- package/dist/plugins/videoplayer.js.map +1 -1
- package/dist/version.js +10 -3
- package/dist/version.js.map +1 -1
- package/package.json +6 -7
- package/src/js/bootstrap-italia.entry.js +8 -0
- package/src/js/bootstrap-italia.esm.js +9 -1
- package/src/js/icons.js +8 -0
- package/src/js/load-plugin.js +8 -0
- package/src/js/plugins/accept-overlay.js +18 -10
- package/src/js/plugins/accordion.js +16 -22
- package/src/js/plugins/alert.js +66 -2
- package/src/js/plugins/{backToTop.js → back-to-top.js} +12 -4
- package/src/js/plugins/base-component.js +89 -0
- package/src/js/plugins/button.js +57 -2
- package/src/js/plugins/carousel-bi.js +18 -9
- package/src/js/plugins/carousel.js +444 -2
- package/src/js/plugins/collapse.js +272 -2
- package/src/js/plugins/cookiebar.js +37 -60
- package/src/js/plugins/dimmer.js +18 -8
- package/src/js/plugins/dom/data.js +58 -0
- package/src/js/plugins/dom/event-handler.js +301 -0
- package/src/js/plugins/dom/manipulator.js +75 -0
- package/src/js/plugins/dom/selector-engine.js +80 -0
- package/src/js/plugins/dropdown.js +432 -2
- package/src/js/plugins/fonts-loader.js +9 -1
- package/src/js/plugins/form-validate.js +21 -8
- package/src/js/plugins/form.js +11 -3
- package/src/js/plugins/forward.js +18 -16
- package/src/js/plugins/header-sticky.js +10 -2
- package/src/js/plugins/history-back.js +14 -14
- package/src/js/plugins/init.js +8 -0
- package/src/js/plugins/input-label.js +13 -3
- package/src/js/plugins/input-number.js +12 -4
- package/src/js/plugins/input-password.js +46 -36
- package/src/js/plugins/input-search-autocomplete.js +9 -13
- package/src/js/plugins/input.js +11 -3
- package/src/js/plugins/list.js +22 -12
- package/src/js/plugins/masonry.js +26 -27
- package/src/js/plugins/modal.js +357 -2
- package/src/js/plugins/navbar-collapsible.js +55 -53
- package/src/js/plugins/navscroll.js +16 -23
- package/src/js/plugins/notification.js +33 -23
- package/src/js/plugins/offcanvas.js +258 -2
- package/src/js/plugins/popover.js +75 -2
- package/src/js/plugins/progress-donut.js +17 -13
- package/src/js/plugins/scrollspy.js +272 -2
- package/src/js/plugins/select-autocomplete.js +9 -1
- package/src/js/plugins/sticky.js +21 -23
- package/src/js/plugins/tab.js +243 -27
- package/src/js/plugins/toast.js +206 -2
- package/src/js/plugins/tooltip.js +601 -2
- package/src/js/plugins/track-focus.js +8 -0
- package/src/js/plugins/transfer.js +12 -24
- package/src/js/plugins/upload-dragdrop.js +12 -4
- package/src/js/plugins/util/backdrop.js +153 -0
- package/src/js/plugins/util/component-functions.js +36 -0
- package/src/js/plugins/util/config.js +68 -0
- package/src/js/plugins/util/cookies.js +8 -0
- package/src/js/plugins/util/device.js +0 -3
- package/src/js/plugins/util/dom.js +8 -0
- package/src/js/plugins/util/focustrap.js +119 -0
- package/src/js/plugins/util/index.js +317 -0
- package/src/js/plugins/util/observer.js +8 -0
- package/src/js/plugins/util/on-document-scroll.js +19 -9
- package/src/js/plugins/util/pageScroll.js +8 -0
- package/src/js/plugins/util/sanitizer.js +112 -0
- package/src/js/plugins/util/scrollbar.js +118 -0
- package/src/js/plugins/util/swipe.js +148 -0
- package/src/js/plugins/util/template-factory.js +164 -0
- package/src/js/plugins/util/tween.js +9 -1
- package/src/js/plugins/util/youtube-video.js +12 -21
- package/src/js/plugins/videoplayer.js +18 -8
- package/src/js/version.js +10 -3
- package/src/scss/base/_containers.scss +41 -0
- package/src/scss/base/_functions.scss +373 -0
- package/src/scss/base/_helpers.scss +10 -0
- package/src/scss/base/_maps.scss +54 -0
- package/src/scss/base/_mixins.scss +44 -0
- package/src/scss/base/_reboot.scss +590 -0
- package/src/scss/base/_root.scss +73 -0
- package/src/scss/base/_transitions.scss +27 -0
- package/src/scss/base/_utilities.scss +742 -0
- package/src/scss/base/_variables.scss +2123 -0
- package/src/scss/base/_version.scss +3 -0
- package/src/scss/base/helpers/_clearfix.scss +3 -0
- package/src/scss/base/helpers/_color-bg.scss +10 -0
- package/src/scss/base/helpers/_colored-links.scss +16 -0
- package/src/scss/base/helpers/_position.scss +36 -0
- package/src/scss/base/helpers/_ratio.scss +26 -0
- package/src/scss/base/helpers/_stacks.scss +15 -0
- package/src/scss/base/helpers/_stretched-link.scss +15 -0
- package/src/scss/base/helpers/_text-truncation.scss +7 -0
- package/src/scss/base/helpers/_visually-hidden.scss +8 -0
- package/src/scss/base/helpers/_vr.scss +8 -0
- package/src/scss/base/mixins/_alert.scss +15 -0
- package/src/scss/base/mixins/_backdrop.scss +18 -0
- package/src/scss/base/mixins/_banner.scss +11 -0
- package/src/scss/base/mixins/_border-radius.scss +77 -0
- package/src/scss/base/mixins/_box-shadow.scss +18 -0
- package/src/scss/base/mixins/_breakpoints.scss +127 -0
- package/src/scss/base/mixins/_buttons.scss +141 -0
- package/src/scss/base/mixins/_caret.scss +64 -0
- package/src/scss/base/mixins/_clearfix.scss +9 -0
- package/src/scss/base/mixins/_color-scheme.scss +7 -0
- package/src/scss/base/mixins/_container.scss +11 -0
- package/src/scss/base/mixins/_deprecate.scss +10 -0
- package/src/scss/base/mixins/_forms.scss +152 -0
- package/src/scss/base/mixins/_gradients.scss +47 -0
- package/src/scss/base/mixins/_grid.scss +151 -0
- package/src/scss/base/mixins/_image.scss +15 -0
- package/src/scss/base/mixins/_list-group.scss +24 -0
- package/src/scss/base/mixins/_lists.scss +7 -0
- package/src/scss/base/mixins/_pagination.scss +10 -0
- package/src/scss/base/mixins/_reset-text.scss +17 -0
- package/src/scss/base/mixins/_resize.scss +6 -0
- package/src/scss/base/mixins/_table-variants.scss +24 -0
- package/src/scss/base/mixins/_text-truncate.scss +8 -0
- package/src/scss/base/mixins/_transition.scss +26 -0
- package/src/scss/base/mixins/_utilities.scss +96 -0
- package/src/scss/base/mixins/_visually-hidden.scss +29 -0
- package/src/scss/base/utilities/_api.scss +45 -0
- package/src/scss/base/vendor/_rfs.scss +337 -0
- package/src/scss/bootstrap-italia.scss +137 -156
- package/src/scss/{custom → components}/_accept-overlay.scss +2 -1
- package/src/scss/components/_accordion.scss +297 -0
- package/src/scss/components/_badge.scss +60 -0
- package/src/scss/components/_breadcrumb.scss +95 -0
- package/src/scss/components/_button-group.scss +143 -0
- package/src/scss/components/_buttons.scss +467 -0
- package/src/scss/{custom → components}/_card.scss +228 -0
- package/src/scss/{custom → components}/_carousel.scss +225 -3
- package/src/scss/components/_dropdown.scss +480 -0
- package/src/scss/{custom → components}/_grid.scss +33 -0
- package/src/scss/{custom → components}/_gridlist.scss +7 -0
- package/src/scss/{custom → components}/_hero.scss +23 -57
- package/src/scss/components/_images.scss +48 -0
- package/src/scss/{custom → components}/_linklist.scss +0 -1
- package/src/scss/components/_list-group.scss +190 -0
- package/src/scss/components/_modal.scss +475 -0
- package/src/scss/components/_nav.scss +169 -0
- package/src/scss/components/_navbar.scss +274 -0
- package/src/scss/components/_offcanvas.scss +144 -0
- package/src/scss/components/_pagination.scss +108 -0
- package/src/scss/components/_placeholders.scss +51 -0
- package/src/scss/components/_popover.scss +298 -0
- package/src/scss/components/_progress-bars.scss +126 -0
- package/src/scss/{custom → components}/_steppers.scss +2 -2
- package/src/scss/{custom → components}/_tab.scss +3 -7
- package/src/scss/components/_tables.scss +171 -0
- package/src/scss/components/_toasts.scss +73 -0
- package/src/scss/{custom → components}/_toolbar.scss +19 -12
- package/src/scss/components/_tooltip.scss +139 -0
- package/src/scss/{custom → components}/_type.scss +92 -0
- package/src/scss/forms/_accessible-autocomplete.scss +188 -0
- package/src/scss/forms/_floating-labels.scss +75 -0
- package/src/scss/forms/_form-check.scss +163 -0
- package/src/scss/forms/_form-control.scss +201 -0
- package/src/scss/forms/_form-range.scss +95 -0
- package/src/scss/{custom → forms}/_form-select.scss +72 -0
- package/src/scss/forms/_form-text.scss +11 -0
- package/src/scss/{custom → forms}/_forms.scss +8 -12
- package/src/scss/forms/_input-group.scss +129 -0
- package/src/scss/forms/_labels.scss +36 -0
- package/src/scss/forms/_validation.scss +12 -0
- package/src/scss/utilities/icons.scss +5 -5
- package/types/index.d.ts +4 -1
- package/types/plugins/video.ts +33 -0
- package/dist/plugins/backToTop.js.map +0 -1
- package/src/scss/_functions.scss +0 -38
- package/src/scss/_variables.scss +0 -639
- package/src/scss/custom/_accessible-autocomplete.scss +0 -30
- package/src/scss/custom/_accordion.scss +0 -176
- package/src/scss/custom/_badge.scss +0 -29
- package/src/scss/custom/_breadcrumb.scss +0 -51
- package/src/scss/custom/_buttons.scss +0 -235
- package/src/scss/custom/_componente-base.scss +0 -6
- package/src/scss/custom/_dropdown.scss +0 -248
- package/src/scss/custom/_form-datepicker.scss +0 -604
- package/src/scss/custom/_images.scss +0 -10
- package/src/scss/custom/_modal.scss +0 -248
- package/src/scss/custom/_popover.scss +0 -106
- package/src/scss/custom/_progress-bars.scss +0 -70
- package/src/scss/custom/_tables.scss +0 -11
- package/src/scss/custom/_timepicker.scss +0 -252
- package/src/scss/custom/_tooltip.scss +0 -33
- package/src/scss/custom/_version.scss +0 -3
- package/src/scss/custom/mixins/_buttons.scss +0 -67
- package/src/scss/utilities/colors_vars.scss +0 -426
- /package/src/scss/{custom → base}/mixins/_text-emphasis.scss +0 -0
- /package/src/scss/{custom → components}/_affix.scss +0 -0
- /package/src/scss/{custom → components}/_alert.scss +0 -0
- /package/src/scss/{custom → components}/_anchor.scss +0 -0
- /package/src/scss/{custom → components}/_avatar.scss +0 -0
- /package/src/scss/{custom → components}/_back-to-top.scss +0 -0
- /package/src/scss/{custom → components}/_bottomnav.scss +0 -0
- /package/src/scss/{custom → components}/_calendar.scss +0 -0
- /package/src/scss/{custom → components}/_callout.scss +0 -0
- /package/src/scss/{custom → components}/_chips.scss +0 -0
- /package/src/scss/{custom → components}/_code.scss +0 -0
- /package/src/scss/{custom → components}/_cookiebar.scss +0 -0
- /package/src/scss/{custom → components}/_dimmer.scss +0 -0
- /package/src/scss/{custom → components}/_figcaption.scss +0 -0
- /package/src/scss/{custom → components}/_font.scss +0 -0
- /package/src/scss/{custom → components}/_footer.scss +0 -0
- /package/src/scss/{custom → components}/_forward.scss +0 -0
- /package/src/scss/{custom → components}/_header.scss +0 -0
- /package/src/scss/{custom → components}/_headercenter.scss +0 -0
- /package/src/scss/{custom → components}/_headercentertheme.scss +0 -0
- /package/src/scss/{custom → components}/_headernavbar.scss +0 -0
- /package/src/scss/{custom → components}/_headernavbartheme.scss +0 -0
- /package/src/scss/{custom → components}/_headerslim.scss +0 -0
- /package/src/scss/{custom → components}/_headerslimtheme.scss +0 -0
- /package/src/scss/{custom → components}/_imgresponsive.scss +0 -0
- /package/src/scss/{custom → components}/_list.scss +0 -0
- /package/src/scss/{custom → components}/_map.scss +0 -0
- /package/src/scss/{custom → components}/_masonry-loader.scss +0 -0
- /package/src/scss/{custom → components}/_megamenu.scss +0 -0
- /package/src/scss/{custom → components}/_navigation.scss +0 -0
- /package/src/scss/{custom → components}/_navigationtheme.scss +0 -0
- /package/src/scss/{custom → components}/_navscroll.scss +0 -0
- /package/src/scss/{custom → components}/_navscrolltheme.scss +0 -0
- /package/src/scss/{custom → components}/_notifications.scss +0 -0
- /package/src/scss/{custom → components}/_overlay-panel.scss +0 -0
- /package/src/scss/{custom → components}/_page-scroll.scss +0 -0
- /package/src/scss/{custom → components}/_pager.scss +0 -0
- /package/src/scss/{custom → components}/_point-list.scss +0 -0
- /package/src/scss/{custom → components}/_print.scss +0 -0
- /package/src/scss/{custom → components}/_progress-donuts.scss +0 -0
- /package/src/scss/{custom → components}/_progress-spinners.scss +0 -0
- /package/src/scss/{custom → components}/_rating-list.scss +0 -0
- /package/src/scss/{custom → components}/_rating.scss +0 -0
- /package/src/scss/{custom → components}/_sections.scss +0 -0
- /package/src/scss/{custom → components}/_sidebar.scss +0 -0
- /package/src/scss/{custom → components}/_sidebarthemes.scss +0 -0
- /package/src/scss/{custom → components}/_skiplinks.scss +0 -0
- /package/src/scss/{custom → components}/_sticky.scss +0 -0
- /package/src/scss/{custom → components}/_thumbnav.scss +0 -0
- /package/src/scss/{custom → components}/_timeline.scss +0 -0
- /package/src/scss/{custom → components}/_videoplayer.scss +0 -0
- /package/src/scss/{custom → forms}/_autocomplete.scss +0 -0
- /package/src/scss/{custom → forms}/_form-input-file.scss +0 -0
- /package/src/scss/{custom → forms}/_form-input-number.scss +0 -0
- /package/src/scss/{custom → forms}/_form-input-upload.scss +0 -0
- /package/src/scss/{custom → forms}/_form-password.scss +0 -0
- /package/src/scss/{custom → forms}/_form-toggles.scss +0 -0
- /package/src/scss/{custom → forms}/_form-transfer.scss +0 -0
- /package/src/scss/{custom → forms}/_just-validate.scss +0 -0
- /package/types/plugins/{backToTop.d.ts → back-to-top.d.ts} +0 -0
|
@@ -1,5 +1,435 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* This a fork of Bootstrap: Initial license and original file name below
|
|
7
|
+
* Bootstrap (v5.2.3): dropdown.js
|
|
8
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
9
|
+
* --------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
import * as Popper from '@popperjs/core'
|
|
13
|
+
import { getElement, getNextActiveElement, isDisabled, isElement, isRTL, isVisible, noop } from './util/index'
|
|
14
|
+
import EventHandler from './dom/event-handler'
|
|
15
|
+
import Manipulator from './dom/manipulator'
|
|
16
|
+
import SelectorEngine from './dom/selector-engine'
|
|
17
|
+
import BaseComponent from './base-component'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Constants
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const NAME = 'dropdown'
|
|
24
|
+
const DATA_KEY = 'bs.dropdown'
|
|
25
|
+
const EVENT_KEY = `.${DATA_KEY}`
|
|
26
|
+
const DATA_API_KEY = '.data-api'
|
|
27
|
+
|
|
28
|
+
const ESCAPE_KEY = 'Escape'
|
|
29
|
+
const TAB_KEY = 'Tab'
|
|
30
|
+
const ARROW_UP_KEY = 'ArrowUp'
|
|
31
|
+
const ARROW_DOWN_KEY = 'ArrowDown'
|
|
32
|
+
const RIGHT_MOUSE_BUTTON = 2 // MouseEvent.button value for the secondary button, usually the right button
|
|
33
|
+
|
|
34
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`
|
|
35
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
|
|
36
|
+
const EVENT_SHOW = `show${EVENT_KEY}`
|
|
37
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`
|
|
38
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
39
|
+
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`
|
|
40
|
+
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
41
|
+
|
|
42
|
+
const CLASS_NAME_SHOW = 'show'
|
|
43
|
+
const CLASS_NAME_DROPUP = 'dropup'
|
|
44
|
+
const CLASS_NAME_DROPEND = 'dropend'
|
|
45
|
+
const CLASS_NAME_DROPSTART = 'dropstart'
|
|
46
|
+
const CLASS_NAME_DROPUP_CENTER = 'dropup-center'
|
|
47
|
+
const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'
|
|
48
|
+
|
|
49
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'
|
|
50
|
+
const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`
|
|
51
|
+
const SELECTOR_MENU = '.dropdown-menu'
|
|
52
|
+
const SELECTOR_NAVBAR = '.navbar'
|
|
53
|
+
const SELECTOR_NAVBAR_NAV = '.navbar-nav'
|
|
54
|
+
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
|
|
55
|
+
|
|
56
|
+
const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'
|
|
57
|
+
const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'
|
|
58
|
+
const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'
|
|
59
|
+
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'
|
|
60
|
+
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'
|
|
61
|
+
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'
|
|
62
|
+
const PLACEMENT_TOPCENTER = 'top'
|
|
63
|
+
const PLACEMENT_BOTTOMCENTER = 'bottom'
|
|
64
|
+
|
|
65
|
+
const Default = {
|
|
66
|
+
autoClose: true,
|
|
67
|
+
boundary: 'clippingParents',
|
|
68
|
+
display: 'dynamic',
|
|
69
|
+
offset: [0, 2],
|
|
70
|
+
popperConfig: null,
|
|
71
|
+
reference: 'toggle',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const DefaultType = {
|
|
75
|
+
autoClose: '(boolean|string)',
|
|
76
|
+
boundary: '(string|element)',
|
|
77
|
+
display: 'string',
|
|
78
|
+
offset: '(array|string|function)',
|
|
79
|
+
popperConfig: '(null|object|function)',
|
|
80
|
+
reference: '(string|element|object)',
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Class definition
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
class Dropdown extends BaseComponent {
|
|
88
|
+
constructor(element, config) {
|
|
89
|
+
super(element, config)
|
|
90
|
+
|
|
91
|
+
this._popper = null
|
|
92
|
+
this._parent = this._element.parentNode // dropdown wrapper
|
|
93
|
+
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
|
|
94
|
+
this._menu =
|
|
95
|
+
SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
|
|
96
|
+
SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
|
|
97
|
+
SelectorEngine.findOne(SELECTOR_MENU, this._parent)
|
|
98
|
+
this._inNavbar = this._detectNavbar()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Getters
|
|
102
|
+
static get Default() {
|
|
103
|
+
return Default
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static get DefaultType() {
|
|
107
|
+
return DefaultType
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static get NAME() {
|
|
111
|
+
return NAME
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Public
|
|
115
|
+
toggle() {
|
|
116
|
+
return this._isShown() ? this.hide() : this.show()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
show() {
|
|
120
|
+
if (isDisabled(this._element) || this._isShown()) {
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const relatedTarget = {
|
|
125
|
+
relatedTarget: this._element,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)
|
|
129
|
+
|
|
130
|
+
if (showEvent.defaultPrevented) {
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this._createPopper()
|
|
135
|
+
|
|
136
|
+
// If this is a touch-enabled device we add extra
|
|
137
|
+
// empty mouseover listeners to the body's immediate children;
|
|
138
|
+
// only needed because of broken event delegation on iOS
|
|
139
|
+
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
|
140
|
+
if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
|
|
141
|
+
for (const element of [].concat(...document.body.children)) {
|
|
142
|
+
EventHandler.on(element, 'mouseover', noop)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this._element.focus()
|
|
147
|
+
this._element.setAttribute('aria-expanded', true)
|
|
148
|
+
|
|
149
|
+
this._menu.classList.add(CLASS_NAME_SHOW)
|
|
150
|
+
this._element.classList.add(CLASS_NAME_SHOW)
|
|
151
|
+
EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
hide() {
|
|
155
|
+
if (isDisabled(this._element) || !this._isShown()) {
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const relatedTarget = {
|
|
160
|
+
relatedTarget: this._element,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
this._completeHide(relatedTarget)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
dispose() {
|
|
167
|
+
if (this._popper) {
|
|
168
|
+
this._popper.destroy()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
super.dispose()
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
update() {
|
|
175
|
+
this._inNavbar = this._detectNavbar()
|
|
176
|
+
if (this._popper) {
|
|
177
|
+
this._popper.update()
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Private
|
|
182
|
+
_completeHide(relatedTarget) {
|
|
183
|
+
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)
|
|
184
|
+
if (hideEvent.defaultPrevented) {
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// If this is a touch-enabled device we remove the extra
|
|
189
|
+
// empty mouseover listeners we added for iOS support
|
|
190
|
+
if ('ontouchstart' in document.documentElement) {
|
|
191
|
+
for (const element of [].concat(...document.body.children)) {
|
|
192
|
+
EventHandler.off(element, 'mouseover', noop)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (this._popper) {
|
|
197
|
+
this._popper.destroy()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
this._menu.classList.remove(CLASS_NAME_SHOW)
|
|
201
|
+
this._element.classList.remove(CLASS_NAME_SHOW)
|
|
202
|
+
this._element.setAttribute('aria-expanded', 'false')
|
|
203
|
+
Manipulator.removeDataAttribute(this._menu, 'popper')
|
|
204
|
+
EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_getConfig(config) {
|
|
208
|
+
config = super._getConfig(config)
|
|
209
|
+
|
|
210
|
+
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
|
|
211
|
+
// Popper virtual elements require a getBoundingClientRect method
|
|
212
|
+
throw new TypeError(`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return config
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
_createPopper() {
|
|
219
|
+
if (typeof Popper === 'undefined') {
|
|
220
|
+
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)")
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
let referenceElement = this._element
|
|
224
|
+
|
|
225
|
+
if (this._config.reference === 'parent') {
|
|
226
|
+
referenceElement = this._parent
|
|
227
|
+
} else if (isElement(this._config.reference)) {
|
|
228
|
+
referenceElement = getElement(this._config.reference)
|
|
229
|
+
} else if (typeof this._config.reference === 'object') {
|
|
230
|
+
referenceElement = this._config.reference
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const popperConfig = this._getPopperConfig()
|
|
234
|
+
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
_isShown() {
|
|
238
|
+
return this._menu.classList.contains(CLASS_NAME_SHOW)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
_getPlacement() {
|
|
242
|
+
const parentDropdown = this._parent
|
|
243
|
+
|
|
244
|
+
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
|
245
|
+
return PLACEMENT_RIGHT
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
|
|
249
|
+
return PLACEMENT_LEFT
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
|
|
253
|
+
return PLACEMENT_TOPCENTER
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
|
|
257
|
+
return PLACEMENT_BOTTOMCENTER
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// We need to trim the value because custom properties can also include spaces
|
|
261
|
+
const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'
|
|
262
|
+
|
|
263
|
+
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
|
264
|
+
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
_detectNavbar() {
|
|
271
|
+
return this._element.closest(SELECTOR_NAVBAR) !== null
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
_getOffset() {
|
|
275
|
+
const { offset } = this._config
|
|
276
|
+
|
|
277
|
+
if (typeof offset === 'string') {
|
|
278
|
+
return offset.split(',').map((value) => Number.parseInt(value, 10))
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (typeof offset === 'function') {
|
|
282
|
+
return (popperData) => offset(popperData, this._element)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return offset
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
_getPopperConfig() {
|
|
289
|
+
const defaultBsPopperConfig = {
|
|
290
|
+
placement: this._getPlacement(),
|
|
291
|
+
modifiers: [
|
|
292
|
+
{
|
|
293
|
+
name: 'preventOverflow',
|
|
294
|
+
options: {
|
|
295
|
+
boundary: this._config.boundary,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'offset',
|
|
300
|
+
options: {
|
|
301
|
+
offset: this._getOffset(),
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Disable Popper if we have a static display or Dropdown is in Navbar
|
|
308
|
+
if (this._inNavbar || this._config.display === 'static') {
|
|
309
|
+
Manipulator.setDataAttribute(this._menu, 'popper', 'static') // todo:v6 remove
|
|
310
|
+
defaultBsPopperConfig.modifiers = [
|
|
311
|
+
{
|
|
312
|
+
name: 'applyStyles',
|
|
313
|
+
enabled: false,
|
|
314
|
+
},
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
...defaultBsPopperConfig,
|
|
320
|
+
...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig),
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
_selectMenuItem({ key, target }) {
|
|
325
|
+
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element))
|
|
326
|
+
|
|
327
|
+
if (!items.length) {
|
|
328
|
+
return
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// if target isn't included in items (e.g. when expanding the dropdown)
|
|
332
|
+
// allow cycling to get the last item in case key equals ARROW_UP_KEY
|
|
333
|
+
getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
static clearMenus(event) {
|
|
337
|
+
if (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY)) {
|
|
338
|
+
return
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)
|
|
342
|
+
|
|
343
|
+
for (const toggle of openToggles) {
|
|
344
|
+
const context = Dropdown.getInstance(toggle)
|
|
345
|
+
if (!context || context._config.autoClose === false) {
|
|
346
|
+
continue
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const composedPath = event.composedPath()
|
|
350
|
+
const isMenuTarget = composedPath.includes(context._menu)
|
|
351
|
+
if (
|
|
352
|
+
composedPath.includes(context._element) ||
|
|
353
|
+
(context._config.autoClose === 'inside' && !isMenuTarget) ||
|
|
354
|
+
(context._config.autoClose === 'outside' && isMenuTarget)
|
|
355
|
+
) {
|
|
356
|
+
continue
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
|
|
360
|
+
if (
|
|
361
|
+
context._menu.contains(event.target) &&
|
|
362
|
+
((event.type === 'keyup' && event.key === TAB_KEY) || /input|select|option|textarea|form/i.test(event.target.tagName))
|
|
363
|
+
) {
|
|
364
|
+
continue
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const relatedTarget = { relatedTarget: context._element }
|
|
368
|
+
|
|
369
|
+
if (event.type === 'click') {
|
|
370
|
+
relatedTarget.clickEvent = event
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
context._completeHide(relatedTarget)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
static dataApiKeydownHandler(event) {
|
|
378
|
+
// If not an UP | DOWN | ESCAPE key => not a dropdown command
|
|
379
|
+
// If input/textarea && if key is other than ESCAPE => not a dropdown command
|
|
380
|
+
|
|
381
|
+
const isInput = /input|textarea/i.test(event.target.tagName)
|
|
382
|
+
const isEscapeEvent = event.key === ESCAPE_KEY
|
|
383
|
+
const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)
|
|
384
|
+
|
|
385
|
+
if (!isUpOrDownEvent && !isEscapeEvent) {
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (isInput && !isEscapeEvent) {
|
|
390
|
+
return
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
event.preventDefault()
|
|
394
|
+
|
|
395
|
+
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
|
|
396
|
+
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE)
|
|
397
|
+
? this
|
|
398
|
+
: SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||
|
|
399
|
+
SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] ||
|
|
400
|
+
SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode)
|
|
401
|
+
|
|
402
|
+
const instance = Dropdown.getOrCreateInstance(getToggleButton)
|
|
403
|
+
|
|
404
|
+
if (isUpOrDownEvent) {
|
|
405
|
+
event.stopPropagation()
|
|
406
|
+
instance.show()
|
|
407
|
+
instance._selectMenuItem(event)
|
|
408
|
+
return
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (instance._isShown()) {
|
|
412
|
+
// else is escape and we check if it is shown
|
|
413
|
+
event.stopPropagation()
|
|
414
|
+
instance.hide()
|
|
415
|
+
getToggleButton.focus()
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Data API implementation
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
425
|
+
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler)
|
|
426
|
+
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler)
|
|
427
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)
|
|
428
|
+
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)
|
|
429
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
|
430
|
+
event.preventDefault()
|
|
431
|
+
Dropdown.getOrCreateInstance(this).toggle()
|
|
432
|
+
})
|
|
433
|
+
}
|
|
4
434
|
|
|
5
435
|
export default Dropdown
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
// Create our stylesheet
|
|
2
10
|
export default (path = '/node_modules/bootstrap-italia/dist/fonts') => {
|
|
3
|
-
if (typeof document === 'undefined') {
|
|
11
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
4
12
|
return
|
|
5
13
|
}
|
|
6
14
|
const styleNode = document.createElement('style')
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import JustValidate from 'just-validate'
|
|
2
10
|
import { CssClassObserver, ContentObserver } from './util/observer'
|
|
3
11
|
|
|
@@ -15,6 +23,9 @@ const SELECTOR_SPAN_SRONLY = `.${CLASS_NAME_SRONLY}`
|
|
|
15
23
|
class FormValidate {
|
|
16
24
|
constructor(selector, config, dictLocale) {
|
|
17
25
|
this.formSelector = selector
|
|
26
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
18
29
|
this.target = document.querySelector(selector)
|
|
19
30
|
|
|
20
31
|
if (dictLocale != undefined) this.validate = new JustValidate(selector, config, dictLocale)
|
|
@@ -165,14 +176,16 @@ const ValidatorSelectAutocomplete = (inputId, config = {}) => {
|
|
|
165
176
|
if (!config.required && !value) {
|
|
166
177
|
result = true
|
|
167
178
|
} else {
|
|
168
|
-
document
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
180
|
+
document
|
|
181
|
+
.querySelector('#' + field.elem.id + '-select')
|
|
182
|
+
.querySelectorAll('option')
|
|
183
|
+
.forEach((option) => {
|
|
184
|
+
if (option.text === value) {
|
|
185
|
+
result = true
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
}
|
|
176
189
|
}
|
|
177
190
|
} else {
|
|
178
191
|
throw new Error('ValidatorSelectAutocomplete: ' + inputId + ' not found as form field')
|
package/src/js/plugins/form.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import BaseComponent from './base-component.js'
|
|
2
10
|
|
|
3
|
-
import EventHandler from '
|
|
4
|
-
import SelectorEngine from '
|
|
11
|
+
import EventHandler from './dom/event-handler'
|
|
12
|
+
import SelectorEngine from './dom/selector-engine'
|
|
5
13
|
|
|
6
14
|
const NAME = 'form'
|
|
7
15
|
const DATA_KEY = 'bs.form'
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import BaseComponent from './base-component.js'
|
|
2
10
|
|
|
3
|
-
import EventHandler from '
|
|
4
|
-
//import SelectorEngine from '
|
|
5
|
-
import Manipulator from '
|
|
6
|
-
import { getElementFromSelector } from '
|
|
11
|
+
import EventHandler from './dom/event-handler'
|
|
12
|
+
//import SelectorEngine from './dom/selector-engine'
|
|
13
|
+
import Manipulator from './dom/manipulator'
|
|
14
|
+
import { getElementFromSelector } from './util/index'
|
|
7
15
|
|
|
8
16
|
import { documentScrollTo } from './util/tween'
|
|
9
17
|
|
|
@@ -71,19 +79,13 @@ class Forward extends BaseComponent {
|
|
|
71
79
|
* Data Api implementation
|
|
72
80
|
* ------------------------------------------------------------------------
|
|
73
81
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
EventHandler.
|
|
82
|
+
|
|
83
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
84
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_TOGGLE, function (evt) {
|
|
77
85
|
evt.preventDefault()
|
|
78
|
-
const forward = Forward.getOrCreateInstance(
|
|
86
|
+
const forward = Forward.getOrCreateInstance(this)
|
|
79
87
|
forward.goToTarget()
|
|
80
88
|
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_TOGGLE, function (evt) {
|
|
84
|
-
evt.preventDefault()
|
|
85
|
-
const forward = Forward.getOrCreateInstance(this)
|
|
86
|
-
forward.goToTarget()
|
|
87
|
-
})
|
|
89
|
+
}
|
|
88
90
|
|
|
89
91
|
export default Forward
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import SelectorEngine from './dom/selector-engine'
|
|
10
|
+
import { isVisible } from './util/index'
|
|
3
11
|
|
|
4
12
|
import Sticky from './sticky'
|
|
5
13
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import BaseComponent from './base-component.js'
|
|
2
10
|
|
|
3
|
-
import EventHandler from '
|
|
4
|
-
//import SelectorEngine from 'bootstrap/js/src/dom/selector-engine'
|
|
11
|
+
import EventHandler from './dom/event-handler'
|
|
5
12
|
|
|
6
13
|
const NAME = 'historyback'
|
|
7
14
|
const DATA_KEY = 'bs.historyback'
|
|
@@ -48,19 +55,12 @@ class HistoryBack extends BaseComponent {
|
|
|
48
55
|
* ------------------------------------------------------------------------
|
|
49
56
|
*/
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
EventHandler.one(toggle, EVENT_CLICK_DATA_API, (evt) => {
|
|
58
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
59
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_TOGGLE, function (evt) {
|
|
54
60
|
evt.preventDefault()
|
|
55
|
-
const historyBack = HistoryBack.getOrCreateInstance(
|
|
61
|
+
const historyBack = HistoryBack.getOrCreateInstance(this)
|
|
56
62
|
historyBack.back()
|
|
57
63
|
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_TOGGLE, function (evt) {
|
|
61
|
-
evt.preventDefault()
|
|
62
|
-
const historyBack = HistoryBack.getOrCreateInstance(this)
|
|
63
|
-
historyBack.back()
|
|
64
|
-
})
|
|
64
|
+
}
|
|
65
65
|
|
|
66
66
|
export default HistoryBack
|
package/src/js/plugins/init.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import TrackFocus from './track-focus'
|
|
2
10
|
|
|
3
11
|
import BOOTSTRAP_ITALIA_VERSION from '../version'
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
|
+
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
|
+
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
+
* --------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import EventHandler from './dom/event-handler'
|
|
10
|
+
import SelectorEngine from './dom/selector-engine'
|
|
3
11
|
|
|
4
12
|
const NAME = 'inputlabel'
|
|
5
13
|
const DATA_KEY = 'bs.inputlabel'
|
|
@@ -26,7 +34,9 @@ class InputLabel {
|
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
static getInputFromLabel = (labelElement) => {
|
|
29
|
-
|
|
37
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
38
|
+
return document.querySelector('#' + CSS.escape(labelElement.getAttribute('for')))
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
|
|
32
42
|
// Public
|