@@ -5,6 +5,65 @@ import { TOAST_BASE_CONFIG, TOAST_VARIANT_TO_CONFIG_MAP } from './constants'
5
5
import { ToastContent } from './ToastContent'
6
6
import './toastManager.scss'
7
7
8
+ /**
9
+ * Service for handling toast across the application
10
+ *
11
+ * Note: The application needs to have `ToastManagerContainer` at the root
12
+ * level for the toast to work
13
+ *
14
+ * @example Default Usage
15
+ * ```ts
16
+ * ToastManager.showToast({
17
+ * description: 'Lorem ipsum'
18
+ * })
19
+ * ```
20
+ *
21
+ * @example Custom Title
22
+ * ```ts
23
+ * ToastManager.showToast({
24
+ * description: 'Lorem ipsum',
25
+ * title: 'Toast title'
26
+ * })
27
+ * ```
28
+ *
29
+ * @example With Button
30
+ * ```ts
31
+ * ToastManager.showToast({
32
+ * description: 'Lorem ipsum',
33
+ * buttonProps: {
34
+ * dataTestId: 'toast-btn',
35
+ * text: 'Reload',
36
+ * startIcon: <ICArrowClockwise />
37
+ * }
38
+ * })
39
+ * ```
40
+ *
41
+ * @example Auto close disabled
42
+ * ```ts
43
+ * ToastManager.showToast({
44
+ * description: 'Lorem ipsum',
45
+ * toastOptions: {
46
+ * autoClose: false,
47
+ * },
48
+ * })
49
+ * ```
50
+ *
51
+ * @example Custom progress bar color
52
+ * ```ts
53
+ * ToastManager.showToast({
54
+ * description: 'Lorem ipsum',
55
+ * progressBarBg: 'var(--N700)',
56
+ * })
57
+ * ```
58
+ *
59
+ * @example Custom icon
60
+ * ```ts
61
+ * ToastManager.showToast({
62
+ * description: 'Lorem ipsum',
63
+ * icon: <ICCube />,
64
+ * })
65
+ * ```
66
+ */
8
67
class ToastManager {
9
68
// eslint-disable-next-line no-use-before-define
10
69
static #instance: ToastManager
0 commit comments