import { jsx as _jsx } from "react/jsx-runtime";
import { useState } from 'react';
import { ArrowUturnCwLeft as WrappingIcon } from '@gravity-ui/icons';
import { ActionTooltip, Button, Icon } from '@gravity-ui/uikit';
import { i18n } from "../../../i18n/viewer/index.js";
export function CodeTextWrappingToggleButton({ qa, style, className, codeElement, }) {
    const [hasWrapping, setHasWrapping] = useState(() => Boolean(codeElement.querySelector('pre code')?.classList?.contains('wrap')));
    return (_jsx(ActionTooltip, { title: i18n('code_wrapping'), children: _jsx(Button, { size: "m", view: "flat", selected: hasWrapping, style: style, "data-qa": qa, className: className, onClick: () => {
                const preCode = codeElement.querySelector('pre code');
                setHasWrapping(Boolean(preCode?.classList?.toggle('wrap')));
            }, children: _jsx(Button.Icon, { children: _jsx(Icon, { data: WrappingIcon }) }) }) }));
}
//# sourceMappingURL=TextWrappingButton.js.map
