@risalabs_frontend_org/oasis-ui-kit 0.2.0 → 0.4.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 +29 -13
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/button/button.d.ts +1 -0
- package/dist/src/components/toast/toast.d.ts +5 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -338,21 +338,37 @@ closeModal('myModal');
|
|
|
338
338
|
```
|
|
339
339
|
|
|
340
340
|
#### `Toast`
|
|
341
|
-
Notification toast for success/error messages.
|
|
341
|
+
Notification toast for success/error messages. Uses a simple imperative API.
|
|
342
342
|
|
|
343
343
|
```tsx
|
|
344
|
-
import {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
344
|
+
import { ToastContainer, toast } from '@risalabs_frontend_org/oasis-ui-kit';
|
|
345
|
+
|
|
346
|
+
// 1. Add ToastContainer once in your app root (e.g., App.tsx)
|
|
347
|
+
function App() {
|
|
348
|
+
return (
|
|
349
|
+
<>
|
|
350
|
+
<ToastContainer />
|
|
351
|
+
{/* rest of your app */}
|
|
352
|
+
</>
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// 2. Call toast.success or toast.error anywhere in your app
|
|
357
|
+
toast.success("Changes saved!");
|
|
358
|
+
toast.error("Something went wrong");
|
|
359
|
+
|
|
360
|
+
// With optional header
|
|
361
|
+
toast.success("Your file has been uploaded", "Upload Complete");
|
|
362
|
+
|
|
363
|
+
// With custom duration (default: 3000ms)
|
|
364
|
+
toast.error("Connection failed", "Network Error", 5000);
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**API:**
|
|
368
|
+
| Method | Parameters | Description |
|
|
369
|
+
|--------|------------|-------------|
|
|
370
|
+
| `toast.success(message, header?, duration?)` | `message: string`, `header?: string`, `duration?: number` | Show success toast |
|
|
371
|
+
| `toast.error(message, header?, duration?)` | `message: string`, `header?: string`, `duration?: number` | Show error toast |
|
|
356
372
|
|
|
357
373
|
#### `InfoIconWithTooltip`
|
|
358
374
|
An info icon with popover tooltip.
|