'use strict';

import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import BSTooltip from 'react-bootstrap/lib/Tooltip';

type TooltipProps = {
    children: React.ReactNode;
    className?: string;
} & BSTooltip.TooltipProps;

export class Tooltip extends React.Component<TooltipProps> {
    static propTypes = {
        ...(BSTooltip as any).propTypes,
        children: PropTypes.node.isRequired,
        className: PropTypes.string
    };

    static defaultProps = {
        className: null
    };

    render() {
        let {children, className, ...props} = this.props;
        return (
            <BSTooltip
                className={classnames(className, 'bootstrap-rc')}
                data-test-automation-id="tooltip"
                {...props}>
                {children}
            </BSTooltip>
        );
    }
}
