@coreui/coreui 4.2.1 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +1 -1
  2. package/dist/css/coreui-grid.css +61 -61
  3. package/dist/css/coreui-grid.css.map +1 -1
  4. package/dist/css/coreui-grid.min.css +1 -1
  5. package/dist/css/coreui-grid.min.css.map +1 -1
  6. package/dist/css/coreui-grid.rtl.css +62 -62
  7. package/dist/css/coreui-grid.rtl.css.map +1 -1
  8. package/dist/css/coreui-grid.rtl.min.css +2 -2
  9. package/dist/css/coreui-grid.rtl.min.css.map +1 -1
  10. package/dist/css/coreui-reboot.css +1 -1
  11. package/dist/css/coreui-reboot.css.map +1 -1
  12. package/dist/css/coreui-reboot.min.css +1 -1
  13. package/dist/css/coreui-reboot.min.css.map +1 -1
  14. package/dist/css/coreui-reboot.rtl.css +2 -2
  15. package/dist/css/coreui-reboot.rtl.css.map +1 -1
  16. package/dist/css/coreui-reboot.rtl.min.css +2 -2
  17. package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
  18. package/dist/css/coreui-utilities.css +72 -2
  19. package/dist/css/coreui-utilities.css.map +1 -1
  20. package/dist/css/coreui-utilities.min.css +2 -2
  21. package/dist/css/coreui-utilities.min.css.map +1 -1
  22. package/dist/css/coreui-utilities.rtl.css +73 -3
  23. package/dist/css/coreui-utilities.rtl.css.map +1 -1
  24. package/dist/css/coreui-utilities.rtl.min.css +3 -3
  25. package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
  26. package/dist/css/coreui.css +195 -208
  27. package/dist/css/coreui.css.map +1 -1
  28. package/dist/css/coreui.min.css +2 -2
  29. package/dist/css/coreui.min.css.map +1 -1
  30. package/dist/css/coreui.rtl.css +196 -169
  31. package/dist/css/coreui.rtl.css.map +1 -1
  32. package/dist/css/coreui.rtl.min.css +3 -3
  33. package/dist/css/coreui.rtl.min.css.map +1 -1
  34. package/dist/js/coreui.bundle.js +704 -1534
  35. package/dist/js/coreui.bundle.js.map +1 -1
  36. package/dist/js/coreui.bundle.min.js +2 -2
  37. package/dist/js/coreui.bundle.min.js.map +1 -1
  38. package/dist/js/coreui.esm.js +641 -1482
  39. package/dist/js/coreui.esm.js.map +1 -1
  40. package/dist/js/coreui.esm.min.js +2 -2
  41. package/dist/js/coreui.esm.min.js.map +1 -1
  42. package/dist/js/coreui.js +642 -1483
  43. package/dist/js/coreui.js.map +1 -1
  44. package/dist/js/coreui.min.js +2 -2
  45. package/dist/js/coreui.min.js.map +1 -1
  46. package/js/dist/alert.js +15 -21
  47. package/js/dist/alert.js.map +1 -1
  48. package/js/dist/base-component.js +14 -25
  49. package/js/dist/base-component.js.map +1 -1
  50. package/js/dist/button.js +13 -12
  51. package/js/dist/button.js.map +1 -1
  52. package/js/dist/carousel.js +27 -103
  53. package/js/dist/carousel.js.map +1 -1
  54. package/js/dist/collapse.js +27 -84
  55. package/js/dist/collapse.js.map +1 -1
  56. package/js/dist/dom/data.js +8 -12
  57. package/js/dist/dom/data.js.map +1 -1
  58. package/js/dist/dom/event-handler.js +32 -69
  59. package/js/dist/dom/event-handler.js.map +1 -1
  60. package/js/dist/dom/manipulator.js +4 -17
  61. package/js/dist/dom/manipulator.js.map +1 -1
  62. package/js/dist/dom/selector-engine.js +41 -24
  63. package/js/dist/dom/selector-engine.js.map +1 -1
  64. package/js/dist/dropdown.js +55 -118
  65. package/js/dist/dropdown.js.map +1 -1
  66. package/js/dist/modal.js +42 -109
  67. package/js/dist/modal.js.map +1 -1
  68. package/js/dist/navigation.js +27 -59
  69. package/js/dist/navigation.js.map +1 -1
  70. package/js/dist/offcanvas.js +26 -70
  71. package/js/dist/offcanvas.js.map +1 -1
  72. package/js/dist/popover.js +18 -21
  73. package/js/dist/popover.js.map +1 -1
  74. package/js/dist/scrollspy.js +43 -71
  75. package/js/dist/scrollspy.js.map +1 -1
  76. package/js/dist/sidebar.js +21 -65
  77. package/js/dist/sidebar.js.map +1 -1
  78. package/js/dist/tab.js +41 -105
  79. package/js/dist/tab.js.map +1 -1
  80. package/js/dist/toast.js +26 -60
  81. package/js/dist/toast.js.map +1 -1
  82. package/js/dist/tooltip.js +88 -201
  83. package/js/dist/tooltip.js.map +1 -1
  84. package/js/dist/util/backdrop.js +24 -43
  85. package/js/dist/util/backdrop.js.map +1 -1
  86. package/js/dist/util/component-functions.js +14 -12
  87. package/js/dist/util/component-functions.js.map +1 -1
  88. package/js/dist/util/config.js +14 -20
  89. package/js/dist/util/config.js.map +1 -1
  90. package/js/dist/util/focustrap.js +15 -23
  91. package/js/dist/util/focustrap.js.map +1 -1
  92. package/js/dist/util/index.js +41 -110
  93. package/js/dist/util/index.js.map +1 -1
  94. package/js/dist/util/sanitizer.js +10 -20
  95. package/js/dist/util/sanitizer.js.map +1 -1
  96. package/js/dist/util/scrollbar.js +20 -39
  97. package/js/dist/util/scrollbar.js.map +1 -1
  98. package/js/dist/util/swipe.js +19 -33
  99. package/js/dist/util/swipe.js.map +1 -1
  100. package/js/dist/util/template-factory.js +22 -42
  101. package/js/dist/util/template-factory.js.map +1 -1
  102. package/js/src/alert.js +5 -5
  103. package/js/src/base-component.js +6 -6
  104. package/js/src/button.js +4 -6
  105. package/js/src/carousel.js +8 -9
  106. package/js/src/collapse.js +9 -14
  107. package/js/src/dom/data.js +2 -2
  108. package/js/src/dom/event-handler.js +19 -16
  109. package/js/src/dom/manipulator.js +2 -2
  110. package/js/src/dom/selector-engine.js +49 -6
  111. package/js/src/dropdown.js +19 -9
  112. package/js/src/modal.js +26 -22
  113. package/js/src/navigation.js +7 -7
  114. package/js/src/offcanvas.js +11 -12
  115. package/js/src/popover.js +3 -3
  116. package/js/src/scrollspy.js +14 -10
  117. package/js/src/sidebar.js +7 -7
  118. package/js/src/tab.js +13 -23
  119. package/js/src/toast.js +13 -8
  120. package/js/src/tooltip.js +53 -75
  121. package/js/src/util/backdrop.js +7 -4
  122. package/js/src/util/component-functions.js +8 -4
  123. package/js/src/util/config.js +7 -5
  124. package/js/src/util/focustrap.js +7 -4
  125. package/js/src/util/index.js +21 -51
  126. package/js/src/util/sanitizer.js +4 -4
  127. package/js/src/util/scrollbar.js +7 -4
  128. package/js/src/util/swipe.js +7 -4
  129. package/js/src/util/template-factory.js +9 -6
  130. package/package.json +31 -30
  131. package/scss/_accordion.scss +7 -3
  132. package/scss/_button-group.scss +1 -1
  133. package/scss/_buttons.scss +31 -6
  134. package/scss/_carousel.scss +0 -3
  135. package/scss/_dropdown.scss +2 -1
  136. package/scss/_functions.scss +2 -2
  137. package/scss/_icon.scss +1 -1
  138. package/scss/_list-group.scss +6 -5
  139. package/scss/_modal.scss +1 -1
  140. package/scss/_nav.scss +2 -2
  141. package/scss/_navbar.scss +3 -1
  142. package/scss/_offcanvas.scss +5 -4
  143. package/scss/_pagination.scss +1 -1
  144. package/scss/_placeholders.scss +1 -1
  145. package/scss/_popover.scss +5 -5
  146. package/scss/_spinners.scss +2 -2
  147. package/scss/_toasts.scss +5 -2
  148. package/scss/_variables.scss +18 -16
  149. package/scss/coreui-grid.rtl.scss +1 -1
  150. package/scss/coreui-grid.scss +1 -1
  151. package/scss/coreui-reboot.rtl.scss +1 -1
  152. package/scss/coreui-reboot.scss +1 -1
  153. package/scss/coreui-utilities.rtl.scss +1 -1
  154. package/scss/coreui-utilities.scss +4 -1
  155. package/scss/coreui.rtl.scss +1 -1
  156. package/scss/coreui.scss +1 -1
  157. package/scss/forms/_floating-labels.scss +1 -0
  158. package/scss/forms/_input-group.scss +19 -8
  159. package/scss/helpers/_vr.scss +1 -1
  160. package/scss/mixins/_forms.scss +10 -11
  161. package/scss/mixins/_table-variants.scss +2 -2
  162. package/scss/mixins/_utilities.scss +1 -1
  163. package/scss/sidebar/_sidebar-nav.scss +5 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): dropdown.js
