sweetalert2 11.7.0 → 11.7.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.
package/README.md CHANGED
@@ -31,15 +31,15 @@ For all questions related to sponsorship please contact me via email sweetalert2
31
31
  <table>
32
32
  <tr>
33
33
  <td align="center"><a href="SPONSORS.md#sponsors"><img src="https://sweetalert2.github.io/images/plus.png" width="80"><br>Become a sponsor</a></td>
34
+ <td align="center"><a href="https://www.serpempire.com/"><img src="https://sweetalert2.github.io/images/sponsors/serpempire.png" width="80"><br>SERP Empire</a>
34
35
  <td align="center"><a href="https://www.borrow.fi/luottotili/"><img src="https://sweetalert2.github.io/images/sponsors/borrowfi.png" width="80"><br>luottotili</a>
35
36
  <td align="center"><a href="https://mybettingcanada.com/"><img src="https://sweetalert2.github.io/images/sponsors/mybettingcanada.png" width="80"><br>My Betting Canada</a>
36
- <td align="center"><a href="https://kasynoonlineblik.pl/"><img src="https://sweetalert2.github.io/images/sponsors/kasynoonlineblik.png" width="80"><br>Kasyno Online Blik</a>
37
37
  </tr>
38
38
  </table>
39
39
  <table>
40
40
  <tr>
41
+ <td align="center"><a href="https://kasynoonlineblik.pl/"><img src="https://sweetalert2.github.io/images/sponsors/kasynoonlineblik.png" width="80"><br>Kasyno Online Blik</a>
41
42
  <td align="center"><a href="https://w88yesbet.com/"><img src="https://sweetalert2.github.io/images/sponsors/w88yesbet.png" width="80"><br>W88YES</a>
42
- <td align="center"><a href="https://rushradar.com/"><img src="https://sweetalert2.github.io/images/sponsors/rushradar.png" width="80"><br>RushRadar:&nbsp;Articles, <br>Reviews,&nbsp;and&nbsp;Discounts</a>
43
43
  <td align="center"><a href="https://www.realspyapps.com/"><img src="https://sweetalert2.github.io/images/sponsors/realspyapps.jpeg" width="80"><br>Real Spy Apps</a>
44
44
  <td align="center"><a href="https://www.istartips.com/"><img src="https://sweetalert2.github.io/images/sponsors/istartips.png" width="80"><br>iStarTips</a>
45
45
  </tr>
@@ -47,9 +47,7 @@ For all questions related to sponsorship please contact me via email sweetalert2
47
47
  <table>
48
48
  <tr>
49
49
  <td align="center"><a href="https://www.evguru.com.my/"><img src="https://sweetalert2.github.io/images/sponsors/evguru.png" width="80"><br>EvGuru EV Chargers</a></td>
50
- <td align="center"><a href="https://bestforandroid.com/"><img src="https://sweetalert2.github.io/images/sponsors/bestforandroid.png" width="80"><br>Best For Android</a></td>
51
50
  <td align="center"><a href="https://celltrackingapps.com/"><img src="https://sweetalert2.github.io/images/sponsors/celltrackingapps.png" width="80"><br>Phone Tracking Apps</a></td>
52
- <td align="center"><a href="https://flowcrypt.com/"><img src="https://avatars2.githubusercontent.com/u/28631236?s=80&v=4" width="80"><br>FlowCrypt</a></td>
53
51
  <td align="center"><a href="https://www.mybitcoinslots.com/"><img src="https://sweetalert2.github.io/images/sponsors/mybitcoinslots.png" width="80"><br>My Bitcoin slots</a></td>
54
52
  <td align="center"><a href="https://www.vegega.com/"><img src="https://sweetalert2.github.io/images/sponsors/vegega.jpeg" width="80"><br>Metal Raised Garden Bed</a></td>
55
53
  </tr>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sweetalert2 v11.7.0
2
+ * sweetalert2 v11.7.2
3
3
  * Released under the MIT License.
4
4
  */
