From 12d1a100d1bc1345ed9330b32559b580533d524e Mon Sep 17 00:00:00 2001 From: Vincenzo Guerrisi Date: Tue, 14 May 2024 16:09:44 +0200 Subject: [PATCH] allow shortcuts with null value --- .../src/DateField/DateField.tsx | 5 +++-- .../bento-design-system/src/DateField/Input.tsx | 17 +++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) 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({