import * as forty_cdk_calendar from 'forty-cdk/calendar'; import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, Provider } from '@angular/core'; import { DateAdapter, WritingDirection, DateRange } from 'forty-cdk/core'; /** The active display mode of a `ForCalendar`. */ type CalendarView = 'day' | 'month' | 'year'; /** A selectable year in the year picker grid. */ interface CalendarYearOption { /** The full year (e.g. `2026`). */ readonly value: number; /** Whether the entire year falls outside `[min, max]`. */ readonly disabled: boolean; } /** A row of three months in the month picker grid. */ interface CalendarMonthRow { /** Stable key for `@for` tracking. */ readonly key: string; /** The (up to three) month options in this row. */ readonly months: readonly CalendarMonthOption[]; } /** A row of three years in the year picker grid. */ interface CalendarYearRow { /** Stable key for `@for` tracking. */ readonly key: string; /** The (up to three) year options in this row. */ readonly years: readonly CalendarYearOption[]; } /** * Handle a `ForCalendarMonthCell` registers with the root so the root can move * DOM focus to the correct cell during keyboard navigation and view switches. */ interface ForCalendarMonthCellHandle { /** The `role="gridcell"` host element. */ readonly host: HTMLElement; /** The month this cell represents, **1-12**. */ readonly month: Signal; } /** * Handle a `ForCalendarYearCell` registers with the root so the root can move * DOM focus to the correct cell during keyboard navigation and view switches. */ interface ForCalendarYearCellHandle { /** The `role="gridcell"` host element. */ readonly host: HTMLElement; /** The year this cell represents. */ readonly year: Signal; } /** A selectable month in the visible year, for building a month dropdown. */ interface CalendarMonthOption { /** Month number, **1-12**. */ readonly value: number; /** Localized month name via the adapter (e.g. `"June"`). */ readonly label: string; /** Whether the whole month falls outside `[min, max]`. */ readonly disabled: boolean; } /** A weekday column header in the calendar grid. */ interface CalendarWeekday { /** Stable key for `@for` tracking (the **0-6** weekday index as a string). */ readonly key: string; /** Narrow label, e.g. `"M"`. */ readonly narrow: string; /** Short label, e.g. `"Mon"`. */ readonly short: string; /** Long label, e.g. `"Monday"`. */ readonly long: string; } /** A single day cell in the calendar grid. */ interface CalendarDayCell { /** Stable key for `@for` tracking (`year-month-day`). */ readonly key: string; /** The date this cell represents. Bind to `[date]` on `[forCalendarCell]`. */ readonly date: D; /** Day-of-month label, e.g. `"1"`. The cell's visible content. */ readonly label: string; /** * Full accessible date string for the cell, host-bound to `aria-label` by * `[forCalendarCell]`. Defaults to the localized full date (e.g. * `"Monday, June 15, 2026"`); outside-month padding days are suffixed so * assistive tech can tell them apart from the visible month. Customize the * format with `ForCalendar`'s `dateLabel` input. */ readonly dateLabel: string; } /** * Formats the full accessible date string a calendar gridcell exposes as its * `aria-label`. Supplied to `ForCalendar`'s `dateLabel` input to override the * default localized full date. * * @typeParam D The adapter's date type. * @param date The cell's date. * @param context Formatting context: the active {@link DateAdapter}, whether the * date falls outside the visible month, and the calendar's resolved `locale` * (`null` = runtime default) to forward to `adapter.format`. */ type CalendarDateLabelFormatter = (date: D, context: { readonly adapter: DateAdapter; readonly outsideMonth: boolean; readonly locale: string | null; }) => string; /** A week row in the calendar grid. */ interface CalendarWeek { /** Stable key for `@for` tracking (the first day's `year-month-day`). */ readonly key: string; /** The seven day cells of this week, starting at `firstDayOfWeek`. */ readonly days: readonly CalendarDayCell[]; } /** * Handle a `ForCalendarCell` registers with the root so it can move DOM focus * to the cell matching a target date after the grid re-renders (e.g. when * keyboard navigation crosses a month boundary). */ interface ForCalendarCellHandle { /** The `role="gridcell"` host element. */ readonly host: HTMLElement; /** The date this cell represents. */ readonly date: Signal; } /** * Coordination contract owned by `ForCalendar` (the root). Grid, header, * cells, heading, and the navigation buttons all derive their state from it * and route selection / navigation through it. * * The token is typed over `unknown`; pieces pass their own `D` into the * `unknown`-typed methods (always assignable) and never need the concrete `D` * back out. * * @typeParam D The adapter's date type. */ interface ForCalendarContext { /** The active date adapter. */ readonly adapter: DateAdapter; /** Resolved writing direction (`'ltr'` / `'rtl'`); flips horizontal arrows. */ readonly dir: Signal; /** Whether the whole calendar is disabled (no focus, no selection). */ readonly disabled: Signal; /** Whether the calendar is read-only (focusable, but selection is blocked). */ readonly readonly: Signal; /** Stable id of the heading element, used for the grid's `aria-labelledby`. */ readonly headingId: Signal; /** The visible month's accessible label, e.g. `"June 2026"`. */ readonly visibleMonthLabel: Signal; /** Weekday column headers for the visible month. */ readonly weekDays: Signal; /** Week rows of the visible month, including outside-month padding days. */ readonly weeks: Signal[]>; /** Whether the previous-month button should be disabled (bounded by `min`). */ readonly isPreviousMonthDisabled: Signal; /** Whether the next-month button should be disabled (bounded by `max`). */ readonly isNextMonthDisabled: Signal; /** The visible month's full year (e.g. `2026`). */ readonly visibleYear: Signal; /** The visible month, **1-12**. */ readonly visibleMonthNumber: Signal; /** Twelve localized, bounds-aware month options for the visible year. */ readonly monthOptions: Signal; /** Set the visible month to (`year`, `month`) without selecting. `month` is **1-12**. */ goTo(year: number, month: number): void; /** Set the visible month within the current visible year. `month` is **1-12**. */ goToMonth(month: number): void; /** Set the visible year, keeping the current visible month. */ goToYear(year: number): void; /** Whether every day of `month` (**1-12**) in the visible year is out of `[min, max]`. */ isMonthDisabled(month: number): boolean; /** Whether every day of `year` is out of `[min, max]`. */ isYearDisabled(year: number): boolean; /** Active calendar view; `'day'` (default), `'month'`, or `'year'`. */ readonly view: Signal; /** Number of years the year picker shows as an aligned block. Default `12`. */ readonly yearBlockSize: Signal; /** Rows of the month picker grid (3 columns) for the visible year. */ readonly monthRows: Signal; /** Rows of the year picker grid (3 columns) for the aligned block containing the visible year. */ readonly yearRows: Signal; /** Label for the active view shown on the view-trigger button. */ readonly viewTriggerLabel: Signal; /** Whether the prev button should be disabled for the active view. */ readonly isPreviousDisabled: Signal; /** Whether the next button should be disabled for the active view. */ readonly isNextDisabled: Signal; /** Cycle the view one step coarser: `day → month → year`, clamped at `'year'`. */ cycleView(): void; /** Drill into a month (1-12): navigate to it and switch to day view. No-op when disabled/read-only/out of bounds. */ selectMonth(month: number): void; /** Drill into a year: navigate to it and switch to month view. No-op when disabled/read-only/out of bounds. */ selectYear(year: number): void; /** Page backward by one month / year / block depending on the active view. */ pagePrevious(): void; /** Page forward by one month / year / block depending on the active view. */ pageNext(): void; /** Whether `month` (1-12) in the visible year is the selected date's month. */ isMonthSelected(month: number): boolean; /** Whether `month` (1-12) is today's month in the visible year. */ isMonthToday(month: number): boolean; /** Whether `month` (1-12) is the roving-tabindex focused month. */ isMonthFocused(month: number): boolean; /** Whether `year` is the selected date's year. */ isYearSelected(year: number): boolean; /** Whether `year` is today's year. */ isYearToday(year: number): boolean; /** Whether `year` is the roving-tabindex focused year. */ isYearFocused(year: number): boolean; /** Handle a keydown originating on a month cell. */ handleMonthCellKeydown(event: KeyboardEvent, month: number): void; /** Handle a keydown originating on a year cell. */ handleYearCellKeydown(event: KeyboardEvent, year: number): void; registerMonthCell(handle: ForCalendarMonthCellHandle): void; unregisterMonthCell(handle: ForCalendarMonthCellHandle): void; registerYearCell(handle: ForCalendarYearCellHandle): void; unregisterYearCell(handle: ForCalendarYearCellHandle): void; /** Whether `date` is the currently selected value. */ isSelected(date: D): boolean; /** Whether `date` is today. */ isToday(date: D): boolean; /** Whether `date` is the roving-tabindex focused day. */ isFocused(date: D): boolean; /** Whether `date` falls outside the visible month. */ isOutsideMonth(date: D): boolean; /** Whether `date` cannot be selected (`disabled`, out of `min`/`max`, or unavailable). */ isUnavailable(date: D): boolean; /** The full accessible date string for `date`'s gridcell (`aria-label`). */ getDateLabel(date: D): string; /** * The active selection mode. `'single'` (default) keeps the existing * single-date behaviour; `'range'` enables the two-click anchor → commit flow. */ readonly selectionMode: Signal<'single' | 'range'>; /** * Whether `date` is the start of the effective range (committed when idle, * preview when a selection is in progress). */ isRangeStart(date: D): boolean; /** * Whether `date` is the end of the effective range (committed when idle, * preview when a selection is in progress). */ isRangeEnd(date: D): boolean; /** * Whether `date` falls within the **committed** range, inclusive (idle state * only; mutually exclusive with `isRangePreview`). */ isInRange(date: D): boolean; /** * Whether `date` falls within the **preview** band, inclusive (selecting * state only; mutually exclusive with `isInRange`). */ isRangePreview(date: D): boolean; /** * Update the pointer-hovered date for the range preview. Ignored in * `selectionMode='single'`. Pass `null` on `pointerleave`. */ setHovered(date: D | null): void; /** Select `date`, unless the calendar is disabled / read-only or the date is unavailable. */ selectDate(date: D): void; /** Page the visible month by `delta` (signed month count). Keeps DOM focus on the caller. */ pageMonths(delta: number): void; /** Resolve and apply a keydown originating on the cell for `fromDate`. */ handleCellKeydown(event: KeyboardEvent, fromDate: D): void; /** * Move DOM focus to the roving cell (the gridcell matching the focused date). * Returns `false` when no matching cell is currently rendered. */ focusActiveCell(): boolean; registerCell(handle: ForCalendarCellHandle): void; unregisterCell(handle: ForCalendarCellHandle): void; /** Adopts a consumer-set static `id` on the heading host into `headingId`. */ adoptHeadingId(el: HTMLElement): void; } /** Injection token for {@link ForCalendarContext}, provided by `ForCalendar`. */ declare const FOR_CALENDAR_CONTEXT: InjectionToken>; /** * Headless implementation of a single-date calendar grid following the * [WAI-ARIA Grid pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/), the * date table at the heart of the APG * [Date Picker Dialog](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/) * example. * * `ForCalendar` is the root: it owns the selected value, the focused date, and * the visible month, and exposes them to the grid / header / cell / heading / * navigation pieces through `FOR_CALENDAR_CONTEXT`. All date math goes through * a pluggable {@link DateAdapter} (`provideInternationalizedDateAdapter()` or * `provideNativeDateAdapter()`), so the library hard-depends on no date * library. * * The grid uses roving tabindex: exactly one cell (the focused date) carries * `tabindex="0"`. Arrow / `Home` / `End` / `PageUp` / `PageDown` / * `Shift+PageUp` / `Shift+PageDown` move the focused date, re-paging the grid * when crossing a month boundary; `Enter` / `Space` select. * * The day / month / year views are each backed by a sub-grid collaborator * ({@link CalendarDayNavigator} / {@link CalendarMonthNavigator} / * {@link CalendarYearNavigator}), and range selection by * {@link CalendarRangeSelection}; the root wires them together and exposes the * `[(value)]` / `[(view)]` / `[(range)]` models. * * `ForCalendar` is the grid widget, not a form value — it exposes `[(value)]` * as a `model` in `selectionMode="single"` (default), and * `[(range)]` as a `model | null>` in * `selectionMode="range"`. The `FormValueControl` contract arrives with the * follow-up `ForDatePicker` / `ForDateField`. See the primitive's README for a * complete styleless usage example. * * @typeParam D The adapter's immutable date type. */ declare class ForCalendar implements ForCalendarContext { #private; /** The active date adapter, resolved from `FOR_DATE_ADAPTER`. */ readonly adapter: DateAdapter; /** * Two-way bindable selected date, or `null`. The `model()` change emitter * (`(valueChange)`) fires only when the calendar itself updates the value * (cell activation), never on consumer writes via `[(value)]`. */ readonly value: _angular_core.ModelSignal; /** Minimum selectable date (inclusive). Dates before it are unavailable. */ readonly min: _angular_core.InputSignal; /** Maximum selectable date (inclusive). Dates after it are unavailable. */ readonly max: _angular_core.InputSignal; /** * Per-date predicate marking a date as unavailable (present in the grid but * not selectable, reflected as `aria-disabled` / `data-disabled`). */ readonly isDateUnavailable: _angular_core.InputSignal<(date: D) => boolean>; /** * Formats the full accessible date string each gridcell exposes as its * `aria-label` (the visible content stays the bare day number). Defaults to * the localized full date (e.g. `"Monday, June 15, 2026"`), with * outside-month padding days suffixed (`" (outside month)"`) so assistive * tech can tell them apart from the visible month. Override to localize that * suffix or change the format entirely. */ readonly dateLabel: _angular_core.InputSignal>; /** Disables the whole calendar: no focus movement, no selection. */ readonly disabled: _angular_core.InputSignalWithTransform; /** Makes the calendar read-only: dates stay focusable but selection is blocked. */ readonly readonly: _angular_core.InputSignalWithTransform; /** * Selection mode. `'single'` (default) keeps the single-date `[(value)]` * behaviour unchanged. `'range'` switches to the two-click anchor → commit * flow and exposes the result through `[(range)]`. */ readonly selectionMode: _angular_core.InputSignal<"single" | "range">; /** * Active calendar view. `'day'` (default) shows the date grid; `'month'` and * `'year'` show the month / year picker grids. Two-way bindable; the `model()` * change emitter (`(viewChange)`) fires only when the calendar itself cycles * or drills the view, never on consumer writes via `[(view)]`. */ readonly view: _angular_core.ModelSignal; /** * Number of years the year view shows, as an aligned block containing the * visible year. Default `12`. */ readonly yearBlockSize: _angular_core.InputSignalWithTransform; /** * Two-way bindable committed date range, or `null`. Only used when * `selectionMode="range"`. The `model()` change emitter (`(rangeChange)`) * fires only when the calendar internally commits or clears a range, never * on consumer writes via `[(range)]`. */ readonly range: _angular_core.ModelSignal | null>; /** * Minimum inclusive day count for a range selection. A click that would * commit a range shorter than this is a no-op (anchor is preserved). * `null` (default) means no minimum. Only honoured in `selectionMode="range"`. */ readonly minRangeLength: _angular_core.InputSignal; /** * Maximum inclusive day count for a range selection. A click that would * commit a range longer than this is a no-op (anchor is preserved). * `null` (default) means no maximum. Only honoured in `selectionMode="range"`. */ readonly maxRangeLength: _angular_core.InputSignal; /** * First day of the week as a **0-6** index (`0` = Sunday). When `null` * (default, overridable via `provideForCalendarDefaults`), the adapter's * `getFirstDayOfWeek()` is used. */ readonly firstDayOfWeek: _angular_core.InputSignal; /** * Writing direction. When unset (default `null`), the inherited ambient * direction is resolved from the nearest ancestor carrying a `dir` attribute * (or ``), defaulting to `'ltr'`. An explicit `[dir]` always wins. * The resolved value is reflected to the host `dir` attribute and swaps the * `ArrowLeft` / `ArrowRight` semantics in RTL. */ readonly _dirInput: _angular_core.InputSignal; readonly dir: _angular_core.Signal; /** * BCP 47 locale tag governing the formatted month / weekday / cell-label names * (heading, weekday headers, month-picker options, gridcell `aria-label`). * When `null` (default), the adapter formats through the runtime's default * locale. Does not change the calendar system, which stays Gregorian. */ readonly locale: _angular_core.InputSignal; /** Internal focused date (the roving entry point), seeded from `value ?? range.start ?? today`. */ readonly focusedDate: _angular_core.WritableSignal; /** First day of the visible month, derived from {@link focusedDate}. */ readonly visibleMonth: _angular_core.Signal; readonly headingId: _angular_core.Signal; /** * Adopts a consumer-set static `id` on the `[forCalendarHeading]` host into * `headingId` (the grid's `aria-labelledby` resolves to it) instead of * letting the `[id]` host binding clobber it. */ adoptHeadingId(el: HTMLElement): void; readonly visibleMonthLabel: _angular_core.Signal; /** The visible month's full year (e.g. `2026`). */ readonly visibleYear: _angular_core.Signal; /** The visible month, **1-12**. */ readonly visibleMonthNumber: _angular_core.Signal; /** * Twelve entries for the visible year — each a localized month name plus * whether the whole month falls outside `[min, max]`. Tracks {@link visibleYear}. * Build native `` to a `ForCalendar`'s month navigation. Apply on a * ` * @for (opt of m.options(); track opt.value) { * * } * * ``` */ declare class ForCalendarMonthSelect { protected readonly ctx: forty_cdk_calendar.ForCalendarContext; /** The twelve localized, bounds-aware month options for the visible year. */ readonly options: _angular_core.Signal; protected onChange(event: Event): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Wires a native `` element inside `[forCalendar]`: the directive keeps the select * showing the visible year and navigates the calendar when the user picks a * different one, without mutating the selected date. * * Render the `