@edinelsonslima/toast-notification 0.1.37 → 0.1.38
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edinelsonslima/toast-notification",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"author": "@edinelsonslima",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,24 +12,26 @@
|
|
|
12
12
|
"url": "https://github.com/edinelsonslima/toast-notification/issues"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/edinelsonslima/toast-notification#readme",
|
|
15
|
-
"main": "
|
|
16
|
-
"module": "
|
|
17
|
-
"browser": "
|
|
18
|
-
"types": "
|
|
15
|
+
"main": "index.umd.js",
|
|
16
|
+
"module": "index.umd.js",
|
|
17
|
+
"browser": "index.umd.js",
|
|
18
|
+
"types": "index.d.ts",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"types": "./
|
|
22
|
-
"import": "./
|
|
23
|
-
"require": "./
|
|
24
|
-
"browser": "./
|
|
21
|
+
"types": "./index.d.ts",
|
|
22
|
+
"import": "./index.umd.js",
|
|
23
|
+
"require": "./index.umd.js",
|
|
24
|
+
"browser": "./index.umd.js"
|
|
25
25
|
},
|
|
26
|
-
"./
|
|
27
|
-
"import": "./
|
|
28
|
-
"require": "./
|
|
26
|
+
"./style.css": {
|
|
27
|
+
"import": "./style.css",
|
|
28
|
+
"require": "./style.css"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
|
-
"
|
|
32
|
+
"index.d.ts",
|
|
33
|
+
"index.umd.js",
|
|
34
|
+
"style.css"
|
|
33
35
|
],
|
|
34
36
|
"keywords": [
|
|
35
37
|
"toast",
|
|
@@ -40,12 +42,5 @@
|
|
|
40
42
|
"publishConfig": {
|
|
41
43
|
"access": "public",
|
|
42
44
|
"registry": "https://registry.npmjs.org"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"dev": "vite",
|
|
46
|
-
"build": "tsc && vite build",
|
|
47
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
48
|
-
"prepublish": "yarn lint && yarn build",
|
|
49
|
-
"preview": "vite preview"
|
|
50
45
|
}
|
|
51
46
|
}
|
package/README.md
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<h1 align="center">Toast Notifications</h1>
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
<image src="https://github.com/edinelsonslima/lp-toast-notification/blob/main/lp.gif"/>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
## 👀 Links
|
|
8
|
-
- 🔗 [Apresentação do toast notification](https://edinelsonslima.github.io/lp-toast-notification/)
|
|
9
|
-
- 🔗 [NPM](https://www.npmjs.com/package/@edinelsonslima/toast-notification)
|
|
10
|
-
|
|
11
|
-
## ⤵️ Instalando
|
|
12
|
-
Adicionar com **yarn**
|
|
13
|
-
```
|
|
14
|
-
yarn add @edinelsonslima/toast-notification
|
|
15
|
-
```
|
|
16
|
-
Adicionar com **npm**
|
|
17
|
-
```
|
|
18
|
-
npm install @edinelsonslima/toast-notification
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 👨🏻💻 Modo de usar
|
|
22
|
-
- Adicione o componente `<ToastContainer/>` em algum lugar da sua aplicação;
|
|
23
|
-
- Importe os estilos css de `import '@edinelsonslima/toast-notification/dist/style.css'`;
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { ToastContainer } from '@edinelsonslima/toast-notification';
|
|
27
|
-
import '@edinelsonslima/toast-notification/dist/style.css';
|
|
28
|
-
|
|
29
|
-
export default function App(){
|
|
30
|
-
//seu código
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<ToastContainer />
|
|
35
|
-
</>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- Disparando os toast com a função `toast` de dentro do `@edinelsonslima/toast-notification`
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
import { toast } from '@edinelsonslima/toast-notification';
|
|
44
|
-
|
|
45
|
-
export default function MyComponent(){
|
|
46
|
-
//seu código
|
|
47
|
-
|
|
48
|
-
const exampleToast = () => {
|
|
49
|
-
toast.success({ content: "Mensagem de exemplo" })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
//seu código
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## 🧐 Informações adicionais
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
#### O que é disponível com o pacote
|
|
62
|
-
| função | propriedades |
|
|
63
|
-
|--------------------|------------------------------------------------------------|
|
|
64
|
-
| ToastContainer | `classNames` `position` `defaultDuration` |
|
|
65
|
-
| toast | `content` `type` `duration` |
|
|
66
|
-
| style | `/dist/style.css` |
|
|
67
|
-
|
|
68
|
-
#### As propriedades da função toast
|
|
69
|
-
|propriedade | toast |
|
|
70
|
-
|--------------------|----------------------------------------------------------- |
|
|
71
|
-
| content | A conteúdo que aparecerá dentro do toast |
|
|
72
|
-
| type | Define o tipo de toast que é para aparecer |
|
|
73
|
-
| duration | O tempo que o toast irá permanecer em tela |
|
|
74
|
-
|
|
75
|
-
#### As propriedades do componente ToastContainer
|
|
76
|
-
|propriedade | ToastContainer |
|
|
77
|
-
|--------------------|----------------------------------------------------------- |
|
|
78
|
-
| classNames | Um objeto de **chave:valor** onde a chave é o tipo de toast e o valor pode ser uma string (classNames) ou um objeto (CSSProperties) |
|
|
79
|
-
| position | Define em qual parte da tela irá aparecer a toast notification, existe valores predefinidos |
|
|
80
|
-
| defaultDuration | Define tempo padrão de duração de todas as toast |
|
|
81
|
-
|
|
82
|
-
#### Mais detalhes sobre as propriedades
|
|
83
|
-
| propriedade |tipo | é obrigatório | padrão |
|
|
84
|
-
|-----------------|---------|-----------------|-------------|
|
|
85
|
-
| content |ReactNode| sim | - |
|
|
86
|
-
| type |string | sim | - |
|
|
87
|
-
| duration |number | não | 7_0000 |
|
|
88
|
-
| defaultDuration |number | não | - |
|
|
89
|
-
| classNames |object | não | undefined |
|
|
90
|
-
| position |string | não | right-top |
|
|
91
|
-
|
|
92
|
-
ℹ️ O `duration` e `defaultDuration` estão em ms (milissegundos)
|
|
93
|
-
|
|
94
|
-
ℹ️ A função `toast` pode ser chamada de algumas formas, veja os exemplos a seguir:
|
|
95
|
-
|
|
96
|
-
caso seja chamada direta, será obrigatório informa o **type**
|
|
97
|
-
```ts
|
|
98
|
-
toast({ content: "mensagem exemplo", type: "info", duration: 1000 * 4 })
|
|
99
|
-
```
|
|
100
|
-
ou pode acessar o tipo do toast diretamente, assim omitindo ele do objeto enviado
|
|
101
|
-
```ts
|
|
102
|
-
toast.info({ content: "mensagem exemplo", durantino: 1000 * 4 })
|
|
103
|
-
```
|
|
104
|
-
```ts
|
|
105
|
-
toast.info('mensagem exemplo')
|
|
106
|
-
```
|
|
107
|
-
```tsx
|
|
108
|
-
toast.info(<strong>mensagem exemplo</strong>)
|
|
109
|
-
```
|
|
110
|
-
```tsx
|
|
111
|
-
toast.info(<MeuComponente>mensagem exemplo</MeuComponente>)
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|