import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import { useMemo } from "react";
import { cloneDeep, set } from "lodash-es";
import { FormattedMessage, useIntl } from "react-intl";
import { MeasureNumberFormat } from "@gooddata/sdk-ui-kit";
import { NumberFormatToggleButton } from "./NumberFormatToggleButton.js";
import { getPresets, getTemplates } from "../../../../../utils/comparisonHelper.js";
import { DisabledBubbleMessage } from "../../../../DisabledBubbleMessage.js";
export function NumberFormatControl({ disabled, valuePath, labelText, format, showDisabledMessage, separators, properties, pushData, }) {
    const intl = useIntl();
    const selectFormat = (format) => {
        const clonedProperties = cloneDeep(properties);
        set(clonedProperties.controls, valuePath, format);
        pushData({ properties: clonedProperties });
    };
    const presets = useMemo(() => getPresets(intl), [intl]);
    const templates = useMemo(() => getTemplates(intl), [intl]);
    return (_jsx(DisabledBubbleMessage, { showDisabledMessage: showDisabledMessage ?? false, children: _jsxs("div", { className: "adi-properties-dropdown-container measure-number-format-control", children: [
                _jsx("span", { className: "input-label-text", children: _jsx(FormattedMessage, { id: labelText }) }), _jsx("label", { className: "adi-bucket-inputfield gd-input gd-input-small measure-number-format-control-dropdown", children: _jsx(MeasureNumberFormat, { disabled: disabled, toggleButton: NumberFormatToggleButton, presets: presets, templates: templates, separators: separators, selectedFormat: format, setFormat: selectFormat, locale: intl.locale }, format) })
            ] }) }));
}
//# sourceMappingURL=NumberFormatControl.js.map