'use strict';

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

var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var plasmaNewHope = require('@salutejs/plasma-new-hope');
var styled = require('styled-components');
var plasmaIcons = require('@salutejs/plasma-icons');
var plasmaCore = require('@salutejs/plasma-core');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);
var styled__default = /*#__PURE__*/_interopDefault(styled);

var _StyledCheck;
var _excluded = ["value", "label", "color", "contentLeft", "isActive", "isHovered", "index", "onClick", "onHover", "onFocus", "items", "isDisabled", "style"];
var mergedItemConfig = /*#__PURE__*/plasmaNewHope.mergeConfig(plasmaNewHope.dropdownItemOldConfig);
var DropdownNewHopeItem = /*#__PURE__*/plasmaNewHope.component(mergedItemConfig);
var StyledCheck = /*#__PURE__*/styled__default.default(plasmaIcons.IconDone).withConfig({
  componentId: "plasma-web__sc-1kwedk5-0"
})(["margin-left:auto;pointer-events:none;margin-right:-0.5rem;"]);
var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var value = props.value,
    label = props.label,
    color = props.color,
    contentLeft = props.contentLeft,
    isActive = props.isActive,
    index = props.index,
    onClick = props.onClick,
    onHover = props.onHover,
    onFocus = props.onFocus,
    isDisabled = props.isDisabled,
    style = props.style,
    rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
  var handleClick = function handleClick(e) {
    if (onClick) {
      onClick({
        value: value,
        label: label,
        color: color,
        contentLeft: contentLeft
      }, e);
    }
  };
  var handleHover = function handleHover() {
    if (onHover) {
      onHover(index);
    }
  };
  return /*#__PURE__*/React__default.default.createElement(DropdownNewHopeItem, _rollupPluginBabelHelpers.extends({}, rest, {
    value: value,
    text: label,
    ref: ref,
    style: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, style), {}, {
      color: color
    }),
    contentLeft: contentLeft,
    contentRight: isActive ? _StyledCheck || (_StyledCheck = /*#__PURE__*/React__default.default.createElement(StyledCheck, {
      size: "s",
      color: plasmaCore.accent
    })) : undefined,
    onClick: handleClick,
    onMouseOver: handleHover,
    onFocus: onFocus,
    disabled: isDisabled
  }));
});

exports.DropdownItem = DropdownItem;
exports.DropdownNewHopeItem = DropdownNewHopeItem;
//# sourceMappingURL=DropdownItem.js.map
