@coreui/coreui 4.1.5 → 4.2.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.
Files changed (203) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +64 -11
  3. package/dist/css/coreui-grid.css +23 -949
  4. package/dist/css/coreui-grid.css.map +1 -1
  5. package/dist/css/coreui-grid.min.css +3 -3
  6. package/dist/css/coreui-grid.min.css.map +1 -1
  7. package/dist/css/coreui-grid.rtl.css +25 -951
  8. package/dist/css/coreui-grid.rtl.css.map +1 -1
  9. package/dist/css/coreui-grid.rtl.min.css +5 -5
  10. package/dist/css/coreui-grid.rtl.min.css.map +1 -1
  11. package/dist/css/coreui-reboot.css +35 -42
  12. package/dist/css/coreui-reboot.css.map +1 -1
  13. package/dist/css/coreui-reboot.min.css +3 -3
  14. package/dist/css/coreui-reboot.min.css.map +1 -1
  15. package/dist/css/coreui-reboot.rtl.css +36 -44
  16. package/dist/css/coreui-reboot.rtl.css.map +1 -1
  17. package/dist/css/coreui-reboot.rtl.min.css +5 -5
  18. package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
  19. package/dist/css/coreui-utilities.css +279 -951
  20. package/dist/css/coreui-utilities.css.map +1 -1
  21. package/dist/css/coreui-utilities.min.css +3 -3
  22. package/dist/css/coreui-utilities.min.css.map +1 -1
  23. package/dist/css/coreui-utilities.rtl.css +275 -953
  24. package/dist/css/coreui-utilities.rtl.css.map +1 -1
  25. package/dist/css/coreui-utilities.rtl.min.css +5 -5
  26. package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
  27. package/dist/css/coreui.css +2179 -2259
  28. package/dist/css/coreui.css.map +1 -1
  29. package/dist/css/coreui.min.css +3 -3
  30. package/dist/css/coreui.min.css.map +1 -1
  31. package/dist/css/coreui.rtl.css +2166 -2253
  32. package/dist/css/coreui.rtl.css.map +1 -1
  33. package/dist/css/coreui.rtl.min.css +5 -5
  34. package/dist/css/coreui.rtl.min.css.map +1 -1
  35. package/dist/js/coreui.bundle.js +2095 -1906
  36. package/dist/js/coreui.bundle.js.map +1 -1
  37. package/dist/js/coreui.bundle.min.js +2 -2
  38. package/dist/js/coreui.bundle.min.js.map +1 -1
  39. package/dist/js/coreui.esm.js +2098 -1909
  40. package/dist/js/coreui.esm.js.map +1 -1
  41. package/dist/js/coreui.esm.min.js +2 -2
  42. package/dist/js/coreui.esm.min.js.map +1 -1
  43. package/dist/js/coreui.js +2099 -1910
  44. package/dist/js/coreui.js.map +1 -1
  45. package/dist/js/coreui.min.js +2 -2
  46. package/dist/js/coreui.min.js.map +1 -1
  47. package/js/dist/alert.js +10 -148
  48. package/js/dist/alert.js.map +1 -1
  49. package/js/dist/base-component.js +36 -122
  50. package/js/dist/base-component.js.map +1 -1
  51. package/js/dist/button.js +9 -76
  52. package/js/dist/button.js.map +1 -1
  53. package/js/dist/carousel.js +212 -507
  54. package/js/dist/carousel.js.map +1 -1
  55. package/js/dist/collapse.js +64 -251
  56. package/js/dist/collapse.js.map +1 -1
  57. package/js/dist/dom/data.js +2 -4
  58. package/js/dist/dom/data.js.map +1 -1
  59. package/js/dist/dom/event-handler.js +82 -133
  60. package/js/dist/dom/event-handler.js.map +1 -1
  61. package/js/dist/dom/manipulator.js +22 -26
  62. package/js/dist/dom/manipulator.js.map +1 -1
  63. package/js/dist/dom/selector-engine.js +16 -81
  64. package/js/dist/dom/selector-engine.js.map +1 -1
  65. package/js/dist/dropdown.js +99 -338
  66. package/js/dist/dropdown.js.map +1 -1
  67. package/js/dist/modal.js +106 -774
  68. package/js/dist/modal.js.map +1 -1
  69. package/js/dist/navigation.js +309 -0
  70. package/js/dist/navigation.js.map +1 -0
  71. package/js/dist/offcanvas.js +88 -680
  72. package/js/dist/offcanvas.js.map +1 -1
  73. package/js/dist/popover.js +35 -120
  74. package/js/dist/popover.js.map +1 -1
  75. package/js/dist/scrollspy.js +178 -264
  76. package/js/dist/scrollspy.js.map +1 -1
  77. package/js/dist/sidebar.js +347 -0
  78. package/js/dist/sidebar.js.map +1 -0
  79. package/js/dist/tab.js +226 -216
  80. package/js/dist/tab.js.map +1 -1
  81. package/js/dist/toast.js +27 -216
  82. package/js/dist/toast.js.map +1 -1
  83. package/js/dist/tooltip.js +271 -618
  84. package/js/dist/tooltip.js.map +1 -1
  85. package/js/dist/util/backdrop.js +166 -0
  86. package/js/dist/util/backdrop.js.map +1 -0
  87. package/js/dist/util/component-functions.js +47 -0
  88. package/js/dist/util/component-functions.js.map +1 -0
  89. package/js/dist/util/config.js +80 -0
  90. package/js/dist/util/config.js.map +1 -0
  91. package/js/dist/util/focustrap.js +130 -0
  92. package/js/dist/util/focustrap.js.map +1 -0
  93. package/js/dist/util/index.js +354 -0
  94. package/js/dist/util/index.js.map +1 -0
  95. package/js/dist/util/sanitizer.js +126 -0
  96. package/js/dist/util/sanitizer.js.map +1 -0
  97. package/js/dist/util/scrollbar.js +139 -0
  98. package/js/dist/util/scrollbar.js.map +1 -0
  99. package/js/dist/util/swipe.js +156 -0
  100. package/js/dist/util/swipe.js.map +1 -0
  101. package/js/dist/util/template-factory.js +178 -0
  102. package/js/dist/util/template-factory.js.map +1 -0
  103. package/js/src/alert.js +3 -15
  104. package/js/src/base-component.js +28 -18
  105. package/js/src/button.js +3 -15
  106. package/js/src/carousel.js +203 -320
  107. package/js/src/collapse.js +61 -94
  108. package/js/src/dom/data.js +1 -3
  109. package/js/src/dom/event-handler.js +74 -107
  110. package/js/src/dom/manipulator.js +22 -31
  111. package/js/src/dom/selector-engine.js +10 -19
  112. package/js/src/dropdown.js +84 -138
  113. package/js/src/modal.js +94 -158
  114. package/js/src/navigation.js +12 -13
  115. package/js/src/offcanvas.js +71 -60
  116. package/js/src/popover.js +31 -62
  117. package/js/src/scrollspy.js +166 -171
  118. package/js/src/sidebar.js +5 -8
  119. package/js/src/tab.js +201 -110
  120. package/js/src/toast.js +19 -41
  121. package/js/src/tooltip.js +264 -374
  122. package/js/src/util/backdrop.js +55 -36
  123. package/js/src/util/component-functions.js +1 -1
  124. package/js/src/util/config.js +66 -0
  125. package/js/src/util/focustrap.js +38 -28
  126. package/js/src/util/index.js +41 -57
  127. package/js/src/util/sanitizer.js +9 -17
  128. package/js/src/util/scrollbar.js +47 -30
  129. package/js/src/util/swipe.js +146 -0
  130. package/js/src/util/template-factory.js +160 -0
  131. package/package.json +40 -40
  132. package/scss/_accordion.scss +53 -25
  133. package/scss/_alert.scss +29 -9
  134. package/scss/_badge.scss +15 -6
  135. package/scss/_breadcrumb.scss +23 -11
  136. package/scss/_button-group.scss +3 -0
  137. package/scss/_buttons.scss +77 -50
  138. package/scss/_callout.scss +18 -6
  139. package/scss/_card.scss +55 -37
  140. package/scss/_carousel.scss +6 -6
  141. package/scss/_close.scss +4 -4
  142. package/scss/_containers.scss +1 -1
  143. package/scss/_dropdown.scss +86 -64
  144. package/scss/_footer.scss +15 -5
  145. package/scss/_functions.scss +11 -24
  146. package/scss/_grid.scss +3 -3
  147. package/scss/_header.scss +59 -34
  148. package/scss/_helpers.scss +1 -0
  149. package/scss/_images.scss +3 -3
  150. package/scss/_list-group.scss +47 -29
  151. package/scss/_maps.scss +54 -0
  152. package/scss/_modal.scss +70 -43
  153. package/scss/_nav.scss +53 -20
  154. package/scss/_navbar.scss +84 -94
  155. package/scss/_offcanvas.scss +120 -60
  156. package/scss/_pagination.scss +66 -21
  157. package/scss/_popover.scss +90 -52
  158. package/scss/_progress.scss +20 -9
  159. package/scss/_reboot.scss +31 -58
  160. package/scss/_root.scss +41 -21
  161. package/scss/_spinners.scss +37 -21
  162. package/scss/_subheader.scss +9 -9
  163. package/scss/_tables.scss +34 -36
  164. package/scss/_toasts.scss +35 -19
  165. package/scss/_tooltip.scss +61 -56
  166. package/scss/_utilities.scss +42 -27
  167. package/scss/_variables.scss +169 -148
  168. package/scss/coreui-grid.rtl.scss +2 -2
  169. package/scss/coreui-grid.scss +3 -2
  170. package/scss/coreui-reboot.rtl.scss +2 -2
  171. package/scss/coreui-reboot.scss +2 -2
  172. package/scss/coreui-utilities.rtl.scss +2 -2
  173. package/scss/coreui-utilities.scss +3 -2
  174. package/scss/coreui.rtl.scss +2 -2
  175. package/scss/coreui.scss +3 -2
  176. package/scss/forms/_floating-labels.scss +14 -3
  177. package/scss/forms/_form-check.scss +42 -19
  178. package/scss/forms/_form-control.scss +25 -50
  179. package/scss/forms/_form-range.scss +8 -8
  180. package/scss/forms/_form-select.scss +8 -8
  181. package/scss/forms/_form-text.scss +1 -1
  182. package/scss/forms/_input-group.scss +3 -3
  183. package/scss/forms/_labels.scss +2 -2
  184. package/scss/helpers/_color-bg.scss +10 -0
  185. package/scss/helpers/_colored-links.scss +2 -2
  186. package/scss/helpers/_position.scss +7 -1
  187. package/scss/helpers/_ratio.scss +2 -2
  188. package/scss/helpers/_vr.scss +1 -0
  189. package/scss/mixins/_alert.scss +10 -10
  190. package/scss/mixins/_breakpoints.scss +8 -8
  191. package/scss/mixins/_buttons.scss +45 -47
  192. package/scss/mixins/_container.scss +4 -2
  193. package/scss/mixins/_css-vars.scss +47 -47
  194. package/scss/mixins/_forms.scss +8 -0
  195. package/scss/mixins/_gradients.scss +1 -1
  196. package/scss/mixins/_grid.scss +11 -11
  197. package/scss/mixins/_list-group.scss +7 -9
  198. package/scss/mixins/_pagination.scss +4 -25
  199. package/scss/mixins/_table-variants.scss +20 -12
  200. package/scss/mixins/_utilities.scss +8 -3
  201. package/scss/sidebar/_sidebar-narrow.scss +10 -10
  202. package/scss/sidebar/_sidebar-nav.scss +33 -32
  203. package/scss/sidebar/_sidebar.scss +110 -56
