@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,5 +1,5 @@
1
1
  /*!
2
- * CoreUI v5.0.0-alpha.0 (https://coreui.io)
2
+ * CoreUI v5.0.0-alpha.2 (https://coreui.io)
3
3
  * Copyright 2023 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
5
  */
@@ -7,10 +7,61 @@ import * as Popper from '@popperjs/core';
7
7
 
8
8
  /**
9
9
  * --------------------------------------------------------------------------
10
- * CoreUI (v5.0.0-alpha.0): util/index.js
10
+ * CoreUI dom/data.js
11
11
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
12
12
  *
13
- * This component is a modified version of the Bootstrap's util/index.js
13
+ * This is a modified version of the Bootstrap's dom/data.js
14
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
15
+ * --------------------------------------------------------------------------
16
+ */
17
+
18
+ /**
19
+ * Constants
20
+ */
21
+
22
+ const elementMap = new Map();
23
+ const Data = {
24
+ set(element, key, instance) {
25
+ if (!elementMap.has(element)) {
26
+ elementMap.set(element, new Map());
27
+ }
28
+ const instanceMap = elementMap.get(element);
29
+
30
+ // make it clear we only want one instance per element
31
+ // can be removed later when multiple key/instances are fine to be used
32
+ if (!instanceMap.has(key) && instanceMap.size !== 0) {
33
+ // eslint-disable-next-line no-console
34
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
35
+ return;
36
+ }
37
+ instanceMap.set(key, instance);
38
+ },
39
+ get(element, key) {
40
+ if (elementMap.has(element)) {
41
+ return elementMap.get(element).get(key) || null;
42
+ }
43
+ return null;
44
+ },
45
+ remove(element, key) {
46
+ if (!elementMap.has(element)) {
47
+ return;
48
+ }
49
+ const instanceMap = elementMap.get(element);
50
+ instanceMap.delete(key);
51
+
52
+ // free up element references if there are no instances left for an element
53
+ if (instanceMap.size === 0) {
54
+ elementMap.delete(element);
55
+ }
56
+ }
57
+ };
58
+
59
+ /**
60
+ * --------------------------------------------------------------------------
61
+ * CoreUI util/index.js
62
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
63
+ *
64
+ * This is a modified version of the Bootstrap's util/index.js
14
65
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
15
66
  * --------------------------------------------------------------------------
16
67
  */
@@ -257,14 +308,15 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
257
308
 
258
309
  /**
259
310
  * --------------------------------------------------------------------------
260
- * CoreUI (v5.0.0-alpha.0): dom/event-handler.js
311
+ * CoreUI dom/event-handler.js
261
312
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
262
313
  *
263
- * This component is a modified version of the Bootstrap's dom/event-handler.js
314
+ * This is a modified version of the Bootstrap's dom/event-handler.js
264
315
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
265
316
  * --------------------------------------------------------------------------
266
317
  */
267
318
 
319
+
268
320
  /**
269
321
  * Constants
270
322
  */
@@ -330,7 +382,7 @@ function findHandler(events, callable, delegationSelector = null) {
330
382
  }
331
383
  function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
332
384
  const isDelegated = typeof handler === 'string';
333
- // todo: tooltip passes `false` instead of selector, so we need to check
385
+ // TODO: tooltip passes `false` instead of selector, so we need to check
334
386
  const callable = isDelegated ? delegationFunction : handler || delegationFunction;
335
387
  let typeEvent = getTypeEvent(originalTypeEvent);
