@astro-utils/forms
Version:
Server component for Astro (call server functions from client side with validation and state management)
29 lines (28 loc) • 1.16 kB
TypeScript
import type { AstroGlobal } from 'astro';
import { BindForm } from './form-utils/bind-form.js';
type InputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
type ExtendedInputTypes = InputTypes | 'int' | 'json';
export declare function getInputValue(astro: AstroGlobal, bindId: string, bind: BindForm<any>): Promise<FormDataEntryValue>;
export declare function validateFormInput(astro: AstroGlobal, bind: BindForm<any>, bindId: string): Promise<void>;
export declare function inputReturnValueAttr(astro: AstroGlobal, bind: BindForm<any>): {
checked: any;
value?: undefined;
min?: undefined;
max?: undefined;
} | {
checked?: undefined;
value?: undefined;
min?: undefined;
max?: undefined;
} | {
value: string | Date;
min: string | Date;
max: string | Date;
checked?: undefined;
};
export declare function caseTypes(type: ExtendedInputTypes): {
type: ExtendedInputTypes;
} & {
[key: string]: string;
};
export {};