UNPKG

semantic-ui-calendar-react

Version:
84 lines (83 loc) 3.32 kB
import { Moment } from 'moment'; import * as React from 'react'; import { TimeFormat } from '../pickers/BasePicker'; export interface BaseInputProps { [key: string]: any; /** Currently selected value. */ value: string; /** Called on selected value change. */ onChange: (e: React.SyntheticEvent, data: any) => void; /** If true, popup closes after selecting a value. */ closable?: boolean; /** An input can be formatted to appear inline in other content. */ inline?: boolean; /** Optional icon to display inside the Input. */ icon?: string | false; /** * Called on clear. * * @param {SyntheticEvent} event - React's original SyntheticEvent. * @param {object} data - All props and proposed value. */ onClear?: (event: React.SyntheticEvent<HTMLInputElement>, data: any) => void; /** Using the clearable setting will let users remove their selection from a calendar. */ clearable?: boolean; /** Optional Icon to display inside the clearable Input. */ clearIcon?: any; /** Position for the popup. */ popupPosition?: 'top left' | 'top right' | 'bottom left' | 'bottom right' | 'right center' | 'left center' | 'top center' | 'bottom center'; /** Should close when cursor leaves calendar popup. */ closeOnMouseLeave?: boolean; /** The node where the picker should mount. */ mountNode?: any; /** A field can have its label next to instead of above it. */ inlineLabel?: boolean; } export interface DateRelatedProps { /** Moment date formatting string. */ dateFormat?: string; /** Date to display initially when no date is selected. */ initialDate?: string | Date | Moment; } export interface TimeRelatedProps { /** Time format. */ timeFormat?: TimeFormat; /** If true, minutes picker won't be shown after picking the hour. */ disableMinute?: boolean; } export interface DisableValuesProps { /** Date or list of dates that are displayed as disabled. */ disable?: string | string[] | Moment | Moment[] | Date | Date[]; } export interface EnableValuesProps { /** Date or list of dates that are enabled (the rest are disabled). */ enable?: string | string[] | Moment | Moment[] | Date | Date[]; } export interface MinMaxValueProps { /** Maximum date that can be selected. */ maxDate?: string | Moment | Date; /** Minimum date that can be selected. */ minDate?: string | Moment | Date; } export interface MultimodeProps { /** Preserve viewmode on focus? */ preserveViewMode?: boolean; } export interface BaseInputState { popupIsClosed: boolean; } declare abstract class BaseInput<P extends BaseInputProps, S extends BaseInputState> extends React.Component<P, S> { static defaultProps: { inline: boolean; }; private calendarNode; private inputNode; protected closePopup: () => void; protected onPopupClose: () => void; protected isPickerInFocus: () => boolean; protected isTriggerInFocus: () => boolean; protected onModeSwitch: () => void; protected onCalendarViewMount: (calendarNode: HTMLElement) => void; protected onInputViewMount: (inputNode: HTMLElement) => void; } export default BaseInput;