UNPKG

@talend/react-bootstrap

Version:

Bootstrap 3 components built with React

88 lines 2.3 kB
import classNames from 'classnames'; import React, { cloneElement } from 'react'; import PropTypes from 'prop-types'; import BaseOverlay from 'react-overlays/lib/Overlay'; import elementType from 'prop-types-extra/lib/elementType'; import Fade from './Fade'; import { jsx as _jsx } from "react/jsx-runtime"; const propTypes = { ...BaseOverlay.propTypes, /** * Set the visibility of the Overlay */ show: PropTypes.bool, /** * Specify whether the overlay should trigger onHide when the user clicks outside the overlay */ rootClose: PropTypes.bool, /** * A callback invoked by the overlay when it wishes to be hidden. Required if * `rootClose` is specified. */ onHide: PropTypes.func, /** * Use animation */ animation: PropTypes.oneOfType([PropTypes.bool, elementType]), /** * Callback fired before the Overlay transitions in */ onEnter: PropTypes.func, /** * Callback fired as the Overlay begins to transition in */ onEntering: PropTypes.func, /** * Callback fired after the Overlay finishes transitioning in */ onEntered: PropTypes.func, /** * Callback fired right before the Overlay transitions out */ onExit: PropTypes.func, /** * Callback fired as the Overlay begins to transition out */ onExiting: PropTypes.func, /** * Callback fired after the Overlay finishes transitioning out */ onExited: PropTypes.func, /** * Sets the direction of the Overlay. */ placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']) }; const defaultProps = { animation: Fade, rootClose: false, show: false, placement: 'right' }; class Overlay extends React.Component { render() { const { animation, children, ...props } = this.props; const transition = animation === true ? Fade : animation || null; let child; if (!transition) { child = /*#__PURE__*/cloneElement(children, { className: classNames(children.props.className, 'in') }); } else { child = children; } return /*#__PURE__*/_jsx(BaseOverlay, { ...props, transition: transition, children: child }); } } Overlay.propTypes = propTypes; Overlay.defaultProps = defaultProps; export default Overlay; //# sourceMappingURL=Overlay.js.map