"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_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),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_rcCheckbox=require("rc-checkbox"),_rcCheckbox2=_interopRequireDefault(_rcCheckbox),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_shallowequal=require("shallowequal"),_shallowequal2=_interopRequireDefault(_shallowequal);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)r.indexOf(a[l])<0&&(t[a[l]]=e[a[l]])}return t},Radio=function(e){function t(){(0,_classCallCheck3.default)(this,t);var r=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.saveCheckbox=function(e){r.rcCheckbox=e},r}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"shouldComponentUpdate",value:function(e,r,t){return!(0,_shallowequal2.default)(this.props,e)||!(0,_shallowequal2.default)(this.state,r)||!(0,_shallowequal2.default)(this.context.radioGroup,t.radioGroup)}},{key:"focus",value:function(){this.rcCheckbox.focus()}},{key:"blur",value:function(){this.rcCheckbox.blur()}},{key:"render",value:function(){var e,r=this.props,t=this.context,a=r.prefixCls,l=r.className,s=r.children,o=r.style,u=__rest(r,["prefixCls","className","children","style"]),n=t.radioGroup,i=(0,_extends3.default)({},u);n&&(i.name=n.name,i.onChange=n.onChange,i.checked=r.value===n.value,i.disabled=r.disabled||n.disabled);var c=(0,_classnames2.default)(l,(e={},(0,_defineProperty3.default)(e,a+"-wrapper",!0),(0,_defineProperty3.default)(e,a+"-wrapper-checked",i.checked),(0,_defineProperty3.default)(e,a+"-wrapper-disabled",i.disabled),e));return React.createElement("label",{className:c,style:o,onMouseEnter:r.onMouseEnter,onMouseLeave:r.onMouseLeave},React.createElement(_rcCheckbox2.default,(0,_extends3.default)({},i,{prefixCls:a,ref:this.saveCheckbox})),void 0!==s?React.createElement("span",null,s):null)}}]),t}(React.Component);(exports.default=Radio).defaultProps={prefixCls:"dt-radio",type:"radio"},Radio.contextTypes={radioGroup:PropTypes.any},module.exports=exports.default;