"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_reactDom=require("react-dom"),ReactDOM=_interopRequireWildcard(_reactDom),_rcAnimate=require("rc-animate"),_rcAnimate2=_interopRequireDefault(_rcAnimate),_icon=require("../icon"),_icon2=_interopRequireDefault(_icon),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function noop(){}var Alert=function(e){function t(e){(0,_classCallCheck3.default)(this,t);var r=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleClose=function(e){e.preventDefault();var t=ReactDOM.findDOMNode(r);t.style.height=t.offsetHeight+"px",t.style.height=t.offsetHeight+"px",r.setState({closing:!1}),(r.props.onClose||noop)(e)},r.animationEnd=function(){r.setState({closed:!0,closing:!0})},r.state={closing:!0,closed:!1},r}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"render",value:function(){var e,t=this.props,r=t.closable,a=t.description,i=t.type,s=t.prefixCls,n=void 0===s?"dt-alert":s,l=t.message,o=t.closeText,c=t.showIcon,u=t.banner,p=t.className,d=void 0===p?"":p,_=t.style,f=t.iconType;if(c=!(!u||void 0!==c)||c,i=u&&void 0===i?"warning":i||"info",!f)switch(i){case"success":f="check-circle";break;case"info":f="info-circle";break;case"error":f="close-circle";break;case"warning":f="exclamation-circle";break;case"comment":f="info-circle";break;default:f="default"}var m=(0,_classnames2.default)(n,(e={},(0,_defineProperty3.default)(e,n+"-"+i,!0),(0,_defineProperty3.default)(e,n+"-close",!this.state.closing),(0,_defineProperty3.default)(e,n+"-with-description",!!a),(0,_defineProperty3.default)(e,n+"-no-icon",!c),(0,_defineProperty3.default)(e,n+"-banner",!!u),e),d);o&&(r=!0);var h=r?React.createElement("a",{onClick:this.handleClose,className:n+"-close-icon"},o||React.createElement(_icon2.default,{type:"close"})):null;return this.state.closed?null:React.createElement(_rcAnimate2.default,{component:"",showProp:"data-show",transitionName:n+"-slide-up",onEnd:this.animationEnd},React.createElement("div",{"data-show":this.state.closing,className:m,style:_},c?React.createElement(_icon2.default,{className:n+"-icon",type:f}):null,React.createElement("span",{className:n+"-message"},l),React.createElement("span",{className:n+"-description"},a),h))}}]),t}(React.Component);exports.default=Alert,module.exports=exports.default;