d9-toast 1.4.27 → 1.4.29
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 +6 -1
- package/dist/Icons.js +8 -3
- package/dist/Toast.js +2 -0
- package/dist/ToastContext.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,11 +94,12 @@ function MyComponent() {
|
|
|
94
94
|
### `useToast()`
|
|
95
95
|
|
|
96
96
|
```ts
|
|
97
|
-
const { showToast, removeToast, removeToastAll } = useToast();
|
|
97
|
+
const { sounds, showToast, removeToast, removeToastAll } = useToast();
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
| Method | Description |
|
|
101
101
|
| -------------------- | --------------------------------- |
|
|
102
|
+
| `sounds` | Available toast sounds `"success" \| "error" \| "info" \| "warning"` |
|
|
102
103
|
| `showToast(options)` | Show a toast and returns its `id` |
|
|
103
104
|
| `removeToast(id)` | Remove toast by ID |
|
|
104
105
|
| `removeToastAll()` | Clear all toasts |
|
|
@@ -139,6 +140,7 @@ actions?: {
|
|
|
139
140
|
**Example**
|
|
140
141
|
|
|
141
142
|
```jsx
|
|
143
|
+
|
|
142
144
|
showToast({
|
|
143
145
|
message: "File uploaded",
|
|
144
146
|
actions: [
|
|
@@ -168,6 +170,8 @@ audio?: {
|
|
|
168
170
|
### Example
|
|
169
171
|
|
|
170
172
|
```jsx
|
|
173
|
+
const { sounds, showToast } = useToast();
|
|
174
|
+
|
|
171
175
|
showToast({
|
|
172
176
|
message: "Message sent",
|
|
173
177
|
type: "success",
|
|
@@ -175,6 +179,7 @@ showToast({
|
|
|
175
179
|
enabled: true,
|
|
176
180
|
volume: 0.8,
|
|
177
181
|
cooldown: 500,
|
|
182
|
+
audioFile: sounds.success,
|
|
178
183
|
},
|
|
179
184
|
});
|
|
180
185
|
```
|
package/dist/Icons.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { memo } from "react";
|
|
1
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
5
|
var Icons = function Icons(_ref) {
|
|
6
|
+
var _icons$name;
|
|
3
7
|
var name = _ref.name,
|
|
4
|
-
className = _ref.className
|
|
8
|
+
_ref$className = _ref.className,
|
|
9
|
+
className = _ref$className === void 0 ? " " : _ref$className;
|
|
5
10
|
var icons = {
|
|
6
11
|
success: /*#__PURE__*/_jsx("svg", {
|
|
7
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -199,6 +204,6 @@ var Icons = function Icons(_ref) {
|
|
|
199
204
|
})
|
|
200
205
|
})
|
|
201
206
|
};
|
|
202
|
-
return icons[name];
|
|
207
|
+
return (_icons$name = icons[name]) !== null && _icons$name !== void 0 ? _icons$name : null;
|
|
203
208
|
};
|
|
204
|
-
export default Icons;
|
|
209
|
+
export default /*#__PURE__*/memo(Icons);
|
package/dist/Toast.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
package/dist/ToastContext.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
4
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|