@openeuropa/bcl-bootstrap 0.28.1 → 1.0.2
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/bootstrap-icons.svg +1 -1
- package/icons/0-circle-fill.svg +4 -0
- package/icons/0-circle.svg +4 -0
- package/icons/0-square-fill.svg +4 -0
- package/icons/0-square.svg +4 -0
- package/icons/1-circle-fill.svg +1 -1
- package/icons/amd.svg +3 -0
- package/icons/arrow-bar-left.svg +1 -1
- package/icons/arrow-bar-right.svg +1 -1
- package/icons/arrows-collapse.svg +1 -1
- package/icons/arrows-expand.svg +1 -1
- package/icons/building-add.svg +5 -0
- package/icons/building-check.svg +5 -0
- package/icons/building-dash.svg +5 -0
- package/icons/building-down.svg +5 -0
- package/icons/building-exclamation.svg +4 -0
- package/icons/building-fill-add.svg +4 -0
- package/icons/building-fill-check.svg +4 -0
- package/icons/building-fill-dash.svg +4 -0
- package/icons/building-fill-down.svg +4 -0
- package/icons/building-fill-exclamation.svg +4 -0
- package/icons/building-fill-gear.svg +4 -0
- package/icons/building-fill-lock.svg +4 -0
- package/icons/building-fill-slash.svg +4 -0
- package/icons/building-fill-up.svg +4 -0
- package/icons/building-fill-x.svg +4 -0
- package/icons/building-fill.svg +3 -0
- package/icons/building-gear.svg +4 -0
- package/icons/building-lock.svg +4 -0
- package/icons/building-slash.svg +5 -0
- package/icons/building-up.svg +5 -0
- package/icons/building-x.svg +4 -0
- package/icons/building.svg +2 -2
- package/icons/buildings-fill.svg +3 -0
- package/icons/buildings.svg +4 -0
- package/icons/bus-front-fill.svg +3 -0
- package/icons/bus-front.svg +4 -0
- package/icons/capsule-pill.svg +1 -1
- package/icons/capsule.svg +1 -1
- package/icons/car-front-fill.svg +1 -1
- package/icons/car-front.svg +1 -1
- package/icons/database-add.svg +4 -0
- package/icons/database-check.svg +4 -0
- package/icons/database-dash.svg +4 -0
- package/icons/database-down.svg +4 -0
- package/icons/database-exclamation.svg +4 -0
- package/icons/database-fill-add.svg +4 -0
- package/icons/database-fill-check.svg +4 -0
- package/icons/database-fill-dash.svg +4 -0
- package/icons/database-fill-down.svg +4 -0
- package/icons/database-fill-exclamation.svg +5 -0
- package/icons/database-fill-gear.svg +4 -0
- package/icons/database-fill-lock.svg +5 -0
- package/icons/database-fill-slash.svg +4 -0
- package/icons/database-fill-up.svg +4 -0
- package/icons/database-fill-x.svg +5 -0
- package/icons/database-fill.svg +6 -0
- package/icons/database-gear.svg +4 -0
- package/icons/database-lock.svg +4 -0
- package/icons/database-slash.svg +4 -0
- package/icons/database-up.svg +4 -0
- package/icons/database-x.svg +4 -0
- package/icons/database.svg +3 -0
- package/icons/envelope-at-fill.svg +4 -0
- package/icons/envelope-at.svg +4 -0
- package/icons/ev-front-fill.svg +3 -0
- package/icons/ev-front.svg +4 -0
- package/icons/globe-americas.svg +3 -0
- package/icons/globe-asia-australia.svg +4 -0
- package/icons/globe-central-south-asia.svg +3 -0
- package/icons/globe-europe-africa.svg +3 -0
- package/icons/heart-pulse-fill.svg +2 -1
- package/icons/heart-pulse.svg +2 -1
- package/icons/heartbreak-fill.svg +1 -1
- package/icons/heartbreak.svg +1 -1
- package/icons/house-add-fill.svg +5 -0
- package/icons/house-add.svg +4 -0
- package/icons/house-check-fill.svg +5 -0
- package/icons/house-check.svg +4 -0
- package/icons/house-dash-fill.svg +5 -0
- package/icons/house-dash.svg +4 -0
- package/icons/house-door-fill.svg +1 -1
- package/icons/house-door.svg +1 -1
- package/icons/house-down-fill.svg +5 -0
- package/icons/house-down.svg +4 -0
- package/icons/house-exclamation-fill.svg +5 -0
- package/icons/house-exclamation.svg +4 -0
- package/icons/house-fill.svg +2 -2
- package/icons/house-gear-fill.svg +5 -0
- package/icons/house-gear.svg +4 -0
- package/icons/house-lock-fill.svg +5 -0
- package/icons/house-lock.svg +4 -0
- package/icons/house-slash-fill.svg +5 -0
- package/icons/house-slash.svg +4 -0
- package/icons/house-up-fill.svg +5 -0
- package/icons/house-up.svg +4 -0
- package/icons/house-x-fill.svg +5 -0
- package/icons/house-x.svg +4 -0
- package/icons/house.svg +1 -2
- package/icons/houses-fill.svg +4 -0
- package/icons/houses.svg +3 -0
- package/icons/lungs-fill.svg +1 -1
- package/icons/nvidia.svg +3 -0
- package/icons/people-fill.svg +1 -3
- package/icons/people.svg +1 -1
- package/icons/person-add.svg +4 -0
- package/icons/person-check.svg +2 -2
- package/icons/person-dash.svg +2 -2
- package/icons/person-down.svg +4 -0
- package/icons/person-exclamation.svg +4 -0
- package/icons/person-fill-add.svg +4 -0
- package/icons/person-fill-check.svg +4 -0
- package/icons/person-fill-dash.svg +4 -0
- package/icons/person-fill-down.svg +4 -0
- package/icons/person-fill-exclamation.svg +4 -0
- package/icons/person-fill-gear.svg +3 -0
- package/icons/person-fill-lock.svg +3 -0
- package/icons/person-fill-slash.svg +3 -0
- package/icons/person-fill-up.svg +4 -0
- package/icons/person-fill-x.svg +4 -0
- package/icons/person-fill.svg +1 -1
- package/icons/person-gear.svg +3 -0
- package/icons/person-lock.svg +3 -0
- package/icons/person-slash.svg +3 -0
- package/icons/person-up.svg +4 -0
- package/icons/person-vcard-fill.svg +3 -0
- package/icons/person-vcard.svg +4 -0
- package/icons/person-x.svg +2 -2
- package/icons/person.svg +1 -1
- package/icons/prescription.svg +2 -2
- package/icons/prescription2.svg +1 -1
- package/icons/regex.svg +3 -0
- package/icons/rocket-fill.svg +4 -0
- package/icons/rocket-takeoff-fill.svg +4 -0
- package/icons/rocket-takeoff.svg +5 -0
- package/icons/rocket.svg +5 -0
- package/icons/scooter.svg +3 -0
- package/icons/sign-dead-end-fill.svg +4 -0
- package/icons/sign-dead-end.svg +4 -0
- package/icons/sign-do-not-enter-fill.svg +4 -0
- package/icons/sign-do-not-enter.svg +4 -0
- package/icons/sign-intersection-fill.svg +3 -0
- package/icons/sign-intersection-side-fill.svg +3 -0
- package/icons/sign-intersection-side.svg +4 -0
- package/icons/sign-intersection-t-fill.svg +3 -0
- package/icons/sign-intersection-t.svg +4 -0
- package/icons/sign-intersection-y-fill.svg +3 -0
- package/icons/sign-intersection-y.svg +4 -0
- package/icons/sign-intersection.svg +4 -0
- package/icons/sign-merge-left-fill.svg +3 -0
- package/icons/sign-merge-left.svg +4 -0
- package/icons/sign-merge-right-fill.svg +3 -0
- package/icons/sign-merge-right.svg +4 -0
- package/icons/sign-no-left-turn-fill.svg +4 -0
- package/icons/sign-no-left-turn.svg +3 -0
- package/icons/sign-no-parking-fill.svg +4 -0
- package/icons/sign-no-parking.svg +3 -0
- package/icons/sign-no-right-turn-fill.svg +4 -0
- package/icons/sign-no-right-turn.svg +3 -0
- package/icons/sign-railroad-fill.svg +5 -0
- package/icons/sign-railroad.svg +4 -0
- package/icons/sign-stop-fill.svg +1 -1
- package/icons/sign-stop-lights-fill.svg +1 -1
- package/icons/sign-turn-left-fill.svg +1 -1
- package/icons/sign-turn-right-fill.svg +1 -1
- package/icons/sign-turn-slight-left-fill.svg +1 -1
- package/icons/sign-turn-slight-right-fill.svg +1 -1
- package/icons/sign-yield-fill.svg +1 -1
- package/icons/sina-weibo.svg +4 -0
- package/icons/stripe.svg +3 -0
- package/icons/subscript.svg +3 -0
- package/icons/superscript.svg +3 -0
- package/icons/taxi-front-fill.svg +3 -0
- package/icons/taxi-front.svg +4 -0
- package/icons/tencent-qq.svg +4 -0
- package/icons/text-wrap.svg +3 -0
- package/icons/train-freight-front-fill.svg +1 -1
- package/icons/train-freight-front.svg +1 -1
- package/icons/train-front-fill.svg +1 -1
- package/icons/train-front.svg +1 -1
- package/icons/train-lightrail-front-fill.svg +1 -1
- package/icons/train-lightrail-front.svg +1 -1
- package/icons/trello.svg +3 -0
- package/icons/truck-front-fill.svg +1 -1
- package/icons/truck-front.svg +2 -3
- package/icons/virus.svg +1 -1
- package/icons/virus2.svg +1 -1
- package/icons/wikipedia.svg +3 -0
- package/js/dist/alert.js +14 -25
- package/js/dist/alert.js.map +1 -1
- package/js/dist/base-component.js +13 -30
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +11 -15
- package/js/dist/button.js.map +1 -1
- package/js/dist/carousel.js +36 -120
- package/js/dist/carousel.js.map +1 -1
- package/js/dist/collapse.js +27 -88
- package/js/dist/collapse.js.map +1 -1
- package/js/dist/dependency/manipulator.js +72 -0
- package/js/dist/dependency/manipulator.js.map +1 -0
- package/js/dist/dom/data.js +6 -10
- package/js/dist/dom/data.js.map +1 -1
- package/js/dist/dom/event-handler.js +7 -52
- package/js/dist/dom/event-handler.js.map +1 -1
- package/js/dist/dom/manipulator.js +2 -15
- package/js/dist/dom/manipulator.js.map +1 -1
- package/js/dist/dom/selector-engine.js +2 -16
- package/js/dist/dom/selector-engine.js.map +1 -1
- package/js/dist/dropdown.js +52 -124
- package/js/dist/dropdown.js.map +1 -1
- package/js/dist/modal.js +40 -119
- package/js/dist/modal.js.map +1 -1
- package/js/dist/offcanvas.js +36 -89
- package/js/dist/offcanvas.js.map +1 -1
- package/js/dist/popover.js +15 -22
- package/js/dist/popover.js.map +1 -1
- package/js/dist/scrollspy-legacy.js +216 -0
- package/js/dist/scrollspy-legacy.js.map +1 -0
- package/js/dist/scrollspy.js +42 -80
- package/js/dist/scrollspy.js.map +1 -1
- package/js/dist/tab.js +40 -98
- package/js/dist/tab.js.map +1 -1
- package/js/dist/toast.js +30 -69
- package/js/dist/toast.js.map +1 -1
- package/js/dist/tooltip.js +74 -196
- package/js/dist/tooltip.js.map +1 -1
- package/js/dist/util/backdrop.js +13 -40
- package/js/dist/util/backdrop.js.map +1 -1
- package/js/dist/util/component-functions.js +5 -11
- package/js/dist/util/component-functions.js.map +1 -1
- package/js/dist/util/config.js +6 -18
- package/js/dist/util/config.js.map +1 -1
- package/js/dist/util/focustrap.js +16 -33
- package/js/dist/util/focustrap.js.map +1 -1
- package/js/dist/util/index.js +28 -75
- package/js/dist/util/index.js.map +1 -1
- package/js/dist/util/sanitizer.js +7 -17
- package/js/dist/util/sanitizer.js.map +1 -1
- package/js/dist/util/scrollbar.js +16 -43
- package/js/dist/util/scrollbar.js.map +1 -1
- package/js/dist/util/swipe.js +18 -40
- package/js/dist/util/swipe.js.map +1 -1
- package/js/dist/util/template-factory.js +13 -41
- package/js/dist/util/template-factory.js.map +1 -1
- package/js/src/alert.js +1 -1
- package/js/src/base-component.js +2 -2
- package/js/src/button.js +1 -1
- package/js/src/carousel.js +1 -1
- package/js/src/collapse.js +1 -1
- package/js/src/dependency/manipulator.js +80 -0
- package/js/src/dom/data.js +1 -1
- package/js/src/dom/event-handler.js +1 -1
- package/js/src/dom/manipulator.js +1 -1
- package/js/src/dom/selector-engine.js +1 -1
- package/js/src/dropdown.js +10 -3
- package/js/src/modal.js +3 -3
- package/js/src/offcanvas.js +1 -1
- package/js/src/popover.js +1 -1
- package/js/src/scrollspy-legacy.js +294 -0
- package/js/src/scrollspy.js +1 -1
- package/js/src/tab.js +2 -4
- package/js/src/toast.js +9 -4
- package/js/src/tooltip.js +27 -48
- package/js/src/util/backdrop.js +1 -1
- package/js/src/util/component-functions.js +1 -1
- package/js/src/util/config.js +1 -1
- package/js/src/util/focustrap.js +1 -1
- package/js/src/util/index.js +1 -1
- package/js/src/util/sanitizer.js +1 -1
- package/js/src/util/scrollbar.js +1 -1
- package/js/src/util/swipe.js +1 -1
- package/js/src/util/template-factory.js +1 -1
- package/legacy/dependency/manipulator.js +80 -0
- package/legacy/scrollspy-legacy.js +294 -0
- package/package.json +6 -6
- package/scss/_buttons.scss +8 -2
- package/scss/_carousel.scss +0 -3
- package/scss/_functions.scss +1 -1
- package/scss/_toasts.scss +2 -0
- package/scss/_variables.scss +1 -1
- package/scss/bootstrap-utilities.scss +3 -0
- package/scss/mixins/_banner.scss +1 -1
- package/scss/mixins/_table-variants.scss +2 -2
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap (v5.1.3): scrollspy.js
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Old versions
|
|
9
|
+
import Manipulator from './dependency/manipulator'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
defineJQueryPlugin,
|
|
13
|
+
getElement,
|
|
14
|
+
getSelectorFromElement,
|
|
15
|
+
} from './util/index'
|
|
16
|
+
import EventHandler from './dom/event-handler'
|
|
17
|
+
import SelectorEngine from './dom/selector-engine'
|
|
18
|
+
import BaseComponent from './base-component'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* ------------------------------------------------------------------------
|
|
22
|
+
* Constants
|
|
23
|
+
* ------------------------------------------------------------------------
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const NAME = 'scrollspy'
|
|
27
|
+
const DATA_KEY = 'bs.scrollspy'
|
|
28
|
+
const EVENT_KEY = `.${DATA_KEY}`
|
|
29
|
+
const DATA_API_KEY = '.data-api'
|
|
30
|
+
|
|
31
|
+
const Default = {
|
|
32
|
+
offset: 10,
|
|
33
|
+
method: 'auto',
|
|
34
|
+
target: ''
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const DefaultType = {
|
|
38
|
+
offset: 'number',
|
|
39
|
+
method: 'string',
|
|
40
|
+
target: '(string|element)'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const EVENT_ACTIVATE = `activate${EVENT_KEY}`
|
|
44
|
+
const EVENT_SCROLL = `scroll${EVENT_KEY}`
|
|
45
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
|
|
46
|
+
|
|
47
|
+
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'
|
|
48
|
+
const CLASS_NAME_ACTIVE = 'active'
|
|
49
|
+
|
|
50
|
+
const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'
|
|
51
|
+
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'
|
|
52
|
+
const SELECTOR_NAV_LINKS = '.nav-link'
|
|
53
|
+
const SELECTOR_NAV_ITEMS = '.nav-item'
|
|
54
|
+
const SELECTOR_LIST_ITEMS = '.list-group-item'
|
|
55
|
+
const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`
|
|
56
|
+
const SELECTOR_DROPDOWN = '.dropdown'
|
|
57
|
+
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
|
|
58
|
+
|
|
59
|
+
const METHOD_OFFSET = 'offset'
|
|
60
|
+
const METHOD_POSITION = 'position'
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* ------------------------------------------------------------------------
|
|
64
|
+
* Class Definition
|
|
65
|
+
* ------------------------------------------------------------------------
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
class ScrollSpy extends BaseComponent {
|
|
69
|
+
constructor(element, config) {
|
|
70
|
+
super(element)
|
|
71
|
+
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element
|
|
72
|
+
this._config = this._getConfig(config)
|
|
73
|
+
this._offsets = []
|
|
74
|
+
this._targets = []
|
|
75
|
+
this._activeTarget = null
|
|
76
|
+
this._scrollHeight = 0
|
|
77
|
+
|
|
78
|
+
EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process())
|
|
79
|
+
|
|
80
|
+
this.refresh()
|
|
81
|
+
this._process()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Getters
|
|
85
|
+
|
|
86
|
+
static get Default() {
|
|
87
|
+
return Default
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static get NAME() {
|
|
91
|
+
return NAME
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Public
|
|
95
|
+
|
|
96
|
+
refresh() {
|
|
97
|
+
const autoMethod = this._scrollElement === this._scrollElement.window ?
|
|
98
|
+
METHOD_OFFSET :
|
|
99
|
+
METHOD_POSITION
|
|
100
|
+
|
|
101
|
+
const offsetMethod = this._config.method === 'auto' ?
|
|
102
|
+
autoMethod :
|
|
103
|
+
this._config.method
|
|
104
|
+
|
|
105
|
+
const offsetBase = offsetMethod === METHOD_POSITION ?
|
|
106
|
+
this._getScrollTop() :
|
|
107
|
+
0
|
|
108
|
+
|
|
109
|
+
this._offsets = []
|
|
110
|
+
this._targets = []
|
|
111
|
+
this._scrollHeight = this._getScrollHeight()
|
|
112
|
+
|
|
113
|
+
const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
|
|
114
|
+
|
|
115
|
+
targets.map(element => {
|
|
116
|
+
const targetSelector = getSelectorFromElement(element)
|
|
117
|
+
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null
|
|
118
|
+
|
|
119
|
+
if (target) {
|
|
120
|
+
const targetBCR = target.getBoundingClientRect()
|
|
121
|
+
if (targetBCR.width || targetBCR.height) {
|
|
122
|
+
return [
|
|
123
|
+
Manipulator[offsetMethod](target).top + offsetBase,
|
|
124
|
+
targetSelector
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return null
|
|
130
|
+
})
|
|
131
|
+
.filter(item => item)
|
|
132
|
+
.sort((a, b) => a[0] - b[0])
|
|
133
|
+
.forEach(item => {
|
|
134
|
+
this._offsets.push(item[0])
|
|
135
|
+
this._targets.push(item[1])
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
dispose() {
|
|
140
|
+
EventHandler.off(this._scrollElement, EVENT_KEY)
|
|
141
|
+
super.dispose()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Private
|
|
145
|
+
|
|
146
|
+
_getConfig(config) {
|
|
147
|
+
config = {
|
|
148
|
+
...Default,
|
|
149
|
+
...Manipulator.getDataAttributes(this._element),
|
|
150
|
+
...(typeof config === 'object' && config ? config : {})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
config.target = getElement(config.target) || document.documentElement
|
|
154
|
+
|
|
155
|
+
return config
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
_getScrollTop() {
|
|
159
|
+
return this._scrollElement === window ?
|
|
160
|
+
this._scrollElement.pageYOffset :
|
|
161
|
+
this._scrollElement.scrollTop
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
_getScrollHeight() {
|
|
165
|
+
return this._scrollElement.scrollHeight || Math.max(
|
|
166
|
+
document.body.scrollHeight,
|
|
167
|
+
document.documentElement.scrollHeight
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_getOffsetHeight() {
|
|
172
|
+
return this._scrollElement === window ?
|
|
173
|
+
window.innerHeight :
|
|
174
|
+
this._scrollElement.getBoundingClientRect().height
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
_process() {
|
|
178
|
+
const scrollTop = this._getScrollTop() + this._config.offset
|
|
179
|
+
const scrollHeight = this._getScrollHeight()
|
|
180
|
+
const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight()
|
|
181
|
+
|
|
182
|
+
if (this._scrollHeight !== scrollHeight) {
|
|
183
|
+
this.refresh()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (scrollTop >= maxScroll) {
|
|
187
|
+
const target = this._targets[this._targets.length - 1]
|
|
188
|
+
|
|
189
|
+
if (this._activeTarget !== target) {
|
|
190
|
+
this._activate(target)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
|
197
|
+
this._activeTarget = null
|
|
198
|
+
this._clear()
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
for (let i = this._offsets.length; i--;) {
|
|
203
|
+
const isActiveTarget = this._activeTarget !== this._targets[i] &&
|
|
204
|
+
scrollTop >= this._offsets[i] &&
|
|
205
|
+
(typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1])
|
|
206
|
+
|
|
207
|
+
if (isActiveTarget) {
|
|
208
|
+
this._activate(this._targets[i])
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
_activate(target) {
|
|
214
|
+
this._activeTarget = target
|
|
215
|
+
|
|
216
|
+
this._clear()
|
|
217
|
+
|
|
218
|
+
const queries = SELECTOR_LINK_ITEMS.split(',')
|
|
219
|
+
.map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`)
|
|
220
|
+
|
|
221
|
+
const link = SelectorEngine.findOne(queries.join(','), this._config.target)
|
|
222
|
+
|
|
223
|
+
link.classList.add(CLASS_NAME_ACTIVE)
|
|
224
|
+
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
|
225
|
+
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN))
|
|
226
|
+
.classList.add(CLASS_NAME_ACTIVE)
|
|
227
|
+
} else {
|
|
228
|
+
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP)
|
|
229
|
+
.forEach(listGroup => {
|
|
230
|
+
// Set triggered links parents as active
|
|
231
|
+
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
|
232
|
+
SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`)
|
|
233
|
+
.forEach(item => item.classList.add(CLASS_NAME_ACTIVE))
|
|
234
|
+
|
|
235
|
+
// Handle special case when .nav-link is inside .nav-item
|
|
236
|
+
SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS)
|
|
237
|
+
.forEach(navItem => {
|
|
238
|
+
SelectorEngine.children(navItem, SELECTOR_NAV_LINKS)
|
|
239
|
+
.forEach(item => item.classList.add(CLASS_NAME_ACTIVE))
|
|
240
|
+
})
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
|
|
245
|
+
relatedTarget: target
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
_clear() {
|
|
250
|
+
SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target)
|
|
251
|
+
.filter(node => node.classList.contains(CLASS_NAME_ACTIVE))
|
|
252
|
+
.forEach(node => node.classList.remove(CLASS_NAME_ACTIVE))
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Static
|
|
256
|
+
|
|
257
|
+
static jQueryInterface(config) {
|
|
258
|
+
return this.each(function () {
|
|
259
|
+
const data = ScrollSpy.getOrCreateInstance(this, config)
|
|
260
|
+
|
|
261
|
+
if (typeof config !== 'string') {
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (typeof data[config] === 'undefined') {
|
|
266
|
+
throw new TypeError(`No method named "${config}"`)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
data[config]()
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* ------------------------------------------------------------------------
|
|
276
|
+
* Data Api implementation
|
|
277
|
+
* ------------------------------------------------------------------------
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
281
|
+
SelectorEngine.find(SELECTOR_DATA_SPY)
|
|
282
|
+
.forEach(spy => new ScrollSpy(spy))
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* ------------------------------------------------------------------------
|
|
287
|
+
* jQuery
|
|
288
|
+
* ------------------------------------------------------------------------
|
|
289
|
+
* add .ScrollSpy to jQuery only if jQuery is present
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
defineJQueryPlugin(ScrollSpy)
|
|
293
|
+
|
|
294
|
+
export default ScrollSpy
|
package/js/src/scrollspy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): scrollspy.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/tab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): tab.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
@@ -38,7 +38,6 @@ const CLASS_DROPDOWN = 'dropdown'
|
|
|
38
38
|
|
|
39
39
|
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
|
|
40
40
|
const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'
|
|
41
|
-
const SELECTOR_DROPDOWN_ITEM = '.dropdown-item'
|
|
42
41
|
const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'
|
|
43
42
|
|
|
44
43
|
const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
|
|
@@ -115,7 +114,6 @@ class Tab extends BaseComponent {
|
|
|
115
114
|
return
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
element.focus()
|
|
119
117
|
element.removeAttribute('tabindex')
|
|
120
118
|
element.setAttribute('aria-selected', true)
|
|
121
119
|
this._toggleDropDown(element, true)
|
|
@@ -163,6 +161,7 @@ class Tab extends BaseComponent {
|
|
|
163
161
|
const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true)
|
|
164
162
|
|
|
165
163
|
if (nextActiveElement) {
|
|
164
|
+
nextActiveElement.focus({ preventScroll: true })
|
|
166
165
|
Tab.getOrCreateInstance(nextActiveElement).show()
|
|
167
166
|
}
|
|
168
167
|
}
|
|
@@ -232,7 +231,6 @@ class Tab extends BaseComponent {
|
|
|
232
231
|
|
|
233
232
|
toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE)
|
|
234
233
|
toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW)
|
|
235
|
-
toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE)
|
|
236
234
|
outerElem.setAttribute('aria-expanded', open)
|
|
237
235
|
}
|
|
238
236
|
|
package/js/src/toast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): toast.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
@@ -153,15 +153,20 @@ class Toast extends BaseComponent {
|
|
|
153
153
|
_onInteraction(event, isInteracting) {
|
|
154
154
|
switch (event.type) {
|
|
155
155
|
case 'mouseover':
|
|
156
|
-
case 'mouseout':
|
|
156
|
+
case 'mouseout': {
|
|
157
157
|
this._hasMouseInteraction = isInteracting
|
|
158
158
|
break
|
|
159
|
+
}
|
|
160
|
+
|
|
159
161
|
case 'focusin':
|
|
160
|
-
case 'focusout':
|
|
162
|
+
case 'focusout': {
|
|
161
163
|
this._hasKeyboardInteraction = isInteracting
|
|
162
164
|
break
|
|
163
|
-
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
default: {
|
|
164
168
|
break
|
|
169
|
+
}
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
if (isInteracting) {
|
package/js/src/tooltip.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): tooltip.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
@@ -121,6 +121,10 @@ class Tooltip extends BaseComponent {
|
|
|
121
121
|
this.tip = null
|
|
122
122
|
|
|
123
123
|
this._setListeners()
|
|
124
|
+
|
|
125
|
+
if (!this._config.selector) {
|
|
126
|
+
this._fixTitle()
|
|
127
|
+
}
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
// Getters
|
|
@@ -149,25 +153,12 @@ class Tooltip extends BaseComponent {
|
|
|
149
153
|
this._isEnabled = !this._isEnabled
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
toggle(
|
|
156
|
+
toggle() {
|
|
153
157
|
if (!this._isEnabled) {
|
|
154
158
|
return
|
|
155
159
|
}
|
|
156
160
|
|
|
157
|
-
|
|
158
|
-
const context = this._initializeOnDelegatedTarget(event)
|
|
159
|
-
|
|
160
|
-
context._activeTrigger.click = !context._activeTrigger.click
|
|
161
|
-
|
|
162
|
-
if (context._isWithActiveTrigger()) {
|
|
163
|
-
context._enter()
|
|
164
|
-
} else {
|
|
165
|
-
context._leave()
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return
|
|
169
|
-
}
|
|
170
|
-
|
|
161
|
+
this._activeTrigger.click = !this._activeTrigger.click
|
|
171
162
|
if (this._isShown()) {
|
|
172
163
|
this._leave()
|
|
173
164
|
return
|
|
@@ -181,12 +172,8 @@ class Tooltip extends BaseComponent {
|
|
|
181
172
|
|
|
182
173
|
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
|
|
183
174
|
|
|
184
|
-
if (this.
|
|
185
|
-
this.
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (this._config.originalTitle) {
|
|
189
|
-
this._element.setAttribute('title', this._config.originalTitle)
|
|
175
|
+
if (this._element.getAttribute('data-bs-original-title')) {
|
|
176
|
+
this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'))
|
|
190
177
|
}
|
|
191
178
|
|
|
192
179
|
this._disposePopper()
|
|
@@ -211,10 +198,7 @@ class Tooltip extends BaseComponent {
|
|
|
211
198
|
}
|
|
212
199
|
|
|
213
200
|
// todo v6 remove this OR make it optional
|
|
214
|
-
|
|
215
|
-
this.tip.remove()
|
|
216
|
-
this.tip = null
|
|
217
|
-
}
|
|
201
|
+
this._disposePopper()
|
|
218
202
|
|
|
219
203
|
const tip = this._getTipElement()
|
|
220
204
|
|
|
@@ -227,11 +211,7 @@ class Tooltip extends BaseComponent {
|
|
|
227
211
|
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED))
|
|
228
212
|
}
|
|
229
213
|
|
|
230
|
-
|
|
231
|
-
this._popper.update()
|
|
232
|
-
} else {
|
|
233
|
-
this._popper = this._createPopper(tip)
|
|
234
|
-
}
|
|
214
|
+
this._popper = this._createPopper(tip)
|
|
235
215
|
|
|
236
216
|
tip.classList.add(CLASS_NAME_SHOW)
|
|
237
217
|
|
|
@@ -290,13 +270,11 @@ class Tooltip extends BaseComponent {
|
|
|
290
270
|
}
|
|
291
271
|
|
|
292
272
|
if (!this._isHovered) {
|
|
293
|
-
|
|
273
|
+
this._disposePopper()
|
|
294
274
|
}
|
|
295
275
|
|
|
296
276
|
this._element.removeAttribute('aria-describedby')
|
|
297
277
|
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN))
|
|
298
|
-
|
|
299
|
-
this._disposePopper()
|
|
300
278
|
}
|
|
301
279
|
|
|
302
280
|
this._queueCallback(complete, this.tip, this._isAnimated())
|
|
@@ -375,7 +353,7 @@ class Tooltip extends BaseComponent {
|
|
|
375
353
|
}
|
|
376
354
|
|
|
377
355
|
_getTitle() {
|
|
378
|
-
return this._resolvePossibleFunction(this._config.title) || this.
|
|
356
|
+
return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')
|
|
379
357
|
}
|
|
380
358
|
|
|
381
359
|
// Private
|
|
@@ -469,7 +447,10 @@ class Tooltip extends BaseComponent {
|
|
|
469
447
|
|
|
470
448
|
for (const trigger of triggers) {
|
|
471
449
|
if (trigger === 'click') {
|
|
472
|
-
EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event =>
|
|
450
|
+
EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
|
|
451
|
+
const context = this._initializeOnDelegatedTarget(event)
|
|
452
|
+
context.toggle()
|
|
453
|
+
})
|
|
473
454
|
} else if (trigger !== TRIGGER_MANUAL) {
|
|
474
455
|
const eventIn = trigger === TRIGGER_HOVER ?
|
|
475
456
|
this.constructor.eventName(EVENT_MOUSEENTER) :
|
|
@@ -500,20 +481,10 @@ class Tooltip extends BaseComponent {
|
|
|
500
481
|
}
|
|
501
482
|
|
|
502
483
|
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
|
|
503
|
-
|
|
504
|
-
if (this._config.selector) {
|
|
505
|
-
this._config = {
|
|
506
|
-
...this._config,
|
|
507
|
-
trigger: 'manual',
|
|
508
|
-
selector: ''
|
|
509
|
-
}
|
|
510
|
-
} else {
|
|
511
|
-
this._fixTitle()
|
|
512
|
-
}
|
|
513
484
|
}
|
|
514
485
|
|
|
515
486
|
_fixTitle() {
|
|
516
|
-
const title = this.
|
|
487
|
+
const title = this._element.getAttribute('title')
|
|
517
488
|
|
|
518
489
|
if (!title) {
|
|
519
490
|
return
|
|
@@ -523,6 +494,7 @@ class Tooltip extends BaseComponent {
|
|
|
523
494
|
this._element.setAttribute('aria-label', title)
|
|
524
495
|
}
|
|
525
496
|
|
|
497
|
+
this._element.setAttribute('data-bs-original-title', title) // DO NOT USE IT. Is only for backwards compatibility
|
|
526
498
|
this._element.removeAttribute('title')
|
|
527
499
|
}
|
|
528
500
|
|
|
@@ -593,7 +565,6 @@ class Tooltip extends BaseComponent {
|
|
|
593
565
|
}
|
|
594
566
|
}
|
|
595
567
|
|
|
596
|
-
config.originalTitle = this._element.getAttribute('title') || ''
|
|
597
568
|
if (typeof config.title === 'number') {
|
|
598
569
|
config.title = config.title.toString()
|
|
599
570
|
}
|
|
@@ -614,6 +585,9 @@ class Tooltip extends BaseComponent {
|
|
|
614
585
|
}
|
|
615
586
|
}
|
|
616
587
|
|
|
588
|
+
config.selector = false
|
|
589
|
+
config.trigger = 'manual'
|
|
590
|
+
|
|
617
591
|
// In the future can be replaced with:
|
|
618
592
|
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
|
619
593
|
// `Object.fromEntries(keysWithDifferentValues)`
|
|
@@ -625,6 +599,11 @@ class Tooltip extends BaseComponent {
|
|
|
625
599
|
this._popper.destroy()
|
|
626
600
|
this._popper = null
|
|
627
601
|
}
|
|
602
|
+
|
|
603
|
+
if (this.tip) {
|
|
604
|
+
this.tip.remove()
|
|
605
|
+
this.tip = null
|
|
606
|
+
}
|
|
628
607
|
}
|
|
629
608
|
|
|
630
609
|
// Static
|
package/js/src/util/backdrop.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/backdrop.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/component-functions.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/config.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/focustrap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/focustrap.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/index.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/sanitizer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/sanitizer.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/scrollbar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/scrollBar.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
package/js/src/util/swipe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/swipe.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.2.
|
|
3
|
+
* Bootstrap (v5.2.3): util/template-factory.js
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|