@total_onion/onion-modalcontroller 1.0.12 → 1.0.13

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.
@@ -71,14 +71,17 @@ export default class modalController {
71
71
  return;
72
72
  }
73
73
  // popupContent.innerHTML = "";
74
- const modalPopupContent = document
75
- .querySelector(`[data-modalpopupcontent=${triggerName}]`);
76
- // ?.cloneNode(true);
74
+ const modalPopupContent = document.querySelector(
75
+ `[data-modalpopupcontent=${triggerName}]`
76
+ );
77
+ // ?.cloneNode(true);
77
78
 
78
79
  if (modalPopupContent) {
79
- popupContent.querySelectorAll("[data-modalpopupcontent]").forEach((el) => {
80
+ popupContent
81
+ .querySelectorAll("[data-modalpopupcontent]")
82
+ .forEach((el) => {
80
83
  el.classList.remove("active");
81
- });
84
+ });
82
85
  popupContent.appendChild(modalPopupContent);
83
86
  modalPopupContent.classList.add("active");
84
87
  const sections = popupContent.querySelectorAll(["data-assetkey"]);
@@ -126,11 +129,21 @@ export default class modalController {
126
129
  const popupContent = modalPopup.querySelector(
127
130
  ".modal-controller-popup__content"
128
131
  );
129
- // if (popupContent) {
130
- // setTimeout(() => {
131
- // popupContent.innerHTML = "";
132
- // }, 300);
133
- // }
132
+
133
+ if (popupContent) {
134
+ const activeContents = popupContent.querySelectorAll(
135
+ "[data-modalpopupcontent].active"
136
+ );
137
+ activeContents.forEach((activeContent) => {
138
+ setTimeout(() => {
139
+ activeContent.classList.remove("active");
140
+ }, 300);
141
+
142
+ if (originalWrapper && originalWrapper !== activeContent) {
143
+ originalWrapper.parentNode.appendChild(activeContent);
144
+ }
145
+ });
146
+ }
134
147
  }
135
148
  closePopupOnClickOutside(event, modalPopup) {
136
149
  if (event.target === modalPopup) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@total_onion/onion-modalcontroller",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Pop up modal controller",
5
5
  "main": "onion-modalcontroller.js",
6
6
  "scripts": {