@zag-js/toast 0.19.0 → 0.20.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/dist/index.d.mts +35 -33
- package/dist/index.d.ts +35 -33
- package/package.json +7 -7
- package/src/toast.types.ts +73 -66
package/dist/index.d.mts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import * as _zag_js_core from '@zag-js/core';
|
|
2
2
|
import { Machine, StateMachine } from '@zag-js/core';
|
|
3
|
+
import * as _zag_js_types from '@zag-js/types';
|
|
3
4
|
import { RootProperties, CommonProperties, Direction, PropTypes, DirectionProperty, Context, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
4
5
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
5
6
|
|
|
6
7
|
type Type = "success" | "error" | "loading" | "info" | "custom";
|
|
7
8
|
type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Whether to pause toast when the user leaves the browser tab
|
|
11
|
-
*/
|
|
12
|
-
pauseOnPageIdle?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Whether to pause the toast when interacted with
|
|
15
|
-
*/
|
|
16
|
-
pauseOnInteraction?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The default options for the toast
|
|
19
|
-
*/
|
|
20
|
-
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>;
|
|
21
|
-
};
|
|
22
|
-
type ToastOptions = {
|
|
9
|
+
interface ToastOptions {
|
|
23
10
|
/**
|
|
24
11
|
* The unique id of the toast
|
|
25
12
|
*/
|
|
@@ -69,12 +56,26 @@ type ToastOptions = {
|
|
|
69
56
|
* Function called when the toast is updated
|
|
70
57
|
*/
|
|
71
58
|
onUpdate?: VoidFunction;
|
|
72
|
-
}
|
|
59
|
+
}
|
|
73
60
|
type Options = Partial<ToastOptions>;
|
|
74
61
|
type RenderOptions = Omit<ToastOptions, "render"> & {
|
|
75
62
|
dismiss(): void;
|
|
76
63
|
};
|
|
77
|
-
|
|
64
|
+
interface SharedContext {
|
|
65
|
+
/**
|
|
66
|
+
* Whether to pause toast when the user leaves the browser tab
|
|
67
|
+
*/
|
|
68
|
+
pauseOnPageIdle?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to pause the toast when interacted with
|
|
71
|
+
*/
|
|
72
|
+
pauseOnInteraction?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The default options for the toast
|
|
75
|
+
*/
|
|
76
|
+
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>;
|
|
77
|
+
}
|
|
78
|
+
interface MachineContext extends SharedContext, RootProperties, CommonProperties, Omit<ToastOptions, "removeDelay"> {
|
|
78
79
|
/**
|
|
79
80
|
* The duration for the toast to kept alive before it is removed.
|
|
80
81
|
* Useful for exit transitions.
|
|
@@ -92,15 +93,15 @@ type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<T
|
|
|
92
93
|
* The time left before the toast is removed
|
|
93
94
|
*/
|
|
94
95
|
remaining: number;
|
|
95
|
-
}
|
|
96
|
-
|
|
96
|
+
}
|
|
97
|
+
interface MachineState {
|
|
97
98
|
value: "active" | "active:temp" | "dismissing" | "inactive" | "persist";
|
|
98
99
|
tags: "visible" | "paused" | "updating";
|
|
99
|
-
}
|
|
100
|
+
}
|
|
100
101
|
type State = StateMachine.State<MachineContext, MachineState>;
|
|
101
102
|
type Send = StateMachine.Send;
|
|
102
103
|
type Service = Machine<MachineContext, MachineState>;
|
|
103
|
-
|
|
104
|
+
interface GroupPublicContext extends SharedContext, DirectionProperty, CommonProperties {
|
|
104
105
|
/**
|
|
105
106
|
* The gutter or spacing between toasts
|
|
106
107
|
*/
|
|
@@ -117,7 +118,7 @@ type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties &
|
|
|
117
118
|
* The offset from the safe environment edge of the viewport
|
|
118
119
|
*/
|
|
119
120
|
offsets: string | Record<"left" | "right" | "bottom" | "top", string>;
|
|
120
|
-
}
|
|
121
|
+
}
|
|
121
122
|
type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
|
|
122
123
|
type GroupComputedContext = Readonly<{
|
|
123
124
|
/**
|
|
@@ -127,20 +128,21 @@ type GroupComputedContext = Readonly<{
|
|
|
127
128
|
count: number;
|
|
128
129
|
}>;
|
|
129
130
|
type GroupPrivateContext = Context<{}>;
|
|
130
|
-
|
|
131
|
+
interface GroupMachineContext extends GroupPublicContext, GroupComputedContext, GroupPrivateContext {
|
|
132
|
+
}
|
|
131
133
|
type GroupState = StateMachine.State<GroupMachineContext>;
|
|
132
|
-
type GroupSend =
|
|
134
|
+
type GroupSend = StateMachine.Send;
|
|
133
135
|
type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
|
|
134
|
-
|
|
136
|
+
interface PromiseOptions<Value> {
|
|
135
137
|
loading: ToastOptions;
|
|
136
138
|
success: MaybeFunction<ToastOptions, Value>;
|
|
137
139
|
error: MaybeFunction<ToastOptions, Error>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
+
}
|
|
141
|
+
interface GroupProps {
|
|
140
142
|
placement: Placement;
|
|
141
143
|
label?: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
+
}
|
|
145
|
+
interface GroupMachineApi<T extends PropTypes = PropTypes> {
|
|
144
146
|
/**
|
|
145
147
|
* The total number of toasts
|
|
146
148
|
*/
|
|
@@ -214,8 +216,8 @@ type GroupMachineApi<T extends PropTypes = PropTypes> = {
|
|
|
214
216
|
*/
|
|
215
217
|
subscribe(callback: (toasts: Service[]) => void): VoidFunction;
|
|
216
218
|
getGroupProps(options: GroupProps): T["element"];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
+
}
|
|
220
|
+
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
219
221
|
/**
|
|
220
222
|
* The type of the toast.
|
|
221
223
|
*/
|
|
@@ -264,7 +266,7 @@ type MachineApi<T extends PropTypes = PropTypes> = {
|
|
|
264
266
|
titleProps: T["element"];
|
|
265
267
|
descriptionProps: T["element"];
|
|
266
268
|
closeTriggerProps: T["button"];
|
|
267
|
-
}
|
|
269
|
+
}
|
|
268
270
|
|
|
269
271
|
declare function groupConnect<T extends PropTypes>(state: GroupState, send: GroupSend, normalize: NormalizeProps<T>): GroupMachineApi<T>;
|
|
270
272
|
|
|
@@ -280,6 +282,6 @@ declare const group: {
|
|
|
280
282
|
connect: typeof groupConnect;
|
|
281
283
|
machine: typeof groupMachine;
|
|
282
284
|
};
|
|
283
|
-
declare function api(): GroupMachineApi | undefined;
|
|
285
|
+
declare function api(): GroupMachineApi<_zag_js_types.PropTypes> | undefined;
|
|
284
286
|
|
|
285
287
|
export { MachineApi as Api, GroupMachineApi as GroupApi, GroupMachineContext, MachineContext, MachineState, Placement, Service, ToastOptions, Type, anatomy, api, connect, createToastMachine as createMachine, group };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import * as _zag_js_core from '@zag-js/core';
|
|
2
2
|
import { Machine, StateMachine } from '@zag-js/core';
|
|
3
|
+
import * as _zag_js_types from '@zag-js/types';
|
|
3
4
|
import { RootProperties, CommonProperties, Direction, PropTypes, DirectionProperty, Context, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
4
5
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
5
6
|
|
|
6
7
|
type Type = "success" | "error" | "loading" | "info" | "custom";
|
|
7
8
|
type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Whether to pause toast when the user leaves the browser tab
|
|
11
|
-
*/
|
|
12
|
-
pauseOnPageIdle?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Whether to pause the toast when interacted with
|
|
15
|
-
*/
|
|
16
|
-
pauseOnInteraction?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The default options for the toast
|
|
19
|
-
*/
|
|
20
|
-
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>;
|
|
21
|
-
};
|
|
22
|
-
type ToastOptions = {
|
|
9
|
+
interface ToastOptions {
|
|
23
10
|
/**
|
|
24
11
|
* The unique id of the toast
|
|
25
12
|
*/
|
|
@@ -69,12 +56,26 @@ type ToastOptions = {
|
|
|
69
56
|
* Function called when the toast is updated
|
|
70
57
|
*/
|
|
71
58
|
onUpdate?: VoidFunction;
|
|
72
|
-
}
|
|
59
|
+
}
|
|
73
60
|
type Options = Partial<ToastOptions>;
|
|
74
61
|
type RenderOptions = Omit<ToastOptions, "render"> & {
|
|
75
62
|
dismiss(): void;
|
|
76
63
|
};
|
|
77
|
-
|
|
64
|
+
interface SharedContext {
|
|
65
|
+
/**
|
|
66
|
+
* Whether to pause toast when the user leaves the browser tab
|
|
67
|
+
*/
|
|
68
|
+
pauseOnPageIdle?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to pause the toast when interacted with
|
|
71
|
+
*/
|
|
72
|
+
pauseOnInteraction?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The default options for the toast
|
|
75
|
+
*/
|
|
76
|
+
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>;
|
|
77
|
+
}
|
|
78
|
+
interface MachineContext extends SharedContext, RootProperties, CommonProperties, Omit<ToastOptions, "removeDelay"> {
|
|
78
79
|
/**
|
|
79
80
|
* The duration for the toast to kept alive before it is removed.
|
|
80
81
|
* Useful for exit transitions.
|
|
@@ -92,15 +93,15 @@ type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<T
|
|
|
92
93
|
* The time left before the toast is removed
|
|
93
94
|
*/
|
|
94
95
|
remaining: number;
|
|
95
|
-
}
|
|
96
|
-
|
|
96
|
+
}
|
|
97
|
+
interface MachineState {
|
|
97
98
|
value: "active" | "active:temp" | "dismissing" | "inactive" | "persist";
|
|
98
99
|
tags: "visible" | "paused" | "updating";
|
|
99
|
-
}
|
|
100
|
+
}
|
|
100
101
|
type State = StateMachine.State<MachineContext, MachineState>;
|
|
101
102
|
type Send = StateMachine.Send;
|
|
102
103
|
type Service = Machine<MachineContext, MachineState>;
|
|
103
|
-
|
|
104
|
+
interface GroupPublicContext extends SharedContext, DirectionProperty, CommonProperties {
|
|
104
105
|
/**
|
|
105
106
|
* The gutter or spacing between toasts
|
|
106
107
|
*/
|
|
@@ -117,7 +118,7 @@ type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties &
|
|
|
117
118
|
* The offset from the safe environment edge of the viewport
|
|
118
119
|
*/
|
|
119
120
|
offsets: string | Record<"left" | "right" | "bottom" | "top", string>;
|
|
120
|
-
}
|
|
121
|
+
}
|
|
121
122
|
type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
|
|
122
123
|
type GroupComputedContext = Readonly<{
|
|
123
124
|
/**
|
|
@@ -127,20 +128,21 @@ type GroupComputedContext = Readonly<{
|
|
|
127
128
|
count: number;
|
|
128
129
|
}>;
|
|
129
130
|
type GroupPrivateContext = Context<{}>;
|
|
130
|
-
|
|
131
|
+
interface GroupMachineContext extends GroupPublicContext, GroupComputedContext, GroupPrivateContext {
|
|
132
|
+
}
|
|
131
133
|
type GroupState = StateMachine.State<GroupMachineContext>;
|
|
132
|
-
type GroupSend =
|
|
134
|
+
type GroupSend = StateMachine.Send;
|
|
133
135
|
type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
|
|
134
|
-
|
|
136
|
+
interface PromiseOptions<Value> {
|
|
135
137
|
loading: ToastOptions;
|
|
136
138
|
success: MaybeFunction<ToastOptions, Value>;
|
|
137
139
|
error: MaybeFunction<ToastOptions, Error>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
+
}
|
|
141
|
+
interface GroupProps {
|
|
140
142
|
placement: Placement;
|
|
141
143
|
label?: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
+
}
|
|
145
|
+
interface GroupMachineApi<T extends PropTypes = PropTypes> {
|
|
144
146
|
/**
|
|
145
147
|
* The total number of toasts
|
|
146
148
|
*/
|
|
@@ -214,8 +216,8 @@ type GroupMachineApi<T extends PropTypes = PropTypes> = {
|
|
|
214
216
|
*/
|
|
215
217
|
subscribe(callback: (toasts: Service[]) => void): VoidFunction;
|
|
216
218
|
getGroupProps(options: GroupProps): T["element"];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
+
}
|
|
220
|
+
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
219
221
|
/**
|
|
220
222
|
* The type of the toast.
|
|
221
223
|
*/
|
|
@@ -264,7 +266,7 @@ type MachineApi<T extends PropTypes = PropTypes> = {
|
|
|
264
266
|
titleProps: T["element"];
|
|
265
267
|
descriptionProps: T["element"];
|
|
266
268
|
closeTriggerProps: T["button"];
|
|
267
|
-
}
|
|
269
|
+
}
|
|
268
270
|
|
|
269
271
|
declare function groupConnect<T extends PropTypes>(state: GroupState, send: GroupSend, normalize: NormalizeProps<T>): GroupMachineApi<T>;
|
|
270
272
|
|
|
@@ -280,6 +282,6 @@ declare const group: {
|
|
|
280
282
|
connect: typeof groupConnect;
|
|
281
283
|
machine: typeof groupMachine;
|
|
282
284
|
};
|
|
283
|
-
declare function api(): GroupMachineApi | undefined;
|
|
285
|
+
declare function api(): GroupMachineApi<_zag_js_types.PropTypes> | undefined;
|
|
284
286
|
|
|
285
287
|
export { MachineApi as Api, GroupMachineApi as GroupApi, GroupMachineContext, MachineContext, MachineState, Placement, Service, ToastOptions, Type, anatomy, api, connect, createToastMachine as createMachine, group };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/toast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Core logic for the toast widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zag-js/anatomy": "0.
|
|
31
|
-
"@zag-js/core": "0.
|
|
32
|
-
"@zag-js/dom-query": "0.
|
|
33
|
-
"@zag-js/dom-event": "0.
|
|
34
|
-
"@zag-js/utils": "0.
|
|
35
|
-
"@zag-js/types": "0.
|
|
30
|
+
"@zag-js/anatomy": "0.20.0",
|
|
31
|
+
"@zag-js/core": "0.20.0",
|
|
32
|
+
"@zag-js/dom-query": "0.20.0",
|
|
33
|
+
"@zag-js/dom-event": "0.20.0",
|
|
34
|
+
"@zag-js/utils": "0.20.0",
|
|
35
|
+
"@zag-js/types": "0.20.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"clean-package": "2.2.0"
|
package/src/toast.types.ts
CHANGED
|
@@ -13,23 +13,7 @@ export type Type = "success" | "error" | "loading" | "info" | "custom"
|
|
|
13
13
|
|
|
14
14
|
export type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Whether to pause toast when the user leaves the browser tab
|
|
19
|
-
*/
|
|
20
|
-
pauseOnPageIdle?: boolean
|
|
21
|
-
/**
|
|
22
|
-
* Whether to pause the toast when interacted with
|
|
23
|
-
*/
|
|
24
|
-
pauseOnInteraction?: boolean
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The default options for the toast
|
|
28
|
-
*/
|
|
29
|
-
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type ToastOptions = {
|
|
16
|
+
export interface ToastOptions {
|
|
33
17
|
/**
|
|
34
18
|
* The unique id of the toast
|
|
35
19
|
*/
|
|
@@ -87,30 +71,51 @@ export type RenderOptions = Omit<ToastOptions, "render"> & {
|
|
|
87
71
|
dismiss(): void
|
|
88
72
|
}
|
|
89
73
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
74
|
+
/* -----------------------------------------------------------------------------
|
|
75
|
+
* Machine context
|
|
76
|
+
* -----------------------------------------------------------------------------*/
|
|
77
|
+
|
|
78
|
+
interface SharedContext {
|
|
79
|
+
/**
|
|
80
|
+
* Whether to pause toast when the user leaves the browser tab
|
|
81
|
+
*/
|
|
82
|
+
pauseOnPageIdle?: boolean
|
|
83
|
+
/**
|
|
84
|
+
* Whether to pause the toast when interacted with
|
|
85
|
+
*/
|
|
86
|
+
pauseOnInteraction?: boolean
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The default options for the toast
|
|
90
|
+
*/
|
|
91
|
+
defaultOptions?: Partial<Pick<ToastOptions, "duration" | "removeDelay" | "placement">>
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface MachineContext
|
|
95
|
+
extends SharedContext,
|
|
96
|
+
RootProperties,
|
|
97
|
+
CommonProperties,
|
|
98
|
+
Omit<ToastOptions, "removeDelay"> {
|
|
99
|
+
/**
|
|
100
|
+
* The duration for the toast to kept alive before it is removed.
|
|
101
|
+
* Useful for exit transitions.
|
|
102
|
+
*/
|
|
103
|
+
removeDelay: number
|
|
104
|
+
/**
|
|
105
|
+
* The document's text/writing direction.
|
|
106
|
+
*/
|
|
107
|
+
dir?: Direction
|
|
108
|
+
/**
|
|
109
|
+
* The time the toast was created
|
|
110
|
+
*/
|
|
111
|
+
createdAt: number
|
|
112
|
+
/**
|
|
113
|
+
* The time left before the toast is removed
|
|
114
|
+
*/
|
|
115
|
+
remaining: number
|
|
116
|
+
}
|
|
112
117
|
|
|
113
|
-
export
|
|
118
|
+
export interface MachineState {
|
|
114
119
|
value: "active" | "active:temp" | "dismissing" | "inactive" | "persist"
|
|
115
120
|
tags: "visible" | "paused" | "updating"
|
|
116
121
|
}
|
|
@@ -121,26 +126,24 @@ export type Send = S.Send
|
|
|
121
126
|
|
|
122
127
|
export type Service = Machine<MachineContext, MachineState>
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
offsets: string | Record<"left" | "right" | "bottom" | "top", string>
|
|
143
|
-
}
|
|
129
|
+
interface GroupPublicContext extends SharedContext, DirectionProperty, CommonProperties {
|
|
130
|
+
/**
|
|
131
|
+
* The gutter or spacing between toasts
|
|
132
|
+
*/
|
|
133
|
+
gutter: string
|
|
134
|
+
/**
|
|
135
|
+
* The z-index applied to each toast group
|
|
136
|
+
*/
|
|
137
|
+
zIndex: number
|
|
138
|
+
/**
|
|
139
|
+
* The maximum number of toasts that can be shown at once
|
|
140
|
+
*/
|
|
141
|
+
max: number
|
|
142
|
+
/**
|
|
143
|
+
* The offset from the safe environment edge of the viewport
|
|
144
|
+
*/
|
|
145
|
+
offsets: string | Record<"left" | "right" | "bottom" | "top", string>
|
|
146
|
+
}
|
|
144
147
|
|
|
145
148
|
export type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">
|
|
146
149
|
|
|
@@ -160,26 +163,30 @@ type GroupPrivateContext = Context<{
|
|
|
160
163
|
toasts: Service[]
|
|
161
164
|
}>
|
|
162
165
|
|
|
163
|
-
export
|
|
166
|
+
export interface GroupMachineContext extends GroupPublicContext, GroupComputedContext, GroupPrivateContext {}
|
|
164
167
|
|
|
165
168
|
export type GroupState = S.State<GroupMachineContext>
|
|
166
169
|
|
|
167
|
-
export type GroupSend =
|
|
170
|
+
export type GroupSend = S.Send
|
|
171
|
+
|
|
172
|
+
/* -----------------------------------------------------------------------------
|
|
173
|
+
* Component API
|
|
174
|
+
* -----------------------------------------------------------------------------*/
|
|
168
175
|
|
|
169
176
|
type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value)
|
|
170
177
|
|
|
171
|
-
export
|
|
178
|
+
export interface PromiseOptions<Value> {
|
|
172
179
|
loading: ToastOptions
|
|
173
180
|
success: MaybeFunction<ToastOptions, Value>
|
|
174
181
|
error: MaybeFunction<ToastOptions, Error>
|
|
175
182
|
}
|
|
176
183
|
|
|
177
|
-
export
|
|
184
|
+
export interface GroupProps {
|
|
178
185
|
placement: Placement
|
|
179
186
|
label?: string
|
|
180
187
|
}
|
|
181
188
|
|
|
182
|
-
export
|
|
189
|
+
export interface GroupMachineApi<T extends PropTypes = PropTypes> {
|
|
183
190
|
/**
|
|
184
191
|
* The total number of toasts
|
|
185
192
|
*/
|
|
@@ -255,7 +262,7 @@ export type GroupMachineApi<T extends PropTypes = PropTypes> = {
|
|
|
255
262
|
getGroupProps(options: GroupProps): T["element"]
|
|
256
263
|
}
|
|
257
264
|
|
|
258
|
-
export
|
|
265
|
+
export interface MachineApi<T extends PropTypes = PropTypes> {
|
|
259
266
|
/**
|
|
260
267
|
* The type of the toast.
|
|
261
268
|
*/
|