import { __assign, __rest } from "tslib";
import React from "react";
import { ListItemStyled } from "./styles";
import ListItemLeadContent from "./LeadContent";
import ListItemTrailContent from "./TrailContent";
var ListItem = React.forwardRef(function (_a, ref) {
    var children = _a.children, className = _a.className, style = _a.style, trailIcon = _a.trailIcon, _b = _a.isSelected, isSelected = _b === void 0 ? false : _b, onClick = _a.onClick, isDisabled = _a.isDisabled, leadIcon = _a.leadIcon, leadContent = _a.leadContent, trailContent = _a.trailContent, onDoubleClick = _a.onDoubleClick, _c = _a.size, size = _c === void 0 ? "l" : _c, props = __rest(_a, ["children", "className", "style", "trailIcon", "isSelected", "onClick", "isDisabled", "leadIcon", "leadContent", "trailContent", "onDoubleClick", "size"]);
    var handleClick = function (event) {
        !isDisabled && (onClick === null || onClick === void 0 ? void 0 : onClick(event));
    };
    var handleDoubleClick = function (event) {
        !isDisabled && (onDoubleClick === null || onDoubleClick === void 0 ? void 0 : onDoubleClick(event));
    };
    return (React.createElement(ListItemStyled, __assign({ as: "li", ref: ref, className: className, style: style, onClick: handleClick, onDoubleClick: handleDoubleClick, isSelected: isSelected, isDisabled: isDisabled, size: size, "data-element": "list-item" }, props),
        React.createElement("div", { className: "list-item__lead-content" },
            React.createElement(ListItemLeadContent, { leadIcon: leadIcon, leadContent: leadContent }),
            children),
        React.createElement(ListItemTrailContent, { trailIcon: trailIcon, trailContent: trailContent })));
});
ListItem.displayName = "ListItem";
export default ListItem;
