Skip to content

Commit

Permalink
[@mantine/dates] Fix popoverProps.onClose overriding original compo…
Browse files Browse the repository at this point in the history
…nent value in DatePickerInput and other similar components (#4105)
  • Loading branch information
rtivital committed Feb 26, 2024
1 parent 49ecef5 commit bd74e63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default { title: 'DatePickerInput' };
export function Usage() {
return (
<div style={{ padding: 40, maxWidth: 400 }}>
<DatePickerInput placeholder="Date picker input" />
<DatePickerInput
placeholder="Date picker input"
// eslint-disable-next-line no-console
popoverProps={{ onClose: () => console.log('close') }}
/>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,15 @@ export const PickerInputBase = factory<PickerInputBaseFactory>((_props, ref) =>
<Popover
position="bottom-start"
opened={dropdownOpened}
onClose={handleClose}
disabled={dropdownType === 'modal' || readOnly}
trapFocus
returnFocus
unstyled={unstyled}
{...popoverProps}
disabled={popoverProps?.disabled || dropdownType === 'modal' || readOnly}
onClose={() => {
popoverProps?.onClose?.();
handleClose();
}}
>
<Popover.Target>
<Input
Expand Down

0 comments on commit bd74e63

Please sign in to comment.