var _excluded = ["children"];

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 Popup from '../popup';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

var Notify = function Notify(_ref) {
  var children = _ref.children,
      props = _objectWithoutPropertiesLoose(_ref, _excluded);

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

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

  var style = {
    color: props.color,
    background: props.background
  };
  return /*#__PURE__*/React.createElement(Popup, {
    visible: props.visible,
    style: style,
    overlay: false,
    position: "top",
    lockScroll: props.lockScroll,
    onClick: props.onClick,
    onClose: props.onClose,
    onClosed: props.onClosed,
    teleport: props.teleport
  }, /*#__PURE__*/React.createElement("div", {
    className: cls(bem([props.type]), props.className)
  }, children || props.message));
};

Notify.defaultProps = {
  type: 'danger',
  duration: 3000,
  color: 'white',
  lockScroll: false
};
export default Notify;