@livechat/design-system-react-components 1.0.0-alpha.4 → 1.0.0-alpha.7
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/dist/dsrc.cjs.js +1 -0
- package/dist/dsrc.es.js +2213 -0
- package/dist/dsrc.umd.js +1 -0
- package/dist/src/components/Alert/Alert.d.ts +19 -0
- package/{src/components/Alert/index.ts → dist/src/components/Alert/index.d.ts} +0 -0
- package/dist/src/components/Badge/Badge.d.ts +5 -0
- package/{src/components/Badge/index.ts → dist/src/components/Badge/index.d.ts} +0 -0
- package/dist/src/components/Button/Button.d.ts +13 -0
- package/{src/components/Button/index.ts → dist/src/components/Button/index.d.ts} +0 -0
- package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +11 -0
- package/{src/components/ButtonGroup/index.ts → dist/src/components/ButtonGroup/index.d.ts} +0 -0
- package/dist/src/components/Card/Card.d.ts +6 -0
- package/{src/components/Card/index.ts → dist/src/components/Card/index.d.ts} +0 -0
- package/dist/src/components/Checkbox/Checkbox.d.ts +7 -0
- package/dist/src/components/Checkbox/CheckboxField.d.ts +7 -0
- package/{src/components/Checkbox/index.ts → dist/src/components/Checkbox/index.d.ts} +0 -0
- package/dist/src/components/FieldDescription/FieldDescription.d.ts +3 -0
- package/{src/components/FieldDescription/index.ts → dist/src/components/FieldDescription/index.d.ts} +0 -0
- package/dist/src/components/FieldError/FieldError.d.ts +3 -0
- package/{src/components/FieldError/index.ts → dist/src/components/FieldError/index.d.ts} +0 -0
- package/dist/src/components/FieldGroup/FieldGroup.d.ts +8 -0
- package/{src/components/FieldGroup/index.ts → dist/src/components/FieldGroup/index.d.ts} +0 -0
- package/dist/src/components/Form/Form.d.ts +7 -0
- package/{src/components/Form/index.ts → dist/src/components/Form/index.d.ts} +0 -0
- package/dist/src/components/FormGroup/FormGroup.d.ts +7 -0
- package/{src/components/FormGroup/index.ts → dist/src/components/FormGroup/index.d.ts} +0 -0
- package/dist/src/components/Icon/Icon.d.ts +70 -0
- package/{src/components/Icon/index.ts → dist/src/components/Icon/index.d.ts} +0 -0
- package/dist/src/components/InputField/InputField.d.ts +15 -0
- package/{src/components/InputField/index.ts → dist/src/components/InputField/index.d.ts} +0 -0
- package/{src/components/Link/Link.tsx → dist/src/components/Link/Link.d.ts} +3 -26
- package/{src/components/Link/index.ts → dist/src/components/Link/index.d.ts} +0 -0
- package/dist/src/components/Loader/Loader.d.ts +10 -0
- package/{src/components/Loader/index.ts → dist/src/components/Loader/index.d.ts} +0 -0
- package/dist/src/components/Modal/ActionModal.d.ts +8 -0
- package/dist/src/components/Modal/Modal.d.ts +7 -0
- package/dist/src/components/Modal/ModalBase.d.ts +6 -0
- package/dist/src/components/Modal/ModalCloseButton.d.ts +3 -0
- package/dist/src/components/Modal/ModalPortal.d.ts +7 -0
- package/{src/components/Modal/index.ts → dist/src/components/Modal/index.d.ts} +0 -1
- package/dist/src/components/NumericInput/NumericInput.d.ts +14 -0
- package/dist/src/components/NumericInput/NumericInputField.d.ts +19 -0
- package/{src/components/NumericInput/index.ts → dist/src/components/NumericInput/index.d.ts} +0 -0
- package/dist/src/components/Popover/Popover.d.ts +15 -0
- package/{src/components/Popover/index.ts → dist/src/components/Popover/index.d.ts} +0 -0
- package/dist/src/components/Progress/ProgressCircle.d.ts +9 -0
- package/dist/src/components/Progress/constants.d.ts +12 -0
- package/dist/src/components/Progress/helpers.d.ts +3 -0
- package/{src/components/Progress/index.ts → dist/src/components/Progress/index.d.ts} +0 -0
- package/dist/src/components/PromoBanner/PromoBanner.d.ts +19 -0
- package/{src/components/PromoBanner/index.ts → dist/src/components/PromoBanner/index.d.ts} +0 -0
- package/dist/src/components/RadioButton/RadioButton.d.ts +7 -0
- package/{src/components/RadioButton/index.ts → dist/src/components/RadioButton/index.d.ts} +0 -0
- package/dist/src/components/Switch/Switch.d.ts +20 -0
- package/{src/components/Switch/index.ts → dist/src/components/Switch/index.d.ts} +0 -0
- package/dist/src/components/Tab/Tab.d.ts +12 -0
- package/dist/src/components/Tab/TabsWrapper.d.ts +3 -0
- package/{src/components/Tab/index.ts → dist/src/components/Tab/index.d.ts} +0 -0
- package/dist/src/components/Tag/Tag.d.ts +12 -0
- package/{src/components/Tag/index.ts → dist/src/components/Tag/index.d.ts} +0 -0
- package/dist/src/components/TagInput/EditableTag.d.ts +11 -0
- package/dist/src/components/TagInput/EditableTagContent.d.ts +11 -0
- package/dist/src/components/TagInput/EmailTagInput.d.ts +5 -0
- package/dist/src/components/TagInput/TagInput.d.ts +12 -0
- package/{src/components/TagInput/index.ts → dist/src/components/TagInput/index.d.ts} +0 -0
- package/dist/src/components/TextField/TextField.d.ts +13 -0
- package/{src/components/TextField/index.ts → dist/src/components/TextField/index.d.ts} +0 -0
- package/dist/src/components/Toast/Toast.d.ts +22 -0
- package/dist/src/components/Toast/ToastWrapper.d.ts +27 -0
- package/{src/components/Toast/index.ts → dist/src/components/Toast/index.d.ts} +0 -0
- package/dist/src/components/Typography/Heading.d.ts +11 -0
- package/dist/src/components/Typography/Text.d.ts +15 -0
- package/{src/components/Typography/index.ts → dist/src/components/Typography/index.d.ts} +0 -0
- package/{src/index.ts → dist/src/index.d.ts} +0 -3
- package/dist/src/themes/designTokens.d.ts +126 -0
- package/dist/src/utils/keyCodes.d.ts +12 -0
- package/dist/src/utils/noop.d.ts +1 -0
- package/{src → dist/src}/vite-env.d.ts +0 -0
- package/dist/style.css +1 -0
- package/{src/themes/dark.scss → dist/themes/dark.css} +2 -0
- package/dist/themes/dark.css.map +1 -0
- package/{src/themes/legacy.scss → dist/themes/legacy.css} +2 -0
- package/dist/themes/legacy.css.map +1 -0
- package/{src/themes/light.scss → dist/themes/light.css} +2 -0
- package/dist/themes/light.css.map +1 -0
- package/package.json +8 -5
- package/.eslintrc +0 -9
- package/.storybook/main.js +0 -20
- package/.storybook/preview-head.html +0 -31
- package/.storybook/preview.js +0 -21
- package/src/components/Alert/Alert.module.scss +0 -88
- package/src/components/Alert/Alert.spec.tsx +0 -78
- package/src/components/Alert/Alert.stories.tsx +0 -73
- package/src/components/Alert/Alert.tsx +0 -94
- package/src/components/Badge/Badge.module.scss +0 -23
- package/src/components/Badge/Badge.spec.tsx +0 -12
- package/src/components/Badge/Badge.stories.tsx +0 -24
- package/src/components/Badge/Badge.tsx +0 -24
- package/src/components/Button/Button.module.scss +0 -257
- package/src/components/Button/Button.spec.tsx +0 -110
- package/src/components/Button/Button.stories.tsx +0 -152
- package/src/components/Button/Button.tsx +0 -88
- package/src/components/ButtonGroup/ButtonGroup.module.scss +0 -31
- package/src/components/ButtonGroup/ButtonGroup.spec.tsx +0 -61
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -53
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -75
- package/src/components/Card/Card.module.scss +0 -31
- package/src/components/Card/Card.spec.tsx +0 -38
- package/src/components/Card/Card.stories.tsx +0 -30
- package/src/components/Card/Card.tsx +0 -34
- package/src/components/Checkbox/Checkbox.module.scss +0 -99
- package/src/components/Checkbox/Checkbox.tsx +0 -39
- package/src/components/Checkbox/CheckboxField.spec.tsx +0 -58
- package/src/components/Checkbox/CheckboxField.stories.tsx +0 -30
- package/src/components/Checkbox/CheckboxField.tsx +0 -46
- package/src/components/FieldDescription/FieldDescription.module.scss +0 -5
- package/src/components/FieldDescription/FieldDescription.tsx +0 -23
- package/src/components/FieldError/FieldError.module.scss +0 -5
- package/src/components/FieldError/FieldError.tsx +0 -23
- package/src/components/FieldGroup/FieldGroup.module.scss +0 -25
- package/src/components/FieldGroup/FieldGroup.spec.tsx +0 -42
- package/src/components/FieldGroup/FieldGroup.stories.tsx +0 -34
- package/src/components/FieldGroup/FieldGroup.tsx +0 -38
- package/src/components/Form/Form.module.scss +0 -22
- package/src/components/Form/Form.spec.tsx +0 -38
- package/src/components/Form/Form.stories.tsx +0 -42
- package/src/components/Form/Form.tsx +0 -46
- package/src/components/FormGroup/FormGroup.module.scss +0 -20
- package/src/components/FormGroup/FormGroup.spec.tsx +0 -34
- package/src/components/FormGroup/FormGroup.stories.tsx +0 -30
- package/src/components/FormGroup/FormGroup.tsx +0 -44
- package/src/components/Icon/Icon.module.scss +0 -70
- package/src/components/Icon/Icon.stories.tsx +0 -53
- package/src/components/Icon/Icon.tsx +0 -118
- package/src/components/InputField/InputField.module.scss +0 -37
- package/src/components/InputField/InputField.spec.tsx +0 -53
- package/src/components/InputField/InputField.stories.tsx +0 -73
- package/src/components/InputField/InputField.tsx +0 -72
- package/src/components/Link/Link.module.scss +0 -18
- package/src/components/Link/Link.stories.tsx +0 -17
- package/src/components/Loader/Loader.module.scss +0 -66
- package/src/components/Loader/Loader.spec.tsx +0 -64
- package/src/components/Loader/Loader.stories.tsx +0 -25
- package/src/components/Loader/Loader.tsx +0 -48
- package/src/components/Modal/ActionModal.tsx +0 -37
- package/src/components/Modal/Modal.module.scss +0 -131
- package/src/components/Modal/Modal.stories.tsx +0 -85
- package/src/components/Modal/Modal.tsx +0 -41
- package/src/components/Modal/ModalBase.spec.tsx +0 -58
- package/src/components/Modal/ModalBase.tsx +0 -66
- package/src/components/Modal/ModalCloseButton.tsx +0 -20
- package/src/components/Modal/ModalPortal.tsx +0 -35
- package/src/components/NumericInput/NumericInput.module.scss +0 -110
- package/src/components/NumericInput/NumericInput.spec.tsx +0 -129
- package/src/components/NumericInput/NumericInput.stories.tsx +0 -56
- package/src/components/NumericInput/NumericInput.tsx +0 -161
- package/src/components/NumericInput/NumericInputField.stories.tsx +0 -58
- package/src/components/NumericInput/NumericInputField.tsx +0 -57
- package/src/components/Popover/Popover.module.scss +0 -16
- package/src/components/Popover/Popover.spec.tsx +0 -39
- package/src/components/Popover/Popover.stories.css +0 -23
- package/src/components/Popover/Popover.stories.tsx +0 -164
- package/src/components/Popover/Popover.tsx +0 -124
- package/src/components/Progress/ProgressBar.module.scss +0 -48
- package/src/components/Progress/ProgressBar.spec.tsx +0 -33
- package/src/components/Progress/ProgressBar.stories.tsx +0 -23
- package/src/components/Progress/ProgressBar.tsx +0 -62
- package/src/components/Progress/ProgressCircle.module.scss +0 -64
- package/src/components/Progress/ProgressCircle.spec.tsx +0 -34
- package/src/components/Progress/ProgressCircle.stories.tsx +0 -28
- package/src/components/Progress/ProgressCircle.tsx +0 -104
- package/src/components/Progress/constants.ts +0 -23
- package/src/components/Progress/helpers.ts +0 -23
- package/src/components/PromoBanner/PromoBanner.module.scss +0 -121
- package/src/components/PromoBanner/PromoBanner.spec.tsx +0 -119
- package/src/components/PromoBanner/PromoBanner.stories.tsx +0 -125
- package/src/components/PromoBanner/PromoBanner.tsx +0 -99
- package/src/components/RadioButton/RadioButton.module.scss +0 -100
- package/src/components/RadioButton/RadioButton.spec.tsx +0 -70
- package/src/components/RadioButton/RadioButton.stories.tsx +0 -34
- package/src/components/RadioButton/RadioButton.tsx +0 -54
- package/src/components/Switch/Switch.module.scss +0 -126
- package/src/components/Switch/Switch.spec.tsx +0 -40
- package/src/components/Switch/Switch.stories.tsx +0 -23
- package/src/components/Switch/Switch.tsx +0 -100
- package/src/components/Tab/Tab.module.scss +0 -56
- package/src/components/Tab/Tab.spec.tsx +0 -34
- package/src/components/Tab/Tab.stories.tsx +0 -20
- package/src/components/Tab/Tab.tsx +0 -49
- package/src/components/Tab/TabsWrapper.module.scss +0 -11
- package/src/components/Tab/TabsWrapper.spec.tsx +0 -19
- package/src/components/Tab/TabsWrapper.stories.tsx +0 -46
- package/src/components/Tab/TabsWrapper.tsx +0 -24
- package/src/components/Tag/Tag.module.scss +0 -131
- package/src/components/Tag/Tag.spec.tsx +0 -93
- package/src/components/Tag/Tag.stories.tsx +0 -151
- package/src/components/Tag/Tag.tsx +0 -129
- package/src/components/TagInput/EditableTag.tsx +0 -54
- package/src/components/TagInput/EditableTagContent.tsx +0 -81
- package/src/components/TagInput/EmailTagInput.tsx +0 -31
- package/src/components/TagInput/TagInput.module.scss +0 -81
- package/src/components/TagInput/TagInput.spec.tsx +0 -58
- package/src/components/TagInput/TagInput.stories.tsx +0 -49
- package/src/components/TagInput/TagInput.tsx +0 -133
- package/src/components/TextField/TextField.module.scss +0 -90
- package/src/components/TextField/TextField.spec.tsx +0 -40
- package/src/components/TextField/TextField.stories.tsx +0 -60
- package/src/components/TextField/TextField.tsx +0 -100
- package/src/components/Toast/Toast.module.scss +0 -218
- package/src/components/Toast/Toast.spec.tsx +0 -96
- package/src/components/Toast/Toast.stories.tsx +0 -64
- package/src/components/Toast/Toast.tsx +0 -121
- package/src/components/Toast/ToastWrapper.spec.tsx +0 -13
- package/src/components/Toast/ToastWrapper.stories.tsx +0 -55
- package/src/components/Toast/ToastWrapper.tsx +0 -87
- package/src/components/Typography/Heading.tsx +0 -36
- package/src/components/Typography/Text.tsx +0 -49
- package/src/components/Typography/Typography.module.scss +0 -132
- package/src/index.scss +0 -9
- package/src/stories/ColorTokens.stories.mdx +0 -10
- package/src/stories/Icons.stories.mdx +0 -12
- package/src/stories/Typography.stories.mdx +0 -65
- package/src/stories/components/ColorTokens.tsx +0 -99
- package/src/stories/components/IconsShowcase.tsx +0 -25
- package/src/stories/components/iconsShowcase.css +0 -13
- package/src/test/setup.ts +0 -1
- package/src/test/utils.ts +0 -3
- package/src/themes/designTokens.ts +0 -126
- package/src/utils/keyCodes.ts +0 -12
- package/src/utils/noop.ts +0 -2
- package/tsconfig.json +0 -25
- package/tsconfig.node.json +0 -8
- package/vite.config.ts +0 -44
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
$toast-appear-animation-timeout: 200ms;
|
|
2
|
-
$toast-exit-animation-timeout: 200ms;
|
|
3
|
-
|
|
4
|
-
.toast {
|
|
5
|
-
align-items: center;
|
|
6
|
-
background: #fff;
|
|
7
|
-
border-radius: 4px;
|
|
8
|
-
box-shadow: 0 6px 30px -10px rgba(0, 0, 0, 0.3);
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
flex: 0 1 auto;
|
|
12
|
-
font-size: 15px;
|
|
13
|
-
font-stretch: normal;
|
|
14
|
-
font-style: normal;
|
|
15
|
-
font-weight: 600;
|
|
16
|
-
justify-content: flex-start;
|
|
17
|
-
letter-spacing: normal;
|
|
18
|
-
line-height: 20px;
|
|
19
|
-
max-width: 500px;
|
|
20
|
-
min-width: 300px;
|
|
21
|
-
padding: 10px 12px;
|
|
22
|
-
|
|
23
|
-
&__content {
|
|
24
|
-
color: var(--content-default);
|
|
25
|
-
width: 100%;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&__icon,
|
|
29
|
-
&__close {
|
|
30
|
-
align-self: baseline;
|
|
31
|
-
height: 20px;
|
|
32
|
-
padding-right: 12px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__icon svg {
|
|
36
|
-
display: flex;
|
|
37
|
-
fill: var(--color-action-default);
|
|
38
|
-
height: 20px;
|
|
39
|
-
width: 20px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&__actions {
|
|
43
|
-
align-items: center;
|
|
44
|
-
align-self: flex-start;
|
|
45
|
-
display: inline-flex;
|
|
46
|
-
flex: 1 0 auto;
|
|
47
|
-
flex-wrap: nowrap;
|
|
48
|
-
height: 20px;
|
|
49
|
-
margin-bottom: auto;
|
|
50
|
-
margin-left: auto;
|
|
51
|
-
|
|
52
|
-
&-close {
|
|
53
|
-
align-items: center;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex: 0 1 auto;
|
|
56
|
-
height: 100%;
|
|
57
|
-
margin-left: 16px;
|
|
58
|
-
width: 100%;
|
|
59
|
-
|
|
60
|
-
svg {
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
display: flex;
|
|
63
|
-
fill: var(--content-subtle);
|
|
64
|
-
height: 16px;
|
|
65
|
-
width: 16px;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&-custom {
|
|
70
|
-
background-color: transparent;
|
|
71
|
-
border: 0;
|
|
72
|
-
color: var(--content-default);
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
font-weight: 600;
|
|
75
|
-
line-height: 20px;
|
|
76
|
-
margin-left: 16px;
|
|
77
|
-
outline: 0;
|
|
78
|
-
padding: 0;
|
|
79
|
-
text-decoration: underline;
|
|
80
|
-
white-space: nowrap;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&--notification {
|
|
85
|
-
background: #fff;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&--success {
|
|
89
|
-
background: var(--color-positive-default);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&--warning {
|
|
93
|
-
background: var(--color-warning-default);
|
|
94
|
-
|
|
95
|
-
.toast__content {
|
|
96
|
-
color: #424d57;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&--error {
|
|
101
|
-
background: var(--color-negative-default);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&--info {
|
|
105
|
-
background: var(--color-action-default);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&--success,
|
|
109
|
-
&--error,
|
|
110
|
-
&--info {
|
|
111
|
-
.toast__content,
|
|
112
|
-
.toast__actions-custom {
|
|
113
|
-
color: #fff;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&-wrapper {
|
|
118
|
-
align-items: center;
|
|
119
|
-
display: flex;
|
|
120
|
-
flex-direction: column;
|
|
121
|
-
position: absolute;
|
|
122
|
-
z-index: 120;
|
|
123
|
-
|
|
124
|
-
&--fixed {
|
|
125
|
-
position: fixed;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&--block {
|
|
129
|
-
position: static;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&--horizontal-center {
|
|
133
|
-
left: calc(50%);
|
|
134
|
-
transform: translateX(-50%);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
&--horizontal-left {
|
|
138
|
-
left: 5px;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
&--horizontal-right {
|
|
142
|
-
right: 5px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&--vertical-top {
|
|
146
|
-
top: 5px;
|
|
147
|
-
|
|
148
|
-
.toast {
|
|
149
|
-
margin-bottom: 10px;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.toast-appear--slide {
|
|
153
|
-
transform: translateY(-100%) !important;
|
|
154
|
-
|
|
155
|
-
&.toast-appear-active--slide {
|
|
156
|
-
transform: translateY(0) !important;
|
|
157
|
-
transition: transform $toast-appear-animation-timeout ease-in;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.toast-exit--slide {
|
|
162
|
-
transform: translateY(0) !important;
|
|
163
|
-
|
|
164
|
-
&.toast-exit-active--slide {
|
|
165
|
-
transform: translateY(-100%) !important;
|
|
166
|
-
transition: transform $toast-exit-animation-timeout ease-in;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&--vertical-bottom {
|
|
172
|
-
bottom: 5px;
|
|
173
|
-
|
|
174
|
-
.toast {
|
|
175
|
-
margin-top: 10px;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.toast-appear--slide {
|
|
179
|
-
transform: translateY(100%) !important;
|
|
180
|
-
|
|
181
|
-
&.toast-appear-active--slide {
|
|
182
|
-
transform: translateY(0) !important;
|
|
183
|
-
transition: transform $toast-appear-animation-timeout ease-in;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.toast-exit--slide {
|
|
188
|
-
transform: translateY(0) !important;
|
|
189
|
-
|
|
190
|
-
&.toast-exit-active--slide {
|
|
191
|
-
transform: translateY(100%) !important;
|
|
192
|
-
transition: transform $toast-exit-animation-timeout ease-in;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&--vertical-top,
|
|
198
|
-
&--vertical-bottom {
|
|
199
|
-
.toast-appear--fade {
|
|
200
|
-
opacity: 0;
|
|
201
|
-
|
|
202
|
-
&.toast-appear-active--fade {
|
|
203
|
-
opacity: 1;
|
|
204
|
-
transition: opacity $toast-appear-animation-timeout ease-in;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.toast-exit--fade {
|
|
209
|
-
opacity: 1;
|
|
210
|
-
transition: opacity $toast-appear-animation-timeout ease-in;
|
|
211
|
-
|
|
212
|
-
&.toast-exit-active--fade {
|
|
213
|
-
opacity: 0;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { render, fireEvent, vi } from 'test-utils';
|
|
3
|
-
import { ToastProps, Toast, Variants } from './Toast';
|
|
4
|
-
|
|
5
|
-
import styles from './Toast.module.scss';
|
|
6
|
-
|
|
7
|
-
const renderComponent = (props: ToastProps) => {
|
|
8
|
-
return render(
|
|
9
|
-
<Toast {...props} className="my-css-class">
|
|
10
|
-
This example content
|
|
11
|
-
</Toast>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe('<Toast> component', () => {
|
|
16
|
-
it('should allow for custom class', () => {
|
|
17
|
-
const { container } = renderComponent({});
|
|
18
|
-
|
|
19
|
-
expect(container.firstChild).toHaveClass('my-css-class');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should render as info by default', () => {
|
|
23
|
-
const { container } = renderComponent({});
|
|
24
|
-
|
|
25
|
-
expect(container.firstChild).toHaveClass(styles['toast--info']);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should render as success', () => {
|
|
29
|
-
const { container } = renderComponent({ variant: Variants.Success });
|
|
30
|
-
|
|
31
|
-
expect(container.firstChild).toHaveClass(styles['toast--success']);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should render as warning', () => {
|
|
35
|
-
const { container } = renderComponent({ variant: Variants.Warning });
|
|
36
|
-
|
|
37
|
-
expect(container.firstChild).toHaveClass(styles['toast--warning']);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should render as error', () => {
|
|
41
|
-
const { container } = renderComponent({ variant: Variants.Error });
|
|
42
|
-
|
|
43
|
-
expect(container.firstChild).toHaveClass(styles['toast--error']);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should render as notification', () => {
|
|
47
|
-
const { container } = renderComponent({
|
|
48
|
-
variant: Variants.Notification,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
expect(container.firstChild).toHaveClass(styles['toast--notification']);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should render with action button and call action function', () => {
|
|
55
|
-
const handler = vi.fn();
|
|
56
|
-
const { getByText } = renderComponent({
|
|
57
|
-
action: {
|
|
58
|
-
label: 'Example action',
|
|
59
|
-
handler,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
expect(getByText('Example action')).toBeVisible();
|
|
64
|
-
fireEvent.click(getByText('Example action'));
|
|
65
|
-
expect(handler).toHaveBeenCalled();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should call action function with onClose function', () => {
|
|
69
|
-
const handler = vi.fn();
|
|
70
|
-
const onClose = vi.fn();
|
|
71
|
-
const { getByText } = renderComponent({
|
|
72
|
-
action: {
|
|
73
|
-
label: 'Example action',
|
|
74
|
-
handler,
|
|
75
|
-
closeOnClick: true,
|
|
76
|
-
},
|
|
77
|
-
onClose,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
fireEvent.click(getByText('Example action'));
|
|
81
|
-
expect(handler).toHaveBeenCalled();
|
|
82
|
-
expect(onClose).toHaveBeenCalled();
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should render with close button and call onClose function', () => {
|
|
86
|
-
const onClose = vi.fn();
|
|
87
|
-
const { getByLabelText } = renderComponent({
|
|
88
|
-
removable: true,
|
|
89
|
-
onClose,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
expect(getByLabelText('Close toast')).toBeVisible();
|
|
93
|
-
fireEvent.click(getByLabelText('Close toast'));
|
|
94
|
-
expect(onClose).toHaveBeenCalled();
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentMeta, Story } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { ToastProps, Toast as ToastComponent, Variants } from './Toast';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/Toast',
|
|
8
|
-
component: ToastComponent,
|
|
9
|
-
parameters: {
|
|
10
|
-
componentSubtitle: `
|
|
11
|
-
Toast is a small message that by default shows up in the top middle of the screen.
|
|
12
|
-
It disappears on its own after a few seconds. It provides a feedback about an operation
|
|
13
|
-
for user.
|
|
14
|
-
`,
|
|
15
|
-
},
|
|
16
|
-
} as ComponentMeta<typeof ToastComponent>;
|
|
17
|
-
|
|
18
|
-
interface IToastArgs extends ToastProps {
|
|
19
|
-
label: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const StoryTemplate: Story<IToastArgs> = (args: IToastArgs) => (
|
|
23
|
-
<div>
|
|
24
|
-
<ToastComponent {...args}>Example text</ToastComponent>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
export const Toast = StoryTemplate.bind({});
|
|
29
|
-
Toast.args = {};
|
|
30
|
-
|
|
31
|
-
export const SuccessToast = StoryTemplate.bind({});
|
|
32
|
-
SuccessToast.args = {
|
|
33
|
-
variant: Variants.Success,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WarningToast = StoryTemplate.bind({});
|
|
37
|
-
WarningToast.args = {
|
|
38
|
-
variant: Variants.Warning,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const ErrorToast = StoryTemplate.bind({});
|
|
42
|
-
ErrorToast.args = {
|
|
43
|
-
variant: Variants.Error,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const InfoToast = StoryTemplate.bind({});
|
|
47
|
-
InfoToast.args = {
|
|
48
|
-
variant: Variants.Info,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const NotificationToast = StoryTemplate.bind({});
|
|
52
|
-
NotificationToast.args = {
|
|
53
|
-
variant: Variants.Notification,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const ToastWithActionAndRemovable = StoryTemplate.bind({});
|
|
57
|
-
ToastWithActionAndRemovable.args = {
|
|
58
|
-
action: {
|
|
59
|
-
label: 'Action',
|
|
60
|
-
handler: () => alert('onAction click'),
|
|
61
|
-
},
|
|
62
|
-
removable: true,
|
|
63
|
-
onClose: () => alert('onClose click'),
|
|
64
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import cx from 'clsx';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Close,
|
|
6
|
-
Info,
|
|
7
|
-
Warning,
|
|
8
|
-
CheckCircleSolid,
|
|
9
|
-
Error,
|
|
10
|
-
} from '@livechat/design-system-icons/react/material';
|
|
11
|
-
import { Icon, IconSizeName, IconTypeName } from '../Icon';
|
|
12
|
-
|
|
13
|
-
import styles from './Toast.module.scss';
|
|
14
|
-
|
|
15
|
-
const baseClass = 'toast';
|
|
16
|
-
|
|
17
|
-
export const enum Variants {
|
|
18
|
-
Success = 'success',
|
|
19
|
-
Warning = 'warning',
|
|
20
|
-
Error = 'error',
|
|
21
|
-
Info = 'info',
|
|
22
|
-
Notification = 'notification',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface ToastAction {
|
|
26
|
-
handler: () => void;
|
|
27
|
-
label: string;
|
|
28
|
-
closeOnClick?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ToastProps {
|
|
32
|
-
action?: ToastAction;
|
|
33
|
-
className?: string;
|
|
34
|
-
removable?: boolean;
|
|
35
|
-
variant?: Variants;
|
|
36
|
-
onClose?: () => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const IconConfig = {
|
|
40
|
-
[Variants.Success]: {
|
|
41
|
-
source: CheckCircleSolid,
|
|
42
|
-
iconType: IconTypeName.Inverted,
|
|
43
|
-
},
|
|
44
|
-
[Variants.Warning]: {
|
|
45
|
-
source: Warning,
|
|
46
|
-
},
|
|
47
|
-
[Variants.Error]: {
|
|
48
|
-
source: Error,
|
|
49
|
-
iconType: IconTypeName.Inverted,
|
|
50
|
-
},
|
|
51
|
-
[Variants.Info]: {
|
|
52
|
-
source: Info,
|
|
53
|
-
iconType: IconTypeName.Inverted,
|
|
54
|
-
},
|
|
55
|
-
[Variants.Notification]: {
|
|
56
|
-
source: Info,
|
|
57
|
-
iconType: IconTypeName.Link,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Toast: React.FC<ToastProps> = ({
|
|
62
|
-
action,
|
|
63
|
-
className,
|
|
64
|
-
children,
|
|
65
|
-
removable,
|
|
66
|
-
variant = Variants.Info,
|
|
67
|
-
onClose,
|
|
68
|
-
}) => {
|
|
69
|
-
const mergedClassNames = cx(
|
|
70
|
-
styles[baseClass],
|
|
71
|
-
styles[`${baseClass}--${variant}`],
|
|
72
|
-
className
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const onActionClick = (action: ToastAction) => {
|
|
76
|
-
if (action && action.closeOnClick && onClose) {
|
|
77
|
-
action.handler();
|
|
78
|
-
return onClose();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return action.handler();
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className={mergedClassNames}>
|
|
86
|
-
<div className={styles[`${baseClass}__icon`]}>
|
|
87
|
-
<Icon {...IconConfig[variant]} />
|
|
88
|
-
</div>
|
|
89
|
-
<div className={styles[`${baseClass}__content`]}>{children}</div>
|
|
90
|
-
{(action || removable) && (
|
|
91
|
-
<div className={styles[`${baseClass}__actions`]}>
|
|
92
|
-
{action && (
|
|
93
|
-
<button
|
|
94
|
-
className={styles[`${baseClass}__actions-custom`]}
|
|
95
|
-
onClick={() => onActionClick(action)}
|
|
96
|
-
>
|
|
97
|
-
{action.label}
|
|
98
|
-
</button>
|
|
99
|
-
)}
|
|
100
|
-
{removable && (
|
|
101
|
-
<div
|
|
102
|
-
className={styles[`${baseClass}__actions-close`]}
|
|
103
|
-
aria-label="Close toast"
|
|
104
|
-
onClick={onClose}
|
|
105
|
-
>
|
|
106
|
-
<Icon
|
|
107
|
-
source={Close}
|
|
108
|
-
size={IconSizeName.Small}
|
|
109
|
-
iconType={
|
|
110
|
-
[Variants.Warning, Variants.Notification].includes(variant)
|
|
111
|
-
? IconTypeName.Primary
|
|
112
|
-
: IconTypeName.Inverted
|
|
113
|
-
}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
)}
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { render } from 'test-utils';
|
|
3
|
-
import { ToastWrapper } from './ToastWrapper';
|
|
4
|
-
|
|
5
|
-
describe('<ToastWrapper> component', () => {
|
|
6
|
-
it('should allow for custom class', () => {
|
|
7
|
-
const { container } = render(
|
|
8
|
-
<ToastWrapper toasts={[]} className="my-css-class" />
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
expect(container.firstChild).toHaveClass('my-css-class');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
ToastWrapperProps,
|
|
6
|
-
ToastWrapper as ToastWrapperComponent,
|
|
7
|
-
} from './ToastWrapper';
|
|
8
|
-
import { Variants } from './Toast';
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'Components/Toast Wrapper',
|
|
12
|
-
component: ToastWrapperComponent,
|
|
13
|
-
parameters: {
|
|
14
|
-
componentSubtitle: `
|
|
15
|
-
You can use ToastWrapper component to position your toasts.
|
|
16
|
-
`,
|
|
17
|
-
},
|
|
18
|
-
} as ComponentMeta<typeof ToastWrapperComponent>;
|
|
19
|
-
|
|
20
|
-
export const ToastWrapper = (args: ToastWrapperProps): React.ReactElement => (
|
|
21
|
-
<div style={{ width: '100%', height: 700, position: 'relative' }}>
|
|
22
|
-
<ToastWrapperComponent {...args} />
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
ToastWrapper.args = {
|
|
27
|
-
fixed: false,
|
|
28
|
-
toasts: [
|
|
29
|
-
{
|
|
30
|
-
id: '1',
|
|
31
|
-
variant: Variants.Success,
|
|
32
|
-
content: <div>First toast with DOM element as content</div>,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: '2',
|
|
36
|
-
variant: Variants.Info,
|
|
37
|
-
content: 'Second toast with string as content and with removable prop',
|
|
38
|
-
removable: true,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: '3',
|
|
42
|
-
variant: Variants.Warning,
|
|
43
|
-
content: 'Third toast with action',
|
|
44
|
-
action: {
|
|
45
|
-
label: 'Action',
|
|
46
|
-
handler: () => alert('Third toast action click'),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: '4',
|
|
51
|
-
variant: Variants.Error,
|
|
52
|
-
content: 'Fourth toast',
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import cx from 'clsx';
|
|
3
|
-
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
4
|
-
|
|
5
|
-
import { ToastProps, Toast } from './Toast';
|
|
6
|
-
|
|
7
|
-
import styles from './Toast.module.scss';
|
|
8
|
-
|
|
9
|
-
export enum HorizontalPosition {
|
|
10
|
-
Left = 'left',
|
|
11
|
-
Center = 'center',
|
|
12
|
-
Right = 'right',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export enum VerticalPosition {
|
|
16
|
-
Top = 'top',
|
|
17
|
-
Bottom = 'bottom',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const ANIMATION_TIME = 200;
|
|
21
|
-
|
|
22
|
-
const baseClass = 'toast-wrapper';
|
|
23
|
-
|
|
24
|
-
interface Toast extends ToastProps {
|
|
25
|
-
id: string;
|
|
26
|
-
content: React.ReactElement | string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ToastWrapperProps {
|
|
30
|
-
className?: string;
|
|
31
|
-
toasts: Toast[];
|
|
32
|
-
fixed?: boolean;
|
|
33
|
-
block?: boolean;
|
|
34
|
-
animationType?: string;
|
|
35
|
-
verticalPosition?: VerticalPosition;
|
|
36
|
-
horizontalPosition?: HorizontalPosition;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const ToastWrapper: React.FC<ToastWrapperProps> = ({
|
|
40
|
-
className,
|
|
41
|
-
toasts = [],
|
|
42
|
-
fixed = true,
|
|
43
|
-
block = false,
|
|
44
|
-
animationType = 'slide',
|
|
45
|
-
verticalPosition = 'top',
|
|
46
|
-
horizontalPosition = 'center',
|
|
47
|
-
}) => {
|
|
48
|
-
const mergedClassNames = cx(
|
|
49
|
-
styles[baseClass],
|
|
50
|
-
{
|
|
51
|
-
[styles[`${baseClass}--fixed`]]: fixed,
|
|
52
|
-
[styles[`${baseClass}--block`]]: !fixed && block,
|
|
53
|
-
[styles[`${baseClass}--horizontal-${horizontalPosition}`]]:
|
|
54
|
-
horizontalPosition,
|
|
55
|
-
[styles[`${baseClass}--vertical-${verticalPosition}`]]: verticalPosition,
|
|
56
|
-
},
|
|
57
|
-
className
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div className={mergedClassNames}>
|
|
62
|
-
<TransitionGroup component={null}>
|
|
63
|
-
{toasts.map(({ id, variant, content, removable, action, onClose }) => (
|
|
64
|
-
<CSSTransition
|
|
65
|
-
key={id}
|
|
66
|
-
classNames={{
|
|
67
|
-
enter: styles[`toast-appear--${animationType}`],
|
|
68
|
-
enterActive: styles[`toast-appear-active--${animationType}`],
|
|
69
|
-
exit: styles[`toast-exit--${animationType}`],
|
|
70
|
-
exitActive: styles[`toast-exit-active--${animationType}`],
|
|
71
|
-
}}
|
|
72
|
-
timeout={ANIMATION_TIME}
|
|
73
|
-
>
|
|
74
|
-
<Toast
|
|
75
|
-
variant={variant}
|
|
76
|
-
onClose={onClose}
|
|
77
|
-
removable={removable}
|
|
78
|
-
action={action}
|
|
79
|
-
>
|
|
80
|
-
{content}
|
|
81
|
-
</Toast>
|
|
82
|
-
</CSSTransition>
|
|
83
|
-
))}
|
|
84
|
-
</TransitionGroup>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import cx from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './Typography.module.scss';
|
|
5
|
-
|
|
6
|
-
enum sizeToElement {
|
|
7
|
-
xl = 'h1',
|
|
8
|
-
lg = 'h2',
|
|
9
|
-
md = 'h3',
|
|
10
|
-
sm = 'h4',
|
|
11
|
-
xs = 'h5',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type TSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
15
|
-
|
|
16
|
-
interface IProps {
|
|
17
|
-
size?: TSize;
|
|
18
|
-
/** DOM element name that will be rendered */
|
|
19
|
-
as?: string;
|
|
20
|
-
/** Optional custom className */
|
|
21
|
-
className?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const Heading: React.FC<IProps> = ({
|
|
25
|
-
as,
|
|
26
|
-
size = 'md',
|
|
27
|
-
children,
|
|
28
|
-
className,
|
|
29
|
-
...props
|
|
30
|
-
}) => {
|
|
31
|
-
return React.createElement(
|
|
32
|
-
as || sizeToElement[size],
|
|
33
|
-
{ className: cx(styles[`heading-${size}`], className), ...props },
|
|
34
|
-
children
|
|
35
|
-
);
|
|
36
|
-
};
|