@starasia/toast 1.0.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 ADDED
@@ -0,0 +1,71 @@
1
+ # starasia toast
2
+
3
+ starasia toast is a strict and customizable toast component for web development projects, designed for simplicity and adherence to strict design guidelines.
4
+
5
+ ## Screenshots
6
+
7
+ ![App Screenshot](https://github.com/primaramadhaniputra/image/blob/main/IToast.png)
8
+
9
+ ## Package instalation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/toast
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/toast
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/toast
27
+ ```
28
+
29
+ ## Usage/Examples
30
+
31
+ ```javascript
32
+ import React from "react";
33
+ import {ToastContainer, toast} from "@starasia/toast";
34
+ import ReactDOM from "react-dom/client";
35
+
36
+ const App = () => {
37
+ const handleAddToastSuccess = () => {
38
+ toast.success("New Feature Available success");
39
+ };
40
+ const handleAddToastDefault = () => {
41
+ toast.default("New Feature Available default");
42
+ };
43
+ const handleAddToastInfo = () => {
44
+ toast.info("New Feature Available info");
45
+ };
46
+ const handleAddToastDanger = () => {
47
+ toast.danger("New Feature Available danger");
48
+ };
49
+ return (
50
+ <div>
51
+ <button onClick={handleAddToastSuccess}>success</button>
52
+ <button onClick={handleAddToastDefault}>default</button>
53
+ <button onClick={handleAddToastInfo}>info</button>
54
+ <button onClick={handleAddToastDanger}>danger</button>
55
+ <ToastContainer type="outline" direction="bottom-right" />
56
+ </div>
57
+ );
58
+ };
59
+
60
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
61
+
62
+ ```
63
+
64
+ ## Props
65
+
66
+ #### Props that you can pass to <ToastContainer {...props} />
67
+
68
+ | Prop Name | Value | required |
69
+ | :-------- | :-------------------------------------------------------- | :------- |
70
+ | type | "solid" / "outline" | false |
71
+ | direction | "bottom-right" / "bottom-left" / "top-right" / "top-left" | false |
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { IToastContainer } from "./types";
3
+ export declare const ToastContainer: React.FC<IToastContainer>;
@@ -0,0 +1,3 @@
1
+ export { ToastContainer } from "./Toast";
2
+ export { toast } from "./state";
3
+ export * from "./types";
@@ -0,0 +1,21 @@
1
+ declare class Observer {
2
+ subscribers: Array<(toast: any | any) => void>;
3
+ toasts: any[];
4
+ constructor();
5
+ subscribe: (subscriber: (toast: any | any) => void) => () => void;
6
+ publish: (data: any) => void;
7
+ addToast: (data: any) => void;
8
+ create: (data: {
9
+ message?: string;
10
+ type?: any;
11
+ }) => number;
12
+ dismiss: (id?: number | string) => string | number | undefined;
13
+ danger: (message: string) => number;
14
+ warning: (message: string) => number;
15
+ success: (message: string) => number;
16
+ info: (message: string) => number;
17
+ default: (message: string) => number;
18
+ }
19
+ export declare const ToastState: Observer;
20
+ export declare const toast: any;
21
+ export {};