preact-material-components
Version:
preact wrapper for "Material Components for the web"
100 lines (99 loc) • 3.27 kB
TypeScript
import { MDCTextField } from '@material/textfield';
import { Component } from 'preact';
import MaterialComponent, { MaterialComponentProps } from '../Base/MaterialComponent';
import { SoftMerge } from '../Base/types';
export interface IHelperTextProps {
persistent?: boolean;
'validation-msg'?: boolean;
}
export interface IHelperTextState {
}
export declare class HelperText extends MaterialComponent<IHelperTextProps, IHelperTextState> {
protected componentName: string;
protected mdcProps: string[];
protected materialDom(props: any): JSX.Element;
}
export interface ILabelProps {
}
export interface ILabelState {
}
export declare class Label extends MaterialComponent<ILabelProps, ILabelState> {
protected componentName: string;
protected mdcProps: never[];
protected materialDom(props: any): JSX.Element;
}
export interface ITextFieldInputProps {
fullwidth?: boolean;
textarea?: boolean;
dense?: boolean;
box?: boolean;
disabled?: boolean;
outlined?: boolean;
cssLabel?: string;
leadingIcon?: string;
trailingIcon?: string;
outerStyle?: {
[key: string]: string;
};
onInit?: (c: MDCTextField) => any | void;
valid?: boolean;
value?: string;
}
export interface ITextFieldInputState {
jsComponentAttached: boolean;
}
export declare class TextFieldInput extends MaterialComponent<ITextFieldInputProps, ITextFieldInputState> {
static readonly defaultProps: {
valid: boolean;
};
state: {
jsComponentAttached: boolean;
};
MDComponent?: MDCTextField;
protected componentName: string;
protected mdcProps: string[];
protected mdcNotifyProps: string[];
componentDidMount(): void;
componentWillReceiveProps(nextProps: ITextFieldInputProps): void;
componentWillUnmount(): void;
getValue(): any;
protected materialDom(allprops: any): JSX.Element;
protected buildClassName(props: MaterialComponentProps<ITextFieldInputProps>): string;
}
declare type input_type = 'button' | 'checkbox' | 'color' | 'date' | 'datetime' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
interface ITextFieldOwnProps {
fullwidth?: boolean;
textarea?: boolean;
type?: input_type;
dense?: boolean;
box?: boolean;
disabled?: boolean;
outlined?: boolean;
valid?: boolean;
helperText?: string;
helperTextPersistent?: boolean;
helperTextValidationMsg?: boolean;
cssLabel?: string;
leadingIcon?: string;
trailingIcon?: string;
outerStyle?: {
[key: string]: string;
};
value?: string;
}
export interface ITextFieldProps extends SoftMerge<ITextFieldOwnProps, JSX.HTMLAttributes> {
}
export interface ITextFieldState {
}
export declare class TextField extends Component<ITextFieldProps, ITextFieldState> {
protected static uidCounter: number;
protected static uid(): number;
MDComponent?: MDCTextField;
protected readonly id: number;
componentDidMount(): void;
render(allprops: any): JSX.Element;
}
export default class extends TextField {
static readonly HelperText: typeof HelperText;
}
export {};