@zag-js/toast 1.46.0 → 1.48.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.
Files changed (41) hide show
  1. package/dist/index.d.mts +10 -17
  2. package/dist/index.d.ts +10 -17
  3. package/dist/index.js +18 -45
  4. package/dist/index.mjs +5 -11
  5. package/dist/toast-group.connect.d.mts +4 -8
  6. package/dist/toast-group.connect.d.ts +4 -8
  7. package/dist/toast-group.connect.js +73 -97
  8. package/dist/toast-group.connect.mjs +68 -61
  9. package/dist/toast-group.machine.d.mts +2 -8
  10. package/dist/toast-group.machine.d.ts +2 -8
  11. package/dist/toast-group.machine.js +294 -302
  12. package/dist/toast-group.machine.mjs +289 -266
  13. package/dist/toast.anatomy.d.mts +2 -6
  14. package/dist/toast.anatomy.d.ts +2 -6
  15. package/dist/toast.anatomy.js +8 -40
  16. package/dist/toast.anatomy.mjs +4 -14
  17. package/dist/toast.connect.d.mts +4 -8
  18. package/dist/toast.connect.d.ts +4 -8
  19. package/dist/toast.connect.js +133 -158
  20. package/dist/toast.connect.mjs +128 -122
  21. package/dist/toast.dom.d.mts +21 -16
  22. package/dist/toast.dom.d.ts +21 -16
  23. package/dist/toast.dom.js +56 -53
  24. package/dist/toast.dom.mjs +42 -20
  25. package/dist/toast.machine.d.mts +2 -8
  26. package/dist/toast.machine.d.ts +2 -8
  27. package/dist/toast.machine.js +272 -311
  28. package/dist/toast.machine.mjs +268 -276
  29. package/dist/toast.store.d.mts +2 -8
  30. package/dist/toast.store.d.ts +2 -8
  31. package/dist/toast.store.js +344 -299
  32. package/dist/toast.store.mjs +340 -274
  33. package/dist/toast.types.d.mts +372 -374
  34. package/dist/toast.types.d.ts +372 -374
  35. package/dist/toast.types.js +4 -18
  36. package/dist/toast.types.mjs +1 -0
  37. package/dist/toast.utils.d.mts +10 -13
  38. package/dist/toast.utils.d.ts +10 -13
  39. package/dist/toast.utils.js +169 -198
  40. package/dist/toast.utils.mjs +159 -168
  41. package/package.json +9 -9
