@snack-uikit/toaster 0.5.3 → 0.5.5
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/CHANGELOG.md +23 -0
- package/dist/components/ToastSystemEvent/ToastSystemEvent.d.ts +5 -5
- package/dist/components/ToastSystemEvent/ToastSystemEvent.js +4 -4
- package/dist/components/ToastSystemEvent/constants.d.ts +9 -13
- package/dist/components/ToastSystemEvent/constants.js +12 -14
- package/dist/components/ToastSystemEvent/styles.module.css +26 -4
- package/dist/components/ToastSystemEvent/types.d.ts +3 -0
- package/dist/components/ToastSystemEvent/types.js +1 -0
- package/dist/components/ToastSystemEvent/utils.d.ts +1 -1
- package/dist/components/ToastSystemEvent/utils.js +5 -6
- package/dist/components/ToastUserAction/ToastUserAction.d.ts +3 -5
- package/dist/components/ToastUserAction/ToastUserAction.js +3 -4
- package/dist/components/ToastUserAction/constants.d.ts +10 -10
- package/dist/components/ToastUserAction/constants.js +10 -12
- package/dist/components/ToastUserAction/styles.module.css +19 -20
- package/dist/components/ToastUserAction/types.d.ts +3 -0
- package/dist/components/ToastUserAction/types.js +1 -0
- package/dist/components/ToastUserAction/utils.d.ts +1 -1
- package/dist/components/ToastUserAction/utils.js +5 -5
- package/dist/helperComponents/ButtonAction/ButtonAction.d.ts +7 -0
- package/dist/helperComponents/ButtonAction/ButtonAction.js +6 -0
- package/dist/helperComponents/ButtonAction/index.d.ts +1 -0
- package/dist/helperComponents/ButtonAction/index.js +1 -0
- package/dist/helperComponents/ButtonAction/styles.module.css +43 -0
- package/dist/helpers.js +20 -20
- package/dist/testIds.d.ts +2 -0
- package/dist/testIds.js +2 -0
- package/package.json +6 -5
- package/src/components/ToastSystemEvent/ToastSystemEvent.tsx +54 -41
- package/src/components/ToastSystemEvent/constants.ts +18 -14
- package/src/components/ToastSystemEvent/styles.module.scss +28 -3
- package/src/components/ToastSystemEvent/types.ts +5 -0
- package/src/components/ToastSystemEvent/utils.tsx +6 -6
- package/src/components/ToastUserAction/ToastUserAction.tsx +26 -24
- package/src/components/ToastUserAction/constants.tsx +10 -10
- package/src/components/ToastUserAction/styles.module.scss +15 -16
- package/src/components/ToastUserAction/types.ts +5 -0
- package/src/components/ToastUserAction/utils.tsx +6 -5
- package/src/helperComponents/ButtonAction/ButtonAction.tsx +24 -0
- package/src/helperComponents/ButtonAction/index.ts +1 -0
- package/src/helperComponents/ButtonAction/styles.module.scss +50 -0
- package/src/helpers.tsx +20 -19
- package/src/testIds.ts +2 -0
package/src/helpers.tsx
CHANGED
|
@@ -64,6 +64,7 @@ function getToastOptions<T extends keyof ToasterPropsMap>({
|
|
|
64
64
|
type,
|
|
65
65
|
toastOptions,
|
|
66
66
|
containerId,
|
|
67
|
+
toasterProps,
|
|
67
68
|
}: {
|
|
68
69
|
type: T;
|
|
69
70
|
toasterProps?: ToasterPropsMap[T];
|
|
@@ -72,7 +73,7 @@ function getToastOptions<T extends keyof ToasterPropsMap>({
|
|
|
72
73
|
}): RtToastOptions {
|
|
73
74
|
return {
|
|
74
75
|
toastId: toastOptions?.id,
|
|
75
|
-
autoClose: AUTO_CLOSE_TIME[type],
|
|
76
|
+
autoClose: toasterProps?.loading ? false : AUTO_CLOSE_TIME[type],
|
|
76
77
|
containerId: containerId || `${TOASTER_CONTAINER_PREFIX}${type}`,
|
|
77
78
|
};
|
|
78
79
|
}
|
|
@@ -149,28 +150,28 @@ const userAction = {
|
|
|
149
150
|
success(options: UserActionOptions) {
|
|
150
151
|
return openToast({
|
|
151
152
|
type: ToasterType.UserAction,
|
|
152
|
-
toasterProps: { ...options, appearance:
|
|
153
|
+
toasterProps: { ...options, appearance: 'success' },
|
|
153
154
|
});
|
|
154
155
|
},
|
|
155
156
|
|
|
156
157
|
neutral(options: UserActionOptions) {
|
|
157
158
|
return openToast({
|
|
158
159
|
type: ToasterType.UserAction,
|
|
159
|
-
toasterProps: { ...options, appearance:
|
|
160
|
+
toasterProps: { ...options, appearance: 'neutral' },
|
|
160
161
|
});
|
|
161
162
|
},
|
|
162
163
|
|
|
163
164
|
error(options: UserActionOptions) {
|
|
164
165
|
return openToast({
|
|
165
166
|
type: ToasterType.UserAction,
|
|
166
|
-
toasterProps: { ...options, appearance:
|
|
167
|
+
toasterProps: { ...options, appearance: 'error' },
|
|
167
168
|
});
|
|
168
169
|
},
|
|
169
170
|
|
|
170
171
|
warning(options: UserActionOptions) {
|
|
171
172
|
return openToast({
|
|
172
173
|
type: ToasterType.UserAction,
|
|
173
|
-
toasterProps: { ...options, appearance:
|
|
174
|
+
toasterProps: { ...options, appearance: 'warning' },
|
|
174
175
|
});
|
|
175
176
|
},
|
|
176
177
|
|
|
@@ -178,28 +179,28 @@ const userAction = {
|
|
|
178
179
|
success(id: ToasterId, options: UserActionOptions) {
|
|
179
180
|
updateToast(id, {
|
|
180
181
|
type: ToasterType.UserAction,
|
|
181
|
-
toasterProps: { ...options, appearance:
|
|
182
|
+
toasterProps: { ...options, appearance: 'success' },
|
|
182
183
|
});
|
|
183
184
|
},
|
|
184
185
|
|
|
185
186
|
neutral(id: ToasterId, options: UserActionOptions) {
|
|
186
187
|
updateToast(id, {
|
|
187
188
|
type: ToasterType.UserAction,
|
|
188
|
-
toasterProps: { ...options, appearance:
|
|
189
|
+
toasterProps: { ...options, appearance: 'neutral' },
|
|
189
190
|
});
|
|
190
191
|
},
|
|
191
192
|
|
|
192
193
|
warning(id: ToasterId, options: UserActionOptions) {
|
|
193
194
|
updateToast(id, {
|
|
194
195
|
type: ToasterType.UserAction,
|
|
195
|
-
toasterProps: { ...options, appearance:
|
|
196
|
+
toasterProps: { ...options, appearance: 'warning' },
|
|
196
197
|
});
|
|
197
198
|
},
|
|
198
199
|
|
|
199
200
|
error(id: ToasterId, options: UserActionOptions) {
|
|
200
201
|
updateToast(id, {
|
|
201
202
|
type: ToasterType.UserAction,
|
|
202
|
-
toasterProps: { ...options, appearance:
|
|
203
|
+
toasterProps: { ...options, appearance: 'error' },
|
|
203
204
|
});
|
|
204
205
|
},
|
|
205
206
|
},
|
|
@@ -213,35 +214,35 @@ const systemEvent = {
|
|
|
213
214
|
success(options: ToastSystemEventProps) {
|
|
214
215
|
return openToast({
|
|
215
216
|
type: ToasterType.SystemEvent,
|
|
216
|
-
toasterProps: { ...options, appearance:
|
|
217
|
+
toasterProps: { ...options, appearance: 'success' },
|
|
217
218
|
});
|
|
218
219
|
},
|
|
219
220
|
|
|
220
221
|
neutral(options: ToastSystemEventProps) {
|
|
221
222
|
return openToast({
|
|
222
223
|
type: ToasterType.SystemEvent,
|
|
223
|
-
toasterProps: { ...options, appearance:
|
|
224
|
+
toasterProps: { ...options, appearance: 'neutral' },
|
|
224
225
|
});
|
|
225
226
|
},
|
|
226
227
|
|
|
227
228
|
warning(options: ToastSystemEventProps) {
|
|
228
229
|
return openToast({
|
|
229
230
|
type: ToasterType.SystemEvent,
|
|
230
|
-
toasterProps: { ...options, appearance:
|
|
231
|
+
toasterProps: { ...options, appearance: 'warning' },
|
|
231
232
|
});
|
|
232
233
|
},
|
|
233
234
|
|
|
234
235
|
error(options: ToastSystemEventProps) {
|
|
235
236
|
return openToast({
|
|
236
237
|
type: ToasterType.SystemEvent,
|
|
237
|
-
toasterProps: { ...options, appearance:
|
|
238
|
+
toasterProps: { ...options, appearance: 'error' },
|
|
238
239
|
});
|
|
239
240
|
},
|
|
240
241
|
|
|
241
242
|
errorCritical(options: ToastSystemEventProps) {
|
|
242
243
|
return openToast({
|
|
243
244
|
type: ToasterType.SystemEvent,
|
|
244
|
-
toasterProps: { ...options, appearance:
|
|
245
|
+
toasterProps: { ...options, appearance: 'errorCritical' },
|
|
245
246
|
});
|
|
246
247
|
},
|
|
247
248
|
|
|
@@ -249,35 +250,35 @@ const systemEvent = {
|
|
|
249
250
|
success(id: ToasterId, options: ToastSystemEventProps) {
|
|
250
251
|
return updateToast(id, {
|
|
251
252
|
type: ToasterType.SystemEvent,
|
|
252
|
-
toasterProps: { ...options, appearance:
|
|
253
|
+
toasterProps: { ...options, appearance: 'success' },
|
|
253
254
|
});
|
|
254
255
|
},
|
|
255
256
|
|
|
256
257
|
neutral(id: ToasterId, options: ToastSystemEventProps) {
|
|
257
258
|
return updateToast(id, {
|
|
258
259
|
type: ToasterType.SystemEvent,
|
|
259
|
-
toasterProps: { ...options, appearance:
|
|
260
|
+
toasterProps: { ...options, appearance: 'neutral' },
|
|
260
261
|
});
|
|
261
262
|
},
|
|
262
263
|
|
|
263
264
|
warning(id: ToasterId, options: ToastSystemEventProps) {
|
|
264
265
|
return updateToast(id, {
|
|
265
266
|
type: ToasterType.SystemEvent,
|
|
266
|
-
toasterProps: { ...options, appearance:
|
|
267
|
+
toasterProps: { ...options, appearance: 'warning' },
|
|
267
268
|
});
|
|
268
269
|
},
|
|
269
270
|
|
|
270
271
|
error(id: ToasterId, options: ToastSystemEventProps) {
|
|
271
272
|
return updateToast(id, {
|
|
272
273
|
type: ToasterType.SystemEvent,
|
|
273
|
-
toasterProps: { ...options, appearance:
|
|
274
|
+
toasterProps: { ...options, appearance: 'error' },
|
|
274
275
|
});
|
|
275
276
|
},
|
|
276
277
|
|
|
277
278
|
errorCritical(id: ToasterId, options: ToastSystemEventProps) {
|
|
278
279
|
return updateToast(id, {
|
|
279
280
|
type: ToasterType.SystemEvent,
|
|
280
|
-
toasterProps: { ...options, appearance:
|
|
281
|
+
toasterProps: { ...options, appearance: 'errorCritical' },
|
|
281
282
|
});
|
|
282
283
|
},
|
|
283
284
|
},
|
package/src/testIds.ts
CHANGED
|
@@ -6,6 +6,7 @@ export const TOAST_SYSTEM_EVENT_TEST_IDS = {
|
|
|
6
6
|
title: `${TOAST_SYSTEM_EVENT_TEST_ID}__title`,
|
|
7
7
|
description: `${TOAST_SYSTEM_EVENT_TEST_ID}__description`,
|
|
8
8
|
buttonClose: `${TOAST_SYSTEM_EVENT_TEST_ID}__button-close`,
|
|
9
|
+
buttonAction: `${TOAST_SYSTEM_EVENT_TEST_ID}__button-action`,
|
|
9
10
|
link: `${TOAST_SYSTEM_EVENT_TEST_ID}__link`,
|
|
10
11
|
progressbar: `${TOAST_SYSTEM_EVENT_TEST_ID}__progressbar`,
|
|
11
12
|
buttonCloseColumn: `${TOAST_SYSTEM_EVENT_TEST_ID}button-close-column`,
|
|
@@ -17,5 +18,6 @@ export const TOAST_USER_ACTION_TEST_IDS = {
|
|
|
17
18
|
main: TOAST_USER_ACTION_TEST_ID,
|
|
18
19
|
label: `${TOAST_USER_ACTION_TEST_ID}__label`,
|
|
19
20
|
icon: `${TOAST_USER_ACTION_TEST_ID}__icon`,
|
|
21
|
+
loader: `${TOAST_USER_ACTION_TEST_ID}__loader`,
|
|
20
22
|
link: `${TOAST_USER_ACTION_TEST_ID}__link`,
|
|
21
23
|
};
|