@snack-uikit/toaster 0.11.14 → 0.11.15-preview-b2ccf94a.0

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/README.md CHANGED
@@ -83,6 +83,7 @@ toaster.upload.dismiss(uploadToastId);
83
83
  | containerId | `Id` | - | |
84
84
  | displayCloseAllButton | `boolean` | - | |
85
85
  | type | enum ToasterType: `"system-event"`, `"user-action"`, `"upload"` | system-event | |
86
+ | draggable | `boolean` | - | |
86
87
  ## ToastUpload
87
88
  ### Props
88
89
  | name | type | default value | description |
@@ -7,5 +7,6 @@ export type ToasterContainerProps = {
7
7
  containerId?: RtToastContainerProps['containerId'];
8
8
  displayCloseAllButton?: boolean;
9
9
  type?: ToasterType;
10
+ draggable?: boolean;
10
11
  };
11
- export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, draggable, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -14,6 +14,7 @@ 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");
17
18
  const constants_1 = require("../../constants");
18
19
  const testIds_1 = require("../../testIds");
19
20
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
@@ -23,7 +24,8 @@ function ToasterContainer(_ref) {
23
24
  limit = 5,
24
25
  containerId,
25
26
  displayCloseAllButton,
26
- type = constants_1.TOASTER_TYPE.SystemEvent
27
+ type = constants_1.TOASTER_TYPE.SystemEvent,
28
+ draggable = false
27
29
  } = _ref;
28
30
  const [notificationCounter, setNotificationCounter] = (0, react_1.useState)(0);
29
31
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = (0, react_1.useState)(false);
@@ -31,7 +33,7 @@ function ToasterContainer(_ref) {
31
33
  react_toastify_1.toast.dismiss();
32
34
  setIsCloseAllButtonHidden(true);
33
35
  };
34
- (0, react_1.useEffect)(() => {
36
+ (0, utils_1.useLayoutEffect)(() => {
35
37
  const unsubscribe = react_toastify_1.toast.onChange(_ref2 => {
36
38
  let {
37
39
  status,
@@ -56,7 +58,7 @@ function ToasterContainer(_ref) {
56
58
  closeOnClick: false,
57
59
  autoClose: false,
58
60
  closeButton: false,
59
- draggable: false,
61
+ draggable: draggable,
60
62
  className: (0, classnames_1.default)('osThemeSnack', styles_module_scss_1.default[position], {
61
63
  [styles_module_scss_1.default.containerWithCloseAllButton]: hasCloseAllButton,
62
64
  'osThemeSnack__toast-container__system-event': type === constants_1.TOASTER_TYPE.SystemEvent,
@@ -55,7 +55,10 @@ function getToastOptions(_ref2) {
55
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
56
  },
57
57
  autoClose: (toasterProps === null || toasterProps === void 0 ? void 0 : toasterProps.loading) ? false : constants_1.AUTO_CLOSE_TIME[type],
58
- containerId: containerId || `${constants_1.TOASTER_CONTAINER_PREFIX}${type}`
58
+ containerId: containerId || `${constants_1.TOASTER_CONTAINER_PREFIX}${type}`,
59
+ draggable: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.draggable,
60
+ draggableDirection: type === constants_1.TOASTER_TYPE.UserAction ? 'y' : 'x',
61
+ draggablePercent: 20
59
62
  };
60
63
  }
61
64
  function getToastComponent(_ref3) {
@@ -150,7 +153,8 @@ const userAction = {
150
153
  }),
151
154
  toastOptions: {
152
155
  id: options.id,
153
- onClose: options.onClose
156
+ onClose: options.onClose,
157
+ draggable: options.draggable
154
158
  }
155
159
  });
156
160
  },
@@ -162,7 +166,8 @@ const userAction = {
162
166
  }),
163
167
  toastOptions: {
164
168
  id: options.id,
165
- onClose: options.onClose
169
+ onClose: options.onClose,
170
+ draggable: options.draggable
166
171
  }
167
172
  });
168
173
  },
@@ -174,7 +179,8 @@ const userAction = {
174
179
  }),
175
180
  toastOptions: {
176
181
  id: options.id,
177
- onClose: options.onClose
182
+ onClose: options.onClose,
183
+ draggable: options.draggable
178
184
  }
179
185
  });
180
186
  },
