import "./date_filter.css"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; export type PresetId = "today" | "yesterday" | "tomorrow" | "this_week" | "this_month" | "last_month" | "this_quarter" | "last_quarter" | "this_year" | "last_year"; /** Every id sets a range; ordered by grain, shortest first. */ export declare const PRESET_IDS: PresetId[]; /** Matches the view-page filter's boundaries, so a resolved range round-trips to its preset. */ export declare function getPresetValue(id: PresetId, now: Date): DateFilterValue; /** * The "so với kỳ trước" comparator: a whole calendar month, quarter or year steps back one whole * period (never a fixed day count); any other range steps back by its own length. Day-aligned; * `null` when a bound is missing. */ export declare function previousPeriod(value: DateFilterValue): DateFilterValue | null; export interface PeriodToDate { /** Ends at `now` while the period is running. */ current: DateFilterValue; /** `previousPeriod`, cut to the same elapsed days; `null` for an open range. */ previous: DateFilterValue | null; running: boolean; /** 0 for a period still ahead. */ elapsedDays: number; totalDays: number; } /** * A running period compares to date, since six days beside a whole month reads as a collapse; the * cut is clamped to the previous period's end. A closed period stays whole. A future period has * `elapsedDays` 0 so a caller can say it has not started. `null` when a bound is missing. */ export declare function periodToDate(value: DateFilterValue, now: Date): PeriodToDate | null; export interface DateFilterValue { start: { date: Date | null; time: string | null; }; end: { date: Date | null; time: string | null; }; } export interface DateFilterLabels { today: string; yesterday: string; tomorrow: string; thisWeek: string; thisMonth: string; lastMonth: string; thisQuarter: string; lastQuarter: string; thisYear: string; lastYear: string; from: string; to: string; selectDateRange: string; /** The open half of a range. */ selectDate: string; } /** The footer's two verbs and the resting text. */ export interface DateFilterFieldLabels extends DateFilterLabels { clear: string; done: string; placeholder: string; } interface DateFilterCommonProps extends StyleProps { value: DateFilterValue; onValueChange: (value: DateFilterValue) => void; includeTime?: boolean; locale?: string; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** Default: the surrounding surface owns trigger and footer, as a grid column header does. */ export interface DateFilterPanelProps extends DateFilterCommonProps { variant?: "panel"; labels?: Partial; } /** A trigger naming the period, the panel in a popover, a Clear / Done footer. */ export interface DateFilterFieldProps extends DateFilterCommonProps { variant: "field"; labels?: Partial; } export type DateFilterProps = DateFilterPanelProps | DateFilterFieldProps; export declare function DateFilter(props: DateFilterProps): React.JSX.Element; /** What Clear leaves: a period that narrows nothing. */ export declare const NO_PERIOD: DateFilterValue; export {};