import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
import PropTypes from 'prop-types';
import Slide from '../Animation/Slide';
import Modal from '../Modal';
import { useClassNames } from '../utils';
var defaultProps = {
  classPrefix: 'drawer',
  placement: 'right',
  animation: Slide
};
var DrawerBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(Modal.Body, _extends({
    classPrefix: "drawer-body"
  }, props, {
    ref: ref
  }));
});
var DrawerHeader = /*#__PURE__*/React.forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(Modal.Header, _extends({
    classPrefix: "drawer-header"
  }, props, {
    ref: ref
  }));
});
var DrawerFooter = /*#__PURE__*/React.forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(Modal.Footer, _extends({
    classPrefix: "drawer-footer"
  }, props, {
    ref: ref
  }));
});
var DrawerTitle = /*#__PURE__*/React.forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(Modal.Title, _extends({
    classPrefix: "drawer-title"
  }, props, {
    ref: ref
  }));
});
var Drawer = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var className = props.className,
      placement = props.placement,
      classPrefix = props.classPrefix,
      rest = _objectWithoutPropertiesLoose(props, ["className", "placement", "classPrefix"]);

  var _useClassNames = useClassNames(classPrefix),
      merge = _useClassNames.merge,
      prefix = _useClassNames.prefix;

  var classes = merge(className, prefix(placement));
  var animationProps = {
    placement: placement
  };
  return /*#__PURE__*/React.createElement(Modal, _extends({}, rest, {
    ref: ref,
    drawer: true,
    classPrefix: classPrefix,
    className: classes,
    animationProps: animationProps
  }));
});
DrawerBody.displayName = 'DrawerBody';
DrawerHeader.displayName = 'DrawerHeader';
DrawerFooter.displayName = 'DrawerFooter';
DrawerTitle.displayName = 'DrawerTitle';
Drawer.Body = DrawerBody;
Drawer.Header = DrawerHeader;
Drawer.Footer = DrawerFooter;
Drawer.Title = DrawerTitle;
Drawer.displayName = 'Drawer';
Drawer.defaultProps = defaultProps;
Drawer.propTypes = {
  classPrefix: PropTypes.string,
  placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
  children: PropTypes.node,
  className: PropTypes.string
};
export default Drawer;