UNPKG

rmwc

Version:

A thin React wrapper for Material Design (Web) Components

311 lines (310 loc) 12.4 kB
import { SimpleTagPropsT } from '../Base'; import { IconPropsT } from '../Icon'; import * as React from 'react'; export declare type ChipPropsT = { /** A custom event you can use from MCW. You can also just use onClick instead. */ onInteraction?: (evt: Event) => any; /** A custom event for the trailing icon that you can use from MCW. You can also just use onClick instead. */ onTrailingIconInteraction?: (evt: Event) => any; /** makes the Chip appear selected. */ selected?: boolean; } & SimpleTagPropsT; /** A chip component. */ export declare const ChipRoot: { 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 Chip_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; }; }; }; export declare class Chip extends Chip_base<ChipPropsT> { static displayName: string; leadingIcon_: any; ripple_: any; root_: Element; initialize(): void; render(): JSX.Element; } /** A checkmark for chip selection and filtering. */ export declare const ChipCheckmark: () => JSX.Element; /** Text for a chip. */ export declare const ChipText: { 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 type ChipIconPropsT = { /** Make it a leading icon */ leading?: boolean; /** Make it a trailing icon */ trailing?: boolean; } & SimpleTagPropsT & IconPropsT; /** Icons inside of a chip. This is an instance of the Icon component. To make the icons interactive, add props tabIndex="0" and role="button". */ export declare const ChipIconRoot: { 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 ChipIcon: React.ComponentType<ChipIconPropsT>; export declare type ChipSetPropsT = { /** Creates a choice chipset */ choice?: boolean; /** Creates a filter chipset */ filter?: boolean; }; export declare const ChipSetRoot: { 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 ChipSet_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 container for multiple Chip components. */ export declare class ChipSet extends ChipSet_base<ChipSetPropsT> { render(): JSX.Element; } export declare type SimpleChipPropsT = { /** Text for your Chip */ text?: React.ReactNode; /** Instance of an Icon Component */ leadingIcon?: React.ReactNode; /** Instance of an Icon Component */ trailingIcon?: React.ReactNode; /** Includes a checkmark for the selected state */ checkmark?: boolean; /** Additional children will be rendered in the text area */ children?: React.ReactNode; }; /** A non-standard abbreviated way for rendering chips. */ export declare const SimpleChip: React.ComponentType<SimpleChipPropsT>; export {};