react-confirm-alert 3.1.0 → 3.1.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.
- package/Readme.md +5 -5
- package/package.json +3 -2
- package/style.css +127 -0
package/Readme.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# react-confirm-alert
|
|
2
2
|
|
|
3
|
-
Confirm, alert and prompt dialogs for React 18 and 19. `await confirm()`, a native modal, focus that moves in and back, and the
|
|
3
|
+
Confirm, alert and prompt dialogs for React 18 and 19. `await confirm()`, a native modal, focus that moves in and back, and the 3.0 `confirmAlert` unchanged.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/react-confirm-alert)
|
|
6
6
|
|
|
7
|
-
[Docs](https://ga-mo.github.io/react-confirm-alert/docs/) · [Playground](https://ga-mo.github.io/react-confirm-alert/playground/) · [
|
|
7
|
+
[Docs](https://ga-mo.github.io/react-confirm-alert/docs/) · [Playground](https://ga-mo.github.io/react-confirm-alert/playground/) · [What's new in 3.1](https://ga-mo.github.io/react-confirm-alert/docs/whats-new-in-3-1/)
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ if (await confirm({ title: 'Delete file?', message: 'This cannot be undone.', to
|
|
|
25
25
|
|
|
26
26
|
`confirm()` resolves `true` or `false`. `alert()` and `prompt()` work the same way, and `<DialogHost />` placed inside your providers lets dialogs read their context.
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## 3.0 code keeps working
|
|
29
29
|
|
|
30
30
|
```jsx
|
|
31
31
|
import { confirmAlert } from 'react-confirm-alert'
|
|
@@ -41,7 +41,7 @@ confirmAlert({
|
|
|
41
41
|
})
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Same options, DOM, class names and CSS path as
|
|
44
|
+
Same options, DOM, class names and CSS path as 3.0.
|
|
45
45
|
|
|
46
46
|
## Tailwind CSS
|
|
47
47
|
|
|
@@ -64,7 +64,7 @@ Importing the CSS into `layer(components)` lets Tailwind utilities win without `
|
|
|
64
64
|
| `import { confirm }` | 3,851 B |
|
|
65
65
|
| CSS | 1,095 B |
|
|
66
66
|
|
|
67
|
-
Measured on 2026-10-23 with size-limit 14.3.0 (`npx size-limit`, config in `.size-limit.json`): the ESM build bundled and minified with React and React DOM excluded, then gzipped.
|
|
67
|
+
Measured on 2026-10-23 with size-limit 14.3.0 (`npx size-limit`, config in `.size-limit.json`): the ESM build bundled and minified with React and React DOM excluded, then gzipped. 3.0.6 measured the same way is 2,396 B, including `prop-types`. The extra bytes are the native modal, focus handling, stacked and queued dialogs, and dialogs that render inside your providers.
|
|
68
68
|
|
|
69
69
|
## Older versions
|
|
70
70
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-confirm-alert",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "react component confirm dialog.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "vite build && node -e \"require('fs').rmSync('typings',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
8
|
+
"build": "vite build && node -e \"require('fs').rmSync('typings',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node -e \"require('fs').copyFileSync('src/react-confirm-alert.css','style.css')\"",
|
|
9
9
|
"prepublishOnly": "npm run build",
|
|
10
10
|
"test": "vitest run",
|
|
11
11
|
"test:fixtures": "node fixtures/run.mjs",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"dist",
|
|
43
43
|
"typings",
|
|
44
44
|
"src/react-confirm-alert.css",
|
|
45
|
+
"style.css",
|
|
45
46
|
"index.d.ts"
|
|
46
47
|
],
|
|
47
48
|
"devDependencies": {
|
package/style.css
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
body.react-confirm-alert-body-element {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.react-confirm-alert-blur {
|
|
6
|
+
filter: blur(var(--rca-blur, 2px));
|
|
7
|
+
-webkit-filter: blur(var(--rca-blur, 2px));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.react-confirm-alert-overlay {
|
|
11
|
+
position: fixed;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
z-index: var(--rca-z-index, 99);
|
|
17
|
+
background: var(--rca-backdrop, rgba(255, 255, 255, 0.9));
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
animation: react-confirm-alert-fadeIn var(--rca-duration, 0.5s) var(--rca-easing, ease) var(--rca-delay, 0.2s) forwards;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.react-confirm-alert-body {
|
|
26
|
+
font-family: var(--rca-font, Arial, Helvetica, sans-serif);
|
|
27
|
+
width: var(--rca-width, 400px);
|
|
28
|
+
max-width: calc(100vw - 92px);
|
|
29
|
+
padding: var(--rca-padding, 30px);
|
|
30
|
+
text-align: left;
|
|
31
|
+
background: var(--rca-bg, #fff);
|
|
32
|
+
border-radius: var(--rca-radius, 10px);
|
|
33
|
+
box-shadow: var(--rca-shadow, 0 20px 75px rgba(0, 0, 0, 0.13));
|
|
34
|
+
color: var(--rca-fg, #666);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.react-confirm-alert-body > h1 {
|
|
38
|
+
margin-top: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.react-confirm-alert-body > h3 {
|
|
42
|
+
margin: 0;
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.react-confirm-alert-button-group {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: flex-start;
|
|
49
|
+
margin-top: 20px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.react-confirm-alert-button-group > button {
|
|
53
|
+
outline: none;
|
|
54
|
+
background: var(--rca-button-bg, #333);
|
|
55
|
+
border: none;
|
|
56
|
+
display: inline-block;
|
|
57
|
+
padding: 6px 18px;
|
|
58
|
+
color: var(--rca-button-fg, #eee);
|
|
59
|
+
margin-right: var(--rca-gap, 10px);
|
|
60
|
+
border-radius: var(--rca-button-radius, 5px);
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Keyboard focus is visible again (B15); a mouse click shows no ring. */
|
|
66
|
+
.react-confirm-alert-button-group > button:focus-visible {
|
|
67
|
+
outline: var(--rca-focus-ring, 2px solid Highlight);
|
|
68
|
+
outline-offset: 2px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* modal: true renders the overlay as a <dialog> in the top layer. Reset the browser's dialog box so it
|
|
72
|
+
looks like the v3 overlay, and never set display while it is closed. */
|
|
73
|
+
dialog.react-confirm-alert-overlay {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
max-width: none;
|
|
77
|
+
max-height: none;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
border: 0;
|
|
81
|
+
color: inherit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
dialog.react-confirm-alert-overlay:not([open]) {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
dialog.react-confirm-alert-overlay::backdrop {
|
|
89
|
+
background: transparent;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.react-confirm-alert-button-group > [data-variant='danger'] {
|
|
93
|
+
background: var(--rca-danger, #c62828);
|
|
94
|
+
color: #fff;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[data-rca]:not([data-kind='custom']) [data-slot='title'] {
|
|
98
|
+
margin: 0 0 8px;
|
|
99
|
+
font-size: 1.25em;
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
color: var(--rca-title, #222);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.react-confirm-alert [data-slot='message'] {
|
|
105
|
+
margin: 0;
|
|
106
|
+
white-space: pre-line;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.react-confirm-alert:focus {
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (prefers-reduced-motion: reduce) {
|
|
114
|
+
.react-confirm-alert-overlay {
|
|
115
|
+
animation: none;
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@keyframes react-confirm-alert-fadeIn {
|
|
121
|
+
from {
|
|
122
|
+
opacity: 0;
|
|
123
|
+
}
|
|
124
|
+
to {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
}
|
|
127
|
+
}
|