diff --git a/packages/bento-design-system/src/DateField/DateField.tsx b/packages/bento-design-system/src/DateField/DateField.tsx index 6f5e4ce14..1148cba9a 100644 --- a/packages/bento-design-system/src/DateField/DateField.tsx +++ b/packages/bento-design-system/src/DateField/DateField.tsx @@ -18,11 +18,11 @@ export type ShortcutProps = { }; type SingleDateFieldProps = { type?: "single"; - shortcuts?: ShortcutProps[]; + shortcuts?: ShortcutProps[]; } & FieldProps; type RangeDateFieldProps = { type: "range"; - shortcuts?: ShortcutProps<[Date, Date]>[]; + shortcuts?: ShortcutProps<[Date, Date] | null>[]; } & FieldProps<[Date, Date] | null>; type Props = (SingleDateFieldProps | RangeDateFieldProps) & { minDate?: Date; @@ -138,6 +138,7 @@ function RangeDateField({ disabled, readOnly, ...props }: Extract } + | { type: "single"; fieldProps: AriaDatePickerProps } | { type: "range"; fieldProps: { - start: AriaDateFieldOptions; - end: AriaDateFieldOptions; + start: AriaDatePickerProps; + end: AriaDatePickerProps; }; } ) & { @@ -60,7 +65,7 @@ function DateSegment({ segment, state }: { segment: DateSegmentType; state: Date ); } -function DateField({ fieldProps }: { fieldProps: AriaDateFieldOptions }) { +function DateField({ fieldProps }: { fieldProps: AriaDatePickerProps }) { const { locale } = useLocale(); const ref = useRef(null); const state = useDateFieldState({ diff --git a/packages/bento-design-system/stories/Components/DateField.stories.tsx b/packages/bento-design-system/stories/Components/DateField.stories.tsx index 71f86e5f4..7ffc99b7d 100644 --- a/packages/bento-design-system/stories/Components/DateField.stories.tsx +++ b/packages/bento-design-system/stories/Components/DateField.stories.tsx @@ -67,6 +67,7 @@ export const SingleWithShortcuts = { args: { value: null, shortcuts: [ + { label: "Clear", value: null }, { label: "Today", value: new Date(), @@ -132,6 +133,10 @@ export const RangeWithShortcuts = { value: null, type: "range", shortcuts: [ + { + label: "Clear all", + value: null, + }, { label: "This Week", value: [startOfWeek(today), endOfWeek(today)],