@enact/sandstone
Version:
Large-screen/TV support library for Enact, containing a variety of UI components.
148 lines (139 loc) • 3.97 kB
TypeScript
// Type definitions for sandstone/TimePicker
import { ChangeableProps as ui_Changeable_ChangeableProps } from "@enact/ui/Changeable";
import * as React from "react";
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
export interface TimePickerBaseProps {
/**
* The `hour` component of the time.
*/
hour: number;
/**
* The `meridiem` component of the time.
*/
meridiem: number;
/**
* The `minute` component of the time.
*/
minute: number;
/**
* The order in which the component pickers are displayed.
*
* Should be an array of 2 or 3 strings containing one of `'h'` , `'k'` , `'m'` , and `'a'` .
*/
order: string[];
/**
* Disables voice control.
*/
"data-webos-voice-disabled"?: boolean;
/**
* Disables the `TimePicker` .
*/
disabled?: boolean;
/**
* The "aria-label" for the hour picker
*
* If not specified, the "aria-label" for the hour picker will be
a combination of the current value and 'hour change a value with up down button'.
*/
hourAriaLabel?: string;
/**
* The primary text of `TimePicker` .
*/
label?: string;
/**
* The "aria-label" for the meridiem picker.
*
* If not specified, the "aria-label" for the meridiem picker will be
a combination of the current value and 'change a value with up down button'.
*/
meridiemAriaLabel?: string;
/**
* The hint string read when focusing the meridiem picker.
*/
meridiemLabel?: string;
/**
* Array of meridiem labels to display.
*/
meridiems: string[];
/**
* The "aria-label" for the minute picker.
*
* If not specified, the "aria-label" for the minute picker will be
a combination of the current value and 'minute change a value with up down button'.
*/
minuteAriaLabel?: string;
/**
* Hides the label that displays the time.
*/
noLabel?: boolean;
/**
* Called on changes in the `hour` component of the time.
*/
onChangeHour?: Function;
/**
* Called on changes in the `meridiem` component of the time.
*/
onChangeMeridiem?: Function;
/**
* Called on changes in the `minute` component of the time.
*/
onChangeMinute?: Function;
/**
* Called when the component is removed while retaining focus.
*/
onSpotlightDisappear?: Function;
/**
* Called when the focus leaves the picker when the 5-way left key is pressed.
*/
onSpotlightLeft?: Function;
/**
* Called when the focus leaves the picker when the 5-way right key is pressed.
*/
onSpotlightRight?: Function;
/**
* Disables spotlight navigation into the component.
*/
spotlightDisabled?: boolean;
/**
* Called when `Enter` key down on the last picker
*/
onComplete?: Function;
}
/**
* is the stateless functional time picker
component. Should not be used directly but may be composed within another component as it is
within .
*/
export class TimePickerBase extends React.Component<
Merge<React.HTMLProps<HTMLElement>, TimePickerBaseProps>
> {}
export interface TimePickerProps extends ui_Changeable_ChangeableProps {
/**
* Default value
*/
defaultValue?: number;
/**
* The selected date.
*/
value?: Date;
}
/**
* A component that allows displaying or selecting time.
*
* Set the property to a standard JavaScript
object to initialize the picker.
*
* By default, `TimePicker` maintains the state of its `value` property. Supply the
`defaultValue` property to control its initial value. If you wish to directly control updates
to the component, supply a value to `value` at creation time and update it in response to
`onChange` events.
*/
export class TimePicker extends React.Component<
Merge<React.HTMLProps<HTMLElement>, TimePickerProps>
> {}
/**
* Converts a standard `Date` object into a locale-specific string.
*/
export function timeToLocaleString(time: Date): any;
export default TimePicker;