"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get ItemContent () {
        return ItemContent;
    },
    get ItemSelectionIcon () {
        return ItemSelectionIcon;
    }
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _utils = require("../../utils");
const _Comboboxtokens = require("../../Combobox.tokens");
const _ItemViewstyles = require("./ItemView.styles");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const ItemSelectionIcon = ({ checked, disabled, multiple, size, variant, renderSelectionIcon, checkboxAppearance, withMargin, onChange })=>/*#__PURE__*/ _react.default.createElement(_ItemViewstyles.IconWrapper, {
        variant: variant,
        withMargin: withMargin
    }, renderSelectionIcon ? renderSelectionIcon((0, _utils.mapCheckedVariants)(checked, multiple)) : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, multiple && /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledCheckboxWrapper, {
        onClick: (e)=>e.stopPropagation()
    }, /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledCheckbox, {
        disabled: disabled,
        checked: Boolean(checked),
        indeterminate: checked === 'indeterminate',
        onChange: onChange,
        appearance: checkboxAppearance ?? 'default'
    })), !multiple && checked === 'dot' && /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledIndicator, {
        size: "s",
        view: "default"
    }), !multiple && checked === 'done' && /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledIconDone, {
        size: (0, _utils.sizeToIconSize)(size, variant),
        color: "inherit"
    })));
const ItemContent = ({ item, renderItem, singleLine })=>{
    const { label, contentLeft, contentRight } = item;
    if (renderItem) {
        return /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledText, null, renderItem(item));
    }
    return /*#__PURE__*/ _react.default.createElement(_ItemViewstyles.StyledCell, {
        contentLeft: contentLeft,
        contentRight: contentRight,
        title: label,
        className: singleLine ? _Comboboxtokens.classes.singleLineMode : ''
    });
};
