UNPKG

@vtex/admin-ui

Version:

> VTEX admin component library

121 lines (120 loc) 6.72 kB
/// <reference types="react" /> import type { ValueBase } from '@react-types/shared'; import type { PickerInitialState } from '../picker'; import type { DateFieldInitialState } from '../date-field'; import type { DateObject } from '../calendar/utils'; import type { CalendarInitialState } from '../calendar'; export declare type DatePickerInitialState = ValueBase<string> & {} & PickerInitialState & Pick<Partial<DateFieldInitialState>, 'formatOptions' | 'placeholder'> & Pick<CalendarInitialState, 'minValue' | 'maxValue' | 'defaultValue'> & { /** * Whether should receive focus on render * @default false */ autoFocus?: boolean; /** * Whether is invalid * @default false */ tone?: 'neutral' | 'critical'; /** * Whether is required * @default false */ required?: boolean; /** * Whether is disabled * @default false */ disabled?: boolean; }; export declare const useDatePickerState: (props?: DatePickerInitialState) => { dateValue: DateObject; setDateValue: import("react").Dispatch<import("react").SetStateAction<DateObject>>; selectDate: (newValue: DateObject) => void; required: boolean; disabled: boolean; calendarState: import("../calendar").CalendarStateReturn; tone: "neutral" | "critical"; pickerState: { baseId: string; unstable_idCountRef: import("react").MutableRefObject<number>; visible: boolean; animated: number | boolean; animating: boolean; setBaseId: import("react").Dispatch<import("react").SetStateAction<string>>; show: () => void; hide: () => void; toggle: () => void; setVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>; setAnimated: import("react").Dispatch<import("react").SetStateAction<number | boolean>>; stopAnimation: () => void; modal: boolean; unstable_disclosureRef: import("react").MutableRefObject<HTMLElement | null>; setModal: import("react").Dispatch<import("react").SetStateAction<boolean>>; unstable_referenceRef: import("react").RefObject<HTMLElement | null>; unstable_popoverRef: import("react").RefObject<HTMLElement | null>; unstable_arrowRef: import("react").RefObject<HTMLElement | null>; unstable_popoverStyles: import("react").CSSProperties; unstable_arrowStyles: import("react").CSSProperties; unstable_originalPlacement: "auto-start" | "auto" | "auto-end" | "top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start"; unstable_update: () => boolean; placement: "auto-start" | "auto" | "auto-end" | "top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start"; place: import("react").Dispatch<import("react").SetStateAction<"auto-start" | "auto" | "auto-end" | "top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start">>; pickerId: string | undefined; popoverId: string | undefined; isDisabled: boolean | undefined; isReadOnly: boolean | undefined; segmentFocus: (() => void) | undefined; }; dateFieldState: { showPlaceholder: import("react").MutableRefObject<Record<string | number | symbol, any>>; fieldValue: Date; setFieldValue: import("react").Dispatch<import("react").SetStateAction<Date>>; segments: import("../segment").DateSegment[]; dateFormatter: import("@internationalized/date").DateFormatter; resetPlaceholder: () => void; displayPlaceholder: () => void; increment(part: Intl.DateTimeFormatPartTypes): void; decrement(part: Intl.DateTimeFormatPartTypes): void; incrementPage(part: Intl.DateTimeFormatPartTypes): void; decrementPage(part: Intl.DateTimeFormatPartTypes): void; setSegment(part: Intl.DateTimeFormatPartTypes, v: number): void; baseId: string; unstable_idCountRef: import("react").MutableRefObject<number>; setBaseId: import("react").Dispatch<import("react").SetStateAction<string>>; unstable_virtual: boolean; rtl: boolean; orientation?: "horizontal" | "vertical" | undefined; items: import("reakit/ts/Composite/__utils/types").Item[]; groups: import("reakit/ts/Composite/__utils/types").Group[]; currentId?: string | null | undefined; loop: boolean | "horizontal" | "vertical"; wrap: boolean | "horizontal" | "vertical"; shift: boolean; unstable_moves: number; unstable_hasActiveWidget: boolean; unstable_includesBaseElement: boolean; registerItem: (item: import("reakit/ts/Composite/__utils/types").Item) => void; unregisterItem: (id: string) => void; registerGroup: (group: import("reakit/ts/Composite/__utils/types").Group) => void; unregisterGroup: (id: string) => void; move: (id: string | null) => void; next: (unstable_allTheWay?: boolean | undefined) => void; previous: (unstable_allTheWay?: boolean | undefined) => void; up: (unstable_allTheWay?: boolean | undefined) => void; down: (unstable_allTheWay?: boolean | undefined) => void; first: () => void; last: () => void; sort: () => void; unstable_setVirtual: import("react").Dispatch<import("react").SetStateAction<boolean>>; setRTL: import("react").Dispatch<import("react").SetStateAction<boolean>>; setOrientation: import("react").Dispatch<import("react").SetStateAction<"horizontal" | "vertical" | undefined>>; setCurrentId: import("react").Dispatch<import("react").SetStateAction<string | null | undefined>>; setLoop: import("react").Dispatch<import("react").SetStateAction<boolean | "horizontal" | "vertical">>; setWrap: import("react").Dispatch<import("react").SetStateAction<boolean | "horizontal" | "vertical">>; setShift: import("react").Dispatch<import("react").SetStateAction<boolean>>; reset: () => void; unstable_setIncludesBaseElement: import("react").Dispatch<import("react").SetStateAction<boolean>>; unstable_setHasActiveWidget: import("react").Dispatch<import("react").SetStateAction<boolean>>; }; }; export declare type DatePickerStateReturn = ReturnType<typeof useDatePickerState>;