@@ -186,7 +192,8 @@ const userAction = {
186
192
  }),
187
193
  toastOptions: {
188
194
  id: options.id,
189
- onClose: options.onClose
195
+ onClose: options.onClose,
196
+ draggable: options.draggable
190
197
  }
191
198
  });
192
199
  },
@@ -196,7 +203,10 @@ const userAction = {
196
203
  type: constants_1.TOASTER_TYPE.UserAction,
197
204
  toasterProps: Object.assign(Object.assign({}, options), {
198
205
  appearance: 'success'
199
- })
206
+ }),
207
+ toastOptions: {
208
+ draggable: options.draggable
209
+ }
200
210
  });
201
211
  },
202
212
  neutral(id, options) {
@@ -204,7 +214,10 @@ const userAction = {
204
214
  type: constants_1.TOASTER_TYPE.UserAction,
205
215
  toasterProps: Object.assign(Object.assign({}, options), {
206
216
  appearance: 'neutral'
207
- })
217
+ }),
218
+ toastOptions: {
219
+ draggable: options.draggable
220
+ }
208
221
  });
209
222
  },
210
223
  warning(id, options) {
@@ -212,7 +225,10 @@ const userAction = {
212
225
  type: constants_1.TOASTER_TYPE.UserAction,
213
226
  toasterProps: Object.assign(Object.assign({}, options), {
214
227
  appearance: 'warning'
215
- })
228
+ }),
229
+ toastOptions: {
230
+ draggable: options.draggable
231
+ }
216
232
  });
217
233
  },
218
234
  error(id, options) {
@@ -220,7 +236,10 @@ const userAction = {
220
236
  type: constants_1.TOASTER_TYPE.UserAction,
221
237
  toasterProps: Object.assign(Object.assign({}, options), {
222
238
  appearance: 'error'
223
- })
239
+ }),
240
+ toastOptions: {
241
+ draggable: options.draggable
242
+ }
224
243
  });
225
244
  }
226
245
  },
@@ -237,7 +256,8 @@ const systemEvent = {
237
256
  }),
238
257
  toastOptions: {
239
258
  id: options.id,
240
- onClose: options.onClose
259
+ onClose: options.onClose,
260
+ draggable: options.draggable
241
261
  }
242
262
  });
243
263
  },
@@ -249,7 +269,8 @@ const systemEvent = {
249
269
  }),
250
270
  toastOptions: {
251
271
  id: options.id,
252
- onClose: options.onClose
272
+ onClose: options.onClose,
273
+ draggable: options.draggable
253
274
  }
254
275
  });
255
276
  },
@@ -261,7 +282,8 @@ const systemEvent = {
261
282
  }),
262
283
  toastOptions: {
263
284
  id: options.id,
264
- onClose: options.onClose
285
+ onClose: options.onClose,
286
+ draggable: options.draggable
265
287
  }
266
288
  });
267
289
  },
@@ -273,7 +295,8 @@ const systemEvent = {
273
295
  }),
274
296
  toastOptions: {
275
297
  id: options.id,
276
- onClose: options.onClose
298
+ onClose: options.onClose,
299
+ draggable: options.draggable
277
300
  }
278
301
  });
279
302
  },
@@ -285,7 +308,8 @@ const systemEvent = {
285
308
  }),
286
309
  toastOptions: {
287
310
  id: options.id,
288
- onClose: options.onClose
311
+ onClose: options.onClose,
312
+ draggable: options.draggable
289
313
  }
290
314
  });
291
315
  },
@@ -295,7 +319,10 @@ const systemEvent = {
295
319
  type: constants_1.TOASTER_TYPE.SystemEvent,
296
320
  toasterProps: Object.assign(Object.assign({}, options), {
297
321
  appearance: 'success'
298
- })
322
+ }),
323
+ toastOptions: {
324
+ draggable: options.draggable
325
+ }
299
326
  });
300
327
  },
