import React from 'react'; import { Validator, UseValidationProps } from '@interface-technologies/iti-react-core'; /** * The value type of the [[`TimeInput`]] component. * * `hours` will always be between 1 and 12. * * We don't do `TimeInputValue = Moment` because representing time of day with a datetime * leads to DST bugs. */ export type TimeInputValue = { hours: number | undefined; minutes: number | undefined; ampm: 'am' | 'pm' | undefined; }; export declare const defaultTimeInputValue: TimeInputValue; /** * Example: * * ``` * timeInputValueFromDecimalHours(9.75) * // returns { hours: 9, minutes: 45, ampm: 'am' } * ``` * * @returns a [[`TimeInputValue`]] or `undefined` if `decimalHours` is `undefined`. */ export declare function timeInputValueFromDecimalHours(decimalHours: number | undefined): TimeInputValue; export declare function timeInputValueToDecimalHours(value: TimeInputValue): number | undefined; /** See [[`DefaultClearButtonComponent`]] and [[`TimeInput`]]. */ export interface ClearButtonComponentProps { onClick(): void; enabled: boolean; } /** * The default clear button used in [[`TimeInput`]]. You can provide a different * clear button component if you want. */ export declare function DefaultClearButtonComponent({ onClick, enabled, }: ClearButtonComponentProps): React.ReactElement; export interface TimeInputProps extends UseValidationProps { individualInputsRequired: boolean; enabled?: boolean; isClearable?: boolean; clearButtonComponent?: React.FunctionComponent; } /** * A time of day input with dropdowns for hours, minutes, and am/pm. * * Make sure to pass `individualInputsRequired=true` and `isClearable=false` * as well as `TimeValidators.required()` if the time is required. * * It's not the most performant or user-friendly component but it has gotten the job * done so far. */ export declare const TimeInput: React.NamedExoticComponent; declare function required(): Validator; /** Validators for use with [[`TimeInput`]]. */ export declare const TimeValidators: { required: typeof required; }; export {};