@xsolla/xui-toast 0.96.0 → 0.97.0
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 +51 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @xsolla/xui-toast
|
|
2
|
+
|
|
3
|
+
Brief auto-dismissing notifications with success, info, warning, and error variants.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @xsolla/xui-toast
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { ToastProvider, useToast } from '@xsolla/xui-toast';
|
|
15
|
+
|
|
16
|
+
const Demo = () => {
|
|
17
|
+
const toast = useToast();
|
|
18
|
+
return <button onClick={() => toast.success('Saved!')}>Save</button>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const App = () => (
|
|
22
|
+
<ToastProvider position="top">
|
|
23
|
+
<Demo />
|
|
24
|
+
</ToastProvider>
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Components
|
|
29
|
+
|
|
30
|
+
- `ToastProvider` — required context provider; renders the toast container
|
|
31
|
+
- `useToast` — hook with `success`, `info`, `warning`, `error`, `toast`, `dismiss`, `dismissAll`
|
|
32
|
+
- `Toast` — individual toast item (used internally; rarely needed directly)
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
### ToastProvider
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Description |
|
|
39
|
+
|------|------|---------|-------------|
|
|
40
|
+
| `position` | `"top" \| "bottom"` | `"top"` | Vertical position of the toast stack |
|
|
41
|
+
| `defaultDuration` | `number` | `5000` | Auto-dismiss delay in ms; `0` disables auto-dismiss |
|
|
42
|
+
|
|
43
|
+
### Toast
|
|
44
|
+
|
|
45
|
+
| Prop | Type | Default | Description |
|
|
46
|
+
|------|------|---------|-------------|
|
|
47
|
+
| `id` | `string` | — | Unique identifier |
|
|
48
|
+
| `message` | `string` | — | Text to display |
|
|
49
|
+
| `variant` | `"success" \| "info" \| "warning" \| "error"` | — | Visual style |
|
|
50
|
+
| `icon` | `ReactNode` | — | Custom leading icon |
|
|
51
|
+
| `onClose` | `() => void` | — | Called when the close button is pressed |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-toast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"test:coverage": "vitest run --coverage"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@xsolla/xui-core": "0.
|
|
18
|
-
"@xsolla/xui-icons": "0.
|
|
19
|
-
"@xsolla/xui-primitives-core": "0.
|
|
17
|
+
"@xsolla/xui-core": "0.97.0",
|
|
18
|
+
"@xsolla/xui-icons": "0.97.0",
|
|
19
|
+
"@xsolla/xui-primitives-core": "0.97.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react": ">=16.8.0",
|