. * @default false */ hideIconVariant?: boolean; /** * Properties applied to the Snackbar root element. You'd only want to use * this prop to apply html attributes for accessibility or data-* attributes. */ SnackbarProps?: React.HTMLAttributes; /** * Replace the snackbar. Callback used for displaying entirely customized snackbars. * @param {string|number} key key of a snackbar * * @ignore * @deprecated - Will be removed in future releases. You should use `Components` prop of * `SnackbarProvider` to display a custom snackbar. This is to have more control over * custom snackbars. */ content?: SnackbarContentCallback; /** * Callback fired before snackbar requests to get closed. * The `reason` parameter can optionally be used to control the response to `onClose`. * * @param {object} event The event source of the callback * @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"maxsnack"` * (snackbar was closed because `maxSnack` has reached) or: `"instructed"` (snackbar was * closed programmatically) * @param {string|number|undefined} key key of a Snackbar. key will be `undefined` if closeSnackbar * is called with no key (user requested all the snackbars to be closed) */ onClose?: (event: React.SyntheticEvent | null, reason: CloseReason, key?: SnackbarKey) => void; } /** * @category Enqueue */ export interface OptionsObject extends SharedProps { /** * Unique identifier to reference a snackbar. * @default string random unique string */ key?: SnackbarKey; /** * Snackbar stays on the screen, unless it is dismissed (programmatically or through user interaction). * @default false */ persist?: boolean; } /** Properties of the internal snack which should not be exposed to outside world */ interface InternalSnackAttributes { open: boolean; entered: boolean; requestClose: boolean; } type NeededByInternalSnack = | 'style' | 'persist' | 'variant' | 'anchorOrigin' | 'TransitionComponent' | 'TransitionProps' | 'transitionDuration' | 'hideIconVariant' | 'disableWindowBlurListener'; /** * Properties of a snackbar internal to notistack implementation. Not to be used by outside * world. If you find yourself using this, you're probably looking for `CustomContentProps` type. */ export interface InternalSnack extends RequiredBy, NeededByInternalSnack>, InternalSnackAttributes { id: SnackbarKey; message?: SnackbarMessage; iconVariant: Record; } type NotNeededByCustomSnackbar = | keyof InternalSnackAttributes | keyof TransitionHandlerProps | 'onClose' | 'SnackbarProps' | 'disableWindowBlurListener' | 'TransitionComponent' | 'transitionDuration' | 'TransitionProps' | 'dense' | 'content'; /** * Props that will be passed to a custom component in `SnackbarProvider` `Components` prop */ export type CustomContentProps = Omit; /** * @category Provider */ export interface SnackbarProviderProps extends SharedProps { /** * Most of the time this is your App. every component from this point onward * will be able to show snackbars. */ children?: React.ReactNode | React.ReactNode[]; /** * Denser margins for snackbars. Recommended to be used on mobile devices. * @default false */ dense?: boolean; /** * Maximum snackbars that can be stacked on top of one another. * @default 3 */ maxSnack?: number; /** * Valid HTML Node element, used to target `ReactDOM.createPortal`. If you are * using this prop, most likely you also want to apply `position: absolute` to SnackbarContainer. */ domRoot?: HTMLElement; /** * Override or extend the styles applied to the container component or Snackbars. */ classes?: Partial>; /** * Mapping between variants and an icon component */ iconVariant?: Partial>; /** * @ignore * SnackbarProvider's ref */ ref?: React.Ref; /** * Mapping between variants and a custom component. */ Components?: { [variant in VariantType]?: React.JSXElementConstructor; }; } type OptionsWithExtraProps = VariantMap[V] extends true ? OptionsObject : OptionsObject & VariantMap[V]; interface EnqueueSnackbar { (options: OptionsWithExtraProps & { message?: SnackbarMessage }): SnackbarKey; (message: SnackbarMessage, options?: OptionsWithExtraProps): SnackbarKey; } export interface ProviderContext { enqueueSnackbar: EnqueueSnackbar; closeSnackbar: (key?: SnackbarKey) => void; } export declare class SnackbarProvider extends React.Component { enqueueSnackbar: ProviderContext['enqueueSnackbar']; closeSnackbar: ProviderContext['closeSnackbar']; render(): React.ReactNode; } export declare function useSnackbar(): ProviderContext; export declare const enqueueSnackbar: ProviderContext['enqueueSnackbar']; export declare const closeSnackbar: ProviderContext['closeSnackbar']; export declare const SnackbarContent: ( props: SnackbarContentProps & React.RefAttributes ) => React.ReactElement; export declare const Transition: React.JSXElementConstructor; export declare const MaterialDesignContent: ( props: CustomContentProps & React.RefAttributes ) => React.ReactElement;