UNPKG

@ui5/webcomponents-react

Version:

React Wrapper for UI5 Web Components and additional components

61 lines (60 loc) 3.05 kB
'use client'; import { withWebComponent } from '../../internal/withWebComponent.js'; /** * The `TimePicker` component provides an input field with assigned clocks which are opened on user action. * The `TimePicker` allows users to select a localized time using touch, mouse, or keyboard input. * It consists of two parts: the time input field and the clocks. * * ### Usage * The user can enter a time by: * * - Using the clocks that are displayed in a popup * - Typing it in directly in the input field * * When the user makes an entry and chooses the enter key, the clocks show the corresponding time (hours, minutes and seconds separately). * When the user directly triggers the clocks display, the actual time is displayed. * For the `TimePicker` * * ### Formatting * * If a time is entered by typing it into * the input field, it must fit to the used time format. * * Supported format options are pattern-based on Unicode LDML Date Format notation. * For more information, see [UTS #35: Unicode Locale Data Markup Language](http://unicode.org/reports/tr35/#Date_Field_Symbol_Table). * * For example, if the `format-pattern` is "HH:mm:ss", * a valid value string is "11:42:35" and the same is displayed in the input. * * ### Keyboard handling * [F4], [Alt]+[Up], [Alt]+[Down] Open/Close picker dialog and move focus to it. * * When closed: * * - [Page Up] - Increments hours by 1. If 12 am is reached, increment hours to 1 pm and vice versa. * - [Page Down] - Decrements the corresponding field by 1. If 1 pm is reached, decrement hours to 12 am and vice versa. * - [Shift]+[Page Up] - Increments minutes by 1. * - [Shift]+[Page Down] - Decrements minutes by 1. * - [Shift]+[Ctrl]+[Page Up] - Increments seconds by 1. * - [Shift]+[Ctrl]+[Page Down] - Decrements seconds by 1. * - * * When opened: * * - [Page Up] - Increments hours by 1. If 12 am is reached, increment hours to 1 pm and vice versa. * - [Page Down] - Decrements the corresponding field by 1. If 1 pm is reached, decrement hours to 12 am and vice versa. * - [Shift]+[Page Up] - Increments minutes by 1. * - [Shift]+[Page Down] - Decrements minutes by 1. * - [Shift]+[Ctrl]+[Page Up] - Increments seconds by 1. * - [Shift]+[Ctrl]+[Page Down] - Decrements seconds by 1. * - [A] or [P] - Selects AM or PM respectively. * - [0]-[9] - Allows direct time selecting (hours/minutes/seconds). * - [:] - Allows switching between hours/minutes/seconds clocks. If the last clock is displayed and [:] is pressed, the first clock is beind displayed. * * * * __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/) */ const TimePicker = withWebComponent('ui5-time-picker', ['accessibleName', 'accessibleNameRef', 'formatPattern', 'name', 'placeholder', 'value', 'valueState'], ['disabled', 'open', 'readonly', 'required'], ['valueStateMessage'], ['change', 'close', 'input', 'open']); TimePicker.displayName = 'TimePicker'; export { TimePicker };