@snack-uikit/toaster 0.11.21-preview-83f569e2.0 → 0.11.21

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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## <small>0.11.21 (2026-01-19)</small>
7
+
8
+ * chore(FF-6693): migrate tests from TestCafe to Playwright ([f32aff8](https://github.com/cloud-ru-tech/snack-uikit/commit/f32aff8))
9
+ * chore(FF-6693): tune test configs ([d194f4d](https://github.com/cloud-ru-tech/snack-uikit/commit/d194f4d))
10
+ * docs(FF-7788): readme update ([e3142b8](https://github.com/cloud-ru-tech/snack-uikit/commit/e3142b8))
11
+
12
+
13
+
14
+
15
+
6
16
  ## <small>0.11.20 (2025-11-28)</small>
7
17
 
8
18
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -204,9 +204,8 @@ toaster.upload.dismiss(uploadToastId);
204
204
  | name | type | default value | description |
205
205
  |------|------|---------------|-------------|
206
206
  | title* | `string` | - | |
207
- | closeToast | `CloseToastFunc` | - | |
207
+ | closeToast | `() => void` | - | |
208
208
  | toastProps | `ToastProps` | - | |
209
- | isPaused | `boolean` | - | |
210
209
  | data | `unknown` | - | |
211
210
  | description | `string` | - | |
212
211
  | appearance | enum ToastSystemEventAppearance: `"neutral"`, `"error"`, `"errorCritical"`, `"warning"`, `"success"` | neutral | |
@@ -222,9 +221,8 @@ toaster.upload.dismiss(uploadToastId);
222
221
  | name | type | default value | description |
223
222
  |------|------|---------------|-------------|
224
223
  | label* | `string` | - | |
225
- | closeToast | `CloseToastFunc` | - | |
224
+ | closeToast | `() => void` | - | |
226
225
  | toastProps | `ToastProps` | - | |
227
- | isPaused | `boolean` | - | |
228
226
  | data | `unknown` | - | |
229
227
  | appearance | enum ToastUserActionAppearance: `"neutral"`, `"error"`, `"warning"`, `"success"` | neutral | |
230
228
  | link | `ToastUserActionLink` | - | |
@@ -239,7 +237,6 @@ toaster.upload.dismiss(uploadToastId);
239
237
  | containerId | `Id` | - | |
240
238
  | displayCloseAllButton | `boolean` | - | |
241
239
  | type | enum ToasterType: `"system-event"`, `"user-action"`, `"upload"` | system-event | |
242
- | draggable | `boolean` | - | |
243
240
  ## ToastUpload
244
241
  ### Props
245
242
  | name | type | default value | description |
@@ -249,9 +246,8 @@ toaster.upload.dismiss(uploadToastId);
249
246
  | progress* | `{ current: number; total: number; }` | - | Общий прогресс загрузки |
250
247
  | description* | `string` | - | Описание статуса загрузки |
251
248
  | status* | enum ToastUploadStatus: `"error"`, `"loading"`, `"pause"`, `"uploaded"`, `"errorUploaded"` | - | Общий статус загрузки |
252
- | closeToast | `CloseToastFunc` | - | |
249
+ | closeToast | `() => void` | - | |
253
250
  | toastProps | `ToastProps` | - | |
254
- | isPaused | `boolean` | - | |
255
251
  | data | `unknown` | - | |
256
252
  | title | `string` | - | Заголовок тостера |
257
253
  | onCloseClick | `(e: MouseEvent<HTMLButtonElement, MouseEvent>, close?: () => void) => void` | - | Закрыть тостер |
@@ -7,6 +7,5 @@ export type ToasterContainerProps = {
7
7
  containerId?: RtToastContainerProps['containerId'];
8
8
  displayCloseAllButton?: boolean;
9
9
  type?: ToasterType;
10
- draggable?: boolean;
11
10
  };
12
- export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, draggable, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,6 @@ require("./style.css");
14
14
  const classnames_1 = __importDefault(require("classnames"));
15
15
  const react_1 = require("react");
16
16
  const react_toastify_1 = require("react-toastify");
17
- const utils_1 = require("@snack-uikit/utils");
18
17
  const constants_1 = require("../../constants");
19
18
  const testIds_1 = require("../../testIds");
20
19
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
@@ -24,8 +23,7 @@ function ToasterContainer(_ref) {
24
23
  limit = 5,
25
24
  containerId,
26
25
  displayCloseAllButton,
27
- type = constants_1.TOASTER_TYPE.SystemEvent,
28
- draggable = false
26
+ type = constants_1.TOASTER_TYPE.SystemEvent
29
27
  } = _ref;
30
28
  const [notificationCounter, setNotificationCounter] = (0, react_1.useState)(0);
31
29
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = (0, react_1.useState)(false);
@@ -33,7 +31,7 @@ function ToasterContainer(_ref) {
33
31
  react_toastify_1.toast.dismiss();
34
32
  setIsCloseAllButtonHidden(true);
35
33
  };
36
- (0, utils_1.useLayoutEffect)(() => {
34
+ (0, react_1.useEffect)(() => {
37
35
  const unsubscribe = react_toastify_1.toast.onChange(_ref2 => {
38
36
  let {
39
37
  status,
@@ -58,7 +56,7 @@ function ToasterContainer(_ref) {
58
56
  closeOnClick: false,
59
57
  autoClose: false,
60
58
  closeButton: false,
61
- draggable: draggable,
59
+ draggable: false,
62
60
  className: (0, classnames_1.default)('osThemeSnack', styles_module_scss_1.default[position], {
63
61
  [styles_module_scss_1.default.containerWithCloseAllButton]: hasCloseAllButton,
64
62
  'osThemeSnack__toast-container__system-event': type === constants_1.TOASTER_TYPE.SystemEvent,
@@ -66,6 +64,7 @@ function ToasterContainer(_ref) {
66
64
  'osThemeSnack__toast-container__upload': type === constants_1.TOASTER_TYPE.Upload
67
65
  }),
68
66
  toastClassName: styles_module_scss_1.default.toaster,
67
+ bodyClassName: styles_module_scss_1.default.toaster,
69
68
  position: position,
70
69
  limit: limit,
71
70
  containerId: containerId
@@ -66,7 +66,6 @@
66
66
  }
67
67
  :global .osThemeSnack.Toastify__toast-container{
68
68
  position:fixed;
69
- left:auto;
70
69
  box-sizing:border-box;
71
70
  padding:0;
72
71
  }
@@ -80,7 +79,6 @@
80
79
  display:flex;
81
80
  justify-content:space-between;
82
81
  box-sizing:border-box;
83
- width:100%;
84
82
  min-height:unset;
85
83
  margin:0;
86
84
  padding:0;
@@ -7,5 +7,5 @@ export declare const updateToast: UpdateToast;
7
7
  * @function
8
8
  */
9
9
  export declare const dismissToast: (params?: Id) => void;
10
- export declare const isToastActive: (id: Id, containerId?: Id) => boolean;
10
+ export declare const isToastActive: typeof import("react-toastify/dist/core/store").isToastActive;
11
11
  export declare const toaster: Toaster;
@@ -50,12 +50,12 @@ function getToastOptions(_ref2) {
50
50
  } = _ref2;
51
51
  return {
52
52
  toastId: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.id,
53
- onClose: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.onClose,
53
+ onClose: data => {
54
+ var _a;
55
+ (_a = toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.onClose) === null || _a === void 0 ? void 0 : _a.call(toastOptions, data === null || data === void 0 ? void 0 : data.id);
56
+ },
54
57
  autoClose: (toasterProps === null || toasterProps === void 0 ? void 0 : toasterProps.loading) ? false : constants_1.AUTO_CLOSE_TIME[type],
55
- containerId: containerId || `${constants_1.TOASTER_CONTAINER_PREFIX}${type}`,
56
- draggable: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.draggable,
57
- draggableDirection: type === constants_1.TOASTER_TYPE.UserAction ? 'y' : 'x',
58
- draggablePercent: 30
58
+ containerId: containerId || `${constants_1.TOASTER_CONTAINER_PREFIX}${type}`
59
59
  };
60
60
  }
61
61
  function getToastComponent(_ref3) {
@@ -150,8 +150,7 @@ const userAction = {
150
150
  }),
151
151
  toastOptions: {
152
152
  id: options.id,
153
- onClose: options.onClose,
154
- draggable: options.draggable
153
+ onClose: options.onClose
155
154
  }
156
155
  });
157
156
  },
@@ -163,8 +162,7 @@ const userAction = {
163
162
  }),
164
163
  toastOptions: {
165
164
  id: options.id,
166
- onClose: options.onClose,
167
- draggable: options.draggable
165
+ onClose: options.onClose
168
166
  }
169
167
  });
170
168
  },
@@ -176,8 +174,7 @@ const userAction = {
176
174
  }),
177
175
  toastOptions: {
178
176
  id: options.id,
179
- onClose: options.onClose,
180
- draggable: options.draggable
177
+ onClose: options.onClose
181
178
  }
182
179
  });
183
180
  },
@@ -189,8 +186,7 @@ const userAction = {
189
186
  }),
190
187
  toastOptions: {
191
188
  id: options.id,
192
- onClose: options.onClose,
193
- draggable: options.draggable
189
+ onClose: options.onClose
194
190
  }
195
191
  });
