import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Card, Icon, Label, Text } from '@gravity-ui/uikit';
import { formBuilderV2Cn } from "../../utils/cn.js";
import { TYPE_ICONS, TYPE_LABELS } from "../../utils/fieldMeta.js";
import './DragOverlayPreview.css';
const b = formBuilderV2Cn('drag-overlay');
const getFieldTitle = (f) => {
    if (!f)
        return '';
    if ('title' in f)
        return f.title ?? '';
    if ('text' in f)
        return f.text ?? '';
    return '';
};
export const DragOverlayPreview = ({ type, field }) => {
    const name = field && 'name' in field ? field.name : '';
    const title = getFieldTitle(field);
    return (_jsxs(Card, { className: b(), view: "raised", children: [_jsx(Icon, { data: TYPE_ICONS[type], size: 14 }), _jsxs("div", { className: b('text'), children: [_jsx(Text, { variant: "body-2", children: TYPE_LABELS[type] }), (name || title) && (_jsx(Label, { theme: "unknown", size: "s", children: name || title }))] })] }));
};
//# sourceMappingURL=DragOverlayPreview.js.map
