import * as _angular_core from '@angular/core'; import { Signal, OnInit, ElementRef } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { ZPopoverControl } from '@shival99/z-ui/components/z-popover'; import { ZSelectOption } from '@shival99/z-ui/components/z-select'; import { ZEvent } from '@shival99/z-ui/utils'; import { ClassValue } from 'clsx'; import * as class_variance_authority_types from 'class-variance-authority/types'; interface ZCalendarDay { date: Date; day: number; isCurrentMonth: boolean; isToday: boolean; isDisabled: boolean; isSelected: boolean; isInRange: boolean; isRangeStart: boolean; isRangeEnd: boolean; isHovered: boolean; } interface ZDateRange { start: Date | null; end: Date | null; } type ZCalendarMode = 'single' | 'range' | 'time' | 'month' | 'year' | 'quarter'; type ZCalendarValueType = 'date' | 'iso' | 'string'; type ZCalendarView = 'day' | 'month' | 'year' | 'quarter'; type ZCalendarSize = 'sm' | 'default' | 'lg'; interface ZQuickSelectPreset { key: string; label: string; getValue: () => ZDateRange | Date | null; } interface ZCalendarControl { /** Trigger validation and return true if valid */ valid: () => boolean; /** * Trigger validation and return true if has error. * @deprecated Use `valid()` for boolean form-submit checks. */ validate: () => boolean; /** Reset component to initial state */ reset: () => void; /** Focus the calendar trigger */ focus: () => void; /** Blur the calendar trigger */ blur: () => void; /** Open the calendar popup */ open: () => void; /** Close the calendar popup */ close: () => void; /** Clear the selected value */ clear: () => void; /** Set custom error message (useful for server-side validation). Pass null to clear. */ setErrorMessage: (message: string | null) => void; /** Signal indicating if component has validation error */ hasError: Signal; /** Signal indicating if popup is open */ isOpen: Signal; /** Signal with current value */ value: Signal; /** Signal with current error message */ errorMessage: Signal; } type ZCalendarValue = Date | ZDateRange | string | null; interface ZCalendarValidator { error: string; message: string; validate: (value: ZCalendarValue) => boolean; } interface ZEndTimeContext { isSameDay: boolean; startHour: number; startMinute: number; startSecond: number; endHour: number; endMinute: number; timeFormat: '12h' | '24h'; startPeriod: 'AM' | 'PM'; endPeriod: 'AM' | 'PM'; } interface ZMonthDisabledContext { currentYear: number; endYear: number; endMonthIndex: number; isRangeMode: boolean; disabledDateFn: ((date: Date) => boolean) | null; } interface ZEndMonthDisabledContext { startYear: number; startMonthIndex: number; endYear: number; isRangeMode: boolean; disabledDateFn: ((date: Date) => boolean) | null; } interface ZYearDisabledContext { endYear: number; startMonthIndex: number; endMonthIndex: number; isRangeMode: boolean; disabledDateFn: ((date: Date) => boolean) | null; } interface ZEndYearDisabledContext { startYear: number; startMonthIndex: number; endMonthIndex: number; isRangeMode: boolean; disabledDateFn: ((date: Date) => boolean) | null; } interface ZCalendarTimeConfig { hour: number; minute: number; second: number; } type ZCalendarDefaultTime = 'current' | 'start' | 'end' | ZCalendarTimeConfig; interface ZCalendarRangeDefaultTime { start?: ZCalendarDefaultTime; end?: ZCalendarDefaultTime; } declare class ZCalendarComponent implements OnInit, ControlValueAccessor { readonly class: _angular_core.InputSignal; readonly zMode: _angular_core.InputSignal; readonly zSize: _angular_core.InputSignal; readonly zLabel: _angular_core.InputSignal; readonly zLabelClass: _angular_core.InputSignal; readonly zPlaceholder: _angular_core.InputSignal; readonly zRequired: _angular_core.InputSignalWithTransform; readonly zDisabled: _angular_core.InputSignalWithTransform; readonly zReadonly: _angular_core.InputSignalWithTransform; readonly zLoading: _angular_core.InputSignalWithTransform; readonly zLoadingOutline: _angular_core.InputSignalWithTransform; readonly zShowTime: _angular_core.InputSignalWithTransform; readonly zTimeFormat: _angular_core.InputSignal<"12h" | "24h">; readonly zShowHour: _angular_core.InputSignalWithTransform; readonly zShowMinute: _angular_core.InputSignalWithTransform; readonly zShowSecond: _angular_core.InputSignalWithTransform; readonly zQuickSelect: _angular_core.InputSignalWithTransform; readonly zAllowEdit: _angular_core.InputSignalWithTransform; readonly zShortTime: _angular_core.InputSignalWithTransform; readonly zAllowClear: _angular_core.InputSignalWithTransform; readonly zFormat: _angular_core.InputSignal; readonly zMinDate: _angular_core.InputSignal; readonly zMaxDate: _angular_core.InputSignal; readonly zValueType: _angular_core.InputSignal; readonly zValidators: _angular_core.InputSignal; readonly zShowOk: _angular_core.InputSignalWithTransform; readonly zOkText: _angular_core.InputSignal; readonly zShowCancel: _angular_core.InputSignalWithTransform; readonly zCancelText: _angular_core.InputSignal; readonly zDisabledDate: _angular_core.InputSignal<((date: Date) => boolean) | null>; readonly zScrollClose: _angular_core.InputSignalWithTransform; readonly zDefaultTime: _angular_core.InputSignal; readonly zRangeDefaultTime: _angular_core.InputSignal; readonly zControl: _angular_core.OutputEmitterRef; readonly zChange: _angular_core.OutputEmitterRef; readonly zOnBlur: _angular_core.OutputEmitterRef; readonly zOnFocus: _angular_core.OutputEmitterRef; readonly zEvent: _angular_core.OutputEmitterRef; protected readonly triggerRef: _angular_core.Signal | undefined>; protected readonly inputRef: _angular_core.Signal | undefined>; protected readonly startInputRef: _angular_core.Signal | undefined>; protected readonly endInputRef: _angular_core.Signal | undefined>; protected readonly pickerId: string; protected readonly weekdayNames: _angular_core.Signal; protected readonly monthNames: _angular_core.Signal; protected readonly quickSelectPresets: ZQuickSelectPreset[]; protected readonly hourOptions: _angular_core.Signal; protected readonly minuteOptions: number[]; protected readonly secondOptions: number[]; protected readonly formattedHour: _angular_core.Signal; protected readonly formattedMinute: _angular_core.Signal; protected readonly formattedSecond: _angular_core.Signal; protected readonly displayHour: _angular_core.Signal; protected readonly displayHourEnd: _angular_core.Signal; private readonly _popoverControl; private readonly _selectedDate; private readonly _rangeStart; private readonly _rangeEnd; private readonly _currentMonth; private readonly _endMonth; private readonly _hourEnd; private readonly _minuteEnd; private readonly _secondEnd; private readonly _periodEnd; private readonly _disabled; private readonly _formControl; private readonly _formStateVersion; private readonly _customError; private readonly _backupSelectedDate; private readonly _backupRangeStart; private readonly _backupRangeEnd; private readonly _backupActivePresetKey; private readonly _backupShortDisplayPresetKey; private readonly _appliedViaOk; private readonly _hasTypedDraft; private readonly _skipBlurHandler; private readonly _injector; private readonly _destroyRef; private readonly _zTranslate; protected readonly zLocale: _angular_core.Signal; private _onChange; private _onTouched; private _ngControl; private readonly _isNgModel; protected readonly isOpen: _angular_core.Signal; protected readonly hoveredDate: _angular_core.WritableSignal; protected readonly currentView: _angular_core.WritableSignal; protected readonly endView: _angular_core.WritableSignal; protected readonly hour: _angular_core.WritableSignal; protected readonly minute: _angular_core.WritableSignal; protected readonly second: _angular_core.WritableSignal; protected readonly period: _angular_core.WritableSignal<"AM" | "PM">; protected readonly inputDisplayValue: _angular_core.WritableSignal; protected readonly isInputFocused: _angular_core.WritableSignal; protected readonly activePresetKey: _angular_core.WritableSignal; protected readonly shortDisplayPresetKey: _angular_core.WritableSignal; protected readonly quickSelectOptions: _angular_core.Signal[]>; protected readonly rangeShortDisplayValue: _angular_core.Signal; protected readonly uiState: _angular_core.WritableSignal<{ hasViewChanged: boolean; hasEndViewChanged: boolean; timeDropdownOpen: boolean; timeDropdownEndOpen: boolean; isFocused: boolean; touched: boolean; dirty: boolean; }>; protected readonly quarterNames: string[]; protected readonly todayQuarterIndex: _angular_core.Signal; protected readonly selectedQuarterIndex: _angular_core.Signal; protected readonly isSameDayRange: _angular_core.Signal; protected readonly isDisabled: _angular_core.Signal; protected readonly isRangeMode: _angular_core.Signal; protected readonly canApply: _angular_core.Signal; protected readonly showOkButton: _angular_core.Signal; protected readonly showCancelButton: _angular_core.Signal; protected readonly isTimeMode: _angular_core.Signal; protected readonly isMonthMode: _angular_core.Signal; protected readonly isYearMode: _angular_core.Signal; protected readonly isQuarterMode: _angular_core.Signal; protected readonly todayButtonText: _angular_core.Signal; protected readonly currentMonth: _angular_core.Signal; protected readonly currentYear: _angular_core.Signal; protected readonly currentMonthIndex: _angular_core.Signal; protected readonly todayMonthIndex: _angular_core.Signal; protected readonly todayYear: _angular_core.Signal; protected readonly selectedMonthIndex: _angular_core.Signal; protected readonly selectedYear: _angular_core.Signal; protected readonly endTimeContext: _angular_core.Signal; protected readonly startMonthDisabledContext: _angular_core.Signal; protected readonly endMonthDisabledContext: _angular_core.Signal; protected readonly startYearDisabledContext: _angular_core.Signal; protected readonly endYearDisabledContext: _angular_core.Signal; protected readonly currentMonthName: _angular_core.Signal; protected readonly yearRange: _angular_core.Signal; protected readonly yearRangeSmall: _angular_core.Signal; protected readonly calendarDays: _angular_core.Signal; protected readonly endMonth: _angular_core.Signal; protected readonly endMonthName: _angular_core.Signal; protected readonly endMonthYear: _angular_core.Signal; protected readonly calendarDaysEnd: _angular_core.Signal; protected readonly formattedHourEnd: _angular_core.Signal; protected readonly formattedMinuteEnd: _angular_core.Signal; protected readonly formattedSecondEnd: _angular_core.Signal; protected readonly minuteEnd: _angular_core.Signal; protected readonly secondEnd: _angular_core.Signal; protected readonly periodEnd: _angular_core.Signal<"AM" | "PM">; protected readonly endYearRange: _angular_core.Signal; protected readonly canNavigateStartNext: _angular_core.Signal; protected readonly canNavigateEndPrev: _angular_core.Signal; protected readonly displayValue: _angular_core.Signal; private _formatDisplayValue; private readonly _inputDisplayStart; private readonly _inputDisplayEnd; protected readonly inputDisplayStart: _angular_core.Signal; protected readonly inputDisplayEnd: _angular_core.Signal; protected readonly displayValueStart: _angular_core.Signal; protected readonly displayValueEnd: _angular_core.Signal; protected readonly effectivePlaceholder: _angular_core.Signal; private _getDisplayFormatStart; private _getDisplayFormatEnd; protected readonly showClearButton: _angular_core.Signal; protected readonly hasValue: _angular_core.Signal; protected readonly currentStatus: _angular_core.Signal<"default" | "disabled" | "readonly" | "open" | "error">; protected readonly triggerClasses: _angular_core.Signal; private readonly _shouldShowValidation; protected readonly hasError: _angular_core.Signal; protected readonly errorMessage: _angular_core.Signal; constructor(); ngOnInit(): void; writeValue(value: ZCalendarValue): void; registerOnChange(fn: (value: ZCalendarValue) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; open(): void; close(): void; toggle(): void; clear(): void; focus(): void; blur(): void; reset(): void; /** @deprecated Use `valid()` for boolean form-submit checks. */ validate(): boolean; valid(): boolean; setErrorMessage(message: string | null): void; protected onPopoverShow(): void; private _initializeTimeIfNeeded; private _syncEndTimeSignals; private _resetCalendarsToDefault; private _backupIfNeeded; protected onPopoverHide(): void; private _restoreFromBackup; protected onPopoverControl(control: ZPopoverControl): void; protected onTriggerKeydown(event: KeyboardEvent): void; protected onInputChange(event: Event): void; private _getExpectedFormatLength; private _parseFormatSegments; private _formatValueOnTyping; private readonly _lastInputLengths; private _formatInputValue; private _clampInputDateString; private _preserveInputSelection; protected onStartInputChange(event: Event): void; protected onEndInputChange(event: Event): void; protected onStartInputEnter(event: Event): void; protected onEndInputEnter(event: Event): void; protected onInputFocus(event: FocusEvent): void; protected onInputBlur(event: FocusEvent): void; protected onInputEnter(event: Event): void; protected onCalendarKeydown(event: KeyboardEvent): void; protected onDayClick(day: ZCalendarDay): void; protected onDayHover(day: ZCalendarDay): void; protected onDayLeave(): void; protected onMonthClick(monthIndex: number): void; protected onYearClick(year: number): void; protected onQuarterClick(quarterIndex: number): void; protected onMonthSelect(monthIndex: number): void; protected onQuickSelect(preset: ZQuickSelectPreset): void; protected onQuickSelectKeyChange(key: string | null): void; protected onTodayClick(): void; protected onClear(event: MouseEvent): void; protected onCancelClick(): void; protected onOkClick(): void; protected navigatePrevious(): void; protected navigateNext(): void; protected navigatePreviousFast(): void; protected navigateNextFast(): void; protected setView(view: ZCalendarView): void; protected setEndView(view: ZCalendarView): void; protected onEndMonthClick(monthIndex: number): void; protected onEndYearClick(year: number): void; protected onHourInput(event: Event): void; protected onMinuteInput(event: Event): void; protected onSecondInput(event: Event): void; protected onTimeBlur(event: Event): void; protected navigateEndPrevious(): void; protected navigateEndNext(): void; protected navigateEndPreviousFast(): void; protected navigateEndNextFast(): void; protected onHourEndInput(event: Event): void; protected onMinuteEndInput(event: Event): void; protected onSecondEndInput(event: Event): void; protected onTimeBlurEnd(event: Event): void; protected togglePeriodEnd(): void; private _updateEndTimeToDate; private _resolveDefaultTime; private _resolveRangeStartTime; private _resolveRangeEndTime; private _handleSingleSelection; private _handleRangeSelection; private _updateTimeToDate; private _detectMatchingPreset; private _updateRangeInputDisplay; private _isQuickSelectPresetDisabled; private _applyValue; private _confirmTypedValue; private _getEmitValue; private _getValidationErrors; private _navigateByArrowKey; private _syncTimeSignals; private _getParseFormat; private _buildTimeFormat; private _updateInputDisplay; private _clearDateValues; private _syncDOMInputs; protected onInputEscape(event: Event): void; protected onStartInputEscape(event: Event): void; protected onEndInputEscape(event: Event): void; private _cancelAndRestore; private _updateAllInputDisplays; private _emitControl; protected togglePeriod(): void; protected incrementHour(): void; protected decrementHour(): void; protected incrementMinute(): void; protected decrementMinute(): void; protected incrementSecond(): void; protected decrementSecond(): void; protected incrementHourEnd(): void; protected decrementHourEnd(): void; protected incrementMinuteEnd(): void; protected decrementMinuteEnd(): void; protected incrementSecondEnd(): void; protected decrementSecondEnd(): void; private _getNextHour; private _getPreviousHour; protected openTimeDropdown(event: MouseEvent): void; protected closeTimeDropdown(): void; protected openTimeDropdownEnd(event: MouseEvent): void; protected closeTimeDropdownEnd(): void; protected onTimeDropdownShow(): void; protected onTimeDropdownEndShow(): void; private _scrollToTimeDropdown; private _updateInputDisplayAfterTimeChange; protected onPeriodChange(event: Event): void; protected selectHour(hour: number, shouldScroll?: boolean): void; protected selectMinute(minute: number, shouldScroll?: boolean): void; protected selectSecond(second: number, shouldScroll?: boolean): void; protected selectPeriod(period: 'AM' | 'PM'): void; protected selectHourEnd(hour: number, shouldScroll?: boolean): void; protected selectMinuteEnd(minute: number, shouldScroll?: boolean): void; protected selectSecondEnd(second: number, shouldScroll?: boolean): void; protected selectPeriodEnd(period: 'AM' | 'PM'): void; protected scrollToSelectedTime(container: HTMLElement | null, value: number, itemHeight?: number): void; private _scrollToTimeValue; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare const zCalendarVariants: (props?: ({ zSize?: "sm" | "default" | "lg" | null | undefined; zStatus?: "default" | "disabled" | "open" | "error" | "readonly" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; declare const zCalendarDayVariants: (props?: ({ state?: "default" | "today" | "selected" | "inRange" | "rangeStart" | "rangeEnd" | "rangeSingle" | "disabled" | "otherMonth" | "hovered" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; declare const zCalendarMonthVariants: (props?: ({ state?: "default" | "selected" | "disabled" | "current" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; declare const zCalendarYearVariants: (props?: ({ state?: "default" | "selected" | "disabled" | "current" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; export { ZCalendarComponent, zCalendarDayVariants, zCalendarMonthVariants, zCalendarVariants, zCalendarYearVariants }; export type { ZCalendarControl, ZCalendarDefaultTime, ZCalendarMode, ZCalendarRangeDefaultTime, ZCalendarSize, ZCalendarTimeConfig, ZCalendarValidator, ZCalendarValue, ZCalendarValueType, ZCalendarView, ZDateRange };