Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import type { TermId } from "@carbon/content/glossary";
import { cn, LabelWithHelp } from "@carbon/react";
import type { ReactNode } from "react";
type FieldProps = {
label: string;
required?: boolean;
/** Glossary term for the ⓘ hover. Absent => no icon, same layout. */
helpTermId?: TermId;
/** Free-text ⓘ hover — a vendor's own field description. `helpTermId` wins. */
help?: string;
/** Message from a validation issue whose `field` path resolves here. */
issue?: string;
/** Advisory one-liner, muted. An issue outranks it — one line under a field. */
hint?: string;
children: ReactNode;
};
/** The label / required marker / message shell every value control sits in. */
export function Field({
label,
required,
helpTermId,
help,
issue,
hint,
children
}: FieldProps) {
return (
<div className="flex w-full min-w-0 flex-col gap-1">
{/* Still rendered when hidden: an `aria-label` on a plain div is ignored. */}
<label className={cn("text-sm font-medium text-foreground")}>
<LabelWithHelp termId={helpTermId} text={help}>
{label}
{required && <span className="ml-0.5 text-destructive">*</span>}
</LabelWithHelp>
</label>
{/* No ring here: the control draws its own destructive border, and the two
together read as a thick red slab. */}
<div className="flex items-center gap-1">{children}</div>
{issue && <p className="text-xs text-destructive">{issue}</p>}
{hint && !issue && (
<p className="text-xs text-muted-foreground">{hint}</p>
)}
</div>
);
}