5
5
  (function (global, factory) {
@@ -207,29 +207,29 @@
207
207
  const getValidationMessage = () => elementByClass(swalClasses['validation-message']);
208
208
 
209
209
  /**
210
- * @returns {HTMLElement | null}
210
+ * @returns {HTMLButtonElement | null}
211
211
  */
212
- const getConfirmButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`);
212
+ const getConfirmButton = () => /** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`);
213
213
 
214
214
  /**
215
- * @returns {HTMLElement | null}
215
+ * @returns {HTMLButtonElement | null}
216
216
  */
217
- const getDenyButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`);
217
+ const getCancelButton = () => /** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`);
218
218
 
219
219
  /**
220
- * @returns {HTMLElement | null}
220
+ * @returns {HTMLButtonElement | null}
221
221
  */
222
- const getInputLabel = () => elementByClass(swalClasses['input-label']);
222
+ const getDenyButton = () => /** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`);
223
223
 
224
224
  /**
225
225
  * @returns {HTMLElement | null}
226
226
  */
227
- const getLoader = () => elementBySelector(`.${swalClasses.loader}`);
227
+ const getInputLabel = () => elementByClass(swalClasses['input-label']);
228
228
 
229
229
  /**
230
230
  * @returns {HTMLElement | null}
231
231
  */
