diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 4403ff2424..aa29239255 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -35,12 +35,18 @@ export function isCustomProps( } const TRIANGLE_SIZE = 5 +const DEFAULT_POSITION = 'top' export function Tooltip(props: DefaultTooltipProps): ReactElement export function Tooltip(props: CustomTooltipProps): ReactElement export function Tooltip< FCProps extends React.PropsWithChildren = DefaultTooltipProps, ->(props: DefaultTooltipProps | CustomTooltipProps): ReactElement { +>({ + position = DEFAULT_POSITION, + wrapperclasses, + className, + ...props +}: DefaultTooltipProps | CustomTooltipProps): ReactElement { const triggerElementRef = useRef(null) const tooltipBodyRef = useRef(null) const tooltipID = useRef( @@ -56,8 +62,6 @@ export function Tooltip< const [wrapTooltip, setWrapTooltip] = useState(false) const [positionStyles, setPositionStyles] = useState({}) - const { position, wrapperclasses, className } = props - const positionTop = (e: HTMLElement, triggerEl: HTMLElement): void => { const topMargin = calculateMarginOffset('top', e.offsetHeight, triggerEl) const leftMargin = calculateMarginOffset('left', e.offsetWidth, triggerEl) @@ -287,7 +291,3 @@ export function Tooltip< ) } } - -Tooltip.defaultProps = { - position: 'top', -} diff --git a/src/components/forms/DatePicker/DatePicker.tsx b/src/components/forms/DatePicker/DatePicker.tsx index 8aff890b9a..411c1a18d7 100644 --- a/src/components/forms/DatePicker/DatePicker.tsx +++ b/src/components/forms/DatePicker/DatePicker.tsx @@ -345,7 +345,3 @@ export const DatePicker = ({ ) } - -DatePicker.defaultProps = { - minDate: DEFAULT_MIN_DATE, -}