@ui5/webcomponents-react
Version:
React Wrapper for UI5 Web Components and additional components
62 lines (61 loc) • 3.45 kB
JavaScript
'use client';
import '@ui5/webcomponents/dist/TimePicker.js';
import { withWebComponent } from '@ui5/webcomponents-react-base';
/**
* 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](https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
*
* For example, if the valueFormat is "HH:mm:ss", the displayFormat is "hh:mm: ss a", and the used locale is English, a valid value string is "11:42:35", which leads to an output of "11:42:35 AM".
* If no placeholder is set to the TimePicker, the used displayFormat is displayed as a placeholder. If another placeholder is needed, it must be set.
*
* ### 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! [TimePicker UI5 Web Component Documentation](https://ui5.github.io/webcomponents/components/TimePicker) | [Repository](https://github.com/UI5/webcomponents)
*/
const TimePicker = withWebComponent('ui5-time-picker', ['accessibleDescription', 'accessibleDescriptionRef', 'accessibleName', 'accessibleNameRef', 'displayFormat', 'formatPattern', 'name', 'placeholder', 'value', 'valueFormat', 'valueState'], ['disabled', 'open', 'readonly', 'required'], ['valueStateMessage'], ['change', 'close', 'input', 'open']);
TimePicker.displayName = 'TimePicker';
export { TimePicker };