@coreui/coreui 4.0.5 → 4.1.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 (143) hide show
  1. package/README.md +4 -7
  2. package/dist/css/coreui-grid.css +254 -205
  3. package/dist/css/coreui-grid.css.map +1 -1
  4. package/dist/css/coreui-grid.min.css +2 -2
  5. package/dist/css/coreui-grid.min.css.map +1 -1
  6. package/dist/css/coreui-grid.rtl.css +255 -206
  7. package/dist/css/coreui-grid.rtl.css.map +1 -1
  8. package/dist/css/coreui-grid.rtl.min.css +3 -3
  9. package/dist/css/coreui-grid.rtl.min.css.map +1 -1
  10. package/dist/css/coreui-reboot.css +63 -8
  11. package/dist/css/coreui-reboot.css.map +1 -1
  12. package/dist/css/coreui-reboot.min.css +2 -2
  13. package/dist/css/coreui-reboot.min.css.map +1 -1
  14. package/dist/css/coreui-reboot.rtl.css +64 -9
  15. package/dist/css/coreui-reboot.rtl.css.map +1 -1
  16. package/dist/css/coreui-reboot.rtl.min.css +3 -3
  17. package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
  18. package/dist/css/coreui-utilities.css +181 -81
  19. package/dist/css/coreui-utilities.css.map +1 -1
  20. package/dist/css/coreui-utilities.min.css +2 -2
  21. package/dist/css/coreui-utilities.min.css.map +1 -1
  22. package/dist/css/coreui-utilities.rtl.css +182 -82
  23. package/dist/css/coreui-utilities.rtl.css.map +1 -1
  24. package/dist/css/coreui-utilities.rtl.min.css +3 -3
  25. package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
  26. package/dist/css/coreui.css +713 -346
  27. package/dist/css/coreui.css.map +1 -1
  28. package/dist/css/coreui.min.css +2 -2
  29. package/dist/css/coreui.min.css.map +1 -1
  30. package/dist/css/coreui.rtl.css +699 -347
  31. package/dist/css/coreui.rtl.css.map +1 -1
  32. package/dist/css/coreui.rtl.min.css +3 -3
  33. package/dist/css/coreui.rtl.min.css.map +1 -1
  34. package/dist/js/coreui.bundle.js +851 -746
  35. package/dist/js/coreui.bundle.js.map +1 -1
  36. package/dist/js/coreui.bundle.min.js +3 -3
  37. package/dist/js/coreui.bundle.min.js.map +1 -1
  38. package/dist/js/coreui.esm.js +704 -644
  39. package/dist/js/coreui.esm.js.map +1 -1
  40. package/dist/js/coreui.esm.min.js +3 -3
  41. package/dist/js/coreui.esm.min.js.map +1 -1
  42. package/dist/js/coreui.js +714 -656
  43. package/dist/js/coreui.js.map +1 -1
  44. package/dist/js/coreui.min.js +3 -3
  45. package/dist/js/coreui.min.js.map +1 -1
  46. package/js/dist/alert.js +82 -49
  47. package/js/dist/alert.js.map +1 -1
  48. package/js/dist/base-component.js +26 -18
  49. package/js/dist/base-component.js.map +1 -1
  50. package/js/dist/button.js +23 -13
  51. package/js/dist/button.js.map +1 -1
  52. package/js/dist/carousel.js +95 -50
  53. package/js/dist/carousel.js.map +1 -1
  54. package/js/dist/collapse.js +125 -139
  55. package/js/dist/collapse.js.map +1 -1
  56. package/js/dist/dom/data.js +6 -6
  57. package/js/dist/dom/data.js.map +1 -1
  58. package/js/dist/dom/event-handler.js +15 -6
  59. package/js/dist/dom/event-handler.js.map +1 -1
  60. package/js/dist/dom/manipulator.js +7 -7
  61. package/js/dist/dom/manipulator.js.map +1 -1
  62. package/js/dist/dom/selector-engine.js +74 -9
  63. package/js/dist/dom/selector-engine.js.map +1 -1
  64. package/js/dist/dropdown.js +125 -112
  65. package/js/dist/dropdown.js.map +1 -1
  66. package/js/dist/modal.js +270 -93
  67. package/js/dist/modal.js.map +1 -1
  68. package/js/dist/offcanvas.js +231 -62
  69. package/js/dist/offcanvas.js.map +1 -1
  70. package/js/dist/popover.js +29 -59
  71. package/js/dist/popover.js.map +1 -1
  72. package/js/dist/scrollspy.js +45 -35
  73. package/js/dist/scrollspy.js.map +1 -1
  74. package/js/dist/tab.js +45 -23
  75. package/js/dist/tab.js.map +1 -1
  76. package/js/dist/toast.js +132 -34
  77. package/js/dist/toast.js.map +1 -1
  78. package/js/dist/tooltip.js +127 -109
  79. package/js/dist/tooltip.js.map +1 -1
  80. package/js/src/alert.js +21 -47
  81. package/js/src/base-component.js +3 -3
  82. package/js/src/button.js +1 -1
  83. package/js/src/carousel.js +10 -4
  84. package/js/src/collapse.js +66 -119
  85. package/js/src/dom/data.js +1 -1
  86. package/js/src/dom/event-handler.js +1 -2
  87. package/js/src/dom/manipulator.js +3 -3
  88. package/js/src/dom/selector-engine.js +18 -1
  89. package/js/src/dropdown.js +53 -68
  90. package/js/src/modal.js +24 -35
  91. package/js/src/navigation.js +1 -1
  92. package/js/src/offcanvas.js +16 -18
  93. package/js/src/popover.js +7 -49
  94. package/js/src/scrollspy.js +1 -1
  95. package/js/src/sidebar.js +21 -27
  96. package/js/src/tab.js +1 -1
  97. package/js/src/toast.js +11 -11
  98. package/js/src/tooltip.js +66 -50
  99. package/js/src/util/backdrop.js +6 -5
  100. package/js/src/util/component-functions.js +34 -0
  101. package/js/src/util/focustrap.js +105 -0
  102. package/js/src/util/index.js +39 -11
  103. package/js/src/util/sanitizer.js +21 -22
  104. package/js/src/util/scrollbar.js +1 -1
  105. package/package.json +54 -55
  106. package/scss/_buttons.scss +1 -2
  107. package/scss/_card.scss +2 -1
  108. package/scss/_dropdown.scss +1 -1
  109. package/scss/_functions.scss +51 -12
  110. package/scss/_grid.scss +0 -23
  111. package/scss/_helpers.scss +2 -0
  112. package/scss/_mixins.scss +1 -0
  113. package/scss/_modal.scss +2 -12
  114. package/scss/_nav.scss +1 -2
  115. package/scss/_navbar.scss +30 -1
  116. package/scss/_offcanvas.scss +6 -2
  117. package/scss/_placeholders.scss +51 -0
  118. package/scss/_reboot.scss +12 -8
  119. package/scss/_root.scss +36 -7
  120. package/scss/_tables.scss +9 -5
  121. package/scss/_toasts.scss +2 -2
  122. package/scss/_transitions.scss +6 -0
  123. package/scss/_utilities.scss +31 -8
  124. package/scss/_variables.scss +188 -13
  125. package/scss/coreui-grid.rtl.scss +1 -1
  126. package/scss/coreui-grid.scss +3 -1
  127. package/scss/coreui-reboot.rtl.scss +1 -1
  128. package/scss/coreui-reboot.scss +2 -4
  129. package/scss/coreui-utilities.rtl.scss +1 -1
  130. package/scss/coreui-utilities.scss +1 -1
  131. package/scss/coreui.rtl.scss +1 -1
  132. package/scss/coreui.scss +2 -1
  133. package/scss/forms/_form-control.scss +1 -1
  134. package/scss/forms/_form-select.scss +2 -0
  135. package/scss/helpers/_stacks.scss +15 -0
  136. package/scss/helpers/_vr.scss +8 -0
  137. package/scss/mixins/_backdrop.scss +14 -0
  138. package/scss/mixins/_grid.scss +26 -7
  139. package/scss/mixins/_ltr-rtl.scss +21 -0
  140. package/scss/mixins/_reset-text.scss +1 -1
  141. package/scss/mixins/_utilities.scss +28 -33
  142. package/scss/mixins/_visually-hidden.scss +1 -1
  143. package/scss/sidebar/_sidebar-nav.scss +1 -0
@@ -1,104 +1,29 @@
1
1
  /*!
2
- * CoreUI v4.0.5 (https://coreui.io)
3
- * Copyright 2021 The CoreUI Team (https://github.com/orgs/coreui/people)
2
+ * CoreUI v4.1.2 (https://coreui.io)
3
+ * Copyright 2022 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * Licensed under MIT (https://coreui.io)
5
5
  */
6
6
  import * as Popper from '@popperjs/core';
7
7
 
8
8
  /**
9
9
  * --------------------------------------------------------------------------
10
- * CoreUI (v4.0.5): dom/selector-engine.js
11
- * Licensed under MIT (https://coreui.io/license)
12
- *
13
- * This component is a modified version of the Bootstrap's dom/selector-engine.js
14
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
15
- * --------------------------------------------------------------------------
16
- */
17
-
18
- /**
19
- * ------------------------------------------------------------------------
20
- * Constants
21
- * ------------------------------------------------------------------------
22
- */
23
- const NODE_TEXT = 3;
24
- const SelectorEngine = {
25
- find(selector, element = document.documentElement) {
26
- return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
27
- },
28
-
29
- findOne(selector, element = document.documentElement) {
30
- return Element.prototype.querySelector.call(element, selector);
31
- },
32
-
33
- children(element, selector) {
34
- return [].concat(...element.children).filter(child => child.matches(selector));
35
- },
36
-
37
- parents(element, selector) {
38
- const parents = [];
39
- let ancestor = element.parentNode;
40
-
41
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
42
- if (ancestor.matches(selector)) {
43
- parents.push(ancestor);
44
- }
45
-
46
- ancestor = ancestor.parentNode;
47
- }
48
-
49
- return parents;
50
- },
51
-
52
- prev(element, selector) {
53
- let previous = element.previousElementSibling;
54
-
55
- while (previous) {
56
- if (previous.matches(selector)) {
57
- return [previous];
58
- }
59
-
60
- previous = previous.previousElementSibling;
61
- }
62
-
63
- return [];
64
- },
65
-
66
- next(element, selector) {
67
- let next = element.nextElementSibling;
68
-
69
- while (next) {
70
- if (next.matches(selector)) {
71
- return [next];
72
- }
73
-
74
- next = next.nextElementSibling;
75
- }
76
-
77
- return [];
78
- }
79
-
80
- };
81
-
82
- /**
83
- * --------------------------------------------------------------------------
84
- * CoreUI (v4.0.5): alert.js
10
+ * CoreUI (v4.1.2): alert.js
85
11
  * Licensed under MIT (https://coreui.io/license)
86
12
  *
87
13
  * This component is a modified version of the Bootstrap's util/index.js
88
14
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
89
15
  * --------------------------------------------------------------------------
90
16
  */
91
-
92
17
  const MAX_UID = 1000000;
93
18
  const MILLISECONDS_MULTIPLIER = 1000;
94
19
  const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
95
20
 
