sweetalert2 11.3.6 → 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 (51) hide show
  1. package/CHANGELOG.md +2257 -0
  2. package/dist/sweetalert2.all.js +77 -44
  3. package/dist/sweetalert2.all.min.js +1 -1
  4. package/dist/sweetalert2.js +77 -44
  5. package/dist/sweetalert2.min.js +1 -1
  6. package/package.json +5 -2
  7. package/src/SweetAlert.js +12 -11
  8. package/src/buttons-handlers.js +27 -27
  9. package/src/globalState.js +1 -1
  10. package/src/instanceMethods/_destroy.js +1 -1
  11. package/src/instanceMethods/close.js +25 -23
  12. package/src/instanceMethods/enable-disable-elements.js +7 -7
  13. package/src/instanceMethods/getInput.js +1 -1
  14. package/src/instanceMethods/hideLoading.js +2 -5
  15. package/src/instanceMethods/progress-steps.js +1 -1
  16. package/src/instanceMethods/update.js +20 -13
  17. package/src/instanceMethods/validation-message.js +2 -2
  18. package/src/keydown-handler.js +22 -16
  19. package/src/popup-click-handler.js +3 -1
  20. package/src/privateMethods.js +1 -1
  21. package/src/privateProps.js +1 -1
  22. package/src/staticMethods/argsToParams.js +1 -1
  23. package/src/staticMethods/bindClickHandler.js +1 -1
  24. package/src/staticMethods/dom.js +1 -1
  25. package/src/staticMethods/fire.js +2 -2
  26. package/src/staticMethods/mixin.js +2 -2
  27. package/src/staticMethods/showLoading.js +1 -4
  28. package/src/staticMethods.js +1 -5
  29. package/src/utils/DismissReason.js +1 -1
  30. package/src/utils/Timer.js +6 -6
  31. package/src/utils/aria.js +2 -2
  32. package/src/utils/classes.js +1 -7
  33. package/src/utils/defaultInputValidators.js +1 -1
  34. package/src/utils/dom/animationEndEvent.js +1 -1
  35. package/src/utils/dom/domUtils.js +16 -9
  36. package/src/utils/dom/getters.js +7 -7
  37. package/src/utils/dom/init.js +3 -7
  38. package/src/utils/dom/inputUtils.js +26 -19
  39. package/src/utils/dom/parseHtmlToContainer.js +14 -3
  40. package/src/utils/dom/renderers/renderActions.js +3 -3
  41. package/src/utils/dom/renderers/renderContainer.js +3 -3
  42. package/src/utils/dom/renderers/renderContent.js +4 -2
  43. package/src/utils/dom/renderers/renderIcon.js +24 -15
  44. package/src/utils/dom/renderers/renderInput.js +30 -21
  45. package/src/utils/dom/renderers/renderPopup.js +2 -1
  46. package/src/utils/dom/renderers/renderProgressSteps.js +1 -1
  47. package/src/utils/getTemplateParams.js +7 -3
  48. package/src/utils/iosFix.js +16 -5
  49. package/src/utils/params.js +2 -2
  50. package/src/utils/setParameters.js +5 -5
  51. package/src/utils/utils.js +5 -3
