sweetalert2 11.3.3 → 11.3.7

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 (54) hide show
  1. package/CHANGELOG.md +2257 -0
  2. package/README.md +8 -10
  3. package/dist/sweetalert2.all.js +175 -78
  4. package/dist/sweetalert2.all.min.js +1 -1
  5. package/dist/sweetalert2.js +175 -78
  6. package/dist/sweetalert2.min.js +1 -1
  7. package/package.json +12 -8
  8. package/src/SweetAlert.js +12 -11
  9. package/src/buttons-handlers.js +32 -29
  10. package/src/globalState.js +1 -1
  11. package/src/instanceMethods/_destroy.js +2 -2
  12. package/src/instanceMethods/close.js +25 -23
  13. package/src/instanceMethods/enable-disable-elements.js +7 -7
  14. package/src/instanceMethods/getInput.js +1 -1
  15. package/src/instanceMethods/hideLoading.js +2 -5
  16. package/src/instanceMethods/progress-steps.js +1 -1
  17. package/src/instanceMethods/update.js +20 -13
  18. package/src/instanceMethods/validation-message.js +2 -2
  19. package/src/keydown-handler.js +22 -16
  20. package/src/popup-click-handler.js +3 -1
  21. package/src/privateMethods.js +1 -1
  22. package/src/privateProps.js +1 -1
  23. package/src/staticMethods/argsToParams.js +1 -1
  24. package/src/staticMethods/bindClickHandler.js +1 -1
  25. package/src/staticMethods/dom.js +1 -1
  26. package/src/staticMethods/fire.js +2 -2
  27. package/src/staticMethods/mixin.js +2 -2
  28. package/src/staticMethods/showLoading.js +1 -4
  29. package/src/staticMethods.js +1 -5
  30. package/src/utils/DismissReason.js +1 -1
  31. package/src/utils/Timer.js +6 -6
  32. package/src/utils/aria.js +2 -2
  33. package/src/utils/classes.js +1 -7
  34. package/src/utils/defaultInputValidators.js +1 -1
  35. package/src/utils/dom/animationEndEvent.js +2 -3
  36. package/src/utils/dom/domUtils.js +16 -9
  37. package/src/utils/dom/getters.js +11 -11
  38. package/src/utils/dom/init.js +3 -7
  39. package/src/utils/dom/inputUtils.js +26 -19
  40. package/src/utils/dom/parseHtmlToContainer.js +14 -3
  41. package/src/utils/dom/renderers/renderActions.js +3 -3
  42. package/src/utils/dom/renderers/renderContainer.js +3 -3
  43. package/src/utils/dom/renderers/renderContent.js +4 -2
  44. package/src/utils/dom/renderers/renderIcon.js +26 -17
  45. package/src/utils/dom/renderers/renderInput.js +30 -21
  46. package/src/utils/dom/renderers/renderPopup.js +2 -1
  47. package/src/utils/dom/renderers/renderProgressSteps.js +1 -1
  48. package/src/utils/getTemplateParams.js +43 -9
  49. package/src/utils/iosFix.js +33 -10
  50. package/src/utils/isNodeEnv.js +5 -1
  51. package/src/utils/openPopup.js +1 -1
  52. package/src/utils/params.js +2 -2
  53. package/src/utils/setParameters.js +5 -5
  54. package/src/utils/utils.js +14 -11
@@ -87,7 +87,7 @@ export const defaultParams = {
87
87
  willClose: undefined,
88
88
  didClose: undefined,
89
89
  didDestroy: undefined,
90
- scrollbarPadding: true
90
+ scrollbarPadding: true,
91
91
  }
92
92
 
