sweetalert2 11.1.9 → 11.2.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.
@@ -41,7 +41,7 @@ const disposeSwal = (instance) => {
41
41
  }
42
42
 
43
43
  const disposeWeakMaps = (instance) => {
44
- // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retreived #2335
44
+ // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
45
45
  if (instance.isAwaitingPromise()) {
46
46
  unsetWeakMaps(privateProps, instance)
47
47
  privateProps.awaitingPromise.set(instance, true)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has.
2
+ * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
3
3
  * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
4
4
  * This is the approach that Babel will probably take to implement private methods/fields
5
5
  * https://github.com/tc39/proposal-private-methods
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has.
2
+ * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
3
3
  * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
4
4
  * This is the approach that Babel will probably take to implement private methods/fields
5
5
  * https://github.com/tc39/proposal-private-methods
@@ -156,3 +156,42 @@
156
156
  transform: rotate(360deg);
157
157
  }
158
158
  }
159
+
160
+ // Question mark animation
161
+ @keyframes swal2-animate-question-mark {
162
+ 0% {
163
+ transform: rotateY(-360deg);
164
+ }
165
+
166
+ 100% {
167
+ transform: rotateY(0);
168
+ }
169
+ }
170
+
171
+ // Info and Warning mark animation
172
+ @keyframes swal2-animate-i-mark {
173
+ 0% {
174
+ transform: rotateZ(45deg);
175
+ opacity: 0;
176
+ }
177
+
178
+ 25% {
179
+ transform: rotateZ(-25deg);
180
+ opacity: .4;
181
+ }
182
+
183
+ 50% {
184
+ transform: rotateZ(15deg);
185
+ opacity: .8;
186
+ }
187
+
188
+ 75% {
189
+ transform: rotateZ(-5deg);
190
+ opacity: 1;
191
+ }
192
+
193
+ 100% {
194
+ transform: rotateX(0);
195
+ opacity: 1;
196
+ }
197
+ }
@@ -577,16 +577,49 @@ $icon-zoom: math.div(strip-units($swal2-icon-size), 5);
577
577
  &.swal2-warning {
578
578
  border-color: lighten($swal2-warning, 7);
579
579
  color: $swal2-warning;
580
+
581
+ // Warning icon animation
582
+ &.swal2-icon-show {
583
+ @if $swal2-icon-animations {
584
+ animation: swal2-animate-error-icon .5s;
585
+
586
+ .swal2-icon-content {
587
+ animation: swal2-animate-i-mark .5s;
588
+ }
589
+ }
590
+ }
580
591
  }
581
592
 
582
593
  &.swal2-info {
583
594
  border-color: lighten($swal2-info, 20);
584
595
  color: $swal2-info;
596
+
597
+ // Info icon animation
598
+ &.swal2-icon-show {
599
+ @if $swal2-icon-animations {
600
+ animation: swal2-animate-error-icon .5s;
601
+
602
+ .swal2-icon-content {
603
+ animation: swal2-animate-i-mark .8s;
604
+ }
605
+ }
606
+ }
585
607
  }
586
608
 
587
609
  &.swal2-question {
588
610
  border-color: lighten($swal2-question, 20);
589
611
  color: $swal2-question;
612
+
613
+ // Question icon animation
614
+ &.swal2-icon-show {
615
+ @if $swal2-icon-animations {
616
+ animation: swal2-animate-error-icon .5s;
617
+
618
+ .swal2-icon-content {
619
+ animation: swal2-animate-question-mark .8s;
620
+ }
621
+ }
622
+ }
590
623
  }
591
624
 
