rmwc
Version:
A thin React wrapper for Material Design (Web) Components
236 lines (235 loc) • 9.11 kB
TypeScript
/**
* Shows in browser notifications
*/
import { SimpleTagPropsT } from '../Base';
import * as React from 'react';
import { MDCSnackbar } from '@material/snackbar/dist/mdc.snackbar';
export declare type SnackbarPropsT = {
/** Show the Snackbar. */
show?: boolean;
/** A callback thats fired when the Snackbar shows. */
onShow?: () => any;
/** A callback thats fired when the Snackbar hides. */
onHide?: () => any;
/** A string or other renderable JSX to be used as the message body. */
message?: React.ReactNode;
/** Milliseconds to show the Snackbar for. */
timeout?: number;
/** Callback that fires when action is pressed. The actionText property must be set to use this. */
actionHandler?: () => any;
/** Label for the action button. */
actionText?: React.ReactNode;
/** Lets the Snackbar text overflow onto multiple lines. */
multiline?: boolean;
/** Places the action underneath the message text. */
actionOnBottom?: boolean;
/** Whether or not the Snackbar dismisses on the action press. */
dismissesOnAction?: boolean;
alignStart?: boolean;
} & SimpleTagPropsT;
export declare const SnackbarRoot: {
new <P>(props: any, context?: any): {
render(): React.ReactElement<any> | null;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: any) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callBack?: (() => void) | undefined): void;
props: Readonly<{
children?: React.ReactNode;
}> & Readonly<any>;
state: Readonly<{}>;
context: any;
refs: {
[key: string]: React.ReactInstance;
};
};
displayName: string;
defaultProps: {
tag: string | React.ComponentClass<any> | React.StatelessComponent<any>;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: string | number | symbol): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: string | number | symbol): boolean;
};
isSimpleTag: boolean;
};
export declare const SnackbarText: {
new <P>(props: any, context?: any): {
render(): React.ReactElement<any> | null;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: any) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callBack?: (() => void) | undefined): void;
props: Readonly<{
children?: React.ReactNode;
}> & Readonly<any>;
state: Readonly<{}>;
context: any;
refs: {
[key: string]: React.ReactInstance;
};
};
displayName: string;
defaultProps: {
tag: string | React.ComponentClass<any> | React.StatelessComponent<any>;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: string | number | symbol): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: string | number | symbol): boolean;
};
isSimpleTag: boolean;
};
export declare const SnackbarActionWrapper: {
new <P>(props: any, context?: any): {
render(): React.ReactElement<any> | null;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: any) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callBack?: (() => void) | undefined): void;
props: Readonly<{
children?: React.ReactNode;
}> & Readonly<any>;
state: Readonly<{}>;
context: any;
refs: {
[key: string]: React.ReactInstance;
};
};
displayName: string;
defaultProps: {
tag: string | React.ComponentClass<any> | React.StatelessComponent<any>;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: string | number | symbol): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: string | number | symbol): boolean;
};
isSimpleTag: boolean;
};
export declare const SnackbarActionButton: {
new <P>(props: any, context?: any): {
render(): React.ReactElement<any> | null;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: any) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callBack?: (() => void) | undefined): void;
props: Readonly<{
children?: React.ReactNode;
}> & Readonly<any>;
state: Readonly<{}>;
context: any;
refs: {
[key: string]: React.ReactInstance;
};
};
displayName: string;
defaultProps: {
tag: string | React.ComponentClass<any> | React.StatelessComponent<any>;
constructor: Function;
toString(): string;
toLocaleString(): string;
valueOf(): Object;
hasOwnProperty(v: string | number | symbol): boolean;
isPrototypeOf(v: Object): boolean;
propertyIsEnumerable(v: string | number | symbol): boolean;
};
isSimpleTag: boolean;
};
declare const Snackbar_base: {
new <P>(props: P & {
tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined;
className?: string | undefined;
wrap?: boolean | undefined;
elementRef?: any;
theme?: string | string[] | undefined;
children?: React.ReactNode;
apiRef?: (<S>(api: S) => S) | undefined;
} & React.HTMLProps<any>): {
foundation_: {
[key: string]: any;
adapter_: any;
init: Function;
destroy: Function;
} | null;
foundationRefs: {
[name: string]: (ref: HTMLElement) => any;
};
root_: Element | Text | null;
props: P & {
tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined;
className?: string | undefined;
wrap?: boolean | undefined;
elementRef?: any;
theme?: string | string[] | undefined;
children?: React.ReactNode;
apiRef?: (<S>(api: S) => S) | undefined;
} & React.HTMLProps<any>;
componentDidMount(): void;
componentWillReceiveProps(nextProps: P & {
tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined;
className?: string | undefined;
wrap?: boolean | undefined;
elementRef?: any;
theme?: string | string[] | undefined;
children?: React.ReactNode;
apiRef?: (<S>(api: S) => S) | undefined;
} & React.HTMLProps<any>): void;
componentWillUnmount(): void;
_safeSyncWithProps(props: Object): void;
initFoundation(): void;
destroyComponent(): void;
syncWithProps(nextProps: Object): void;
initialize(...args: any[]): void;
initialSyncWithDOM(): void;
destroy(): void;
getDefaultFoundation(): {
adapter_: {};
init: () => void;
destroy: () => void;
};
emit(evtType: string, evtData: Object, shouldBubble?: boolean): any;
listen(evtType: string, handler: Function): void;
unlisten(evtType: string, handler: Function): void;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: P & {
tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined;
className?: string | undefined;
wrap?: boolean | undefined;
elementRef?: any;
theme?: string | string[] | undefined;
children?: React.ReactNode;
apiRef?: (<S>(api: S) => S) | undefined;
} & React.HTMLProps<any>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callBack?: (() => void) | undefined): void;
render(): React.ReactNode;
state: Readonly<{}>;
context: any;
refs: {
[key: string]: React.ReactInstance;
};
};
};
/**
* A Snackbar component for notifications.
*/
export declare class Snackbar extends Snackbar_base<SnackbarPropsT> {
static displayName: string;
static defaultProps: {
show: boolean;
onHide: () => void;
onShow: () => void;
message: undefined;
timeout: undefined;
actionHandler: undefined;
actionText: undefined;
multiline: boolean;
actionOnBottom: boolean;
dismissesOnAction: boolean;
};
isShowing_: boolean;
dismissesOnAction: boolean;
show: Function;
isShowing: boolean;
syncWithProps(nextProps: MDCSnackbar): void;
render(): JSX.Element;
}
export default Snackbar;