import { DateRange } from "@trackunit/date-and-time-utils"; import { CommonProps, PopoverPlacement } from "@trackunit/react-components"; import { Size } from "@trackunit/shared-utils"; import { ReactElement } from "react"; import { DayRangePickerProps } from "../DayPicker/DayRangePicker"; import { SelectedDateRange, TemporalDirection, TemporalPeriod } from "./types"; export type DayRangeSelectProps = CommonProps & { /** * Whether the component is disabled. */ disabled?: boolean; /** * The selected date range. * When a temporal period is provided, the date range will be calculated and rendered as if a options was selected. * When a date range is provided, it will be rendered as a custom date range. */ selectedDateRange?: DateRange | TemporalPeriod; /** * If initialDateRangeOptions is provided, it will be used instead of the components default options. */ initialDateRangeOptions?: Array; /** * Callback function that is called when a date range is selected. */ onRangeSelect: (params?: SelectedDateRange) => void; /** * The direction of the date range to allow. If not provided, both 'last' and 'next' directions are allowed. */ allowedDirection?: TemporalDirection; /** * Whether to show the date range search input. */ showDateRangeSearch?: boolean; /** * Whether to show the reset button above the preset options. */ showResetButton?: boolean; /** * Whether to show the custom date range option with a calendar picker. */ showCustomDateRangeOption?: boolean; /** * @deprecated Timezone is now resolved automatically from context. This prop is kept for backwards compatibility. */ timezone?: DayRangePickerProps["timezone"]; /** * The maximum amount of days that can be selected. If not provided, there is no limit. */ maxDaysInRange?: number; /** * Define any days which may not be selected in the custom date range picker. */ disabledDays?: DayRangePickerProps["disabledDays"]; /** * The size of the button. */ size?: Size; /** * Whether the trigger button is full width. */ fullWidth?: boolean; /** * Custom action button to trigger the display of the date range selector. * If provided, this button replaces the default trigger button of the component. */ actionButton?: ReactElement; /** * The placement of the popover menu relative to the trigger button. * * @default "bottom-start" */ popoverPlacement?: PopoverPlacement; }; /** * DayRangeSelect is a popover-based date range picker with preset temporal options (e.g., "Last 7 days", "Next 30 days") * and an optional custom calendar picker. Users can search for presets by typing natural language queries like "last 3 months". * It supports configurable allowed directions, timezone handling, and max day limits. * * ### When to use * Use DayRangeSelect when users need to choose a date range from predefined presets or a custom calendar — for example, * filtering dashboard data by time period or selecting a reporting window. * * ### When not to use * Do not use DayRangeSelect for a standalone calendar without presets — use `DayRangePicker`. * Do not use it for time-only selection — use `TimeRangeField`. * * @example Date range select with default presets * ```tsx * import { DayRangeSelect } from "@trackunit/react-date-and-time-components"; * * const ReportFilter = () => ( * console.log(selection)} * /> * ); * ``` * @param {DayRangeSelectProps} props - The props for the DayRangeSelect component */ export declare const DayRangeSelect: ({ className, "data-testid": dataTestId, disabled, selectedDateRange, onRangeSelect, allowedDirection, initialDateRangeOptions, showDateRangeSearch, showResetButton, showCustomDateRangeOption, timezone, maxDaysInRange, disabledDays, size, fullWidth, actionButton, popoverPlacement, }: DayRangeSelectProps) => import("react/jsx-runtime").JSX.Element;