d9-toast 1.0.16 → 1.1.17
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 +23 -21
- package/dist/Toast.js +50 -26
- package/dist/ToastContext.js +20 -8
- package/dist/d9-toast.d.ts +49 -14
- package/dist/toast.css +147 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,11 +10,15 @@ Customizable toast notifications for React.
|
|
|
10
10
|
* Pure CSS included — no additional setup required.
|
|
11
11
|
* Easy to import and use in any React project.
|
|
12
12
|
* Supports multiple types: success, error, info, warning, loading, submit.
|
|
13
|
-
* Fully responsive and modern UI.
|
|
13
|
+
* Fully responsive and modern UI and smooth animation.
|
|
14
14
|
* Users can optionally add Tailwind CSS classes via `className` for custom styling.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
+
## Demo
|
|
19
|
+
|
|
20
|
+
[Click Here](https://codesandbox.io/embed/cqkyzm?view=preview&module=%2Fpublic%2Findex.html)
|
|
21
|
+
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
20
24
|
```bash
|
|
@@ -40,7 +44,7 @@ import App from "./App";
|
|
|
40
44
|
|
|
41
45
|
function Root() {
|
|
42
46
|
return (
|
|
43
|
-
<ToastProvider
|
|
47
|
+
<ToastProvider>
|
|
44
48
|
<App />
|
|
45
49
|
</ToastProvider>
|
|
46
50
|
);
|
|
@@ -56,46 +60,44 @@ import React from "react";
|
|
|
56
60
|
import { useToast } from "d9-toast";
|
|
57
61
|
|
|
58
62
|
function App() {
|
|
59
|
-
const toast = useToast();
|
|
60
63
|
|
|
61
|
-
const showToast = ()
|
|
62
|
-
|
|
64
|
+
const { showToast, removeToast, removeToastAll } = useToast();
|
|
65
|
+
|
|
66
|
+
const Toast = () => {
|
|
67
|
+
showToast({
|
|
63
68
|
message: "Hello World!",
|
|
64
69
|
type: "success", // success | error | info | warning | loading | submit
|
|
70
|
+
position: "top-right",
|
|
65
71
|
duration: 3000,
|
|
66
72
|
actions: [
|
|
67
|
-
{ text: "
|
|
68
|
-
|
|
73
|
+
{ text: "Toast ID", callback: (toastId) => console.log(toastId) },
|
|
74
|
+
{ text: "Submit", callback: () => console.log("Submit clicked") },
|
|
75
|
+
],
|
|
69
76
|
className: "bg-green-500 text-white shadow-lg", // optional Tailwind/custom styling
|
|
70
77
|
});
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
return <button onClick={
|
|
80
|
+
return <button onClick={Toast}>Show Toast</button>;
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
export default App;
|
|
77
84
|
```
|
|
78
85
|
|
|
79
|
-
### 3.
|
|
80
|
-
|
|
81
|
-
| Prop | Type | Default | Description |
|
|
82
|
-
| ------------------ | ------- | ----------- | ------------------------------------------------------------------------------- |
|
|
83
|
-
| `position` | string | `top-right` | Position of all toasts (`top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, `center-top`, `center-bottom` ) |
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### 4. Toast Options
|
|
86
|
+
### 3. Toast Options
|
|
87
87
|
|
|
88
88
|
| Option | Type | Default | Description |
|
|
89
89
|
| ---------- | ------- | ------- | -------------------------------------------------------------------------- |
|
|
90
|
-
| `message` | string | - |
|
|
90
|
+
| `message` | string | - | Main message text of the toast |
|
|
91
91
|
| `type` | string | `info` | Type of toast (`success`, `error`, `info`, `warning`, `loading`, `submit`) |
|
|
92
92
|
| `duration` | number | 5000 | Auto-close duration in ms (0 for infinite) |
|
|
93
|
+
| `position` | string | `top-right` | Position of all toasts (`top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, `center-top`, `center-bottom` ) |
|
|
93
94
|
| `theme` | string | `light` | Default theme for all toasts (`light` or `dark`) |
|
|
94
|
-
| `pauseOnHover` | boolean | `true` | Pause
|
|
95
|
-
| `pauseOnFocusLoss` | boolean | `true` | Pause
|
|
95
|
+
| `pauseOnHover` | boolean | `true` | Pause timer when hovered |
|
|
96
|
+
| `pauseOnFocusLoss` | boolean | `true` | Pause timer when window/tab loses focus |
|
|
96
97
|
| `actions` | array | [] | Array of action objects `{ text: string, callback: function }` |
|
|
97
|
-
| `closable` | boolean | true |
|
|
98
|
-
| `
|
|
98
|
+
| `closable` | boolean | true | Allow manual close via X button
|
|
99
|
+
| `autoClose` | boolean | true | Whether the toast auto-closes after duration button |
|
|
100
|
+
| `progress` | boolean | true | Whether to show progress bar |
|
|
99
101
|
| `className` | string| " " | Optional extra CSS/Tailwind classes to customize the toast bar |
|
|
100
102
|
|
|
101
103
|
---
|
package/dist/Toast.js
CHANGED
|
@@ -15,6 +15,8 @@ var Toast = function Toast(_ref) {
|
|
|
15
15
|
type = _ref$type === void 0 ? "info" : _ref$type,
|
|
16
16
|
_ref$theme = _ref.theme,
|
|
17
17
|
theme = _ref$theme === void 0 ? "light" : _ref$theme,
|
|
18
|
+
_ref$position = _ref.position,
|
|
19
|
+
position = _ref$position === void 0 ? "top-right" : _ref$position,
|
|
18
20
|
_ref$className = _ref.className,
|
|
19
21
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
20
22
|
_ref$duration = _ref.duration,
|
|
@@ -22,9 +24,10 @@ var Toast = function Toast(_ref) {
|
|
|
22
24
|
_ref$actions = _ref.actions,
|
|
23
25
|
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
24
26
|
remove = _ref.remove,
|
|
25
|
-
position = _ref.position,
|
|
26
27
|
_ref$progress = _ref.progress,
|
|
27
28
|
progress = _ref$progress === void 0 ? true : _ref$progress,
|
|
29
|
+
_ref$autoClose = _ref.autoClose,
|
|
30
|
+
autoClose = _ref$autoClose === void 0 ? true : _ref$autoClose,
|
|
28
31
|
_ref$closable = _ref.closable,
|
|
29
32
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
30
33
|
_ref$pauseOnHover = _ref.pauseOnHover,
|
|
@@ -42,13 +45,23 @@ var Toast = function Toast(_ref) {
|
|
|
42
45
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
46
|
isPaused = _useState4[0],
|
|
44
47
|
setPaused = _useState4[1]; // For timer pause
|
|
48
|
+
var _useState5 = useState(false),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
exiting = _useState6[0],
|
|
51
|
+
setExiting = _useState6[1];
|
|
52
|
+
|
|
53
|
+
// Styles [Animation]
|
|
54
|
+
// entry animation [based on position]
|
|
55
|
+
var enterAnim = "".concat(position.startsWith("top") && "upToDown" || position.startsWith("bottom") && "downToUp" || position.endsWith("top") && "upToDown" || position.endsWith("bottom") && "downToUp" || "centerEnter", " 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards");
|
|
56
|
+
|
|
57
|
+
// exit animation [reverse direction]
|
|
58
|
+
var exitAnim = "".concat(position.startsWith("top") && "downToUpExit" || position.startsWith("bottom") && "upToDownExit" || position.endsWith("top") && "downToUpExit" || position.endsWith("bottom") && "upToDownExit" || "centerExit", " 0.25s cubic-bezier(0.39, 0.575, 0.565, 1) forwards");
|
|
45
59
|
|
|
46
60
|
// Start auto-close timer.
|
|
47
61
|
useEffect(function () {
|
|
48
|
-
if (duration !== 0) {
|
|
62
|
+
if (duration !== 0 && autoClose) {
|
|
49
63
|
startTimer();
|
|
50
64
|
}
|
|
51
|
-
|
|
52
65
|
// pause/resume when window focus changes.
|
|
53
66
|
var handleBlur = function handleBlur() {
|
|
54
67
|
return pauseOnFocusLoss && pauseTimer();
|
|
@@ -67,11 +80,12 @@ var Toast = function Toast(_ref) {
|
|
|
67
80
|
window.removeEventListener("focus", handleFocus);
|
|
68
81
|
}
|
|
69
82
|
};
|
|
70
|
-
}, [duration, pauseOnFocusLoss]);
|
|
83
|
+
}, [duration, autoClose, pauseOnFocusLoss]);
|
|
71
84
|
|
|
72
85
|
// --- Helpers Fun ---
|
|
73
86
|
// for start
|
|
74
87
|
var startTimer = function startTimer() {
|
|
88
|
+
if (!autoClose) return;
|
|
75
89
|
intervalRef.current = setInterval(function () {
|
|
76
90
|
// time to passed...
|
|
77
91
|
var elapsed = Date.now() - start.current;
|
|
@@ -83,14 +97,14 @@ var Toast = function Toast(_ref) {
|
|
|
83
97
|
// stop timer...
|
|
84
98
|
clearInterval(intervalRef.current);
|
|
85
99
|
// remove toast.
|
|
86
|
-
|
|
100
|
+
triggerExit();
|
|
87
101
|
}
|
|
88
102
|
}, 100);
|
|
89
103
|
};
|
|
90
104
|
|
|
91
105
|
// for pause
|
|
92
106
|
var pauseTimer = function pauseTimer() {
|
|
93
|
-
if (isPaused) return;
|
|
107
|
+
if (isPaused && !autoClose) return;
|
|
94
108
|
clearInterval(intervalRef.current);
|
|
95
109
|
remaining.current = remaining.current - (Date.now() - start.current);
|
|
96
110
|
setPaused(true);
|
|
@@ -98,30 +112,40 @@ var Toast = function Toast(_ref) {
|
|
|
98
112
|
|
|
99
113
|
// for resume
|
|
100
114
|
var resumeTimer = function resumeTimer() {
|
|
101
|
-
if (!isPaused) return;
|
|
115
|
+
if (!isPaused && !autoClose) return;
|
|
102
116
|
start.current = Date.now();
|
|
103
117
|
setPaused(false);
|
|
104
118
|
startTimer();
|
|
105
119
|
};
|
|
106
120
|
|
|
107
|
-
//
|
|
108
|
-
var
|
|
121
|
+
// for exit
|
|
122
|
+
var triggerExit = function triggerExit() {
|
|
123
|
+
setExiting(true);
|
|
124
|
+
setTimeout(function () {
|
|
125
|
+
return remove();
|
|
126
|
+
}, 250); // Set and match exit animation duration.
|
|
127
|
+
};
|
|
109
128
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
110
129
|
children: /*#__PURE__*/_jsxs("div", {
|
|
111
130
|
style: {
|
|
112
|
-
animation:
|
|
131
|
+
animation: exiting ? exitAnim : enterAnim
|
|
113
132
|
},
|
|
114
133
|
className: "toast ".concat(theme, " ").concat(className),
|
|
115
134
|
onMouseEnter: pauseOnHover ? pauseTimer : undefined,
|
|
116
135
|
onMouseLeave: pauseOnHover ? resumeTimer : undefined,
|
|
117
136
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
118
137
|
className: "toastHeader ".concat(type),
|
|
119
|
-
children: [/*#__PURE__*/_jsxs("
|
|
138
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
139
|
+
className: "title",
|
|
120
140
|
children: [/*#__PURE__*/_jsx(Icons, {
|
|
121
141
|
name: type
|
|
122
|
-
}), " ",
|
|
142
|
+
}), " ", /*#__PURE__*/_jsx("p", {
|
|
143
|
+
children: type.toUpperCase()
|
|
144
|
+
})]
|
|
123
145
|
}), closable && /*#__PURE__*/_jsx("button", {
|
|
124
|
-
onClick:
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
return triggerExit();
|
|
148
|
+
},
|
|
125
149
|
children: /*#__PURE__*/_jsx(Icons, {
|
|
126
150
|
name: "X"
|
|
127
151
|
})
|
|
@@ -134,20 +158,20 @@ var Toast = function Toast(_ref) {
|
|
|
134
158
|
}), actions.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
135
159
|
className: "toastActions",
|
|
136
160
|
children: actions.map(function (a, idx) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
161
|
+
if (idx < 2) {
|
|
162
|
+
return /*#__PURE__*/_jsx("button", {
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
var _a$callback;
|
|
165
|
+
return (_a$callback = a.callback) === null || _a$callback === void 0 ? void 0 : _a$callback.call(a, {
|
|
166
|
+
id: id
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
className: "action-btn ".concat(actions.length === 1 ? "action-btnA ".concat(type) : idx === 0 ? "action-btnB ".concat(type) : "action-btnA ".concat(type)),
|
|
170
|
+
children: a.text
|
|
171
|
+
}, idx);
|
|
172
|
+
}
|
|
149
173
|
})
|
|
150
|
-
}), progress && duration !== 0 && /*#__PURE__*/_jsx("div", {
|
|
174
|
+
}), progress && duration !== 0 && autoClose && /*#__PURE__*/_jsx("div", {
|
|
151
175
|
className: "progress-container ".concat(type),
|
|
152
176
|
children: /*#__PURE__*/_jsx("div", {
|
|
153
177
|
className: "toast-progress ".concat(type),
|
package/dist/ToastContext.js
CHANGED
|
@@ -23,9 +23,8 @@ export var useToast = function useToast() {
|
|
|
23
23
|
return useContext(ToastContext);
|
|
24
24
|
};
|
|
25
25
|
export var ToastProvider = function ToastProvider(_ref) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
position = _ref$position === void 0 ? "top-right" : _ref$position;
|
|
26
|
+
var _toasts$2;
|
|
27
|
+
var children = _ref.children;
|
|
29
28
|
var _useState = useState([]),
|
|
30
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
30
|
toasts = _useState2[0],
|
|
@@ -36,7 +35,10 @@ export var ToastProvider = function ToastProvider(_ref) {
|
|
|
36
35
|
return Date.now() + Math.random();
|
|
37
36
|
};
|
|
38
37
|
|
|
39
|
-
//
|
|
38
|
+
// Positions.
|
|
39
|
+
var positions = ["top-left", "top-right", "bottom-left", "bottom-right", "center", "center-top", "center-bottom"];
|
|
40
|
+
|
|
41
|
+
// Show toast..
|
|
40
42
|
var showToast = useCallback(function (toast) {
|
|
41
43
|
var newToast = _objectSpread({
|
|
42
44
|
id: generateId()
|
|
@@ -44,7 +46,7 @@ export var ToastProvider = function ToastProvider(_ref) {
|
|
|
44
46
|
setToasts(function (prev) {
|
|
45
47
|
return [].concat(_toConsumableArray(prev), [newToast]);
|
|
46
48
|
});
|
|
47
|
-
if (toast.duration !== 0) {
|
|
49
|
+
if (toast.duration !== 0 && toast.autoClose) {
|
|
48
50
|
setTimeout(function () {
|
|
49
51
|
return removeToast(newToast.id);
|
|
50
52
|
}, toast.duration || 5000);
|
|
@@ -59,16 +61,26 @@ export var ToastProvider = function ToastProvider(_ref) {
|
|
|
59
61
|
});
|
|
60
62
|
});
|
|
61
63
|
}, []);
|
|
64
|
+
|
|
65
|
+
// Remove all toast.
|
|
66
|
+
var removeToastAll = function removeToastAll() {
|
|
67
|
+
if (toasts.length > 0) {
|
|
68
|
+
setToasts([]);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
62
71
|
return /*#__PURE__*/_jsxs(ToastContext.Provider, {
|
|
63
72
|
value: {
|
|
64
73
|
showToast: showToast,
|
|
65
|
-
removeToast: removeToast
|
|
74
|
+
removeToast: removeToast,
|
|
75
|
+
removeToastAll: removeToastAll
|
|
66
76
|
},
|
|
67
77
|
children: [children, /*#__PURE__*/_jsx("div", {
|
|
68
|
-
className: "toastContainer ".concat(
|
|
78
|
+
className: "toastContainer ".concat(positions.some(function (p) {
|
|
79
|
+
var _toasts$;
|
|
80
|
+
return p === ((_toasts$ = toasts[0]) === null || _toasts$ === void 0 ? void 0 : _toasts$.position);
|
|
81
|
+
}) ? (_toasts$2 = toasts[0]) === null || _toasts$2 === void 0 ? void 0 : _toasts$2.position : "top-right"),
|
|
69
82
|
children: toasts.map(function (toast) {
|
|
70
83
|
return /*#__PURE__*/_jsx(Toast, _objectSpread(_objectSpread({}, toast), {}, {
|
|
71
|
-
position: position,
|
|
72
84
|
remove: function remove() {
|
|
73
85
|
return removeToast(toast.id);
|
|
74
86
|
}
|
package/dist/d9-toast.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare module "d9-toast" {
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
/** Toast type (icon + header color) */
|
|
4
5
|
export type ToastType =
|
|
5
6
|
| "success"
|
|
6
7
|
| "error"
|
|
@@ -9,40 +10,74 @@ declare module "d9-toast" {
|
|
|
9
10
|
| "loading"
|
|
10
11
|
| "submit";
|
|
11
12
|
|
|
13
|
+
/** Theme variants */
|
|
14
|
+
export type ToastTheme = "light" | "dark";
|
|
15
|
+
|
|
16
|
+
/** Available toast positions */
|
|
17
|
+
export type ToastPosition =
|
|
18
|
+
| "top-right"
|
|
19
|
+
| "top-left"
|
|
20
|
+
| "bottom-right"
|
|
21
|
+
| "bottom-left"
|
|
22
|
+
| "center"
|
|
23
|
+
| "center-top"
|
|
24
|
+
| "center-bottom";
|
|
25
|
+
|
|
26
|
+
/** Single button/action displayed inside a toast */
|
|
12
27
|
export interface ToastAction {
|
|
28
|
+
/** Text label for the action button */
|
|
13
29
|
text: string;
|
|
30
|
+
/** Optional callback triggered on click */
|
|
14
31
|
callback?: (toast: { id: number }) => void;
|
|
15
32
|
}
|
|
16
33
|
|
|
34
|
+
/** Toast configuration options */
|
|
17
35
|
export interface ToastOptions {
|
|
36
|
+
/** Main message text of the toast */
|
|
18
37
|
message: string;
|
|
38
|
+
/** Visual type (color/icon) */
|
|
19
39
|
type?: ToastType;
|
|
40
|
+
/** Duration in ms before auto-close (0 = persistent) */
|
|
20
41
|
duration?: number;
|
|
42
|
+
/** Optional buttons shown inside the toast */
|
|
21
43
|
actions?: ToastAction[];
|
|
22
|
-
|
|
44
|
+
/** Visual theme */
|
|
45
|
+
theme?: ToastTheme;
|
|
46
|
+
/** Whether to show progress bar */
|
|
23
47
|
progress?: boolean;
|
|
48
|
+
/** Allow manual close via X button */
|
|
24
49
|
closable?: boolean;
|
|
50
|
+
/** Pause timer when hovered */
|
|
25
51
|
pauseOnHover?: boolean;
|
|
52
|
+
/** Pause timer when window/tab loses focus */
|
|
26
53
|
pauseOnFocusLoss?: boolean;
|
|
27
|
-
|
|
54
|
+
/** Extra custom class names */
|
|
55
|
+
className?: string;
|
|
56
|
+
/** Where to place the toast on screen */
|
|
57
|
+
position?: ToastPosition;
|
|
58
|
+
/** Whether the toast auto-closes after duration */
|
|
59
|
+
autoClose?: boolean;
|
|
28
60
|
}
|
|
29
61
|
|
|
62
|
+
/** Toast provider props for context setup */
|
|
30
63
|
export interface ToastProviderProps {
|
|
64
|
+
/** App children to wrap with ToastProvider */
|
|
31
65
|
children: React.ReactNode;
|
|
32
|
-
position?:
|
|
33
|
-
| "top-right"
|
|
34
|
-
| "top-left"
|
|
35
|
-
| "bottom-right"
|
|
36
|
-
| "bottom-left"
|
|
37
|
-
| "center"
|
|
38
|
-
| "center-top"
|
|
39
|
-
| "center-bottom";
|
|
40
66
|
}
|
|
41
67
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
/** Context value shape */
|
|
69
|
+
export interface ToastContextValue {
|
|
70
|
+
/** Show a toast with given options */
|
|
45
71
|
showToast: (toast: ToastOptions) => void;
|
|
72
|
+
/** Remove a toast by ID */
|
|
46
73
|
removeToast: (id: number) => void;
|
|
47
|
-
|
|
74
|
+
/** Remove all active toasts */
|
|
75
|
+
removeToastAll: () => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Context provider component */
|
|
79
|
+
export const ToastProvider: React.FC<ToastProviderProps>;
|
|
80
|
+
|
|
81
|
+
/** Hook to trigger and manage toasts */
|
|
82
|
+
export const useToast: () => ToastContextValue;
|
|
48
83
|
}
|
package/dist/toast.css
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/* Defaults */
|
|
2
|
+
button,
|
|
3
|
+
p,
|
|
4
|
+
span {
|
|
5
|
+
font: inherit;
|
|
6
|
+
color: inherit;
|
|
7
|
+
background-color: transparent;
|
|
8
|
+
border: none;
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
.toastContainer {
|
|
2
14
|
position: fixed;
|
|
3
15
|
z-index: 999;
|
|
4
16
|
display: flex;
|
|
5
|
-
gap:
|
|
17
|
+
gap: 14px;
|
|
6
18
|
}
|
|
7
19
|
.toastContainer.top-right {
|
|
8
20
|
flex-direction: column;
|
|
@@ -31,11 +43,13 @@
|
|
|
31
43
|
transform: translate(-50%, -50%);
|
|
32
44
|
}
|
|
33
45
|
.toastContainer.center-top {
|
|
46
|
+
flex-direction: column;
|
|
34
47
|
top: 16px;
|
|
35
48
|
left: 50%;
|
|
36
49
|
transform: translateX(-50%);
|
|
37
50
|
}
|
|
38
51
|
.toastContainer.center-bottom {
|
|
52
|
+
flex-direction: column-reverse;
|
|
39
53
|
bottom: 16px;
|
|
40
54
|
left: 50%;
|
|
41
55
|
transform: translateX(-50%);
|
|
@@ -48,19 +62,20 @@
|
|
|
48
62
|
flex-direction: column;
|
|
49
63
|
gap: 8px;
|
|
50
64
|
padding: 6px;
|
|
65
|
+
margin: 6px 0;
|
|
51
66
|
border-radius: 8px;
|
|
52
67
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
53
|
-
font-family:
|
|
54
|
-
transition: all 0.3s ease-in
|
|
68
|
+
font-family: cursive;
|
|
69
|
+
transition: all 0.3s ease-in;
|
|
55
70
|
}
|
|
56
|
-
.
|
|
71
|
+
.light {
|
|
57
72
|
background-color: #f9fafb;
|
|
58
|
-
color: #
|
|
73
|
+
color: #111827;
|
|
59
74
|
}
|
|
60
75
|
|
|
61
|
-
.
|
|
76
|
+
.dark {
|
|
62
77
|
background-color: #030712;
|
|
63
|
-
color: #
|
|
78
|
+
color: #f3f4f6;
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
.toastHeader {
|
|
@@ -71,15 +86,23 @@
|
|
|
71
86
|
border-radius: 6px;
|
|
72
87
|
box-shadow: inset 0 1px rgb(0 0 0 / 0.05);
|
|
73
88
|
}
|
|
74
|
-
.toastHeader
|
|
75
|
-
display: flex;
|
|
89
|
+
.toastHeader .title {
|
|
90
|
+
display: inline-flex;
|
|
76
91
|
align-items: center;
|
|
77
92
|
gap: 8px;
|
|
78
93
|
font-size: 1rem;
|
|
79
94
|
font-weight: 500;
|
|
80
95
|
}
|
|
81
|
-
|
|
96
|
+
|
|
97
|
+
.toastHeader button {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
font-size: 1.3em;
|
|
82
102
|
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.toastHeader button:hover {
|
|
83
106
|
color: oklch(57.7% 0.245 27.325);
|
|
84
107
|
}
|
|
85
108
|
|
|
@@ -93,16 +116,16 @@
|
|
|
93
116
|
}
|
|
94
117
|
.toastHeader.info {
|
|
95
118
|
color: oklch(54.6% 0.245 262.881);
|
|
96
|
-
background-color: oklch(54.6% 0.245 262.881 / 0.
|
|
119
|
+
background-color: oklch(54.6% 0.245 262.881 / 0.2);
|
|
97
120
|
}
|
|
98
121
|
.toastHeader.warning {
|
|
99
122
|
color: oklch(68.1% 0.162 75.834);
|
|
100
|
-
background-color: oklch(68.1% 0.162 75.834 / 0.
|
|
123
|
+
background-color: oklch(68.1% 0.162 75.834 / 0.2);
|
|
101
124
|
}
|
|
102
125
|
.toastHeader.loading,
|
|
103
126
|
.toastHeader.submit {
|
|
104
|
-
color:
|
|
105
|
-
background-color:
|
|
127
|
+
color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
128
|
+
background-color: oklab(54.13400000000001% 0.09644 -0.22706 / 0.2);
|
|
106
129
|
}
|
|
107
130
|
.toastActions {
|
|
108
131
|
display: flex;
|
|
@@ -111,13 +134,68 @@
|
|
|
111
134
|
margin-right: 5px;
|
|
112
135
|
margin-bottom: 8px;
|
|
113
136
|
}
|
|
114
|
-
.toastActions
|
|
137
|
+
.toastActions .action-btn {
|
|
115
138
|
padding: 4px 12px;
|
|
116
139
|
font-size: 14px;
|
|
117
140
|
border-radius: 6px;
|
|
118
141
|
border: 1px solid;
|
|
119
142
|
cursor: pointer;
|
|
120
143
|
}
|
|
144
|
+
.toastActions .action-btn:hover {
|
|
145
|
+
opacity: 0.8;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Action button 1 */
|
|
149
|
+
.action-btnA.success {
|
|
150
|
+
color: oklab(98.193% -0.01648 0.00729);
|
|
151
|
+
border-color: oklch(63.187% 0.18673 147.227);
|
|
152
|
+
background-color: oklch(63.187% 0.18673 147.227);
|
|
153
|
+
}
|
|
154
|
+
.action-btnA.error {
|
|
155
|
+
color: oklab(93.56400000000001% 0.02943 0.0093);
|
|
156
|
+
border-color: oklch(58.305% 0.23863 28.392);
|
|
157
|
+
background-color: oklch(58.305% 0.23863 28.392);
|
|
158
|
+
}
|
|
159
|
+
.action-btnA.info {
|
|
160
|
+
color: oklab(93.192% -0.00786 -0.03071);
|
|
161
|
+
border-color: oklch(54.742% 0.24331 262.725);
|
|
162
|
+
background-color: oklch(54.742% 0.24331 262.725);
|
|
163
|
+
}
|
|
164
|
+
.action-btnA.warning {
|
|
165
|
+
color: oklab(97.962% 0.00443 0.01503);
|
|
166
|
+
border-color: oklch(68.215% 0.14645 71.468);
|
|
167
|
+
background-color: oklch(68.215% 0.14645 71.468);
|
|
168
|
+
}
|
|
169
|
+
.action-btnA.loading,
|
|
170
|
+
.action-btnA.submit {
|
|
171
|
+
color: oklab(94.33500000000001% 0.01183 -0.02594);
|
|
172
|
+
border-color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
173
|
+
background-color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
174
|
+
}
|
|
175
|
+
/* Action button 2 */
|
|
176
|
+
.action-btnB.success {
|
|
177
|
+
color: oklch(63.187% 0.18673 147.227);
|
|
178
|
+
border-color: oklch(63.187% 0.18673 147.227);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.action-btnB.error {
|
|
182
|
+
color: oklch(58.305% 0.23863 28.392);
|
|
183
|
+
border-color: oklch(58.305% 0.23863 28.392);
|
|
184
|
+
}
|
|
185
|
+
.action-btnB.info {
|
|
186
|
+
color: oklch(54.742% 0.24331 262.725);
|
|
187
|
+
border-color: oklch(54.742% 0.24331 262.725);
|
|
188
|
+
}
|
|
189
|
+
.action-btnB.warning {
|
|
190
|
+
color: oklch(68.215% 0.14645 71.468);
|
|
191
|
+
border-color: oklch(68.215% 0.14645 71.468);
|
|
192
|
+
}
|
|
193
|
+
.action-btnB.loading,
|
|
194
|
+
.action-btnB.submit {
|
|
195
|
+
color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
196
|
+
border-color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
197
|
+
}
|
|
198
|
+
|
|
121
199
|
.progress-container {
|
|
122
200
|
position: absolute;
|
|
123
201
|
bottom: 0;
|
|
@@ -143,7 +221,7 @@
|
|
|
143
221
|
}
|
|
144
222
|
.progress-container.loading,
|
|
145
223
|
.progress-container.submit {
|
|
146
|
-
background-color:
|
|
224
|
+
background-color: oklab(54.13400000000001% 0.09644 -0.22706 / 0.25);
|
|
147
225
|
}
|
|
148
226
|
|
|
149
227
|
.toast-progress {
|
|
@@ -165,32 +243,78 @@
|
|
|
165
243
|
}
|
|
166
244
|
.toast-progress.loading,
|
|
167
245
|
.toast-progress.submit {
|
|
168
|
-
background-color:
|
|
246
|
+
background-color: oklab(54.13400000000001% 0.09644 -0.22706);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Enter animate keyframes */
|
|
250
|
+
@keyframes upToDown {
|
|
251
|
+
from {
|
|
252
|
+
opacity: 0;
|
|
253
|
+
transform: translateY(-60px) scale(0.6);
|
|
254
|
+
}
|
|
255
|
+
to {
|
|
256
|
+
opacity: 1;
|
|
257
|
+
transform: translateY(0) scale(1);
|
|
258
|
+
}
|
|
169
259
|
}
|
|
170
260
|
|
|
171
261
|
@keyframes downToUp {
|
|
172
262
|
from {
|
|
173
|
-
transform: translateY(100%);
|
|
174
263
|
opacity: 0;
|
|
264
|
+
transform: translateY(60px) scale(0.6);
|
|
175
265
|
}
|
|
176
266
|
to {
|
|
177
|
-
transform: translateY(0);
|
|
178
267
|
opacity: 1;
|
|
268
|
+
transform: translateY(0) scale(1);
|
|
179
269
|
}
|
|
180
270
|
}
|
|
181
271
|
|
|
182
|
-
|
|
272
|
+
/* Exit animate keyframes */
|
|
273
|
+
@keyframes upToDownExit {
|
|
183
274
|
from {
|
|
184
|
-
|
|
275
|
+
opacity: 1;
|
|
276
|
+
transform: translateY(0) scale(1);
|
|
277
|
+
}
|
|
278
|
+
to {
|
|
185
279
|
opacity: 0;
|
|
280
|
+
transform: translateY(60px) scale(0.6);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@keyframes downToUpExit {
|
|
285
|
+
from {
|
|
286
|
+
opacity: 1;
|
|
287
|
+
transform: translateY(0) scale(1);
|
|
288
|
+
}
|
|
289
|
+
to {
|
|
290
|
+
opacity: 0;
|
|
291
|
+
transform: translateY(-60px) scale(0.6);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
@keyframes centerEnter {
|
|
296
|
+
from {
|
|
297
|
+
opacity: 0;
|
|
298
|
+
transform: scale(0.6);
|
|
186
299
|
}
|
|
187
300
|
to {
|
|
188
|
-
transform: translateY(0);
|
|
189
301
|
opacity: 1;
|
|
302
|
+
transform: scale(1);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@keyframes centerExit {
|
|
307
|
+
from {
|
|
308
|
+
opacity: 1;
|
|
309
|
+
transform: scale(1);
|
|
310
|
+
}
|
|
311
|
+
to {
|
|
312
|
+
opacity: 0;
|
|
313
|
+
transform: scale(0.6);
|
|
190
314
|
}
|
|
191
315
|
}
|
|
192
316
|
|
|
193
|
-
@media screen and (max-width:
|
|
317
|
+
@media screen and (max-width: 375px) {
|
|
194
318
|
.toastContainer.top-right,
|
|
195
319
|
.toastContainer.bottom-right {
|
|
196
320
|
right: 0px;
|