import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import cx from "classnames";
import { cloneDeep, set } from "lodash-es";
import { useIntl } from "react-intl";
import { Button } from "@gooddata/sdk-ui-kit";
import { messages } from "../../../../../../locales.js";
import { isComparisonDefaultColors } from "../../../../../utils/comparisonHelper.js";
import { COMPARISON_COLOR_CONFIG_EQUALS, COMPARISON_COLOR_CONFIG_NEGATIVE, COMPARISON_COLOR_CONFIG_POSITIVE, } from "../../ComparisonValuePath.js";
export function ColorResetButton({ disabled, properties, pushData }) {
    const { formatMessage } = useIntl();
    const label = formatMessage(messages["resetColors"]);
    const isDefaultColors = isComparisonDefaultColors(properties?.controls?.comparison?.colorConfig);
    const resetColors = () => {
        const clonedProperties = cloneDeep(properties);
        set(clonedProperties.controls, COMPARISON_COLOR_CONFIG_POSITIVE, undefined);
        set(clonedProperties.controls, COMPARISON_COLOR_CONFIG_NEGATIVE, undefined);
        set(clonedProperties.controls, COMPARISON_COLOR_CONFIG_EQUALS, undefined);
        pushData({ properties: clonedProperties });
    };
    const classNames = cx(["gd-color-reset-colors-section", "s-gd-color-reset-colors-section"], {
        disabled: disabled || isDefaultColors,
    });
    return (_jsx("div", { className: classNames, children: _jsx(Button, { value: label, className: "gd-button-link", onClick: resetColors, disabled: disabled }) }));
}
//# sourceMappingURL=ColorResetButton.js.map