@@ -1,41 +1,65 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * Bootstrap (v5.1.3): util/backdrop.js
3
+ * Bootstrap (v5.2.0-beta1): util/backdrop.js
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
8
  import EventHandler from '../dom/event-handler'
9
- import { execute, executeAfterTransition, getElement, reflow, typeCheckConfig } from './index'
9
+ import { execute, executeAfterTransition, getElement, reflow } from './index'
10
+ import Config from './config'
11
+
12
+ /**
13
+ * Constants
14
+ */
15
+
16
+ const NAME = 'backdrop'
17
+ const CLASS_NAME_FADE = 'fade'
18
+ const CLASS_NAME_SHOW = 'show'
19
+ const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME}`
10
20
 
11
21
  const Default = {
12
22
  className: 'modal-backdrop',
13
- isVisible: true, // if false, we use the backdrop helper without adding any element to the dom
23
+ clickCallback: null,
14
24
  isAnimated: false,
15
- rootElement: 'body', // give the choice to place backdrop under different elements
16
- clickCallback: null
25
+ isVisible: true, // if false, we use the backdrop helper without adding any element to the dom
26
+ rootElement: 'body' // give the choice to place backdrop under different elements
17
27
  }
18
28
 
19
29
  const DefaultType = {
20
30
  className: 'string',
21
- isVisible: 'boolean',
31
+ clickCallback: '(function|null)',
22
32
  isAnimated: 'boolean',
23
- rootElement: '(element|string)',
24
- clickCallback: '(function|null)'
33
+ isVisible: 'boolean',
34
+ rootElement: '(element|string)'
25
35
  }
26
- const NAME = 'backdrop'
27
- const CLASS_NAME_FADE = 'fade'
28
- const CLASS_NAME_SHOW = 'show'
29
36
 
30
- const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME}`
37
+ /**
38
+ * Class definition
39
+ */
31
40
 
