@coreui/coreui 5.0.0-alpha.0 → 5.0.0-alpha.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.
Files changed (207) hide show
  1. package/LICENSE +5 -5
  2. package/README.md +2 -2
  3. package/dist/css/coreui-grid.css +34 -192
  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 +118 -275
  8. package/dist/css/coreui-grid.rtl.css.map +1 -1
  9. package/dist/css/coreui-grid.rtl.min.css +3 -3
  10. package/dist/css/coreui-grid.rtl.min.css.map +1 -1
  11. package/dist/css/coreui-reboot.css +166 -148
  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 +170 -156
  16. package/dist/css/coreui-reboot.rtl.css.map +1 -1
  17. package/dist/css/coreui-reboot.rtl.min.css +3 -3
  18. package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
  19. package/dist/css/coreui-utilities.css +653 -427
  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 +824 -703
  24. package/dist/css/coreui-utilities.rtl.css.map +1 -1
  25. package/dist/css/coreui-utilities.rtl.min.css +3 -3
  26. package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
  27. package/dist/css/coreui.css +2082 -1790
  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 +2333 -2213
  32. package/dist/css/coreui.rtl.css.map +1 -1
  33. package/dist/css/coreui.rtl.min.css +3 -3
  34. package/dist/css/coreui.rtl.min.css.map +1 -1
  35. package/dist/js/coreui.bundle.js +313 -292
  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 +273 -246
  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 +276 -248
  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 +7 -6
  48. package/js/dist/alert.js.map +1 -1
  49. package/js/dist/base-component.js +8 -7
  50. package/js/dist/base-component.js.map +1 -1
  51. package/js/dist/button.js +7 -6
  52. package/js/dist/button.js.map +1 -1
  53. package/js/dist/carousel.js +8 -7
  54. package/js/dist/carousel.js.map +1 -1
  55. package/js/dist/collapse.js +7 -6
  56. package/js/dist/collapse.js.map +1 -1
  57. package/js/dist/dom/data.js +3 -3
  58. package/js/dist/dom/data.js.map +1 -1
  59. package/js/dist/dom/event-handler.js +7 -7
  60. package/js/dist/dom/event-handler.js.map +1 -1
  61. package/js/dist/dom/manipulator.js +4 -4
  62. package/js/dist/dom/manipulator.js.map +1 -1
  63. package/js/dist/dom/selector-engine.js +4 -3
  64. package/js/dist/dom/selector-engine.js.map +1 -1
  65. package/js/dist/dropdown.js +10 -9
  66. package/js/dist/dropdown.js.map +1 -1
  67. package/js/dist/modal.js +9 -10
  68. package/js/dist/modal.js.map +1 -1
  69. package/js/dist/navigation.js +7 -6
  70. package/js/dist/navigation.js.map +1 -1
  71. package/js/dist/offcanvas.js +11 -10
  72. package/js/dist/offcanvas.js.map +1 -1
  73. package/js/dist/popover.js +7 -6
  74. package/js/dist/popover.js.map +1 -1
  75. package/js/dist/scrollspy.js +9 -8
  76. package/js/dist/scrollspy.js.map +1 -1
  77. package/js/dist/sidebar.js +7 -6
  78. package/js/dist/sidebar.js.map +1 -1
  79. package/js/dist/tab.js +21 -12
  80. package/js/dist/tab.js.map +1 -1
  81. package/js/dist/toast.js +7 -6
  82. package/js/dist/toast.js.map +1 -1
  83. package/js/dist/tooltip.js +12 -11
  84. package/js/dist/tooltip.js.map +1 -1
  85. package/js/dist/util/backdrop.js +8 -7
  86. package/js/dist/util/backdrop.js.map +1 -1
  87. package/js/dist/util/component-functions.js +8 -7
  88. package/js/dist/util/component-functions.js.map +1 -1
  89. package/js/dist/util/config.js +8 -7
  90. package/js/dist/util/config.js.map +1 -1
  91. package/js/dist/util/focustrap.js +4 -3
  92. package/js/dist/util/focustrap.js.map +1 -1
  93. package/js/dist/util/index.js +3 -3
  94. package/js/dist/util/index.js.map +1 -1
  95. package/js/dist/util/sanitizer.js +28 -30
  96. package/js/dist/util/sanitizer.js.map +1 -1
  97. package/js/dist/util/scrollbar.js +8 -7
  98. package/js/dist/util/scrollbar.js.map +1 -1
  99. package/js/dist/util/swipe.js +8 -7
  100. package/js/dist/util/swipe.js.map +1 -1
  101. package/js/dist/util/template-factory.js +8 -7
  102. package/js/dist/util/template-factory.js.map +1 -1
  103. package/js/index.esm.js +21 -0
  104. package/js/index.umd.js +38 -0
  105. package/js/src/alert.js +3 -3
  106. package/js/src/base-component.js +3 -3
  107. package/js/src/button.js +4 -3
  108. package/js/src/carousel.js +6 -6
  109. package/js/src/collapse.js +4 -4
  110. package/js/src/dom/data.js +2 -2
  111. package/js/src/dom/event-handler.js +4 -5
  112. package/js/src/dom/manipulator.js +3 -3
  113. package/js/src/dom/selector-engine.js +2 -2
  114. package/js/src/dropdown.js +8 -8
  115. package/js/src/modal.js +8 -9
  116. package/js/src/navigation.js +3 -3
  117. package/js/src/offcanvas.js +11 -11
  118. package/js/src/popover.js +2 -2
  119. package/js/src/scrollspy.js +5 -5
  120. package/js/src/sidebar.js +4 -4
  121. package/js/src/tab.js +19 -9
  122. package/js/src/toast.js +3 -3
  123. package/js/src/tooltip.js +9 -9
  124. package/js/src/util/backdrop.js +3 -3
  125. package/js/src/util/component-functions.js +3 -3
  126. package/js/src/util/config.js +3 -3
  127. package/js/src/util/focustrap.js +2 -2
  128. package/js/src/util/index.js +2 -2
  129. package/js/src/util/sanitizer.js +40 -43
  130. package/js/src/util/scrollbar.js +3 -3
  131. package/js/src/util/swipe.js +3 -3
  132. package/js/src/util/template-factory.js +4 -5
  133. package/package.json +51 -45
  134. package/scss/_alert.scss +5 -5
  135. package/scss/_avatar.scss +4 -4
  136. package/scss/_badge.scss +11 -1
  137. package/scss/_breadcrumb.scss +9 -4
  138. package/scss/_button-group.scss +4 -4
  139. package/scss/_buttons.scss +38 -71
  140. package/scss/_callout.scss +2 -2
  141. package/scss/_card.scss +4 -3
  142. package/scss/_carousel.scss +9 -3
  143. package/scss/_close.scss +3 -0
  144. package/scss/_dropdown.scss +14 -14
  145. package/scss/_functions.scss +59 -0
  146. package/scss/_grid.scss +8 -0
  147. package/scss/_header.scss +186 -0
  148. package/scss/_helpers.scss +2 -0
  149. package/scss/_images.scss +3 -3
  150. package/scss/_list-group.scss +12 -19
  151. package/scss/_maps.scss +75 -21
  152. package/scss/_mixins.scss +6 -4
  153. package/scss/_modal.scss +2 -2
  154. package/scss/_nav.scss +8 -20
  155. package/scss/_navbar.scss +11 -8
  156. package/scss/_offcanvas.scss +8 -8
  157. package/scss/_pagination.scss +2 -2
  158. package/scss/_progress.scss +43 -0
  159. package/scss/_reboot.scss +23 -25
  160. package/scss/_root.scss +70 -63
  161. package/scss/_sidebar.scss +0 -11
  162. package/scss/_tables.scss +18 -11
  163. package/scss/_toasts.scss +2 -2
  164. package/scss/_tooltip.scss +14 -15
  165. package/scss/_type.scss +1 -1
  166. package/scss/_utilities.scss +117 -65
  167. package/scss/_variables-dark.scss +112 -61
  168. package/scss/_variables.scss +401 -268
  169. package/scss/coreui-grid.rtl.scss +4 -0
  170. package/scss/coreui-grid.scss +2 -5
  171. package/scss/coreui-reboot.rtl.scss +4 -0
  172. package/scss/coreui-reboot.scss +1 -1
  173. package/scss/coreui-utilities.rtl.scss +4 -0
  174. package/scss/coreui-utilities.scss +1 -1
  175. package/scss/coreui.rtl.scss +4 -0
  176. package/scss/coreui.scss +3 -3
  177. package/scss/forms/_floating-labels.scss +21 -16
  178. package/scss/forms/_form-check.scss +41 -20
  179. package/scss/forms/_form-control.scss +18 -5
  180. package/scss/forms/_form-range.scss +3 -3
  181. package/scss/forms/_form-select.scss +7 -8
  182. package/scss/forms/_input-group.scss +5 -5
  183. package/scss/helpers/_color-bg.scss +13 -4
  184. package/scss/helpers/_colored-links.scss +20 -2
  185. package/scss/helpers/_focus-ring.scss +5 -0
  186. package/scss/helpers/_icon-link.scss +25 -0
  187. package/scss/helpers/_ratio.scss +1 -1
  188. package/scss/helpers/_vr.scss +2 -1
  189. package/scss/mixins/_alert.scss +1 -1
  190. package/scss/mixins/_banner.scss +3 -3
  191. package/scss/mixins/_border-radius.scss +7 -7
  192. package/scss/mixins/_buttons.scss +53 -49
  193. package/scss/mixins/_caret.scss +3 -3
  194. package/scss/mixins/_forms.scss +7 -7
  195. package/scss/mixins/_grid.scss +1 -1
  196. package/scss/mixins/_list-group.scss +12 -20
  197. package/scss/mixins/_lists.scss +1 -1
  198. package/scss/mixins/_ltr-rtl.scss +87 -0
  199. package/scss/mixins/_utilities.scss +6 -1
  200. package/scss/mixins/_visually-hidden.scss +5 -1
  201. package/scss/sidebar/_sidebar-narrow.scss +37 -17
  202. package/scss/sidebar/_sidebar-nav.scss +115 -20
  203. package/scss/sidebar/_sidebar.scss +98 -139
  204. package/scss/vendor/_rfs.scss +24 -30
  205. package/scss/tests/mixins/_color-modes.test.scss +0 -69
  206. package/scss/tests/mixins/_utilities.test.scss +0 -393
  207. package/scss/tests/utilities/_api.test.scss +0 -75
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): dom/manipulator.js
3
+ * CoreUI dom/manipulator.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's dom/manipulator.js
6
+ * This is a modified version of the Bootstrap's dom/manipulator.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
@@ -55,7 +55,7 @@ const Manipulator = {
55
55
  }
