import { jsx as _jsx } from "react/jsx-runtime";
import { memo } from 'react';
import { Select } from '@gravity-ui/uikit';
import { cn } from "../../../../../classname.js";
import { i18n } from "../../../../../i18n/codeblock/index.js";
import { i18n as i18nPlaceholder } from "../../../../../i18n/placeholder/index.js";
import { PlainTextLang } from "../const.js";
const bCodeBlock = cn('code-block');
export const CodeLangSelect = memo(function CodeLangSelect({ lang, focus, onChange, selectItems, mapping }) {
    const value = mapping[lang] || lang || PlainTextLang;
    const handleClick = (type) => {
        focus();
        if (type === value)
            return;
        onChange(type);
    };
    return (_jsx(Select, { size: "m", width: "max", disablePortal: true, value: [value], onUpdate: (v) => handleClick(v[0]), options: selectItems, filterable: true, filterPlaceholder: i18nPlaceholder('select_filter'), popupClassName: bCodeBlock('select-popup'), className: bCodeBlock('select-button'), renderEmptyOptions: () => (_jsx("div", { className: bCodeBlock('select-empty'), children: i18n('empty_option') })) }));
});
//# sourceMappingURL=CodeLangSelect.js.map