336
388
  if (!nativeEvents.has(typeEvent)) {
@@ -447,11 +499,10 @@ const EventHandler = {
447
499
  nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
448
500
  defaultPrevented = jQueryEvent.isDefaultPrevented();
449
501
  }
450
- let evt = new Event(event, {
502
+ const evt = hydrateObj(new Event(event, {
451
503
  bubbles,
452
504
  cancelable: true
453
- });
454
- evt = hydrateObj(evt, args);
505
+ }), args);
455
506
  if (defaultPrevented) {
456
507
  evt.preventDefault();
457
508
  }
@@ -482,61 +533,10 @@ function hydrateObj(obj, meta = {}) {
482
533
 
483
534
  /**
484
535
  * --------------------------------------------------------------------------
485
- * CoreUI (v5.0.0-alpha.0): dom/data.js
486
- * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
487
- *
488
- * This component is a modified version of the Bootstrap's dom/data.js
489
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
490
- * --------------------------------------------------------------------------
491
- */
492
-
493
- /**
494
- * Constants
495
- */
496
-
497
- const elementMap = new Map();
498
- const Data = {
499
- set(element, key, instance) {
500
- if (!elementMap.has(element)) {
501
- elementMap.set(element, new Map());
502
- }
503
- const instanceMap = elementMap.get(element);
504
-
505
- // make it clear we only want one instance per element
506
- // can be removed later when multiple key/instances are fine to be used
507
- if (!instanceMap.has(key) && instanceMap.size !== 0) {
508
- // eslint-disable-next-line no-console
509
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
510
- return;
511
- }
512
- instanceMap.set(key, instance);
513
- },
514
- get(element, key) {
515
- if (elementMap.has(element)) {
516
- return elementMap.get(element).get(key) || null;
517
- }
518
- return null;
519
- },
520
- remove(element, key) {
521
- if (!elementMap.has(element)) {
522
- return;
523
- }
524
- const instanceMap = elementMap.get(element);
525
- instanceMap.delete(key);
526
-
527
- // free up element references if there are no instances left for an element
528
- if (instanceMap.size === 0) {
529
- elementMap.delete(element);
530
- }
531
- }
532
- };
533
-
534
- /**
535
- * --------------------------------------------------------------------------
536
- * CoreUI (v5.0.0-alpha.0): dom/manipulator.js
536
+ * CoreUI dom/manipulator.js
537
537
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
538
538
  *
539
- * This component is a modified version of the Bootstrap's dom/manipulator.js
539
+ * This is a modified version of the Bootstrap's dom/manipulator.js
540
540
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
541
541
  * --------------------------------------------------------------------------
542
542
  */
@@ -578,7 +578,7 @@ const Manipulator = {
578
578
  return {};
579
579
  }
580
580
  const attributes = {};
581
- const coreuiKeys = Object.keys(element.dataset).filter(key => key.startsWith('coreu') && !key.startsWith('coreuiConfig'));
581
+ const coreuiKeys = Object.keys(element.dataset).filter(key => key.startsWith('coreui') && !key.startsWith('coreuiConfig'));
582
582
  for (const key of coreuiKeys) {
583
583
  let pureKey = key.replace(/^coreui/, '');
584
584
  pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
@@ -593,14 +593,15 @@ const Manipulator = {
593
593
 
594
594
  /**
595
595
  * --------------------------------------------------------------------------
596
- * CoreUI (v5.0.0-alpha.0): util/config.js
596
+ * CoreUI util/config.js
597
597
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
598
598
  *
599
- * This component is a modified version of the Bootstrap's util/config.js
599
+ * This is a modified version of the Bootstrap's util/config.js
600
600
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
601
601
  * --------------------------------------------------------------------------
602
602
  */
603
603
 
604
+
604
605
  /**
605
606
  * Class definition
606
607
  */
@@ -648,7 +649,7 @@ class Config {
648
649
 
649
650
  /**
650
651
  * --------------------------------------------------------------------------
651
- * CoreUI (v5.0.0-alpha.0): base-component.js
652
+ * CoreUI base-component.js
652
653
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
653
654
  *
654
655
  * This component is a modified version of the Bootstrap's base-component.js
@@ -656,11 +657,12 @@ class Config {
656
657
  * --------------------------------------------------------------------------
657
658
  */
658
659
 
660
+
659
661
  /**
660
662
  * Constants
661
663
  */
662
664
 
663
- const VERSION = '5.0.0-alpha.0';
665
+ const VERSION = '5.0.0-alpha.2';
664
666
 
665
667
  /**
666
668
  * Class definition
@@ -719,13 +721,14 @@ class BaseComponent extends Config {
719
721
 
720
722
  /**
721
723
  * --------------------------------------------------------------------------
722
- * CoreUI (v5.0.0-alpha.0): dom/selector-engine.js
724
+ * CoreUI dom/selector-engine.js
723
725
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
724
726
  *
725
- * This component is a modified version of the Bootstrap's dom/selector-engine.js
727
+ * This is a modified version of the Bootstrap's dom/selector-engine.js
726
728
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
727
729
  * --------------------------------------------------------------------------
728
730
  */
731
+
729
732
  const getSelector = element => {
730
733
  let selector = element.getAttribute('data-coreui-target');
731
734
  if (!selector || selector === '#') {
@@ -810,13 +813,14 @@ const SelectorEngine = {
810
813
 
811
814
  /**
812
815
  * --------------------------------------------------------------------------
813
- * CoreUI (v5.0.0-alpha.0): util/component-functions.js
816
+ * CoreUI util/component-functions.js
814
817
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
815
818
  *
816
- * This component is a modified version of the Bootstrap's util/component-functions.js
819
+ * This is a modified version of the Bootstrap's util/component-functions.js
817
820
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
818
821
  * --------------------------------------------------------------------------
819
822
  */
823
+
820
824
  const enableDismissTrigger = (component, method = 'hide') => {
821
825
  const clickEvent = `click.dismiss${component.EVENT_KEY}`;
822
826
  const name = component.NAME;
@@ -837,7 +841,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
837
841
 
838
842
  /**
839
843
  * --------------------------------------------------------------------------
840
- * CoreUI (v5.0.0-alpha.0): alert.js
844
+ * CoreUI alert.js
841
845
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
842
846
  *
843
847
  * This component is a modified version of the Bootstrap's alert.js
@@ -845,6 +849,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
845
849
  * --------------------------------------------------------------------------
846
850
  */
847
851
 
852
+
848
853
  /**
849
854
  * Constants
850
855
  */
@@ -914,7 +919,7 @@ defineJQueryPlugin(Alert);
914
919
 
915
920
  /**
916
921
  * --------------------------------------------------------------------------
917
- * CoreUI (v5.0.0-alpha.0): button.js
922
+ * CoreUI button.js
918
923
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
919
924
  *
920
925
  * This component is a modified version of the Bootstrap's button.js
@@ -922,6 +927,7 @@ defineJQueryPlugin(Alert);
922
927
  * --------------------------------------------------------------------------
923
928
  */
924
929
 
930
+
925
931
  /**
926
932
  * Constants
927
933
  */
@@ -980,14 +986,15 @@ defineJQueryPlugin(Button);
980
986
 
981
987
  /**
982
988
  * --------------------------------------------------------------------------
983
- * CoreUI (v5.0.0-alpha.0): util/swipe.js
989
+ * CoreUI util/swipe.js
984
990
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
985
991
  *
986
- * This component is a modified version of the Bootstrap's util/swipe.js
992
+ * This is a modified version of the Bootstrap's util/swipe.js
987
993
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
988
994
  * --------------------------------------------------------------------------
989
995
  */
990
996
 
997
+
991
998
  /**
992
999
  * Constants
993
1000
  */
@@ -1102,7 +1109,7 @@ class Swipe extends Config {
1102
1109
 
1103
1110
  /**
1104
1111
  * --------------------------------------------------------------------------
1105
- * CoreUI (v5.0.0-alpha.0): carousel.js
1112
+ * CoreUI carousel.js
1106
1113
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
1107
1114
  *
1108
1115
  * This component is a modified version of the Bootstrap's carousel.js
@@ -1110,6 +1117,7 @@ class Swipe extends Config {
1110
1117
  * --------------------------------------------------------------------------
1111
1118
  */
1112
1119
 
1120
+
1113
1121
  /**
1114
1122
  * Constants
1115
1123
  */
@@ -1365,7 +1373,7 @@ class Carousel extends BaseComponent {
1365
1373
  }
1366
1374
  if (!activeElement || !nextElement) {
1367
1375
  // Some weirdness is happening, so we bail
1368
- // todo: change tests that use empty divs to avoid this check
1376
+ // TODO: change tests that use empty divs to avoid this check
1369
1377
  return;
1370
1378
  }
1371
1379
  const isCycling = Boolean(this._interval);
@@ -1477,7 +1485,7 @@ defineJQueryPlugin(Carousel);
1477
1485
 
1478
1486
  /**
1479
1487
  * --------------------------------------------------------------------------
1480
- * CoreUI (v5.0.0-alpha.0): collapse.js
1488
+ * CoreUI collapse.js
1481
1489
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
1482
1490
  *
1483
1491
  * This component is a modified version of the Bootstrap's collapse.js
@@ -1485,6 +1493,7 @@ defineJQueryPlugin(Carousel);
1485
1493
  * --------------------------------------------------------------------------
1486
1494
  */
1487
1495
 
1496
+
1488
1497
  /**
1489
1498
  * Constants
1490
1499
  */
@@ -1713,7 +1722,7 @@ defineJQueryPlugin(Collapse);
1713
1722
 
1714
1723
  /**
1715
1724
  * --------------------------------------------------------------------------
1716
- * CoreUI (v5.0.0-alpha.0): dropdown.js
1725
+ * CoreUI dropdown.js
1717
1726
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
1718
1727
  *
1719
1728
  * This component is a modified version of the Bootstrap's dropdown.js
@@ -1721,6 +1730,7 @@ defineJQueryPlugin(Collapse);
1721
1730
  * --------------------------------------------------------------------------
1722
1731
  */
1723
1732
 
1733
+
1724
1734
  /**
1725
1735
  * Constants
1726
1736
  */
@@ -1788,7 +1798,7 @@ class Dropdown extends BaseComponent {
1788
1798
  super(element, config);
1789
1799
  this._popper = null;
1790
1800
  this._parent = this._element.parentNode; // dropdown wrapper
1791
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
1801
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
1792
1802
  this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
1793
1803
  this._inNavbar = this._detectNavbar();
1794
1804
  }
@@ -1962,7 +1972,7 @@ class Dropdown extends BaseComponent {
1962
1972
 
1963
1973
  // Disable Popper if we have a static display or Dropdown is in Navbar
1964
1974
  if (this._inNavbar || this._config.display === 'static') {
1965
- Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // todo:v6 remove
1975
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove
1966
1976
  defaultBsPopperConfig.modifiers = [{
1967
1977
  name: 'applyStyles',
1968
1978
  enabled: false
@@ -2044,7 +2054,7 @@ class Dropdown extends BaseComponent {
2044
2054
  }
2045
2055
  event.preventDefault();
2046
2056
 
2047
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
2057
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
2048
2058
  const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$4) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$4)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$4)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$4, event.delegateTarget.parentNode);
2049
2059
  const instance = Dropdown.getOrCreateInstance(getToggleButton);
2050
2060
  if (isUpOrDownEvent) {
@@ -2083,113 +2093,14 @@ defineJQueryPlugin(Dropdown);
2083
2093
 
2084
2094
  /**
2085
2095
  * --------------------------------------------------------------------------
2086
- * CoreUI (v5.0.0-alpha.0): util/scrollBar.js
2096
+ * CoreUI util/backdrop.js
2087
2097
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2088
2098
  *
2089
- * This component is a modified version of the Bootstrap's util/scrollBar.js
2099
+ * This is a modified version of the Bootstrap's util/backdrop.js
2090
2100
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2091
2101
  * --------------------------------------------------------------------------
2092
2102
  */
2093
2103
 
2094
- /**
2095
- * Constants
2096
- */
2097
-
2098
- const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
2099
- const SELECTOR_STICKY_CONTENT = '.sticky-top';
2100
- const PROPERTY_PADDING = 'padding-right';
2101
- const PROPERTY_MARGIN = 'margin-right';
2102
-
2103
- /**
2104
- * Class definition
2105
- */
2106
-
2107
- class ScrollBarHelper {
2108
- constructor() {
2109
- this._element = document.body;
2110
- }
2111
-
2112
- // Public
2113
- getWidth() {
2114
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
2115
- const documentWidth = document.documentElement.clientWidth;
2116
- return Math.abs(window.innerWidth - documentWidth);
2117
- }
2118
- hide() {
2119
- const width = this.getWidth();
2120
- this._disableOverFlow();
2121
- // give padding to element to balance the hidden scrollbar width
2122
- this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
2123
- // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
2124
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
2125
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
2126
- }
2127
- reset() {
2128
- this._resetElementAttributes(this._element, 'overflow');
2129
- this._resetElementAttributes(this._element, PROPERTY_PADDING);
2130
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
2131
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
2132
- }
2133
- isOverflowing() {
2134
- return this.getWidth() > 0;
2135
- }
2136
-
2137
- // Private
2138
- _disableOverFlow() {
2139
- this._saveInitialAttribute(this._element, 'overflow');
2140
- this._element.style.overflow = 'hidden';
2141
- }
2142
- _setElementAttributes(selector, styleProperty, callback) {
2143
- const scrollbarWidth = this.getWidth();
2144
- const manipulationCallBack = element => {
2145
- if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
2146
- return;
2147
- }
2148
- this._saveInitialAttribute(element, styleProperty);
2149
- const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
2150
- element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
2151
- };
2152
- this._applyManipulationCallback(selector, manipulationCallBack);
2153
- }
2154
- _saveInitialAttribute(element, styleProperty) {
2155
- const actualValue = element.style.getPropertyValue(styleProperty);
2156
- if (actualValue) {
2157
- Manipulator.setDataAttribute(element, styleProperty, actualValue);
2158
- }
2159
- }
2160
- _resetElementAttributes(selector, styleProperty) {
2161
- const manipulationCallBack = element => {
2162
- const value = Manipulator.getDataAttribute(element, styleProperty);
2163
- // We only want to remove the property if the value is `null`; the value can also be zero
2164
- if (value === null) {
2165
- element.style.removeProperty(styleProperty);
2166
- return;
2167
- }
2168
- Manipulator.removeDataAttribute(element, styleProperty);
2169
- element.style.setProperty(styleProperty, value);
2170
- };
2171
- this._applyManipulationCallback(selector, manipulationCallBack);
2172
- }
2173
- _applyManipulationCallback(selector, callBack) {
2174
- if (isElement(selector)) {
2175
- callBack(selector);
2176
- return;
2177
- }
2178
- for (const sel of SelectorEngine.find(selector, this._element)) {
2179
- callBack(sel);
2180
- }
2181
- }
2182
- }
2183
-
2184
- /**
2185
- * --------------------------------------------------------------------------
2186
- * CoreUI (v5.0.0-alpha.0): util/backdrop.js
2187
- * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2188
- *
2189
- * This component is a modified version of the Bootstrap's util/backdrop.js
2190
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2191
- * --------------------------------------------------------------------------
2192
- */
2193
2104
 
2194
2105
  /**
2195
2106
  * Constants
@@ -2310,14 +2221,15 @@ class Backdrop extends Config {
2310
2221
 
2311
2222
  /**
2312
2223
  * --------------------------------------------------------------------------
2313
- * CoreUI (v5.0.0-alpha.0): util/focustrap.js
2224
+ * CoreUI util/focustrap.js
2314
2225
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2315
2226
  *
2316
- * This component is a modified version of the Bootstrap's util/focustrap.js
2227
+ * This is a modified version of the Bootstrap's util/focustrap.js
2317
2228
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2318
2229
  * --------------------------------------------------------------------------
2319
2230
  */
2320
2231
 
2232
+
2321
2233
  /**
2322
2234
  * Constants
2323
2235
  */
@@ -2411,7 +2323,108 @@ class FocusTrap extends Config {
2411
2323
 
2412
2324
  /**
2413
2325
  * --------------------------------------------------------------------------
2414
- * CoreUI (v5.0.0-alpha.0): modal.js
2326
+ * CoreUI util/scrollBar.js
2327
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2328
+ *
2329
+ * This is a modified version of the Bootstrap's util/scrollBar.js
2330
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2331
+ * --------------------------------------------------------------------------
2332
+ */
2333
+
2334
+
2335
+ /**
2336
+ * Constants
2337
+ */
2338
+
2339
+ const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
2340
+ const SELECTOR_STICKY_CONTENT = '.sticky-top';
2341
+ const PROPERTY_PADDING = 'padding-right';
2342
+ const PROPERTY_MARGIN = 'margin-right';
2343
+
2344
+ /**
2345
+ * Class definition
2346
+ */
2347
+
2348
+ class ScrollBarHelper {
2349
+ constructor() {
2350
+ this._element = document.body;
2351
+ }
2352
+
2353
+ // Public
2354
+ getWidth() {
2355
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
2356
+ const documentWidth = document.documentElement.clientWidth;
2357
+ return Math.abs(window.innerWidth - documentWidth);
2358
+ }
2359
+ hide() {
2360
+ const width = this.getWidth();
2361
+ this._disableOverFlow();
2362
+ // give padding to element to balance the hidden scrollbar width
2363
+ this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
2364
+ // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
2365
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
2366
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
2367
+ }
2368
+ reset() {
2369
+ this._resetElementAttributes(this._element, 'overflow');
2370
+ this._resetElementAttributes(this._element, PROPERTY_PADDING);
2371
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
2372
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
2373
+ }
2374
+ isOverflowing() {
2375
+ return this.getWidth() > 0;
2376
+ }
2377
+
2378
+ // Private
2379
+ _disableOverFlow() {
2380
+ this._saveInitialAttribute(this._element, 'overflow');
2381
+ this._element.style.overflow = 'hidden';
2382
+ }
2383
+ _setElementAttributes(selector, styleProperty, callback) {
2384
+ const scrollbarWidth = this.getWidth();
2385
+ const manipulationCallBack = element => {
2386
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
2387
+ return;
2388
+ }
2389
+ this._saveInitialAttribute(element, styleProperty);
2390
+ const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
2391
+ element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
2392
+ };
2393
+ this._applyManipulationCallback(selector, manipulationCallBack);
2394
+ }
2395
+ _saveInitialAttribute(element, styleProperty) {
2396
+ const actualValue = element.style.getPropertyValue(styleProperty);
2397
+ if (actualValue) {
2398
+ Manipulator.setDataAttribute(element, styleProperty, actualValue);
2399
+ }
2400
+ }
2401
+ _resetElementAttributes(selector, styleProperty) {
2402
+ const manipulationCallBack = element => {
2403
+ const value = Manipulator.getDataAttribute(element, styleProperty);
2404
+ // We only want to remove the property if the value is `null`; the value can also be zero
2405
+ if (value === null) {
2406
+ element.style.removeProperty(styleProperty);
2407
+ return;
2408
+ }
2409
+ Manipulator.removeDataAttribute(element, styleProperty);
2410
+ element.style.setProperty(styleProperty, value);
2411
+ };
2412
+ this._applyManipulationCallback(selector, manipulationCallBack);
2413
+ }
2414
+ _applyManipulationCallback(selector, callBack) {
2415
+ if (isElement(selector)) {
2416
+ callBack(selector);
2417
+ return;
2418
+ }
2419
+ for (const sel of SelectorEngine.find(selector, this._element)) {
2420
+ callBack(sel);
2421
+ }
2422
+ }
2423
+ }
2424
+
2425
+ /**
2426
+ * --------------------------------------------------------------------------
2427
+ * CoreUI modal.js
2415
2428
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2416
2429
  *
2417
2430
  * This component is a modified version of the Bootstrap's modal.js
@@ -2419,6 +2432,7 @@ class FocusTrap extends Config {
2419
2432
  * --------------------------------------------------------------------------
2420
2433
  */
2421
2434
 
2435
+
2422
2436
  /**
2423
2437
  * Constants
2424
2438
  */
@@ -2520,9 +2534,8 @@ class Modal extends BaseComponent {
2520
2534
  this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
2521
2535
  }
2522
2536
  dispose() {
2523
- for (const htmlElement of [window, this._dialog]) {
2524
- EventHandler.off(htmlElement, EVENT_KEY$6);
2525
- }
2537
+ EventHandler.off(window, EVENT_KEY$6);
2538
+ EventHandler.off(this._dialog, EVENT_KEY$6);
2526
2539
  this._backdrop.dispose();
2527
2540
  this._focustrap.deactivate();
2528
2541
  super.dispose();
@@ -2577,7 +2590,6 @@ class Modal extends BaseComponent {
2577
2590
  return;
2578
2591
  }
2579
2592
  if (this._config.keyboard) {
2580
- event.preventDefault();
2581
2593
  this.hide();
2582
2594
  return;
2583
2595
  }
@@ -2720,11 +2732,12 @@ defineJQueryPlugin(Modal);
2720
2732
 
2721
2733
  /**
2722
2734
  * --------------------------------------------------------------------------
2723
- * CoreUI (v5.0.0-alpha.0): navigation.js
2735
+ * CoreUI navigation.js
2724
2736
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2725
2737
  * --------------------------------------------------------------------------
2726
2738
  */
2727
2739
 
2740
+
2728
2741
  /**
2729
2742
  * ------------------------------------------------------------------------
2730
2743
  * Constants
@@ -2974,14 +2987,15 @@ defineJQueryPlugin(Navigation);
2974
2987
 
2975
2988
  /**
2976
2989
  * --------------------------------------------------------------------------
2977
- * CoreUI (v5.0.0-alpha.0): offcanvas.js
2990
+ * CoreUI offcanvas.js
2978
2991
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
2979
2992
  *
2980
2993
  * This component is a modified version of the Bootstrap's offcanvas.js
2981
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2994
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2982
2995
  * --------------------------------------------------------------------------
2983
2996
  */
2984
2997
 
2998
+
2985
2999
  /**
2986
3000
  * Constants
2987
3001
  */
@@ -3135,11 +3149,11 @@ class Offcanvas extends BaseComponent {
3135
3149
  if (event.key !== ESCAPE_KEY) {
3136
3150
  return;
3137
3151
  }
3138
- if (!this._config.keyboard) {
3139
- EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
3152
+ if (this._config.keyboard) {
3153
+ this.hide();
3140
3154
  return;
3141
3155
  }
3142
- this.hide();
3156
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
3143
3157
  });
3144
3158
  }
3145
3159
 
@@ -3207,42 +3221,16 @@ defineJQueryPlugin(Offcanvas);
3207
3221
 
3208
3222
  /**
3209
3223
  * --------------------------------------------------------------------------
3210
- * CoreUI (v5.0.0-alpha.0): util/sanitizer.js
3224
+ * CoreUI util/sanitizer.js
3211
3225
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
3212
3226
  *
3213
- * This component is a modified version of the Bootstrap's util/sanitizer.js
3227
+ * This is a modified version of the Bootstrap's util/sanitizer.js
3214
3228
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3215
3229
  * --------------------------------------------------------------------------
3216
3230
  */
3217
3231
 
3218
- const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
3232
+ // js-docs-start allow-list
3219
3233
  const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
3220
-
3221
- /**
3222
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
3223
- *
3224
- * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
3225
- */
3226
- const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
3227
-
3228
- /**
3229
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
3230
- *
3231
- * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
3232
- */
3233
- 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;
3234
- const allowedAttribute = (attribute, allowedAttributeList) => {
3235
- const attributeName = attribute.nodeName.toLowerCase();
3236
- if (allowedAttributeList.includes(attributeName)) {
3237
- if (uriAttributes.has(attributeName)) {
3238
- return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
3239
- }
3240
- return true;
3241
- }
3242
-
3243
- // Check if a regular expression validates the attribute.
3244
- return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
3245
- };
3246
3234
  const DefaultAllowlist = {
3247
3235
  // Global attributes allowed on any supplied element below.
3248
3236
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
@@ -3276,6 +3264,30 @@ const DefaultAllowlist = {
3276
3264
  u: [],
3277
3265
  ul: []
3278
3266
  };
3267
+ // js-docs-end allow-list
3268
+
3269
+ const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
3270
+
3271
+ /**
3272
+ * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
3273
+ * contexts.
3274
+ *
3275
+ * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
3276
+ */
3277
+ // eslint-disable-next-line unicorn/better-regex
3278
+ const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
3279
+ const allowedAttribute = (attribute, allowedAttributeList) => {
3280
+ const attributeName = attribute.nodeName.toLowerCase();
3281
+ if (allowedAttributeList.includes(attributeName)) {
3282
+ if (uriAttributes.has(attributeName)) {
3283
+ return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
3284
+ }
3285
+ return true;
3286
+ }
3287
+
3288
+ // Check if a regular expression validates the attribute.
3289
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
3290
+ };
3279
3291
  function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
3280
3292
  if (!unsafeHtml.length) {
3281
3293
  return unsafeHtml;
@@ -3305,14 +3317,15 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
3305
3317
 
3306
3318
  /**
3307
3319
  * --------------------------------------------------------------------------
3308
- * CoreUI (v5.0.0-alpha.0): util/template-factory.js
3320
+ * CoreUI util/template-factory.js
3309
3321
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
3310
3322
  *
3311
- * This component is a modified version of the Bootstrap's util/template-factory.js
3323
+ * This is a modified version of the Bootstrap's util/template-factory.js
3312
3324
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3313
3325
  * --------------------------------------------------------------------------
3314
3326
  */
3315
3327
 
3328
+
3316
3329
  /**
3317
3330
  * Constants
3318
3331
  */
@@ -3443,7 +3456,7 @@ class TemplateFactory extends Config {
3443
3456
 
3444
3457
  /**
3445
3458
  * --------------------------------------------------------------------------
3446
- * CoreUI (v5.0.0-alpha.0): tooltip.js
3459
+ * CoreUI tooltip.js
3447
3460
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
3448
3461
  *
3449
3462
  * This component is a modified version of the Bootstrap's tooltip.js
@@ -3451,6 +3464,7 @@ class TemplateFactory extends Config {
3451
3464
  * --------------------------------------------------------------------------
3452
3465
  */
3453
3466
 
3467
+
3454
3468
  /**
3455
3469
  * Constants
3456
3470
  */
@@ -3493,7 +3507,7 @@ const Default$4 = {
3493
3507
  delay: 0,
3494
3508
  fallbackPlacements: ['top', 'right', 'bottom', 'left'],
3495
3509
  html: false,
3496
- offset: [0, 0],
3510
+ offset: [0, 6],
3497
3511
  placement: 'top',
3498
3512
  popperConfig: null,
3499
3513
  sanitize: true,
@@ -3606,7 +3620,7 @@ class Tooltip extends BaseComponent {
3606
3620
  return;
3607
3621
  }
3608
3622
 
3609
- // todo v6 remove this OR make it optional
3623
+ // TODO: v6 remove this or make it optional
3610
3624
  this._disposePopper();
3611
3625
  const tip = this._getTipElement();
3612
3626
  this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
@@ -3692,13 +3706,13 @@ class Tooltip extends BaseComponent {
3692
3706
  _createTipElement(content) {
3693
3707
  const tip = this._getTemplateFactory(content).toHtml();
3694
3708
 
3695
- // todo: remove this check on v6
3709
+ // TODO: remove this check in v6
3696
3710
  if (!tip) {
3697
3711
  return null;
3698
3712
  }
3699
3713
  tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$3);
3700
- // todo: on v6 the following can be achieved with CSS only
3701
- tip.classList.add(`cui-${this.constructor.NAME}-auto`);
3714
+ // TODO: v6 the following can be achieved with CSS only
3715
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`);
3702
3716
  const tipId = getUID(this.constructor.NAME).toString();
3703
3717
  tip.setAttribute('id', tipId);
3704
3718
  if (this._isAnimated()) {
@@ -3957,7 +3971,7 @@ defineJQueryPlugin(Tooltip);
3957
3971
 
3958
3972
  /**
3959
3973
  * --------------------------------------------------------------------------
3960
- * CoreUI (v5.0.0-alpha.0): popover.js
3974
+ * CoreUI popover.js
3961
3975
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
3962
3976
  *
3963
3977
  * This component is a modified version of the Bootstrap's popover.js
@@ -3965,6 +3979,7 @@ defineJQueryPlugin(Tooltip);
3965
3979
  * --------------------------------------------------------------------------
3966
3980
  */
3967
3981
 
3982
+
3968
3983
  /**
3969
3984
  * Constants
3970
3985
  */
@@ -4040,7 +4055,7 @@ defineJQueryPlugin(Popover);
4040
4055
 
4041
4056
  /**
4042
4057
  * --------------------------------------------------------------------------
4043
- * CoreUI (v5.0.0-alpha.0): scrollspy.js
4058
+ * CoreUI scrollspy.js
4044
4059
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
4045
4060
  *
4046
4061
  * This component is a modified version of the Bootstrap's scrollspy.js
@@ -4048,6 +4063,7 @@ defineJQueryPlugin(Popover);
4048
4063
  * --------------------------------------------------------------------------
4049
4064
  */
4050
4065
 
4066
+
4051
4067
  /**
4052
4068
  * Constants
4053
4069
  */
@@ -4226,11 +4242,11 @@ class ScrollSpy extends BaseComponent {
4226
4242
  if (!anchor.hash || isDisabled(anchor)) {
4227
4243
  continue;
4228
4244
  }
4229
- const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
4245
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
4230
4246
 
4231
4247
  // ensure that the observableSection exists & is visible
4232
4248
  if (isVisible(observableSection)) {
4233
- this._targetLinks.set(anchor.hash, anchor);
4249
+ this._targetLinks.set(decodeURI(anchor.hash), anchor);
4234
4250
  this._observableSections.set(anchor.hash, observableSection);
4235
4251
  }
4236
4252
  }
@@ -4302,11 +4318,12 @@ defineJQueryPlugin(ScrollSpy);
4302
4318
 
4303
4319
  /**
4304
4320
  * --------------------------------------------------------------------------
4305
- * CoreUI (v5.0.0-alpha.0): sidebar.js
4321
+ * CoreUI sidebar.js
4306
4322
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
4307
4323
  * --------------------------------------------------------------------------
4308
4324
  */
4309
4325
 
4326
+
4310
4327
  /**
4311
4328
  * ------------------------------------------------------------------------
4312
4329
  * Constants
@@ -4582,7 +4599,7 @@ defineJQueryPlugin(Sidebar);
4582
4599
 
4583
4600
  /**
4584
4601
  * --------------------------------------------------------------------------
4585
- * CoreUI (v5.0.0-alpha.0): tab.js
4602
+ * CoreUI tab.js
4586
4603
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
4587
4604
  *
4588
4605
  * This component is a modified version of the Bootstrap's tab.js
@@ -4590,6 +4607,7 @@ defineJQueryPlugin(Sidebar);
4590
4607
  * --------------------------------------------------------------------------
4591
4608
  */
4592
4609
 
4610
+
4593
4611
  /**
4594
4612
  * Constants
4595
4613
  */
@@ -4608,6 +4626,8 @@ const ARROW_LEFT_KEY = 'ArrowLeft';
4608
4626
  const ARROW_RIGHT_KEY = 'ArrowRight';
4609
4627
  const ARROW_UP_KEY = 'ArrowUp';
4610
4628
  const ARROW_DOWN_KEY = 'ArrowDown';
4629
+ const HOME_KEY = 'Home';
4630
+ const END_KEY = 'End';
4611
4631
  const CLASS_NAME_ACTIVE = 'active';
4612
4632
  const CLASS_NAME_FADE$1 = 'fade';
4613
4633
  const CLASS_NAME_SHOW$1 = 'show';
@@ -4618,7 +4638,7 @@ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
4618
4638
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
4619
4639
  const SELECTOR_OUTER = '.nav-item, .list-group-item';
4620
4640
  const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
4621
- const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="tab"], [data-coreui-toggle="pill"], [data-coreui-toggle="list"]'; // todo:v6: could be only `tab`
4641
+ const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="tab"], [data-coreui-toggle="pill"], [data-coreui-toggle="list"]'; // TODO: could only be `tab` in v6
4622
4642
  const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
4623
4643
  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"]`;
4624
4644
 
@@ -4632,7 +4652,7 @@ class Tab extends BaseComponent {
4632
4652
  this._parent = this._element.closest(SELECTOR_TAB_PANEL);
4633
4653
  if (!this._parent) {
4634
4654
  return;
4635
- // todo: should Throw exception on v6
4655
+ // TODO: should throw exception in v6
4636
4656
  // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
4637
4657
  }
4638
4658
 
@@ -4714,13 +4734,19 @@ class Tab extends BaseComponent {
4714
4734
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
4715
4735
  }
4716
4736
  _keydown(event) {
4717
- if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
4737
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
4718
4738
  return;
4719
4739
  }
4720
4740
  event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
4721
4741
  event.preventDefault();
4722
- const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
4723
- const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
4742
+ const children = this._getChildren().filter(element => !isDisabled(element));
4743
+ let nextActiveElement;
4744
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
4745
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
4746
+ } else {
4747
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
4748
+ nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
4749
+ }
4724
4750
  if (nextActiveElement) {
4725
4751
  nextActiveElement.focus({
4726
4752
  preventScroll: true
@@ -4764,7 +4790,7 @@ class Tab extends BaseComponent {
4764
4790
  }
4765
4791
  this._setAttributeIfNotExists(target, 'role', 'tabpanel');
4766
4792
  if (child.id) {
4767
- this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
4793
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
4768
4794
  }
4769
4795
  }
4770
4796
  _toggleDropDown(element, open) {
@@ -4846,7 +4872,7 @@ defineJQueryPlugin(Tab);
4846
4872
 
4847
4873
  /**
4848
4874
  * --------------------------------------------------------------------------
4849
- * CoreUI (v5.0.0-alpha.0): toast.js
4875
+ * CoreUI toast.js
4850
4876
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
4851
4877
  *
4852
4878
  * This component is a modified version of the Bootstrap's toast.js
@@ -4854,6 +4880,7 @@ defineJQueryPlugin(Tab);
4854
4880
  * --------------------------------------------------------------------------
4855
4881
  */
4856
4882
 
4883
+
4857
4884
  /**
4858
4885
  * Constants
4859
4886
  */