import { PropertyValueMap } from "lit"; import { DropdownElement } from "../../base/dropdown-element"; import { type SgdsFormControl } from "../../utils/formSubmitController"; import { SgdsButton } from "../Button/sgds-button"; import { DatepickerCalendar } from "./datepicker-calendar"; import { DatepickerHeader } from "./datepicker-header"; import DatepickerInput from "./datepicker-input"; import SgdsIconButton from "../IconButton/sgds-icon-button"; export type DateFormat = "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY/MM/DD"; declare const SgdsDatepicker_base: (new (...args: any[]) => import("../../utils/validatorMixin").ToBeValidatedElementInterface) & typeof DropdownElement; /** * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input * * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value * @event sgds-invalid - Emitted when the combo box's invalid state is set to true. * @event sgds-valid - Emitted when the combo box's invalid state is set to false. * * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current * date view of the calendar */ export declare class SgdsDatepicker extends SgdsDatepicker_base implements SgdsFormControl { static styles: import("lit").CSSResult[]; /**@internal */ static dependencies: { "sgds-datepicker-input": typeof DatepickerInput; "sgds-datepicker-calendar": typeof DatepickerCalendar; "sgds-datepicker-header": typeof DatepickerHeader; "sgds-button": typeof SgdsButton; "sgds-icon-button": typeof SgdsIconButton; }; constructor(); /** When true, adds required attribute to input element */ required: boolean; /**The datepicker input's name attribute */ name: string; /** When true, adds disabled attribute to input and button element */ disabled: boolean; /** Disables native and sgds validation for the datepicker. */ noValidate: boolean; /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`. * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode * For example, `value="22/12/2023"` for single mode or `value="22/12/2023 - 25/12/2023"` for range mode */ value: string; /** * Deprecated since v3.3.0 in favour of `value`. * The initial value of DatePicker on first load for single & * range mode as array of string. eg.'["22/12/2023"]' for single & * '["22/12/2023","25/12/2023"]' for range respectively @deprecated * */ initialValue: string[]; private dateFormat; /** ISO date string to set the lowest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */ minDate: string; /** ISO date string to set the highest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */ maxDate: string; /** Changes DatePicker to single date selection or range date selection */ mode: "single" | "range"; /**Feedback text for error state when date input is invalid */ invalidFeedback: string; /** Allows invalidFeedback and invalid styles to be visible with the input */ hasFeedback: boolean; /** The datepicker input's label */ label: string; /** The datepicker input's hint text below the label */ hintText: string; /** Controls auto-flipping of menu */ noFlip: boolean; /** The drop position of menu relative to the toggle button */ drop: "up" | "down"; /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */ displayDate: Date; /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */ defaultValue: string; /** Marks the component as invalid. Replace the pseudo :invalid selector. */ invalid: boolean; private view; private selectedDateRange; private focusedDate; private focusedTabIndex; private isValueEmpty; private initialDisplayDate; private calendar; private datepickerInputAsync; private datepickerInput; /** * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput */ reportValidity(): boolean; /** * Checks for validity without any native error popup message */ checkValidity(): boolean; /** * Programmatically sets the invalid state of the datepicker. * Use together with `noValidate` (or `novalidate` on the parent `
`) and `invalidFeedback` * to integrate 3rd-party or custom validation logic. */ setInvalid(bool: boolean): void; /** * Checks for validity without any native error popup message */ setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void; /** * Returns the ValidityState object */ get validity(): ValidityState; /** * Returns the validation message based on the ValidityState */ get validationMessage(): string; connectedCallback(): Promise; firstUpdated(changedProperties: PropertyValueMap): Promise; /** @internal */ private _getDateFormatRegex; private _handleTab; _handleValueChange(): void; private _handleCloseMenu; private _handleOpenMenu; private _makeInputValueString; private _handleSelectDatesInput; private _handleSelectDates; private _handleSelectDatesAndClose; /** update latest view state from datepicker-header */ private _handleViewChanged; private _handleDateChanged; private _handleFocusDateChanged; private _handleSelectMonth; private _handleSelectYear; private _handleInvalidInput; private _handleEmptyInput; private _resetDatepicker; private _manageInternalsBadInput; /** * Even though element internals handles the required constraint validation. This custom one is still needed as * datepicker input has a special case where the default input mask "DD/MM/YYYY" means an empty input. * However, the required constraint validation sees "DD/MM/YYYY" as a non-empty input. */ private _manageEmptyInput; /** * Called when a valid date is entered via input or selected by calendar * 1. sets validity state to valid * 2. updates invalid prop * 3. sets the form value of datepicker */ private _manageInternalsValid; /** * Handles the form "reset" event */ private _mixinResetFormControl; private _handleInputMaskChange; private _dialogAriaLabels; render(): import("lit").TemplateResult<1>; } export default SgdsDatepicker;