import _defineProperty from"babel-runtime/helpers/defineProperty";import _classCallCheck from"babel-runtime/helpers/classCallCheck";import _createClass from"babel-runtime/helpers/createClass";import _possibleConstructorReturn from"babel-runtime/helpers/possibleConstructorReturn";import _inherits from"babel-runtime/helpers/inherits";import*as React from"react";import*as ReactDOM from"react-dom";import Animate from"rc-animate";import Icon from"../icon";import classNames from"classnames";function noop(){}var Alert=function(e){function t(e){_classCallCheck(this,t);var s=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return s.handleClose=function(e){e.preventDefault();var t=ReactDOM.findDOMNode(s);t.style.height=t.offsetHeight+"px",t.style.height=t.offsetHeight+"px",s.setState({closing:!1}),(s.props.onClose||noop)(e)},s.animationEnd=function(){s.setState({closed:!0,closing:!0})},s.state={closing:!0,closed:!1},s}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e,t=this.props,s=t.closable,r=t.description,a=t.type,o=t.prefixCls,n=void 0===o?"dt-alert":o,c=t.message,i=t.closeText,l=t.showIcon,m=t.banner,p=t.className,f=void 0===p?"":p,h=t.style,d=t.iconType;if(l=!(!m||void 0!==l)||l,a=m&&void 0===a?"warning":a||"info",!d)switch(a){case"success":d="check-circle";break;case"info":d="info-circle";break;case"error":d="close-circle";break;case"warning":d="exclamation-circle";break;case"comment":d="info-circle";break;default:d="default"}var u=classNames(n,(_defineProperty(e={},n+"-"+a,!0),_defineProperty(e,n+"-close",!this.state.closing),_defineProperty(e,n+"-with-description",!!r),_defineProperty(e,n+"-no-icon",!l),_defineProperty(e,n+"-banner",!!m),e),f);i&&(s=!0);var b=s?React.createElement("a",{onClick:this.handleClose,className:n+"-close-icon"},i||React.createElement(Icon,{type:"close"})):null;return this.state.closed?null:React.createElement(Animate,{component:"",showProp:"data-show",transitionName:n+"-slide-up",onEnd:this.animationEnd},React.createElement("div",{"data-show":this.state.closing,className:u,style:h},l?React.createElement(Icon,{className:n+"-icon",type:d}):null,React.createElement("span",{className:n+"-message"},c),React.createElement("span",{className:n+"-description"},r),b))}}]),t}(React.Component);export default Alert;