592
625
  &.swal2-success {
@@ -1,6 +1,6 @@
1
1
  import { swalClasses } from '../classes.js'
2
2
  import { uniqueArray, toArray } from '../utils.js'
3
- import { isVisible } from './domUtils.js'
3
+ import { isVisible, hasClass } from './domUtils.js'
4
4
 
5
5
  export const getContainer = () => document.body.querySelector(`.${swalClasses.container}`)
6
6
 
@@ -87,11 +87,11 @@ export const getFocusableElements = () => {
87
87
  }
88
88
 
89
89
  export const isModal = () => {
90
- return !isToast() && !document.body.classList.contains(swalClasses['no-backdrop'])
90
+ return !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop'])
91
91
  }
92
92
 
93
93
  export const isToast = () => {
94
- return document.body.classList.contains(swalClasses['toast-shown'])
94
+ return getPopup() && hasClass(getPopup(), swalClasses.toast)
95
95
  }
96
96
 
97
97
  export const isLoading = () => {
@@ -5,9 +5,6 @@ import { capitalizeFirstLetter } from '../../utils.js'
5
5
  export const renderActions = (instance, params) => {
6
6
  const actions = dom.getActions()
7
7
  const loader = dom.getLoader()
8
- const confirmButton = dom.getConfirmButton()
9
- const denyButton = dom.getDenyButton()
10
- const cancelButton = dom.getCancelButton()
11
8
 
12
9
  // Actions (buttons) wrapper
13
10
  if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {
@@ -19,6 +16,19 @@ export const renderActions = (instance, params) => {
19
16
  // Custom class
20
17
  dom.applyCustomClass(actions, params, 'actions')
21
18
 
19
+ // Render all the buttons
20
+ renderButtons(actions, loader, params)
21
+
22
+ // Loader
23
+ dom.setInnerHtml(loader, params.loaderHtml)
24
+ dom.applyCustomClass(loader, params, 'loader')
25
+ }
26
+
27
+ function renderButtons (actions, loader, params) {
28
+ const confirmButton = dom.getConfirmButton()
29
+ const denyButton = dom.getDenyButton()
30
+ const cancelButton = dom.getCancelButton()
31
+
22
32
  // Render buttons
23
33
  renderButton(confirmButton, 'confirm', params)
24
34
  renderButton(denyButton, 'deny', params)
@@ -26,14 +36,15 @@ export const renderActions = (instance, params) => {
26
36
  handleButtonsStyling(confirmButton, denyButton, cancelButton, params)
27
37
 
28
38
  if (params.reverseButtons) {
29
- actions.insertBefore(cancelButton, loader)
30
- actions.insertBefore(denyButton, loader)
31
- actions.insertBefore(confirmButton, loader)
39
+ if (params.toast) {
40
+ actions.insertBefore(cancelButton, confirmButton)
41
+ actions.insertBefore(denyButton, confirmButton)
42
+ } else {
43
+ actions.insertBefore(cancelButton, loader)
44
+ actions.insertBefore(denyButton, loader)
45
+ actions.insertBefore(confirmButton, loader)
46
+ }
32
47
  }
33
-
34
- // Loader
35
- dom.setInnerHtml(loader, params.loaderHtml)
36
- dom.applyCustomClass(loader, params, 'loader')
37
48
  }
38
49
 
39
50
  function handleButtonsStyling (confirmButton, denyButton, cancelButton, params) {
@@ -187,7 +187,7 @@ $swal2-button-focus-box-shadow: 0 0 0 3px $swal2-outline-color !default;
187
187
  $swal2-confirm-button-order: null !default;
188
188
  $swal2-confirm-button-border: 0 !default;
189
189
  $swal2-confirm-button-border-radius: .25em !default;
190
- $swal2-confirm-button-background-color: #7367f0 !default;
190
+ $swal2-confirm-button-background-color: #7066e0 !default;
191
191
  $swal2-confirm-button-color: $swal2-white !default;
192
192
  $swal2-confirm-button-font-size: 1em !default;
193
193
  $swal2-confirm-button-focus-box-shadow: 0 0 0 3px rgba($swal2-confirm-button-background-color, .5) !default;
@@ -196,7 +196,7 @@ $swal2-confirm-button-focus-box-shadow: 0 0 0 3px rgba($swal2-confirm-button-bac
196
196
  $swal2-deny-button-order: null !default;
197
197
  $swal2-deny-button-border: 0 !default;
198
198
  $swal2-deny-button-border-radius: .25em !default;
199
- $swal2-deny-button-background-color: #ea5455 !default;
199
+ $swal2-deny-button-background-color: #dc3741 !default;
200
200
  $swal2-deny-button-color: $swal2-white !default;
201
201
  $swal2-deny-button-font-size: 1em !default;
202
202
  $swal2-deny-button-focus-box-shadow: 0 0 0 3px rgba($swal2-deny-button-background-color, .5) !default;
@@ -205,7 +205,7 @@ $swal2-deny-button-focus-box-shadow: 0 0 0 3px rgba($swal2-deny-button-backgroun
205
205
  $swal2-cancel-button-order: null !default;
206
206
  $swal2-cancel-button-border: 0 !default;
207
207
  $swal2-cancel-button-border-radius: .25em !default;
208
- $swal2-cancel-button-background-color: #6e7d88 !default;
208
+ $swal2-cancel-button-background-color: #6e7881 !default;
209
209
  $swal2-cancel-button-color: $swal2-white !default;
210
210
  $swal2-cancel-button-font-size: 1em !default;
211
211
  $swal2-cancel-button-focus-box-shadow: 0 0 0 3px rgba($swal2-cancel-button-background-color, .5) !default;