sweetalert2 11.7.4 → 11.7.6

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.
@@ -1,7 +1,7 @@
1
1
  import privateProps from '../privateProps.js'
2
2
 
3
3
  /**
4
- * @param {SweetAlert2} instance
4
+ * @param {SweetAlert} instance
5
5
  * @param {string[]} buttons
6
6
  * @param {boolean} disabled
7
7
  */
@@ -31,18 +31,30 @@ function setInputDisabled(input, disabled) {
31
31
  }
32
32
  }
33
33
 
34
+ /**
35
+ * Enable all the buttons
36
+ */
34
37
  export function enableButtons() {
35
38
  setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false)
36
39
  }
37
40
 
41
+ /**
42
+ * Disable all the buttons
43
+ */
38
44
  export function disableButtons() {
39
45
  setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true)
40
46
  }
41
47
 
48
+ /**
49
+ * Enable the input field
50
+ */
42
51
  export function enableInput() {
43
52
  setInputDisabled(this.getInput(), false)
44
53
  }
45
54
 
55
+ /**
56
+ * Disable the input field
57
+ */
46
58
  export function disableInput() {
47
59
  setInputDisabled(this.getInput(), true)
48
60
  }
@@ -4,12 +4,11 @@ import * as dom from '../utils/dom/index.js'
4
4
  /**
5
5
  * Gets the input DOM node, this method works with input parameter.
6
6
  *
7
- * @param {SweetAlert2} instance
8
- * @returns {HTMLElement | null}
7
+ * @returns {HTMLInputElement | null}
9
8
  */
