Added a clear/reset button in InternalDateInput to reset/unschedule events (#3154)

* Added a clear/reset button in InternalDateInput to reset/unschedule events

* Added clearable prop to <InternalDateInput /> and fixed some design mistakes

* Removed unnecessary code that was used during debugging

* Replaced button with <MenuItem /> component

* Fixed null date in ObjectFilterDropdownDateSearchInput

* Moved clear context call from DateInput to DateFieldInput

* Removed useless props

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Atharv Parlikar
2023-12-29 19:45:08 +05:30
committed by GitHub
parent fd607789f4
commit 97f83b55b0
11 changed files with 89 additions and 36 deletions

View File

@ -37,6 +37,7 @@ export type DateInputProps = {
newDate: Nullable<Date>,
) => void;
hotkeyScope: string;
clearable?: boolean;
};
export const DateInput = ({
@ -45,6 +46,7 @@ export const DateInput = ({
onEnter,
onEscape,
onClickOutside,
clearable,
}: DateInputProps) => {
const theme = useTheme();
@ -91,9 +93,10 @@ export const DateInput = ({
<InternalDatePicker
date={internalValue ?? new Date()}
onChange={handleChange}
onMouseSelect={(newDate: Date) => {
onMouseSelect={(newDate: Date | null) => {
onEnter(newDate);
}}
clearable={clearable ? clearable : false}
/>
</StyledCalendarContainer>
</div>