@@ -1,392 +1,390 @@
1
- import { PropTypes, CommonProperties, Direction, DirectionProperty, Required, RequiredBy } from '@zag-js/types';
2
- import { Service, EventObject, Machine } from '@zag-js/core';
3
- import { AnimationFrame } from '@zag-js/dom-query';
4
-
5
- type Type = "success" | "error" | "loading" | "info" | "warning" | (string & {});
6
- type ToastQueuePriority = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
7
- type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
8
- type Status = "visible" | "dismissing" | "unmounted";
9
- interface StatusChangeDetails {
10
- /**
11
- * The status of the toast
12
- */
13
- status: Status;
14
- /**
15
- * The reason for the status change
16
- */
17
- src?: string | undefined;
1
+ import { CommonProperties, Direction, DirectionProperty, PropTypes, Required, RequiredBy } from "@zag-js/types";
2
+ import { EventObject, Machine, Service } from "@zag-js/core";
3
+ import { AnimationFrame } from "@zag-js/dom-query";
4
+ export type Type = "success" | "error" | "loading" | "info" | "warning" | (string & {});
5
+ export type ToastQueuePriority = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
6
+ export type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
7
+ export type Status = "visible" | "dismissing" | "unmounted";
8
+ export interface StatusChangeDetails {
9
+ /**
10
+ * The status of the toast
11
+ */
12
+ status: Status;
13
+ /**
14
+ * The reason for the status change
15
+ */
16
+ src?: string | undefined;
18
17
  }
19
- interface ToastHeight {
20
- /**
21
- * The id of the toast
22
- */
23
- id: string;
24
- /**
25
- * The height of the toast
26
- */
27
- height: number;
18
+ export interface ToastHeight {
19
+ /**
20
+ * The id of the toast
21
+ */
22
+ id: string;
23
+ /**
24
+ * The height of the toast
25
+ */
26
+ height: number;
28
27
  }
29
- interface ActionOptions {
30
- /**
31
- * The label of the action
32
- */
33
- label: string;
34
- /**
35
- * The function to call when the action is clicked
36
- */
37
- onClick: VoidFunction;
28
+ export interface ActionOptions {
29
+ /**
30
+ * The label of the action
31
+ */
32
+ label: string;
33
+ /**
34
+ * The function to call when the action is clicked
35
+ */
36
+ onClick: VoidFunction;
38
37
  }
39
- interface IntlTranslations {
40
- closeTriggerLabel?: string | undefined;
38
+ export interface IntlTranslations {
39
+ closeTriggerLabel?: string | undefined;
41
40
  }
42
- interface Options<T = any> {
43
- /**
44
- * The title of the toast.
45
- */
46
- title?: T | undefined;
47
- /**
48
- * The description of the toast.
49
- */
50
- description?: T | undefined;
51
- /**
52
- * The duration the toast will be visible
53
- */
54
- duration?: number | undefined;
55
- /**
56
- * The duration for the toast to kept alive before it is removed.
57
- * Useful for exit transitions.
58
- */
59
- removeDelay?: number | undefined;
60
- /**
61
- * The unique id of the toast
62
- */
63
- id?: string | undefined;
64
- /**
65
- * The type of the toast
66
- */
67
- type?: Type | undefined;
68
- /**
69
- * The priority of the toast (1 = highest, 8 = lowest)
70
- */
71
- priority?: ToastQueuePriority | undefined;
72
- /**
73
- * Function called when the toast is visible
74
- */
75
- onStatusChange?: ((details: StatusChangeDetails) => void) | undefined;
76
- /**
77
- * The action of the toast
78
- */
79
- action?: ActionOptions | undefined;
80
- /**
81
- * Whether the toast is closable
82
- */
83
- closable?: boolean | undefined;
84
- /**
85
- * The metadata of the toast
86
- */
87
- meta?: Record<string, any> | undefined;
41
+ export interface Options<T = any> {
42
+ /**
43
+ * The title of the toast.
44
+ */
45
+ title?: T | undefined;
46
+ /**
47
+ * The description of the toast.
48
+ */
49
+ description?: T | undefined;
50
+ /**
51
+ * The duration the toast will be visible
52
+ */
53
+ duration?: number | undefined;
54
+ /**
55
+ * The duration for the toast to kept alive before it is removed.
56
+ * Useful for exit transitions.
57
+ */
58
+ removeDelay?: number | undefined;
59
+ /**
60
+ * The unique id of the toast
61
+ */
62
+ id?: string | undefined;
63
+ /**
64
+ * The type of the toast
65
+ */
66
+ type?: Type | undefined;
67
+ /**
68
+ * The priority of the toast (1 = highest, 8 = lowest)
69
+ */
70
+ priority?: ToastQueuePriority | undefined;
71
+ /**
72
+ * Function called when the toast is visible
73
+ */
74
+ onStatusChange?: ((details: StatusChangeDetails) => void) | undefined;
75
+ /**
76
+ * The action of the toast
77
+ */
78
+ action?: ActionOptions | undefined;
79
+ /**
80
+ * Whether the toast is closable
81
+ */
82
+ closable?: boolean | undefined;
83
+ /**
84
+ * The metadata of the toast
85
+ */
86
+ meta?: Record<string, any> | undefined;
88
87
  }
89
- interface ToastProps<T = any> extends Omit<CommonProperties, "id">, Options<T> {
90
- /**
91
- * Specifies the localized strings that identifies the accessibility elements and their states
92
- */
93
- translations?: IntlTranslations | undefined;
94
- /**
95
- * The direction of the toast
96
- */
97
- dir?: Direction | undefined;
98
- /**
99
- * The index of the toast in the group
100
- */
101
- index?: number | undefined;
102
- /**
103
- * The gap of the toast
104
- */
105
- gap?: number | undefined;
106
- /**
107
- * The parent toast group service. Required when using toast as a child of a group.
108
- */
109
- parent: Service<ToastGroupSchema>;
88
+ export interface ToastProps<T = any> extends Omit<CommonProperties, "id">, Options<T> {
89
+ /**
90
+ * Specifies the localized strings that identifies the accessibility elements and their states
91
+ */
92
+ translations?: IntlTranslations | undefined;
93
+ /**
94
+ * The direction of the toast
95
+ */
96
+ dir?: Direction | undefined;
97
+ /**
98
+ * The index of the toast in the group
99
+ */
100
+ index?: number | undefined;
101
+ /**
102
+ * The gap of the toast
103
+ */
104
+ gap?: number | undefined;
105
+ /**
106
+ * The parent toast group service. Required when using toast as a child of a group.
107
+ */
108
+ parent: Service<ToastGroupSchema>;
110
109
  }
111
110
  type ToastPropsWithDefault = "type" | "parent" | "duration" | "id" | "removeDelay";
112
- type ToastSchema<O = any> = {
113
- props: RequiredBy<ToastProps<O>, Extract<ToastPropsWithDefault, keyof ToastProps<O>>>;
114
- context: {
115
- mounted: boolean;
116
- initialHeight: number;
117
- remainingTime: number;
118
- rendered: {
119
- title: boolean;
120
- description: boolean;
121
- };
122
- };
123
- computed: {
124
- height: number;
125
- heightIndex: number;
126
- heightBefore: number;
127
- frontmost: boolean;
128
- zIndex: number;
129
- shouldPersist: boolean;
130
- };
131
- refs: {
132
- closeTimerStartTime: number;
133
- lastCloseStartTimerStartTime: number;
111
+ export type ToastSchema<O = any> = {
112
+ props: RequiredBy<ToastProps<O>, Extract<ToastPropsWithDefault, keyof ToastProps<O>>>;
113
+ context: {
114
+ mounted: boolean;
115
+ initialHeight: number;
116
+ remainingTime: number;
117
+ rendered: {
118
+ title: boolean;
119
+ description: boolean;
134
120
  };
135
- state: "visible" | "visible:updating" | "dismissing" | "unmounted" | "visible:persist";
136
- tag: "visible" | "paused" | "updating";
137
- guard: string;
138
- action: string;
139
- effect: string;
140
- event: EventObject;
121
+ };
122
+ computed: {
123
+ height: number;
124
+ heightIndex: number;
125
+ heightBefore: number;
126
+ frontmost: boolean;
127
+ zIndex: number;
128
+ shouldPersist: boolean;
129
+ };
130
+ refs: {
131
+ closeTimerStartTime: number;
132
+ lastCloseStartTimerStartTime: number;
133
+ };
134
+ state: "visible" | "visible:updating" | "dismissing" | "unmounted" | "visible:persist";
135
+ tag: "visible" | "paused" | "updating";
136
+ guard: string;
137
+ action: string;
138
+ effect: string;
139
+ event: EventObject;
141
140
  };
142
- type ToastService = Service<ToastSchema>;
143
- type ToastMachine = Machine<ToastSchema>;
144
- interface ToastStoreProps {
145
- /**
146
- * The placement of the toast
147
- * @default "bottom"
148
- */
149
- placement?: Placement | undefined;
150
- /**
151
- * The maximum number of toasts. When the number of toasts exceeds this limit, the new toasts are queued.
152
- * @default 24
153
- */
154
- max?: number | undefined;
155
- /**
156
- * Whether to overlap the toasts
157
- */
158
- overlap?: boolean | undefined;
159
- /**
160
- * The duration of the toast.
161
- * By default, it is determined by the type of the toast.
162
- */
163
- duration?: number | undefined;
164
- /**
165
- * The gap between the toasts
166
- * @default 16
167
- */
168
- gap?: number | undefined;
169
- /**
170
- * The offset from the safe environment edge of the viewport
171
- * @default "1rem"
172
- */
173
- offsets?: string | Record<"left" | "right" | "bottom" | "top", string> | undefined;
174
- /**
175
- * The hotkey that will move focus to the toast group
176
- * @default '["altKey", "KeyT"]'
177
- */
178
- hotkey?: string[] | undefined;
179
- /**
180
- * The duration for the toast to kept alive before it is removed.
181
- * Useful for exit transitions.
182
- *
183
- * @default 200
184
- */
185
- removeDelay?: number | undefined;
186
- /**
187
- * Whether to pause toast when the user leaves the browser tab
188
- * @default true
189
- */
190
- pauseOnPageIdle?: boolean | undefined;
141
+ export type ToastService = Service<ToastSchema>;
142
+ export type ToastMachine = Machine<ToastSchema>;
143
+ export interface ToastStoreProps {
144
+ /**
145
+ * The placement of the toast
146
+ * @default "bottom"
147
+ */
148
+ placement?: Placement | undefined;
149
+ /**
150
+ * The maximum number of toasts. When the number of toasts exceeds this limit, the new toasts are queued.
151
+ * @default 24
152
+ */
153
+ max?: number | undefined;
154
+ /**
155
+ * Whether to overlap the toasts
156
+ */
157
+ overlap?: boolean | undefined;
158
+ /**
159
+ * The duration of the toast.
160
+ * By default, it is determined by the type of the toast.
161
+ */
162
+ duration?: number | undefined;
163
+ /**
164
+ * The gap between the toasts
165
+ * @default 16
166
+ */
167
+ gap?: number | undefined;
168
+ /**
169
+ * The offset from the safe environment edge of the viewport
170
+ * @default "1rem"
171
+ */
172
+ offsets?: string | Record<"left" | "right" | "bottom" | "top", string> | undefined;
173
+ /**
174
+ * The hotkey that will move focus to the toast group
175
+ * @default '["altKey", "KeyT"]'
176
+ */
177
+ hotkey?: string[] | undefined;
178
+ /**
179
+ * The duration for the toast to kept alive before it is removed.
180
+ * Useful for exit transitions.
181
+ *
182
+ * @default 200
183
+ */
184
+ removeDelay?: number | undefined;
185
+ /**
186
+ * Whether to pause toast when the user leaves the browser tab
187
+ * @default true
188
+ */
189
+ pauseOnPageIdle?: boolean | undefined;
191
190
  }
192
- interface ToastGroupProps extends DirectionProperty, CommonProperties {
193
- /**
194
- * The store of the toast
195
- */
196
- store: ToastStore;
191
+ export interface ToastGroupProps extends DirectionProperty, CommonProperties {
192
+ /**
193
+ * The store of the toast
194
+ */
195
+ store: ToastStore;
197
196
  }
198
- type ToastGroupSchema = {
199
- state: "stack" | "overlap";
200
- props: ToastGroupProps;
201
- context: {
202
- toasts: RequiredBy<ToastProps, Extract<ToastPropsWithDefault, keyof ToastProps>>[];
203
- heights: ToastHeight[];
204
- };
205
- computed: {
206
- count: number;
207
- overlap: boolean;
208
- placement: Placement;
209
- };
210
- refs: {
211
- dismissableCleanup?: VoidFunction | undefined;
212
- lastFocusedEl: HTMLElement | null;
213
- isFocusWithin: boolean;
214
- isPointerWithin: boolean;
215
- ignoreMouseTimer: AnimationFrame;
216
- };
217
- guard: string;
218
- effect: string;
219
- action: string;
220
- event: EventObject;
197
+ export type ToastGroupSchema = {
198
+ state: "stack" | "overlap";
199
+ props: ToastGroupProps;
200
+ context: {
201
+ toasts: RequiredBy<ToastProps, Extract<ToastPropsWithDefault, keyof ToastProps>>[];
202
+ heights: ToastHeight[];
203
+ };
204
+ computed: {
205
+ count: number;
206
+ overlap: boolean;
207
+ placement: Placement;
208
+ };
209
+ refs: {
210
+ dismissableCleanup?: VoidFunction | undefined;
211
+ lastFocusedEl: HTMLElement | null;
212
+ isFocusWithin: boolean;
213
+ isPointerWithin: boolean;
214
+ ignoreMouseTimer: AnimationFrame;
215
+ };
216
+ guard: string;
217
+ effect: string;
218
+ action: string;
219
+ event: EventObject;
221
220
  };
222
- type ToastGroupService = Service<ToastGroupSchema>;
223
- type ToastGroupMachine = Machine<ToastGroupSchema>;
224
- interface ToastStore<V = any> {
225
- /**
226
- * The attributes of the toast store
227
- */
228
- attrs: Required<ToastStoreProps>;
229
- /**
230
- * Subscribe to the toast store
231
- */
232
- subscribe: (subscriber: (...args: any[]) => void) => VoidFunction;
233
- /**
234
- * Create a toast or update an existing toast with the same ID.
235
- * Calls targeting closing toasts are ignored.
236
- */
237
- create: (data: Options<V>) => string;
238
- /**
239
- * Update a toast with new properties or a function of its current properties.
240
- * Updates to closing toasts are ignored.
241
- * Functional updates are also ignored when the toast does not exist.
242
- */
243
- update: (id: string, data: MaybeFunction<Partial<ToastProps<V>>, Partial<ToastProps<V>>>) => string;
244
- /**
245
- * Remove a toast by its ID
246
- */
247
- remove: (id?: string) => void;
248
- /**
249
- * Dismiss a toast by its ID. If no ID is provided, dismisses all toasts
250
- */
251
- dismiss: (id?: string) => void;
252
- /**
253
- * Create an error toast with the given options
254
- */
255
- error: (data: Options<V>) => void;
256
- /**
257
- * Create a success toast with the given options
258
- */
259
- success: (data: Options<V>) => void;
260
- /**
261
- * Create an info toast with the given options
262
- */
263
- info: (data: Options<V>) => void;
264
- /**
265
- * Create a warning toast with the given options
266
- */
267
- warning: (data: Options<V>) => void;
268
- /**
269
- * Create a loading toast with the given options
270
- */
271
- loading: (data: Options<V>) => void;
272
- /**
273
- * Get all currently visible toasts
274
- */
275
- getVisibleToasts: () => Partial<ToastProps<V>>[];
276
- /**
277
- * Get the total number of toasts
278
- */
279
- getCount: () => number;
280
- /**
281
- * Create a toast that tracks a promise's state
282
- */
283
- promise: <T>(promise: Promise<T> | (() => Promise<T>), options: PromiseOptions<T, V>, shared?: Omit<Options<V>, "type">) => {
284
- id: string | undefined;
285
- unwrap: () => Promise<T>;
286
- } | undefined;
287
- /**
288
- * Pause a toast's auto-dismiss timer. If no ID is provided, pauses all toasts
289
- */
290
- pause: (id?: string) => void;
291
- /**
292
- * Resume a toast's auto-dismiss timer. If no ID is provided, resumes all toasts
293
- */
294
- resume: (id?: string) => void;
295
- /**
296
- * Check if a toast with the given ID is currently visible
297
- */
298
- isVisible: (id: string) => boolean;
299
- /**
300
- * Check if a toast with the given ID has been dismissed
301
- */
302
- isDismissed: (id: string) => boolean;
303
- /**
304
- * Expand all toasts to show their full content (overlap mode)
305
- */
306
- expand: VoidFunction;
307
- /**
308
- * Collapse all toasts to their compact state (overlap mode)
309
- */
310
- collapse: VoidFunction;
221
+ export type ToastGroupService = Service<ToastGroupSchema>;
222
+ export type ToastGroupMachine = Machine<ToastGroupSchema>;
223
+ export interface ToastStore<V = any> {
224
+ /**
225
+ * The attributes of the toast store
226
+ */
227
+ attrs: Required<ToastStoreProps>;
228
+ /**
229
+ * Subscribe to the toast store
230
+ */
231
+ subscribe: (subscriber: (...args: any[]) => void) => VoidFunction;
232
+ /**
233
+ * Create a toast or update an existing toast with the same ID.
234
+ * Calls targeting closing toasts are ignored.
235
+ */
236
+ create: (data: Options<V>) => string;
237
+ /**
238
+ * Update a toast with new properties or a function of its current properties.
239
+ * Updates to closing toasts are ignored.
240
+ * Functional updates are also ignored when the toast does not exist.
241
+ */
242
+ update: (id: string, data: MaybeFunction<Partial<ToastProps<V>>, Partial<ToastProps<V>>>) => string;
243
+ /**
244
+ * Remove a toast by its ID
245
+ */
246
+ remove: (id?: string) => void;
247
+ /**
248
+ * Dismiss a toast by its ID. If no ID is provided, dismisses all toasts
249
+ */
250
+ dismiss: (id?: string) => void;
251
+ /**
252
+ * Create an error toast with the given options
253
+ */
254
+ error: (data: Options<V>) => void;
255
+ /**
256
+ * Create a success toast with the given options
257
+ */
258
+ success: (data: Options<V>) => void;
259
+ /**
260
+ * Create an info toast with the given options
261
+ */
262
+ info: (data: Options<V>) => void;
263
+ /**
264
+ * Create a warning toast with the given options
265
+ */
266
+ warning: (data: Options<V>) => void;
267
+ /**
268
+ * Create a loading toast with the given options
269
+ */
270
+ loading: (data: Options<V>) => void;
271
+ /**
272
+ * Get all currently visible toasts
273
+ */
274
+ getVisibleToasts: () => Partial<ToastProps<V>>[];
275
+ /**
276
+ * Get the total number of toasts
277
+ */
278
+ getCount: () => number;
279
+ /**
280
+ * Create a toast that tracks a promise's state
281
+ */
282
+ promise: <T>(promise: Promise<T> | (() => Promise<T>), options: PromiseOptions<T, V>, shared?: Omit<Options<V>, "type">) => {
283
+ id: string | undefined;
284
+ unwrap: () => Promise<T>;
285
+ } | undefined;
286
+ /**
287
+ * Pause a toast's auto-dismiss timer. If no ID is provided, pauses all toasts
288
+ */
289
+ pause: (id?: string) => void;
290
+ /**
291
+ * Resume a toast's auto-dismiss timer. If no ID is provided, resumes all toasts
292
+ */
293
+ resume: (id?: string) => void;
294
+ /**
295
+ * Check if a toast with the given ID is currently visible
296
+ */
297
+ isVisible: (id: string) => boolean;
298
+ /**
299
+ * Check if a toast with the given ID has been dismissed
300
+ */
301
+ isDismissed: (id: string) => boolean;
302
+ /**
303
+ * Expand all toasts to show their full content (overlap mode)
304
+ */
305
+ expand: VoidFunction;
306
+ /**
307
+ * Collapse all toasts to their compact state (overlap mode)
308
+ */
309
+ collapse: VoidFunction;
311
310
  }
312
311
  type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
313
- interface PromiseOptions<V, O = any> {
314
- loading: Omit<Options<O>, "type">;
315
- success?: MaybeFunction<Omit<Options<O>, "type"> & {
316
- type?: "success" | "warning";
317
- }, V> | undefined;
318
- error?: MaybeFunction<Omit<Options<O>, "type">, unknown> | undefined;
319
- finally?: (() => void | Promise<void>) | undefined;
312
+ export interface PromiseOptions<V, O = any> {
313
+ loading: Omit<Options<O>, "type">;
314
+ success?: MaybeFunction<Omit<Options<O>, "type"> & {
315
+ type?: "success" | "warning";
316
+ }, V> | undefined;
317
+ error?: MaybeFunction<Omit<Options<O>, "type">, unknown> | undefined;
318
+ finally?: (() => void | Promise<void>) | undefined;
320
319
  }
321
- interface GroupProps {
322
- /**
323
- * The human-readable label for the toast region
324
- */
325
- label?: string | undefined;
320
+ export interface GroupProps {
321
+ /**
322
+ * The human-readable label for the toast region
323
+ */
324
+ label?: string | undefined;
326
325
  }
327
- interface ToastGroupApi<T extends PropTypes = PropTypes, O = any> {
328
- /**
329
- * The total number of toasts
330
- */
331
- getCount: () => number;
332
- /**
333
- * The toasts
334
- */
335
- getToasts: () => ToastProps[];
336
- /**
337
- * Subscribe to the toast group
338
- */
339
- subscribe: (callback: (toasts: Options<O>[]) => void) => VoidFunction;
340
- getGroupProps: (options?: GroupProps) => T["element"];
326
+ export interface ToastGroupApi<T extends PropTypes = PropTypes, O = any> {
327
+ /**
328
+ * The total number of toasts
329
+ */
330
+ getCount: () => number;
331
+ /**
332
+ * The toasts
333
+ */
334
+ getToasts: () => ToastProps[];
335
+ /**
336
+ * Subscribe to the toast group
337
+ */
338
+ subscribe: (callback: (toasts: Options<O>[]) => void) => VoidFunction;
339
+ getGroupProps: (options?: GroupProps) => T["element"];
341
340
  }
342
- interface ToastApi<T extends PropTypes = PropTypes, O = any> {
343
- /**
344
- * The title of the toast.
345
- */
346
- title?: O | undefined;
347
- /**
348
- * The description of the toast.
349
- */
350
- description?: O | undefined;
351
- /**
352
- * The type of the toast.
353
- */
354
- type: Type;
355
- /**
356
- * The current placement of the toast.
357
- */
358
- placement: Placement;
359
- /**
360
- * Whether the toast is visible.
361
- */
362
- visible: boolean;
363
- /**
364
- * Whether the toast should render a close button
365
- */
366
- closable: boolean;
367
- /**
368
- * Whether the toast is paused.
369
- */
370
- paused: boolean;
371
- /**
372
- * Function to pause the toast (keeping it visible).
373
- */
374
- pause: VoidFunction;
375
- /**
376
- * Function to resume the toast dismissing.
377
- */
378
- resume: VoidFunction;
379
- /**
380
- * Function to instantly dismiss the toast.
381
- */
382
- dismiss: VoidFunction;
383
- getRootProps: () => T["element"];
384
- getTitleProps: () => T["element"];
385
- getGhostBeforeProps: () => T["element"];
386
- getGhostAfterProps: () => T["element"];
387
- getDescriptionProps: () => T["element"];
388
- getCloseTriggerProps: () => T["button"];
389
- getActionTriggerProps: () => T["button"];
341
+ export interface ToastApi<T extends PropTypes = PropTypes, O = any> {
342
+ /**
343
+ * The title of the toast.
344
+ */
345
+ title?: O | undefined;
346
+ /**
347
+ * The description of the toast.
348
+ */
349
+ description?: O | undefined;
350
+ /**
351
+ * The type of the toast.
352
+ */
353
+ type: Type;
354
+ /**
355
+ * The current placement of the toast.
356
+ */
357
+ placement: Placement;
358
+ /**
359
+ * Whether the toast is visible.
360
+ */
361
+ visible: boolean;
362
+ /**
363
+ * Whether the toast should render a close button
364
+ */
365
+ closable: boolean;
366
+ /**
367
+ * Whether the toast is paused.
368
+ */
369
+ paused: boolean;
370
+ /**
371
+ * Function to pause the toast (keeping it visible).
372
+ */
373
+ pause: VoidFunction;
374
+ /**
375
+ * Function to resume the toast dismissing.
376
+ */
377
+ resume: VoidFunction;
378
+ /**
379
+ * Function to instantly dismiss the toast.
380
+ */
381
+ dismiss: VoidFunction;
382
+ getRootProps: () => T["element"];
383
+ getTitleProps: () => T["element"];
384
+ getGhostBeforeProps: () => T["element"];
385
+ getGhostAfterProps: () => T["element"];
386
+ getDescriptionProps: () => T["element"];
387
+ getCloseTriggerProps: () => T["button"];
388
+ getActionTriggerProps: () => T["button"];
390
389
  }
391
-
392
- export type { ActionOptions, GroupProps, IntlTranslations, Options, Placement, PromiseOptions, Status, StatusChangeDetails, ToastApi, ToastGroupApi, ToastGroupMachine, ToastGroupProps, ToastGroupSchema, ToastGroupService, ToastHeight, ToastMachine, ToastProps, ToastQueuePriority, ToastSchema, ToastService, ToastStore, ToastStoreProps, Type };
390
+ export {};