11
11
*/
12
12
13
13
import { AriaToastRegionProps } from '@react-aria/toast' ;
14
- import React , { ReactElement , ReactNode , useEffect , useRef } from 'react' ;
14
+ import React , { ReactElement , useEffect , useRef } from 'react' ;
15
15
import { SpectrumToastValue , Toast } from './Toast' ;
16
16
import { Toaster } from './Toaster' ;
17
17
import { ToastOptions , ToastQueue , useToastQueue } from '@react-stately/toast' ;
@@ -21,7 +21,7 @@ export interface SpectrumToastContainerProps extends AriaToastRegionProps {}
21
21
22
22
export interface SpectrumToastOptions extends Omit < ToastOptions , 'priority' > {
23
23
/** A label for the action button within the toast. */
24
- actionLabel ?: ReactNode ,
24
+ actionLabel ?: string ,
25
25
/** Handler that is called when the action button is pressed. */
26
26
onAction ?: ( ) => void ,
27
27
/** Whether the toast should automatically close when an action is performed. */
@@ -119,7 +119,7 @@ export function ToastContainer(props: SpectrumToastContainerProps): ReactElement
119
119
return null ;
120
120
}
121
121
122
- function addToast ( children : ReactNode , variant : SpectrumToastValue [ 'variant' ] , options : SpectrumToastOptions = { } ) {
122
+ function addToast ( children : string , variant : SpectrumToastValue [ 'variant' ] , options : SpectrumToastOptions = { } ) {
123
123
// Dispatch a custom event so that toasts can be intercepted and re-targeted, e.g. when inside an iframe.
124
124
if ( typeof CustomEvent !== 'undefined' && typeof window !== 'undefined' ) {
125
125
let event = new CustomEvent ( 'react-spectrum-toast' , {
@@ -157,19 +157,19 @@ function addToast(children: ReactNode, variant: SpectrumToastValue['variant'], o
157
157
158
158
const SpectrumToastQueue = {
159
159
/** Queues a neutral toast. */
160
- neutral ( children : ReactNode , options : SpectrumToastOptions = { } ) : CloseFunction {
160
+ neutral ( children : string , options : SpectrumToastOptions = { } ) : CloseFunction {
161
161
return addToast ( children , 'neutral' , options ) ;
162
162
} ,
163
163
/** Queues a positive toast. */
164
- positive ( children : ReactNode , options : SpectrumToastOptions = { } ) : CloseFunction {
164
+ positive ( children : string , options : SpectrumToastOptions = { } ) : CloseFunction {
165
165
return addToast ( children , 'positive' , options ) ;
166
166
} ,
167
167
/** Queues a negative toast. */
168
- negative ( children : ReactNode , options : SpectrumToastOptions = { } ) : CloseFunction {
168
+ negative ( children : string , options : SpectrumToastOptions = { } ) : CloseFunction {
169
169
return addToast ( children , 'negative' , options ) ;
170
170
} ,
171
171
/** Queues an informational toast. */
172
- info ( children : ReactNode , options : SpectrumToastOptions = { } ) : CloseFunction {
172
+ info ( children : string , options : SpectrumToastOptions = { } ) : CloseFunction {
173
173
return addToast ( children , 'info' , options ) ;
174
174
}
175
175
} ;
0 commit comments