232
- const getCancelButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`);
232
+ const getLoader = () => elementBySelector(`.${swalClasses.loader}`);
233
233
 
234
234
  /**
235
235
  * @returns {HTMLElement | null}
@@ -1872,7 +1872,9 @@
1872
1872
  const confirmButton = getConfirmButton();
1873
1873
  const denyButton = getDenyButton();
1874
1874
  const cancelButton = getCancelButton();
1875
- if (document.activeElement instanceof HTMLElement && ![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {
1875
+ /** @type HTMLElement[] */
1876
+ const buttons = [confirmButton, denyButton, cancelButton];
1877
+ if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) {
1876
1878
  return;
1877
1879
  }
1878
1880
  const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
@@ -2075,10 +2077,12 @@
2075
2077
  }
2076
2078
  };
2077
2079
 
2078
- /*
2079
- * Instance method to close sweetAlert
2080
+ /**
2081
+ * @param {SweetAlert2} instance
2082
+ * @param {HTMLElement} container
2083
+ * @param {boolean} returnFocus
2084
+ * @param {Function} didClose
2080
2085
  */
2081
-
2082
2086
  function removePopupAndResetState(instance, container, returnFocus, didClose) {
2083
2087
  if (isToast()) {
2084
2088
  triggerDidCloseAndDispose(instance, didClose);
@@ -2103,9 +2107,19 @@
2103
2107
  }
2104
2108
  removeBodyClasses();
2105
2109
  }
2110
+
2111
+ /**
2112
+ * Remove SweetAlert2 classes from body
2113
+ */
2106
2114
  function removeBodyClasses() {
2107
2115
  removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);
2108
2116
  }
2117
+
2118
+ /**
2119
+ * Instance method to close sweetAlert
2120
+ *
2121
+ * @param {any} resolveValue
2122
+ */
2109
2123
  function close(resolveValue) {
2110
2124
  resolveValue = prepareResolveValue(resolveValue);
2111
2125
  const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
@@ -2121,6 +2135,10 @@
2121
2135
  swalPromiseResolve(resolveValue);
2122
2136
  }
2123
2137
  }
2138
+
2139
+ /**
2140
+ * @returns {boolean}
2141
+ */
2124
2142
  function isAwaitingPromise() {
2125
2143
  return !!privateProps.awaitingPromise.get(this);
2126
2144
  }
@@ -2141,6 +2159,10 @@
2141
2159
  handlePopupAnimation(instance, popup, innerParams);
2142
2160
  return true;
2143
2161
  };
2162
+
2163
+ /**
2164
+ * @param {any} error
2165
+ */
2144
2166
  function rejectPromise(error) {
2145
2167
  const rejectPromise = privateMethods.swalPromiseReject.get(this);
2146
2168
  handleAwaitingPromise(this);
@@ -2149,15 +2171,26 @@
2149
2171
  rejectPromise(error);
2150
2172
  }
2151
2173
  }
2174
+
2175
+ /**
2176
+ * @param {SweetAlert2} instance
2177
+ */
2152
2178
  const handleAwaitingPromise = instance => {
2179
+ // @ts-ignore
2153
2180
  if (instance.isAwaitingPromise()) {
2154
2181
  privateProps.awaitingPromise.delete(instance);
2155
2182
  // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335
2156
2183
  if (!privateProps.innerParams.get(instance)) {
2184
+ // @ts-ignore
2157
2185
  instance._destroy();
2158
2186
  }
2159
2187
  }
2160
2188
  };
2189
+
2190
+ /**
2191
+ * @param {any} resolveValue
2192
+ * @returns {import('sweetalert2').SweetAlertResult}
2193
+ */
2161
2194
  const prepareResolveValue = resolveValue => {
2162
2195
  // When user calls Swal.close()
2163
2196
  if (typeof resolveValue === 'undefined') {
@@ -2173,6 +2206,12 @@
2173
2206
  isDismissed: false
2174
2207
  }, resolveValue);
2175
2208
  };
2209
+
2210
+ /**
2211
+ * @param {SweetAlert2} instance
2212
+ * @param {HTMLElement} popup
2213
+ * @param {SweetAlertOptions} innerParams
2214
+ */
2176
2215
  const handlePopupAnimation = (instance, popup, innerParams) => {
2177
2216
  const container = getContainer();
2178
2217
  // If animation is supported, animate
@@ -2187,6 +2226,14 @@
2187
2226
  removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);
2188
2227
  }
2189
2228
  };
2229
+
2230
+ /**
2231
+ * @param {SweetAlert2} instance
2232
+ * @param {HTMLElement} popup
2233
+ * @param {HTMLElement} container
2234
+ * @param {boolean} returnFocus
2235
+ * @param {Function} didClose
2236
+ */
2190
2237
  const animatePopup = (instance, popup, container, returnFocus, didClose) => {
2191
2238
  globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);
2192
2239
  popup.addEventListener(animationEndEvent, function (e) {
@@ -2196,11 +2243,18 @@
2196
2243
  }
2197
2244
  });
2198
2245
  };
2246
+
2247
+ /**
2248
+ * @param {SweetAlert2} instance
2249
+ * @param {Function} didClose
2250
+ */
2199
2251
  const triggerDidCloseAndDispose = (instance, didClose) => {
2200
2252
  setTimeout(() => {
2201
2253
  if (typeof didClose === 'function') {
2254
+ // @ts-ignore
2202
2255
  didClose.bind(instance.params)();
2203
2256
  }
2257
+ // @ts-ignore
2204
2258
  instance._destroy();
2205
2259
  });
2206
2260
  };
@@ -2561,29 +2615,31 @@
2561
2615
 
2562
2616
  var instanceMethods = /*#__PURE__*/Object.freeze({
2563
2617
  __proto__: null,
2564
- hideLoading: hideLoading,
2565
- disableLoading: hideLoading,
2566
- getInput: getInput,
2618
+ _destroy: _destroy,
2567
2619
  close: close,
2568
- isAwaitingPromise: isAwaitingPromise,
2569
- rejectPromise: rejectPromise,
2570
- handleAwaitingPromise: handleAwaitingPromise,
2571
- closePopup: close,
2572
2620
  closeModal: close,
2621
+ closePopup: close,
2573
2622
  closeToast: close,
2574
- enableButtons: enableButtons,
2575
2623
  disableButtons: disableButtons,
2576
- enableInput: enableInput,
2577
2624
  disableInput: disableInput,
2578
- showValidationMessage: showValidationMessage,
2625
+ disableLoading: hideLoading,
2626
+ enableButtons: enableButtons,
2627
+ enableInput: enableInput,
2628
+ getInput: getInput,
2629
+ handleAwaitingPromise: handleAwaitingPromise,
2630
+ hideLoading: hideLoading,
2631
+ isAwaitingPromise: isAwaitingPromise,
2632
+ rejectPromise: rejectPromise,
2579
2633
  resetValidationMessage: resetValidationMessage,
2580
- update: update,
2581
- _destroy: _destroy
2634
+ showValidationMessage: showValidationMessage,
2635
+ update: update
2582
2636
  });
2583
2637
 
2584
2638
  /**
2585
2639
  * Shows loader (spinner), this is useful with AJAX requests.
2586
2640
  * By default the loader be shown instead of the "Confirm" button.
2641
+ *
2642
+ * @param {HTMLButtonElement} [buttonToReplace]
2587
2643
  */
2588
2644
  const showLoading = buttonToReplace => {
2589
2645
  let popup = getPopup();
@@ -2603,6 +2659,11 @@
2603
2659
  popup.setAttribute('aria-busy', 'true');
2604
2660
  popup.focus();
2605
2661
  };
2662
+
2663
+ /**
2664
+ * @param {HTMLElement} popup
2665
+ * @param {HTMLButtonElement} [buttonToReplace]
2666
+ */
2606
2667
  const replaceButton = (popup, buttonToReplace) => {
2607
2668
  const actions = getActions();
2608
2669
  const loader = getLoader();
@@ -3218,45 +3279,45 @@
3218
3279
 
3219
3280
  var staticMethods = /*#__PURE__*/Object.freeze({
3220
3281
  __proto__: null,
3221
- isValidParameter: isValidParameter,
3222
- isUpdatableParameter: isUpdatableParameter,
3223
- isDeprecatedParameter: isDeprecatedParameter,
3224
3282
  argsToParams: argsToParams,
3283
+ bindClickHandler: bindClickHandler,
3284
+ clickCancel: clickCancel,
3285
+ clickConfirm: clickConfirm,
3286
+ clickDeny: clickDeny,
3287
+ enableLoading: showLoading,
3288
+ fire: fire,
3289
+ getActions: getActions,
3290
+ getCancelButton: getCancelButton,
3291
+ getCloseButton: getCloseButton,
3292
+ getConfirmButton: getConfirmButton,
3225
3293
  getContainer: getContainer,
3226
- getPopup: getPopup,
3227
- getTitle: getTitle,
3294
+ getDenyButton: getDenyButton,
3295
+ getFocusableElements: getFocusableElements,
3296
+ getFooter: getFooter,
3228
3297
  getHtmlContainer: getHtmlContainer,
3229
- getImage: getImage,
3230
3298
  getIcon: getIcon,
3231
3299
  getIconContent: getIconContent,
3300
+ getImage: getImage,
3232
3301
  getInputLabel: getInputLabel,
3233
- getCloseButton: getCloseButton,
3234
- getActions: getActions,
3235
- getConfirmButton: getConfirmButton,
3236
- getDenyButton: getDenyButton,
3237
- getCancelButton: getCancelButton,
3238
3302
  getLoader: getLoader,
3239
- getFooter: getFooter,
3303
+ getPopup: getPopup,
3304
+ getProgressSteps: getProgressSteps,
3305
+ getTimerLeft: getTimerLeft,
3240
3306
  getTimerProgressBar: getTimerProgressBar,
3241
- getFocusableElements: getFocusableElements,
3307
+ getTitle: getTitle,
3242
3308
  getValidationMessage: getValidationMessage,
3243
- getProgressSteps: getProgressSteps,
3309
+ increaseTimer: increaseTimer,
3310
+ isDeprecatedParameter: isDeprecatedParameter,
3244
3311
  isLoading: isLoading,
3312
+ isTimerRunning: isTimerRunning,
3313
+ isUpdatableParameter: isUpdatableParameter,
3314
+ isValidParameter: isValidParameter,
3245
3315
  isVisible: isVisible,
3246
- clickConfirm: clickConfirm,
3247
- clickDeny: clickDeny,
3248
- clickCancel: clickCancel,
3249
- fire: fire,
3250
3316
  mixin: mixin,
3317
+ resumeTimer: resumeTimer,
3251
3318
  showLoading: showLoading,
3252
- enableLoading: showLoading,
3253
- getTimerLeft: getTimerLeft,
3254
3319
  stopTimer: stopTimer,
3255
- resumeTimer: resumeTimer,
3256
- toggleTimer: toggleTimer,
3257
- increaseTimer: increaseTimer,
3258
- isTimerRunning: isTimerRunning,
3259
- bindClickHandler: bindClickHandler
3320
+ toggleTimer: toggleTimer
3260
3321
  });
3261
3322
 
3262
3323
  class Timer {
@@ -3945,7 +4006,7 @@
3945
4006
  };
3946
4007
  });
3947
4008
  SweetAlert.DismissReason = DismissReason;
3948
- SweetAlert.version = '11.7.0';
4009
+ SweetAlert.version = '11.7.2';
3949
4010
 
3950
4011
  const Swal = SweetAlert;
3951
4012
  // @ts-ignore