196
192
  },
@@ -200,10 +196,7 @@ const userAction = {
200
196
  type: constants_1.TOASTER_TYPE.UserAction,
201
197
  toasterProps: Object.assign(Object.assign({}, options), {
202
198
  appearance: 'success'
203
- }),
204
- toastOptions: {
205
- draggable: options.draggable
206
- }
199
+ })
207
200
  });
208
201
  },
209
202
  neutral(id, options) {
@@ -211,10 +204,7 @@ const userAction = {
211
204
  type: constants_1.TOASTER_TYPE.UserAction,
212
205
  toasterProps: Object.assign(Object.assign({}, options), {
213
206
  appearance: 'neutral'
214
- }),
215
- toastOptions: {
216
- draggable: options.draggable
217
- }
207
+ })
218
208
  });
219
209
  },
220
210
  warning(id, options) {
@@ -222,10 +212,7 @@ const userAction = {
222
212
  type: constants_1.TOASTER_TYPE.UserAction,
223
213
  toasterProps: Object.assign(Object.assign({}, options), {
224
214
  appearance: 'warning'
225
- }),
226
- toastOptions: {
227
- draggable: options.draggable
228
- }
215
+ })
229
216
  });
230
217
  },
231
218
  error(id, options) {
@@ -233,10 +220,7 @@ const userAction = {
233
220
  type: constants_1.TOASTER_TYPE.UserAction,
234
221
  toasterProps: Object.assign(Object.assign({}, options), {
235
222
  appearance: 'error'
236
- }),
237
- toastOptions: {
238
- draggable: options.draggable
239
- }
223
+ })
240
224
  });