@@ -34,7 +34,9 @@ export const handleCancelButtonClick = (instance, dismissWith) => {
34
34
  const handleConfirmOrDenyWithInput = (instance, type /* 'confirm' | 'deny' */) => {
35
35
  const innerParams = privateProps.innerParams.get(instance)
36
36
  if (!innerParams.input) {
37
- return error(`The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`)
37
+ return error(
38
+ `The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`
39
+ )
38
40
  }
39
41
  const inputValue = getInputValue(instance, innerParams)
40
42
  if (innerParams.inputValidator) {
@@ -52,22 +54,20 @@ const handleConfirmOrDenyWithInput = (instance, type /* 'confirm' | 'deny' */) =
52
54
  const handleInputValidator = (instance, inputValue, type /* 'confirm' | 'deny' */) => {
53
55
  const innerParams = privateProps.innerParams.get(instance)
54
56
  instance.disableInput()
55
- const validationPromise = Promise.resolve().then(() => asPromise(
56
- innerParams.inputValidator(inputValue, innerParams.validationMessage))
57
+ const validationPromise = Promise.resolve().then(() =>
58
+ asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage))
57
59
  )
58
- validationPromise.then(
59
- (validationMessage) => {
60
- instance.enableButtons()
61
- instance.enableInput()
62
- if (validationMessage) {
63
- instance.showValidationMessage(validationMessage)
64
- } else if (type === 'deny') {
65
- deny(instance, inputValue)
66
- } else {
67
- confirm(instance, inputValue)
68
- }
60
+ validationPromise.then((validationMessage) => {
61
+ instance.enableButtons()
62
+ instance.enableInput()
63
+ if (validationMessage) {
64
+ instance.showValidationMessage(validationMessage)
65
+ } else if (type === 'deny') {
66
+ deny(instance, inputValue)
67
+ } else {
68
+ confirm(instance, inputValue)
69
69
  }
70
- )
70
+ })
71
71
  }
72
72
 
73
73
  const deny = (instance, value) => {
@@ -79,18 +79,18 @@ const deny = (instance, value) => {
79
79
 
80
80
  if (innerParams.preDeny) {
81
81
  privateProps.awaitingPromise.set(instance || this, true) // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received
82
- const preDenyPromise = Promise.resolve().then(() => asPromise(
83
- innerParams.preDeny(value, innerParams.validationMessage))
82
+ const preDenyPromise = Promise.resolve().then(() =>
83
+ asPromise(innerParams.preDeny(value, innerParams.validationMessage))
84
84
  )
85
- preDenyPromise.then(
86
- (preDenyValue) => {
85
+ preDenyPromise
86
+ .then((preDenyValue) => {
87
87
  if (preDenyValue === false) {
88
88
  instance.hideLoading()
89
89
  } else {
90
90
  instance.closePopup({ isDenied: true, value: typeof preDenyValue === 'undefined' ? value : preDenyValue })
91
91
  }
92
- }
93
- ).catch((error) => rejectWith(instance || this, error))
92
+ })
93
+ .catch((error) => rejectWith(instance || this, error))
94
94
  } else {
95
95
  instance.closePopup({ isDenied: true, value })
96
96
  }
@@ -114,18 +114,18 @@ const confirm = (instance, value) => {
114
114
  if (innerParams.preConfirm) {
115
115
  instance.resetValidationMessage()
116
116
  privateProps.awaitingPromise.set(instance || this, true) // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received
117
- const preConfirmPromise = Promise.resolve().then(() => asPromise(
118
- innerParams.preConfirm(value, innerParams.validationMessage))
117
+ const preConfirmPromise = Promise.resolve().then(() =>
118
+ asPromise(innerParams.preConfirm(value, innerParams.validationMessage))
119
119
  )
120
- preConfirmPromise.then(
121
- (preConfirmValue) => {
120
+ preConfirmPromise
121
+ .then((preConfirmValue) => {
122
122
  if (isVisible(getValidationMessage()) || preConfirmValue === false) {
123
123
  instance.hideLoading()
124
124
  } else {
125
125
  succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue)
126
126
  }
127
- }
128
- ).catch((error) => rejectWith(instance || this, error))
127
+ })
128
+ .catch((error) => rejectWith(instance || this, error))
129
129
  } else {
130
130
  succeedWith(instance, value)
131
131
  }
@@ -15,7 +15,7 @@ const focusPreviousActiveElement = () => {
15
15
 
16
16
  // Restore previous active (focused) element
17
17
  export const restoreActiveElement = (returnFocus) => {
18
- return new Promise(resolve => {
18
+ return new Promise((resolve) => {
19
19
  if (!returnFocus) {
20
20
  return resolve()
21
21
  }
@@ -2,7 +2,7 @@ import globalState from '../globalState.js'
2
2
  import privateProps from '../privateProps.js'
3
3
  import privateMethods from '../privateMethods.js'
4
4
 
5
- export function _destroy () {
5
+ export function _destroy() {
6
6
  const domCache = privateProps.domCache.get(this)
7
7
  const innerParams = privateProps.innerParams.get(this)
8
8
 
@@ -11,12 +11,14 @@ import privateMethods from '../privateMethods.js'
11
11
  * Instance method to close sweetAlert
12
12
  */
13
13
 
14
- function removePopupAndResetState (instance, container, returnFocus, didClose) {
14
+ function removePopupAndResetState(instance, container, returnFocus, didClose) {
15
15
  if (dom.isToast()) {
16
16
  triggerDidCloseAndDispose(instance, didClose)
17
17
  } else {
18
18
  restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose))
19
- globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { capture: globalState.keydownListenerCapture })
19
+ globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
20
+ capture: globalState.keydownListenerCapture,
21
+ })
20
22
  globalState.keydownHandlerAdded = false
21
23
  }
22
24
 
@@ -40,19 +42,14 @@ function removePopupAndResetState (instance, container, returnFocus, didClose) {
40
42
  removeBodyClasses()
41
43
  }
42
44
 
43
- function removeBodyClasses () {
45
+ function removeBodyClasses() {
44
46
  dom.removeClass(
45
47
  [document.documentElement, document.body],
46
- [
47
- swalClasses.shown,
48
- swalClasses['height-auto'],
49
- swalClasses['no-backdrop'],
50
- swalClasses['toast-shown'],
51
- ]
48
+ [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]
52
49
  )
53
50
  }
54
51
 
55
- export function close (resolveValue) {
52
+ export function close(resolveValue) {
56
53
  resolveValue = prepareResolveValue(resolveValue)
57
54
 
58
55
  const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this)
@@ -71,7 +68,7 @@ export function close (resolveValue) {
71
68
  }
72
69
  }
73
70
 
74
- export function isAwaitingPromise () {
71
+ export function isAwaitingPromise() {
75
72
  return !!privateProps.awaitingPromise.get(this)
76
73
  }
77
74
 
@@ -99,7 +96,7 @@ const triggerClosePopup = (instance) => {
99
96
  return true
100
97
  }
101
98
 
102
- export function rejectPromise (error) {
99
+ export function rejectPromise(error) {
103
100
  const rejectPromise = privateMethods.swalPromiseReject.get(this)
104
101
  handleAwaitingPromise(this)
105
102
  if (rejectPromise) {
@@ -128,11 +125,14 @@ const prepareResolveValue = (resolveValue) => {
128
125
  }
129
126
  }
130
127
 
131
- return Object.assign({
132
- isConfirmed: false,
133
- isDenied: false,
134
- isDismissed: false,
135
- }, resolveValue)
128
+ return Object.assign(
129
+ {
130
+ isConfirmed: false,
131
+ isDenied: false,
132
+ isDismissed: false,
133
+ },
134
+ resolveValue
135
+ )
136
136
  }
137
137
 
138
138
  const handlePopupAnimation = (instance, popup, innerParams) => {
@@ -153,7 +153,13 @@ const handlePopupAnimation = (instance, popup, innerParams) => {
153
153
  }
154
154
 
155
155
  const animatePopup = (instance, popup, container, returnFocus, didClose) => {
156
- globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose)
156
+ globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(
157
+ null,
158
+ instance,
159
+ container,
160
+ returnFocus,
161
+ didClose
162
+ )
157
163
  popup.addEventListener(dom.animationEndEvent, function (e) {
158
164
  if (e.target === popup) {
159
165
  globalState.swalCloseEventFinishedCallback()
@@ -171,8 +177,4 @@ const triggerDidCloseAndDispose = (instance, didClose) => {
171
177
  })
172
178
  }
173
179
 
174
- export {
175
- close as closePopup,
176
- close as closeModal,
177
- close as closeToast
178
- }
180
+ export { close as closePopup, close as closeModal, close as closeToast }
@@ -1,13 +1,13 @@
1
1
  import privateProps from '../privateProps.js'
2
2
 
3
- function setButtonsDisabled (instance, buttons, disabled) {
3
+ function setButtonsDisabled(instance, buttons, disabled) {
4
4
  const domCache = privateProps.domCache.get(instance)
5
- buttons.forEach(button => {
5
+ buttons.forEach((button) => {
6
6
  domCache[button].disabled = disabled
7
7
  })
8
8
  }
9
9
 
10
- function setInputDisabled (input, disabled) {
10
+ function setInputDisabled(input, disabled) {
11
11
  if (!input) {
12
12
  return false
13
13
  }
@@ -22,18 +22,18 @@ function setInputDisabled (input, disabled) {
22
22
  }
23
23
  }
24
24
 
25
- export function enableButtons () {
25
+ export function enableButtons() {
26
26
  setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false)
27
27
  }
28
28
 
29
- export function disableButtons () {
29
+ export function disableButtons() {
30
30
  setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true)
31
31
  }
32
32
 
33
- export function enableInput () {
33
+ export function enableInput() {
34
34
  return setInputDisabled(this.getInput(), false)
35
35
  }
36
36
 
37
- export function disableInput () {
37
+ export function disableInput() {
38
38
  return setInputDisabled(this.getInput(), true)
39
39
  }
@@ -5,7 +5,7 @@ import privateProps from '../privateProps.js'
5
5
  * Gets the input DOM node, this method works with input parameter.
6
6
  * @returns {HTMLElement | null}
7
7
  */
8
- export function getInput (instance) {
8
+ export function getInput(instance) {
9
9
  const innerParams = privateProps.innerParams.get(instance || this)
10
10
  const domCache = privateProps.domCache.get(instance || this)
11
11
  if (!domCache) {
@@ -5,7 +5,7 @@ import privateProps from '../privateProps.js'
5
5
  /**
6
6
  * Hides loader and shows back the button which was hidden by .showLoading()
7
7
  */
8
- function hideLoading () {
8
+ function hideLoading() {
9
9
  // do nothing if popup is closed
10
10
  const innerParams = privateProps.innerParams.get(this)
11
11
  if (!innerParams) {
@@ -37,7 +37,4 @@ const showRelatedButton = (domCache) => {
37
37
  }
38
38
  }
39
39
 
40
- export {
41
- hideLoading,
42
- hideLoading as disableLoading
43
- }
40
+ export { hideLoading, hideLoading as disableLoading }
@@ -1,6 +1,6 @@
1
1
  import privateProps from '../privateProps.js'
2
2
 
3
- export function getProgressSteps () {
3
+ export function getProgressSteps() {
4
4
  const domCache = privateProps.domCache.get(this)
5
5
  return domCache.progressSteps
6
6
  }
@@ -6,24 +6,17 @@ import { isUpdatableParameter } from '../../src/utils/params.js'
6
6
  /**
7
7
  * Updates popup parameters.
8
8
  */
9
- export function update (params) {
9
+ export function update(params) {
10
10
  const popup = dom.getPopup()
11
11
  const innerParams = privateProps.innerParams.get(this)
12
12
 
13
13
  if (!popup || dom.hasClass(popup, innerParams.hideClass.popup)) {
14
- return warn(`You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.`)
14
+ return warn(
15
+ `You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.`
16
+ )
15
17
  }
16
18
 
17
- const validUpdatableParams = {}
18
-
19
- // assign valid params from `params` to `defaults`
20
- Object.keys(params).forEach(param => {
21
- if (isUpdatableParameter(param)) {
22
- validUpdatableParams[param] = params[param]
23
- } else {
24
- warn(`Invalid parameter to update: "${param}". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js\n\nIf you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md`)
25
- }
26
- })
19
+ const validUpdatableParams = filterValidParams(params)
27
20
 
28
21
  const updatedParams = Object.assign({}, innerParams, validUpdatableParams)
29
22
 
@@ -34,7 +27,21 @@ export function update (params) {
34
27
  params: {
35
28
  value: Object.assign({}, this.params, params),
36
29
  writable: false,
37
- enumerable: true
30
+ enumerable: true,
31
+ },
32
+ })
33
+ }
34
+
35
+ const filterValidParams = (params) => {
36
+ const validUpdatableParams = {}
37
+ Object.keys(params).forEach((param) => {
38
+ if (isUpdatableParameter(param)) {
39
+ validUpdatableParams[param] = params[param]
40
+ } else {
41
+ warn(
42
+ `Invalid parameter to update: "${param}". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js\n\nIf you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md`
43
+ )
38
44
  }
39
45
  })
46
+ return validUpdatableParams
40
47
  }
@@ -3,7 +3,7 @@ import { swalClasses } from '../utils/classes.js'
3
3
  import privateProps from '../privateProps.js'
4
4
 
5
5
  // Show block with validation message
6
- export function showValidationMessage (error) {
6
+ export function showValidationMessage(error) {
7
7
  const domCache = privateProps.domCache.get(this)
8
8
  const params = privateProps.innerParams.get(this)
9
9
  dom.setInnerHtml(domCache.validationMessage, error)
@@ -23,7 +23,7 @@ export function showValidationMessage (error) {
23
23
  }
24
24
 
25
25
  // Hide block with validation message
26
- export function resetValidationMessage () {
26
+ export function resetValidationMessage() {
27
27
  const domCache = privateProps.domCache.get(this)
28
28
  if (domCache.validationMessage) {
29
29
  dom.hide(domCache.validationMessage)
@@ -6,7 +6,9 @@ import privateProps from './privateProps.js'
6
6
 
7
7
  export const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
8
8
  if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
9
- globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { capture: globalState.keydownListenerCapture })
9
+ globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
10
+ capture: globalState.keydownListenerCapture,
11
+ })
10
12
  globalState.keydownHandlerAdded = false
11
13
  }
12
14
 
@@ -14,7 +16,9 @@ export const addKeydownHandler = (instance, globalState, innerParams, dismissWit
14
16
  globalState.keydownHandler = (e) => keydownHandler(instance, e, dismissWith)
15
17
  globalState.keydownTarget = innerParams.keydownListenerCapture ? window : dom.getPopup()
16
18
  globalState.keydownListenerCapture = innerParams.keydownListenerCapture
17
- globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { capture: globalState.keydownListenerCapture })
19
+ globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
20
+ capture: globalState.keydownListenerCapture,
21
+ })
18
22
  globalState.keydownHandlerAdded = true
19
23
  }
20
24
  }
@@ -41,13 +45,9 @@ export const setFocus = (innerParams, index, increment) => {
41
45
  dom.getPopup().focus()
42
46
  }
43
47
 
44
- const arrowKeysNextButton = [
45
- 'ArrowRight', 'ArrowDown',
46
- ]
48
+ const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']
47
49
 
48
- const arrowKeysPreviousButton = [
49
- 'ArrowLeft', 'ArrowUp',
50
- ]
50
+ const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']
51
51
 
52
52
  const keydownHandler = (instance, e, dismissWith) => {
53
53
  const innerParams = privateProps.innerParams.get(instance)
@@ -63,24 +63,27 @@ const keydownHandler = (instance, e, dismissWith) => {
63
63
  // ENTER
64
64
  if (e.key === 'Enter') {
65
65
  handleEnter(instance, e, innerParams)
66
+ }
66
67
 
67
68
  // TAB
68
- } else if (e.key === 'Tab') {
69
+ else if (e.key === 'Tab') {
69
70
  handleTab(e, innerParams)
71
+ }
70
72
 
71
73
  // ARROWS - switch focus between buttons
72
- } else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {
74
+ else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {
73
75
  handleArrows(e.key)
76
+ }
74
77
 
75
78
  // ESC
76
- } else if (e.key === 'Escape') {
79
+ else if (e.key === 'Escape') {
77
80
  handleEsc(e, innerParams, dismissWith)
78
81
  }
79
82
  }
80
83
 
81
84
  const handleEnter = (instance, e, innerParams) => {
82
- // #720 #721
83
- if (e.isComposing) {
85
+ // #2386 #720 #721
86
+ if (!callIfFunction(innerParams.allowEnterKey) || e.isComposing) {
84
87
  return
85
88
  }
86
89
 
@@ -106,13 +109,16 @@ const handleTab = (e, innerParams) => {
106
109
  }
107
110
  }
108
111
 
112
+ // Cycle to the next button
109
113
  if (!e.shiftKey) {
110
- // Cycle to the next button
111
114
  setFocus(innerParams, btnIndex, 1)
112
- } else {
113
- // Cycle to the prev button
115
+ }
116
+
117
+ // Cycle to the prev button
118
+ else {
114
119
  setFocus(innerParams, btnIndex, -1)
115
120
  }
121
+
116
122
  e.stopPropagation()
117
123
  e.preventDefault()
118
124
  }
@@ -34,10 +34,12 @@ const handleToastClick = (instance, domCache, dismissWith) => {
34
34
  * @returns {boolean}
35
35
  */
36
36
  const isAnyButtonShown = (innerParams) => {
37
- return innerParams.showConfirmButton ||
37
+ return (
38
+ innerParams.showConfirmButton ||
38
39
  innerParams.showDenyButton ||
39
40
  innerParams.showCancelButton ||
40
41
  innerParams.showCloseButton
42
+ )
41
43
  }
42
44
 
43
45
  let ignoreOutsideClick = false
@@ -10,5 +10,5 @@
10
10
 
11
11
  export default {
12
12
  swalPromiseResolve: new WeakMap(),
13
- swalPromiseReject: new WeakMap()
13
+ swalPromiseReject: new WeakMap(),
14
14
  }
@@ -12,5 +12,5 @@ export default {
12
12
  awaitingPromise: new WeakMap(),
13
13
  promise: new WeakMap(),
14
14
  innerParams: new WeakMap(),
15
- domCache: new WeakMap()
15
+ domCache: new WeakMap(),
16
16
  }
@@ -8,7 +8,7 @@ export const argsToParams = (args) => {
8
8
  if (typeof args[0] === 'object' && !isElement(args[0])) {
9
9
  Object.assign(params, args[0])
10
10
  } else {
11
- ['title', 'html', 'icon'].forEach((name, index) => {
11
+ ;['title', 'html', 'icon'].forEach((name, index) => {
12
12
  const arg = args[index]
13
13
  if (typeof arg === 'string' || isElement(arg)) {
14
14
  params[name] = arg
@@ -1,7 +1,7 @@
1
1
  let bodyClickListenerAdded = false
2
2
  const clickHandlers = {}
3
3
 
4
- export function bindClickHandler (attr = 'data-swal-template') {
4
+ export function bindClickHandler(attr = 'data-swal-template') {
5
5
  clickHandlers[attr] = this
6
6
 
7
7
  if (!bodyClickListenerAdded) {
@@ -19,7 +19,7 @@ export {
19
19
  getTimerProgressBar,
20
20
  getFocusableElements,
21
21
  getValidationMessage,
22
- isLoading
22
+ isLoading,
23
23
  } from '../utils/dom/index.js'
24
24
 
25
25
  /*
@@ -1,4 +1,4 @@
1
- export function fire (...args) {
2
- const Swal = this
1
+ export function fire(...args) {
2
+ const Swal = this // eslint-disable-line @typescript-eslint/no-this-alias
3
3
  return new Swal(...args)
4
4
  }
@@ -16,9 +16,9 @@
16
16
  *
17
17
  * @param mixinParams
18
18
  */
19
- export function mixin (mixinParams) {
19
+ export function mixin(mixinParams) {
20
20
  class MixinSwal extends this {
21
- _main (params, priorityMixinParams) {
21
+ _main(params, priorityMixinParams) {
22
22
  return super._main(params, Object.assign({}, mixinParams, priorityMixinParams))
23
23
  }
24
24
  }
@@ -43,7 +43,4 @@ const replaceButton = (popup, buttonToReplace) => {
43
43
  dom.addClass([popup, actions], swalClasses.loading)
44
44
  }
45
45
 
46
- export {
47
- showLoading,
48
- showLoading as enableLoading
49
- }
46
+ export { showLoading, showLoading as enableLoading }
@@ -5,8 +5,4 @@ export * from './staticMethods/mixin.js'
5
5
  export * from './staticMethods/showLoading.js'
6
6
  export * from './staticMethods/timer.js'
7
7
  export * from './staticMethods/bindClickHandler.js'
8
- export {
9
- isValidParameter,
10
- isUpdatableParameter,
11
- isDeprecatedParameter
12
- } from './utils/params.js'
8
+ export { isValidParameter, isUpdatableParameter, isDeprecatedParameter } from './utils/params.js'
@@ -3,5 +3,5 @@ export const DismissReason = Object.freeze({
3
3
  backdrop: 'backdrop',
4
4
  close: 'close',
5
5
  esc: 'esc',
6
- timer: 'timer'
6
+ timer: 'timer',
7
7
  })
@@ -1,5 +1,5 @@
1
1
  export default class Timer {
2
- constructor (callback, delay) {
2
+ constructor(callback, delay) {
3
3
  this.callback = callback
4
4
  this.remaining = delay
5
5
  this.running = false
@@ -7,7 +7,7 @@ export default class Timer {
7
7
  this.start()
8
8
  }
9
9
 
10
- start () {
10
+ start() {
11
11
  if (!this.running) {
12
12
  this.running = true
13
13
  this.started = new Date()
@@ -16,7 +16,7 @@ export default class Timer {
16
16
  return this.remaining
17
17
  }
18
18
 
19
- stop () {
19
+ stop() {
20
20
  if (this.running) {
21
21
  this.running = false
22
22
  clearTimeout(this.id)
@@ -25,7 +25,7 @@ export default class Timer {
25
25
  return this.remaining
26
26
  }
27
27
 
28
- increase (n) {
28
+ increase(n) {
29
29
  const running = this.running
30
30
  if (running) {
31
31
  this.stop()
@@ -37,7 +37,7 @@ export default class Timer {
37
37
  return this.remaining
38
38
  }
39
39
 
40
- getTimerLeft () {
40
+ getTimerLeft() {
41
41
  if (this.running) {
42
42
  this.stop()
43
43
  this.start()
@@ -45,7 +45,7 @@ export default class Timer {
45
45
  return this.remaining
46
46
  }
47
47
 
48
- isRunning () {
48
+ isRunning() {
49
49
  return this.running
50
50
  }
51
51
  }
package/src/utils/aria.js CHANGED
@@ -8,7 +8,7 @@ import { toArray } from './utils.js'
8
8
 
9
9
  export const setAriaHidden = () => {
10
10
  const bodyChildren = toArray(document.body.children)
11
- bodyChildren.forEach(el => {
11
+ bodyChildren.forEach((el) => {
12
12
  if (el === getContainer() || el.contains(getContainer())) {
13
13
  return
14
14
  }
@@ -22,7 +22,7 @@ export const setAriaHidden = () => {
22
22
 
23
23
  export const unsetAriaHidden = () => {
24
24
  const bodyChildren = toArray(document.body.children)
25
- bodyChildren.forEach(el => {
25
+ bodyChildren.forEach((el) => {
26
26
  if (el.hasAttribute('data-previous-aria-hidden')) {
27
27
  el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'))
28
28
  el.removeAttribute('data-previous-aria-hidden')
@@ -80,10 +80,4 @@ export const swalClasses = prefix([
80
80
  'icon-error',
81
81
  ])
82
82
 
83
- export const iconTypes = prefix([
84
- 'success',
85
- 'warning',
86
- 'info',
87
- 'question',
88
- 'error'
89
- ])
83
+ export const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error'])
@@ -9,5 +9,5 @@ export default {
9
9
  return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string)
10
10
  ? Promise.resolve()
11
11
  : Promise.resolve(validationMessage || 'Invalid URL')
12
- }
12
+ },
13
13
  }