maille
Version:
Component library for MithrilJS
46 lines (45 loc) • 1.7 kB
TypeScript
import m from "mithril";
import { ClassComponent, CVnode, Vnode, ChildArray, Children } from "mithril";
import { MithrilEvent } from "../../types";
export declare type RadioInputGroupOnChangeFn = (value: any, e: MithrilEvent) => any;
export interface RadioInputGroupAttrs {
id?: string;
className?: string;
bordered?: boolean;
rounded?: boolean;
disabled?: boolean;
inputStyle?: RadioInputStyle;
name?: string;
value?: any;
onchange?: RadioInputGroupOnChangeFn;
options: RadioInputOption[];
}
export interface RadioInputOption {
value: any;
checked?: boolean;
rounded?: boolean;
label: Children;
}
export declare enum RadioInputStyle {
Default = "default",
Button = "button"
}
declare class RadioInputGroup implements ClassComponent<RadioInputGroupAttrs> {
protected value: any;
protected name: string;
protected options: RadioInputOption[];
protected children: ChildArray;
protected changedOnce: boolean;
protected disabled: boolean;
protected rounded: boolean;
protected inputStyle: RadioInputStyle;
constructor(vnode?: CVnode<RadioInputGroupAttrs>);
view(vnode: Vnode<RadioInputGroupAttrs>): m.Children;
protected internalOnChange: RadioInputGroupOnChangeFn;
protected buildContainer(classes: string[], vnode: Vnode<RadioInputGroupAttrs>): Children;
protected buildChild(option: RadioInputOption, checked: boolean, idx: number): Children;
protected buildChildren(options: RadioInputOption[]): ChildArray;
protected getSelectedValue(e?: MithrilEvent): any;
protected onchange(e: MithrilEvent, value: any): Promise<any> | undefined;
}
export default RadioInputGroup;