import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from '../../../utils/cn.js';
import { to_inline_style } from '../../../utils/style_resolver.js';
import { DataFormHelpTooltip } from './data_form_help_tooltip.js';
export function DataFormLabel({ field, config, computed_formula }) {
    const { style_resolver } = config;
    const item_code_style = style_resolver.has_style('item_code')
        ? to_inline_style(style_resolver.resolve('item_code'))
        : undefined;
    const label_style = style_resolver.has_style('label')
        ? to_inline_style(style_resolver.resolve('label'))
        : undefined;
    return (_jsxs("div", { className: cn('cls_data_form_label', 'flex items-center gap-2 min-w-0'), children: [field.item_code && (_jsx("span", { className: "cls_data_form_item_code inline-flex items-center justify-center shrink-0", style: {
                    ...item_code_style,
                    borderStyle: 'solid',
                }, children: field.item_code })), _jsxs("span", { className: "cls_data_form_label_text truncate", style: label_style, children: [field.label || field.id, field.required && (_jsx("span", { className: "text-red-500 ml-0.5", "aria-label": "required", children: "*" }))] }), field.help_tooltip && (_jsx(DataFormHelpTooltip, { help_tooltip: field.help_tooltip, computed_formula: computed_formula }))] }));
}
//# sourceMappingURL=data_form_label.js.map