301
328
  neutral(id, options) {
@@ -8,6 +8,7 @@ export type ToastOptions = {
8
8
  id?: ToasterId;
9
9
  autoClose?: RtToastOptions['autoClose'];
10
10
  onClose?(id?: ToasterId): void;
11
+ draggable?: boolean;
11
12
  };
12
13
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
13
14
  export type ToasterPropsMap = {
@@ -34,8 +35,8 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(id: string | number,
34
35
  toastOptions?: ToastOptions;
35
36
  containerId?: ToasterContainerProps['containerId'];
36
37
  }) => void;
37
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
+ export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
+ export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
40
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
40
41
  export type Toaster = {
41
42
  userAction: {
@@ -7,5 +7,6 @@ export type ToasterContainerProps = {
7
7
  containerId?: RtToastContainerProps['containerId'];
8
8
  displayCloseAllButton?: boolean;
9
9
  type?: ToasterType;
10
+ draggable?: boolean;
10
11
  };
11
- export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ToasterContainer({ position, limit, containerId, displayCloseAllButton, type, draggable, }: ToasterContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,20 @@
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 { useEffect, useState } from 'react';
4
+ import { useState } from 'react';
5
5
  import { toast, ToastContainer as RtToastContainer, } from 'react-toastify';
6
+ import { useLayoutEffect } from '@snack-uikit/utils';
6
7
  import { TOASTER_CONTAINER_PREFIX, TOASTER_TYPE } from '../../constants';
7
8
  import { TOAST_SYSTEM_EVENT_TEST_IDS } from '../../testIds';
8
9
  import styles from './styles.module.css';
9
- export function ToasterContainer({ position = 'bottom-right', limit = 5, containerId, displayCloseAllButton, type = TOASTER_TYPE.SystemEvent, }) {
10
+ export function ToasterContainer({ position = 'bottom-right', limit = 5, containerId, displayCloseAllButton, type = TOASTER_TYPE.SystemEvent, draggable = false, }) {
10
11
  const [notificationCounter, setNotificationCounter] = useState(0);
11
12
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = useState(false);
12
13
  const closeAll = () => {
13
14
  toast.dismiss();
14
15
  setIsCloseAllButtonHidden(true);
15
16
  };
16
- useEffect(() => {
17
+ useLayoutEffect(() => {
17
18
  const unsubscribe = toast.onChange(({ status, containerId }) => {
18
19
  if (containerId === `${TOASTER_CONTAINER_PREFIX}${TOASTER_TYPE.SystemEvent}`) {
19
20
  if (status === 'added') {
@@ -28,7 +29,7 @@ export function ToasterContainer({ position = 'bottom-right', limit = 5, contain
28
29
  return unsubscribe;
29
30
  }, []);
30
31
  const hasCloseAllButton = displayCloseAllButton && notificationCounter > 2 && !isCloseAllButtonHidden;
31
- return (_jsxs(_Fragment, { children: [_jsx(RtToastContainer, { hideProgressBar: true, closeOnClick: false, autoClose: false, closeButton: false, draggable: false, className: cn('osThemeSnack', styles[position], {
32
+ return (_jsxs(_Fragment, { children: [_jsx(RtToastContainer, { hideProgressBar: true, closeOnClick: false, autoClose: false, closeButton: false, draggable: draggable, className: cn('osThemeSnack', styles[position], {
32
33
  [styles.containerWithCloseAllButton]: hasCloseAllButton,
33
34
  'osThemeSnack__toast-container__system-event': type === TOASTER_TYPE.SystemEvent,
34
35
  'osThemeSnack__toast-container__user-action': type === TOASTER_TYPE.UserAction,
@@ -40,6 +40,9 @@ function getToastOptions({ type, toastOptions, containerId, toasterProps, }) {
40
40
  }),
41
41
  autoClose: (toasterProps === null || toasterProps === void 0 ? void 0 : toasterProps.loading) ? false : AUTO_CLOSE_TIME[type],
42
42
  containerId: containerId || `${TOASTER_CONTAINER_PREFIX}${type}`,
43
+ draggable: toastOptions === null || toastOptions === void 0 ? void 0 : toastOptions.draggable,
44
+ draggableDirection: type === TOASTER_TYPE.UserAction ? 'y' : 'x',
45
+ draggablePercent: 20,
43
46
  };
44
47
  }
45
48
  function getToastComponent({ type, toasterProps, }) {
@@ -100,6 +103,7 @@ const userAction = {
100
103
  toastOptions: {
101
104
  id: options.id,
102
105
  onClose: options.onClose,
106
+ draggable: options.draggable,
103
107
  },
104
108
  });
105
109
  },
@@ -110,6 +114,7 @@ const userAction = {
110
114
  toastOptions: {
111
115
  id: options.id,
112
116
  onClose: options.onClose,
117
+ draggable: options.draggable,
113
118
  },
114
119
  });
115
120
  },
@@ -120,6 +125,7 @@ const userAction = {
120
125
  toastOptions: {
121
126
  id: options.id,
122
127
  onClose: options.onClose,
128
+ draggable: options.draggable,
123
129
  },
124
130
  });
125
131
  },
@@ -130,6 +136,7 @@ const userAction = {
130
136
  toastOptions: {
131
137
  id: options.id,
132
138
  onClose: options.onClose,
139
+ draggable: options.draggable,
133
140
  },
134
141
  });
135
142
  },
@@ -138,24 +145,36 @@ const userAction = {
138
145
  updateToast(id, {
139
146
  type: TOASTER_TYPE.UserAction,
140
147
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
148
+ toastOptions: {
149
+ draggable: options.draggable,
150
+ },
141
151
  });
142
152
  },
143
153
  neutral(id, options) {
144
154
  updateToast(id, {
145
155
  type: TOASTER_TYPE.UserAction,
146
156
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'neutral' }),
157
+ toastOptions: {
158
+ draggable: options.draggable,
159
+ },
147
160
  });
148
161
  },
149
162
  warning(id, options) {
150
163
  updateToast(id, {
151
164
  type: TOASTER_TYPE.UserAction,
152
165
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'warning' }),
166
+ toastOptions: {
167
+ draggable: options.draggable,
168
+ },
153
169
  });
154
170
  },
155
171
  error(id, options) {
156
172
  updateToast(id, {
157
173
  type: TOASTER_TYPE.UserAction,
158
174
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'error' }),
175
+ toastOptions: {
176
+ draggable: options.draggable,
177
+ },
159
178
  });
160
179
  },
161
180
  },
@@ -171,6 +190,7 @@ const systemEvent = {
171
190
  toastOptions: {
172
191
  id: options.id,
173
192
  onClose: options.onClose,
193
+ draggable: options.draggable,
174
194
  },
175
195
  });
176
196
  },
@@ -181,6 +201,7 @@ const systemEvent = {
181
201
  toastOptions: {
182
202
  id: options.id,
183
203
  onClose: options.onClose,
204
+ draggable: options.draggable,
184
205
  },
185
206
  });
186
207
  },
@@ -191,6 +212,7 @@ const systemEvent = {
191
212
  toastOptions: {
192
213
  id: options.id,
193
214
  onClose: options.onClose,
215
+ draggable: options.draggable,
194
216
  },
195
217
  });
196
218
  },
@@ -201,6 +223,7 @@ const systemEvent = {
201
223
  toastOptions: {
202
224
  id: options.id,
203
225
  onClose: options.onClose,
226
+ draggable: options.draggable,
204
227
  },
205
228
  });
206
229
  },
@@ -211,6 +234,7 @@ const systemEvent = {
211
234
  toastOptions: {
212
235
  id: options.id,
213
236
  onClose: options.onClose,
237
+ draggable: options.draggable,
214
238
  },
215
239
  });
216
240
  },
@@ -219,6 +243,9 @@ const systemEvent = {
219
243
  return updateToast(id, {
220
244
  type: TOASTER_TYPE.SystemEvent,
221
245
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
246
+ toastOptions: {
247
+ draggable: options.draggable,
248
+ },
222
249
  });
223
250
  },
224
251
  neutral(id, options) {
@@ -8,6 +8,7 @@ export type ToastOptions = {
8
8
  id?: ToasterId;
9
9
  autoClose?: RtToastOptions['autoClose'];
10
10
  onClose?(id?: ToasterId): void;
11
+ draggable?: boolean;
11
12
  };
12
13
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
13
14
  export type ToasterPropsMap = {
@@ -34,8 +35,8 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(id: string | number,
34
35
  toastOptions?: ToastOptions;
35
36
  containerId?: ToasterContainerProps['containerId'];
36
37
  }) => void;
37
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
38
+ export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
+ export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose' | 'draggable'>;
39
40
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
40
41
  export type Toaster = {
41
42
  userAction: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Toaster",
7
- "version": "0.11.14",
7
+ "version": "0.11.15-preview-b2ccf94a.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -49,5 +49,5 @@
49
49
  "react-toastify": "10.0.5",
50
50
  "uncontrollable": "9.0.0"
51
51
  },
52
- "gitHead": "6f4dbbdf91fdd49fc8a49ecf0be7a2e7e56ae73b"
52
+ "gitHead": "a5a48e75b322989a38a9248a85af63051c16641e"
53
53
  }
@@ -1,7 +1,7 @@
1
1
  import './style.css';
2
2
 
3
3
  import cn from 'classnames';
4
- import { useEffect, useState } from 'react';
4
+ import { useState } from 'react';
5
5
  import {
6
6
  toast,
7
7
  ToastContainer as RtToastContainer,
@@ -10,6 +10,8 @@ import {
10
10
  ToastPosition,
11
11
  } from 'react-toastify';
12
12
 
13
+ import { useLayoutEffect } from '@snack-uikit/utils';
14
+
13
15
  import { TOASTER_CONTAINER_PREFIX, TOASTER_TYPE } from '../../constants';
14
16
  import { TOAST_SYSTEM_EVENT_TEST_IDS } from '../../testIds';
15
17
  import { ToasterType } from '../../types';
@@ -21,6 +23,7 @@ export type ToasterContainerProps = {
21
23
  containerId?: RtToastContainerProps['containerId'];
22
24
  displayCloseAllButton?: boolean;
23
25
  type?: ToasterType;
26
+ draggable?: boolean;
24
27
  };
25
28
 
26
29
  export function ToasterContainer({
@@ -29,6 +32,7 @@ export function ToasterContainer({
29
32
  containerId,
30
33
  displayCloseAllButton,
31
34
  type = TOASTER_TYPE.SystemEvent,
35
+ draggable = false,
32
36
  }: ToasterContainerProps) {
33
37
  const [notificationCounter, setNotificationCounter] = useState(0);
34
38
  const [isCloseAllButtonHidden, setIsCloseAllButtonHidden] = useState(false);
@@ -37,7 +41,7 @@ export function ToasterContainer({
37
41
  setIsCloseAllButtonHidden(true);
38
42
  };
39
43
 
40
- useEffect(() => {
44
+ useLayoutEffect(() => {
41
45
  const unsubscribe = toast.onChange(({ status, containerId }: ToastItem) => {
42
46
  if (containerId === `${TOASTER_CONTAINER_PREFIX}${TOASTER_TYPE.SystemEvent}`) {
43
47
  if (status === 'added') {
@@ -62,7 +66,7 @@ export function ToasterContainer({
62
66
  closeOnClick={false}
63
67
  autoClose={false}
64
68
  closeButton={false}
65
- draggable={false}
69
+ draggable={draggable}
66
70
  className={cn('osThemeSnack', styles[position], {
67
71
  [styles.containerWithCloseAllButton]: hasCloseAllButton,
68
72
  'osThemeSnack__toast-container__system-event': type === TOASTER_TYPE.SystemEvent,
package/src/helpers.tsx CHANGED
@@ -85,6 +85,9 @@ function getToastOptions<T extends keyof ToasterPropsMap>({
85
85
  }) as RtToastOptions['onClose'],
86
86
  autoClose: toasterProps?.loading ? false : AUTO_CLOSE_TIME[type],
87
87
  containerId: containerId || `${TOASTER_CONTAINER_PREFIX}${type}`,
88
+ draggable: toastOptions?.draggable,
89
+ draggableDirection: type === TOASTER_TYPE.UserAction ? 'y' : 'x',
90
+ draggablePercent: 20,
88
91
  };
89
92
  }
90
93
 
@@ -172,6 +175,7 @@ const userAction = {
172
175
  toastOptions: {
173
176
  id: options.id,
174
177
  onClose: options.onClose,
178
+ draggable: options.draggable,
175
179
  },
176
180
  });
177
181
  },
@@ -183,6 +187,7 @@ const userAction = {
183
187
  toastOptions: {
184
188
  id: options.id,
185
189
  onClose: options.onClose,
190
+ draggable: options.draggable,
186
191
  },
187
192
  });
188
193
  },
@@ -194,6 +199,7 @@ const userAction = {
194
199
  toastOptions: {
195
200
  id: options.id,
196
201
  onClose: options.onClose,
202
+ draggable: options.draggable,
197
203
  },
198
204
  });
199
205
  },
@@ -205,6 +211,7 @@ const userAction = {
205
211
  toastOptions: {
206
212
  id: options.id,
207
213
  onClose: options.onClose,
214
+ draggable: options.draggable,
208
215
  },
209
216
  });
210
217
  },
@@ -214,6 +221,9 @@ const userAction = {
214
221
  updateToast(id, {
215
222
  type: TOASTER_TYPE.UserAction,
216
223
  toasterProps: { ...options, appearance: 'success' },
224
+ toastOptions: {
225
+ draggable: options.draggable,
226
+ },
217
227
  });
218
228
  },
219
229
 
@@ -221,6 +231,9 @@ const userAction = {
221
231
  updateToast(id, {
222
232
  type: TOASTER_TYPE.UserAction,
223
233
  toasterProps: { ...options, appearance: 'neutral' },
234
+ toastOptions: {
235
+ draggable: options.draggable,
236
+ },
224
237
  });
225
238
  },
226
239
 
@@ -228,6 +241,9 @@ const userAction = {
228
241
  updateToast(id, {
229
242
  type: TOASTER_TYPE.UserAction,
230
243
  toasterProps: { ...options, appearance: 'warning' },
244
+ toastOptions: {
245
+ draggable: options.draggable,
246
+ },
231
247
  });
232
248
  },
233
249
 
@@ -235,6 +251,9 @@ const userAction = {
235
251
  updateToast(id, {
236
252
  type: TOASTER_TYPE.UserAction,
237
253
  toasterProps: { ...options, appearance: 'error' },
254
+ toastOptions: {
255
+ draggable: options.draggable,
256
+ },
238
257
  });
239
258
  },
240
259
  },
@@ -252,6 +271,7 @@ const systemEvent = {
252
271
  toastOptions: {
253
272
  id: options.id,
254
273
  onClose: options.onClose,
274
+ draggable: options.draggable,
255
275
  },
256
276
  });
257
277
  },
@@ -263,6 +283,7 @@ const systemEvent = {
263
283
  toastOptions: {
264
284
  id: options.id,
265
285
  onClose: options.onClose,
286
+ draggable: options.draggable,
266
287
  },
267
288
  });
268
289
  },
@@ -274,6 +295,7 @@ const systemEvent = {
274
295
  toastOptions: {
275
296
  id: options.id,
276
297
  onClose: options.onClose,
298
+ draggable: options.draggable,
277
299
  },
278
300
  });
279
301
  },
@@ -285,6 +307,7 @@ const systemEvent = {
285
307
  toastOptions: {
286
308
  id: options.id,
287
309
  onClose: options.onClose,
310
+ draggable: options.draggable,
288
311
  },
289
312
  });
290
313
  },
@@ -296,6 +319,7 @@ const systemEvent = {
296
319
  toastOptions: {
297
320
  id: options.id,
298
321
  onClose: options.onClose,
322
+ draggable: options.draggable,
299
323
  },
300
324
  });
301
325
  },
