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 Icon from"../icon";import Input from"../input";var Search=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.handleChange=function(t){var r=e.props.onChange;r&&r(t)},e.handleClear=function(t){t.preventDefault();var r=e.props.handleClear;r&&r(t)},e}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this.props,t=e.placeholder,r=e.value,a=e.prefixCls,l=r&&r.length>0?React.createElement("a",{href:"#",className:a+"-action",onClick:this.handleClear},React.createElement(Icon,{type:"close-circle"})):React.createElement("span",{className:a+"-action"},React.createElement(Icon,{type:"search"}));return React.createElement("div",null,React.createElement(Input,{placeholder:t,className:a,value:r,onChange:this.handleChange}),l)}}]),t}(React.Component);export default Search;Search.defaultProps={placeholder:""};