@coconut-software/ui
Version:
React components for faster and easier web development.
30 lines (29 loc) • 1.44 kB
TypeScript
import type { MouseEventHandler, PropsWithChildren } from 'react';
import { AriaLiveRole } from '../utilities/aria';
interface SnackbarProps {
anchorOrigin: AnchorOrigin;
autoHideDuration?: number;
open?: boolean;
role?: AriaLiveRole.Alert | AriaLiveRole.Status;
severity?: Severity;
}
type Severity = 'error' | 'info' | 'success' | 'warning';
type HorizontalAchorOrigin = 'center' | 'left' | 'right';
type VerticalAnchorOrigin = 'bottom' | 'center' | 'top';
type AnchorOrigin = {
horizontal: HorizontalAchorOrigin;
vertical: VerticalAnchorOrigin;
};
declare function Snackbar({ anchorOrigin: { horizontal, vertical }, autoHideDuration, children, open, role, severity, }: PropsWithChildren<SnackbarProps>): JSX.Element | null;
declare namespace Snackbar {
var Actions: ({ children, }: PropsWithChildren<Record<string, unknown>>) => JSX.Element;
var Button: ({ children, dataSet, onClick, }: PropsWithChildren<ButtonProps>) => JSX.Element;
var Content: ({ children, }: PropsWithChildren<Record<string, unknown>>) => JSX.Element;
var Description: ({ children, }: PropsWithChildren<Record<string, unknown>>) => JSX.Element;
var Title: ({ children, }: PropsWithChildren<Record<string, unknown>>) => JSX.Element;
}
interface ButtonProps {
dataSet?: Record<string, string | undefined>;
onClick?: MouseEventHandler<HTMLButtonElement>;
}
export default Snackbar;