@liguelead/design-system 0.0.12 → 0.0.14
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/components/RequiredAsterisk/RequiredAsterisk.style.ts +1 -1
- package/components/Toaster/Toaster.style.ts +100 -0
- package/components/Toaster/Toaster.ts +26 -0
- package/components/Toaster/ToasterProvider.tsx +10 -0
- package/components/Toaster/index.ts +2 -0
- package/components/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { parseColor } from '../../utils'
|
|
3
|
+
import { ToastContainer } from 'react-toastify'
|
|
4
|
+
|
|
5
|
+
export const ToasterStyledContainer = styled(ToastContainer)`
|
|
6
|
+
${({ theme }) => css`
|
|
7
|
+
|
|
8
|
+
/* Colored Theme */
|
|
9
|
+
|
|
10
|
+
.Toastify__toast-theme--colored.Toastify__toast--success {
|
|
11
|
+
background-color: ${parseColor(theme.colors?.success100)};
|
|
12
|
+
color: ${parseColor(theme.colors?.textLight)};
|
|
13
|
+
|
|
14
|
+
.Toastify__progress-bar-theme--colored {
|
|
15
|
+
background: ${parseColor(theme.colors?.success50)};
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.Toastify__toast-theme--colored.Toastify__toast--error {
|
|
21
|
+
background-color: ${parseColor(theme.colors?.danger200)};
|
|
22
|
+
color: ${parseColor(theme.colors?.textLight)};
|
|
23
|
+
|
|
24
|
+
.Toastify__progress-bar-theme--colored {
|
|
25
|
+
background: ${parseColor(theme.colors?.danger50)};
|
|
26
|
+
opacity: 0.5;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.Toastify__toast-theme--colored.Toastify__toast--warning {
|
|
31
|
+
background-color: ${parseColor(theme.colors?.warning100)};
|
|
32
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
33
|
+
|
|
34
|
+
.Toastify__progress-bar-theme--colored {
|
|
35
|
+
background: ${parseColor(theme.colors?.warning50)};
|
|
36
|
+
opacity: 0.5;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Toastify__toast-theme--colored.Toastify__toast--info {
|
|
41
|
+
background-color: ${parseColor(theme.colors?.info100)};
|
|
42
|
+
color: ${parseColor(theme.colors?.textLight)};
|
|
43
|
+
|
|
44
|
+
.Toastify__progress-bar-theme--colored {
|
|
45
|
+
background: ${parseColor(theme.colors?.info50)};
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Light Theme */
|
|
51
|
+
|
|
52
|
+
.Toastify__toast-theme--light.Toastify__toast--success {
|
|
53
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
54
|
+
|
|
55
|
+
.Toastify__toast-icon {
|
|
56
|
+
color: ${parseColor(theme.colors?.success100)};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.Toastify__progress-bar-theme--light {
|
|
60
|
+
background: ${parseColor(theme.colors?.success100)};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.Toastify__toast-theme--light.Toastify__toast--error {
|
|
65
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
66
|
+
|
|
67
|
+
.Toastify__toast-icon {
|
|
68
|
+
color: ${parseColor(theme.colors?.danger200)};
|
|
69
|
+
}
|
|
70
|
+
.Toastify__progress-bar-theme--light {
|
|
71
|
+
background: ${parseColor(theme.colors?.danger200)};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.Toastify__toast-theme--light.Toastify__toast--warning {
|
|
76
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
77
|
+
|
|
78
|
+
.Toastify__toast-icon {
|
|
79
|
+
color: ${parseColor(theme.colors?.warning100)};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.Toastify__progress-bar-theme--light {
|
|
83
|
+
background: ${parseColor(theme.colors?.warning100)};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.Toastify__toast-theme--light.Toastify__toast--info {
|
|
88
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
89
|
+
|
|
90
|
+
.Toastify__toast-icon {
|
|
91
|
+
color: ${parseColor(theme.colors?.info100)};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.Toastify__progress-bar-theme--light {
|
|
95
|
+
background: ${parseColor(theme.colors?.info100)};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
`}
|
|
100
|
+
`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { toast, ToastOptions } from "react-toastify"
|
|
2
|
+
|
|
3
|
+
const defaultOptions: ToastOptions = {
|
|
4
|
+
position: 'top-right',
|
|
5
|
+
hideProgressBar: false,
|
|
6
|
+
closeOnClick: true,
|
|
7
|
+
pauseOnHover: true,
|
|
8
|
+
draggable: true,
|
|
9
|
+
theme: 'light'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Toaster = {
|
|
13
|
+
success: (message: string, options?: ToastOptions) =>
|
|
14
|
+
toast.success(message, { ...defaultOptions, ...options }),
|
|
15
|
+
|
|
16
|
+
error: (message: string, options?: ToastOptions) =>
|
|
17
|
+
toast.error(message, { ...defaultOptions, ...options }),
|
|
18
|
+
|
|
19
|
+
warning: (message: string, options?: ToastOptions) =>
|
|
20
|
+
toast.warning(message, { ...defaultOptions, ...options }),
|
|
21
|
+
|
|
22
|
+
info: (message: string, options?: ToastOptions) =>
|
|
23
|
+
toast.info(message, { ...defaultOptions, ...options })
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default Toaster;
|
package/components/index.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { default as Select } from './Select'
|
|
|
12
12
|
export { default as SegmentedButton } from './SegmentedButton'
|
|
13
13
|
export { default as LinkButton } from './LinkButton'
|
|
14
14
|
export { default as RadioButton } from './RadioButton'
|
|
15
|
+
export { ToastProvider, Toaster } from './Toaster'
|