Skip to content

Commit

Permalink
feat: add onCancel prop to timepicker component
Browse files Browse the repository at this point in the history
affects: @medly-components/core
  • Loading branch information
gmukul01 committed Oct 13, 2024
1 parent 2b70fae commit 03ba529
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/components/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Component: FC<TimePickerProps> = memo(
const {
value,
onChange,
onCancel,
disabled,
className,
fullWidth,
Expand All @@ -31,6 +32,7 @@ const Component: FC<TimePickerProps> = memo(
const handleReset = () => {
setTextfieldKey(key => key + 1);
clearOnCancel && onChange('');
onCancel?.();
};
const handleChange = (value: string) => {
setTextfieldKey(key => key + 1);
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/TimePicker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface TimePickerProps extends Omit<TextFieldProps, 'value' | 'onChang
value: string;
/** Function to be called on changing the time */
onChange: (time: string) => void;
/** Function to be called on cancel */
onCancel?: () => void;
/** Popover placement */
popoverPlacement?: Placement;
/** Distance from Textfield */
Expand Down

0 comments on commit 03ba529

Please sign in to comment.