UNPKG

2 kBTypeScriptView Raw
1import * as React from 'react';
2import { ClickAwayListener, ClickAwayListenerProps } from '../ClickAwayListener';
3import { UseSnackbarParameters } from '../useSnackbar';
4import { PolymorphicProps, SlotComponentProps } from '../utils';
5export interface SnackbarRootSlotPropsOverrides {
6}
7export interface SnackbarClickAwayListenerSlotPropsOverrides {
8}
9export interface SnackbarOwnProps extends Omit<UseSnackbarParameters, 'ref'> {
10 children?: React.ReactNode;
11 /**
12 * The components used for each slot inside the Snackbar.
13 * Either a string to use a HTML element or a component.
14 * @default {}
15 */
16 slots?: SnackbarSlots;
17 /**
18 * The props used for each slot inside the Snackbar.
19 * @default {}
20 */
21 slotProps?: {
22 clickAwayListener?: SlotComponentProps<typeof ClickAwayListener, SnackbarClickAwayListenerSlotPropsOverrides, SnackbarOwnerState>;
23 root?: SlotComponentProps<'div', SnackbarRootSlotPropsOverrides, SnackbarOwnerState>;
24 };
25 /**
26 * The prop used to handle exited transition and unmount the component.
27 * @default true
28 */
29 exited?: boolean;
30}
31export interface SnackbarSlots {
32 /**
33 * The component that renders the root.
34 * @default 'div'
35 */
36 root?: React.ElementType;
37}
38export interface SnackbarTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
39 props: SnackbarOwnProps & AdditionalProps;
40 defaultComponent: RootComponentType;
41}
42export type SnackbarProps<RootComponentType extends React.ElementType = SnackbarTypeMap['defaultComponent']> = PolymorphicProps<SnackbarTypeMap<{}, RootComponentType>, RootComponentType>;
43export type SnackbarOwnerState = SnackbarOwnProps;
44export type SnackbarRootSlotProps = {
45 ownerState: SnackbarOwnerState;
46 className?: string;
47 children?: React.ReactNode;
48 ref: React.Ref<any>;
49};
50export interface SnackbarClickAwayListenerSlotProps extends ClickAwayListenerProps {
51 ownerState: SnackbarOwnerState;
52}