@@ -305,6 +329,9 @@ const systemEvent = {
305
329
  return updateToast(id, {
306
330
  type: TOASTER_TYPE.SystemEvent,
307
331
  toasterProps: { ...options, appearance: 'success' },
332
+ toastOptions: {
333
+ draggable: options.draggable,
334
+ },
308
335
  });
309
336
  },
310
337
 
package/src/types.ts CHANGED
@@ -12,6 +12,7 @@ export type ToastOptions = {
12
12
  id?: ToasterId;
13
13
  autoClose?: RtToastOptions['autoClose'];
14
14
  onClose?(id?: ToasterId): void;
15
+ draggable?: boolean;
15
16
  };
16
17
 
17
18
  export type ToasterType = ValueOf<typeof TOASTER_TYPE>;
@@ -48,8 +49,10 @@ export type UpdateToast = <T extends keyof ToasterPropsMap>(
48
49
  },
49
50
  ) => void;
50
51
 
51
- export type UserActionOptions = Omit<ToastUserActionProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
52
- export type SystemEventOptions = Omit<ToastSystemEventProps, 'appearance'> & Pick<ToastOptions, 'id' | 'onClose'>;
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'>;
53
56
  export type UploadOptions = ToastUploadProps & Pick<ToastOptions, 'id' | 'onClose'>;
54
57
 
55
58
  export type Toaster = {