3
+ * CoreUI (v4.2.3): dropdown.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's dropdown.js
@@ -11,6 +11,7 @@
11
11
  import * as Popper from '@popperjs/core'
12
12
  import {
13
13
  defineJQueryPlugin,
14
+ execute,
14
15
  getElement,
15
16
  getNextActiveElement,
16
17
  isDisabled,
@@ -18,11 +19,11 @@ import {
18
19
  isRTL,
19
20
  isVisible,
20
21
  noop
21
- } from './util/index'
22
- import EventHandler from './dom/event-handler'
23
- import Manipulator from './dom/manipulator'
24
- import SelectorEngine from './dom/selector-engine'
25
- import BaseComponent from './base-component'
22
+ } from './util/index.js'
23
+ import EventHandler from './dom/event-handler.js'
24
+ import Manipulator from './dom/manipulator.js'
25
+ import SelectorEngine from './dom/selector-engine.js'
26
+ import BaseComponent from './base-component.js'
26
27
 
27
28
  /**
28
29
  * Constants
@@ -98,7 +99,10 @@ class Dropdown extends BaseComponent {
98
99
 
99
100
  this._popper = null
100
101
  this._parent = this._element.parentNode // dropdown wrapper
101
- this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent)
102
+ // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
103
+ this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
104
+ SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
105
+ SelectorEngine.findOne(SELECTOR_MENU, this._parent)
102
106
  this._inNavbar = this._detectNavbar()
103
107
  }
104
108
 
@@ -319,7 +323,7 @@ class Dropdown extends BaseComponent {
319
323
 
320
324
  return {
321
325
  ...defaultBsPopperConfig,
322
- ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
326
+ ...execute(this._config.popperConfig, [defaultBsPopperConfig])
323
327
  }
324
328
  }
325
329
 
@@ -408,7 +412,13 @@ class Dropdown extends BaseComponent {
408
412
 
409
413
  event.preventDefault()
410
414
 
411
- const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode)
415
+ // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
416
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?
417
+ this :
418
+ (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||
419
+ SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] ||
420
+ SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode))
421
+
412
422
  const instance = Dropdown.getOrCreateInstance(getToggleButton)
413
423
 
414
424
  if (isUpOrDownEvent) {
package/js/src/modal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): modal.js
3
+ * CoreUI (v4.2.3): modal.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's modal.js
@@ -8,14 +8,14 @@
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index'
12
- import EventHandler from './dom/event-handler'
13
- import SelectorEngine from './dom/selector-engine'
14
- import ScrollBarHelper from './util/scrollbar'
15
- import BaseComponent from './base-component'
16
- import Backdrop from './util/backdrop'
17
- import FocusTrap from './util/focustrap'
18
- import { enableDismissTrigger } from './util/component-functions'
11
+ import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js'
12
+ import EventHandler from './dom/event-handler.js'
13
+ import SelectorEngine from './dom/selector-engine.js'
14
+ import ScrollBarHelper from './util/scrollbar.js'
15
+ import BaseComponent from './base-component.js'
16
+ import Backdrop from './util/backdrop.js'
17
+ import FocusTrap from './util/focustrap.js'
18
+ import { enableDismissTrigger } from './util/component-functions.js'
19
19
 
20
20
  /**
21
21
  * Constants
@@ -33,6 +33,7 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`
33
33
  const EVENT_SHOW = `show${EVENT_KEY}`
34
34
  const EVENT_SHOWN = `shown${EVENT_KEY}`
35
35
  const EVENT_RESIZE = `resize${EVENT_KEY}`
36
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`
36
37
  const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`
37
38
  const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`
38
39
  const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
@@ -225,18 +226,21 @@ class Modal extends BaseComponent {
225
226
  })
226
227
 
227
228
  EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
228
- if (event.target !== event.currentTarget) { // click is inside modal-dialog
229
- return
230
- }
231
-
232
- if (this._config.backdrop === 'static') {
233
- this._triggerBackdropTransition()
234
- return
235
- }
236
-
237
- if (this._config.backdrop) {
238
- this.hide()
239
- }
229
+ // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
230
+ EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
231
+ if (this._element !== event.target || this._element !== event2.target) {
232
+ return
233
+ }
234
+
235
+ if (this._config.backdrop === 'static') {
236
+ this._triggerBackdropTransition()
237
+ return
238
+ }
239
+
240
+ if (this._config.backdrop) {
241
+ this.hide()
242
+ }
243
+ })
240
244
  })
241
245
  }
242
246
 
@@ -335,7 +339,7 @@ class Modal extends BaseComponent {
335
339
  */