32
- class Backdrop {
41
+ class Backdrop extends Config {
33
42
  constructor(config) {
43
+ super()
34
44
  this._config = this._getConfig(config)
35
45
  this._isAppended = false
36
46
  this._element = null
37
47
  }
38
48
 
49
+ // Getters
50
+ static get Default() {
51
+ return Default
52
+ }
53
+
54
+ static get DefaultType() {
55
+ return DefaultType
56
+ }
57
+
58
+ static get NAME() {
59
+ return NAME
60
+ }
61
+
62
+ // Public
39
63
  show(callback) {
40
64
  if (!this._config.isVisible) {
41
65
  execute(callback)
@@ -44,11 +68,12 @@ class Backdrop {
44
68
 
45
69
  this._append()
46
70
 
71
+ const element = this._getElement()
47
72
  if (this._config.isAnimated) {
48
- reflow(this._getElement())
73
+ reflow(element)
49
74
  }
50
75
 
51
- this._getElement().classList.add(CLASS_NAME_SHOW)
76
+ element.classList.add(CLASS_NAME_SHOW)
52
77
 
53
78
  this._emulateAnimation(() => {
54
79
  execute(callback)
@@ -69,8 +94,18 @@ class Backdrop {
69
94
  })
70
95
  }
71
96
 
72
- // Private
97
+ dispose() {
98
+ if (!this._isAppended) {
99
+ return
100
+ }
101
+
102
+ EventHandler.off(this._element, EVENT_MOUSEDOWN)
73
103
 
104
+ this._element.remove()
105
+ this._isAppended = false
106
+ }
107
+
108
+ // Private
74
109
  _getElement() {
75
110
  if (!this._element) {
76
111
  const backdrop = document.createElement('div')
@@ -85,15 +120,9 @@ class Backdrop {
85
120
  return this._element
86
121
  }
87
122
 
88
- _getConfig(config) {
89
- config = {
90
- ...Default,
91
- ...(typeof config === 'object' ? config : {})
92
- }
93
-
123
+ _configAfterMerge(config) {
94
124
  // use getElement() with the default "body" to get a fresh Element on each instantiation
95
125
  config.rootElement = getElement(config.rootElement)
96
- typeCheckConfig(NAME, config, DefaultType)
97
126
  return config
98
127
  }
99
128
 
@@ -102,26 +131,16 @@ class Backdrop {
102
131
  return
103
132
  }
104
133
 
105
- this._config.rootElement.append(this._getElement())
134
+ const element = this._getElement()
135
+ this._config.rootElement.append(element)
106
136
 
107
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
137
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
108
138
  execute(this._config.clickCallback)
109
139
  })
110
140
 
111
141
  this._isAppended = true
112
142
  }
113
143
 
114
- dispose() {
115
- if (!this._isAppended) {
116
- return
117
- }
118
-
119
- EventHandler.off(this._element, EVENT_MOUSEDOWN)
120
-
121
- this._element.remove()
122
- this._isAppended = false
123
- }
124
-
125
144
  _emulateAnimation(callback) {
126
145
  executeAfterTransition(callback, this._getElement(), this._config.isAnimated)
127
146
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * Bootstrap (v5.1.3): util/component-functions.js
3
+ * Bootstrap (v5.2.0-beta1): util/component-functions.js
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  * --------------------------------------------------------------------------
6
6
  */
@@ -0,0 +1,66 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap (v5.2.0-beta1): util/config.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import { isElement, toType } from './index'
9
+ import Manipulator from '../dom/manipulator'
10
+
11
+ /**
12
+ * Class definition
13
+ */
14
+
15
+ class Config {
16
+ // Getters
17
+ static get Default() {
18
+ return {}
19
+ }
20
+
21
+ static get DefaultType() {
22
+ return {}
23
+ }
24
+
25
+ static get NAME() {
26
+ throw new Error('You have to implement the static method "NAME", for each component!')
27
+ }
28
+
29
+ _getConfig(config) {
30
+ config = this._mergeConfigObj(config)
31
+ config = this._configAfterMerge(config)
32
+ this._typeCheckConfig(config)
33
+ return config
34
+ }
35
+
36
+ _configAfterMerge(config) {
37
+ return config
38
+ }
39
+
40
+ _mergeConfigObj(config, element) {
41
+ const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse
42
+
43
+ return {
44
+ ...this.constructor.Default,
45
+ ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
46
+ ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
47
+ ...(typeof config === 'object' ? config : {})
48
+ }
49
+ }
50
+
51
+ _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
52
+ for (const property of Object.keys(configTypes)) {
53
+ const expectedTypes = configTypes[property]
54
+ const value = config[property]
55
+ const valueType = isElement(value) ? 'element' : toType(value)
56
+
57
+ if (!new RegExp(expectedTypes).test(valueType)) {
58
+ throw new TypeError(
59
+ `${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
60
+ )
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ export default Config
@@ -1,23 +1,17 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * Bootstrap (v5.1.3): util/focustrap.js
3
+ * Bootstrap (v5.2.0-beta1): util/focustrap.js
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
8
  import EventHandler from '../dom/event-handler'
9
9
  import SelectorEngine from '../dom/selector-engine'
10
- import { typeCheckConfig } from './index'
10
+ import Config from './config'
11
11
 
12
- const Default = {
13
- trapElement: null, // The element to trap focus inside of
14
- autofocus: true
15
- }
16
-
17
- const DefaultType = {
18
- trapElement: 'element',
19
- autofocus: 'boolean'
20
- }
12
+ /**
13
+ * Constants
14
+ */
21
15
 
22
16
  const NAME = 'focustrap'
23
17
  const DATA_KEY = 'coreui.focustrap'
@@ -29,22 +23,49 @@ const TAB_KEY = 'Tab'
29
23
  const TAB_NAV_FORWARD = 'forward'
30
24
  const TAB_NAV_BACKWARD = 'backward'
31
25
 
32
- class FocusTrap {
26
+ const Default = {
27
+ autofocus: true,
28
+ trapElement: null // The element to trap focus inside of
29
+ }
30
+
31
+ const DefaultType = {
32
+ autofocus: 'boolean',
33
+ trapElement: 'element'
34
+ }
35
+
36
+ /**
37
+ * Class definition
38
+ */
39
+
40
+ class FocusTrap extends Config {
33
41
  constructor(config) {
42
+ super()
34
43
  this._config = this._getConfig(config)
35
44
  this._isActive = false
36
45
  this._lastTabNavDirection = null
37
46
  }
38
47
 
39
- activate() {
40
- const { trapElement, autofocus } = this._config
48
+ // Getters
49
+ static get Default() {
50
+ return Default
51
+ }
52
+
53
+ static get DefaultType() {
54
+ return DefaultType
55
+ }
56
+
57
+ static get NAME() {
58
+ return NAME
59
+ }
41
60
 
61
+ // Public
62
+ activate() {
42
63
  if (this._isActive) {
43
64
  return
44
65
  }
45
66
 
46
- if (autofocus) {
47
- trapElement.focus()
67
+ if (this._config.autofocus) {
68
+ this._config.trapElement.focus()
48
69
  }
49
70
 
50
71
  EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
@@ -64,12 +85,10 @@ class FocusTrap {
64
85
  }
65
86
 
66
87
  // Private
67
-
68
88
  _handleFocusin(event) {
69
- const { target } = event
70
89
  const { trapElement } = this._config
71
90
 
72
- if (target === document || target === trapElement || trapElement.contains(target)) {
91
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
73
92
  return
74
93
  }
75
94
 
@@ -91,15 +110,6 @@ class FocusTrap {
91
110
 
92
111
  this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD
93
112
  }
94
-
95
- _getConfig(config) {
96
- config = {
97
- ...Default,
98
- ...(typeof config === 'object' ? config : {})
99
- }
100
- typeCheckConfig(NAME, config, DefaultType)
101
- return config
102
- }
103
113
  }
104
114
 
105
115
  export default FocusTrap
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.1.5): alert.js
3
+ * CoreUI (v4.2.1): alert.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's util/index.js
@@ -22,9 +22,7 @@ const toType = object => {
22
22
  }
23
23
 
24
24
  /**
25
- * --------------------------------------------------------------------------
26
- * Public Util Api
27
- * --------------------------------------------------------------------------
25
+ * Public Util API
28
26
  */
29
27
 
30
28
  const getUID = prefix => {
@@ -39,22 +37,22 @@ const getSelector = element => {
39
37
  let selector = element.getAttribute('data-coreui-target')
40
38
 
41
39
  if (!selector || selector === '#') {
42
- let hrefAttr = element.getAttribute('href')
40
+ let hrefAttribute = element.getAttribute('href')
43
41
 
44
42
  // The only valid content that could double as a selector are IDs or classes,
45
43
  // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
46
44
  // `document.querySelector` will rightfully complain it is invalid.
47
45
  // See https://github.com/twbs/bootstrap/issues/32273
48
- if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
46
+ if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {
49
47
  return null
50
48
  }
51
49
 
52
50
  // Just in case some CMS puts out a full URL with the anchor appended
53
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
54
- hrefAttr = `#${hrefAttr.split('#')[1]}`
51
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
52
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`
55
53
  }
56
54
 
57
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null
55
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null
58
56
  }
59
57
 
60
58
  return selector
@@ -103,44 +101,31 @@ const triggerTransitionEnd = element => {
103
101
  element.dispatchEvent(new Event(TRANSITION_END))
104
102
  }
105
103
 
106
- const isElement = obj => {
107
- if (!obj || typeof obj !== 'object') {
104
+ const isElement = object => {
105
+ if (!object || typeof object !== 'object') {
108
106
  return false
109
107
  }
110
108
 
111
- if (typeof obj.jquery !== 'undefined') {
112
- obj = obj[0]
109
+ if (typeof object.jquery !== 'undefined') {
110
+ object = object[0]
113
111
  }
114
112
 
115
- return typeof obj.nodeType !== 'undefined'
113
+ return typeof object.nodeType !== 'undefined'
116
114
  }
117
115
 
118
- const getElement = obj => {
119
- if (isElement(obj)) { // it's a jQuery object or a node element
120
- return obj.jquery ? obj[0] : obj
116
+ const getElement = object => {
117
+ // it's a jQuery object or a node element
118
+ if (isElement(object)) {
119
+ return object.jquery ? object[0] : object
121
120
  }
122
121
 
123
- if (typeof obj === 'string' && obj.length > 0) {
124
- return document.querySelector(obj)
122
+ if (typeof object === 'string' && object.length > 0) {
123
+ return document.querySelector(object)
125
124
  }
126
125
 
127
126
  return null
128
127
  }
129
128
 
130
- const typeCheckConfig = (componentName, config, configTypes) => {
131
- Object.keys(configTypes).forEach(property => {
132
- const expectedTypes = configTypes[property]
133
- const value = config[property]
134
- const valueType = value && isElement(value) ? 'element' : toType(value)
135
-
136
- if (!new RegExp(expectedTypes).test(valueType)) {
137
- throw new TypeError(
138
- `${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
139
- )
140
- }
141
- })
142
- }
143
-
144
129
  const isVisible = element => {
145
130
  if (!isElement(element) || element.getClientRects().length === 0) {
146
131
  return false
@@ -218,15 +203,12 @@ const noop = () => {}
218
203
  * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
219
204
  */
220
205
  const reflow = element => {
221
- // eslint-disable-next-line no-unused-expressions
222
- element.offsetHeight
206
+ element.offsetHeight // eslint-disable-line no-unused-expressions
223
207
  }
224
208
 
225
209
  const getjQuery = () => {
226
- const { jQuery } = window
227
-
228
- if (jQuery && !document.body.hasAttribute('data-coreui-no-jquery')) {
229
- return jQuery
210
+ if (window.jQuery && !document.body.hasAttribute('data-coreui-no-jquery')) {
211
+ return window.jQuery
230
212
  }
231
213
 
232
214
  return null
@@ -239,7 +221,9 @@ const onDOMContentLoaded = callback => {
239
221
  // add listener on the first call when the document is in loading state
240
222
  if (!DOMContentLoadedCallbacks.length) {
241
223
  document.addEventListener('DOMContentLoaded', () => {
242
- DOMContentLoadedCallbacks.forEach(callback => callback())
224
+ for (const callback of DOMContentLoadedCallbacks) {
225
+ callback()
226
+ }
243
227
  })
244
228
  }
245
229
 
@@ -313,15 +297,15 @@ const executeAfterTransition = (callback, transitionElement, waitForTransition =
313
297
  * @return {Element|elem} The proper element
314
298
  */
315
299
  const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
300
+ const listLength = list.length
316
301
  let index = list.indexOf(activeElement)
317
302
 
318
- // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
303
+ // if the element does not exist in the list return an element
304
+ // depending on the direction and if cycle is allowed
319
305
  if (index === -1) {
320
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]
306
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]
321
307
  }
322
308
 
323
- const listLength = list.length
324
-
325
309
  index += shouldGetNext ? 1 : -1
326
310
 
327
311
  if (isCycleAllowed) {
@@ -332,24 +316,24 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
332
316
  }
333
317
 
334
318
  export {
319
+ defineJQueryPlugin,
320
+ execute,
321
+ executeAfterTransition,
322
+ findShadowRoot,
335
323
  getElement,
336
- getUID,
337
- getSelectorFromElement,
338
324
  getElementFromSelector,
325
+ getjQuery,
326
+ getNextActiveElement,
327
+ getSelectorFromElement,
339
328
  getTransitionDurationFromElement,
340
- triggerTransitionEnd,
329
+ getUID,
330
+ isDisabled,
341
331
  isElement,
342
- typeCheckConfig,
332
+ isRTL,
343
333
  isVisible,
344
- isDisabled,
345
- findShadowRoot,
346
334
  noop,
347
- getNextActiveElement,
348
- reflow,
349
- getjQuery,
350
335
  onDOMContentLoaded,
351
- isRTL,
352
- defineJQueryPlugin,
353
- execute,
354
- executeAfterTransition
336
+ reflow,
337
+ triggerTransitionEnd,
338
+ toType
355
339
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (v4.1.5): alert.js
3
+ * CoreUI (v4.2.1): alert.js
4
4
  * Licensed under MIT (https://coreui.io/license)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's util/sanitizer.js
@@ -46,16 +46,9 @@ const allowedAttribute = (attribute, allowedAttributeList) => {
46
46
  return true
47
47
  }
48
48
 
49
- const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
50
-
51
49
  // Check if a regular expression validates the attribute.
52
- for (let i = 0, len = regExp.length; i < len; i++) {
53
- if (regExp[i].test(attributeName)) {
54
- return true
55
- }
56
- }
57
-
58
- return false
50
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
51
+ .some(regex => regex.test(attributeName))
59
52
  }
60
53
 
61
54
  export const DefaultAllowlist = {
@@ -92,21 +85,20 @@ export const DefaultAllowlist = {
92
85
  ul: []
93
86
  }
94
87
 
95
- export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
88
+ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
96
89
  if (!unsafeHtml.length) {
97
90
  return unsafeHtml
98
91
  }
99
92
 
100
- if (sanitizeFn && typeof sanitizeFn === 'function') {
101
- return sanitizeFn(unsafeHtml)
93
+ if (sanitizeFunction && typeof sanitizeFunction === 'function') {
94
+ return sanitizeFunction(unsafeHtml)
102
95
  }
103
96
 
104
97
  const domParser = new window.DOMParser()
105
98
  const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
106
99
  const elements = [].concat(...createdDocument.body.querySelectorAll('*'))
107
100
 
108
- for (let i = 0, len = elements.length; i < len; i++) {
109
- const element = elements[i]
101
+ for (const element of elements) {
110
102
  const elementName = element.nodeName.toLowerCase()
111
103
 
112
104
  if (!Object.keys(allowList).includes(elementName)) {
@@ -118,11 +110,11 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
118
110
  const attributeList = [].concat(...element.attributes)
119
111
  const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])
120
112
 
121
- attributeList.forEach(attribute => {
113
+ for (const attribute of attributeList) {
122
114
  if (!allowedAttribute(attribute, allowedAttributes)) {
123
115
  element.removeAttribute(attribute.nodeName)
124
116
  }
125
- })
117
+ }
126
118
  }
127
119
 
128
120
  return createdDocument.body.innerHTML