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.
94 lines (91 loc) • 4.12 kB
text/typescript
import * as vue from 'vue';
import { ComponentPublicInstance } from 'vue';
import * as react from 'react';
import TimescapeManager, { Options, DateType, $NOW, RangeOptions } from './index.cjs';
declare const useTimescape: (options?: Options) => {
readonly _manager: TimescapeManager;
readonly registerElement: (type: DateType) => (element: Element | ComponentPublicInstance | null) => false | HTMLInputElement | undefined;
readonly registerRoot: () => (element: Element | ComponentPublicInstance | null) => void;
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: vue.Ref<{
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}, Options | {
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}>;
};
declare const useTimescapeRange: (options?: RangeOptions) => {
readonly registerRangeRoot: () => (element: Element | ComponentPublicInstance | null) => void;
readonly from: {
readonly registerElement: (type: DateType) => (element: Element | ComponentPublicInstance | null) => false | HTMLInputElement | undefined;
readonly options: vue.Ref<{
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}, Options | {
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}>;
};
readonly to: {
readonly registerElement: (type: DateType) => (element: Element | ComponentPublicInstance | null) => false | HTMLInputElement | undefined;
readonly options: vue.Ref<{
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}, Options | {
date?: Date | undefined;
minDate?: (Date | $NOW) | undefined;
maxDate?: (Date | $NOW) | undefined;
hour12?: boolean | undefined;
digits?: "numeric" | "2-digit" | undefined;
wrapAround?: boolean | undefined;
snapToStep?: boolean | undefined;
wheelControl?: boolean | undefined;
disallowPartial?: boolean | undefined;
}>;
};
};
export { $NOW, DateType, Options, RangeOptions, useTimescape, useTimescapeRange };