241
225
  }
242
226
  },
@@ -253,8 +237,7 @@ const systemEvent = {
253
237
  }),
254
238
  toastOptions: {
255
239
  id: options.id,
256
- onClose: options.onClose,
257
- draggable: options.draggable
240
+ onClose: options.onClose
258
241
  }
259
242
  });
260
243
  },
@@ -266,8 +249,7 @@ const systemEvent = {
266
249
  }),
267
250
  toastOptions: {
268
251
  id: options.id,
269
- onClose: options.onClose,
270
- draggable: options.draggable
252
+ onClose: options.onClose
271
253
  }
272
254
  });
273
255
  },
@@ -279,8 +261,7 @@ const systemEvent = {
279
261
  }),
280
262
  toastOptions: {
281
263
  id: options.id,
282
- onClose: options.onClose,
283
- draggable: options.draggable
264
+ onClose: options.onClose
284
265
  }
285
266
  });
286
267
  },
@@ -292,8 +273,7 @@ const systemEvent = {
292
273
  }),
293
274
  toastOptions: {
294
275
  id: options.id,
295
- onClose: options.onClose,
296
- draggable: options.draggable
276
+ onClose: options.onClose
297
277
  }
298
278
  });
299
279
  },
@@ -305,8 +285,7 @@ const systemEvent = {
305
285
  }),
306
286
  toastOptions: {
307
287
  id: options.id,
308
- onClose: options.onClose,
309
- draggable: options.draggable
288
+ onClose: options.onClose
310
289
  }
311
290
  });
312
291
  },
@@ -316,10 +295,7 @@ const systemEvent = {
316
295
  type: constants_1.TOASTER_TYPE.SystemEvent,
317
296
  toasterProps: Object.assign(Object.assign({}, options), {
318
297
  appearance: 'success'
319
- }),
320
- toastOptions: {
321
- draggable: options.draggable
322
- }
298
+ })
323
299
  });
324
300
  },
