UNPKG

rmwc

Version:

A thin React wrapper for Material Design (Web) Components

129 lines (128 loc) 5.14 kB
import { SimpleTagPropsT, CustomEventT } from '../Base'; import { IconPropsT } from '../Icon'; import * as React from 'react'; export declare type IconButtonPropsT = { /** A label for non-toggleable buttons */ label?: React.ReactNode; /** The icon to use when a toggleable button is on. */ onContent?: React.ReactNode; /** The label to use when a toggleable button is on. */ onLabel?: React.ReactNode; /** The icon to use when a toggleable button is off. */ offContent?: React.ReactNode; /** The label to use when a toggleable button is off. */ offLabel?: React.ReactNode; /** Controls the on / off state of the a toggleable button. */ checked?: boolean; /** An onChange callback that receives a custom event. */ onChange?: (evt: CustomEventT<{ isOn: boolean; }>) => any; /** Makes the button disabled */ disabled?: boolean; } & SimpleTagPropsT & IconPropsT; export declare const IconButtonRoot: { 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 IconButton_base: { new <P>(props: P & { tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined; wrap?: boolean | undefined; elementRef?: any; theme?: string | string[] | undefined; apiRef?: (<S>(api: S) => S) | undefined; } & React.HTMLAttributes<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; wrap?: boolean | undefined; elementRef?: any; theme?: string | string[] | undefined; apiRef?: (<S>(api: S) => S) | undefined; } & React.HTMLAttributes<any>; componentDidMount(): void; componentWillReceiveProps(nextProps: P & { tag?: string | React.ComponentClass<any> | React.StatelessComponent<any> | undefined; wrap?: boolean | undefined; elementRef?: any; theme?: string | string[] | undefined; apiRef?: (<S>(api: S) => S) | undefined; } & React.HTMLAttributes<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; wrap?: boolean | undefined; elementRef?: any; theme?: string | string[] | undefined; apiRef?: (<S>(api: S) => S) | undefined; } & React.HTMLAttributes<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; }; }; }; export declare class IconButton extends IconButton_base<IconButtonPropsT> { static displayName: string; on: boolean; initRipple_: Function; ripple_: any; /** Takes into account our checked prop */ isOn(): boolean | null; initialize(): void; syncWithProps(nextProps: IconButtonPropsT): void; renderIcon(): {} | null | undefined; render(): JSX.Element; } export default IconButton;