'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports["default"] = undefined;

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');

var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var React = _interopRequireWildcard(_react);

var _rmcPullToRefresh = require('rmc-pull-to-refresh');

var _rmcPullToRefresh2 = _interopRequireDefault(_rmcPullToRefresh);

var _icon = require('../icon');

var _icon2 = _interopRequireDefault(_icon);

var _splitObject3 = require('../_util/splitObject');

var _splitObject4 = _interopRequireDefault(_splitObject3);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var RefreshControl = function (_React$Component) {
    (0, _inherits3["default"])(RefreshControl, _React$Component);

    function RefreshControl() {
        (0, _classCallCheck3["default"])(this, RefreshControl);
        return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
    }

    RefreshControl.prototype.render = function render() {
        var _splitObject = (0, _splitObject4["default"])(this.props, ['prefixCls', 'children', 'icon', 'loading', 'hammerOptions']);

        var _splitObject2 = (0, _slicedToArray3["default"])(_splitObject, 2);

        var _splitObject2$ = _splitObject2[0];
        var prefixCls = _splitObject2$.prefixCls;
        var children = _splitObject2$.children;
        var icon = _splitObject2$.icon;
        var loading = _splitObject2$.loading;
        var hammerOptions = _splitObject2$.hammerOptions;
        var restProps = _splitObject2[1];

        return React.createElement(
            _rmcPullToRefresh2["default"],
            (0, _extends3["default"])({}, restProps, { prefixCls: prefixCls, icon: icon, loading: loading, hammerOptions: hammerOptions || {} }),
            children
        );
    };

    return RefreshControl;
}(React.Component);

exports["default"] = RefreshControl;

RefreshControl.propTypes = {
    prefixCls: _react.PropTypes.string,
    children: _react.PropTypes.any,
    icon: _react.PropTypes.any,
    loading: _react.PropTypes.any,
    hammerOptions: _react.PropTypes.object
};
RefreshControl.defaultProps = {
    prefixCls: 'am-refresh-control',
    icon: React.createElement(
        'div',
        null,
        React.createElement(
            'div',
            { className: 'pull' },
            React.createElement(_icon2["default"], { type: 'down' })
        ),
        React.createElement(
            'div',
            { className: 'release' },
            React.createElement(_icon2["default"], { type: 'up' })
        )
    ),
    loading: React.createElement(_icon2["default"], { type: 'loading' })
};
module.exports = exports['default'];