"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextSettings = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const uikit_1 = require("@gravity-ui/uikit");
const Row_1 = require("./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';
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 ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(Row_1.Row, { label: "Text", children: (0, jsx_runtime_1.jsx)(uikit_1.TextArea, { value: field.text ?? '', onUpdate: (value) => updateField(field.id, { text: value }), minRows: 2, placeholder: "Static hint text" }) }), (0, jsx_runtime_1.jsx)(Row_1.Row, { label: "Banner", children: (0, jsx_runtime_1.jsx)(uikit_1.Select, { size: "m", value: [field.level ?? ''], options: TEXT_LEVEL_OPTIONS, onUpdate: handleLevelUpdate }) }), (0, jsx_runtime_1.jsx)(Row_1.Row, { label: "Color", children: (0, jsx_runtime_1.jsx)(uikit_1.Select, { size: "m", value: [field.color ?? ''], options: TEXT_COLOR_OPTIONS, onUpdate: handleColorUpdate }) }), whenEditorSection] }));
};
exports.TextSettings = TextSettings;
//# sourceMappingURL=TextSettings.js.map