10
- export function getInput(instance) {
11
- const innerParams = privateProps.innerParams.get(instance || this)
12
- const domCache = privateProps.domCache.get(instance || this)
9
+ export function getInput() {
10
+ const innerParams = privateProps.innerParams.get(this)
11
+ const domCache = privateProps.domCache.get(this)
13
12
  if (!domCache) {
14
13
  return null
15
14
  }
@@ -17,7 +17,7 @@ export const removeKeydownHandler = (globalState) => {
17
17
  }
18
18
 
19
19
  /**
20
- * @param {SweetAlert2} instance
20
+ * @param {SweetAlert} instance
21
21
  * @param {GlobalState} globalState
22
22
  * @param {SweetAlertOptions} innerParams
23
23
  * @param {*} dismissWith
@@ -66,7 +66,7 @@ const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']
66
66
  const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']
67
67
 
68
68
  /**
69
- * @param {SweetAlert2} instance
69
+ * @param {SweetAlert} instance
70
70
  * @param {KeyboardEvent} event
71
71
  * @param {Function} dismissWith
72
72
  */
@@ -111,7 +111,7 @@ const keydownHandler = (instance, event, dismissWith) => {
111
111
  }
112
112
 
113
113
  /**
114
- * @param {SweetAlert2} instance
114
+ * @param {SweetAlert} instance
115
115
  * @param {KeyboardEvent} event
116
116
  * @param {SweetAlertOptions} innerParams
117
117
  */
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  export default {
12
- awaitingPromise: new WeakMap(),
13
12
  promise: new WeakMap(),
14
13
  innerParams: new WeakMap(),
15
14
  domCache: new WeakMap(),
@@ -14,7 +14,8 @@
14
14
  * const {value: firstName} = await TextPrompt('What is your first name?')
15
15
  * const {value: lastName} = await TextPrompt('What is your last name?')
16
16
  *
17
- * @param mixinParams
17
+ * @param {SweetAlertOptions} mixinParams
18
+ * @returns {SweetAlert}
18
19
  */
19
20
  export function mixin(mixinParams) {
20
21
  class MixinSwal extends this {
@@ -22,6 +23,6 @@ export function mixin(mixinParams) {
22
23
  return super._main(params, Object.assign({}, mixinParams, priorityMixinParams))
23
24
  }
24
25
  }
25
-
26
+ // @ts-ignore
26
27
  return MixinSwal
27
28
  }
package/src/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef { import('sweetalert2').default } SweetAlert2
2
+ * @typedef { import('./SweetAlert').SweetAlert } SweetAlert
3
3
  * @typedef { import('sweetalert2').SweetAlertOptions } SweetAlertOptions
4
4
  * @typedef { import('sweetalert2').SweetAlertIcon } SweetAlertIcon
5
5
  * @typedef { import('sweetalert2').SweetAlertInput } SweetAlertInput
@@ -12,7 +12,7 @@
12
12
 
13
13
  /**
14
14
  * @typedef GlobalState
15
- * @property {SweetAlert2} [currentInstance]
15
+ * @property {SweetAlert} [currentInstance]
16
16
  * @property {Element} [previousActiveElement]
17
17
  * @property {Timer} [timeout]
18
18
  * @property {NodeJS.Timeout} [restoreFocusTimeout]
@@ -9,7 +9,7 @@ import * as dom from './index.js'
9
9
  */
10
10
 
11
11
  /**
12
- * @param {SweetAlert2} instance
12
+ * @param {SweetAlert} instance
13
13
  * @param {SweetAlertOptions} params
14
14
  */
15
15
  export const handleInputOptionsAndValue = (instance, params) => {
@@ -25,7 +25,7 @@ export const handleInputOptionsAndValue = (instance, params) => {
25
25
  }
26
26
 
27
27
  /**
28
- * @param {SweetAlert2} instance
28
+ * @param {SweetAlert} instance
29
29
  * @param {SweetAlertOptions} innerParams
30
30
  * @returns {string | number | File | FileList | null}
31
31
  */
@@ -66,7 +66,7 @@ const getFileValue = (input) =>
66
66
  input.files.length ? (input.getAttribute('multiple') !== null ? input.files : input.files[0]) : null
67
67
 
68
68
  /**
69
- * @param {SweetAlert2} instance
69
+ * @param {SweetAlert} instance
70
70
  * @param {SweetAlertOptions} params
71
71
  */
72
72
  const handleInputOptions = (instance, params) => {
@@ -91,7 +91,7 @@ const handleInputOptions = (instance, params) => {
91
91
  }
92
92
 
93
93
  /**
94
- * @param {SweetAlert2} instance
94
+ * @param {SweetAlert} instance
95
95
  * @param {SweetAlertOptions} params
96
96
  */
97
97
  const handleInputValue = (instance, params) => {
@@ -11,7 +11,7 @@ import { renderProgressSteps } from './renderProgressSteps.js'
11
11
  import { renderTitle } from './renderTitle.js'
12
12
 
13
13
  /**
14
- * @param {SweetAlert2} instance
14
+ * @param {SweetAlert} instance
15
15
  * @param {SweetAlertOptions} params
16
16
  */
17
17
  export const render = (instance, params) => {
@@ -3,7 +3,7 @@ import * as dom from '../../dom/index.js'
3
3
  import { capitalizeFirstLetter } from '../../utils.js'
4
4
 
5
5
  /**
6
- * @param {SweetAlert2} instance
6
+ * @param {SweetAlert} instance
7
7
  * @param {SweetAlertOptions} params
8
8
  */
9
9
  export const renderActions = (instance, params) => {
@@ -1,7 +1,7 @@
1
1
  import * as dom from '../../dom/index.js'
2
2
 
3
3
  /**
4
- * @param {SweetAlert2} instance
4
+ * @param {SweetAlert} instance
5
5
  * @param {SweetAlertOptions} params
6
6
  */
7
7
  export const renderCloseButton = (instance, params) => {
@@ -3,7 +3,7 @@ import * as dom from '../../dom/index.js'
3
3
  import { warn } from '../../utils.js'
4
4
 
5
5
  /**
6
- * @param {SweetAlert2} instance
6
+ * @param {SweetAlert} instance
7
7
  * @param {SweetAlertOptions} params
8
8
  */
9
9
  export const renderContainer = (instance, params) => {
@@ -2,7 +2,7 @@ import * as dom from '../../dom/index.js'
2
2
  import { renderInput } from './renderInput.js'
3
3
 
4
4
  /**
5
- * @param {SweetAlert2} instance
5
+ * @param {SweetAlert} instance
6
6
  * @param {SweetAlertOptions} params
7
7
  */
8
8
  export const renderContent = (instance, params) => {
@@ -1,7 +1,7 @@
1
1
  import * as dom from '../../dom/index.js'
2
2
 
3
3
  /**
4
- * @param {SweetAlert2} instance
4
+ * @param {SweetAlert} instance
5
5
  * @param {SweetAlertOptions} params
6
6
  */
7
7
  export const renderFooter = (instance, params) => {
@@ -4,7 +4,7 @@ import * as dom from '../../dom/index.js'
4
4
  import { error } from '../../utils.js'
5
5
 
6
6
  /**
7
- * @param {SweetAlert2} instance
7
+ * @param {SweetAlert} instance
8
8
  * @param {SweetAlertOptions} params
9
9
  */
10
10
  export const renderIcon = (instance, params) => {
@@ -2,7 +2,7 @@ import { swalClasses } from '../../classes.js'
2
2
  import * as dom from '../../dom/index.js'
3
3
 
4
4
  /**
5
- * @param {SweetAlert2} instance
5
+ * @param {SweetAlert} instance
6
6
  * @param {SweetAlertOptions} params
7
7
  */
8
8
  export const renderImage = (instance, params) => {
@@ -13,7 +13,7 @@ import { error, isPromise, warn } from '../../utils.js'
13
13
  const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']
14
14
 
15
15
  /**
16
- * @param {SweetAlert2} instance
16
+ * @param {SweetAlert} instance
17
17
  * @param {SweetAlertOptions} params
18
18
  */
19
19
  export const renderInput = (instance, params) => {
@@ -2,7 +2,7 @@ import { swalClasses } from '../../classes.js'
2
2
  import * as dom from '../../dom/index.js'
3
3
 
4
4
  /**
5
- * @param {SweetAlert2} instance
5
+ * @param {SweetAlert} instance
6
6
  * @param {SweetAlertOptions} params
7
7
  */
8
8
  export const renderPopup = (instance, params) => {
@@ -3,7 +3,7 @@ import * as dom from '../../dom/index.js'
3
3
  import { warn } from '../../utils.js'
4
4
 
5
5
  /**
6
- * @param {SweetAlert2} instance
6
+ * @param {SweetAlert} instance
7
7
  * @param {SweetAlertOptions} params
8
8
  */
9
9
  export const renderProgressSteps = (instance, params) => {
@@ -1,7 +1,7 @@
1
1
  import * as dom from '../../dom/index.js'
2
2
 
3
3
  /**
4
- * @param {SweetAlert2} instance
4
+ * @param {SweetAlert} instance
5
5
  * @param {SweetAlertOptions} params
6
6
  */
7
7
  export const renderTitle = (instance, params) => {