import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2022-2026 GoodData Corporation
import { useCallback, useMemo } from "react";
import cx from "classnames";
import { simplifyText } from "@gooddata/util";
import { ParentFiltersDisabledItem } from "./ParentFiltersDisabledItem.js";
export function ParentFiltersListItemWithoutConnectingAttributes({ item: { isSelected, localIdentifier }, onClick, currentFilterLocalId, title, disabled, isValid, }) {
    const activeItemClasses = useMemo(() => {
        return cx("gd-list-item attribute-filter-item s-attribute-filter-dropdown-configuration-item", `s-${simplifyText(title)}`, {
            "is-selected": isSelected,
        });
    }, [isSelected, title]);
    const onSelect = useCallback(() => {
        onClick(localIdentifier, !isSelected);
    }, [onClick, localIdentifier, isSelected]);
    if (!isValid) {
        return (_jsx(ParentFiltersDisabledItem, { hasConnectingAttributes: false, itemTitle: title, itemLocalId: currentFilterLocalId }));
    }
    return (_jsx("div", { className: activeItemClasses, onClick: () => !disabled && onSelect(), title: title, children: _jsxs("label", { className: "input-checkbox-label configuration-item-title", children: [
                _jsx("input", { type: "checkbox", className: "input-checkbox s-checkbox", checked: isSelected, disabled: disabled, readOnly: true }), _jsx("span", { className: "input-label-text", children: title })
            ] }) }));
}