336
340
 
337
341
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
338
- const target = getElementFromSelector(this)
342
+ const target = SelectorEngine.getElementFromSelector(this)
339
343
 
340
344
  if (['A', 'AREA'].includes(this.tagName)) {
341
345
  event.preventDefault()
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): navigation.js
3
+ * CoreUI (v4.2.3): navigation.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
- import { defineJQueryPlugin } from './util/index'
9
- import Data from './dom/data'
10
- import EventHandler from './dom/event-handler'
11
- import Manipulator from './dom/manipulator'
12
- import SelectorEngine from './dom/selector-engine'
13
- import BaseComponent from './base-component'
8
+ import { defineJQueryPlugin } from './util/index.js'
9
+ import Data from './dom/data.js'
10
+ import EventHandler from './dom/event-handler.js'
11
+ import Manipulator from './dom/manipulator.js'
12
+ import SelectorEngine from './dom/selector-engine.js'
13
+ import BaseComponent from './base-component.js'
14
14
 
15
15
  /**
16
16
  * ------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): dropdown.js
3
+ * CoreUI (v4.2.3): dropdown.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's offcanvas.js
@@ -10,17 +10,16 @@
10
10
 
11
11
  import {
12
12
  defineJQueryPlugin,
13
- getElementFromSelector,
14
13
  isDisabled,
15
14
  isVisible
16
- } from './util/index'
17
- import ScrollBarHelper from './util/scrollbar'
18
- import EventHandler from './dom/event-handler'
19
- import BaseComponent from './base-component'
20
- import SelectorEngine from './dom/selector-engine'
21
- import Backdrop from './util/backdrop'
22
- import FocusTrap from './util/focustrap'
23
- import { enableDismissTrigger } from './util/component-functions'
15
+ } from './util/index.js'
16
+ import ScrollBarHelper from './util/scrollbar.js'
17
+ import EventHandler from './dom/event-handler.js'
18
+ import BaseComponent from './base-component.js'
19
+ import SelectorEngine from './dom/selector-engine.js'
20
+ import Backdrop from './util/backdrop.js'
21
+ import FocusTrap from './util/focustrap.js'
22
+ import { enableDismissTrigger } from './util/component-functions.js'
24
23
 
25
24
  /**
26
25
  * Constants
@@ -117,7 +116,7 @@ class Offcanvas extends BaseComponent {
117
116
  this._element.classList.add(CLASS_NAME_SHOWING)
118
117
 
119
118
  const completeCallBack = () => {
120
- if (!this._config.scroll) {
119
+ if (!this._config.scroll || this._config.backdrop) {
121
120
  this._focustrap.activate()
122
121
  }
123
122
 
@@ -234,7 +233,7 @@ class Offcanvas extends BaseComponent {
234
233
  */
