function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = _object_without_properties_loose(source, excluded);
    var key, i;
    if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceSymbolKeys.length; i++){
            key = sourceSymbolKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        target[key] = source[key];
    }
    return target;
}
import React, { forwardRef } from 'react';
import { component, dropdownItemOldConfig, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import styled from 'styled-components';
import { IconDone } from '@salutejs/plasma-icons';
import { accent } from '@salutejs/plasma-core';
var mergedItemConfig = mergeConfig(dropdownItemOldConfig);
export var DropdownNewHopeItem = component(mergedItemConfig);
var StyledCheck = styled(IconDone).withConfig({
    displayName: "DropdownItem__StyledCheck",
    componentId: "sc-dab289d0-0"
})([
    "margin-left:auto;pointer-events:none;margin-right:-0.5rem;"
]);
export var DropdownItem = /*#__PURE__*/ forwardRef(function(props, ref) {
    var value = props.value, label = props.label, color = props.color, contentLeft = props.contentLeft, isActive = props.isActive, isHovered = props.isHovered, index = props.index, onClick = props.onClick, onHover = props.onHover, onFocus = props.onFocus, items = props.items, isDisabled = props.isDisabled, style = props.style, rest = _object_without_properties(props, [
        "value",
        "label",
        "color",
        "contentLeft",
        "isActive",
        "isHovered",
        "index",
        "onClick",
        "onHover",
        "onFocus",
        "items",
        "isDisabled",
        "style"
    ]);
    var handleClick = function(e) {
        if (onClick) {
            onClick({
                value: value,
                label: label,
                color: color,
                contentLeft: contentLeft
            }, e);
        }
    };
    var handleHover = function() {
        if (onHover) {
            onHover(index);
        }
    };
    return /*#__PURE__*/ React.createElement(DropdownNewHopeItem, _object_spread_props(_object_spread({}, rest), {
        value: value,
        text: label,
        ref: ref,
        style: _object_spread_props(_object_spread({}, style), {
            color: color
        }),
        contentLeft: contentLeft,
        contentRight: isActive ? /*#__PURE__*/ React.createElement(StyledCheck, {
            size: "s",
            color: accent
        }) : undefined,
        onClick: handleClick,
        onMouseOver: handleHover,
        onFocus: onFocus,
        disabled: isDisabled
    }));
});
