import { DateRangePreset } from "../Calendar/presets.mjs"; import { FieldBaseProps } from "../FieldBase/FieldBase.mjs"; import { WidthProp } from "@marigold/system"; import { Ref } from "react"; import RAC from "react-aria-components"; import { DateValue } from "react-aria-components/DateRangePicker"; type RemovedProps = 'isDisabled' | 'isDateUnavailable' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'style' | 'className' | 'isOpen'; export interface DateRangePickerProps extends Omit, RemovedProps>, Pick, 'label' | 'addon' | 'description' | 'errorMessage'> { /** * Callback that is called for each date of the calendar. If it returns true, then the date is unavailable. */ dateUnavailable?: RAC.DateRangePickerProps['isDateUnavailable']; /** * If `true`, the date range picker is disabled. * @default false */ disabled?: RAC.DateRangePickerProps['isDisabled']; /** * If `true`, the date range picker is required. * @default false */ required?: RAC.DateRangePickerProps['isRequired']; /** * If `true`, the date range picker is readOnly. * @default false */ readOnly?: RAC.DateRangePickerProps['isReadOnly']; /** * If `true`, the field is considered invalid and if set the errorMessage is shown instead of the `description`. * @default false */ error?: RAC.DateRangePickerProps['isInvalid']; /** * Whether the calendar is open by default (controlled). * @default false */ open?: RAC.DateRangePickerProps['isOpen']; /** * Visual variant of the component. Which values exist is defined by the theme * and listed in the "Appearance" section of the component's documentation. */ variant?: string; /** * Size of the component. Which values exist is defined by the theme and listed * in the "Appearance" section of the component's documentation. */ size?: string; /** * The number of months to display at once in the calendar popover. Up to 3 months are supported. * @default { months: 1 } */ visibleDuration?: { months: 1 | 2 | 3; }; /** * Controls how the calendar pages when navigating. * - 'single': Page by one month at a time * - 'visible': Page by the number of visible months * @default 'visible' */ pageBehavior?: RAC.DateRangePickerProps['pageBehavior']; /** * Sets the width of the field. You can see allowed tokens here: https://tailwindcss.com/docs/width * * Numeric/scale values are spacing-scale tokens, not pixels: `width={64}` * resolves to `calc(var(--spacing) * 64)` ~= 16rem (256px), not 64px. * * When unset, the field hugs its content (`'fit'`) on larger screens and * fills the available space (`'full'`) on small screens, where two dates plus * the separator and calendar button would otherwise be too cramped to fit. * @default 'fit' */ width?: WidthProp['width']; /** * Quick-select presets rendered beside the calendar in the popover. In * the small-screen tray, a "Quick selection" row above the grid switches * the sheet to the preset list in place. Accepts built-in keys (see * `BuiltInDateRangePresetKey`) with localized labels, and custom presets * with a `label` and a range value or resolver function. Selecting a * preset applies the range; the overlay stays open. */ presets?: readonly DateRangePreset[]; } declare const DateRangePickerBase: ({ dateUnavailable, disabled, required, readOnly, error, variant, size, open, granularity, visibleDuration, pageBehavior, width, presets, onChange, ref, ...rest }: DateRangePickerProps & { ref?: Ref; }) => import("react").JSX.Element; export { DateRangePickerBase as DateRangePicker };