235
234
 
236
235
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
237
- const target = getElementFromSelector(this)
236
+ const target = SelectorEngine.getElementFromSelector(this)
238
237
 
239
238
  if (['A', 'AREA'].includes(this.tagName)) {
240
239
  event.preventDefault()
package/js/src/popover.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): popover.js
3
+ * CoreUI (v4.2.3): popover.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's popover.js
@@ -8,8 +8,8 @@
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { defineJQueryPlugin } from './util/index'
12
- import Tooltip from './tooltip'
11
+ import { defineJQueryPlugin } from './util/index.js'
12
+ import Tooltip from './tooltip.js'
13
13
 
14
14
  /**
15
15
  * Constants
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): scrollspy.js
3
+ * CoreUI (v4.2.3): scrollspy.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's scrollspy.js
@@ -43,14 +43,16 @@ const Default = {
43
43
  offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons
44
44
  rootMargin: '0px 0px -25%',
45
45
  smoothScroll: false,
46
- target: null
46
+ target: null,
47
+ threshold: [0.1, 0.5, 1]
47
48
  }
48
49
 
49
50
  const DefaultType = {
50
51
  offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons
51
52
  rootMargin: 'string',
52
53
  smoothScroll: 'boolean',
53
- target: 'element'
54
+ target: 'element',
55
+ threshold: 'array'
54
56
  }
55
57
 
56
58
  /**
@@ -113,6 +115,13 @@ class ScrollSpy extends BaseComponent {
113
115
  // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
114
116
  config.target = getElement(config.target) || document.body
115
117
 
118
+ // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
119
+ config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin
120
+
121
+ if (typeof config.threshold === 'string') {
122
+ config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value))
123
+ }
124
+
116
125
  return config
117
126
  }
118
127
 
@@ -144,8 +153,8 @@ class ScrollSpy extends BaseComponent {
144
153
  _getNewObserver() {
145
154
  const options = {
146
155
  root: this._rootElement,
147
- threshold: [0.1, 0.5, 1],
148
- rootMargin: this._getRootMargin()
156
+ threshold: this._config.threshold,
157
+ rootMargin: this._config.rootMargin
149
158
  }
150
159
 
151
160
  return new IntersectionObserver(entries => this._observerCallback(entries), options)
@@ -190,11 +199,6 @@ class ScrollSpy extends BaseComponent {
190
199
  }
191
200
  }
192
201
 
193
- // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
194
- _getRootMargin() {
195
- return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin
196
- }
197
-
198
202
  _initializeTargetsAndObservables() {
199
203
  this._targetLinks = new Map()
200
204
  this._observableSections = new Map()
package/js/src/sidebar.js CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): sidebar.js
3
+ * CoreUI (v4.2.3): sidebar.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
- import { defineJQueryPlugin } from './util/index'
9
- import ScrollBarHelper from './util/scrollbar'
10
- import EventHandler from './dom/event-handler'
11
- import BaseComponent from './base-component'
12
- import Manipulator from './dom/manipulator'
13
- import Backdrop from './util/backdrop'
8
+ import { defineJQueryPlugin } from './util/index.js'
9
+ import ScrollBarHelper from './util/scrollbar.js'
10
+ import EventHandler from './dom/event-handler.js'
11
+ import BaseComponent from './base-component.js'
12
+ import Manipulator from './dom/manipulator.js'
13
+ import Backdrop from './util/backdrop.js'
14
14
 
15
15
  /**
16
16
  * ------------------------------------------------------------------------
package/js/src/tab.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): tab.js
3
+ * CoreUI (v4.2.3): tab.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's tab.js
@@ -8,10 +8,10 @@
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { defineJQueryPlugin, getElementFromSelector, getNextActiveElement, isDisabled } from './util/index'
12
- import EventHandler from './dom/event-handler'
13
- import SelectorEngine from './dom/selector-engine'
14
- import BaseComponent from './base-component'
11
+ import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js'
12
+ import EventHandler from './dom/event-handler.js'
13
+ import SelectorEngine from './dom/selector-engine.js'
14
+ import BaseComponent from './base-component.js'
15
15
 
16
16
  /**
17
17
  * Constants
@@ -41,7 +41,6 @@ const CLASS_DROPDOWN = 'dropdown'
41
41
 
42
42
  const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
43
43
  const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'
44
- const SELECTOR_DROPDOWN_ITEM = '.dropdown-item'
45
44
  const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'
46
45
 
47
46
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
@@ -110,19 +109,14 @@ class Tab extends BaseComponent {
110
109
 
111
110
  element.classList.add(CLASS_NAME_ACTIVE)
112
111
 
113
- this._activate(getElementFromSelector(element)) // Search and activate/show the proper section
112
+ this._activate(SelectorEngine.getElementFromSelector(element)) // Search and activate/show the proper section
114
113
 
115
- const isAnimated = element.classList.contains(CLASS_NAME_FADE)
116
114
  const complete = () => {
117
- if (isAnimated) { // todo: maybe is redundant
118
- element.classList.add(CLASS_NAME_SHOW)
119
- }
120
-
121
115
  if (element.getAttribute('role') !== 'tab') {
116
+ element.classList.add(CLASS_NAME_SHOW)
122
117
  return
123
118
  }
124
119
 
125
- element.focus()
126
120
  element.removeAttribute('tabindex')
127
121
  element.setAttribute('aria-selected', true)
128
122
  this._toggleDropDown(element, true)
@@ -131,7 +125,7 @@ class Tab extends BaseComponent {
131
125
  })
132
126
  }
133
127
 
134
- this._queueCallback(complete, element, isAnimated)
128
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))
135
129
  }
136
130
 
137
131
  _deactivate(element, relatedElem) {
@@ -142,15 +136,11 @@ class Tab extends BaseComponent {
142
136
  element.classList.remove(CLASS_NAME_ACTIVE)
143
137
  element.blur()
144
138
 
145
- this._deactivate(getElementFromSelector(element)) // Search and deactivate the shown section too
139
+ this._deactivate(SelectorEngine.getElementFromSelector(element)) // Search and deactivate the shown section too
146
140
 
147
- const isAnimated = element.classList.contains(CLASS_NAME_FADE)
148
141
  const complete = () => {
149
- if (isAnimated) { // todo maybe is redundant
150
- element.classList.remove(CLASS_NAME_SHOW)
151
- }
152
-
153
142
  if (element.getAttribute('role') !== 'tab') {
143
+ element.classList.remove(CLASS_NAME_SHOW)
154
144
  return
155
145
  }
156
146
 
@@ -160,7 +150,7 @@ class Tab extends BaseComponent {
160
150
  EventHandler.trigger(element, EVENT_HIDDEN, { relatedTarget: relatedElem })
161
151
  }
162
152
 
163
- this._queueCallback(complete, element, isAnimated)
153
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))
164
154
  }
165
155
 
166
156
  _keydown(event) {
@@ -174,6 +164,7 @@ class Tab extends BaseComponent {
174
164
  const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true)
175
165
 
176
166
  if (nextActiveElement) {
167
+ nextActiveElement.focus({ preventScroll: true })
177
168
  Tab.getOrCreateInstance(nextActiveElement).show()
178
169
  }
179
170
  }
@@ -215,7 +206,7 @@ class Tab extends BaseComponent {
215
206
  }
216
207
 
217
208
  _setInitialAttributesOnTargetPanel(child) {
218
- const target = getElementFromSelector(child)
209
+ const target = SelectorEngine.getElementFromSelector(child)
219
210
 
220
211
  if (!target) {
221
212
  return
@@ -243,7 +234,6 @@ class Tab extends BaseComponent {
243
234
 
244
235
  toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE)
245
236
  toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW)
246
- toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE)
247
237
  outerElem.setAttribute('aria-expanded', open)
248
238
  }
249
239
 
package/js/src/toast.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.2.1): toast.js
3
+ * CoreUI (v4.2.3): toast.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's toast.js
@@ -8,10 +8,10 @@
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { defineJQueryPlugin, reflow } from './util/index'
12
- import EventHandler from './dom/event-handler'
13
- import BaseComponent from './base-component'
14
- import { enableDismissTrigger } from './util/component-functions'
11
+ import { defineJQueryPlugin, reflow } from './util/index.js'
12
+ import EventHandler from './dom/event-handler.js'
13
+ import BaseComponent from './base-component.js'
14
+ import { enableDismissTrigger } from './util/component-functions.js'
15
15
 
16
16
  /**
17
17
  * Constants
@@ -156,15 +156,20 @@ class Toast extends BaseComponent {
156
156
  _onInteraction(event, isInteracting) {
157
157
  switch (event.type) {
158
158
  case 'mouseover':
159
- case 'mouseout':
159
+ case 'mouseout': {
160
160
  this._hasMouseInteraction = isInteracting
161
161
  break
162
+ }
163
+
162
164
  case 'focusin':
163
- case 'focusout':
165
+ case 'focusout': {
164
166
  this._hasKeyboardInteraction = isInteracting
165
167
  break
166
- default:
168
+ }
169
+
170
+ default: {
167
171
  break
172
+ }
168
173
  }
169
174
 
170
175
  if (isInteracting) {