'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _jsx = function () { var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; return function createRawReactElement(type, props, key, children) { var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = {}; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _styles = require('../helpers/styles');

var _theme = require('../const/theme');

var _CloseCrossIcon = require('../SVGIcons/CloseCrossIcon');

var _CloseCrossIcon2 = _interopRequireDefault(_CloseCrossIcon);

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

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var CloseCross = function CloseCross(props) {
    var size = props.size,
        styles = props.styles,
        isHasHover = props.isHasHover,
        rest = _objectWithoutProperties(props, ['size', 'styles', 'isHasHover']);

    return _react2.default.createElement(
        'div',
        _extends({}, rest, {
            className: _styles.css.apply(undefined, [STYLE.closeCross, STYLE.getPreset('size', size), isHasHover && STYLE.closeCrossHover].concat(_toConsumableArray(styles || []))) }),
        _jsx(_CloseCrossIcon2.default, {
            color: isHasHover ? _theme.COLOR.MUTED : _theme.COLOR.TEXT
        })
    );
};

CloseCross.defaultProps = {
    size: 'm',
    isHasHover: false
};

var STYLE = _styles.StyleSheet.create({
    closeCross: {
        cursor: 'pointer',
        verticalAlign: 'top',
        height: '16px',
        width: '16px',
        lineHeight: '16px',
        '& path': {
            transition: 'all 0.15s ease-in'
        }
    },
    closeCrossHover: {
        '&:hover path': {
            stroke: _theme.COLOR.TEXT
        }
    },
    sizeL: {
        fontSize: '1.4rem'
    },
    sizeM: {
        fontSize: '1.2rem'
    },
    sizeS: {
        fontSize: '1rem'
    },
    sizeXs: {
        fontSize: '.8rem'
    }
});

exports.default = CloseCross;