sweetalert2 11.2.0 → 11.3.1

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,8 +1,8 @@
1
- import * as dom from '../utils/dom/index.js'
2
- import { DismissReason } from '../utils/DismissReason.js'
3
- import { callIfFunction } from '../utils/utils.js'
4
- import { clickConfirm } from '../staticMethods/dom.js'
5
- import privateProps from '../privateProps.js'
1
+ import * as dom from './utils/dom/index.js'
2
+ import { DismissReason } from './utils/DismissReason.js'
3
+ import { callIfFunction } from './utils/utils.js'
4
+ import { clickConfirm } from './staticMethods/dom.js'
5
+ import privateProps from './privateProps.js'
6
6
 
7
7
  export const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {
8
8
  if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
@@ -1,6 +1,6 @@
1
- import { callIfFunction } from '../utils/utils.js'
2
- import { DismissReason } from '../utils/DismissReason.js'
3
- import privateProps from '../privateProps.js'
1
+ import { callIfFunction } from './utils/utils.js'
2
+ import { DismissReason } from './utils/DismissReason.js'
3
+ import privateProps from './privateProps.js'
4
4
 
5
5
  export const handlePopupClick = (instance, domCache, dismissWith) => {
6
6
  const innerParams = privateProps.innerParams.get(instance)
@@ -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 = () => {
@@ -17,6 +17,11 @@ export const renderPopup = (instance, params) => {
17
17
  // Padding
18
18
  dom.applyNumericalStyle(popup, 'padding', params.padding)
19
19
 
20
+ // Color
21
+ if (params.color) {
22
+ popup.style.color = params.color
23
+ }
24
+
20
25
  // Background
21
26
  if (params.background) {
22
27
  popup.style.background = params.background
@@ -23,6 +23,7 @@ export const defaultParams = {
23
23
  },
24
24
  customClass: {},
25
25
  target: 'body',
26
+ color: undefined,
26
27
  backdrop: true,
27
28
  heightAuto: true,
28
29
  allowOutsideClick: true,
@@ -99,6 +100,7 @@ export const updatableParams = [
99
100
  'cancelButtonText',
100
101
  'closeButtonAriaLabel',
101
102
  'closeButtonHtml',
103
+ 'color',
102
104
  'confirmButtonAriaLabel',
103
105
  'confirmButtonColor',
104
106
  'confirmButtonText',
@@ -51,7 +51,7 @@ $swal2-title-position: relative !default;
51
51
  $swal2-title-max-width: 100% !default;
52
52
  $swal2-title-margin: 0 !default;
53
53
  $swal2-title-padding: .8em 1em 0 !default;
54
- $swal2-title-color: lighten($swal2-black, 35) !default;
54
+ $swal2-title-color: inherit !default;
55
55
  $swal2-title-font-size: 1.875em !default;
56
56
  $swal2-title-font-weight: 600 !default;
57
57
  $swal2-title-text-align: center !default;
@@ -61,7 +61,7 @@ $swal2-html-container-justify-content: center !default;
61
61
  $swal2-html-container-margin: 1em 1.6em .3em !default;
62
62
  $swal2-html-container-padding: 0 !default;
63
63
  $swal2-html-container-overflow: auto !default;
64
- $swal2-html-container-color: lighten($swal2-black, 33) !default;
64
+ $swal2-html-container-color: inherit !default;
65
65
  $swal2-html-container-font-size: 1.125em !default;
66
66
  $swal2-html-container-font-weight: normal !default;
67
67
  $swal2-html-container-line-height: normal !default;
@@ -129,7 +129,7 @@ $swal2-active-step-color: $swal2-white !default;
129
129
  $swal2-footer-margin: 1em 0 0 !default;
130
130
  $swal2-footer-padding: 1em 1em 0 !default;
131
131
  $swal2-footer-border-color: #eee !default;
132
- $swal2-footer-color: lighten($swal2-black, 33) !default;
132
+ $swal2-footer-color: inherit !default;
133
133
  $swal2-footer-font-size: 1em !default;
134
134
 
135
135
  // TIMER POGRESS BAR
@@ -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;
package/sweetalert2.d.ts CHANGED
@@ -580,7 +580,14 @@ declare module 'sweetalert2' {
580
580
  padding?: number | string;
581
581
 
582
582
  /**
583
- * Popup background (CSS `background` property).
583
+ * Color for title, content and footer (CSS `color` property). The default color is `#545454`.
584
+ *
585
+ * @default undefined
586
+ */
587
+ color?: string;
588
+
589
+ /**
590
+ * Popup background (CSS `background` property). The default background is `#fff`.
584
591
  *
585
592
  * @default undefined
586
593
  */