makki-toast 1.2.1 → 2.0.9

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 CHANGED
@@ -1,111 +1,193 @@
1
- <a href="https://danieljimenezc.github.io/makki-toast/MakkiHeader.png"><img alt="makki toast - Try it" src="https://danieljimenezc.github.io/makki-toast/MakkiHeader.png"/></a>
2
- <div align="center">
3
- <img src="https://badgen.net/npm/v/makki-toast" alt="NPM Version" />
4
- <img src="https://img.shields.io/bundlephobia/minzip/makki-toast" alt="Minzip size"/>
5
- <img src="https://img.shields.io/npm/dt/makki-toast" alt="Download" />
6
- <img src="https://img.shields.io/github/license/DanielJimenezC/makki-toast-package" alt="Licence" />
7
-
8
- </div>
9
- <br />
10
- <div align="center">
11
- <strong>Creative makki toast.</strong>
12
- </div>
13
- <div align="center">Easy to use, customizable & compatible with dark mode.</div>
14
- <br />
15
- <div align="center">
16
- <a href="https://danieljimenezc.github.io/makki-toast/">Website</a>
17
- <span> · </span>
18
- <a href="https://danieljimenezc.github.io/makki-toast/#/docs">Documentation</a>
19
- </div>
20
- <br />
21
- <div align="center">
22
- <sub>Build by <a href="https://daniel-jimenez.tech">Daniel Jimenez</a></sub>
23
- </div>
24
- <br />
25
-
26
- ## Features
27
-
28
- - **Easy to use**
29
- - **Customizable**
30
- - **Dark mode**
31
- - **Lightweight**
32
- - **Accessible**
33
-
34
- ## Installation
35
-
36
- #### With NPM
37
-
38
- ```sh
39
- npm install makki-toast@latest
40
- ```
41
- ## Getting Started
42
-
43
- Add the makki toast and it will take care of render the alerts.
44
- #### Import Makki Toast
45
- ```jsx
46
- import { Toast } from 'makki-toast'
47
- ```
48
-
49
- #### Info
50
- ```jsx
51
- const toast = new Toast()
52
-
53
- const handleToast = () => {
54
- toast.info('Simple text', false)
55
- }
56
- ```
57
-
58
- #### Success
59
- ```jsx
60
- const toast = new Toast()
61
-
62
- const handleToast = () => {
63
- toast.success('Simple text', false)
64
- }
65
- ```
66
-
67
- #### Warning
68
- ```jsx
69
- const toast = new Toast()
70
-
71
- const handleToast = () => {
72
- toast.warning('Simple text', false)
73
- }
74
- ```
75
-
76
- #### Danger
77
- ```jsx
78
- const toast = new Toast()
79
-
80
- const handleToast = () => {
81
- toast.danger('Simple text', false)
82
- }
83
- ```
84
-
85
- #### Custom
86
- ```jsx
87
- import { Toast } from 'makki-toast'
88
-
89
- const App = () => {
90
- const toast = new Toast()
91
-
92
- const handleToast = () => {
93
- toast.show({
94
- autoClose: 5000,
95
- darkMode: false,
96
- message: 'Simple text',
97
- position: 'top-right'
98
- })
99
- }
100
-
101
- return (
102
- <div>
103
- <button onClick={handleToast}>Show Makki Toast</button>
104
- </div>
105
- )
106
- }
107
- ```
108
-
109
- ## Documentation
110
-
111
- Find the full documentation on [official documentation](https://danieljimenezc.github.io/makki-toast/#/docs)
1
+ <a href="https://danieljimenezc.github.io/makki-toast/MakkiHeader.png"><img alt="makki toast - Try it" src="https://danieljimenezc.github.io/makki-toast/MakkiHeader.png"/></a>
2
+ <div align="center">
3
+ <img src="https://img.shields.io/npm/v/makki-toast" alt="NPM Version" />
4
+ <img src="https://img.shields.io/bundlephobia/minzip/makki-toast" alt="Minzip size"/>
5
+ <img src="https://img.shields.io/npm/dt/makki-toast" alt="Download" />
6
+ <img src="https://img.shields.io/github/license/DanielJimenezC/makki-toast-package" alt="Licence" />
7
+
8
+ </div>
9
+ <br />
10
+ <div align="center">
11
+ <strong>Creative makki toast.</strong>
12
+ </div>
13
+ <div align="center">Easy to use, customizable & support promise</div>
14
+ <br />
15
+ <div align="center">
16
+ <a href="https://danieljimenezc.github.io/makki-toast/">Website</a>
17
+ <span> · </span>
18
+ <a href="https://danieljimenezc.github.io/makki-toast/docs">Documentation</a>
19
+ </div>
20
+ <br />
21
+ <div align="center">
22
+ <sub>Build by <a href="https://github.com/DanielJimenezC">Daniel Jimenez</a></sub>
23
+ </div>
24
+ <br />
25
+
26
+ ## Features
27
+
28
+ - **Easy to use**
29
+ - **Customizable**
30
+ - **Dark mode**
31
+ - **Lightweight**
32
+ - **Accessible**
33
+
34
+ ## Installation
35
+
36
+ #### With NPM
37
+
38
+ ```sh
39
+ npm install makki-toast@latest
40
+ ```
41
+ ## Getting Started
42
+
43
+ Add the makki toast and it will take care of render the alerts. From version 2.0.0 it's for Angular 21
44
+
45
+ #### Import Makki Toast in app.ts
46
+ ```jsx
47
+ import { Component } from '@angular/core'
48
+ import { RouterOutlet } from '@angular/router'
49
+ import { ToasterComponent } from 'makki-toast'
50
+
51
+ @Component({
52
+ selector: 'app-root',
53
+ standalone: true,
54
+ imports: [RouterOutlet, ToasterComponent],
55
+ templateUrl: './app.html',
56
+ styleUrl: './app.css'
57
+ })
58
+ export class App {
59
+ constructor() {}
60
+ }
61
+ ```
62
+
63
+ #### Import Makki Toast in app.html
64
+ ```jsx
65
+ <app-toaster></app-toaster>
66
+ <router-outlet></router-outlet>
67
+ ```
68
+
69
+ #### Import Makki Toast in Component
70
+ ```jsx
71
+ import { ToastService } from 'makki-toast'
72
+
73
+ constructor(
74
+ private readonly toast: ToastService,
75
+ ) {}
76
+ ```
77
+
78
+ #### Info
79
+ ```jsx
80
+ this.toast.info({
81
+ title: 'Info toast',
82
+ description: 'Info toast message',
83
+ });
84
+ ```
85
+
86
+ #### Success
87
+ ```jsx
88
+ this.toast.success({
89
+ title: 'Success toast',
90
+ description: 'Success toast message'
91
+ });
92
+ ```
93
+
94
+ #### Warning
95
+ ```jsx
96
+ this.toast.warning({
97
+ title: 'Warning toast',
98
+ description: 'Warning toast message'
99
+ });
100
+ ```
101
+
102
+ #### Error
103
+ ```jsx
104
+ this.toast.error({
105
+ title: 'Error toast',
106
+ description: 'Error toast message'
107
+ });
108
+ ```
109
+
110
+ #### Action
111
+ ```jsx
112
+ this.toast.action({
113
+ title: 'Action toast',
114
+ description: 'Action toast message',
115
+ button: {
116
+ title: 'View Details',
117
+ onClick: () => console.log('show')
118
+ },
119
+ });
120
+ ```
121
+
122
+ #### Promise
123
+ ```jsx
124
+ this.toast.promise(
125
+ fetchData(),
126
+ {
127
+ loading: {
128
+ title: 'Loading...',
129
+ },
130
+ success: (data) => ({
131
+ title: 'Complete',
132
+ description: 'promise complete message'
133
+ }),
134
+ error: (err) => ({
135
+ title: 'Error',
136
+ description: err.message
137
+ })
138
+ }
139
+ );
140
+ ```
141
+
142
+ #### Component in description without data
143
+ ```jsx
144
+ this.toast.promise(
145
+ fetchData(),
146
+ {
147
+ loading: {
148
+ title: 'Loading...',
149
+ },
150
+ success: (data) => ({
151
+ title: 'Complete',
152
+ description: DataComponent
153
+ }),
154
+ error: (err) => ({
155
+ title: 'Error',
156
+ description: err.message
157
+ })
158
+ }
159
+ );
160
+ ```
161
+
162
+ #### Component in description with share data
163
+ ```jsx
164
+ this.toast.promise(
165
+ fetchData(),
166
+ {
167
+ loading: {
168
+ title: 'Loading...',
169
+ },
170
+ success: (data) => ({
171
+ title: 'Complete',
172
+ description: {
173
+ component: DataComponent,
174
+ inputs: {
175
+ data: data
176
+ }
177
+ }
178
+ }),
179
+ error: (err) => ({
180
+ title: 'Error',
181
+ description: err.message
182
+ })
183
+ }
184
+ );
185
+
186
+ export class DataComponent {
187
+ @Input() data!: any;
188
+ }
189
+ ```
190
+
191
+ ## Documentation
192
+
193
+ Find the full documentation on [official documentation](https://danieljimenezc.github.io/makki-toast/docs)