import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2019-2025 GoodData Corporation
import { memo } from "react";
import { useIntl } from "react-intl";
import { messages } from "../../../../locales.js";
import { rotationDropdownItems } from "../../../constants/dropdowns.js";
import { getTranslatedDropdownItems } from "../../../utils/translations.js";
import { DropdownControl } from "../DropdownControl.js";
export const LabelRotationControl = memo(function LabelRotationControl(props) {
    const intl = useIntl();
    const getControlProperties = () => {
        const axisProperties = props.properties?.controls?.[props.axis];
        const axisVisible = axisProperties?.visible ?? true;
        const axisLabelsEnabled = axisProperties?.labelsEnabled ?? true;
        const axisRotation = axisProperties?.rotation ?? "auto";
        return {
            axisVisible,
            axisLabelsEnabled,
            axisRotation,
        };
    };
    const { axisVisible, axisLabelsEnabled, axisRotation } = getControlProperties();
    const isDisabled = props.disabled || !axisVisible || !axisLabelsEnabled;
    return (_jsx(DropdownControl, { value: axisRotation, valuePath: `${props.axis}.rotation`, labelText: messages["axisRotation"].id, disabled: isDisabled, showDisabledMessage: !props.configPanelDisabled && isDisabled, properties: props.properties, pushData: props.pushData, items: getTranslatedDropdownItems(rotationDropdownItems, intl) }));
});
//# sourceMappingURL=LabelRotationControl.js.map