UNPKG

timescape

Version:

A flexible, headless date and time input library for JavaScript. Provides tools for building fully customizable date and time input fields, with support for libraries like React, Preact, Vue, Svelte and Solid.

54 lines (51 loc) 1.87 kB
import * as react from 'react'; import * as signals from '@preact/signals'; import { MutableRef } from 'preact/hooks'; import TimescapeManager, { Options, DateType, RangeOptions } from './index.js'; export { $NOW } from './index.js'; declare const useTimescape: (options?: Options) => { readonly _manager: TimescapeManager; readonly getInputProps: (type: DateType, opts?: { ref?: MutableRef<HTMLInputElement | null>; autofocus?: boolean; }) => { ref: (element: HTMLInputElement | null) => void; }; readonly getRootProps: () => { ref: (element: HTMLElement | null) => void | null; }; readonly ampm: { readonly value: "am" | "pm" | undefined; set: (value: "am" | "pm") => void; toggle: () => void; getSelectProps: () => { value: "am" | "pm" | undefined; onChange: (e: Event | react.ChangeEvent<HTMLSelectElement>) => void; }; }; readonly options: signals.Signal<Options>; }; declare const useTimescapeRange: (options?: RangeOptions) => { readonly getRootProps: () => { ref: (element: HTMLElement | null) => void; }; readonly from: { readonly getInputProps: (type: DateType, opts?: { ref?: MutableRef<HTMLInputElement | null>; autofocus?: boolean; }) => { ref: (element: HTMLInputElement | null) => void; }; readonly options: signals.Signal<Options>; }; readonly to: { readonly getInputProps: (type: DateType, opts?: { ref?: MutableRef<HTMLInputElement | null>; autofocus?: boolean; }) => { ref: (element: HTMLInputElement | null) => void; }; readonly options: signals.Signal<Options>; }; }; export { DateType, Options, RangeOptions, useTimescape, useTimescapeRange };