sweetalert2 11.4.5 → 11.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sweetalert2",
3
- "version": "11.4.5",
3
+ "version": "11.4.8",
4
4
  "repository": "sweetalert2/sweetalert2",
5
5
  "homepage": "https://sweetalert2.github.io/",
6
6
  "description": "A beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes, supported fork of sweetalert",
@@ -9,7 +9,7 @@
9
9
  "module": "src/sweetalert2.js",
10
10
  "types": "sweetalert2.d.ts",
11
11
  "devDependencies": {
12
- "@babel/core": "^7.17.0",
12
+ "@babel/core": "^7.17.8",
13
13
  "@babel/preset-env": "^7.16.7",
14
14
  "@rollup/plugin-json": "^4.0.2",
15
15
  "@sweetalert2/eslint-config": "^1.0.11",
@@ -18,7 +18,7 @@
18
18
  "@sweetalert2/stylelint-config": "^2.0.6",
19
19
  "browser-sync": "^2.27.7",
20
20
  "cypress": "^9.5.1",
21
- "eslint": "^8.11.0",
21
+ "eslint": "^8.12.0",
22
22
  "eslint-plugin-cypress": "^2.12.1",
23
23
  "eslint-plugin-import": "^2.25.4",
24
24
  "eslint-plugin-no-unsanitized": "^4.0.1",
@@ -34,13 +34,13 @@
34
34
  "jquery": "^3.6.0",
35
35
  "merge2": "^1.2.3",
36
36
  "postcss-scss": "^4.0.2",
37
- "prettier": "^2.5.1",
37
+ "prettier": "^2.6.1",
38
38
  "replace-in-file": "^6.3.2",
39
39
  "rollup": "^2.70.0",
40
40
  "rollup-plugin-babel": "^4.3.2",
41
41
  "sass": "^1.49.9",
42
- "stylelint": "^14.5.3",
43
- "typescript": "^4.6.2"
42
+ "stylelint": "^14.6.1",
43
+ "typescript": "^4.6.3"
44
44
  },
45
45
  "files": [
46
46
  "dist",
package/src/SweetAlert.js CHANGED
@@ -228,6 +228,6 @@ Object.keys(instanceMethods).forEach((key) => {
228
228
 
229
229
  SweetAlert.DismissReason = DismissReason
230
230
 
231
- SweetAlert.version = '11.4.5'
231
+ SweetAlert.version = '11.4.8'
232
232
 
233
233
  export default SweetAlert
@@ -6,6 +6,7 @@ import { swalClasses } from '../utils/classes.js'
6
6
  import globalState, { restoreActiveElement } from '../globalState.js'
7
7
  import privateProps from '../privateProps.js'
8
8
  import privateMethods from '../privateMethods.js'
9
+ import { removeKeydownHandler } from '../keydown-handler.js'
9
10
 
10
11
  /*
11
12
  * Instance method to close sweetAlert
@@ -16,10 +17,7 @@ function removePopupAndResetState(instance, container, returnFocus, didClose) {
16
17
  triggerDidCloseAndDispose(instance, didClose)
17
18
  } else {
18
19
  restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose))
19
- globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
20
- capture: globalState.keydownListenerCapture,
21
- })
22
- globalState.keydownHandlerAdded = false
20
+ removeKeydownHandler(globalState)
23
21
  }
24
22
 
25
23
  const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
@@ -4,14 +4,17 @@ import { callIfFunction } from './utils/utils.js'
4
4
  import { clickConfirm } from './staticMethods/dom.js'
5
5
  import privateProps from './privateProps.js'
6
6
 
7
- export const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
7
+ export const removeKeydownHandler = (globalState) => {
8
8
  if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
9
9
  globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
10
10
  capture: globalState.keydownListenerCapture,
11
11
  })
12
12
  globalState.keydownHandlerAdded = false
13
13
  }
14
+ }
14
15
 
16
+ export const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
17
+ removeKeydownHandler(globalState)
15
18
  if (!innerParams.toast) {
16
19
  globalState.keydownHandler = (e) => keydownHandler(instance, e, dismissWith)
17
20
  globalState.keydownTarget = innerParams.keydownListenerCapture ? window : dom.getPopup()
package/sweetalert2.d.ts CHANGED
@@ -676,7 +676,7 @@ declare module 'sweetalert2' {
676
676
  *
677
677
  * @default {}
678
678
  */
679
- customClass?: SweetAlertCustomClass
679
+ customClass?: SweetAlertCustomClass | string
680
680
 
681
681
  /**
682
682
  * Auto close timer of the popup. Set in ms (milliseconds).