/** * A Field describes a single field in an action or form. * * Fields can be used to automatically render forms or other UIs based on * hypermedia actions. */ export interface BaseField { /** * Name of the field. * * Typically this is the property that will get sent to a server. */ name: string; /** * Type describes the type of the property. * * This is similar to the HTML5 "type" attribute on forms. */ type: TType; /** * The current (pre-filed) value on the form. */ value?: TValue; /** * This could be used to describe a sample value. */ placeholder?: TValue; /** * Whether this field is required for submitting the form. */ required: boolean; /** * Render the field as read-only. */ readOnly: boolean; /** * A human-readable label for the field. */ label?: string; } /** * A checkbox basically behaves like a boolean. */ export declare type Checkbox = BaseField<'checkbox', boolean>; /** * A color picker. */ export declare type Color = BaseField<'color', string>; /** * A 'date' field. */ export declare type Date = BaseField<'date', string>; /** * @deprecated */ export declare type DateTime = BaseField<'datetime', Date>; export declare type DateTimeLocal = BaseField<'datetime-local', Date>; export declare type Email = BaseField<'email', string>; export declare type File = BaseField<'file', never>; export declare type Hidden = BaseField<'hidden', string>; export interface Number extends BaseField<'number', number> { max?: number; min?: number; step?: number; } export declare type Month = BaseField<'month', string>; export declare type Password = BaseField<'password', string>; export interface Radio extends BaseField<'radio', string> { options?: Map; } export interface Range extends BaseField<'range', number> { max?: number; min?: number; step?: number; } export declare type Search = BaseField<'search', string>; export declare type Tel = BaseField<'tel', string>; export interface Text extends BaseField<'text', string> { minLength?: number; maxLength?: number; pattern?: RegExp; options?: Map; } export declare type Time = BaseField<'time', string>; export declare type Url = BaseField<'url', string>; export declare type Week = BaseField<'week', string>; export declare type Field = Checkbox | Color | Date | DateTime | DateTimeLocal | Email | File | Hidden | Number | Month | Password | Radio | Range | Search | Tel | Text | Time | Url | Week;