import React from "react";
import { sizeToIconSize, mapCheckedVariants } from "../../utils";
import { classes } from "../../Combobox.tokens";
import { StyledText, StyledCheckbox, IconWrapper, StyledIndicator, StyledCheckboxWrapper, StyledCell, StyledIconDone } from "./ItemView.styles";
export const ItemSelectionIcon = ({ checked, disabled, multiple, size, variant, renderSelectionIcon, checkboxAppearance, withMargin, onChange })=>/*#__PURE__*/ React.createElement(IconWrapper, {
        variant: variant,
        withMargin: withMargin
    }, renderSelectionIcon ? renderSelectionIcon(mapCheckedVariants(checked, multiple)) : /*#__PURE__*/ React.createElement(React.Fragment, null, multiple && /*#__PURE__*/ React.createElement(StyledCheckboxWrapper, {
        onClick: (e)=>e.stopPropagation()
    }, /*#__PURE__*/ React.createElement(StyledCheckbox, {
        disabled: disabled,
        checked: Boolean(checked),
        indeterminate: checked === 'indeterminate',
        onChange: onChange,
        appearance: checkboxAppearance ?? 'default'
    })), !multiple && checked === 'dot' && /*#__PURE__*/ React.createElement(StyledIndicator, {
        size: "s",
        view: "default"
    }), !multiple && checked === 'done' && /*#__PURE__*/ React.createElement(StyledIconDone, {
        size: sizeToIconSize(size, variant),
        color: "inherit"
    })));
export const ItemContent = ({ item, renderItem, singleLine })=>{
    const { label, contentLeft, contentRight } = item;
    if (renderItem) {
        return /*#__PURE__*/ React.createElement(StyledText, null, renderItem(item));
    }
    return /*#__PURE__*/ React.createElement(StyledCell, {
        contentLeft: contentLeft,
        contentRight: contentRight,
        title: label,
        className: singleLine ? classes.singleLineMode : ''
    });
};
