var _excluded = ["children", "className", "hairline", "dashed", "contentPosition"];

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React, { useContext } from 'react';
import cls from 'clsx';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

var Divider = function Divider(_ref) {
  var _bem;

  var children = _ref.children,
      className = _ref.className,
      hairline = _ref.hairline,
      dashed = _ref.dashed,
      contentPosition = _ref.contentPosition,
      props = _objectWithoutPropertiesLoose(_ref, _excluded);

  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('divider', prefixCls),
      bem = _createNamespace[0];

  return /*#__PURE__*/React.createElement("div", _extends({
    role: "separator",
    className: cls(className, bem((_bem = {
      dashed: dashed,
      hairline: hairline
    }, _bem["content-" + contentPosition] = !!children, _bem)))
  }, props), children);
};

Divider.defaultProps = {
  hairline: true,
  contentPosition: 'center'
};
export default Divider;