325
301
  neutral(id, options) {
@@ -7,8 +7,7 @@ export type PromisedId = Promise<ToasterId>;
7
7
  export type ToastOptions = {
8
8
  id?: ToasterId;
9
9
  autoClose?: RtToastOptions['autoClose'];
10
- onClose?(reason?: boolean | string): void;
11
- draggable?: boolean;
10
+ onClose?(id?: ToasterId): void;
12
11
  };
13
12
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
14
13
  export type ToasterPropsMap = {
@@ -35,8 +34,8 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(id: string | number,
35
34
  toastOptions?: ToastOptions;
36
35
  containerId?: ToasterContainerProps['containerId'];
37
36
  }) => void;
38
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
37
+ export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
+ export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
40
39
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
41
40
  export type Toaster = {
42
41
  userAction: {
@@ -7,6 +7,5 @@ export type ToasterContainerProps = {
7
7
  containerId?: RtToastContainerProps['containerId'];
8
8
  displayCloseAllButton?: boolean;
9
9
  type?: ToasterType;
10
- draggable?: boolean;
11
10
  };
12
- export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, draggable, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,19 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import './style.css';
3
3
  import cn from 'classnames';
4
- import { useState } from 'react';
4
+ import { useEffect, useState } from 'react';
5
5
  import { toast, ToastContainer as RtToastContainer, } from 'react-toastify';
6
- import { useLayoutEffect } from '@snack-uikit/utils';
7
6
  import { TOASTER_CONTAINER_PREFIX, TOASTER_TYPE } from '../../constants';
8
7
  import { TOAST_SYSTEM_EVENT_TEST_IDS } from '../../testIds';
9
8
  import styles from './styles.module.css';
10
- export function ToasterContainer({ position = 'bottom-right', limit = 5, containerId, displayCloseAllButton, type = TOASTER_TYPE.SystemEvent, draggable = false, }) {
9
+ export function ToasterContainer({ position = 'bottom-right', limit = 5, containerId, displayCloseAllButton, type = TOASTER_TYPE.SystemEvent, }) {
11
10
  const [notificationCounter, setNotificationCounter] = useState(0);
12
11
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = useState(false);
13
12
  const closeAll = () => {
14
13
  toast.dismiss();
15
14
  setIsCloseAllButtonHidden(true);
16
15
  };
17
- useLayoutEffect(() => {
16
+ useEffect(() => {
18
17
  const unsubscribe = toast.onChange(({ status, containerId }) => {
19
18
  if (containerId === `${TOASTER_CONTAINER_PREFIX}${TOASTER_TYPE.SystemEvent}`) {
20
19
  if (status === 'added') {
@@ -29,10 +28,10 @@ export function ToasterContainer({ position = 'bottom-right', limit = 5, contain
29
28
  return unsubscribe;
30
29
  }, []);
31
30
  const hasCloseAllButton = displayCloseAllButton && notificationCounter > 2 && !isCloseAllButtonHidden;
32
- return (_jsxs(_Fragment, { children: [_jsx(RtToastContainer, { hideProgressBar: true, closeOnClick: false, autoClose: false, closeButton: false, draggable: draggable, className: cn('osThemeSnack', styles[position], {
31
+ return (_jsxs(_Fragment, { children: [_jsx(RtToastContainer, { hideProgressBar: true, closeOnClick: false, autoClose: false, closeButton: false, draggable: false, className: cn('osThemeSnack', styles[position], {
33
32
  [styles.containerWithCloseAllButton]: hasCloseAllButton,
34
33
  'osThemeSnack__toast-container__system-event': type === TOASTER_TYPE.SystemEvent,
35
34
  'osThemeSnack__toast-container__user-action': type === TOASTER_TYPE.UserAction,
36
35
  'osThemeSnack__toast-container__upload': type === TOASTER_TYPE.Upload,
37
- }), toastClassName: styles.toaster, position: position, limit: limit, containerId: containerId }), hasCloseAllButton && (_jsx("div", { className: cn(styles.buttonCloseColumnWrapper, styles[position]), children: _jsx("button", { type: 'button', className: styles.buttonCloseColumn, onClick: closeAll, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonCloseColumn, children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u0435" }) }))] }));
36
+ }), toastClassName: styles.toaster, bodyClassName: styles.toaster, position: position, limit: limit, containerId: containerId }), hasCloseAllButton && (_jsx("div", { className: cn(styles.buttonCloseColumnWrapper, styles[position]), children: _jsx("button", { type: 'button', className: styles.buttonCloseColumn, onClick: closeAll, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonCloseColumn, children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u0435" }) }))] }));
38
37
  }
@@ -66,7 +66,6 @@
66
66
  }
67
67
  :global .osThemeSnack.Toastify__toast-container{
68
68
  position:fixed;
69
- left:auto;
70
69
  box-sizing:border-box;
71
70
  padding:0;
72
71
  }
@@ -80,7 +79,6 @@
80
79
  display:flex;
81
80
  justify-content:space-between;
82
81
  box-sizing:border-box;
83
- width:100%;
84
82
  min-height:unset;
85
83
  margin:0;
86
84
  padding:0;
@@ -7,5 +7,5 @@ export declare const updateToast: UpdateToast;
7
7
  * @function
8
8
  */
9
9
  export declare const dismissToast: (params?: Id) => void;
10
- export declare const isToastActive: (id: Id, containerId?: Id) => boolean;
10
+ export declare const isToastActive: typeof import("react-toastify/dist/core/store").isToastActive;
11
11
  export declare const toaster: Toaster;
@@ -34,12 +34,12 @@ function getToasterContainer({ type, toasterParent, containerProps, }) {
34
34
  function getToastOptions({ type, toastOptions, containerId, toasterProps, }) {
35
35
  return {
36
36
  toastId: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.id,
37
- onClose: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.onClose,
37
+ onClose: ((data) => {
38
+ var _a;
39
+ (_a = toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.onClose) === null || _a === void 0 ? void 0 : _a.call(toastOptions, data === null || data === void 0 ? void 0 : data.id);
40
+ }),
38
41
  autoClose: (toasterProps === null || toasterProps === void 0 ? void 0 : toasterProps.loading) ? false : AUTO_CLOSE_TIME[type],
39
42
  containerId: containerId || `${TOASTER_CONTAINER_PREFIX}${type}`,
40
- draggable: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.draggable,
41
- draggableDirection: type === TOASTER_TYPE.UserAction ? 'y' : 'x',
42
- draggablePercent: 30,
43
43
  };
44
44
  }
45
45
  function getToastComponent({ type, toasterProps, }) {
@@ -100,7 +100,6 @@ const userAction = {
100
100
  toastOptions: {
101
101
  id: options.id,
102
102
  onClose: options.onClose,
103
- draggable: options.draggable,
104
103
  },
105
104
  });
106
105
  },
@@ -111,7 +110,6 @@ const userAction = {
111
110
  toastOptions: {
112
111
  id: options.id,
113
112
  onClose: options.onClose,
114
- draggable: options.draggable,
115
113
  },
116
114
  });
117
115
  },
@@ -122,7 +120,6 @@ const userAction = {
122
120
  toastOptions: {
123
121
  id: options.id,
124
122
  onClose: options.onClose,
125
- draggable: options.draggable,
126
123
  },
127
124
  });
128
125
  },
@@ -133,7 +130,6 @@ const userAction = {
133
130
  toastOptions: {
134
131
  id: options.id,
135
132
  onClose: options.onClose,
136
- draggable: options.draggable,
137
133
  },
138
134
  });
139
135
  },
@@ -142,36 +138,24 @@ const userAction = {
142
138
  updateToast(id, {
143
139
  type: TOASTER_TYPE.UserAction,
144
140
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
145
- toastOptions: {
146
- draggable: options.draggable,
147
- },
148
141
  });
149
142
  },
150
143
  neutral(id, options) {
151
144
  updateToast(id, {
152
145
  type: TOASTER_TYPE.UserAction,
153
146
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'neutral' }),
154
- toastOptions: {
155
- draggable: options.draggable,
156
- },
157
147
  });
158
148
  },
159
149
  warning(id, options) {
160
150
  updateToast(id, {
161
151
  type: TOASTER_TYPE.UserAction,
162
152
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'warning' }),
163
- toastOptions: {
164
- draggable: options.draggable,
165
- },
166
153
  });
167
154
  },
168
155
  error(id, options) {
169
156
  updateToast(id, {
170
157
  type: TOASTER_TYPE.UserAction,
171
158
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'error' }),
172
- toastOptions: {
173
- draggable: options.draggable,
174
- },
175
159
  });
176
160
  },
177
161
  },
@@ -187,7 +171,6 @@ const systemEvent = {
187
171
  toastOptions: {
188
172
  id: options.id,
189
173
  onClose: options.onClose,
190
- draggable: options.draggable,
191
174
  },
192
175
  });
193
176
  },
@@ -198,7 +181,6 @@ const systemEvent = {
198
181
  toastOptions: {
199
182
  id: options.id,
200
183
  onClose: options.onClose,
201
- draggable: options.draggable,
202
184
  },
203
185
  });
204
186
  },
@@ -209,7 +191,6 @@ const systemEvent = {
209
191
  toastOptions: {
210
192
  id: options.id,
211
193
  onClose: options.onClose,
212
- draggable: options.draggable,
213
194
  },
214
195
  });
215
196
  },
@@ -220,7 +201,6 @@ const systemEvent = {
220
201
  toastOptions: {
221
202
  id: options.id,
222
203
  onClose: options.onClose,
223
- draggable: options.draggable,
224
204
  },
225
205
  });
226
206
  },
@@ -231,7 +211,6 @@ const systemEvent = {
231
211
  toastOptions: {
232
212
  id: options.id,
233
213
  onClose: options.onClose,
234
- draggable: options.draggable,
235
214
  },
236
215
  });
237
216
  },
@@ -240,9 +219,6 @@ const systemEvent = {
240
219
  return updateToast(id, {
241
220
  type: TOASTER_TYPE.SystemEvent,
242
221
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
243
- toastOptions: {
244
- draggable: options.draggable,
245
- },
246
222
  });
247
223
  },
248
224
  neutral(id, options) {
@@ -7,8 +7,7 @@ export type PromisedId = Promise<ToasterId>;
7
7
  export type ToastOptions = {
8
8
  id?: ToasterId;
9
9
  autoClose?: RtToastOptions['autoClose'];
10
- onClose?(reason?: boolean | string): void;
11
- draggable?: boolean;
10
+ onClose?(id?: ToasterId): void;
12
11
  };
13
12
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
14
13
  export type ToasterPropsMap = {
@@ -35,8 +34,8 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(id: string | number,
35
34
  toastOptions?: ToastOptions;
36
35
  containerId?: ToasterContainerProps['containerId'];
37
36
  }) => void;
38
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
37
+ export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
+ export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
40
39
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
41
40
  export type Toaster = {
42
41
  userAction: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Toaster",
7
- "version": "0.11.21-preview-83f569e2.0",
7
+ "version": "0.11.21",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -36,20 +36,20 @@
36
36
  "license": "Apache-2.0",
37
37
  "scripts": {},
38
38
  "dependencies": {
39
- "@snack-uikit/icons": "0.27.4",
40
- "@snack-uikit/link": "0.17.15",
41
- "@snack-uikit/loaders": "0.9.9",
42
- "@snack-uikit/progress-bar": "0.1.10",
43
- "@snack-uikit/scroll": "0.10.5",
44
- "@snack-uikit/truncate-string": "0.7.6",
45
- "@snack-uikit/utils": "4.0.0",
39
+ "@snack-uikit/icons": "0.27.5",
40
+ "@snack-uikit/link": "0.17.16",
41
+ "@snack-uikit/loaders": "0.9.10",
42
+ "@snack-uikit/progress-bar": "0.1.11",
43
+ "@snack-uikit/scroll": "0.10.6",
44
+ "@snack-uikit/truncate-string": "0.7.7",
45
+ "@snack-uikit/utils": "4.0.1",
46
46
  "classnames": "2.5.1",
47
- "react-draggable": "4.5.0",
48
- "react-toastify": "11.0.5",
47
+ "react-draggable": "4.4.6",
48
+ "react-toastify": "10.0.5",
49
49
  "uncontrollable": "9.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@snack-uikit/locale": "*"
53
53
  },
54
- "gitHead": "7e7545cd231d23db02cc090a3199a142383ecfc0"
54
+ "gitHead": "84371bbf91915f650a852df849cd71d416c5b7b2"
55
55
  }
@@ -1,7 +1,7 @@
1
1
  import './style.css';
2
2
 
3
3
  import cn from 'classnames';
4
- import { useState } from 'react';
4
+ import { useEffect, useState } from 'react';
5
5
  import {
6
6
  toast,
7
7
  ToastContainer as RtToastContainer,
@@ -10,8 +10,6 @@ import {
10
10
  ToastPosition,
11
11
  } from 'react-toastify';
12
12
 
13
- import { useLayoutEffect } from '@snack-uikit/utils';
14
-
15
13
  import { TOASTER_CONTAINER_PREFIX, TOASTER_TYPE } from '../../constants';
16
14
  import { TOAST_SYSTEM_EVENT_TEST_IDS } from '../../testIds';
17
15
  import { ToasterType } from '../../types';
@@ -23,7 +21,6 @@ export type ToasterContainerProps = {
23
21
  containerId?: RtToastContainerProps['containerId'];
24
22
  displayCloseAllButton?: boolean;
25
23
  type?: ToasterType;
26
- draggable?: boolean;
27
24
  };
28
25
 
29
26
  export function ToasterContainer({
@@ -32,7 +29,6 @@ export function ToasterContainer({
32
29
  containerId,
33
30
  displayCloseAllButton,
34
31
  type = TOASTER_TYPE.SystemEvent,
35
- draggable = false,
36
32
  }: ToasterContainerProps) {
37
33
  const [notificationCounter, setNotificationCounter] = useState(0);
38
34
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = useState(false);
@@ -41,7 +37,7 @@ export function ToasterContainer({
41
37
  setIsCloseAllButtonHidden(true);
42
38
  };
43
39
 
44
- useLayoutEffect(() => {
40
+ useEffect(() => {
45
41
  const unsubscribe = toast.onChange(({ status, containerId }: ToastItem) => {
46
42
  if (containerId === `${TOASTER_CONTAINER_PREFIX}${TOASTER_TYPE.SystemEvent}`) {
47
43
  if (status === 'added') {
@@ -66,7 +62,7 @@ export function ToasterContainer({
66
62
  closeOnClick={false}
67
63
  autoClose={false}
68
64
  closeButton={false}
69
- draggable={draggable}
65
+ draggable={false}
70
66
  className={cn('osThemeSnack', styles[position], {
71
67
  [styles.containerWithCloseAllButton]: hasCloseAllButton,
72
68
  'osThemeSnack__toast-container__system-event': type === TOASTER_TYPE.SystemEvent,
@@ -74,6 +70,7 @@ export function ToasterContainer({
74
70
  'osThemeSnack__toast-container__upload': type === TOASTER_TYPE.Upload,
75
71
  })}
76
72
  toastClassName={styles.toaster}
73
+ bodyClassName={styles.toaster}
77
74
  position={position}
78
75
  limit={limit}
79
76
  containerId={containerId}
@@ -76,7 +76,6 @@ $theme-name: osThemeSnack;
76
76
  :global {
77
77
  .#{$theme-name}.Toastify__toast-container {
78
78
  position: fixed;
79
- left: auto;
80
79
  box-sizing: border-box;
81
80
  padding: 0;
82
81
 
@@ -95,7 +94,6 @@ $theme-name: osThemeSnack;
95
94
  justify-content: space-between;
96
95
 
97
96
  box-sizing: border-box;
98
- width: 100%;
99
97
  min-height: unset;
100
98
  margin: 0;
101
99
  padding: 0;
package/src/helpers.tsx CHANGED
@@ -80,12 +80,11 @@ function getToastOptions<T extends keyof ToasterPropsMap>({
80
80
  }): RtToastOptions {
81
81
  return {
82
82
  toastId: toastOptions?.id,
83
- onClose: toastOptions?.onClose,
83
+ onClose: ((data: { id: ToasterId }) => {
84
+ toastOptions?.onClose?.(data?.id);
85
+ }) as RtToastOptions['onClose'],
84
86
  autoClose: toasterProps?.loading ? false : AUTO_CLOSE_TIME[type],
85
87
  containerId: containerId || `${TOASTER_CONTAINER_PREFIX}${type}`,
86
- draggable: toastOptions?.draggable,
87
- draggableDirection: type === TOASTER_TYPE.UserAction ? 'y' : 'x',
88
- draggablePercent: 30,
89
88
  };
90
89
  }
91
90
 
@@ -173,7 +172,6 @@ const userAction = {
173
172
  toastOptions: {
174
173
  id: options.id,
175
174
  onClose: options.onClose,
176
- draggable: options.draggable,
177
175
  },
178
176
  });
179
177
  },
@@ -185,7 +183,6 @@ const userAction = {
185
183
  toastOptions: {
186
184
  id: options.id,
187
185
  onClose: options.onClose,
188
- draggable: options.draggable,
189
186
  },
190
187
  });
191
188
  },
@@ -197,7 +194,6 @@ const userAction = {
197
194
  toastOptions: {
198
195
  id: options.id,
199
196
  onClose: options.onClose,
200
- draggable: options.draggable,
201
197
  },
202
198
  });
203
199
  },
@@ -209,7 +205,6 @@ const userAction = {
209
205
  toastOptions: {
210
206
  id: options.id,
211
207
  onClose: options.onClose,
212
- draggable: options.draggable,
213
208
  },
214
209
  });
215
210
  },
@@ -219,9 +214,6 @@ const userAction = {
219
214
  updateToast(id, {
220
215
  type: TOASTER_TYPE.UserAction,
221
216
  toasterProps: { ...options, appearance: 'success' },
222
- toastOptions: {
223
- draggable: options.draggable,
224
- },
225
217
  });
226
218
  },
227
219
 
@@ -229,9 +221,6 @@ const userAction = {
229
221
  updateToast(id, {
230
222
  type: TOASTER_TYPE.UserAction,
231
223
  toasterProps: { ...options, appearance: 'neutral' },
232
- toastOptions: {
233
- draggable: options.draggable,
234
- },
235
224
  });
236
225
  },
237
226
 
@@ -239,9 +228,6 @@ const userAction = {
239
228
  updateToast(id, {
240
229
  type: TOASTER_TYPE.UserAction,
241
230
  toasterProps: { ...options, appearance: 'warning' },
242
- toastOptions: {
243
- draggable: options.draggable,
244
- },
245
231
  });
246
232
  },
247
233
 
@@ -249,9 +235,6 @@ const userAction = {
249
235
  updateToast(id, {
250
236
  type: TOASTER_TYPE.UserAction,
251
237
  toasterProps: { ...options, appearance: 'error' },
252
- toastOptions: {
253
- draggable: options.draggable,
254
- },
255
238
  });
256
239
  },
257
240
  },
@@ -269,7 +252,6 @@ const systemEvent = {
269
252
  toastOptions: {
270
253
  id: options.id,
271
254
  onClose: options.onClose,
272
- draggable: options.draggable,
273
255
  },
274
256
  });
275
257
  },
@@ -281,7 +263,6 @@ const systemEvent = {
281
263
  toastOptions: {
282
264
  id: options.id,
283
265
  onClose: options.onClose,
284
- draggable: options.draggable,
285
266
  },
286
267
  });
287
268
  },
@@ -293,7 +274,6 @@ const systemEvent = {
293
274
  toastOptions: {
294
275
  id: options.id,
295
276
  onClose: options.onClose,
296
- draggable: options.draggable,
297
277
  },
298
278
  });
299
279
  },
@@ -305,7 +285,6 @@ const systemEvent = {
305
285
  toastOptions: {
306
286
  id: options.id,
307
287
  onClose: options.onClose,
308
- draggable: options.draggable,
309
288
  },
310
289
  });
311
290
  },
@@ -317,7 +296,6 @@ const systemEvent = {
317
296
  toastOptions: {
318
297
  id: options.id,
319
298
  onClose: options.onClose,
320
- draggable: options.draggable,
321
299
  },
322
300
  });
323
301
  },
@@ -327,9 +305,6 @@ const systemEvent = {
327
305
  return updateToast(id, {
328
306
  type: TOASTER_TYPE.SystemEvent,
329
307
  toasterProps: { ...options, appearance: 'success' },
330
- toastOptions: {
331
- draggable: options.draggable,
332
- },
333
308
  });
334
309
  },
335
310
 
package/src/types.ts CHANGED
@@ -11,8 +11,7 @@ export type PromisedId = Promise<ToasterId>;
11
11
  export type ToastOptions = {
12
12
  id?: ToasterId;
13
13
  autoClose?: RtToastOptions['autoClose'];
14
- onClose?(reason?: boolean | string): void;
15
- draggable?: boolean;
14
+ onClose?(id?: ToasterId): void;
16
15
  };
17
16
 
18
17
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
@@ -49,10 +48,8 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(
49
48
  },
50
49
  ) => void;
51
50
 
52
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> &
53
- Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
54
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> &
55
- Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
51
+ export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
52
+ export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
56
53
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
57
54
 
58
55
  export type Toaster = {