/**
 * `<calendar-grid-ui>` — Substrate primitive — a single-month calendar grid (month nav + day cells + keyboard nav). Renders inline; no trigger, no popover. Used as a substrate by calendar-picker-ui (popover wrapper), date-range-picker-ui (two side-by-side grids), and datetime-picker-ui (one grid + time pane). For a complete date-picker affordance (trigger + popover + form participation), use calendar-picker-ui.
 *
 * @see https://ui-kit.exe.xyz/site/components/calendar-grid
 *
 * Type declarations generated by scripts/build/dts-codegen.mjs from
 * the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
 * run `npm run build:components`, then `npm run codegen:dts` to
 * regenerate; or hand-author this file fully if rich event types are
 * needed beyond what the yaml `events:` block can express.
 */

import { UIElement } from '../../core/element.js';

export type CalendarGridChangeEvent = CustomEvent<unknown>;
export type CalendarGridInputEvent = CustomEvent<unknown>;

export class UICalendarGrid extends UIElement {
  /** Disables all interaction. */
  disabled: boolean;
  /** Maximum selectable date in ISO format (YYYY-MM-DD). */
  max: string;
  /** Minimum selectable date in ISO format (YYYY-MM-DD). */
  min: string;
  /** Displayed month (YYYY-MM) used when no value is selected — shows a specific month independent of selection. A selected value always takes precedence. Used by date-range-picker to show its end pane one month ahead of the start. */
  month: string;
  /** End of a date range (ISO YYYY-MM-DD). See `rangeStart` for the full contract. */
  rangeEnd: string;
  /** Start of a date range (ISO YYYY-MM-DD). When both rangeStart and rangeEnd are set + ordered, day cells strictly between the endpoints get `[data-in-range]` stamped for visual continuity. Used by `<date-range-picker-ui>` which pushes the same from/to onto both calendar panes. Endpoints themselves render via the `value` prop's `[data-selected]` state. */
  rangeStart: string;
  /** Blocks selection but allows month navigation. */
  readonly: boolean;
  /** Selected date in ISO format (YYYY-MM-DD). */
  value: string;

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UICalendarGrid, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'change', listener: (ev: CalendarGridChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
  addEventListener(type: 'input', listener: (ev: CalendarGridInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
