import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2007-2026 GoodData Corporation
import { memo, useCallback, useMemo } from "react";
import cx from "classnames";
import { FormattedMessage } from "react-intl";
import { simplifyText } from "@gooddata/util";
/**
 * @internal
 * @deprecated This component is deprecated use MultiSelectListItem instead
 */
export const LegacyMultiSelectListItem = memo(function LegacyMultiSelectListItem({ onMouseOver = () => { }, onMouseOut = () => { }, onOnly = () => { }, onSelect = () => { }, selected = false, source = {}, }) {
    const classNames = useMemo(() => cx({
        "gd-list-item": true,
        [`s-${simplifyText(source.title)}`]: true,
        "has-only-visible": true,
        "is-selected": selected,
    }), [source.title, selected]);
    const handleSelect = useCallback(() => {
        onSelect(source);
    }, [onSelect, source]);
    const handleMouseOver = useCallback(() => {
        onMouseOver(source);
    }, [onMouseOver, source]);
    const handleMouseOut = useCallback(() => {
        onMouseOut(source);
    }, [onMouseOut, source]);
    const handleOnly = useCallback((ev) => {
        ev.stopPropagation();
        onOnly(source);
    }, [onOnly, source]);
    const renderOnly = useCallback(() => {
        return (_jsx("span", { className: "gd-list-item-only", onClick: handleOnly, children: _jsx(FormattedMessage, { id: "gs.list.only" }) }));
    }, [handleOnly]);
    return (_jsxs("div", { className: classNames, onClick: handleSelect, onMouseOver: handleMouseOver, onMouseOut: handleMouseOut, children: [
            _jsxs("label", { className: "input-checkbox-label", children: [
                    _jsx("input", { type: "checkbox", className: "input-checkbox", readOnly: true, checked: selected }), _jsx("span", { className: "input-label-text", children: source.title })
                ] }), renderOnly()] }));
});
