import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getCalculationValuesDefault } from "@gooddata/sdk-ui-charts";
import { CalculationControl } from "./calculation/CalculationControl.js";
import { COMPARISON_ENABLED_VALUE_PATH } from "./ComparisonValuePath.js";
import { IndicatorSubSection } from "./indicators/IndicatorSubSection.js";
import { LabelSubSection } from "./label/LabelSubSection.js";
import { ValueSubSection } from "./values/ValueSubSection.js";
import { comparisonMessages } from "../../../../locales.js";
import { ConfigSection } from "../ConfigSection.js";
export function ComparisonSection({ controlDisabled, disabledByVisualization, defaultCalculationType, separators, properties, propertiesMeta, colorPalette, pushData, }) {
    const toggledOn = properties.controls?.comparison?.enabled;
    const comparisonDisabled = controlDisabled || disabledByVisualization;
    const sectionDisabled = comparisonDisabled || !toggledOn;
    const showDisabledMessage = !controlDisabled && disabledByVisualization;
    const calculationType = properties?.controls?.comparison?.calculationType || defaultCalculationType;
    const { defaultFormat, defaultLabelKeys } = getCalculationValuesDefault(calculationType);
    return (_jsxs(ConfigSection, { id: "comparison_section", valuePath: COMPARISON_ENABLED_VALUE_PATH, title: comparisonMessages["title"].id, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData, canBeToggled: true, toggleDisabled: comparisonDisabled, showDisabledMessage: showDisabledMessage, toggledOn: toggledOn, children: [_jsx(CalculationControl, { disabled: sectionDisabled, showDisabledMessage: showDisabledMessage, defaultCalculationType: defaultCalculationType, properties: properties, pushData: pushData }), _jsx(ValueSubSection, { sectionDisabled: sectionDisabled, showDisabledMessage: showDisabledMessage, defaultFormat: defaultFormat, separators: separators, properties: properties, pushData: pushData }), _jsx(IndicatorSubSection, { sectionDisabled: sectionDisabled, showDisabledMessage: showDisabledMessage, properties: properties, colorPalette: colorPalette, pushData: pushData }), _jsx(LabelSubSection, { sectionDisabled: sectionDisabled, showDisabledMessage: showDisabledMessage, defaultLabelKeys: defaultLabelKeys, calculationType: calculationType, properties: properties, pushData: pushData })] }));
}
//# sourceMappingURL=ComparisonSection.js.map