/** * The `auro-calendar-cell` component renders a single selectable day button within a calendar month grid. * * @event calendar-cell-activate - Notifies that this cell has been activated via click or tap. * @event date-is-hovered - Notifies that this cell's date is being hovered. * @event calendar-cell-focused - Notifies that this cell's button has received focus. * @csspart dateSlot - Use for customizing the style of the date slot content container. */ export class AuroCalendarCell extends LitElement { static get properties(): { /** * The day object for this cell, containing its Unix timestamp (`date`) and day-of-month title. */ day: { type: ObjectConstructor; }; /** * Whether this cell's date is currently selected. */ selected: { type: BooleanConstructor; }; /** * The end (return) date of the selected range as a Unix-timestamp string. */ dateTo: { type: StringConstructor; attribute: string; }; /** * The start (depart) date of the selected range as a Unix-timestamp string. */ dateFrom: { type: StringConstructor; attribute: string; }; /** * The month this cell belongs to. */ month: { type: StringConstructor; }; /** * The minimum selectable date as a Unix timestamp. */ min: { type: NumberConstructor; }; /** * The maximum selectable date as a Unix timestamp. */ max: { type: NumberConstructor; }; /** * Whether this cell is disabled because its date falls outside the min/max range. */ disabled: { type: BooleanConstructor; reflect: boolean; }; /** * Legacy array of Unix-timestamp dates that cannot be selected. * @deprecated Propagated from the legacy `auro-calendar.disabledDays` * Unix-timestamp array. The cell honors it for backward compatibility * (see the divergence-check fallback inside `isBlackout`), but * consumers should migrate to `auro-datepicker.blackoutDates` * (YYYY-MM-DD ISO strings). The calendar emits a one-time * deprecation warning the first time a non-empty value is observed. * @type {number[]} */ disabledDays: number[]; /** * Whether this cell represents the current date (today). */ isCurrentDate: { type: BooleanConstructor; attribute: string; }; /** * The BCP 47 locale tag used to format the cell's date. */ locale: { type: StringConstructor; }; /** * The cell's date formatted as a `YYYY_MM_DD` slot-name string. */ dateStr: { type: StringConstructor; attribute: string; }; /** * Whether to render the numerical date off-center to leave room below for date slot content. */ renderForDateSlot: { type: BooleanConstructor; attribute: string; }; /** * Whether this cell has popover slot content to display. */ hasPopoverContent: { type: BooleanConstructor; attribute: string; }; }; static get styles(): import("lit").CSSResult[]; day: any; selected: boolean; dateTo: any; dateFrom: any; month: any; min: any; max: any; disabled: boolean; /** @type {number[]} */ disabledDays: number[]; isCurrentDate: boolean; _locale: any; dateStr: string | null; renderForDateSlot: boolean; active: boolean; hasPopoverContent: boolean; runtimeUtils: any; popoverTag: any; set locale(value: any); get locale(): any; /** * Handles selected state of the calendar cell when the selection changes. * Also clears any imperative range preview classes so classMap is the * sole source of truth after a selection update. * @private * @param {Number} dateFrom - Depart date. * @param {Number} dateTo - Return date. * @param {Object} day - An object containing the dateFrom and day of month values. * @returns {void} */ private dateChanged; /** * Handles user click events and calls datepicker to update the value(s). * @private * @returns {void} */ private handleTap; /** * Handles user hover events and dispatches a custom event. * Does NOT set any reactive properties — the range preview is handled * imperatively by the calendar component to avoid O(N) re-renders. * @private * @returns {void} */ private handleHover; /** * Handles focus events on the cell button. * Dispatches a lightweight event for the calendar to handle SR * announcements and range preview updates without triggering * any Lit lifecycle updates. * @private * @returns {void} */ private handleFocus; /** * Checks if the current date is outside the valid min/max range. * Out-of-range cells are not focusable and are hidden from screen readers. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} min - The minimum date value. * @param {Number} max - The maximum date value. * @returns {Boolean} - True if the date is out of range. */ private isOutOfRange; /** * Checks if the current date is a blackout date (in disabledDays but within range). * Blackout cells are focusable but not selectable. * @private * @returns {Boolean} - True if the date is a blackout date. */ private isBlackout; /** * Checks if the current date is disabled based on min/max range or the * legacy disabledDays timestamp list. Sets the `disabled` attribute on the * host when the date falls outside the allowed range or appears in * disabledDays. Note: blackout dates are handled separately by `isBlackout()`. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} min - The minimum date value. * @param {Number} max - The maximum date value. * @param {Array} disabledDays - An array of disabled dates. * @returns {Boolean} - True if the date is disabled. */ private isEnabled; /** * Generates a unique cell ID in the format cell-YYYY-MM-DD. * @private * @returns {String} The unique cell ID. */ private getCellId; /** * Generates a localized aria-label for the cell button using Intl.DateTimeFormat. * Includes range position and blackout status. * @private * @returns {String} The aria-label string. */ private getAriaLabel; /** * Determines the range position of this cell relative to the current selection. * @private * @returns {String|null} Range position label or null if not in range mode. */ private getRangePosition; /** * Checks if the current date is the depart date. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} dateFrom - Depart date. * @returns {Boolean} True if the date is the depart date. */ private isDepartDate; /** * Checks if the current date is the return date. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} dateFrom - Depart date. * @param {Number} dateTo - Return date. * @returns {Boolean} True if the date is the return date. */ private isReturnDate; /** * Checks if the current date is between dateFrom and dateTo. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} dateFrom - Depart date. * @param {Number} dateTo - Return date. * @returns {Boolean} True if the current date is between dateFrom and dateTo. */ private isInRange; /** * Determines the hovered date appearing latest in the calendar. * @private * @param {Object} day - An object containing the dateFrom and day of month values. * @param {Number} dateFrom - Depart date. * @param {Number} dateTo - Return date. * @param {Number} hoveredDate - Hovered date. * @returns {Boolean} True if the hovered date is the latest hovered date in the calendar. */ private isLastHoveredDate; /** * Checks if the current date is a referenced date. * @param {Object} dateStr - The date string in YYYY_MM_DD format. * @returns Boolean - True if the date is a referenced date. */ isReferenceDate(dateStr: Object): boolean; /** * Determines the title of the auro-calendar-cell. * @private * @param {Number} date - The date of the auro-calendar-cell. * @returns {String} The title of the auro-calendar-cell in the user's locale. */ private getTitle; _titleFormatter: Intl.DateTimeFormat | undefined; _titleFormatterLocale: any; /** * Gets the name of the date slot. * @private * @returns {void} */ private setDateSlotName; /** * Remove existing cell slot content and clone any current slot content from the root `auro-datepicker` which matches this cells date. * @private * @returns {void} */ private handleSlotContent; firstUpdated(): void; /** * Wires the cell to its ancestor calendar-month and calendar (and, via * the calendar, to the datepicker). Extracted from firstUpdated() so the * retry loop can re-attempt without recursively invoking a Lit lifecycle * method (which is outside the framework's contract). * @private * @returns {void} */ private _initFromAncestors; _firstUpdatedRetries: any; _firstUpdatedRetryTimer: any; calendar: any; datepicker: any; _slotContentHandler: (() => void) | undefined; _cachedButton: Element | null | undefined; calendarMonth: any; /** * Configures the popover instance with the calendar month boundary. * Called from firstUpdated and updated because the popover element is only * rendered after hasPopoverContent becomes true (set by handleSlotContent). * @private * @returns {void} */ private configurePopover; auroPopover: any; updated(properties: any): void; /** * Sets host-level ARIA so each cell exposes its date, selection state, * and blackout status to assistive tech browsing the month grid. * @private * @returns {void} */ private updateHostAria; /** * Programmatically focuses the cell's interactive button element. * Uses focusVisible: true so the :focus-visible ring appears even when * the bib was opened via mouse click (which sets mouse input modality). * @returns {void} */ focusButton(): void; /** * Imperatively marks this cell as active without triggering a Lit re-render. * Buttons stay tabindex="-1" because DOM focus stays on the grid wrapper — * arrow keys move the active cell imperatively and the live region carries * the SR announcement. * * Refuses to activate out-of-range cells: those are aria-hidden, have no * click/focus handlers, and are filtered out of `getFocusableCells`. The * active class showing on a disabled cell would be visually misleading, * so this guard is the single source of truth across every code path * that might call setActive (keyboard nav, focus restore, cell click). * @returns {void} */ setActive(): void; /** * Imperatively marks this cell as inactive without triggering a Lit re-render. * @returns {void} */ clearActive(): void; /** * Updates range preview classes imperatively (no Lit re-render). * Called by the calendar component when the hovered date changes * during range selection (dateFrom set, dateTo not yet set). * @param {Number} hoveredDate - Unix timestamp of the currently hovered/focused date. * @param {Number} dateFrom - Unix timestamp of the selected departure date. * @returns {void} */ updateRangePreviewClasses(hoveredDate: number, dateFrom: number): void; /** * Clears all imperative range preview classes from the cell button. * Called when a selection occurs so classMap becomes the sole source of truth. * @returns {void} */ clearRangePreviewClasses(): void; /** * Re-applies the committed-range classes (inRange / rangeDepartDate / * rangeReturnDate) imperatively from the cell's current `day`, * `dateFrom`, and `dateTo`. Used after month navigation flushes: * classMap in `renderCellButton` tracks its own previous state, so a * preceding imperative `classList.remove` (from * `clearRangePreviewClasses`) leaves classMap thinking the class is * still applied. On re-render with the same class-value, classMap emits * no delta and the class stays missing in the DOM. Re-toggling * imperatively resyncs the DOM with the committed range. * * Delegates to the same `isInRange` / `isDepartDate` / `isReturnDate` * helpers `renderCellButton` uses, so the two code paths cannot drift * (including whatever timestamp normalization those helpers apply). * @returns {void} */ applyCommittedRangeClasses(): void; renderCellButton(): import("lit-html").TemplateResult; render(): import("lit-html").TemplateResult; } import { LitElement } from "lit";