import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import { cloneDeep, set } from "lodash-es";
import { useIntl } from "react-intl";
import { Checkbox } from "@gooddata/sdk-ui-kit";
import { comparisonMessages } from "../../../../../../locales.js";
import { DisabledBubbleMessage } from "../../../../DisabledBubbleMessage.js";
import { COMPARISON_COLOR_CONFIG_DISABLED } from "../../ComparisonValuePath.js";
export function ColorCheckbox({ disabled, showDisabledMessage, properties, pushData }) {
    const { formatMessage } = useIntl();
    const checked = !properties?.controls?.comparison?.colorConfig?.disabled;
    const label = formatMessage(comparisonMessages["colorsConfigTitle"]);
    const handleChange = (value) => {
        const clonedProperties = cloneDeep(properties);
        set(clonedProperties.controls, COMPARISON_COLOR_CONFIG_DISABLED, !value);
        pushData({ properties: clonedProperties });
    };
    return (_jsx(DisabledBubbleMessage, { showDisabledMessage: !!showDisabledMessage, children: _jsx(Checkbox, { text: label, value: checked, disabled: disabled, onChange: handleChange }) }));
}
//# sourceMappingURL=ColorCheckbox.js.map