import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2007-2025 GoodData Corporation
import { useCallback } from "react";
import cx from "classnames";
import { FormattedMessage } from "react-intl";
import { stringUtils } from "@gooddata/util";
/**
 * @internal
 */
export function InvertableSelectItem(props) {
    const { title, onClick, onMouseOver, onMouseOut, isSelected, onOnly, renderOnly, icon, isDisabled } = props;
    const handleOnly = useCallback((e) => {
        if (isDisabled) {
            return;
        }
        e.stopPropagation();
        onOnly?.();
    }, [onOnly, isDisabled]);
    return (_jsxs("div", { className: cx({
            "gd-list-item": true,
            [`s-${stringUtils.simplifyText(title)}`]: true,
            "has-only-visible": true,
            "is-selected": isSelected,
            "is-disabled": isDisabled,
        }), onClick: isDisabled ? () => { } : onClick, onMouseOver: onMouseOver, onMouseOut: onMouseOut, children: [_jsxs("label", { className: "input-checkbox-label", children: [_jsx("input", { type: "checkbox", className: "input-checkbox", readOnly: true, checked: isSelected, disabled: isDisabled }), icon ?? null, _jsx("span", { className: "input-label-text", children: title })] }), renderOnly?.({ onOnly: onOnly }) ?? (_jsx("span", { className: "gd-list-item-only", onClick: handleOnly, children: _jsx(FormattedMessage, { id: "gs.list.only" }) }))] }));
}
//# sourceMappingURL=InvertableSelectItem.js.map