96
- const toType = obj => {
97
- if (obj === null || obj === undefined) {
98
- return `${obj}`;
21
+ const toType = object => {
22
+ if (object === null || object === undefined) {
23
+ return `${object}`;
99
24
  }
100
25
 
101
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
26
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
102
27
  };
103
28
  /**
104
29
  * --------------------------------------------------------------------------
@@ -200,7 +125,7 @@ const getElement = obj => {
200
125
  }
201
126
 
202
127
  if (typeof obj === 'string' && obj.length > 0) {
203
- return SelectorEngine.findOne(obj);
128
+ return document.querySelector(obj);
204
129
  }
205
130
 
206
131
  return null;
@@ -223,7 +148,27 @@ const isVisible = element => {
223
148
  return false;
224
149
  }
225
150
 
226
- return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
151
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; // Handle `details` element as its content may falsie appear visible when it is closed
152
+
153
+ const closedDetails = element.closest('details:not([open])');
154
+
155
+ if (!closedDetails) {
156
+ return elementIsVisible;
157
+ }
158
+
159
+ if (closedDetails !== element) {
160
+ const summary = element.closest('summary');
161
+
162
+ if (summary && summary.parentNode !== closedDetails) {
163
+ return false;
164
+ }
165
+
166
+ if (summary === null) {
167
+ return false;
168
+ }
169
+ }
170
+
171
+ return elementIsVisible;
227
172
  };
228
173
 
229
174
  const isDisabled = element => {
@@ -266,8 +211,20 @@ const findShadowRoot = element => {
266
211
  };
267
212
 
268
213
  const noop = () => {};
214
+ /**
215
+ * Trick to restart an element's animation
216
+ *
217
+ * @param {HTMLElement} element
218
+ * @return void
219
+ *
220
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
221
+ */
222
+
269
223
 
270
- const reflow = element => element.offsetHeight;
224
+ const reflow = element => {
225
+ // eslint-disable-next-line no-unused-expressions
226
+ element.offsetHeight;
227
+ };
271
228
 
272
229
  const getjQuery = () => {
273
230
  const {
@@ -384,7 +341,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
384
341
 
385
342
  /**
386
343
  * --------------------------------------------------------------------------
387
- * CoreUI (v4.0.5): dom/event-handler.js
344
+ * CoreUI (v4.1.2): dom/event-handler.js
388
345
  * Licensed under MIT (https://coreui.io/license)
389
346
  *
390
347
  * This component is a modified version of the Bootstrap's dom/event-handler.js
@@ -450,7 +407,6 @@ function bootstrapDelegationHandler(element, selector, fn) {
450
407
  event.delegateTarget = target;
451
408
 
452
409
  if (handler.oneOff) {
453
- // eslint-disable-next-line unicorn/consistent-destructuring
454
410
  EventHandler.off(element, event.type, selector, fn);
455
411
  }
456
412
 
@@ -676,7 +632,7 @@ const EventHandler = {
676
632
 
677
633
  /**
678
634
  * --------------------------------------------------------------------------
679
- * CoreUI (v4.0.5): dom/data.js
635
+ * CoreUI (v4.1.2): dom/data.js
680
636
  * Licensed under MIT (https://coreui.io/license)
681
637
  *
682
638
  * This component is a modified version of the Bootstrap's dom/data.js
@@ -690,7 +646,7 @@ const EventHandler = {
690
646
  * ------------------------------------------------------------------------
691
647
  */
692
648
  const elementMap = new Map();
693
- var Data = {
649
+ const Data = {
694
650
  set(element, key, instance) {
695
651
  if (!elementMap.has(element)) {
696
652
  elementMap.set(element, new Map());
@@ -733,7 +689,7 @@ var Data = {
733
689
 
734
690
  /**
735
691
  * --------------------------------------------------------------------------
736
- * CoreUI (v4.0.5): alert.js
692
+ * CoreUI (v4.1.2): alert.js
737
693
  * Licensed under MIT (https://coreui.io/license)
738
694
  *
739
695
  * This component is a modified version of the Bootstrap's base-component.js
@@ -746,7 +702,7 @@ var Data = {
746
702
  * ------------------------------------------------------------------------
747
703
  */
748
704
 
749
- const VERSION = '4.0.5';
705
+ const VERSION = '4.1.2';
750
706
 
751
707
  class BaseComponent {
752
708
  constructor(element) {
@@ -775,7 +731,7 @@ class BaseComponent {
775
731
 
776
732
 
777
733
  static getInstance(element) {
778
- return Data.get(element, this.DATA_KEY);
734
+ return Data.get(getElement(element), this.DATA_KEY);
779
735
  }
780
736
 
781
737
  static getOrCreateInstance(element, config = {}) {
@@ -802,7 +758,33 @@ class BaseComponent {
802
758
 
803
759
  /**
804
760
  * --------------------------------------------------------------------------
805
- * CoreUI (v4.0.5): alert.js
761
+ * Bootstrap (v5.1.3): util/component-functions.js
762
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
763
+ * --------------------------------------------------------------------------
764
+ */
765
+
766
+ const enableDismissTrigger = (component, method = 'hide') => {
767
+ const clickEvent = `click.dismiss${component.EVENT_KEY}`;
768
+ const name = component.NAME;
769
+ EventHandler.on(document, clickEvent, `[data-coreui-dismiss="${name}"]`, function (event) {
770
+ if (['A', 'AREA'].includes(this.tagName)) {
771
+ event.preventDefault();
772
+ }
773
+
774
+ if (isDisabled(this)) {
775
+ return;
776
+ }
777
+
778
+ const target = getElementFromSelector(this) || this.closest(`.${name}`);
779
+ const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
780
+
781
+ instance[method]();
782
+ });
783
+ };
784
+
785
+ /**
786
+ * --------------------------------------------------------------------------
787
+ * CoreUI (v4.1.2): alert.js
806
788
  * Licensed under MIT (https://coreui.io/license)
807
789
  *
808
790
  * This component is a modified version of the Bootstrap's alert.js
@@ -815,17 +797,13 @@ class BaseComponent {
815
797
  * ------------------------------------------------------------------------
816
798
  */
817
799
 
818
- const NAME$e = 'alert';
819
- const DATA_KEY$d = 'coreui.alert';
820
- const EVENT_KEY$d = `.${DATA_KEY$d}`;
821
- const DATA_API_KEY$a = '.data-api';
822
- const SELECTOR_DISMISS = '[data-coreui-dismiss="alert"]';
823
- const EVENT_CLOSE = `close${EVENT_KEY$d}`;
824
- const EVENT_CLOSED = `closed${EVENT_KEY$d}`;
825
- const EVENT_CLICK_DATA_API$9 = `click${EVENT_KEY$d}${DATA_API_KEY$a}`;
826
- const CLASS_NAME_ALERT = 'alert';
827
- const CLASS_NAME_FADE$7 = 'fade';
828
- const CLASS_NAME_SHOW$b = 'show';
800
+ const NAME$f = 'alert';
801
+ const DATA_KEY$e = 'coreui.alert';
802
+ const EVENT_KEY$e = `.${DATA_KEY$e}`;
803
+ const EVENT_CLOSE = `close${EVENT_KEY$e}`;
804
+ const EVENT_CLOSED = `closed${EVENT_KEY$e}`;
805
+ const CLASS_NAME_FADE$5 = 'fade';
806
+ const CLASS_NAME_SHOW$a = 'show';
829
807
  /**
830
808
  * ------------------------------------------------------------------------
831
809
  * Class Definition
@@ -835,41 +813,30 @@ const CLASS_NAME_SHOW$b = 'show';
835
813
  class Alert extends BaseComponent {
836
814
  // Getters
837
815
  static get NAME() {
838
- return NAME$e;
816
+ return NAME$f;
839
817
  } // Public
840
818
 
841
819
 
842
- close(element) {
843
- const rootElement = element ? this._getRootElement(element) : this._element;
820
+ close() {
821
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
844
822
 
845
- const customEvent = this._triggerCloseEvent(rootElement);
846
-
847
- if (customEvent === null || customEvent.defaultPrevented) {
823
+ if (closeEvent.defaultPrevented) {
848
824
  return;
849
825
  }
850
826
 
851
- this._removeElement(rootElement);
852
- } // Private
853
-
827
+ this._element.classList.remove(CLASS_NAME_SHOW$a);
854
828
 
855
- _getRootElement(element) {
856
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
857
- }
829
+ const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
858
830
 
859
- _triggerCloseEvent(element) {
860
- return EventHandler.trigger(element, EVENT_CLOSE);
861
- }
831
+ this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
832
+ } // Private
862
833
 
863
- _removeElement(element) {
864
- element.classList.remove(CLASS_NAME_SHOW$b);
865
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$7);
866
834
 
867
- this._queueCallback(() => this._destroyElement(element), element, isAnimated);
868
- }
835
+ _destroyElement() {
836
+ this._element.remove();
869
837
 
870
- _destroyElement(element) {
871
- element.remove();
872
- EventHandler.trigger(element, EVENT_CLOSED);
838
+ EventHandler.trigger(this._element, EVENT_CLOSED);
839
+ this.dispose();
873
840
  } // Static
874
841
 
875
842
 
@@ -877,20 +844,16 @@ class Alert extends BaseComponent {
877
844
  return this.each(function () {
878
845
  const data = Alert.getOrCreateInstance(this);
879
846
 
880
- if (config === 'close') {
881
- data[config](this);
847
+ if (typeof config !== 'string') {
848
+ return;
882
849
  }
883
- });
884
- }
885
850
 
886
- static handleDismiss(alertInstance) {
887
- return function (event) {
888
- if (event) {
889
- event.preventDefault();
851
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
852
+ throw new TypeError(`No method named "${config}"`);
890
853
  }
891
854
 
892
- alertInstance.close(this);
893
- };
855
+ data[config](this);
856
+ });
894
857
  }
895
858
 
896
859
  }
@@ -901,7 +864,7 @@ class Alert extends BaseComponent {
901
864
  */
902
865
 
903
866
 
904
- EventHandler.on(document, EVENT_CLICK_DATA_API$9, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
867
+ enableDismissTrigger(Alert, 'close');
905
868
  /**
906
869
  * ------------------------------------------------------------------------
907
870
  * jQuery
@@ -913,7 +876,7 @@ defineJQueryPlugin(Alert);
913
876
 
914
877
  /**
915
878
  * --------------------------------------------------------------------------
916
- * CoreUI (v4.0.5): alert.js
879
+ * CoreUI (v4.1.2): alert.js
917
880
  * Licensed under MIT (https://coreui.io/license)
918
881
  *
919
882
  * This component is a modified version of the Bootstrap's button.js
@@ -926,13 +889,13 @@ defineJQueryPlugin(Alert);
926
889
  * ------------------------------------------------------------------------
927
890
  */
928
891
 
929
- const NAME$d = 'button';
930
- const DATA_KEY$c = 'coreui.button';
931
- const EVENT_KEY$c = `.${DATA_KEY$c}`;
892
+ const NAME$e = 'button';
893
+ const DATA_KEY$d = 'coreui.button';
894
+ const EVENT_KEY$d = `.${DATA_KEY$d}`;
932
895
  const DATA_API_KEY$9 = '.data-api';
933
896
  const CLASS_NAME_ACTIVE$4 = 'active';
934
897
  const SELECTOR_DATA_TOGGLE$6 = '[data-coreui-toggle="button"]';
935
- const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$c}${DATA_API_KEY$9}`;
898
+ const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$d}${DATA_API_KEY$9}`;
936
899
  /**
937
900
  * ------------------------------------------------------------------------
938
901
  * Class Definition
@@ -942,7 +905,7 @@ const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$c}${DATA_API_KEY$9}`;
942
905
  class Button extends BaseComponent {
943
906
  // Getters
944
907
  static get NAME() {
945
- return NAME$d;
908
+ return NAME$e;
946
909
  } // Public
947
910
 
948
911
 
@@ -987,7 +950,7 @@ defineJQueryPlugin(Button);
987
950
 
988
951
  /**
989
952
  * --------------------------------------------------------------------------
990
- * CoreUI (v4.0.5): dom/manipulator.js
953
+ * CoreUI (v4.1.2): dom/manipulator.js
991
954
  * Licensed under MIT (https://coreui.io/license)
992
955
  *
993
956
  * This component is a modified version of the Bootstrap's dom/manipulator.js
@@ -1048,8 +1011,8 @@ const Manipulator = {
1048
1011
  offset(element) {
1049
1012
  const rect = element.getBoundingClientRect();
1050
1013
  return {
1051
- top: rect.top + document.body.scrollTop,
1052
- left: rect.left + document.body.scrollLeft
1014
+ top: rect.top + window.pageYOffset,
1015
+ left: rect.left + window.pageXOffset
1053
1016
  };
1054
1017
  },
1055
1018
 
@@ -1064,7 +1027,80 @@ const Manipulator = {
1064
1027
 
1065
1028
  /**
1066
1029
  * --------------------------------------------------------------------------
1067
- * CoreUI (v4.0.5): carousel.js
1030
+ * CoreUI (v4.1.2): dom/selector-engine.js
1031
+ * Licensed under MIT (https://coreui.io/license)
1032
+ *
1033
+ * This component is a modified version of the Bootstrap's dom/selector-engine.js
1034
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1035
+ * --------------------------------------------------------------------------
1036
+ */
1037
+ const NODE_TEXT = 3;
1038
+ const SelectorEngine = {
1039
+ find(selector, element = document.documentElement) {
1040
+ return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
1041
+ },
1042
+
1043
+ findOne(selector, element = document.documentElement) {
1044
+ return Element.prototype.querySelector.call(element, selector);
1045
+ },
1046
+
1047
+ children(element, selector) {
1048
+ return [].concat(...element.children).filter(child => child.matches(selector));
1049
+ },
1050
+
1051
+ parents(element, selector) {
1052
+ const parents = [];
1053
+ let ancestor = element.parentNode;
1054
+
1055
+ while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
1056
+ if (ancestor.matches(selector)) {
1057
+ parents.push(ancestor);
1058
+ }
1059
+
1060
+ ancestor = ancestor.parentNode;
1061
+ }
1062
+
1063
+ return parents;
1064
+ },
1065
+
1066
+ prev(element, selector) {
1067
+ let previous = element.previousElementSibling;
1068
+
1069
+ while (previous) {
1070
+ if (previous.matches(selector)) {
1071
+ return [previous];
1072
+ }
1073
+
1074
+ previous = previous.previousElementSibling;
1075
+ }
1076
+
1077
+ return [];
1078
+ },
1079
+
1080
+ next(element, selector) {
1081
+ let next = element.nextElementSibling;
1082
+
1083
+ while (next) {
1084
+ if (next.matches(selector)) {
1085
+ return [next];
1086
+ }
1087
+
1088
+ next = next.nextElementSibling;
1089
+ }
1090
+
1091
+ return [];
1092
+ },
1093
+
1094
+ focusableChildren(element) {
1095
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
1096
+ return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
1097
+ }
1098
+
1099
+ };
1100
+
1101
+ /**
1102
+ * --------------------------------------------------------------------------
1103
+ * CoreUI (v4.1.2): carousel.js
1068
1104
  * Licensed under MIT (https://coreui.io/license)
1069
1105
  *
1070
1106
  * This component is a modified version of the Bootstrap's carousel.js
@@ -1077,16 +1113,16 @@ const Manipulator = {
1077
1113
  * ------------------------------------------------------------------------
1078
1114
  */
1079
1115
 
1080
- const NAME$c = 'carousel';
1081
- const DATA_KEY$b = 'coreui.carousel';
1082
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
1116
+ const NAME$d = 'carousel';
1117
+ const DATA_KEY$c = 'coreui.carousel';
1118
+ const EVENT_KEY$c = `.${DATA_KEY$c}`;
1083
1119
  const DATA_API_KEY$8 = '.data-api';
1084
1120
  const ARROW_LEFT_KEY = 'ArrowLeft';
1085
1121
  const ARROW_RIGHT_KEY = 'ArrowRight';
1086
1122
  const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
1087
1123
 
1088
1124
  const SWIPE_THRESHOLD = 40;
1089
- const Default$b = {
1125
+ const Default$c = {
1090
1126
  interval: 5000,
1091
1127
  keyboard: true,
1092
1128
  slide: false,
@@ -1094,7 +1130,7 @@ const Default$b = {
1094
1130
  wrap: true,
1095
1131
  touch: true
1096
1132
  };
1097
- const DefaultType$b = {
1133
+ const DefaultType$c = {
1098
1134
  interval: '(number|boolean)',
1099
1135
  keyboard: 'boolean',
1100
1136
  slide: '(boolean|string)',
@@ -1110,19 +1146,19 @@ const KEY_TO_DIRECTION = {
1110
1146
  [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
1111
1147
  [ARROW_RIGHT_KEY]: DIRECTION_LEFT
1112
1148
  };
1113
- const EVENT_SLIDE = `slide${EVENT_KEY$b}`;
1114
- const EVENT_SLID = `slid${EVENT_KEY$b}`;
1115
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$b}`;
1116
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$b}`;
1117
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$b}`;
1118
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$b}`;
1119
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$b}`;
1120
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$b}`;
1121
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$b}`;
1122
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$b}`;
1123
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$b}`;
1124
- const EVENT_LOAD_DATA_API$4 = `load${EVENT_KEY$b}${DATA_API_KEY$8}`;
1125
- const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
1149
+ const EVENT_SLIDE = `slide${EVENT_KEY$c}`;
1150
+ const EVENT_SLID = `slid${EVENT_KEY$c}`;
1151
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$c}`;
1152
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$c}`;
1153
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$c}`;
1154
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$c}`;
1155
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$c}`;
1156
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$c}`;
1157
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$c}`;
1158
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$c}`;
1159
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$c}`;
1160
+ const EVENT_LOAD_DATA_API$4 = `load${EVENT_KEY$c}${DATA_API_KEY$8}`;
1161
+ const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$c}${DATA_API_KEY$8}`;
1126
1162
  const CLASS_NAME_CAROUSEL = 'carousel';
1127
1163
  const CLASS_NAME_ACTIVE$3 = 'active';
1128
1164
  const CLASS_NAME_SLIDE = 'slide';
@@ -1169,11 +1205,11 @@ class Carousel extends BaseComponent {
1169
1205
 
1170
1206
 
1171
1207
  static get Default() {
1172
- return Default$b;
1208
+ return Default$c;
1173
1209
  }
1174
1210
 
1175
1211
  static get NAME() {
1176
- return NAME$c;
1212
+ return NAME$d;
1177
1213
  } // Public
1178
1214
 
1179
1215
 
@@ -1251,11 +1287,11 @@ class Carousel extends BaseComponent {
1251
1287
 
1252
1288
 
1253
1289
  _getConfig(config) {
1254
- config = { ...Default$b,
1290
+ config = { ...Default$c,
1255
1291
  ...Manipulator.getDataAttributes(this._element),
1256
1292
  ...(typeof config === 'object' ? config : {})
1257
1293
  };
1258
- typeCheckConfig(NAME$c, config, DefaultType$b);
1294
+ typeCheckConfig(NAME$d, config, DefaultType$c);
1259
1295
  return config;
1260
1296
  }
1261
1297
 
@@ -1292,8 +1328,12 @@ class Carousel extends BaseComponent {
1292
1328
  }
1293
1329
 
1294
1330
  _addTouchEventListeners() {
1331
+ const hasPointerPenTouch = event => {
1332
+ return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
1333
+ };
1334
+
1295
1335
  const start = event => {
1296
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
1336
+ if (hasPointerPenTouch(event)) {
1297
1337
  this.touchStartX = event.clientX;
1298
1338
  } else if (!this._pointerEvent) {
1299
1339
  this.touchStartX = event.touches[0].clientX;
@@ -1306,7 +1346,7 @@ class Carousel extends BaseComponent {
1306
1346
  };
1307
1347
 
1308
1348
  const end = event => {
1309
- if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
1349
+ if (hasPointerPenTouch(event)) {
1310
1350
  this.touchDeltaX = event.clientX - this.touchStartX;
1311
1351
  }
1312
1352
 
@@ -1331,7 +1371,7 @@ class Carousel extends BaseComponent {
1331
1371
  };
1332
1372
 
1333
1373
  SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
1334
- EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault());
1374
+ EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
1335
1375
  });
1336
1376
 
1337
1377
  if (this._pointerEvent) {
@@ -1388,7 +1428,7 @@ class Carousel extends BaseComponent {
1388
1428
  const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
1389
1429
  activeIndicator.classList.remove(CLASS_NAME_ACTIVE$3);
1390
1430
  activeIndicator.removeAttribute('aria-current');
1391
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
1431
+ const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement); // eslint-disable-next-line unicorn/no-for-loop
1392
1432
 
1393
1433
  for (let i = 0; i < indicators.length; i++) {
1394
1434
  if (Number.parseInt(indicators[i].getAttribute('data-coreui-slide-to'), 10) === this._getItemIndex(element)) {
@@ -1612,7 +1652,7 @@ defineJQueryPlugin(Carousel);
1612
1652
 
1613
1653
  /**
1614
1654
  * --------------------------------------------------------------------------
1615
- * CoreUI (v4.0.5): collapse.js
1655
+ * CoreUI (v4.1.2): collapse.js
1616
1656
  * Licensed under MIT (https://coreui.io/license)
1617
1657
  *
1618
1658
  * This component is a modified version of the Bootstrap's collapse.js
@@ -1625,30 +1665,32 @@ defineJQueryPlugin(Carousel);
1625
1665
  * ------------------------------------------------------------------------
1626
1666
  */
1627
1667
 
1628
- const NAME$b = 'collapse';
1629
- const DATA_KEY$a = 'coreui.collapse';
1630
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
1668
+ const NAME$c = 'collapse';
1669
+ const DATA_KEY$b = 'coreui.collapse';
1670
+ const EVENT_KEY$b = `.${DATA_KEY$b}`;
1631
1671
  const DATA_API_KEY$7 = '.data-api';
1632
- const Default$a = {
1672
+ const Default$b = {
1633
1673
  toggle: true,
1634
- parent: ''
1674
+ parent: null
1635
1675
  };
1636
- const DefaultType$a = {
1676
+ const DefaultType$b = {
1637
1677
  toggle: 'boolean',
1638
- parent: '(string|element)'
1678
+ parent: '(null|element)'
1639
1679
  };
1640
- const EVENT_SHOW$6 = `show${EVENT_KEY$a}`;
1641
- const EVENT_SHOWN$6 = `shown${EVENT_KEY$a}`;
1642
- const EVENT_HIDE$6 = `hide${EVENT_KEY$a}`;
1643
- const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$a}`;
1644
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
1645
- const CLASS_NAME_SHOW$a = 'show';
1680
+ const EVENT_SHOW$6 = `show${EVENT_KEY$b}`;
1681
+ const EVENT_SHOWN$6 = `shown${EVENT_KEY$b}`;
1682
+ const EVENT_HIDE$6 = `hide${EVENT_KEY$b}`;
1683
+ const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$b}`;
1684
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
1685
+ const CLASS_NAME_SHOW$9 = 'show';
1646
1686
  const CLASS_NAME_COLLAPSE = 'collapse';
1647
1687
  const CLASS_NAME_COLLAPSING = 'collapsing';
1648
1688
  const CLASS_NAME_COLLAPSED = 'collapsed';
1689
+ const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
1690
+ const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
1649
1691
  const WIDTH = 'width';
1650
1692
  const HEIGHT = 'height';
1651
- const SELECTOR_ACTIVES = '.show, .collapsing';
1693
+ const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
1652
1694
  const SELECTOR_DATA_TOGGLE$5 = '[data-coreui-toggle="collapse"]';
1653
1695
  /**
1654
1696
  * ------------------------------------------------------------------------
@@ -1661,7 +1703,7 @@ class Collapse extends BaseComponent {
1661
1703
  super(element);
1662
1704
  this._isTransitioning = false;
1663
1705
  this._config = this._getConfig(config);
1664
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$5}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$5}[data-coreui-target="#${this._element.id}"]`);
1706
+ this._triggerArray = [];
1665
1707
  const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$5);
1666
1708
 
1667
1709
  for (let i = 0, len = toggleList.length; i < len; i++) {
@@ -1676,10 +1718,10 @@ class Collapse extends BaseComponent {
1676
1718
  }
1677
1719
  }
1678
1720
 
1679
- this._parent = this._config.parent ? this._getParent() : null;
1721
+ this._initializeChildren();
1680
1722
 
1681
1723
  if (!this._config.parent) {
1682
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
1724
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
1683
1725
  }
1684
1726
 
1685
1727
  if (this._config.toggle) {
@@ -1689,16 +1731,16 @@ class Collapse extends BaseComponent {
1689
1731
 
1690
1732
 
1691
1733
  static get Default() {
1692
- return Default$a;
1734
+ return Default$b;
1693
1735
  }
1694
1736
 
1695
1737
  static get NAME() {
1696
- return NAME$b;
1738
+ return NAME$c;
1697
1739
  } // Public
1698
1740
 
1699
1741
 
1700
1742
  toggle() {
1701
- if (this._element.classList.contains(CLASS_NAME_SHOW$a)) {
1743
+ if (this._isShown()) {
1702
1744
  this.hide();
1703
1745
  } else {
1704
1746
  this.show();
@@ -1706,30 +1748,21 @@ class Collapse extends BaseComponent {
1706
1748
  }
1707
1749
 
1708
1750
  show() {
1709
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$a)) {
1751
+ if (this._isTransitioning || this._isShown()) {
1710
1752
  return;
1711
1753
  }
1712
1754
 
1713
- let actives;
1755
+ let actives = [];
1714
1756
  let activesData;
1715
1757
 
1716
- if (this._parent) {
1717
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => {
1718
- if (typeof this._config.parent === 'string') {
1719
- return elem.getAttribute('data-coreui-parent') === this._config.parent;
1720
- }
1721
-
1722
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
1723
- });
1724
-
1725
- if (actives.length === 0) {
1726
- actives = null;
1727
- }
1758
+ if (this._config.parent) {
1759
+ const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
1760
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
1728
1761
  }
1729
1762
 
1730
1763
  const container = SelectorEngine.findOne(this._selector);
1731
1764
 
1732
- if (actives) {
1765
+ if (actives.length) {
1733
1766
  const tempActiveData = actives.find(elem => container !== elem);
1734
1767
  activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
1735
1768
 
@@ -1744,17 +1777,17 @@ class Collapse extends BaseComponent {
1744
1777
  return;
1745
1778
  }
1746
1779
 
1747
- if (actives) {
1748
- actives.forEach(elemActive => {
1749
- if (container !== elemActive) {
1750
- Collapse.collapseInterface(elemActive, 'hide');
1751
- }
1780
+ actives.forEach(elemActive => {
1781
+ if (container !== elemActive) {
1782
+ Collapse.getOrCreateInstance(elemActive, {
1783
+ toggle: false
1784
+ }).hide();
1785
+ }
1752
1786
 
1753
- if (!activesData) {
1754
- Data.set(elemActive, DATA_KEY$a, null);
1755
- }
1756
- });
1757
- }
1787
+ if (!activesData) {
1788
+ Data.set(elemActive, DATA_KEY$b, null);
1789
+ }
1790
+ });
1758
1791
 
1759
1792
  const dimension = this._getDimension();
1760
1793
 
@@ -1764,22 +1797,18 @@ class Collapse extends BaseComponent {
1764
1797
 
1765
1798
  this._element.style[dimension] = 0;
1766
1799
 
1767
- if (this._triggerArray.length) {
1768
- this._triggerArray.forEach(element => {
1769
- element.classList.remove(CLASS_NAME_COLLAPSED);
1770
- element.setAttribute('aria-expanded', true);
1771
- });
1772
- }
1800
+ this._addAriaAndCollapsedClass(this._triggerArray, true);
1773
1801
 
1774
- this.setTransitioning(true);
1802
+ this._isTransitioning = true;
1775
1803
 
1776
1804
  const complete = () => {
1805
+ this._isTransitioning = false;
1806
+
1777
1807
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1778
1808
 
1779
- this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$a);
1809
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
1780
1810
 
1781
1811
  this._element.style[dimension] = '';
1782
- this.setTransitioning(false);
1783
1812
  EventHandler.trigger(this._element, EVENT_SHOWN$6);
1784
1813
  };
1785
1814
 
@@ -1792,7 +1821,7 @@ class Collapse extends BaseComponent {
1792
1821
  }
1793
1822
 
1794
1823
  hide() {
1795
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$a)) {
1824
+ if (this._isTransitioning || !this._isShown()) {
1796
1825
  return;
1797
1826
  }
1798
1827
 
@@ -1809,26 +1838,23 @@ class Collapse extends BaseComponent {
1809
1838
 
1810
1839
  this._element.classList.add(CLASS_NAME_COLLAPSING);
1811
1840
 
1812
- this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$a);
1841
+ this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
1813
1842
 
1814
1843
  const triggerArrayLength = this._triggerArray.length;
1815
1844
 
1816
- if (triggerArrayLength > 0) {
1817
- for (let i = 0; i < triggerArrayLength; i++) {
1818
- const trigger = this._triggerArray[i];
1819
- const elem = getElementFromSelector(trigger);
1845
+ for (let i = 0; i < triggerArrayLength; i++) {
1846
+ const trigger = this._triggerArray[i];
1847
+ const elem = getElementFromSelector(trigger);
1820
1848
 
1821
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$a)) {
1822
- trigger.classList.add(CLASS_NAME_COLLAPSED);
1823
- trigger.setAttribute('aria-expanded', false);
1824
- }
1849
+ if (elem && !this._isShown(elem)) {
1850
+ this._addAriaAndCollapsedClass([trigger], false);
1825
1851
  }
1826
1852
  }
1827
1853
 
1828
- this.setTransitioning(true);
1854
+ this._isTransitioning = true;
1829
1855
 
1830
1856
  const complete = () => {
1831
- this.setTransitioning(false);
1857
+ this._isTransitioning = false;
1832
1858
 
1833
1859
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1834
1860
 
@@ -1842,45 +1868,47 @@ class Collapse extends BaseComponent {
1842
1868
  this._queueCallback(complete, this._element, true);
1843
1869
  }
1844
1870
 
1845
- setTransitioning(isTransitioning) {
1846
- this._isTransitioning = isTransitioning;
1871
+ _isShown(element = this._element) {
1872
+ return element.classList.contains(CLASS_NAME_SHOW$9);
1847
1873
  } // Private
1848
1874
 
1849
1875
 
1850
1876
  _getConfig(config) {
1851
- config = { ...Default$a,
1877
+ config = { ...Default$b,
1878
+ ...Manipulator.getDataAttributes(this._element),
1852
1879
  ...config
1853
1880
  };
1854
1881
  config.toggle = Boolean(config.toggle); // Coerce string values
1855
1882
 
1856
- typeCheckConfig(NAME$b, config, DefaultType$a);
1883
+ config.parent = getElement(config.parent);
1884
+ typeCheckConfig(NAME$c, config, DefaultType$b);
1857
1885
  return config;
1858
1886
  }
1859
1887
 
1860
1888
  _getDimension() {
1861
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
1889
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
1862
1890
  }
1863
1891
 
1864
- _getParent() {
1865
- let {
1866
- parent
1867
- } = this._config;
1868
- parent = getElement(parent);
1869
- const selector = `${SELECTOR_DATA_TOGGLE$5}[data-coreui-parent="${parent}"]`;
1870
- SelectorEngine.find(selector, parent).forEach(element => {
1892
+ _initializeChildren() {
1893
+ if (!this._config.parent) {
1894
+ return;
1895
+ }
1896
+
1897
+ const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
1898
+ SelectorEngine.find(SELECTOR_DATA_TOGGLE$5, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
1871
1899
  const selected = getElementFromSelector(element);
1872
1900
 
1873
- this._addAriaAndCollapsedClass(selected, [element]);
1901
+ if (selected) {
1902
+ this._addAriaAndCollapsedClass([element], this._isShown(selected));
1903
+ }
1874
1904
  });
1875
- return parent;
1876
1905
  }
1877
1906
 
1878
- _addAriaAndCollapsedClass(element, triggerArray) {
1879
- if (!element || !triggerArray.length) {
1907
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
1908
+ if (!triggerArray.length) {
1880
1909
  return;
1881
1910
  }
1882
1911
 
1883
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$a);
1884
1912
  triggerArray.forEach(elem => {
1885
1913
  if (isOpen) {
1886
1914
  elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -1893,33 +1921,23 @@ class Collapse extends BaseComponent {
1893
1921
  } // Static
1894
1922
 
1895
1923
 
1896
- static collapseInterface(element, config) {
1897
- let data = Collapse.getInstance(element);
1898
- const _config = { ...Default$a,
1899
- ...Manipulator.getDataAttributes(element),
1900
- ...(typeof config === 'object' && config ? config : {})
1901
- };
1902
-
1903
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
1904
- _config.toggle = false;
1905
- }
1906
-
1907
- if (!data) {
1908
- data = new Collapse(element, _config);
1909
- }
1924
+ static jQueryInterface(config) {
1925
+ return this.each(function () {
1926
+ const _config = {};
1910
1927
 
1911
- if (typeof config === 'string') {
1912
- if (typeof data[config] === 'undefined') {
1913
- throw new TypeError(`No method named "${config}"`);
1928
+ if (typeof config === 'string' && /show|hide/.test(config)) {
1929
+ _config.toggle = false;
1914
1930
  }
1915
1931
 
1916
- data[config]();
1917
- }
1918
- }
1932
+ const data = Collapse.getOrCreateInstance(this, _config);
1919
1933
 
1920
- static jQueryInterface(config) {
1921
- return this.each(function () {
1922
- Collapse.collapseInterface(this, config);
1934
+ if (typeof config === 'string') {
1935
+ if (typeof data[config] === 'undefined') {
1936
+ throw new TypeError(`No method named "${config}"`);
1937
+ }
1938
+
1939
+ data[config]();
1940
+ }
1923
1941
  });
1924
1942
  }
1925
1943
 
@@ -1937,26 +1955,12 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, functi
1937
1955
  event.preventDefault();
1938
1956
  }
1939
1957
 
1940
- const triggerData = Manipulator.getDataAttributes(this);
1941
1958
  const selector = getSelectorFromElement(this);
1942
1959
  const selectorElements = SelectorEngine.find(selector);
1943
1960
  selectorElements.forEach(element => {
1944
- const data = Collapse.getInstance(element);
1945
- let config;
1946
-
1947
- if (data) {
1948
- // update parent attribute
1949
- if (data._parent === null && typeof triggerData.parent === 'string') {
1950
- data._config.parent = triggerData.parent;
1951
- data._parent = data._getParent();
1952
- }
1953
-
1954
- config = 'toggle';
1955
- } else {
1956
- config = triggerData;
1957
- }
1958
-
1959
- Collapse.collapseInterface(element, config);
1961
+ Collapse.getOrCreateInstance(element, {
1962
+ toggle: false
1963
+ }).toggle();
1960
1964
  });
1961
1965
  });
1962
1966
  /**
@@ -1970,7 +1974,7 @@ defineJQueryPlugin(Collapse);
1970
1974
 
1971
1975
  /**
1972
1976
  * --------------------------------------------------------------------------
1973
- * CoreUI (v4.0.5): dropdown.js
1977
+ * CoreUI (v4.1.2): dropdown.js
1974
1978
  * Licensed under MIT (https://coreui.io/license)
1975
1979
  *
1976
1980
  * This component is a modified version of the Bootstrap's dropdown.js
@@ -1983,27 +1987,26 @@ defineJQueryPlugin(Collapse);
1983
1987
  * ------------------------------------------------------------------------
1984
1988
  */
1985
1989
 
1986
- const NAME$a = 'dropdown';
1987
- const DATA_KEY$9 = 'coreui.dropdown';
1988
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
1990
+ const NAME$b = 'dropdown';
1991
+ const DATA_KEY$a = 'coreui.dropdown';
1992
+ const EVENT_KEY$a = `.${DATA_KEY$a}`;
1989
1993
  const DATA_API_KEY$6 = '.data-api';
1990
1994
  const ESCAPE_KEY$2 = 'Escape';
1991
1995
  const SPACE_KEY = 'Space';
1992
- const TAB_KEY = 'Tab';
1996
+ const TAB_KEY$1 = 'Tab';
1993
1997
  const ARROW_UP_KEY = 'ArrowUp';
1994
1998
  const ARROW_DOWN_KEY = 'ArrowDown';
1995
1999
  const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
1996
2000
 
1997
2001
  const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
1998
- const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
1999
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
2000
- const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
2001
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
2002
- const EVENT_CLICK = `click${EVENT_KEY$9}`;
2003
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
2004
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$9}${DATA_API_KEY$6}`;
2005
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$9}${DATA_API_KEY$6}`;
2006
- const CLASS_NAME_SHOW$9 = 'show';
2002
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$a}`;
2003
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$a}`;
2004
+ const EVENT_SHOW$5 = `show${EVENT_KEY$a}`;
2005
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$a}`;
2006
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
2007
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$a}${DATA_API_KEY$6}`;
2008
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$a}${DATA_API_KEY$6}`;
2009
+ const CLASS_NAME_SHOW$8 = 'show';
2007
2010
  const CLASS_NAME_DROPUP = 'dropup';
2008
2011
  const CLASS_NAME_DROPEND = 'dropend';
2009
2012
  const CLASS_NAME_DROPSTART = 'dropstart';
@@ -2018,7 +2021,7 @@ const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
2018
2021
  const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
2019
2022
  const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
2020
2023
  const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
2021
- const Default$9 = {
2024
+ const Default$a = {
2022
2025
  offset: [0, 2],
2023
2026
  boundary: 'clippingParents',
2024
2027
  reference: 'toggle',
@@ -2026,7 +2029,7 @@ const Default$9 = {
2026
2029
  popperConfig: null,
2027
2030
  autoClose: true
2028
2031
  };
2029
- const DefaultType$9 = {
2032
+ const DefaultType$a = {
2030
2033
  offset: '(array|string|function)',
2031
2034
  boundary: '(string|element)',
2032
2035
  reference: '(string|element|object)',
@@ -2047,45 +2050,31 @@ class Dropdown extends BaseComponent {
2047
2050
  this._config = this._getConfig(config);
2048
2051
  this._menu = this._getMenuElement();
2049
2052
  this._inNavbar = this._detectNavbar();
2050
-
2051
- this._addEventListeners();
2052
2053
  } // Getters
2053
2054
 
2054
2055
 
2055
2056
  static get Default() {
2056
- return Default$9;
2057
+ return Default$a;
2057
2058
  }
2058
2059
 
2059
2060
  static get DefaultType() {
2060
- return DefaultType$9;
2061
+ return DefaultType$a;
2061
2062
  }
2062
2063
 
2063
2064
  static get NAME() {
2064
- return NAME$a;
2065
- } // Public
2066
-
2067
-
2068
- toggle() {
2069
- if (isDisabled(this._element)) {
2070
- return;
2071
- }
2072
-
2073
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$9);
2074
-
2075
- if (isActive) {
2076
- this.hide();
2077
- return;
2078
- }
2065
+ return NAME$b;
2066
+ } // Public
2079
2067
 
2080
- this.show();
2068
+
2069
+ toggle() {
2070
+ return this._isShown() ? this.hide() : this.show();
2081
2071
  }
2082
2072
 
2083
2073
  show() {
2084
- if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$9)) {
2074
+ if (isDisabled(this._element) || this._isShown(this._menu)) {
2085
2075
  return;
2086
2076
  }
2087
2077
 
2088
- const parent = Dropdown.getParentFromElement(this._element);
2089
2078
  const relatedTarget = {
2090
2079
  relatedTarget: this._element
2091
2080
  };
@@ -2093,34 +2082,14 @@ class Dropdown extends BaseComponent {
2093
2082
 
2094
2083
  if (showEvent.defaultPrevented) {
2095
2084
  return;
2096
- } // Totally disable Popper for Dropdowns in Navbar
2085
+ }
2097
2086
 
2087
+ const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
2098
2088
 
2099
2089
  if (this._inNavbar) {
2100
2090
  Manipulator.setDataAttribute(this._menu, 'popper', 'none');
2101
2091
  } else {
2102
- if (typeof Popper === 'undefined') {
2103
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
2104
- }
2105
-
2106
- let referenceElement = this._element;
2107
-
2108
- if (this._config.reference === 'parent') {
2109
- referenceElement = parent;
2110
- } else if (isElement(this._config.reference)) {
2111
- referenceElement = getElement(this._config.reference);
2112
- } else if (typeof this._config.reference === 'object') {
2113
- referenceElement = this._config.reference;
2114
- }
2115
-
2116
- const popperConfig = this._getPopperConfig();
2117
-
2118
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
2119
- this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
2120
-
2121
- if (isDisplayStatic) {
2122
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
2123
- }
2092
+ this._createPopper(parent);
2124
2093
  } // If this is a touch-enabled device we add extra
2125
2094
  // empty mouseover listeners to the body's immediate children;
2126
2095
  // only needed because of broken event delegation on iOS
@@ -2135,15 +2104,15 @@ class Dropdown extends BaseComponent {
2135
2104
 
2136
2105
  this._element.setAttribute('aria-expanded', true);
2137
2106
 
2138
- this._menu.classList.toggle(CLASS_NAME_SHOW$9);
2107
+ this._menu.classList.add(CLASS_NAME_SHOW$8);
2139
2108
 
2140
- this._element.classList.toggle(CLASS_NAME_SHOW$9);
2109
+ this._element.classList.add(CLASS_NAME_SHOW$8);
2141
2110
 
2142
2111
  EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
2143
2112
  }
2144
2113
 
2145
2114
  hide() {
2146
- if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$9)) {
2115
+ if (isDisabled(this._element) || !this._isShown(this._menu)) {
2147
2116
  return;
2148
2117
  }
2149
2118
 
@@ -2171,13 +2140,6 @@ class Dropdown extends BaseComponent {
2171
2140
  } // Private
2172
2141
 
2173
2142
 
2174
- _addEventListeners() {
2175
- EventHandler.on(this._element, EVENT_CLICK, event => {
2176
- event.preventDefault();
2177
- this.toggle();
2178
- });
2179
- }
2180
-
2181
2143
  _completeHide(relatedTarget) {
2182
2144
  const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
2183
2145
 
@@ -2195,9 +2157,9 @@ class Dropdown extends BaseComponent {
2195
2157
  this._popper.destroy();
2196
2158
  }
2197
2159
 
2198
- this._menu.classList.remove(CLASS_NAME_SHOW$9);
2160
+ this._menu.classList.remove(CLASS_NAME_SHOW$8);
2199
2161
 
2200
- this._element.classList.remove(CLASS_NAME_SHOW$9);
2162
+ this._element.classList.remove(CLASS_NAME_SHOW$8);
2201
2163
 
2202
2164
  this._element.setAttribute('aria-expanded', 'false');
2203
2165
 
@@ -2210,16 +2172,45 @@ class Dropdown extends BaseComponent {
2210
2172
  ...Manipulator.getDataAttributes(this._element),
2211
2173
  ...config
2212
2174
  };
2213
- typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
2175
+ typeCheckConfig(NAME$b, config, this.constructor.DefaultType);
2214
2176
 
2215
2177
  if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
2216
2178
  // Popper virtual elements require a getBoundingClientRect method
2217
- throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2179
+ throw new TypeError(`${NAME$b.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2218
2180
  }
2219
2181
 
2220
2182
  return config;
2221
2183
  }
2222
2184
 
2185
+ _createPopper(parent) {
2186
+ if (typeof Popper === 'undefined') {
2187
+ throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
2188
+ }
2189
+
2190
+ let referenceElement = this._element;
2191
+
2192
+ if (this._config.reference === 'parent') {
2193
+ referenceElement = parent;
2194
+ } else if (isElement(this._config.reference)) {
2195
+ referenceElement = getElement(this._config.reference);
2196
+ } else if (typeof this._config.reference === 'object') {
2197
+ referenceElement = this._config.reference;
2198
+ }
2199
+
2200
+ const popperConfig = this._getPopperConfig();
2201
+
2202
+ const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
2203
+ this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
2204
+
2205
+ if (isDisplayStatic) {
2206
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
2207
+ }
2208
+ }
2209
+
2210
+ _isShown(element = this._element) {
2211
+ return element.classList.contains(CLASS_NAME_SHOW$8);
2212
+ }
2213
+
2223
2214
  _getMenuElement() {
2224
2215
  return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
2225
2216
  }
@@ -2309,26 +2300,24 @@ class Dropdown extends BaseComponent {
2309
2300
  } // Static
2310
2301
 
2311
2302
 
2312
- static dropdownInterface(element, config) {
2313
- const data = Dropdown.getOrCreateInstance(element, config);
2303
+ static jQueryInterface(config) {
2304
+ return this.each(function () {
2305
+ const data = Dropdown.getOrCreateInstance(this, config);
2306
+
2307
+ if (typeof config !== 'string') {
2308
+ return;
2309
+ }
2314
2310
 
2315
- if (typeof config === 'string') {
2316
2311
  if (typeof data[config] === 'undefined') {
2317
2312
  throw new TypeError(`No method named "${config}"`);
2318
2313
  }
2319
2314
 
2320
2315
  data[config]();
2321
- }
2322
- }
2323
-
2324
- static jQueryInterface(config) {
2325
- return this.each(function () {
2326
- Dropdown.dropdownInterface(this, config);
2327
2316
  });
2328
2317
  }
2329
2318
 
2330
2319
  static clearMenus(event) {
2331
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
2320
+ if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
2332
2321
  return;
2333
2322
  }
2334
2323
 
@@ -2341,7 +2330,7 @@ class Dropdown extends BaseComponent {
2341
2330
  continue;
2342
2331
  }
2343
2332
 
2344
- if (!context._element.classList.contains(CLASS_NAME_SHOW$9)) {
2333
+ if (!context._isShown()) {
2345
2334
  continue;
2346
2335
  }
2347
2336
 
@@ -2358,7 +2347,7 @@ class Dropdown extends BaseComponent {
2358
2347
  } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
2359
2348
 
2360
2349
 
2361
- if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
2350
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
2362
2351
  continue;
2363
2352
  }
2364
2353
 
@@ -2387,7 +2376,7 @@ class Dropdown extends BaseComponent {
2387
2376
  return;
2388
2377
  }
2389
2378
 
2390
- const isActive = this.classList.contains(CLASS_NAME_SHOW$9);
2379
+ const isActive = this.classList.contains(CLASS_NAME_SHOW$8);
2391
2380
 
2392
2381
  if (!isActive && event.key === ESCAPE_KEY$2) {
2393
2382
  return;
@@ -2400,20 +2389,20 @@ class Dropdown extends BaseComponent {
2400
2389
  return;
2401
2390
  }
2402
2391
 
2403
- const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$4) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$4)[0];
2392
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$4) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$4)[0];
2393
+ const instance = Dropdown.getOrCreateInstance(getToggleButton);
2404
2394
 
2405
2395
  if (event.key === ESCAPE_KEY$2) {
2406
- getToggleButton().focus();
2407
- Dropdown.clearMenus();
2396
+ instance.hide();
2408
2397
  return;
2409
2398
  }
2410
2399
 
2411
2400
  if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
2412
2401
  if (!isActive) {
2413
- getToggleButton().click();
2402
+ instance.show();
2414
2403
  }
2415
2404
 
2416
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
2405
+ instance._selectMenuItem(event);
2417
2406
 
2418
2407
  return;
2419
2408
  }
@@ -2437,7 +2426,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, Dropdown.clearMenus);
2437
2426
  EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
2438
2427
  EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$4, function (event) {
2439
2428
  event.preventDefault();
2440
- Dropdown.dropdownInterface(this);
2429
+ Dropdown.getOrCreateInstance(this).toggle();
2441
2430
  });
2442
2431
  /**
2443
2432
  * ------------------------------------------------------------------------
@@ -2450,7 +2439,7 @@ defineJQueryPlugin(Dropdown);
2450
2439
 
2451
2440
  /**
2452
2441
  * --------------------------------------------------------------------------
2453
- * Bootstrap (v5.0.2): util/scrollBar.js
2442
+ * Bootstrap (v5.1.3): util/scrollBar.js
2454
2443
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2455
2444
  * --------------------------------------------------------------------------
2456
2445
  */
@@ -2554,11 +2543,12 @@ class ScrollBarHelper {
2554
2543
 
2555
2544
  /**
2556
2545
  * --------------------------------------------------------------------------
2557
- * Bootstrap (v5.0.2): util/backdrop.js
2558
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2546
+ * Bootstrap (v5.1.3): util/backdrop.js
2547
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2559
2548
  * --------------------------------------------------------------------------
2560
2549
  */
2561
- const Default$8 = {
2550
+ const Default$9 = {
2551
+ className: 'modal-backdrop',
2562
2552
  isVisible: true,
2563
2553
  // if false, we use the backdrop helper without adding any element to the dom
2564
2554
  isAnimated: false,
@@ -2566,17 +2556,17 @@ const Default$8 = {
2566
2556
  // give the choice to place backdrop under different elements
2567
2557
  clickCallback: null
2568
2558
  };
2569
- const DefaultType$8 = {
2559
+ const DefaultType$9 = {
2560
+ className: 'string',
2570
2561
  isVisible: 'boolean',
2571
2562
  isAnimated: 'boolean',
2572
2563
  rootElement: '(element|string)',
2573
2564
  clickCallback: '(function|null)'
2574
2565
  };
2575
- const NAME$9 = 'backdrop';
2576
- const CLASS_NAME_BACKDROP$1 = 'modal-backdrop';
2577
- const CLASS_NAME_FADE$6 = 'fade';
2578
- const CLASS_NAME_SHOW$8 = 'show';
2579
- const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$9}`;
2566
+ const NAME$a = 'backdrop';
2567
+ const CLASS_NAME_FADE$4 = 'fade';
2568
+ const CLASS_NAME_SHOW$7 = 'show';
2569
+ const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$a}`;
2580
2570
 
2581
2571
  class Backdrop {
2582
2572
  constructor(config) {
@@ -2597,7 +2587,7 @@ class Backdrop {
2597
2587
  reflow(this._getElement());
2598
2588
  }
2599
2589
 
2600
- this._getElement().classList.add(CLASS_NAME_SHOW$8);
2590
+ this._getElement().classList.add(CLASS_NAME_SHOW$7);
2601
2591
 
2602
2592
  this._emulateAnimation(() => {
2603
2593
  execute(callback);
@@ -2610,7 +2600,7 @@ class Backdrop {
2610
2600
  return;
2611
2601
  }
2612
2602
 
2613
- this._getElement().classList.remove(CLASS_NAME_SHOW$8);
2603
+ this._getElement().classList.remove(CLASS_NAME_SHOW$7);
2614
2604
 
2615
2605
  this._emulateAnimation(() => {
2616
2606
  this.dispose();
@@ -2622,10 +2612,10 @@ class Backdrop {
2622
2612
  _getElement() {
2623
2613
  if (!this._element) {
2624
2614
  const backdrop = document.createElement('div');
2625
- backdrop.className = CLASS_NAME_BACKDROP$1;
2615
+ backdrop.className = this._config.className;
2626
2616
 
2627
2617
  if (this._config.isAnimated) {
2628
- backdrop.classList.add(CLASS_NAME_FADE$6);
2618
+ backdrop.classList.add(CLASS_NAME_FADE$4);
2629
2619
  }
2630
2620
 
2631
2621
  this._element = backdrop;
@@ -2635,12 +2625,12 @@ class Backdrop {
2635
2625
  }
2636
2626
 
2637
2627
  _getConfig(config) {
2638
- config = { ...Default$8,
2628
+ config = { ...Default$9,
2639
2629
  ...(typeof config === 'object' ? config : {})
2640
2630
  }; // use getElement() with the default "body" to get a fresh Element on each instantiation
2641
2631
 
2642
2632
  config.rootElement = getElement(config.rootElement);
2643
- typeCheckConfig(NAME$9, config, DefaultType$8);
2633
+ typeCheckConfig(NAME$a, config, DefaultType$9);
2644
2634
  return config;
2645
2635
  }
2646
2636
 
@@ -2649,7 +2639,7 @@ class Backdrop {
2649
2639
  return;
2650
2640
  }
2651
2641
 
2652
- this._config.rootElement.appendChild(this._getElement());
2642
+ this._config.rootElement.append(this._getElement());
2653
2643
 
2654
2644
  EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
2655
2645
  execute(this._config.clickCallback);
@@ -2677,7 +2667,110 @@ class Backdrop {
2677
2667
 
2678
2668
  /**
2679
2669
  * --------------------------------------------------------------------------
2680
- * CoreUI (v4.0.5): modal.js
2670
+ * Bootstrap (v5.1.3): util/focustrap.js
2671
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2672
+ * --------------------------------------------------------------------------
2673
+ */
2674
+ const Default$8 = {
2675
+ trapElement: null,
2676
+ // The element to trap focus inside of
2677
+ autofocus: true
2678
+ };
2679
+ const DefaultType$8 = {
2680
+ trapElement: 'element',
2681
+ autofocus: 'boolean'
2682
+ };
2683
+ const NAME$9 = 'focustrap';
2684
+ const DATA_KEY$9 = 'coreui.focustrap';
2685
+ const EVENT_KEY$9 = `.${DATA_KEY$9}`;
2686
+ const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$9}`;
2687
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$9}`;
2688
+ const TAB_KEY = 'Tab';
2689
+ const TAB_NAV_FORWARD = 'forward';
2690
+ const TAB_NAV_BACKWARD = 'backward';
2691
+
2692
+ class FocusTrap {
2693
+ constructor(config) {
2694
+ this._config = this._getConfig(config);
2695
+ this._isActive = false;
2696
+ this._lastTabNavDirection = null;
2697
+ }
2698
+
2699
+ activate() {
2700
+ const {
2701
+ trapElement,
2702
+ autofocus
2703
+ } = this._config;
2704
+
2705
+ if (this._isActive) {
2706
+ return;
2707
+ }
2708
+
2709
+ if (autofocus) {
2710
+ trapElement.focus();
2711
+ }
2712
+
2713
+ EventHandler.off(document, EVENT_KEY$9); // guard against infinite focus loop
2714
+
2715
+ EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
2716
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
2717
+ this._isActive = true;
2718
+ }
2719
+
2720
+ deactivate() {
2721
+ if (!this._isActive) {
2722
+ return;
2723
+ }
2724
+
2725
+ this._isActive = false;
2726
+ EventHandler.off(document, EVENT_KEY$9);
2727
+ } // Private
2728
+
2729
+
2730
+ _handleFocusin(event) {
2731
+ const {
2732
+ target
2733
+ } = event;
2734
+ const {
2735
+ trapElement
2736
+ } = this._config;
2737
+
2738
+ if (target === document || target === trapElement || trapElement.contains(target)) {
2739
+ return;
2740
+ }
2741
+
2742
+ const elements = SelectorEngine.focusableChildren(trapElement);
2743
+
2744
+ if (elements.length === 0) {
2745
+ trapElement.focus();
2746
+ } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
2747
+ elements[elements.length - 1].focus();
2748
+ } else {
2749
+ elements[0].focus();
2750
+ }
2751
+ }
2752
+
2753
+ _handleKeydown(event) {
2754
+ if (event.key !== TAB_KEY) {
2755
+ return;
2756
+ }
2757
+
2758
+ this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
2759
+ }
2760
+
2761
+ _getConfig(config) {
2762
+ config = { ...Default$8,
2763
+ ...(typeof config === 'object' ? config : {})
2764
+ };
2765
+ typeCheckConfig(NAME$9, config, DefaultType$8);
2766
+ return config;
2767
+ }
2768
+
2769
+ }
2770
+
2771
+ /**
2772
+ * --------------------------------------------------------------------------
2773
+ * CoreUI (v4.1.2): modal.js
2681
2774
  * Licensed under MIT (https://coreui.io/license)
2682
2775
  *
2683
2776
  * This component is a modified version of the Bootstrap's modal.js
@@ -2710,21 +2803,20 @@ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$8}`;
2710
2803
  const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
2711
2804
  const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
2712
2805
  const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
2713
- const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$8}`;
2714
2806
  const EVENT_RESIZE$1 = `resize${EVENT_KEY$8}`;
2715
- const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$8}`;
2807
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$8}`;
2716
2808
  const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$8}`;
2717
2809
  const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$8}`;
2718
2810
  const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$8}`;
2719
2811
  const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
2720
2812
  const CLASS_NAME_OPEN = 'modal-open';
2721
- const CLASS_NAME_FADE$5 = 'fade';
2722
- const CLASS_NAME_SHOW$7 = 'show';
2813
+ const CLASS_NAME_FADE$3 = 'fade';
2814
+ const CLASS_NAME_SHOW$6 = 'show';
2723
2815
  const CLASS_NAME_STATIC = 'modal-static';
2816
+ const OPEN_SELECTOR$1 = '.modal.show';
2724
2817
  const SELECTOR_DIALOG = '.modal-dialog';
2725
2818
  const SELECTOR_MODAL_BODY = '.modal-body';
2726
2819
  const SELECTOR_DATA_TOGGLE$3 = '[data-coreui-toggle="modal"]';
2727
- const SELECTOR_DATA_DISMISS$2 = '[data-coreui-dismiss="modal"]';
2728
2820
  /**
2729
2821
  * ------------------------------------------------------------------------
2730
2822
  * Class Definition
@@ -2737,6 +2829,7 @@ class Modal extends BaseComponent {
2737
2829
  this._config = this._getConfig(config);
2738
2830
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
2739
2831
  this._backdrop = this._initializeBackDrop();
2832
+ this._focustrap = this._initializeFocusTrap();
2740
2833
  this._isShown = false;
2741
2834
  this._ignoreBackdropClick = false;
2742
2835
  this._isTransitioning = false;
@@ -2786,7 +2879,6 @@ class Modal extends BaseComponent {
2786
2879
 
2787
2880
  this._setResizeEvent();
2788
2881
 
2789
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
2790
2882
  EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
2791
2883
  EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
2792
2884
  if (event.target === this._element) {
@@ -2798,11 +2890,7 @@ class Modal extends BaseComponent {
2798
2890
  this._showBackdrop(() => this._showElement(relatedTarget));
2799
2891
  }
2800
2892
 
2801
- hide(event) {
2802
- if (event && ['A', 'AREA'].includes(event.target.tagName)) {
2803
- event.preventDefault();
2804
- }
2805
-
2893
+ hide() {
2806
2894
  if (!this._isShown || this._isTransitioning) {
2807
2895
  return;
2808
2896
  }
@@ -2825,11 +2913,11 @@ class Modal extends BaseComponent {
2825
2913
 
2826
2914
  this._setResizeEvent();
2827
2915
 
2828
- EventHandler.off(document, EVENT_FOCUSIN$2);
2916
+ this._focustrap.deactivate();
2829
2917
 
2830
- this._element.classList.remove(CLASS_NAME_SHOW$7);
2918
+ this._element.classList.remove(CLASS_NAME_SHOW$6);
2831
2919
 
2832
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
2920
+ EventHandler.off(this._element, EVENT_CLICK_DISMISS);
2833
2921
  EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
2834
2922
 
2835
2923
  this._queueCallback(() => this._hideModal(), this._element, isAnimated);
@@ -2840,14 +2928,9 @@ class Modal extends BaseComponent {
2840
2928
 
2841
2929
  this._backdrop.dispose();
2842
2930
 
2843
- super.dispose();
2844
- /**
2845
- * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
2846
- * Do not move `document` in `htmlElements` array
2847
- * It will remove `EVENT_CLICK_DATA_API` event that should remain
2848
- */
2931
+ this._focustrap.deactivate();
2849
2932
 
2850
- EventHandler.off(document, EVENT_FOCUSIN$2);
2933
+ super.dispose();
2851
2934
  }
2852
2935
 
2853
2936
  handleUpdate() {
@@ -2863,6 +2946,12 @@ class Modal extends BaseComponent {
2863
2946
  });
2864
2947
  }
2865
2948
 
2949
+ _initializeFocusTrap() {
2950
+ return new FocusTrap({
2951
+ trapElement: this._element
2952
+ });
2953
+ }
2954
+
2866
2955
  _getConfig(config) {
2867
2956
  config = { ...Default$7,
2868
2957
  ...Manipulator.getDataAttributes(this._element),
@@ -2879,7 +2968,7 @@ class Modal extends BaseComponent {
2879
2968
 
2880
2969
  if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
2881
2970
  // Don't move modal's DOM position
2882
- document.body.appendChild(this._element);
2971
+ document.body.append(this._element);
2883
2972
  }
2884
2973
 
2885
2974
  this._element.style.display = 'block';
@@ -2900,15 +2989,11 @@ class Modal extends BaseComponent {
2900
2989
  reflow(this._element);
2901
2990
  }
2902
2991
 
2903
- this._element.classList.add(CLASS_NAME_SHOW$7);
2904
-
2905
- if (this._config.focus) {
2906
- this._enforceFocus();
2907
- }
2992
+ this._element.classList.add(CLASS_NAME_SHOW$6);
2908
2993
 
2909
2994
  const transitionComplete = () => {
2910
2995
  if (this._config.focus) {
2911
- this._element.focus();
2996
+ this._focustrap.activate();
2912
2997
  }
2913
2998
 
2914
2999
  this._isTransitioning = false;
@@ -2920,16 +3005,6 @@ class Modal extends BaseComponent {
2920
3005
  this._queueCallback(transitionComplete, this._dialog, isAnimated);
2921
3006
  }
2922
3007
 
2923
- _enforceFocus() {
2924
- EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop
2925
-
2926
- EventHandler.on(document, EVENT_FOCUSIN$2, event => {
2927
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
2928
- this._element.focus();
2929
- }
2930
- });
2931
- }
2932
-
2933
3008
  _setEscapeEvent() {
2934
3009
  if (this._isShown) {
2935
3010
  EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
@@ -2976,7 +3051,7 @@ class Modal extends BaseComponent {
2976
3051
  }
2977
3052
 
2978
3053
  _showBackdrop(callback) {
2979
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
3054
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
2980
3055
  if (this._ignoreBackdropClick) {
2981
3056
  this._ignoreBackdropClick = false;
2982
3057
  return;
@@ -2997,7 +3072,7 @@ class Modal extends BaseComponent {
2997
3072
  }
2998
3073
 
2999
3074
  _isAnimated() {
3000
- return this._element.classList.contains(CLASS_NAME_FADE$5);
3075
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
3001
3076
  }
3002
3077
 
3003
3078
  _triggerBackdropTransition() {
@@ -3104,10 +3179,18 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$3, functi
3104
3179
  this.focus();
3105
3180
  }
3106
3181
  });
3107
- });
3182
+ }); // avoid conflict when clicking moddal toggler while another one is open
3183
+
3184
+ const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
3185
+
3186
+ if (allReadyOpen) {
3187
+ Modal.getInstance(allReadyOpen).hide();
3188
+ }
3189
+
3108
3190
  const data = Modal.getOrCreateInstance(target);
3109
3191
  data.toggle(this);
3110
3192
  });
3193
+ enableDismissTrigger(Modal);
3111
3194
  /**
3112
3195
  * ------------------------------------------------------------------------
3113
3196
  * jQuery
@@ -3119,7 +3202,7 @@ defineJQueryPlugin(Modal);
3119
3202
 
3120
3203
  /**
3121
3204
  * --------------------------------------------------------------------------
3122
- * CoreUI (v4.0.5): navigation.js
3205
+ * CoreUI (v4.1.2): navigation.js
3123
3206
  * Licensed under MIT (https://coreui.io/license)
3124
3207
  * --------------------------------------------------------------------------
3125
3208
  */
@@ -3142,7 +3225,7 @@ const DefaultType$6 = {
3142
3225
  groupsAutoCollapse: '(string|boolean)'
3143
3226
  };
3144
3227
  const CLASS_NAME_ACTIVE$2 = 'active';
3145
- const CLASS_NAME_SHOW$6 = 'show';
3228
+ const CLASS_NAME_SHOW$5 = 'show';
3146
3229
  const CLASS_NAME_NAV_GROUP = 'nav-group';
3147
3230
  const CLASS_NAME_NAV_GROUP_TOGGLE = 'nav-group-toggle';
3148
3231
  const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
@@ -3219,7 +3302,7 @@ class Navigation extends BaseComponent {
3219
3302
  if (this._config.activeLinksExact && element.href === currentUrl) {
3220
3303
  element.classList.add(CLASS_NAME_ACTIVE$2);
3221
3304
  Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
3222
- element.classList.add(CLASS_NAME_SHOW$6);
3305
+ element.classList.add(CLASS_NAME_SHOW$5);
3223
3306
  element.setAttribute('aria-expanded', true);
3224
3307
  });
3225
3308
  }
@@ -3227,7 +3310,7 @@ class Navigation extends BaseComponent {
3227
3310
  if (!this._config.activeLinksExact && element.href.startsWith(currentUrl)) {
3228
3311
  element.classList.add(CLASS_NAME_ACTIVE$2);
3229
3312
  Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
3230
- element.classList.add(CLASS_NAME_SHOW$6);
3313
+ element.classList.add(CLASS_NAME_SHOW$5);
3231
3314
  element.setAttribute('aria-expanded', true);
3232
3315
  });
3233
3316
  }
@@ -3326,28 +3409,28 @@ class Navigation extends BaseComponent {
3326
3409
  toggler = toggler.closest(SELECTOR_NAV_GROUP_TOGGLE);
3327
3410
  }
3328
3411
 
3329
- const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$6)); // Close other groups
3412
+ const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$5)); // Close other groups
3330
3413
 
3331
3414
 
3332
3415
  if (this._config.groupsAutoCollapse === true) {
3333
3416
  this._getSiblings(toggler.parentNode, filter).forEach(element => {
3334
3417
  this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, element), () => {
3335
- element.classList.remove(CLASS_NAME_SHOW$6);
3418
+ element.classList.remove(CLASS_NAME_SHOW$5);
3336
3419
  element.setAttribute('aria-expanded', false);
3337
3420
  });
3338
3421
  });
3339
3422
  }
3340
3423
 
3341
- if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$6)) {
3424
+ if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$5)) {
3342
3425
  this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode), () => {
3343
- toggler.parentNode.classList.remove(CLASS_NAME_SHOW$6);
3426
+ toggler.parentNode.classList.remove(CLASS_NAME_SHOW$5);
3344
3427
  toggler.parentNode.setAttribute('aria-expanded', false);
3345
3428
  });
3346
3429
 
3347
3430
  return;
3348
3431
  }
3349
3432
 
3350
- toggler.parentNode.classList.add(CLASS_NAME_SHOW$6);
3433
+ toggler.parentNode.classList.add(CLASS_NAME_SHOW$5);
3351
3434
  toggler.parentNode.setAttribute('aria-expanded', true);
3352
3435
 
3353
3436
  this._slideDown(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode));
@@ -3404,7 +3487,7 @@ defineJQueryPlugin(Navigation);
3404
3487
 
3405
3488
  /**
3406
3489
  * --------------------------------------------------------------------------
3407
- * CoreUI (v4.0.5): dropdown.js
3490
+ * CoreUI (v4.1.2): dropdown.js
3408
3491
  * Licensed under MIT (https://coreui.io/license)
3409
3492
  *
3410
3493
  * This component is a modified version of the Bootstrap's offcanvas.js
@@ -3433,17 +3516,15 @@ const DefaultType$5 = {
3433
3516
  keyboard: 'boolean',
3434
3517
  scroll: 'boolean'
3435
3518
  };
3436
- const CLASS_NAME_SHOW$5 = 'show';
3519
+ const CLASS_NAME_SHOW$4 = 'show';
3520
+ const CLASS_NAME_BACKDROP$1 = 'offcanvas-backdrop';
3437
3521
  const OPEN_SELECTOR = '.offcanvas.show';
3438
3522
  const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
3439
3523
  const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
3440
3524
  const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
3441
3525
  const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
3442
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
3443
3526
  const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
3444
- const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$6}`;
3445
3527
  const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
3446
- const SELECTOR_DATA_DISMISS$1 = '[data-coreui-dismiss="offcanvas"]';
3447
3528
  const SELECTOR_DATA_TOGGLE$2 = '[data-coreui-toggle="offcanvas"]';
3448
3529
  /**
3449
3530
  * ------------------------------------------------------------------------
@@ -3457,6 +3538,7 @@ class Offcanvas extends BaseComponent {
3457
3538
  this._config = this._getConfig(config);
3458
3539
  this._isShown = false;
3459
3540
  this._backdrop = this._initializeBackDrop();
3541
+ this._focustrap = this._initializeFocusTrap();
3460
3542
 
3461
3543
  this._addEventListeners();
3462
3544
  } // Getters
@@ -3495,8 +3577,6 @@ class Offcanvas extends BaseComponent {
3495
3577
 
3496
3578
  if (!this._config.scroll) {
3497
3579
  new ScrollBarHelper().hide();
3498
-
3499
- this._enforceFocusOnElement(this._element);
3500
3580
  }
3501
3581
 
3502
3582
  this._element.removeAttribute('aria-hidden');
@@ -3505,9 +3585,13 @@ class Offcanvas extends BaseComponent {
3505
3585
 
3506
3586
  this._element.setAttribute('role', 'dialog');
3507
3587
 
3508
- this._element.classList.add(CLASS_NAME_SHOW$5);
3588
+ this._element.classList.add(CLASS_NAME_SHOW$4);
3509
3589
 
3510
3590
  const completeCallBack = () => {
3591
+ if (!this._config.scroll) {
3592
+ this._focustrap.activate();
3593
+ }
3594
+
3511
3595
  EventHandler.trigger(this._element, EVENT_SHOWN$3, {
3512
3596
  relatedTarget
3513
3597
  });
@@ -3527,13 +3611,13 @@ class Offcanvas extends BaseComponent {
3527
3611
  return;
3528
3612
  }
3529
3613
 
3530
- EventHandler.off(document, EVENT_FOCUSIN$1);
3614
+ this._focustrap.deactivate();
3531
3615
 
3532
3616
  this._element.blur();
3533
3617
 
3534
3618
  this._isShown = false;
3535
3619
 
3536
- this._element.classList.remove(CLASS_NAME_SHOW$5);
3620
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
3537
3621
 
3538
3622
  this._backdrop.hide();
3539
3623
 
@@ -3559,8 +3643,9 @@ class Offcanvas extends BaseComponent {
3559
3643
  dispose() {
3560
3644
  this._backdrop.dispose();
3561
3645
 
3646
+ this._focustrap.deactivate();
3647
+
3562
3648
  super.dispose();
3563
- EventHandler.off(document, EVENT_FOCUSIN$1);
3564
3649
  } // Private
3565
3650
 
3566
3651
 
@@ -3575,6 +3660,7 @@ class Offcanvas extends BaseComponent {
3575
3660
 
3576
3661
  _initializeBackDrop() {
3577
3662
  return new Backdrop({
3663
+ className: CLASS_NAME_BACKDROP$1,
3578
3664
  isVisible: this._config.backdrop,
3579
3665
  isAnimated: true,
3580
3666
  rootElement: this._element.parentNode,
@@ -3582,19 +3668,13 @@ class Offcanvas extends BaseComponent {
3582
3668
  });
3583
3669
  }
3584
3670
 
3585
- _enforceFocusOnElement(element) {
3586
- EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop
3587
-
3588
- EventHandler.on(document, EVENT_FOCUSIN$1, event => {
3589
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
3590
- element.focus();
3591
- }
3671
+ _initializeFocusTrap() {
3672
+ return new FocusTrap({
3673
+ trapElement: this._element
3592
3674
  });
3593
- element.focus();
3594
3675
  }
3595
3676
 
3596
3677
  _addEventListeners() {
3597
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
3598
3678
  EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
3599
3679
  if (this._config.keyboard && event.key === ESCAPE_KEY) {
3600
3680
  this.hide();
@@ -3655,6 +3735,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
3655
3735
  data.toggle(this);
3656
3736
  });
3657
3737
  EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
3738
+ enableDismissTrigger(Offcanvas);
3658
3739
  /**
3659
3740
  * ------------------------------------------------------------------------
3660
3741
  * jQuery
@@ -3665,45 +3746,45 @@ defineJQueryPlugin(Offcanvas);
3665
3746
 
3666
3747
  /**
3667
3748
  * --------------------------------------------------------------------------
3668
- * CoreUI (v4.0.5): alert.js
3749
+ * CoreUI (v4.1.2): alert.js
3669
3750
  * Licensed under MIT (https://coreui.io/license)
3670
3751
  *
3671
3752
  * This component is a modified version of the Bootstrap's util/sanitizer.js
3672
3753
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3673
3754
  * --------------------------------------------------------------------------
3674
3755
  */
3675
- const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
3756
+ const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
3676
3757
  const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
3677
3758
  /**
3678
3759
  * A pattern that recognizes a commonly useful subset of URLs that are safe.
3679
3760
  *
3680
- * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
3761
+ * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
3681
3762
  */
3682
3763
 
3683
- const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
3764
+ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
3684
3765
  /**
3685
3766
  * A pattern that matches safe data URLs. Only matches image, video and audio types.
3686
3767
  *
3687
- * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
3768
+ * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
3688
3769
  */
3689
3770
 
3690
3771
  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;
3691
3772
 
3692
- const allowedAttribute = (attr, allowedAttributeList) => {
3693
- const attrName = attr.nodeName.toLowerCase();
3773
+ const allowedAttribute = (attribute, allowedAttributeList) => {
3774
+ const attributeName = attribute.nodeName.toLowerCase();
3694
3775
 
3695
- if (allowedAttributeList.includes(attrName)) {
3696
- if (uriAttrs.has(attrName)) {
3697
- return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
3776
+ if (allowedAttributeList.includes(attributeName)) {
3777
+ if (uriAttributes.has(attributeName)) {
3778
+ return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
3698
3779
  }
3699
3780
 
3700
3781
  return true;
3701
3782
  }
3702
3783
 
3703
- const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute.
3784
+ const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
3704
3785
 
3705
3786
  for (let i = 0, len = regExp.length; i < len; i++) {
3706
- if (regExp[i].test(attrName)) {
3787
+ if (regExp[i].test(attributeName)) {
3707
3788
  return true;
3708
3789
  }
3709
3790
  }
@@ -3755,23 +3836,22 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
3755
3836
 
3756
3837
  const domParser = new window.DOMParser();
3757
3838
  const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
3758
- const allowlistKeys = Object.keys(allowList);
3759
3839
  const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
3760
3840
 
3761
3841
  for (let i = 0, len = elements.length; i < len; i++) {
3762
- const el = elements[i];
3763
- const elName = el.nodeName.toLowerCase();
3842
+ const element = elements[i];
3843
+ const elementName = element.nodeName.toLowerCase();
3764
3844
 
3765
- if (!allowlistKeys.includes(elName)) {
3766
- el.remove();
3845
+ if (!Object.keys(allowList).includes(elementName)) {
3846
+ element.remove();
3767
3847
  continue;
3768
3848
  }
3769
3849
 
3770
- const attributeList = [].concat(...el.attributes);
3771
- const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
3772
- attributeList.forEach(attr => {
3773
- if (!allowedAttribute(attr, allowedAttributes)) {
3774
- el.removeAttribute(attr.nodeName);
3850
+ const attributeList = [].concat(...element.attributes);
3851
+ const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
3852
+ attributeList.forEach(attribute => {
3853
+ if (!allowedAttribute(attribute, allowedAttributes)) {
3854
+ element.removeAttribute(attribute.nodeName);
3775
3855
  }
3776
3856
  });
3777
3857
  }
@@ -3781,7 +3861,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
3781
3861
 
3782
3862
  /**
3783
3863
  * --------------------------------------------------------------------------
3784
- * CoreUI (v4.0.5): tooltip.js
3864
+ * CoreUI (v4.1.2): tooltip.js
3785
3865
  * Licensed under MIT (https://coreui.io/license)
3786
3866
  *
3787
3867
  * This component is a modified version of the Bootstrap's tooltip.js
@@ -3798,7 +3878,6 @@ const NAME$5 = 'tooltip';
3798
3878
  const DATA_KEY$5 = 'coreui.tooltip';
3799
3879
  const EVENT_KEY$5 = `.${DATA_KEY$5}`;
3800
3880
  const CLASS_PREFIX$1 = 'bs-tooltip';
3801
- const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
3802
3881
  const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
3803
3882
  const DefaultType$4 = {
3804
3883
  animation: 'boolean',
@@ -3857,12 +3936,14 @@ const Event$2 = {
3857
3936
  MOUSEENTER: `mouseenter${EVENT_KEY$5}`,
3858
3937
  MOUSELEAVE: `mouseleave${EVENT_KEY$5}`
3859
3938
  };
3860
- const CLASS_NAME_FADE$4 = 'fade';
3939
+ const CLASS_NAME_FADE$2 = 'fade';
3861
3940
  const CLASS_NAME_MODAL = 'modal';
3862
- const CLASS_NAME_SHOW$4 = 'show';
3941
+ const CLASS_NAME_SHOW$3 = 'show';
3863
3942
  const HOVER_STATE_SHOW = 'show';
3864
3943
  const HOVER_STATE_OUT = 'out';
3865
3944
  const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
3945
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
3946
+ const EVENT_MODAL_HIDE = 'hide.coreui.modal';
3866
3947
  const TRIGGER_HOVER = 'hover';
3867
3948
  const TRIGGER_FOCUS = 'focus';
3868
3949
  const TRIGGER_CLICK = 'click';
@@ -3939,7 +4020,7 @@ class Tooltip extends BaseComponent {
3939
4020
  context._leave(null, context);
3940
4021
  }
3941
4022
  } else {
3942
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$4)) {
4023
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
3943
4024
  this._leave(null, this);
3944
4025
 
3945
4026
  return;
@@ -3951,15 +4032,13 @@ class Tooltip extends BaseComponent {
3951
4032
 
3952
4033
  dispose() {
3953
4034
  clearTimeout(this._timeout);
3954
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.coreui.modal', this._hideModalHandler);
4035
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
3955
4036
 
3956
4037
  if (this.tip) {
3957
4038
  this.tip.remove();
3958
4039
  }
3959
4040
 
3960
- if (this._popper) {
3961
- this._popper.destroy();
3962
- }
4041
+ this._disposePopper();
3963
4042
 
3964
4043
  super.dispose();
3965
4044
  }
@@ -3979,6 +4058,15 @@ class Tooltip extends BaseComponent {
3979
4058
 
3980
4059
  if (showEvent.defaultPrevented || !isInTheDom) {
3981
4060
  return;
4061
+ } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-coreui-original-title`
4062
+ // This will be removed later in favor of a `setContent` method
4063
+
4064
+
4065
+ if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
4066
+ this._disposePopper();
4067
+
4068
+ this.tip.remove();
4069
+ this.tip = null;
3982
4070
  }
3983
4071
 
3984
4072
  const tip = this.getTipElement();
@@ -3987,10 +4075,8 @@ class Tooltip extends BaseComponent {
3987
4075
 
3988
4076
  this._element.setAttribute('aria-describedby', tipId);
3989
4077
 
3990
- this.setContent();
3991
-
3992
4078
  if (this._config.animation) {
3993
- tip.classList.add(CLASS_NAME_FADE$4);
4079
+ tip.classList.add(CLASS_NAME_FADE$2);
3994
4080
  }
3995
4081
 
3996
4082
  const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
@@ -4005,7 +4091,7 @@ class Tooltip extends BaseComponent {
4005
4091
  Data.set(tip, this.constructor.DATA_KEY, this);
4006
4092
 
4007
4093
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
4008
- container.appendChild(tip);
4094
+ container.append(tip);
4009
4095
  EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
4010
4096
  }
4011
4097
 
@@ -4015,8 +4101,9 @@ class Tooltip extends BaseComponent {
4015
4101
  this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
4016
4102
  }
4017
4103
 
4018
- tip.classList.add(CLASS_NAME_SHOW$4);
4019
- const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass;
4104
+ tip.classList.add(CLASS_NAME_SHOW$3);
4105
+
4106
+ const customClass = this._resolvePossibleFunction(this._config.customClass);
4020
4107
 
4021
4108
  if (customClass) {
4022
4109
  tip.classList.add(...customClass.split(' '));
@@ -4042,7 +4129,7 @@ class Tooltip extends BaseComponent {
4042
4129
  }
4043
4130
  };
4044
4131
 
4045
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$4);
4132
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
4046
4133
 
4047
4134
  this._queueCallback(complete, this.tip, isAnimated);
4048
4135
  }
@@ -4069,11 +4156,7 @@ class Tooltip extends BaseComponent {
4069
4156
 
4070
4157
  EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
4071
4158
 
4072
- if (this._popper) {
4073
- this._popper.destroy();
4074
-
4075
- this._popper = null;
4076
- }
4159
+ this._disposePopper();
4077
4160
  };
4078
4161
 
4079
4162
  const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
@@ -4082,7 +4165,7 @@ class Tooltip extends BaseComponent {
4082
4165
  return;
4083
4166
  }
4084
4167
 
4085
- tip.classList.remove(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
4168
+ tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
4086
4169
  // empty mouseover listeners we added for iOS support
4087
4170
 
4088
4171
  if ('ontouchstart' in document.documentElement) {
@@ -4092,7 +4175,7 @@ class Tooltip extends BaseComponent {
4092
4175
  this._activeTrigger[TRIGGER_CLICK] = false;
4093
4176
  this._activeTrigger[TRIGGER_FOCUS] = false;
4094
4177
  this._activeTrigger[TRIGGER_HOVER] = false;
4095
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$4);
4178
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
4096
4179
 
4097
4180
  this._queueCallback(complete, this.tip, isAnimated);
4098
4181
 
@@ -4117,14 +4200,27 @@ class Tooltip extends BaseComponent {
4117
4200
 
4118
4201
  const element = document.createElement('div');
4119
4202
  element.innerHTML = this._config.template;
4120
- this.tip = element.children[0];
4203
+ const tip = element.children[0];
4204
+ this.setContent(tip);
4205
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$3);
4206
+ this.tip = tip;
4121
4207
  return this.tip;
4122
4208
  }
4123
4209
 
4124
- setContent() {
4125
- const tip = this.getTipElement();
4126
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
4127
- tip.classList.remove(CLASS_NAME_FADE$4, CLASS_NAME_SHOW$4);
4210
+ setContent(tip) {
4211
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
4212
+ }
4213
+
4214
+ _sanitizeAndSetContent(template, content, selector) {
4215
+ const templateElement = SelectorEngine.findOne(selector, template);
4216
+
4217
+ if (!content && templateElement) {
4218
+ templateElement.remove();
4219
+ return;
4220
+ } // we use append for html objects to maintain js events
4221
+
4222
+
4223
+ this.setElementContent(templateElement, content);
4128
4224
  }
4129
4225
 
4130
4226
  setElementContent(element, content) {
@@ -4138,7 +4234,7 @@ class Tooltip extends BaseComponent {
4138
4234
  if (this._config.html) {
4139
4235
  if (content.parentNode !== element) {
4140
4236
  element.innerHTML = '';
4141
- element.appendChild(content);
4237
+ element.append(content);
4142
4238
  }
4143
4239
  } else {
4144
4240
  element.textContent = content.textContent;
@@ -4159,13 +4255,9 @@ class Tooltip extends BaseComponent {
4159
4255
  }
4160
4256
 
4161
4257
  getTitle() {
4162
- let title = this._element.getAttribute('data-coreui-original-title');
4163
-
4164
- if (!title) {
4165
- title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
4166
- }
4258
+ const title = this._element.getAttribute('data-coreui-original-title') || this._config.title;
4167
4259
 
4168
- return title;
4260
+ return this._resolvePossibleFunction(title);
4169
4261
  }
4170
4262
 
4171
4263
  updateAttachment(attachment) {
@@ -4182,15 +4274,7 @@ class Tooltip extends BaseComponent {
4182
4274
 
4183
4275
 
4184
4276
  _initializeOnDelegatedTarget(event, context) {
4185
- const dataKey = this.constructor.DATA_KEY;
4186
- context = context || Data.get(event.delegateTarget, dataKey);
4187
-
4188
- if (!context) {
4189
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
4190
- Data.set(event.delegateTarget, dataKey, context);
4191
- }
4192
-
4193
- return context;
4277
+ return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
4194
4278
  }
4195
4279
 
4196
4280
  _getOffset() {
@@ -4209,6 +4293,10 @@ class Tooltip extends BaseComponent {
4209
4293
  return offset;
4210
4294
  }
4211
4295
 
4296
+ _resolvePossibleFunction(content) {
4297
+ return typeof content === 'function' ? content.call(this._element) : content;
4298
+ }
4299
+
4212
4300
  _getPopperConfig(attachment) {
4213
4301
  const defaultBsPopperConfig = {
4214
4302
  placement: attachment,
@@ -4250,7 +4338,7 @@ class Tooltip extends BaseComponent {
4250
4338
  }
4251
4339
 
4252
4340
  _addAttachmentClass(attachment) {
4253
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
4341
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
4254
4342
  }
4255
4343
 
4256
4344
  _getAttachment(placement) {
@@ -4277,7 +4365,7 @@ class Tooltip extends BaseComponent {
4277
4365
  }
4278
4366
  };
4279
4367
 
4280
- EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.coreui.modal', this._hideModalHandler);
4368
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
4281
4369
 
4282
4370
  if (this._config.selector) {
4283
4371
  this._config = { ...this._config,
@@ -4312,7 +4400,7 @@ class Tooltip extends BaseComponent {
4312
4400
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
4313
4401
  }
4314
4402
 
4315
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
4403
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
4316
4404
  context._hoverState = HOVER_STATE_SHOW;
4317
4405
  return;
4318
4406
  }
@@ -4408,26 +4496,32 @@ class Tooltip extends BaseComponent {
4408
4496
  _getDelegateConfig() {
4409
4497
  const config = {};
4410
4498
 
4411
- if (this._config) {
4412
- for (const key in this._config) {
4413
- if (this.constructor.Default[key] !== this._config[key]) {
4414
- config[key] = this._config[key];
4415
- }
4499
+ for (const key in this._config) {
4500
+ if (this.constructor.Default[key] !== this._config[key]) {
4501
+ config[key] = this._config[key];
4416
4502
  }
4417
- }
4503
+ } // In the future can be replaced with:
4504
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
4505
+ // `Object.fromEntries(keysWithDifferentValues)`
4506
+
4418
4507
 
4419
4508
  return config;
4420
4509
  }
4421
4510
 
4422
4511
  _cleanTipClass() {
4423
4512
  const tip = this.getTipElement();
4424
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
4513
+ const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
4514
+ const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
4425
4515
 
4426
4516
  if (tabClass !== null && tabClass.length > 0) {
4427
4517
  tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
4428
4518
  }
4429
4519
  }
4430
4520
 
4521
+ _getBasicClassPrefix() {
4522
+ return CLASS_PREFIX$1;
4523
+ }
4524
+
4431
4525
  _handlePopperPlacementChange(popperData) {
4432
4526
  const {
4433
4527
  state
@@ -4442,6 +4536,14 @@ class Tooltip extends BaseComponent {
4442
4536
  this._cleanTipClass();
4443
4537
 
4444
4538
  this._addAttachmentClass(this._getAttachment(state.placement));
4539
+ }
4540
+
4541
+ _disposePopper() {
4542
+ if (this._popper) {
4543
+ this._popper.destroy();
4544
+
4545
+ this._popper = null;
4546
+ }
4445
4547
  } // Static
4446
4548
 
4447
4549
 
@@ -4472,7 +4574,7 @@ defineJQueryPlugin(Tooltip);
4472
4574
 
4473
4575
  /**
4474
4576
  * --------------------------------------------------------------------------
4475
- * CoreUI (v4.0.5): popover.js
4577
+ * CoreUI (v4.1.2): popover.js
4476
4578
  * Licensed under MIT (https://coreui.io/license)
4477
4579
  *
4478
4580
  * This component is a modified version of the Bootstrap's popover.js
@@ -4489,7 +4591,6 @@ const NAME$4 = 'popover';
4489
4591
  const DATA_KEY$4 = 'coreui.popover';
4490
4592
  const EVENT_KEY$4 = `.${DATA_KEY$4}`;
4491
4593
  const CLASS_PREFIX = 'bs-popover';
4492
- const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
4493
4594
  const Default$3 = { ...Tooltip.Default,
4494
4595
  placement: 'right',
4495
4596
  offset: [0, 8],
@@ -4512,8 +4613,6 @@ const Event$1 = {
4512
4613
  MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
4513
4614
  MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
4514
4615
  };
4515
- const CLASS_NAME_FADE$3 = 'fade';
4516
- const CLASS_NAME_SHOW$3 = 'show';
4517
4616
  const SELECTOR_TITLE = '.popover-header';
4518
4617
  const SELECTOR_CONTENT = '.popover-body';
4519
4618
  /**
@@ -4545,55 +4644,19 @@ class Popover extends Tooltip {
4545
4644
  return this.getTitle() || this._getContent();
4546
4645
  }
4547
4646
 
4548
- getTipElement() {
4549
- if (this.tip) {
4550
- return this.tip;
4551
- }
4552
-
4553
- this.tip = super.getTipElement();
4554
-
4555
- if (!this.getTitle()) {
4556
- SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
4557
- }
4558
-
4559
- if (!this._getContent()) {
4560
- SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
4561
- }
4562
-
4563
- return this.tip;
4564
- }
4565
-
4566
- setContent() {
4567
- const tip = this.getTipElement(); // we use append for html objects to maintain js events
4647
+ setContent(tip) {
4648
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
4568
4649
 
4569
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
4570
-
4571
- let content = this._getContent();
4572
-
4573
- if (typeof content === 'function') {
4574
- content = content.call(this._element);
4575
- }
4576
-
4577
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
4578
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
4650
+ this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
4579
4651
  } // Private
4580
4652
 
4581
4653
 
4582
- _addAttachmentClass(attachment) {
4583
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
4584
- }
4585
-
4586
4654
  _getContent() {
4587
- return this._element.getAttribute('data-coreui-content') || this._config.content;
4655
+ return this._resolvePossibleFunction(this._config.content);
4588
4656
  }
4589
4657
 
4590
- _cleanTipClass() {
4591
- const tip = this.getTipElement();
4592
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
4593
-
4594
- if (tabClass !== null && tabClass.length > 0) {
4595
- tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
4596
- }
4658
+ _getBasicClassPrefix() {
4659
+ return CLASS_PREFIX;
4597
4660
  } // Static
4598
4661
 
4599
4662
 
@@ -4624,7 +4687,7 @@ defineJQueryPlugin(Popover);
4624
4687
 
4625
4688
  /**
4626
4689
  * --------------------------------------------------------------------------
4627
- * CoreUI (v4.0.5): scrollspy.js
4690
+ * CoreUI (v4.1.2): scrollspy.js
4628
4691
  * Licensed under MIT (https://coreui.io/license)
4629
4692
  *
4630
4693
  * This component is a modified version of the Bootstrap's scrollspy.js
@@ -4862,7 +4925,7 @@ defineJQueryPlugin(ScrollSpy);
4862
4925
 
4863
4926
  /**
4864
4927
  * --------------------------------------------------------------------------
4865
- * CoreUI (v4.0.5): sidebar.js
4928
+ * CoreUI (v4.1.2): sidebar.js
4866
4929
  * Licensed under MIT (https://coreui.io/license)
4867
4930
  * --------------------------------------------------------------------------
4868
4931
  */
@@ -4879,7 +4942,6 @@ const DATA_API_KEY$1 = '.data-api';
4879
4942
  const Default$1 = {};
4880
4943
  const DefaultType$1 = {};
4881
4944
  const CLASS_NAME_BACKDROP = 'sidebar-backdrop';
4882
- const CLASS_NAME_FADE$2 = 'fade';
4883
4945
  const CLASS_NAME_HIDE$1 = 'hide';
4884
4946
  const CLASS_NAME_SHOW$2 = 'show';
4885
4947
  const CLASS_NAME_SIDEBAR_NARROW = 'sidebar-narrow';
@@ -4910,7 +4972,7 @@ class Sidebar extends BaseComponent {
4910
4972
  this._overlaid = this._isOverlaid();
4911
4973
  this._narrow = this._isNarrow();
4912
4974
  this._unfoldable = this._isUnfoldable();
4913
- this._backdrop = null;
4975
+ this._backdrop = this._initializeBackDrop();
4914
4976
 
4915
4977
  this._addEventListeners();
4916
4978
  } // Getters
@@ -4939,7 +5001,9 @@ class Sidebar extends BaseComponent {
4939
5001
  if (this._isMobile()) {
4940
5002
  this._element.classList.add(CLASS_NAME_SHOW$2);
4941
5003
 
4942
- this._showBackdrop();
5004
+ this._backdrop.show();
5005
+
5006
+ new ScrollBarHelper().hide();
4943
5007
  }
4944
5008
 
4945
5009
  const complete = () => {
@@ -4965,7 +5029,9 @@ class Sidebar extends BaseComponent {
4965
5029
  }
4966
5030
 
4967
5031
  if (this._isMobile()) {
4968
- this._removeBackdrop();
5032
+ this._backdrop.hide();
5033
+
5034
+ new ScrollBarHelper().reset();
4969
5035
  } else {
4970
5036
  this._element.classList.add(CLASS_NAME_HIDE$1);
4971
5037
  }
@@ -5054,6 +5120,16 @@ class Sidebar extends BaseComponent {
5054
5120
  return config;
5055
5121
  }
5056
5122
 
5123
+ _initializeBackDrop() {
5124
+ return new Backdrop({
5125
+ className: CLASS_NAME_BACKDROP,
5126
+ isVisible: this._isMobile(),
5127
+ isAnimated: true,
5128
+ rootElement: this._element.parentNode,
5129
+ clickCallback: () => this.hide()
5130
+ });
5131
+ }
5132
+
5057
5133
  _isMobile() {
5058
5134
  return Boolean(window.getComputedStyle(this._element, null).getPropertyValue('--cui-is-mobile'));
5059
5135
  }
@@ -5073,35 +5149,13 @@ class Sidebar extends BaseComponent {
5073
5149
  _isVisible() {
5074
5150
  const rect = this._element.getBoundingClientRect();
5075
5151
 
5076
- return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
5152
+ return rect.top >= 0 && rect.left >= 0 && Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) && Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth);
5077
5153
  }
5078
5154
 
5079
5155
  _addClassName(className) {
5080
5156
  this._element.classList.add(className);
5081
5157
  }
5082
5158
 
5083
- _removeBackdrop() {
5084
- if (this._backdrop) {
5085
- this._backdrop.parentNode.removeChild(this._backdrop);
5086
-
5087
- this._backdrop = null;
5088
- }
5089
- }
5090
-
5091
- _showBackdrop() {
5092
- if (!this._backdrop) {
5093
- this._backdrop = document.createElement('div');
5094
- this._backdrop.className = CLASS_NAME_BACKDROP;
5095
-
5096
- this._backdrop.classList.add(CLASS_NAME_FADE$2);
5097
-
5098
- document.body.appendChild(this._backdrop);
5099
- reflow(this._backdrop);
5100
-
5101
- this._backdrop.classList.add(CLASS_NAME_SHOW$2);
5102
- }
5103
- }
5104
-
5105
5159
  _clickOutListener(event, sidebar) {
5106
5160
  if (event.target.closest(SELECTOR_SIDEBAR) === null) {
5107
5161
  event.preventDefault();
@@ -5149,6 +5203,7 @@ class Sidebar extends BaseComponent {
5149
5203
  EventHandler.on(window, EVENT_RESIZE, () => {
5150
5204
  if (this._isMobile() && this._isVisible()) {
5151
5205
  this.hide();
5206
+ this._backdrop = this._initializeBackDrop();
5152
5207
  }
5153
5208
  });
5154
5209
  } // Static
@@ -5195,7 +5250,7 @@ defineJQueryPlugin(Sidebar);
5195
5250
 
5196
5251
  /**
5197
5252
  * --------------------------------------------------------------------------
5198
- * CoreUI (v4.0.5): tab.js
5253
+ * CoreUI (v4.1.2): tab.js
5199
5254
  * Licensed under MIT (https://coreui.io/license)
5200
5255
  *
5201
5256
  * This component is a modified version of the Bootstrap's tab.js
@@ -5396,7 +5451,7 @@ defineJQueryPlugin(Tab);
5396
5451
 
5397
5452
  /**
5398
5453
  * --------------------------------------------------------------------------
5399
- * CoreUI (v4.0.5): toast.js
5454
+ * CoreUI (v4.1.2): toast.js
5400
5455
  * Licensed under MIT (https://coreui.io/license)
5401
5456
  *
5402
5457
  * This component is a modified version of the Bootstrap's toast.js
@@ -5412,7 +5467,6 @@ defineJQueryPlugin(Tab);
5412
5467
  const NAME = 'toast';
5413
5468
  const DATA_KEY = 'coreui.toast';
5414
5469
  const EVENT_KEY = `.${DATA_KEY}`;
5415
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
5416
5470
  const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
5417
5471
  const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
5418
5472
  const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
@@ -5422,7 +5476,8 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
5422
5476
  const EVENT_SHOW = `show${EVENT_KEY}`;
5423
5477
  const EVENT_SHOWN = `shown${EVENT_KEY}`;
5424
5478
  const CLASS_NAME_FADE = 'fade';
5425
- const CLASS_NAME_HIDE = 'hide';
5479
+ const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
5480
+
5426
5481
  const CLASS_NAME_SHOW = 'show';
5427
5482
  const CLASS_NAME_SHOWING = 'showing';
5428
5483
  const DefaultType = {
@@ -5435,7 +5490,6 @@ const Default = {
5435
5490
  autohide: true,
5436
5491
  delay: 5000
5437
5492
  };
5438
- const SELECTOR_DATA_DISMISS = '[data-coreui-dismiss="toast"]';
5439
5493
  /**
5440
5494
  * ------------------------------------------------------------------------
5441
5495
  * Class Definition
@@ -5483,17 +5537,18 @@ class Toast extends BaseComponent {
5483
5537
  const complete = () => {
5484
5538
  this._element.classList.remove(CLASS_NAME_SHOWING);
5485
5539
 
5486
- this._element.classList.add(CLASS_NAME_SHOW);
5487
-
5488
5540
  EventHandler.trigger(this._element, EVENT_SHOWN);
5489
5541
 
5490
5542
  this._maybeScheduleHide();
5491
5543
  };
5492
5544
 
5493
- this._element.classList.remove(CLASS_NAME_HIDE);
5545
+ this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
5546
+
5494
5547
 
5495
5548
  reflow(this._element);
5496
5549
 
5550
+ this._element.classList.add(CLASS_NAME_SHOW);
5551
+
5497
5552
  this._element.classList.add(CLASS_NAME_SHOWING);
5498
5553
 
5499
5554
  this._queueCallback(complete, this._element, this._config.animation);
@@ -5511,12 +5566,17 @@ class Toast extends BaseComponent {
5511
5566
  }
5512
5567
 
5513
5568
  const complete = () => {
5514
- this._element.classList.add(CLASS_NAME_HIDE);
5569
+ this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
5570
+
5571
+
5572
+ this._element.classList.remove(CLASS_NAME_SHOWING);
5573
+
5574
+ this._element.classList.remove(CLASS_NAME_SHOW);
5515
5575
 
5516
5576
  EventHandler.trigger(this._element, EVENT_HIDDEN);
5517
5577
  };
5518
5578
 
5519
- this._element.classList.remove(CLASS_NAME_SHOW);
5579
+ this._element.classList.add(CLASS_NAME_SHOWING);
5520
5580
 
5521
5581
  this._queueCallback(complete, this._element, this._config.animation);
5522
5582
  }
@@ -5584,7 +5644,6 @@ class Toast extends BaseComponent {
5584
5644
  }
5585
5645
 
5586
5646
  _setListeners() {
5587
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
5588
5647
  EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
5589
5648
  EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
5590
5649
  EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
@@ -5612,6 +5671,8 @@ class Toast extends BaseComponent {
5612
5671
  }
5613
5672
 
5614
5673
  }
5674
+
5675
+ enableDismissTrigger(Toast);
5615
5676
  /**
5616
5677
  * ------------------------------------------------------------------------
5617
5678
  * jQuery
@@ -5619,8 +5680,7 @@ class Toast extends BaseComponent {
5619
5680
  * add .Toast to jQuery only if jQuery is present
5620
5681
  */
5621
5682
 
5622
-
5623
5683
  defineJQueryPlugin(Toast);
5624
5684
 
5625
- export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas as OffCanvas, Popover, ScrollSpy, Sidebar, Tab, Toast, Tooltip };
5685
+ export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas, Popover, ScrollSpy, Sidebar, Tab, Toast, Tooltip };
5626
5686
  //# sourceMappingURL=coreui.esm.js.map