93
93
  export const updatableParams = [
@@ -147,7 +147,7 @@ const toastIncompatibleParams = [
147
147
  'focusCancel',
148
148
  'returnFocus',
149
149
  'heightAuto',
150
- 'keydownListenerCapture'
150
+ 'keydownListenerCapture',
151
151
  ]
152
152
 
153
153
  /**
@@ -2,7 +2,7 @@ import { warn } from './utils.js'
2
2
  import * as dom from './dom/index.js'
3
3
  import defaultInputValidators from './defaultInputValidators.js'
4
4
 
5
- function setDefaultInputValidators (params) {
5
+ function setDefaultInputValidators(params) {
6
6
  // Use default `inputValidator` for supported input types if not provided
7
7
  if (!params.inputValidator) {
8
8
  Object.keys(defaultInputValidators).forEach((key) => {
@@ -13,7 +13,7 @@ function setDefaultInputValidators (params) {
13
13
  }
14
14
  }
15
15
 
16
- function validateCustomTargetElement (params) {
16
+ function validateCustomTargetElement(params) {
17
17
  // Determine if the custom target element is valid
18
18
  if (
19
19
  !params.target ||
@@ -30,15 +30,15 @@ function validateCustomTargetElement (params) {
30
30
  *
31
31
  * @param params
32
32
  */
33
- export default function setParameters (params) {
33
+ export default function setParameters(params) {
34
34
  setDefaultInputValidators(params)
35
35
 
36
36
  // showLoaderOnConfirm && preConfirm
37
37
  if (params.showLoaderOnConfirm && !params.preConfirm) {
38
38
  warn(
39
39
  'showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' +
40
- 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' +
41
- 'https://sweetalert2.github.io/#ajax-request'
40
+ 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' +
41
+ 'https://sweetalert2.github.io/#ajax-request'
42
42
  )
43
43
  }
44
44
 
@@ -16,27 +16,28 @@ export const uniqueArray = (arr) => {
16
16
 
17
17
  /**
18
18
  * Capitalize the first letter of a string
19
- * @param str
19
+ * @param {string} str
20
+ * @returns {string}
20
21
  */
21
22
  export const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1)
22
23
 
23
24
  /**
24
- * Convert NodeList to Array
25
- * @param nodeList
25
+ * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList
26
+ * @returns {array}
26
27
  */
27
28
  export const toArray = (nodeList) => Array.prototype.slice.call(nodeList)
28
29
 
29
30
  /**
30
- * Standardise console warnings
31
- * @param message
31
+ * Standardize console warnings
32
+ * @param {string | array} message
32
33
  */
33
34
  export const warn = (message) => {
34
35
  console.warn(`${consolePrefix} ${typeof message === 'object' ? message.join(' ') : message}`)
35
36
  }
36
37
 
37
38
  /**
38
- * Standardise console errors
39
- * @param message
39
+ * Standardize console errors
40
+ * @param {string} message
40
41
  */
41
42
  export const error = (message) => {
42
43
  console.error(`${consolePrefix} ${message}`)
@@ -51,7 +52,7 @@ const previousWarnOnceMessages = []
51
52
 
52
53
  /**
53
54
  * Show a console warning, but only if it hasn't already been shown
54
- * @param message
55
+ * @param {string} message
55
56
  */
56
57
  export const warnOnce = (message) => {
57
58
  if (!previousWarnOnceMessages.includes(message)) {
@@ -64,7 +65,9 @@ export const warnOnce = (message) => {
64
65
  * Show a one-time console warning about deprecated params/methods
65
66
  */
66
67
  export const warnAboutDeprecation = (deprecatedParam, useInstead) => {
67
- warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release. Please use "${useInstead}" instead.`)
68
+ warnOnce(
69
+ `"${deprecatedParam}" is deprecated and will be removed in the next major release. Please use "${useInstead}" instead.`
70
+ )
68
71
  }
69
72
 
70
73
  /**
@@ -72,10 +75,10 @@ export const warnAboutDeprecation = (deprecatedParam, useInstead) => {
72
75
  * Otherwise, just pass the value through
73
76
  * @param arg
74
77
  */
75
- export const callIfFunction = (arg) => typeof arg === 'function' ? arg() : arg
78
+ export const callIfFunction = (arg) => (typeof arg === 'function' ? arg() : arg)
76
79
 
77
80
  export const hasToPromiseFn = (arg) => arg && typeof arg.toPromise === 'function'
78
81
 
79
- export const asPromise = (arg) => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg)
82
+ export const asPromise = (arg) => (hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg))
80
83
 
81
84
  export const isPromise = (arg) => arg && Promise.resolve(arg) === arg