56
56
 
57
57
  const attributes = {}
58
- const coreuiKeys = Object.keys(element.dataset).filter(key => key.startsWith('coreu') && !key.startsWith('coreuiConfig'))
58
+ const coreuiKeys = Object.keys(element.dataset).filter(key => key.startsWith('coreui') && !key.startsWith('coreuiConfig'))
59
59
 
60
60
  for (const key of coreuiKeys) {
61
61
  let pureKey = key.replace(/^coreui/, '')
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): dom/selector-engine.js
3
+ * CoreUI dom/selector-engine.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's dom/selector-engine.js
6
+ * This is a modified version of the Bootstrap's dom/selector-engine.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): dropdown.js
3
+ * CoreUI dropdown.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's dropdown.js
@@ -9,6 +9,10 @@
9
9
  */
10
10
 
11
11
  import * as Popper from '@popperjs/core'
12
+ import BaseComponent from './base-component.js'
13
+ import EventHandler from './dom/event-handler.js'
14
+ import Manipulator from './dom/manipulator.js'
15
+ import SelectorEngine from './dom/selector-engine.js'
12
16
  import {
13
17
  defineJQueryPlugin,
14
18
  execute,
@@ -20,10 +24,6 @@ import {
20
24
  isVisible,
21
25
  noop
22
26
  } 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'
27
27
 
28
28
  /**
29
29
  * Constants
@@ -99,7 +99,7 @@ class Dropdown extends BaseComponent {
99
99
 
100
100
  this._popper = null
101
101
  this._parent = this._element.parentNode // dropdown wrapper
102
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
102
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
103
103
  this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
104
104
  SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
105
105
  SelectorEngine.findOne(SELECTOR_MENU, this._parent)
@@ -314,7 +314,7 @@ class Dropdown extends BaseComponent {
314
314
 
315
315
  // Disable Popper if we have a static display or Dropdown is in Navbar
316
316
  if (this._inNavbar || this._config.display === 'static') {
317
- Manipulator.setDataAttribute(this._menu, 'popper', 'static') // todo:v6 remove
317
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static') // TODO: v6 remove
318
318
  defaultBsPopperConfig.modifiers = [{
319
319
  name: 'applyStyles',
320
320
  enabled: false
@@ -412,7 +412,7 @@ class Dropdown extends BaseComponent {
412
412
 
413
413
  event.preventDefault()
414
414
 
415
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
415
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
416
416
  const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?
417
417
  this :
418
418
  (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||
package/js/src/modal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): modal.js
3
+ * CoreUI modal.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/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, isRTL, isVisible, reflow } from './util/index.js'
11
+ import BaseComponent from './base-component.js'
12
12
  import EventHandler from './dom/event-handler.js'
13
13
  import SelectorEngine from './dom/selector-engine.js'
14
- import ScrollBarHelper from './util/scrollbar.js'
15
- import BaseComponent from './base-component.js'
16
14
  import Backdrop from './util/backdrop.js'
17
- import FocusTrap from './util/focustrap.js'
18
15
  import { enableDismissTrigger } from './util/component-functions.js'
16
+ import FocusTrap from './util/focustrap.js'
17
+ import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js'
18
+ import ScrollBarHelper from './util/scrollbar.js'
19
19
 
20
20
  /**
21
21
  * Constants
@@ -142,12 +142,12 @@ class Modal extends BaseComponent {
142
142
  }
143
143
 
144
144
  dispose() {
145
- for (const htmlElement of [window, this._dialog]) {
146
- EventHandler.off(htmlElement, EVENT_KEY)
147
- }
145
+ EventHandler.off(window, EVENT_KEY)
146
+ EventHandler.off(this._dialog, EVENT_KEY)
148
147
 
149
148
  this._backdrop.dispose()
150
149
  this._focustrap.deactivate()
150
+
151
151
  super.dispose()
152
152
  }
153
153
 
@@ -211,7 +211,6 @@ class Modal extends BaseComponent {
211
211
  }
212
212
 
213
213
  if (this._config.keyboard) {
214
- event.preventDefault()
215
214
  this.hide()
216
215
  return
217
216
  }
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): navigation.js
3
+ * CoreUI navigation.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
- import { defineJQueryPlugin } from './util/index.js'
8
+ import BaseComponent from './base-component.js'
9
9
  import Data from './dom/data.js'
10
10
  import EventHandler from './dom/event-handler.js'
11
11
  import Manipulator from './dom/manipulator.js'
12
12
  import SelectorEngine from './dom/selector-engine.js'
13
- import BaseComponent from './base-component.js'
13
+ import { defineJQueryPlugin } from './util/index.js'
14
14
 
15
15
  /**
16
16
  * ------------------------------------------------------------------------
@@ -1,25 +1,25 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): offcanvas.js
3
+ * CoreUI offcanvas.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's offcanvas.js
7
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
+ import BaseComponent from './base-component.js'
12
+ import EventHandler from './dom/event-handler.js'
13
+ import SelectorEngine from './dom/selector-engine.js'
14
+ import Backdrop from './util/backdrop.js'
15
+ import { enableDismissTrigger } from './util/component-functions.js'
16
+ import FocusTrap from './util/focustrap.js'
11
17
  import {
12
18
  defineJQueryPlugin,
13
19
  isDisabled,
14
20
  isVisible
15
21
  } from './util/index.js'
16
22
  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'
23
23
 
24
24
  /**
25
25
  * Constants
@@ -201,12 +201,12 @@ class Offcanvas extends BaseComponent {
201
201
  return
202
202
  }
203
203
 
204
- if (!this._config.keyboard) {
205
- EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)
204
+ if (this._config.keyboard) {
205
+ this.hide()
206
206
  return
207
207
  }
208
208
 
209
- this.hide()
209
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)
210
210
  })
211
211
  }
212
212
 
package/js/src/popover.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): popover.js
3
+ * CoreUI popover.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/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.js'
12
11
  import Tooltip from './tooltip.js'
12
+ import { defineJQueryPlugin } from './util/index.js'
13
13
 
14
14
  /**
15
15
  * Constants
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): scrollspy.js
3
+ * CoreUI scrollspy.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's scrollspy.js
@@ -8,10 +8,10 @@
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js'
11
+ import BaseComponent from './base-component.js'
12
12
  import EventHandler from './dom/event-handler.js'
13
13
  import SelectorEngine from './dom/selector-engine.js'
14
- import BaseComponent from './base-component.js'
14
+ import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js'
15
15
 
16
16
  /**
17
17
  * Constants
@@ -211,11 +211,11 @@ class ScrollSpy extends BaseComponent {
211
211
  continue
212
212
  }
213
213
 
214
- const observableSection = SelectorEngine.findOne(anchor.hash, this._element)
214
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element)
215
215
 
216
216
  // ensure that the observableSection exists & is visible
217
217
  if (isVisible(observableSection)) {
218
- this._targetLinks.set(anchor.hash, anchor)
218
+ this._targetLinks.set(decodeURI(anchor.hash), anchor)
219
219
  this._observableSections.set(anchor.hash, observableSection)
220
220
  }
221
221
  }
package/js/src/sidebar.js CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): sidebar.js
3
+ * CoreUI sidebar.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
 
8
- import { defineJQueryPlugin } from './util/index.js'
9
- import ScrollBarHelper from './util/scrollbar.js'
10
- import EventHandler from './dom/event-handler.js'
11
8
  import BaseComponent from './base-component.js'
9
+ import EventHandler from './dom/event-handler.js'
12
10
  import Manipulator from './dom/manipulator.js'
11
+ import { defineJQueryPlugin } from './util/index.js'
13
12
  import Backdrop from './util/backdrop.js'
13
+ import ScrollBarHelper from './util/scrollbar.js'
14
14
 
15
15
  /**
16
16
  * ------------------------------------------------------------------------
package/js/src/tab.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): tab.js
3
+ * CoreUI tab.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/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, getNextActiveElement, isDisabled } from './util/index.js'
11
+ import BaseComponent from './base-component.js'
12
12
  import EventHandler from './dom/event-handler.js'
13
13
  import SelectorEngine from './dom/selector-engine.js'
14
- import BaseComponent from './base-component.js'
14
+ import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js'
15
15
 
16
16
  /**
17
17
  * Constants
@@ -33,6 +33,8 @@ const ARROW_LEFT_KEY = 'ArrowLeft'
33
33
  const ARROW_RIGHT_KEY = 'ArrowRight'
34
34
  const ARROW_UP_KEY = 'ArrowUp'
35
35
  const ARROW_DOWN_KEY = 'ArrowDown'
36
+ const HOME_KEY = 'Home'
37
+ const END_KEY = 'End'
36
38
 
37
39
  const CLASS_NAME_ACTIVE = 'active'
38
40
  const CLASS_NAME_FADE = 'fade'
@@ -46,7 +48,7 @@ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'
46
48
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
47
49
  const SELECTOR_OUTER = '.nav-item, .list-group-item'
48
50
  const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`
49
- const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="tab"], [data-coreui-toggle="pill"], [data-coreui-toggle="list"]' // todo:v6: could be only `tab`
51
+ const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="tab"], [data-coreui-toggle="pill"], [data-coreui-toggle="list"]' // TODO: could only be `tab` in v6
50
52
  const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`
51
53
 
52
54
  const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-coreui-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-coreui-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-coreui-toggle="list"]`
@@ -62,7 +64,7 @@ class Tab extends BaseComponent {
62
64
 
63
65
  if (!this._parent) {
64
66
  return
65
- // todo: should Throw exception on v6
67
+ // TODO: should throw exception in v6
66
68
  // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
67
69
  }
68
70
 
@@ -154,14 +156,22 @@ class Tab extends BaseComponent {
154
156
  }
155
157
 
156
158
  _keydown(event) {
157
- if (!([ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key))) {
159
+ if (!([ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key))) {
158
160
  return
159
161
  }
160
162
 
161
163
  event.stopPropagation()// stopPropagation/preventDefault both added to support up/down keys without scrolling the page
162
164
  event.preventDefault()
163
- const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key)
164
- const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true)
165
+
166
+ const children = this._getChildren().filter(element => !isDisabled(element))
167
+ let nextActiveElement
168
+
169
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
170
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]
171
+ } else {
172
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key)
173
+ nextActiveElement = getNextActiveElement(children, event.target, isNext, true)
174
+ }
165
175
 
166
176
  if (nextActiveElement) {
167
177
  nextActiveElement.focus({ preventScroll: true })
@@ -215,7 +225,7 @@ class Tab extends BaseComponent {
215
225
  this._setAttributeIfNotExists(target, 'role', 'tabpanel')
216
226
 
217
227
  if (child.id) {
218
- this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`)
228
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`)
219
229
  }
220
230
  }
221
231
 
package/js/src/toast.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): toast.js
3
+ * CoreUI toast.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/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.js'
12
- import EventHandler from './dom/event-handler.js'
13
11
  import BaseComponent from './base-component.js'
12
+ import EventHandler from './dom/event-handler.js'
14
13
  import { enableDismissTrigger } from './util/component-functions.js'
14
+ import { defineJQueryPlugin, reflow } from './util/index.js'
15
15
 
16
16
  /**
17
17
  * Constants
package/js/src/tooltip.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): tooltip.js
3
+ * CoreUI tooltip.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
6
  * This component is a modified version of the Bootstrap's tooltip.js
@@ -9,11 +9,11 @@
9
9
  */
10
10
 
11
11
  import * as Popper from '@popperjs/core'
12
- import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js'
13
- import { DefaultAllowlist } from './util/sanitizer.js'
12
+ import BaseComponent from './base-component.js'
14
13
  import EventHandler from './dom/event-handler.js'
15
14
  import Manipulator from './dom/manipulator.js'
16
- import BaseComponent from './base-component.js'
15
+ import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js'
16
+ import { DefaultAllowlist } from './util/sanitizer.js'
17
17
  import TemplateFactory from './util/template-factory.js'
18
18
 
19
19
  /**
@@ -65,7 +65,7 @@ const Default = {
65
65
  delay: 0,
66
66
  fallbackPlacements: ['top', 'right', 'bottom', 'left'],
67
67
  html: false,
68
- offset: [0, 0],
68
+ offset: [0, 6],
69
69
  placement: 'top',
70
70
  popperConfig: null,
71
71
  sanitize: true,
@@ -200,7 +200,7 @@ class Tooltip extends BaseComponent {
200
200
  return
201
201
  }
202
202
 
203
- // todo v6 remove this OR make it optional
203
+ // TODO: v6 remove this or make it optional
204
204
  this._disposePopper()
205
205
 
206
206
  const tip = this._getTipElement()
@@ -305,14 +305,14 @@ class Tooltip extends BaseComponent {
305
305
  _createTipElement(content) {
306
306
  const tip = this._getTemplateFactory(content).toHtml()
307
307
 
308
- // todo: remove this check on v6
308
+ // TODO: remove this check in v6
309
309
  if (!tip) {
310
310
  return null
311
311
  }
312
312
 
313
313
  tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
314
- // todo: on v6 the following can be achieved with CSS only
315
- tip.classList.add(`cui-${this.constructor.NAME}-auto`)
314
+ // TODO: v6 the following can be achieved with CSS only
315
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`)
316
316
 
317
317
  const tipId = getUID(this.constructor.NAME).toString()
318
318
 
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/backdrop.js
3
+ * CoreUI util/backdrop.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/backdrop.js
6
+ * This is a modified version of the Bootstrap's util/backdrop.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
11
  import EventHandler from '../dom/event-handler.js'
12
- import { execute, executeAfterTransition, getElement, reflow } from './index.js'
13
12
  import Config from './config.js'
13
+ import { execute, executeAfterTransition, getElement, reflow } from './index.js'
14
14
 
15
15
  /**
16
16
  * Constants
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/component-functions.js
3
+ * CoreUI util/component-functions.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/component-functions.js
6
+ * This is a modified version of the Bootstrap's util/component-functions.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
11
  import EventHandler from '../dom/event-handler.js'
12
- import { isDisabled } from './index.js'
13
12
  import SelectorEngine from '../dom/selector-engine.js'
13
+ import { isDisabled } from './index.js'
14
14
 
15
15
  const enableDismissTrigger = (component, method = 'hide') => {
16
16
  const clickEvent = `click.dismiss${component.EVENT_KEY}`
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/config.js
3
+ * CoreUI util/config.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/config.js
6
+ * This is a modified version of the Bootstrap's util/config.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import { isElement, toType } from './index.js'
12
11
  import Manipulator from '../dom/manipulator.js'
12
+ import { isElement, toType } from './index.js'
13
13
 
14
14
  /**
15
15
  * Class definition
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/focustrap.js
3
+ * CoreUI util/focustrap.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/focustrap.js
6
+ * This is a modified version of the Bootstrap's util/focustrap.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/index.js
3
+ * CoreUI util/index.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/index.js
6
+ * This is a modified version of the Bootstrap's util/index.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
@@ -1,56 +1,16 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/sanitizer.js
3
+ * CoreUI util/sanitizer.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/sanitizer.js
6
+ * This is a modified version of the Bootstrap's util/sanitizer.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- const uriAttributes = new Set([
12
- 'background',
13
- 'cite',
14
- 'href',
15
- 'itemtype',
16
- 'longdesc',
17
- 'poster',
18
- 'src',
19
- 'xlink:href'
20
- ])
21
-
11
+ // js-docs-start allow-list
22
12
  const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
23
13
 
24
- /**
25
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
26
- *
27
- * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
28
- */
29
- const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i
30
-
31
- /**
32
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
33
- *
34
- * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
35
- */
36
- const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i
37
-
38
- const allowedAttribute = (attribute, allowedAttributeList) => {
39
- const attributeName = attribute.nodeName.toLowerCase()
40
-
41
- if (allowedAttributeList.includes(attributeName)) {
42
- if (uriAttributes.has(attributeName)) {
43
- return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue))
44
- }
45
-
46
- return true
47
- }
48
-
49
- // Check if a regular expression validates the attribute.
50
- return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
51
- .some(regex => regex.test(attributeName))
52
- }
53
-
54
14
  export const DefaultAllowlist = {
55
15
  // Global attributes allowed on any supplied element below.
56
16
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
@@ -84,6 +44,43 @@ export const DefaultAllowlist = {
84
44
  u: [],
85
45
  ul: []
86
46
  }
47
+ // js-docs-end allow-list
48
+
49
+ const uriAttributes = new Set([
50
+ 'background',
51
+ 'cite',
52
+ 'href',
53
+ 'itemtype',
54
+ 'longdesc',
55
+ 'poster',
56
+ 'src',
57
+ 'xlink:href'
58
+ ])
59
+
60
+ /**
61
+ * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
62
+ * contexts.
63
+ *
64
+ * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
65
+ */
66
+ // eslint-disable-next-line unicorn/better-regex
67
+ const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i
68
+
69
+ const allowedAttribute = (attribute, allowedAttributeList) => {
70
+ const attributeName = attribute.nodeName.toLowerCase()
71
+
72
+ if (allowedAttributeList.includes(attributeName)) {
73
+ if (uriAttributes.has(attributeName)) {
74
+ return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue))
75
+ }
76
+
77
+ return true
78
+ }
79
+
80
+ // Check if a regular expression validates the attribute.
81
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
82
+ .some(regex => regex.test(attributeName))
83
+ }
87
84
 
88
85
  export function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
89
86
  if (!unsafeHtml.length) {
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * --------------------------------------------------------------------------
3
- * CoreUI (__COREUI_VERSION__): util/scrollBar.js
3
+ * CoreUI util/scrollBar.js
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  *
6
- * This component is a modified version of the Bootstrap's util/scrollBar.js
6
+ * This is a modified version of the Bootstrap's util/scrollBar.js
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  * --------------------------------------------------------------------------
9
9
  */
10
10
 
11
- import SelectorEngine from '../dom/selector-engine.js'
12
11
  import Manipulator from '../dom/manipulator.js'
12
+ import SelectorEngine from '../dom/selector-engine.js'
13
13
  import { isElement } from './index.js'
14
14
 
15
15
  /**