import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { Select, TextArea } from '@gravity-ui/uikit';
import { Row } from "./Row.js";
const TEXT_COLOR_OPTIONS = [
    { value: '', content: 'Default' },
    { value: 'primary', content: 'Primary' },
    { value: 'secondary', content: 'Secondary' },
    { value: 'hint', content: 'Hint' },
    { value: 'info', content: 'Info' },
    { value: 'positive', content: 'Positive' },
    { value: 'warning', content: 'Warning' },
    { value: 'danger', content: 'Danger' },
    { value: 'utility', content: 'Utility' },
    { value: 'misc', content: 'Misc' },
];
const TEXT_LEVEL_OPTIONS = [
    { value: '', content: 'None' },
    { value: 'info', content: 'Info banner' },
    { value: 'danger', content: 'Danger banner' },
];
const TEXT_COLORS = [
    'primary',
    'secondary',
    'hint',
    'info',
    'positive',
    'warning',
    'danger',
    'utility',
    'misc',
];
const isTextColor = (value) => TEXT_COLORS.includes(value);
const isTextLevel = (value) => value === 'info' || value === 'danger';
export const TextSettings = ({ field, updateField, whenEditorSection }) => {
    const handleLevelUpdate = ([value]) => {
        updateField(field.id, {
            level: isTextLevel(value) ? value : undefined,
        });
    };
    const handleColorUpdate = ([value]) => {
        updateField(field.id, {
            color: isTextColor(value) ? value : undefined,
        });
    };
    return (_jsxs(React.Fragment, { children: [_jsx(Row, { label: "Text", children: _jsx(TextArea, { value: field.text ?? '', onUpdate: (value) => updateField(field.id, { text: value }), minRows: 2, placeholder: "Static hint text" }) }), _jsx(Row, { label: "Banner", children: _jsx(Select, { size: "m", value: [field.level ?? ''], options: TEXT_LEVEL_OPTIONS, onUpdate: handleLevelUpdate }) }), _jsx(Row, { label: "Color", children: _jsx(Select, { size: "m", value: [field.color ?? ''], options: TEXT_COLOR_OPTIONS, onUpdate: handleColorUpdate }) }), whenEditorSection] }));
};
//# sourceMappingURL=TextSettings.js.map
