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:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user