/** * `DateRangePicker` — the compact time-window control observability screens share. * It emits ONE of two shapes: * * - a relative token from a PRESET chip, `{ kind: 'relative', token }` — the backend * resolves `\d+[hdw]` tokens, so a preset stays a token rather than freezing to an * instant at click time; * - an ABSOLUTE range from the two native `datetime-local` inputs, * `{ kind: 'absolute', from, to }` with ISO instants — native inputs keep the * control inside the platform date UI, no third-party calendar. * * Absolute ranges are normalized by {@link normalizeCustomRange}; the active window * is rendered by {@link formatRangeLabel}, always with the YEAR present. */ import { type ReactNode } from 'react'; /** A relative preset: a `\d+[hdw]` token the backend resolves, plus its chip label. */ export interface DateRangePreset { readonly token: string; readonly label: string; } /** The presets a picker offers when the caller names none. */ export declare const DEFAULT_DATE_RANGE_PRESETS: readonly DateRangePreset[]; /** * A named time window: either a relative token the backend resolves against its * own clock, or an absolute pair of ISO instants. */ export type DateRangeValue = { readonly kind: 'relative'; readonly token: string; } | { readonly kind: 'absolute'; readonly from: string; readonly to: string; }; export declare function formatRangeLabel(value: DateRangeValue, presets?: readonly DateRangePreset[]): string; /** * A raw from/to pair resolved to a clean absolute range. Order matters: SWAP the * reversed pair first (earlier instant becomes start), THEN cap both ends at `now` — * capping first can leave a future instant on the post-swap end. The end is * INCLUSIVE of its minute, extended to `:59.999`, so `23:59` reaches the day's end. */ export declare function normalizeCustomRange(fromInput: string, toInput: string, now: Date): { readonly from: string; readonly to: string; }; export interface DateRangePickerProps { readonly value: DateRangeValue; readonly onValueChange: (value: DateRangeValue) => void; /** The preset chips to offer. Defaults to {@link DEFAULT_DATE_RANGE_PRESETS}. */ readonly presets?: readonly DateRangePreset[]; /** The control group's accessible name. */ readonly 'aria-label'?: string; readonly disabled?: boolean; /** * The clock the absolute-range clamp reads. Defaults to the wall clock; a caller * (or a test) injects a fixed instant to pin the "no future" boundary. */ readonly now?: () => Date; } /** * The range control: a row of preset chips over the two `datetime-local` inputs and * an Apply action, with the active window echoed as text below. * * Controlled: the caller owns `value` and receives the next window through * `onValueChange` — a preset click emits its token immediately, while the custom * inputs hold a working draft until Apply commits the normalized absolute range. * * The drafts track the controlled value, re-seeded on a NEW absolute `value` (keyed * on `from`/`to`), so edits against an unchanged value are preserved but a genuinely * different value replaces an in-progress draft. */ export declare function DateRangePicker({ value, onValueChange, presets, 'aria-label': ariaLabel, disabled, now, }: DateRangePickerProps): ReactNode; //# sourceMappingURL=date-range-picker.d.ts.map