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
feat(status): centralize status enum colors in @carbon/utils; docs FieldTable + StatusFlow
Sidwebworks771e6b50692b
diff --git a/apps/erp/app/modules/accounting/ui/FixedAssets/FixedAssetStatus.tsx b/apps/erp/app/modules/accounting/ui/FixedAssets/FixedAssetStatus.tsxindex 343fb5622e..aee74d7f59 100644--- a/apps/erp/app/modules/accounting/ui/FixedAssets/FixedAssetStatus.tsx+++ b/apps/erp/app/modules/accounting/ui/FixedAssets/FixedAssetStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { FIXED_ASSET_STATUS_COLOR_MAP } from "@carbon/utils";import type { fixedAssetStatuses } from "../../accounting.models";type FixedAssetStatusProps = {@@ -6,18 +7,11 @@ type FixedAssetStatusProps = {};const FixedAssetStatus = ({ status }: FixedAssetStatusProps) => {- switch (status) {- case "Draft":- return <Status color="gray">{status}</Status>;- case "Active":- return <Status color="green">{status}</Status>;- case "Fully Depreciated":- return <Status color="yellow">{status}</Status>;- case "Disposed":- return <Status color="red">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = FIXED_ASSET_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default FixedAssetStatus;diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryStatus.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryStatus.tsxindex ff272cc103..85a26bd71c 100644--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryStatus.tsx+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { JOURNAL_ENTRY_STATUS_COLOR_MAP } from "@carbon/utils";import type { journalEntryStatuses } from "../../accounting.models";type JournalEntryStatusProps = {@@ -6,16 +7,11 @@ type JournalEntryStatusProps = {};const JournalEntryStatus = ({ status }: JournalEntryStatusProps) => {- switch (status) {- case "Draft":- return <Status color="gray">{status}</Status>;- case "Posted":- return <Status color="green">{status}</Status>;- case "Reversed":- return <Status color="red">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = JOURNAL_ENTRY_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default JournalEntryStatus;diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptStatus.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptStatus.tsxindex 3dd968bfdd..5dca1302a2 100644--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptStatus.tsx+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { RECEIPT_STATUS_COLOR_MAP } from "@carbon/utils";import { Trans } from "@lingui/react/macro";import type { receiptStatusType } from "~/modules/inventory";@@ -7,28 +8,30 @@ type ReceiptStatusProps = {};const ReceiptStatus = ({ status }: ReceiptStatusProps) => {+ if (!status) return null;+ const color = RECEIPT_STATUS_COLOR_MAP[status];switch (status) {case "Draft":return (- <Status color="gray">+ <Status color={color}><Trans>Draft</Trans></Status>);case "Pending":return (- <Status color="orange">+ <Status color={color}><Trans>Pending</Trans></Status>);case "Posted":return (- <Status color="green">+ <Status color={color}><Trans>Posted</Trans></Status>);case "Voided":return (- <Status color="red">+ <Status color={color}><Trans>Voided</Trans></Status>);diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentStatus.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentStatus.tsxindex f7036b39c8..6b4dad11a6 100644--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentStatus.tsx+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { SHIPMENT_STATUS_COLOR_MAP } from "@carbon/utils";import { Trans } from "@lingui/react/macro";import type { shipmentStatusType } from "~/modules/inventory";@@ -16,28 +17,30 @@ const ShipmentStatus = ({ status, invoiced, voided }: ShipmentStatusProps) => {</Status>);}+ if (!status) return null;+ const color = SHIPMENT_STATUS_COLOR_MAP[status];switch (status) {case "Draft":return (- <Status color="gray">+ <Status color={color}><Trans>Draft</Trans></Status>);case "Pending":return (- <Status color="orange">+ <Status color={color}><Trans>Pending</Trans></Status>);case "Posted":return (- <Status color="green">+ <Status color={color}><Trans>Posted</Trans></Status>);case "Voided":return (- <Status color="red">+ <Status color={color}><Trans>Voided</Trans></Status>);diff --git a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferStatus.tsx b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferStatus.tsxindex 78092d968c..3b492c06c1 100644--- a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferStatus.tsx+++ b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { STOCK_TRANSFER_STATUS_COLOR_MAP } from "@carbon/utils";import { Trans } from "@lingui/react/macro";import type { stockTransferStatusType } from "~/modules/inventory";@@ -7,28 +8,30 @@ type StockTransferStatusProps = {};const StockTransferStatus = ({ status }: StockTransferStatusProps) => {+ if (!status) return null;+ const color = STOCK_TRANSFER_STATUS_COLOR_MAP[status];switch (status) {case "Draft":return (- <Status color="gray">+ <Status color={color}><Trans>Draft</Trans></Status>);case "Released":return (- <Status color="orange">+ <Status color={color}><Trans>Released</Trans></Status>);case "In Progress":return (- <Status color="blue">+ <Status color={color}><Trans>In Progress</Trans></Status>);case "Completed":return (- <Status color="green">+ <Status color={color}><Trans>Completed</Trans></Status>);diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntityStatus.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntityStatus.tsxindex 11824b6f3d..9715aad579 100644--- a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntityStatus.tsx+++ b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntityStatus.tsx@@ -1,5 +1,6 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";+import { TRACKED_ENTITY_STATUS_COLOR_MAP } from "@carbon/utils";import { Trans } from "@lingui/react/macro";type TrackedEntityStatusProps = {@@ -7,34 +8,36 @@ type TrackedEntityStatusProps = {};function TrackedEntityStatus({ status }: TrackedEntityStatusProps) {+ if (!status) return null;+ const color = TRACKED_ENTITY_STATUS_COLOR_MAP[status];switch (status) {case "Available":return (- <Status color="green">+ <Status color={color}><Trans>Available</Trans></Status>);case "Reserved":return (- <Status color="gray">+ <Status color={color}><Trans>Reserved</Trans></Status>);case "On Hold":return (- <Status color="orange">+ <Status color={color}><Trans>On Hold</Trans></Status>);case "Rejected":return (- <Status color="red">+ <Status color={color}><Trans>Rejected</Trans></Status>);case "Consumed":return (- <Status color="blue">+ <Status color={color}><Trans>Consumed</Trans></Status>);diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoicingStatus.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoicingStatus.tsxindex 51b239a952..9b3fa5392e 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoicingStatus.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoicingStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { PURCHASE_INVOICE_STATUS_COLOR_MAP } from "@carbon/utils";import type { purchaseInvoiceStatusType } from "~/modules/invoicing";type PurchaseInvoicingStatusProps = {@@ -6,25 +7,11 @@ type PurchaseInvoicingStatusProps = {};const PurchaseInvoicingStatus = ({ status }: PurchaseInvoicingStatusProps) => {- switch (status) {- case "Draft":- // case "Return":- return <Status color="gray">{status}</Status>;- case "Open":- return <Status color="blue">{status}</Status>;- case "Pending":- case "Partially Paid":- return <Status color="orange">{status}</Status>;- case "Overdue":- return <Status color="red">{status}</Status>;- case "Voided":- return <Status color="red">{status}</Status>;- case "Debit Note Issued":- case "Paid":- return <Status color="green">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = PURCHASE_INVOICE_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default PurchaseInvoicingStatus;diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceStatus.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceStatus.tsxindex 66d7f8e1fd..38376e3cbb 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceStatus.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceStatus.tsx@@ -1,30 +1,17 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";+import { SALES_INVOICE_STATUS_COLOR_MAP } from "@carbon/utils";type SalesInvoicingStatusProps = {status?: Database["public"]["Enums"]["salesInvoiceStatus"] | null;};const SalesInvoicingStatus = ({ status }: SalesInvoicingStatusProps) => {- switch (status) {- case "Draft":- case "Return":- return <Status color="gray">{status}</Status>;- case "Submitted":- return <Status color="blue">{status}</Status>;- case "Pending":- case "Partially Paid":- return <Status color="yellow">{status}</Status>;- case "Voided":- return <Status color="red">{status}</Status>;- case "Overdue":- return <Status color="orange">{status}</Status>;- case "Credit Note Issued":- case "Paid":- return <Status color="green">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = SALES_INVOICE_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default SalesInvoicingStatus;diff --git a/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx b/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsxindex 7c32aef6a6..2cf9ddf2af 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx@@ -1,27 +1,14 @@import { Status } from "@carbon/react";+import { JOB_STATUS_COLOR_MAP } from "@carbon/utils";import type { jobStatus } from "../../production.models";+export { JOB_STATUS_COLOR_MAP } from "@carbon/utils";+type JobStatusProps = {status?: (typeof jobStatus)[number] | null;className?: string;};-export const JOB_STATUS_COLOR_MAP: Record<- (typeof jobStatus)[number],- "gray" | "yellow" | "blue" | "orange" | "green" | "red"-> = {- Draft: "gray",- Planned: "yellow",- Ready: "blue",- "In Progress": "orange",- Paused: "orange",- "Due Today": "orange",- Completed: "green",- Closed: "gray",- Overdue: "red",- Cancelled: "red"-} as const;-function JobStatus({ status, className }: JobStatusProps) {if (!status) return null;diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchasingStatus.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchasingStatus.tsxindex 1f2451ed45..07bc72bbdc 100644--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchasingStatus.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchasingStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { PURCHASE_ORDER_STATUS_COLOR_MAP } from "@carbon/utils";import type { purchaseOrderStatusType } from "~/modules/purchasing";type PurchasingStatusProps = {@@ -6,23 +7,25 @@ type PurchasingStatusProps = {};const PurchasingStatus = ({ status }: PurchasingStatusProps) => {+ if (!status) return null;+ const color = PURCHASE_ORDER_STATUS_COLOR_MAP[status];switch (status) {case "Draft":- return <Status color="gray">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Planned":case "To Review":case "Needs Approval":- return <Status color="yellow">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "To Receive":case "To Receive and Invoice":- return <Status color="orange">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "To Invoice":- return <Status color="blue">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Completed":- return <Status color="green">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Closed":case "Rejected":- return <Status color="red">{status}</Status>;+ return <Status color={color}>{status}</Status>;default:return null;}diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsxindex 54a154a6d5..52051f1eee 100644--- a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { PURCHASING_RFQ_STATUS_COLOR_MAP } from "@carbon/utils";import type { purchasingRfqStatusType } from "../../purchasing.models";type PurchasingRFQStatusProps = {@@ -6,13 +7,15 @@ type PurchasingRFQStatusProps = {};const PurchasingRFQStatus = ({ status }: PurchasingRFQStatusProps) => {+ if (!status) return null;+ const color = PURCHASING_RFQ_STATUS_COLOR_MAP[status];switch (status) {case "Draft":- return <Status color="gray">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Requested":- return <Status color="green">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Closed":- return <Status color="red">{status}</Status>;+ return <Status color={color}>{status}</Status>;default:return null;}diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteStatus.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteStatus.tsxindex c05c823067..ff6563fc74 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteStatus.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { SUPPLIER_QUOTE_STATUS_COLOR_MAP } from "@carbon/utils";import type { supplierQuoteStatusType } from "../../purchasing.models";type SupplierQuoteStatusProps = {@@ -6,16 +7,18 @@ type SupplierQuoteStatusProps = {};const SupplierQuoteStatus = ({ status }: SupplierQuoteStatusProps) => {+ if (!status) return null;+ const color = SUPPLIER_QUOTE_STATUS_COLOR_MAP[status];switch (status) {case "Active":- return <Status color="green">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Draft":- return <Status color="gray">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Declined":- return <Status color="orange">{status}</Status>;+ return <Status color={color}>{status}</Status>;case "Expired":case "Cancelled":- return <Status color="red">{status}</Status>;+ return <Status color={color}>{status}</Status>;default:return null;}diff --git a/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx b/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsxindex 1f5296542f..ac38e9a72f 100644--- a/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx+++ b/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx@@ -1,19 +1,21 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";+import {+ GAUGE_CALIBRATION_STATUS_COLOR_MAP,+ GAUGE_ROLE_COLOR_MAP,+ GAUGE_STATUS_COLOR_MAP+} from "@carbon/utils";type GaugeStatusProps = {status?: Database["public"]["Enums"]["gaugeStatus"] | null;};const GaugeStatus = ({ status }: GaugeStatusProps) => {- switch (status) {- case "Active":- return <Status color="gray">{status}</Status>;- case "Inactive":- return <Status color="red">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = GAUGE_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};type GaugeCalibrationStatusProps = {@@ -21,16 +23,11 @@ type GaugeCalibrationStatusProps = {};const GaugeCalibrationStatus = ({ status }: GaugeCalibrationStatusProps) => {- switch (status) {- case "Pending":- return <Status color="orange">{status}</Status>;- case "In-Calibration":- return <Status color="green">{status}</Status>;- case "Out-of-Calibration":- return <Status color="red">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = GAUGE_CALIBRATION_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};type GaugeRoleProps = {@@ -38,14 +35,11 @@ type GaugeRoleProps = {};const GaugeRole = ({ role }: GaugeRoleProps) => {- switch (role) {- case "Master":- return <Status color="blue">{role}</Status>;- case "Standard":- return <Status color="gray">{role}</Status>;- default:- return null;- }+ if (!role) return null;+ const color = GAUGE_ROLE_COLOR_MAP[role];+ if (!color) return null;++ return <Status color={color}>{role}</Status>;};export { GaugeCalibrationStatus, GaugeRole, GaugeStatus };diff --git a/apps/erp/app/modules/quality/ui/Issue/IssueStatus.tsx b/apps/erp/app/modules/quality/ui/Issue/IssueStatus.tsxindex af23ce7254..8eb88be9de 100644--- a/apps/erp/app/modules/quality/ui/Issue/IssueStatus.tsx+++ b/apps/erp/app/modules/quality/ui/Issue/IssueStatus.tsx@@ -1,21 +1,17 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";+import { ISSUE_STATUS_COLOR_MAP } from "@carbon/utils";type IssueStatusProps = {status?: Database["public"]["Enums"]["nonConformanceStatus"] | null;};const IssueStatus = ({ status }: IssueStatusProps) => {- switch (status) {- case "Registered":- return <Status color="gray">{status}</Status>;- case "In Progress":- return <Status color="blue">{status}</Status>;- case "Closed":- return <Status color="green">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = ISSUE_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default IssueStatus;diff --git a/apps/erp/app/modules/quality/ui/RiskRegister/RiskStatus.tsx b/apps/erp/app/modules/quality/ui/RiskRegister/RiskStatus.tsxindex 8fc2c5a91f..dc2d1da9b3 100644--- a/apps/erp/app/modules/quality/ui/RiskRegister/RiskStatus.tsx+++ b/apps/erp/app/modules/quality/ui/RiskRegister/RiskStatus.tsx@@ -1,25 +1,17 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";+import { RISK_STATUS_COLOR_MAP } from "@carbon/utils";type RiskStatusProps = {status?: Database["public"]["Enums"]["riskStatus"] | null;};const RiskStatus = ({ status }: RiskStatusProps) => {- switch (status) {- case "Accepted":- return <Status color="green">{status}</Status>;- case "In Review":- return <Status color="blue">{status}</Status>;- case "Mitigating":- return <Status color="orange">{status}</Status>;- case "Closed":- return <Status color="red">{status}</Status>;- case "Open":- return <Status color="gray">{status}</Status>;- default:- return null;- }+ if (!status) return null;+ const color = RISK_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default RiskStatus;diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceStatus.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceStatus.tsxindex ce0f22c68e..b249acb322 100644--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceStatus.tsx+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { MAINTENANCE_DISPATCH_STATUS_COLOR_MAP } from "@carbon/utils";import type { maintenanceDispatchStatus } from "../../resources.models";type MaintenanceStatusProps = {@@ -7,40 +8,15 @@ type MaintenanceStatusProps = {};function MaintenanceStatus({ status, className }: MaintenanceStatusProps) {- switch (status) {- case "Open":- return (- <Status color="gray" className={className}>- {status}- </Status>- );- case "Assigned":- return (- <Status color="yellow" className={className}>- {status}- </Status>- );- case "In Progress":- return (- <Status color="blue" className={className}>- {status}- </Status>- );- case "Completed":- return (- <Status color="green" className={className}>- {status}- </Status>- );- case "Cancelled":- return (- <Status color="red" className={className}>- {status}- </Status>- );- default:- return null;- }+ if (!status) return null;+ const color = MAINTENANCE_DISPATCH_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return (+ <Status color={color} className={className}>+ {status}+ </Status>+ );}export default MaintenanceStatus;diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteStatus.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteStatus.tsxindex 2930c4c33a..c5e226c645 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteStatus.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { QUOTE_STATUS_COLOR_MAP } from "@carbon/utils";import type { quoteStatusType } from "../../sales.models";type QuoteStatusProps = {@@ -6,22 +7,12 @@ type QuoteStatusProps = {};const QuoteStatus = ({ status }: QuoteStatusProps) => {- switch (status) {- case "Draft":- return <Status color="gray">{status}</Status>;- case "Sent":- return <Status color="blue">{status}</Status>;- case "Ordered":- case "Partial":- return <Status color="green">{status}</Status>;- case "Cancelled":- case "Expired":- return <Status color="red">{status}</Status>;- case "Lost":- return <Status color="orange">{status}</Status>;- default:- return null;- }+ if (!status) return null;++ const color = QUOTE_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default QuoteStatus;diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesStatus.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesStatus.tsxindex 2256aa5edc..23ebb47086 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesStatus.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesStatus.tsx@@ -1,6 +1,8 @@import type { Database } from "@carbon/database";import { Status } from "@carbon/react";-import { hasIncompleteJobs } from "@carbon/utils";+import { hasIncompleteJobs, SALES_STATUS_COLOR_MAP } from "@carbon/utils";++export { SALES_STATUS_COLOR_MAP } from "@carbon/utils";type SalesOrderStatusProps = {status?: Database["public"]["Enums"]["salesOrderStatus"] | null;@@ -18,23 +20,6 @@ type SalesOrderStatusProps = {disableTooltip?: boolean;};-export const SALES_STATUS_COLOR_MAP: Record<- Database["public"]["Enums"]["salesOrderStatus"],- "gray" | "yellow" | "orange" | "blue" | "green" | "red"-> = {- Draft: "gray",- Cancelled: "red",- Closed: "red",- "To Ship and Invoice": "orange",- "To Ship": "orange",- "To Invoice": "blue",- Confirmed: "blue",- "Needs Approval": "yellow",- "In Progress": "yellow",- Invoiced: "gray",- Completed: "green"-} as const;-const SalesStatus = ({status,jobs,diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQStatus.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQStatus.tsxindex 622cc05bd9..26e1ecbf62 100644--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQStatus.tsx+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQStatus.tsx@@ -1,4 +1,5 @@import { Status } from "@carbon/react";+import { SALES_RFQ_STATUS_COLOR_MAP } from "@carbon/utils";import type { salesRFQStatusType } from "../../sales.models";type SalesRFQStatusProps = {@@ -6,18 +7,12 @@ type SalesRFQStatusProps = {};const SalesRFQStatus = ({ status }: SalesRFQStatusProps) => {- switch (status) {- case "Draft":- return <Status color="gray">{status}</Status>;- case "Ready for Quote":- return <Status color="green">{status}</Status>;- case "Quoted":- return <Status color="blue">{status}</Status>;- case "Closed":- return <Status color="red">{status}</Status>;- default:- return null;- }+ if (!status) return null;++ const color = SALES_RFQ_STATUS_COLOR_MAP[status];+ if (!color) return null;++ return <Status color={color}>{status}</Status>;};export default SalesRFQStatus;diff --git a/docs/app/global.css b/docs/app/global.cssindex a7bb1db51c..f3f87aaa79 100644--- a/docs/app/global.css+++ b/docs/app/global.css@@ -87,6 +87,32 @@--color-brand: hsl(var(--brand));}+/* Editorial warm-paper palette as Tailwind theme tokens — single source of truth for the+ * hand-built editorial components (FieldTable, StatusFlow). Defining them in @theme both+ * generates utilities (text-ed-ink, bg-ed-paper, border-ed-hairline, fill-ed-*, …) and+ * exposes them as CSS variables (var(--color-ed-*)) for inline SVG styles. They mirror the+ * exact hex the components were hardcoded with — a zero-drift swap, tweakable in one place.+ * Light-only surface by design. */+@theme {+ --color-ed-ink: #262323;+ --color-ed-ink-78: rgba(38, 35, 35, 0.78);+ --color-ed-ink-66: rgba(38, 35, 35, 0.66);+ --color-ed-ink-60: rgba(38, 35, 35, 0.6);+ --color-ed-ink-45: rgba(38, 35, 35, 0.45);+ --color-ed-hairline: #e7e7e3;+ --color-ed-paper: #fbfbf8;+ --color-ed-svg-line: #d8d7d2;+ --color-ed-brand: #00b0ff;+ --color-ed-brand-ink: #1e84b0;+ --color-ed-accent-fill: #eaf8ff;+ --color-ed-amber-fill: #fff2d8;+ --color-ed-amber-stroke: #e6cfa3;+ --color-ed-amber-text: #9c7136;+ --color-ed-header: #f1f1ec; /* table header strip */+ --color-ed-inset: #f6f6f1; /* expanded row panel */+ --color-ed-row-hover: rgba(38, 35, 35, 0.025); /* row hover */+}+/* Map Fumadocs' own theme variables onto Carbon tokens — one palette everywhere */:root,.dark {@@ -184,6 +210,21 @@table {font-variant-numeric: tabular-nums;}++ /* Site-wide focus ring. Single brand-accent style on every focusable element,+ * shown only for keyboard navigation (:focus-visible) — never on mouse/touch+ * click. `outline` (not box-shadow) follows each element's own shape and can't+ * be clipped by overflow. Components with their own focus-visible ring still+ * win via specificity; this is the consistent default for everything else. */+ :focus-visible {+ outline: 2px solid hsl(var(--brand));+ outline-offset: 2px;+ }+ /* Belt-and-suspenders: suppress the UA outline on pointer focus, including any+ * third-party rule that targets plain :focus. */+ :focus:not(:focus-visible) {+ outline: none;+ }}/* Honor reduced-motion globally: near-instant transitions/animations everywhere,diff --git a/docs/components/editorial/field-table.tsx b/docs/components/editorial/field-table.tsxnew file mode 100644index 0000000000..8282bfa639--- /dev/null+++ b/docs/components/editorial/field-table.tsx@@ -0,0 +1,120 @@+"use client";++/* Accordion field reference — the warm-paper take on Fumadocs' TypeTable. A bordered+ * panel with a header row (Field · Type) and dense, divided rows; clicking a row expands+ * its description into an inset panel. Replaces a plain `| Field | Type | Description |`+ * markdown table.+ *+ * Why children, not a `type={{}}` object prop: descriptions are authored as MDX, so+ * <Term>, inline `code`, and *italics* render. A data prop would force authors to inline+ * JSX and lose that. The accordion mechanism is the in-house one from `api/faq.tsx`+ * (button + CSS-grid rows reveal) so the description stays in the DOM when collapsed (good+ * for Cmd-F and the search index). The description container is a <div> with `[&>p]:m-0`:+ * MDX wraps the text child in a <p>, so a <p> here would nest <p><p> → hydration error.+ * Colors come from the editorial @theme tokens (text-ed-ink, bg-ed-paper, …). */++import {+ Children,+ cloneElement,+ isValidElement,+ type ReactElement,+ type ReactNode,+ useId,+ useState,+} from "react";++type FieldProps = {+ name: string;+ type?: string;+ required?: boolean;+ defaultOpen?: boolean;+ children?: ReactNode;+};++export function FieldTable({+ children,+ defaultOpen = false,+}: {+ children?: ReactNode;+ defaultOpen?: boolean;+}) {+ const rows = Children.toArray(children).filter((c): c is ReactElement<FieldProps> =>+ isValidElement(c),+ );+ return (+ <div className="my-[24px] overflow-hidden rounded-[12px] border border-ed-hairline bg-ed-paper">+ <div className="flex items-center gap-[12px] border-b border-ed-hairline bg-ed-header px-[16px] py-[9px] font-[family-name:var(--font-mono)] text-[10.5px] font-[600] uppercase tracking-[0.07em] text-ed-ink-45">+ <span>Field</span>+ <span className="ml-auto">Type</span>+ <span className="w-[14px]" />+ </div>+ <div className="divide-y divide-ed-hairline">+ {rows.map((row, i) =>+ cloneElement(row, {+ key: row.key ?? i,+ defaultOpen: row.props.defaultOpen ?? defaultOpen,+ }),+ )}+ </div>+ </div>+ );+}++export function Field({ name, type, required, defaultOpen = false, children }: FieldProps) {+ const [open, setOpen] = useState(defaultOpen);+ const panelId = `field-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;+ const hasBody = children != null && children !== false;++ return (+ <div>+ <button+ type="button"+ aria-expanded={open}+ aria-controls={hasBody ? panelId : undefined}+ onClick={() => hasBody && setOpen((o) => !o)}+ className={`flex w-full items-center gap-[12px] px-[16px] py-[11px] text-left hover:bg-ed-row-hover ${+ hasBody ? "cursor-pointer" : "cursor-default"+ }`}+ >+ <span className="text-[14px] font-[550] tracking-[0.1px] text-ed-ink">{name}</span>+ {required && (+ <span className="inline-flex items-center rounded-[5px] border border-ed-amber-stroke bg-ed-amber-fill px-[6px] py-[1px] text-[10px] font-medium tracking-[0.02em] text-ed-amber-text">+ required+ </span>+ )}+ <span className="ml-auto font-[family-name:var(--font-mono)] text-[12.5px] text-ed-ink-45 whitespace-nowrap">+ {type}+ </span>+ {hasBody ? (+ <span+ aria-hidden="true"+ className={`w-[14px] text-center text-[18px] leading-none text-ed-brand-ink transition-transform duration-200 motion-reduce:transition-none ${+ open ? "rotate-45" : ""+ }`}+ >+ ++ </span>+ ) : (+ <span className="w-[14px]" />+ )}+ </button>+ {hasBody && (+ <div+ className={`grid overflow-hidden transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${+ open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"+ }`}+ >+ <div className="min-h-0 overflow-hidden">+ <div+ id={panelId}+ role="region"+ className="border-t border-ed-hairline bg-ed-inset px-[16px] py-[12px] text-[13.5px] leading-[160%] text-ed-ink-66 [&>p]:m-0 [&>p]:text-[13.5px] [&>p]:leading-[160%] [&>p]:text-ed-ink-66 [&>p+p]:mt-[8px]"+ >+ {children}+ </div>+ </div>+ </div>+ )}+ </div>+ );+}diff --git a/docs/components/editorial/illustration-kit.tsx b/docs/components/editorial/illustration-kit.tsxnew file mode 100644index 0000000000..8dcb830649--- /dev/null+++ b/docs/components/editorial/illustration-kit.tsx@@ -0,0 +1,95 @@+/* Shared primitives for the on-brand editorial SVGs — warm paper palette, DM Sans+ * (inherited), #00B0FF accent, made=blue / bought=amber tags matching the content+ * badges. Both the static `illustrations.tsx` registry and the data-driven+ * `status-flow.tsx` import from here so every diagram stays visually locked.+ * Colors are kept as constants in SVG attributes (not Tailwind classes) to match the+ * surrounding illustration code and keep the geometry/paint in one place. */++export const INK = "#262323";+export const INK_60 = "rgba(38,35,35,0.6)";+export const INK_45 = "rgba(38,35,35,0.45)";+export const LINE = "#D8D7D2";+export const BRAND = "#00B0FF";+export const BRAND_INK = "#1E84B0";++export const TAG = {+ made: { fill: "#DFF5FF", stroke: "#A9DAF3", text: "#3583A8" },+ bought: { fill: "#FFF2D8", stroke: "#E6CFA3", text: "#9C7136" },+ neutral: { fill: "#EFEFEB", stroke: "#DADAD5", text: "rgba(38,35,35,0.55)" },+};++export function Box({+ x,+ y,+ w,+ h,+ label,+ sub,+ accent,+}: {+ x: number;+ y: number;+ w: number;+ h: number;+ label: string;+ sub?: string;+ accent?: boolean;+}) {+ return (+ <g>+ <rect+ x={x}+ y={y}+ width={w}+ height={h}+ rx={10}+ fill={accent ? "#EAF8FF" : "#FBFBF8"}+ stroke={accent ? BRAND : LINE}+ strokeWidth={1.4}+ />+ <text+ x={x + w / 2}+ y={sub ? y + h / 2 - 4 : y + h / 2 + 5}+ textAnchor="middle"+ fontSize="14"+ fontWeight={530}+ fill={accent ? BRAND_INK : INK}+ >+ {label}+ </text>+ {sub && (+ <text x={x + w / 2} y={y + h / 2 + 14} textAnchor="middle" fontSize="11.5" fill={INK_45}>+ {sub}+ </text>+ )}+ </g>+ );+}++export function Arrow({ x1, y1, x2, y2 }: { x1: number; y1: number; x2: number; y2: number }) {+ const ang = Math.atan2(y2 - y1, x2 - x1);+ const ah = 5;+ return (+ <g stroke={INK_45} strokeWidth={1.4} fill="none">+ <line x1={x1} y1={y1} x2={x2} y2={y2} />+ <path+ d={`M ${x2 - ah * Math.cos(ang - 0.5)} ${y2 - ah * Math.sin(ang - 0.5)} L ${x2} ${y2} L ${x2 - ah * Math.cos(ang + 0.5)} ${y2 - ah * Math.sin(ang + 0.5)}`}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </g>+ );+}++export function Tag({ x, y, kind, label }: { x: number; y: number; kind: keyof typeof TAG; label: string }) {+ const t = TAG[kind];+ const w = label.length * 6.4 + 16;+ return (+ <g>+ <rect x={x} y={y} width={w} height={18} rx={9} fill={t.fill} stroke={t.stroke} strokeWidth={1} />+ <text x={x + w / 2} y={y + 12.5} textAnchor="middle" fontSize="10" fontWeight={500} fill={t.text}>+ {label}+ </text>+ </g>+ );+}diff --git a/docs/components/editorial/illustrations.tsx b/docs/components/editorial/illustrations.tsxindex 30ba0c748e..26991ee2ed 100644--- a/docs/components/editorial/illustrations.tsx+++ b/docs/components/editorial/illustrations.tsx@@ -1,3 +1,5 @@+import { Arrow, Box, BRAND, BRAND_INK, INK, INK_45, INK_60, LINE, Tag, TAG } from "./illustration-kit";+export type IllustrationKey =| "flow-overview"| "order-split"@@ -27,96 +29,9 @@ export type IllustrationKey =/* On-brand editorial illustrations — warm paper palette, DM Sans (inherited),* #00B0FF accent, made=blue / bought=amber tags matching the content badges.- * Each is a responsive SVG (w-full h-auto) sized for the 620px reading column. */--const INK = "#262323";-const INK_60 = "rgba(38,35,35,0.6)";-const INK_45 = "rgba(38,35,35,0.45)";-const LINE = "#D8D7D2";-const BRAND = "#00B0FF";-const BRAND_INK = "#1E84B0";--const TAG = {- made: { fill: "#DFF5FF", stroke: "#A9DAF3", text: "#3583A8" },- bought: { fill: "#FFF2D8", stroke: "#E6CFA3", text: "#9C7136" },- neutral: { fill: "#EFEFEB", stroke: "#DADAD5", text: "rgba(38,35,35,0.55)" },-};--function Box({- x,- y,- w,- h,- label,- sub,- accent,-}: {- x: number;- y: number;- w: number;- h: number;- label: string;- sub?: string;- accent?: boolean;-}) {- return (- <g>- <rect- x={x}- y={y}- width={w}- height={h}- rx={10}- fill={accent ? "#EAF8FF" : "#FBFBF8"}- stroke={accent ? BRAND : LINE}- strokeWidth={1.4}- />- <text- x={x + w / 2}- y={sub ? y + h / 2 - 4 : y + h / 2 + 5}- textAnchor="middle"- fontSize="14"- fontWeight={530}- fill={accent ? BRAND_INK : INK}- >- {label}- </text>- {sub && (- <text x={x + w / 2} y={y + h / 2 + 14} textAnchor="middle" fontSize="11.5" fill={INK_45}>- {sub}- </text>- )}- </g>- );-}--function Arrow({ x1, y1, x2, y2 }: { x1: number; y1: number; x2: number; y2: number }) {- const ang = Math.atan2(y2 - y1, x2 - x1);- const ah = 5;- return (- <g stroke={INK_45} strokeWidth={1.4} fill="none">- <line x1={x1} y1={y1} x2={x2} y2={y2} />- <path- d={`M ${x2 - ah * Math.cos(ang - 0.5)} ${y2 - ah * Math.sin(ang - 0.5)} L ${x2} ${y2} L ${x2 - ah * Math.cos(ang + 0.5)} ${y2 - ah * Math.sin(ang + 0.5)}`}- strokeLinecap="round"- strokeLinejoin="round"- />- </g>- );-}--function Tag({ x, y, kind, label }: { x: number; y: number; kind: keyof typeof TAG; label: string }) {- const t = TAG[kind];- const w = label.length * 6.4 + 16;- return (- <g>- <rect x={x} y={y} width={w} height={18} rx={9} fill={t.fill} stroke={t.stroke} strokeWidth={1} />- <text x={x + w / 2} y={y + 12.5} textAnchor="middle" fontSize="10" fontWeight={500} fill={t.text}>- {label}- </text>- </g>- );-}+ * Each is a responsive SVG (w-full h-auto) sized for the 620px reading column.+ * Box / Arrow / Tag and the palette constants live in `illustration-kit.tsx`,+ * shared with the data-driven `status-flow.tsx`. */function FlowOverview() {const steps = ["Order", "Build", "Plan", "Floor", "Quality", "Ship"];diff --git a/docs/components/editorial/mdx.tsx b/docs/components/editorial/mdx.tsxindex 562a117ca6..20739964a5 100644--- a/docs/components/editorial/mdx.tsx+++ b/docs/components/editorial/mdx.tsx@@ -1,5 +1,7 @@import type { ComponentPropsWithoutRef, ReactNode } from "react";+import { Field, FieldTable } from "./field-table";import { type IllustrationKey, illustrations } from "./illustrations";+import { Status, StatusFlow } from "./status-flow";import { Term } from "./term";import { Zoomable } from "./zoomable";@@ -238,4 +240,8 @@ export const editorialMdxComponents = {Callout,Divider,Term,+ FieldTable,+ Field,+ StatusFlow,+ Status,};diff --git a/docs/components/editorial/status-flow.tsx b/docs/components/editorial/status-flow.tsxnew file mode 100644index 0000000000..0ec532d277--- /dev/null+++ b/docs/components/editorial/status-flow.tsx@@ -0,0 +1,253 @@+"use client";++/* Status lifecycle as one interactive widget — the warm-paper replacement for a linear+ * `| Status | Meaning |` table. A single bordered card: the happy-path states as selectable+ * badges joined by arrows, off-track states (branch like Paused, terminal like Cancelled) on a+ * second row, and an integrated detail footer showing the selected state's meaning. Selecting a+ * badge (click, or arrow keys within the group) updates the footer.+ *+ * The badges are styled to MATCH the real Carbon `<Status>` badge (@carbon/react) — light colored+ * fill, dark same-hue text, uppercase, with the same lucide status icon per color — so a reader+ * builds the same visual memory as the app. The color for each status is the real ERP color,+ * resolved from `@carbon/utils/status-colors` via the `entity` prop, so the docs can't drift. The+ * badge classes are duplicated here (not imported as strings) so the docs' Tailwind scanner emits+ * them. Meanings are authored MDX (so <Term>/`code`/*italics* render); the footer uses `[&>p]:m-0`+ * because MDX wraps the text child in a <p>. */++import {+ STATUS_COLOR_HEX,+ statusColor,+ type StatusColor,+ type StatusEntity,+} from "@carbon/utils/status-colors";+import {+ Children,+ type ComponentType,+ Fragment,+ isValidElement,+ type KeyboardEvent,+ type ReactElement,+ type ReactNode,+ useRef,+ useState,+} from "react";++type StatusProps = {+ name: string;+ accent?: boolean;+ branch?: boolean;+ terminal?: boolean;+ children?: ReactNode;+};++/* Pure data carrier — StatusFlow reads its props; it renders nothing itself. */+export function Status(_props: StatusProps): null {+ return null;+}++type Item = StatusProps & { idx: number };++/* Inline lucide-style status icons (same glyphs as the app's @carbon/react Status) — drawn here+ * so the docs don't take a lucide-react dependency. 24-box, currentColor stroke. */+type IconProps = { className?: string };+function CircleCheck({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="10" />+ <path d="m9 12 2 2 4-4" />+ </svg>+ );+}+function CircleAlert({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="10" />+ <path d="M12 8v4" />+ <path d="M12 16h.01" />+ </svg>+ );+}+function CircleSlash({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="10" />+ <path d="M9 15 15 9" />+ </svg>+ );+}+function Clock({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="10" />+ <path d="M12 6v6l4 2" />+ </svg>+ );+}+function LoaderCircle({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />+ </svg>+ );+}+function CircleDashed({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" strokeDasharray="2.7 3.2" aria-hidden="true">+ <circle cx="12" cy="12" r="10" />+ </svg>+ );+}+function Star({ className }: IconProps) {+ return (+ <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">+ <path d="M12 2.5l2.7 5.92 6.3.5-4.8 4.06 1.5 6.02L12 16.9l-5.7 3.1 1.5-6.02-4.8-4.06 6.3-.5z" />+ </svg>+ );+}++/* Mirror of the @carbon/react Status/Badge variants (light mode) — fill + text + border + icon+ * per semantic color. Kept in this file so Tailwind sees the class names. */+const BADGE: Record<StatusColor, { cls: string; Icon: ComponentType<{ className?: string }> }> = {+ green: { cls: "bg-emerald-100 text-emerald-800 border-emerald-500/20", Icon: CircleCheck },+ yellow: { cls: "bg-yellow-100 text-yellow-800 border-yellow-500/20", Icon: Clock },+ orange: { cls: "bg-orange-100 text-orange-800 border-orange-500/20", Icon: CircleAlert },+ red: { cls: "bg-red-100 text-red-800 border-red-500/20", Icon: CircleSlash },+ blue: { cls: "bg-blue-100 text-blue-800 border-blue-500/20", Icon: LoaderCircle },+ gray: { cls: "bg-[#e3e2e080] text-[#32302c] border-transparent", Icon: CircleDashed },+ purple: { cls: "bg-violet-100 text-violet-800 border-violet-500/20", Icon: Star },+};++const BADGE_BASE =+ "inline-flex items-center gap-[5px] rounded-md border px-2 py-[4px] text-[11px] font-bold uppercase tracking-tight leading-none whitespace-nowrap";++export function StatusFlow({+ children,+ label,+ entity,+}: {+ children?: ReactNode;+ label?: string;+ /** ERP entity id — resolves each status's real UI color (matching the app badge) from @carbon/utils. */+ entity?: StatusEntity;+}) {+ const items: Item[] = Children.toArray(children)+ .filter((c): c is ReactElement<StatusProps> => isValidElement(c))+ .map((c, idx) => ({ idx, ...c.props }));++ const mainItems = items.filter((s) => !s.branch && !s.terminal);+ const offItems = items.filter((s) => s.branch || s.terminal);++ const accentIdx = items.findIndex((s) => s.accent);+ const [sel, setSel] = useState(accentIdx >= 0 ? accentIdx : 0);+ const selected = items[sel] ?? items[0];++ const colorOf = (s: StatusProps): StatusColor =>+ (entity ? statusColor(entity, s.name) : undefined) ?? "gray";++ const refs = useRef<(HTMLButtonElement | null)[]>([]);+ const move = (dir: 1 | -1) => {+ const next = Math.min(items.length - 1, Math.max(0, sel + dir));+ setSel(next);+ refs.current[next]?.focus();+ };+ const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {+ if (e.key === "ArrowRight" || e.key === "ArrowDown") {+ e.preventDefault();+ move(1);+ } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {+ e.preventDefault();+ move(-1);+ } else if (e.key === "Home") {+ e.preventDefault();+ setSel(0);+ refs.current[0]?.focus();+ } else if (e.key === "End") {+ e.preventDefault();+ setSel(items.length - 1);+ refs.current[items.length - 1]?.focus();+ }+ };++ const ariaLabel =+ label ??+ `Status lifecycle: ${mainItems.map((s) => s.name).join(" → ")}` ++ (offItems.length ? `; off-track states: ${offItems.map((s) => s.name).join(", ")}` : "");++ const pill = (s: Item) => {+ const color = colorOf(s);+ const { cls, Icon } = BADGE[color];+ const isSel = sel === s.idx;+ return (+ <button+ key={s.idx}+ type="button"+ ref={(el) => {+ refs.current[s.idx] = el;+ }}+ aria-pressed={isSel}+ tabIndex={isSel ? 0 : -1}+ onClick={() => setSel(s.idx)}+ className={`${BADGE_BASE} ${cls} cursor-pointer focus-visible:outline-none`}+ // Selection = a ring in the status's real color (paper gap then color), tying it to the app.+ style={+ isSel+ ? { boxShadow: `0 0 0 2px var(--color-ed-paper), 0 0 0 3.5px ${STATUS_COLOR_HEX[color]}` }+ : undefined+ }+ >+ <Icon className="h-[12px] w-[12px] shrink-0" />+ {s.name}+ </button>+ );+ };++ if (!selected) return null;++ const selColor = colorOf(selected);+ const SelIcon = BADGE[selColor].Icon;++ return (+ <figure className="my-[36px] overflow-hidden rounded-[14px] border border-ed-hairline bg-ed-paper">+ <div+ role="group"+ aria-label={ariaLabel}+ onKeyDown={onKeyDown}+ className="flex flex-col gap-[12px] px-[18px] pt-[18px] pb-[16px]"+ >+ <div className="flex flex-wrap items-center gap-x-[4px] gap-y-[10px]">+ {mainItems.map((s, j) => (+ <Fragment key={s.idx}>+ {j > 0 && (+ <span aria-hidden="true" className="px-[2px] text-[14px] leading-none text-ed-ink-45">+ →+ </span>+ )}+ {pill(s)}+ </Fragment>+ ))}+ </div>+ {offItems.length > 0 && (+ <div className="flex flex-wrap items-center gap-[8px]">+ <span className="font-[family-name:var(--font-mono)] text-[9.5px] font-[600] uppercase tracking-[0.08em] text-ed-ink-45">+ Off-track+ </span>+ {offItems.map((s) => pill(s))}+ </div>+ )}+ </div>++ {/* Integrated detail footer — one card, not a separate callout */}+ <div aria-live="polite" className="border-t border-ed-hairline bg-ed-inset px-[18px] py-[15px]">+ <div key={sel} className="animate-in fade-in-0 duration-200 motion-reduce:animate-none">+ <span className={`${BADGE_BASE} ${BADGE[selColor].cls}`}>+ <SelIcon className="h-[12px] w-[12px] shrink-0" />+ {selected.name}+ </span>+ <div className="mt-[10px] text-[13.5px] leading-[1.6] text-ed-ink-66 [&>p]:m-0 [&>p]:text-[13.5px] [&>p]:leading-[1.6]">+ {selected.children}+ </div>+ </div>+ </div>+ </figure>+ );+}diff --git a/docs/components/mdx.tsx b/docs/components/mdx.tsxindex d76ab5c551..338cc4f036 100644--- a/docs/components/mdx.tsx+++ b/docs/components/mdx.tsx@@ -1,13 +1,20 @@+import { CodeBlock, Pre } from "fumadocs-ui/components/codeblock";import { Step, Steps } from "fumadocs-ui/components/steps";import { Tab, Tabs } from "fumadocs-ui/components/tabs";import defaultMdxComponents from "fumadocs-ui/mdx";import type { MDXComponents } from "mdx/types";import type { ComponentProps } from "react";-import { MdxCodeBlock } from "@/components/api/mdx-code-block";import { Checklist, Check } from "@/components/checklist";+import { Field, FieldTable } from "@/components/editorial/field-table";+import { Glossary } from "@/components/editorial/glossary";+// Figure/Screenshot + the shared Zoomable island so the Reference gets the same+// click-to-enlarge visuals as the Guide (one component, both surfaces).+import { Figure, Screenshot } from "@/components/editorial/mdx";// Editorial Callout/Card so the Reference matches the Guide (not Fumadocs defaults).import { Callout, Card, Cards, EnvVar, EnvVars, PlanBadge } from "@/components/editorial/reference-components";+import { StatusFlow, Status } from "@/components/editorial/status-flow";import { Term } from "@/components/editorial/term";+import { Zoomable } from "@/components/editorial/zoomable";import { FeatureCallout } from "@/components/feature-callout";import { Frame } from "@/components/frame";import { Eyebrow } from "@/components/prose";@@ -16,10 +23,18 @@ import { ScrollReveal } from "@/components/scroll-reveal";export function getMDXComponents(components?: MDXComponents) {return {...defaultMdxComponents,- // Fenced code → our dark API-playground panel (not Fumadocs' default block).- pre: ({ title, children }: ComponentProps<"pre">) => (- <MdxCodeBlock title={typeof title === "string" ? title : undefined}>{children}</MdxCodeBlock>- ),+ // Fenced code → Fumadocs' CodeBlock (language icon + label, copy button). The+ // `data-language` is stamped on by a Shiki transformer (source.config.ts) and shown+ // as the header title; `.ed-codeblock` restyles the chrome to the warm-paper dark+ // panel in reference.css.+ pre: ({ ref: _ref, className, title, ...props }: ComponentProps<"pre">) => {+ const lang = (props as Record<string, unknown>)["data-language"] as string | undefined;+ return (+ <CodeBlock {...props} title={title ?? lang} className={`ed-codeblock ${className ?? ""}`}>+ <Pre>{props.children}</Pre>+ </CodeBlock>+ );+ },// Reference tables can be wide (many columns). On a phone the prose column is// ~330px, so wrap every table in a horizontal scroller — it keeps the rounded// frame and lets the table scroll instead of forcing the page to.@@ -30,11 +45,24 @@ export function getMDXComponents(components?: MDXComponents) {</table></div>),+ // Markdown images zoom too, via the same shared lightbox the Guide figures use.+ img: ({ alt, ...props }: ComponentProps<"img">) => (+ <Zoomable>+ <img {...props} alt={alt ?? ""} className="block w-full rounded-[12px] border border-ed-hairline" />+ </Zoomable>+ ),Card,Cards,Callout,EnvVar,EnvVars,+ FieldTable,+ Field,+ Glossary,+ StatusFlow,+ Status,+ Figure,+ Screenshot,PlanBadge,Term,Step,diff --git a/docs/content/docs/integrations/accounting.mdx b/docs/content/docs/integrations/accounting.mdxindex 29de98f017..ba185e887d 100644--- a/docs/content/docs/integrations/accounting.mdx+++ b/docs/content/docs/integrations/accounting.mdx@@ -14,14 +14,29 @@ keeps multi-currency math honest. Exchange Rates is available on every plan; XerConnect over **OAuth**, then choose what Carbon and Xero share. Once connected, Carbon posts **sales andpurchase invoices** to Xero and keeps the two ledgers aligned.-| Setting | What it controls |-| --- | --- |-| Backfill | Whether to seed Xero with your existing **customers**, **vendors**, and **items** on first connect. |-| Source of truth | Per entity (customer, vendor, item, invoice, bill) — whether **Carbon** or the **accounting system** wins on conflict. |-| Account mapping | The default **sales** and **purchase** account codes, picked from your Xero chart of accounts. |--A **Run Initial Sync** action kicks off the first backfill on demand. After that, changes flow continuously,-matched to the same Xero record each time so a Carbon customer or invoice never duplicates.+<Steps>+ <Step>+ ### Connect over OAuth++ No keys to paste — authorizing stores the connection.+ </Step>+ <Step>+ ### Choose what's shared++ Set backfill, the per-entity source of truth, and the default account mapping (below).+ </Step>+ <Step>+ ### Run the initial sync++ A **Run Initial Sync** action kicks off the first backfill on demand. After that, changes flow continuously, matched to the same Xero record each time so a Carbon customer or invoice never duplicates.+ </Step>+</Steps>++<FieldTable>+ <Field name="Backfill">Whether to seed Xero with your existing **customers**, **vendors**, and **items** on first connect.</Field>+ <Field name="Source of truth">Per entity (customer, vendor, item, invoice, bill) — whether **Carbon** or the **accounting system** wins on conflict.</Field>+ <Field name="Account mapping">The default **sales** and **purchase** account codes, picked from your Xero chart of accounts.</Field>+</FieldTable><Callout type="warn">Xero only appears when its OAuth client is configured server-side (`XERO_CLIENT_ID`). Without it thediff --git a/docs/content/docs/integrations/assistant.mdx b/docs/content/docs/integrations/assistant.mdxindex f765b04099..7dc94c6290 100644--- a/docs/content/docs/integrations/assistant.mdx+++ b/docs/content/docs/integrations/assistant.mdx@@ -7,8 +7,20 @@ description: Bring the Carbon Assistant into Slack, with nonconformance notifica## SlackConnect **Slack** over **OAuth** to put the **Carbon Assistant** in your workspace and receive-**<Term id="nonconformance">nonconformance</Term> notifications** where your team already talks. Authorizing opens a Slack install popup;-there are no fields to fill in.+**<Term id="nonconformance">nonconformance</Term> notifications** where your team already talks — there are no fields to fill in.++<Steps>+ <Step>+ ### Start the Slack install++ Authorizing opens a Slack install popup.+ </Step>+ <Step>+ ### Choose your workspace++ Pick the workspace to install into and approve the install. Carbon stores the connection — no keys to paste.+ </Step>+</Steps>| Setting | What it controls || --- | --- |diff --git a/docs/content/docs/integrations/cad.mdx b/docs/content/docs/integrations/cad.mdxindex e52367de3c..c4aefafcbc 100644--- a/docs/content/docs/integrations/cad.mdx+++ b/docs/content/docs/integrations/cad.mdx@@ -6,8 +6,25 @@ description: Sync CAD data from Onshape into Carbon.## Onshape-Connect to **Onshape** over **OAuth** to bring CAD data into Carbon. Authorizing opens an Onshape popup;-once you approve read access, Carbon stores the connection and can pull from your Onshape documents.+Connect to **Onshape** over **OAuth** to bring CAD data into Carbon — no keys to paste.++<Steps>+ <Step>+ ### Authorize over OAuth++ Start the connection and Carbon opens an Onshape popup.+ </Step>+ <Step>+ ### Approve read access++ Approve read access to your Onshape documents in the popup.+ </Step>+ <Step>+ ### Tokens stored++ Carbon stores the connection — the access and refresh tokens — and can then pull from your Onshape documents.+ </Step>+</Steps>| Setting | What it controls || --- | --- |diff --git a/docs/content/docs/integrations/email.mdx b/docs/content/docs/integrations/email.mdxindex 19475dfca9..0d9df57a81 100644--- a/docs/content/docs/integrations/email.mdx+++ b/docs/content/docs/integrations/email.mdx@@ -8,14 +8,27 @@ description: Send outbound email through Carbon-managed Resend or your own SMTPEmail is how Carbon sends transactional mail — order confirmations, notifications, and the like. It'savailable on **every plan**, and you choose who actually delivers the mail.-| Setting | What it controls |-| --- | --- |-| Provider | **Resend** (Carbon-managed) or **SMTP** (your own server). |-| From address | The address outbound mail is sent from. |-| API key | *(Resend)* Your Resend API key. |-| Host / Port | *(SMTP)* Your mail server and port (default `587`). |-| Username / Password | *(SMTP)* Credentials for the SMTP server. |-| Secure | *(SMTP)* Whether to connect over TLS. |+<Steps>+ <Step>+ ### Choose a provider++ Pick **Resend** (Carbon-managed) or **SMTP** (your own server). The fields below change to match your choice.+ </Step>+ <Step>+ ### Fill in the provider fields++ For **Resend**, enter your API key. For **SMTP**, enter the host and port (default `587`), username and password, and whether to connect over TLS. Set the **from address** either way.+ </Step>+</Steps>++<FieldTable>+ <Field name="Provider">**Resend** (Carbon-managed) or **SMTP** (your own server).</Field>+ <Field name="From address">The address outbound mail is sent from.</Field>+ <Field name="API key">*(Resend)* Your Resend API key.</Field>+ <Field name="Host / Port">*(SMTP)* Your mail server and port (default `587`).</Field>+ <Field name="Username / Password">*(SMTP)* Credentials for the SMTP server.</Field>+ <Field name="Secure">*(SMTP)* Whether to connect over TLS.</Field>+</FieldTable><Callout type="note">The Resend and SMTP fields are shown only for the provider you pick — choose **SMTP** to route mail throughdiff --git a/docs/content/docs/integrations/estimating.mdx b/docs/content/docs/integrations/estimating.mdxindex 0b6b5ba089..d0a261d61e 100644--- a/docs/content/docs/integrations/estimating.mdx+++ b/docs/content/docs/integrations/estimating.mdx@@ -7,16 +7,33 @@ description: Pull quotes and bills of material from Paperless Parts into Carbon.## Paperless PartsConnect with an **API key** plus a **webhook signing secret** (Paperless calls Carbon when something-changes, and the secret verifies those calls). On connect you also set the defaults Carbon applies to items-it imports.--| Setting | What it controls |-| --- | --- |-| API key | Authenticates Carbon to Paperless Parts. |-| Webhook signing secret | Verifies inbound webhooks from Paperless Parts. |-| Method type | Default for imported items — **Purchase to Order** or **Pull from Inventory**. |-| Tracking type | Default for imported items — **Inventory**, **Non-Inventory**, or **Batch**. |-| Use Paperless order number | Whether to carry the Paperless order number onto the Carbon document. |+changes, and the secret verifies those calls).++<Steps>+ <Step>+ ### Add your API key++ Provide your Paperless Parts **API key** to authenticate Carbon.+ </Step>+ <Step>+ ### Set the webhook signing secret++ Add the **webhook signing secret** — Paperless calls Carbon when something changes, and the secret verifies those calls.+ </Step>+ <Step>+ ### Set import defaults++ On connect you also set the defaults Carbon applies to items it imports — **method type**, **tracking type**, and whether to use the Paperless order number (below).+ </Step>+</Steps>++<FieldTable>+ <Field name="API key">Authenticates Carbon to Paperless Parts.</Field>+ <Field name="Webhook signing secret">Verifies inbound webhooks from Paperless Parts.</Field>+ <Field name="Method type">Default for imported items — **Purchase to Order** or **Pull from Inventory**.</Field>+ <Field name="Tracking type">Default for imported items — **Inventory**, **Non-Inventory**, or **Batch**.</Field>+ <Field name="Use Paperless order number">Whether to carry the Paperless order number onto the Carbon document.</Field>+</FieldTable>Imported <Term id="quote">quotes</Term> and <Term id="bom">BOMs</Term> land as Carbon records, ready to turn into <Term id="sales-order">sales orders</Term> and <Term id="job">jobs</Term>.diff --git a/docs/content/docs/integrations/project-management.mdx b/docs/content/docs/integrations/project-management.mdxindex 3c5dd562e0..06f0c804d0 100644--- a/docs/content/docs/integrations/project-management.mdx+++ b/docs/content/docs/integrations/project-management.mdx@@ -9,8 +9,20 @@ already lives in. Both connectors are aimed at **quality (<Term id="nonconforman## Linear-Authenticate with a **Linear API key** (it begins with `lin_api`). Once connected, Carbon syncs issues to-Linear, keeping each Carbon issue matched to the same Linear issue.+Authenticate with a **Linear API key** (it begins with `lin_api`).++<Steps>+ <Step>+ ### Paste your Linear API key++ Provide your Linear API key — Carbon checks the `lin_api` prefix.+ </Step>+ <Step>+ ### Issues sync++ Once connected, Carbon syncs issues to Linear, keeping each Carbon issue matched to the same Linear issue.+ </Step>+</Steps>| Setting | What it controls || --- | --- |@@ -18,8 +30,20 @@ Linear, keeping each Carbon issue matched to the same Linear issue.## Jira-Connect over **OAuth** — there are no fields to fill in beyond authorizing Carbon. Once connected, you can-link a quality issue to a Jira issue.+Connect over **OAuth** — there are no fields to fill in beyond authorizing Carbon.++<Steps>+ <Step>+ ### Authorize over OAuth++ Authorize Carbon in Jira — there are no fields to fill in.+ </Step>+ <Step>+ ### Link a quality issue++ Once connected, you can link a quality issue to a Jira issue.+ </Step>+</Steps><Callout type="warn">Jira only appears when its OAuth client is configured server-side (`JIRA_CLIENT_ID`) — seediff --git a/docs/content/docs/platform/local-development.mdx b/docs/content/docs/platform/local-development.mdxindex dc027dd192..412f549b30 100644--- a/docs/content/docs/platform/local-development.mdx+++ b/docs/content/docs/platform/local-development.mdx@@ -7,21 +7,33 @@ Carbon is a **pnpm + Turborepo** monorepo — the ERP and MES apps plus their sh## Setup-Add `crbn` to your `PATH` (it installs a small shell wrapper):+<Steps>+ <Step>+ ### Add `crbn` to your `PATH`-```bash-source ./setup.sh-```+ Source the setup script — it installs a small shell wrapper:-## Bring up the stack+ ```bash+ source ./setup.sh+ ```+ </Step>+ <Step>+ ### Bring up the stack-From any worktree:+ From any worktree, boot the compose stack and the ERP and MES dev servers:-```bash-crbn up-```+ ```bash+ crbn up+ ```-This boots the compose stack and the ERP and MES dev servers, and generates a `.env.local` with per-worktree ports, local Supabase keys, `REDIS_URL`, Inngest dev settings, and `DEV_BYPASS_EMAIL` so you can sign in without a magic link. Reach the apps at their portless `.dev` URLs or at `localhost:<port>`.+ This generates a `.env.local` with per-worktree ports, local Supabase keys, `REDIS_URL`, Inngest dev settings, and `DEV_BYPASS_EMAIL` so you can sign in without a magic link.+ </Step>+ <Step>+ ### Reach the apps++ Open the apps at their portless `.dev` URLs or at `localhost:<port>`.+ </Step>+</Steps><Callout type="warn">`DEV_BYPASS_EMAIL` is local-only — it signs you in as that email with no magic link. Never set it in a deployed environment.diff --git a/docs/content/docs/reference/approvals.mdx b/docs/content/docs/reference/approvals.mdxindex bbe5364ebb..1574b4f89b 100644--- a/docs/content/docs/reference/approvals.mdx+++ b/docs/content/docs/reference/approvals.mdx@@ -31,12 +31,12 @@ minimum is 0), so for them approval is simply on or off.Rules live under **Settings → Approval Rules**, grouped by document type. Each rule:-| Field | Description |-| --- | --- |-| Minimum amount | The tier floor — approval applies at or above this, up to the next rule's minimum. (Purchase orders only.) |-| Who can approve | Groups **and/or** individual users eligible to decide. |-| Default approver | A named fallback approver for the tier. |-| Enabled | Whether the rule is live. |+<FieldTable>+ <Field name="Minimum amount">The tier floor — approval applies at or above this, up to the next rule's minimum. (Purchase orders only.)</Field>+ <Field name="Who can approve">Groups **and/or** individual users eligible to decide.</Field>+ <Field name="Default approver">A named fallback approver for the tier.</Field>+ <Field name="Enabled">Whether the rule is live.</Field>+</FieldTable>For purchase orders, several rules form **amount tiers** — each band runs from its minimum up to the nextrule's minimum, and the top tier is "over $X". An order matches the single highest tier its total clears.diff --git a/docs/content/docs/reference/fixed-assets.mdx b/docs/content/docs/reference/fixed-assets.mdxindex 3b1f0fe7fd..806c880d39 100644--- a/docs/content/docs/reference/fixed-assets.mdx+++ b/docs/content/docs/reference/fixed-assets.mdx@@ -7,12 +7,12 @@ A **fixed asset** is a piece of capital equipment you capitalize and depreciate## Lifecycle-| Status | Meaning |-| --- | --- |-| Draft | Created, not yet on the books. |-| Active | Capitalized and depreciating. |-| Fully Depreciated | Written down to its residual value; no longer accruing. |-| Disposed | Retired or sold off the books. |+<StatusFlow entity="fixedAsset">+ <Status name="Draft">Created, not yet on the books.</Status>+ <Status name="Active" accent>Capitalized and depreciating.</Status>+ <Status name="Fully Depreciated">Written down to its residual value; no longer accruing.</Status>+ <Status name="Disposed" terminal>Retired or sold off the books.</Status>+</StatusFlow>## Acquiringdiff --git a/docs/content/docs/reference/items.mdx b/docs/content/docs/reference/items.mdxindex 05373713a8..a8e638e360 100644--- a/docs/content/docs/reference/items.mdx+++ b/docs/content/docs/reference/items.mdx@@ -9,15 +9,15 @@ An item's type, how it's replenished, and how it's tracked decide how it behaves## Fields-| Field | Type | Description |-| --- | --- | --- |-| Part number | text | The readable id; with a non-zero revision it reads as `id.rev`. |-| Type | enum | *Part*, *Material*, *Tool*, *Consumable*, *Service*, or *Fixture*. |-| Replenishment system | enum | How it's sourced overall — *Buy*, *Make*, or *Buy and Make*. |-| Default method type | enum | The default per-line fulfillment — *Purchase to Order*, *Pull from Inventory*, or *Make to Order*. |-| Tracking type | enum | *Inventory*, *Non-Inventory*, *Serial*, or *Batch*. |-| Unit of measure | reference | The stock unit. |-| Active | boolean | Whether it can be used on new documents. |+<FieldTable>+ <Field name="Part number" type="text">The readable id; with a non-zero revision it reads as `id.rev`.</Field>+ <Field name="Type" type="enum">*Part*, *Material*, *Tool*, *Consumable*, *Service*, or *Fixture*.</Field>+ <Field name="Replenishment system" type="enum">How it's sourced overall — *Buy*, *Make*, or *Buy and Make*.</Field>+ <Field name="Default method type" type="enum">The default per-line fulfillment — *Purchase to Order*, *Pull from Inventory*, or *Make to Order*.</Field>+ <Field name="Tracking type" type="enum">*Inventory*, *Non-Inventory*, *Serial*, or *Batch*.</Field>+ <Field name="Unit of measure" type="reference">The stock unit.</Field>+ <Field name="Active" type="boolean">Whether it can be used on new documents.</Field>+</FieldTable><Callout type="note">**<Term>Replenishment system</Term>** is the high-level strategy; **<Term id="method-type">default method type</Term>** is the line-level default it allows. A *Buy* item defaults to purchasing; a *Make* item can be built to order or pulled from stock. The two are related but distinct.diff --git a/docs/content/docs/reference/jobs.mdx b/docs/content/docs/reference/jobs.mdxindex bd74afb500..7ef76d2998 100644--- a/docs/content/docs/reference/jobs.mdx+++ b/docs/content/docs/reference/jobs.mdx@@ -9,31 +9,31 @@ Everything on the shop floor hangs off a job: the schedule board places its oper## Fields-| Field | Type | Description |-| --- | --- | --- |-| Item | reference | What's being made. The job copies this item's method on release. |-| Quantity | number | Good units to produce. |-| Scrap quantity | number | Units expected lost; `production quantity` = quantity + scrap. |-| Quantity complete | number | Good units finished so far. |-| Location | reference | The site the job runs at and receives into. |-| Due date | date | When it's needed; paired with a deadline type that tells the scheduler how hard the date is. |-| Source | reference | The sales order line or quote line it was raised for, if any. |-| Assignee | reference | The person responsible for the job. |+<FieldTable>+ <Field name="Item" type="reference">What's being made. The job copies this item's method on release.</Field>+ <Field name="Quantity" type="number">Good units to produce.</Field>+ <Field name="Scrap quantity" type="number">Units expected lost; `production quantity` = quantity + scrap.</Field>+ <Field name="Quantity complete" type="number">Good units finished so far.</Field>+ <Field name="Location" type="reference">The site the job runs at and receives into.</Field>+ <Field name="Due date" type="date">When it's needed; paired with a deadline type that tells the scheduler how hard the date is.</Field>+ <Field name="Source" type="reference">The sales order line or quote line it was raised for, if any.</Field>+ <Field name="Assignee" type="reference">The person responsible for the job.</Field>+</FieldTable>## Status lifecycleA job's status drives what you can do with it and what the floor sees.-| Status | Meaning |-| --- | --- |-| Draft | Created and editable; not yet planned or scheduled. |-| Planned | Demand is visible to planning, but no work is on the board yet. |-| Ready | Released — operations are scheduled and material requirements raised. |-| In Progress | The first production event has been logged against it. |-| Paused | Work is temporarily halted. |-| Completed | Every operation is done; finished goods have been received into inventory. |-| Closed | The books are settled — any residual work-in-process is swept to variance. |-| Cancelled | Abandoned before completion. |+<StatusFlow entity="job">+ <Status name="Draft">Created and editable; not yet planned or scheduled.</Status>+ <Status name="Planned">Demand is visible to planning, but no work is on the board yet.</Status>+ <Status name="Ready" accent>Released — operations are scheduled and material requirements raised.</Status>+ <Status name="In Progress">The first production event has been logged against it.</Status>+ <Status name="Paused" branch>Work is temporarily halted.</Status>+ <Status name="Completed">Every operation is done; finished goods have been received into inventory.</Status>+ <Status name="Closed">The books are settled — any residual work-in-process is swept to variance.</Status>+ <Status name="Cancelled" terminal>Abandoned before completion.</Status>+</StatusFlow><Callout type="info">A **Completed**, **Closed**, or **Cancelled** job is locked — its method, quantity, and dates can no longer be edited. Closing is what makes a job's work-in-process provably zero.diff --git a/docs/content/docs/reference/maintenance.mdx b/docs/content/docs/reference/maintenance.mdxindex 9cb5aa534d..76e0460c7f 100644--- a/docs/content/docs/reference/maintenance.mdx+++ b/docs/content/docs/reference/maintenance.mdx@@ -9,13 +9,13 @@ Maintenance in Carbon keeps the machines on the floor running. The unit of workA **maintenance dispatch** is one job of upkeep: what's wrong, which work center, who's on it, and the time and parts it took. It moves through a short lifecycle:-| Status | Meaning |-| --- | --- |-| Open | Raised, not yet picked up. |-| Assigned | Given to someone. |-| In Progress | Being worked, with the clock running. |-| Completed | Done — any running time entries are closed automatically. |-| Cancelled | Dropped without completing. |+<StatusFlow entity="maintenanceDispatch">+ <Status name="Open">Raised, not yet picked up.</Status>+ <Status name="Assigned">Given to someone.</Status>+ <Status name="In Progress">Being worked, with the clock running.</Status>+ <Status name="Completed" accent>Done — any running time entries are closed automatically.</Status>+ <Status name="Cancelled" terminal>Dropped without completing.</Status>+</StatusFlow>Every dispatch carries a **priority** (Low, Medium, High, Critical) and a **source** that says where it came from: **Reactive** (a breakdown — the default), **Scheduled** (generated from a preventive schedule), or **Non-Conformance** (raised from a <Term id="nonconformance">quality issue</Term>). Time is tracked as events against the dispatch, and parts as dispatch items.diff --git a/docs/content/docs/reference/purchase-orders.mdx b/docs/content/docs/reference/purchase-orders.mdxindex 56a7c6dcd1..15227c01e7 100644--- a/docs/content/docs/reference/purchase-orders.mdx+++ b/docs/content/docs/reference/purchase-orders.mdx@@ -9,13 +9,13 @@ Like a <Term id="sales-order">sales order</Term> in reverse, a purchase order li## Line fields-| Field | Type | Description |-| --- | --- | --- |-| Item | reference | What's being bought. |-| Purchase quantity | number | Ordered quantity. |-| Quantity received | number | Received so far; `quantity to receive` is the remainder. |-| Quantity invoiced | number | Billed so far; `quantity to invoice` is the remainder. |-| Conversion factor | number | Converts the supplier's purchase unit to the stock unit. |+<FieldTable>+ <Field name="Item" type="reference">What's being bought.</Field>+ <Field name="Purchase quantity" type="number">Ordered quantity.</Field>+ <Field name="Quantity received" type="number">Received so far; `quantity to receive` is the remainder.</Field>+ <Field name="Quantity invoiced" type="number">Billed so far; `quantity to invoice` is the remainder.</Field>+ <Field name="Conversion factor" type="number">Converts the supplier's purchase unit to the stock unit.</Field>+</FieldTable>## Types@@ -25,14 +25,17 @@ A purchase order is one of three kinds: a plain **Purchase**, a **Return** to thThe status is computed from the state of its lines, never set by hand.-| Status | Meaning |-| --- | --- |-| Draft / Planned | Being built, or suggested by planning. |-| Needs Approval | Held for sign-off (amount-gated); rejection lands on *Rejected*. |-| To Receive and Invoice | Confirmed; nothing received or billed yet. |-| To Receive | Fully invoiced, still owes receipt. |-| To Invoice | Fully received, still owes invoice. |-| Completed / Closed | Fully received and invoiced, or ended. |+<StatusFlow entity="purchaseOrder">+ <Status name="Draft">Being built.</Status>+ <Status name="Planned" branch>Suggested by planning.</Status>+ <Status name="Needs Approval" branch>Held for sign-off (amount-gated); rejection lands on *Rejected*.</Status>+ <Status name="To Receive and Invoice" accent>Confirmed; nothing received or billed yet.</Status>+ <Status name="To Receive">Fully invoiced, still owes receipt.</Status>+ <Status name="To Invoice">Fully received, still owes invoice.</Status>+ <Status name="Completed">Fully received and invoiced.</Status>+ <Status name="Closed" terminal>Ended.</Status>+ <Status name="Rejected" terminal>Sign-off was declined.</Status>+</StatusFlow>## Relateddiff --git a/docs/content/docs/reference/quotes.mdx b/docs/content/docs/reference/quotes.mdxindex e416780c5d..706c87aa60 100644--- a/docs/content/docs/reference/quotes.mdx+++ b/docs/content/docs/reference/quotes.mdx@@ -9,25 +9,25 @@ A quote is where pricing is negotiated and recorded. Lines support quantity brea## Fields-| Field | Type | Description |-| --- | --- | --- |-| Customer | reference | Who the offer is for. |-| Lines | list | The items quoted, each with quantity-break pricing. |-| Revision | number | Bumped as the quote is reworked, so history isn't overwritten. |-| Expiration | date | When the offer lapses. |-| Status | enum | Where the quote is in its lifecycle (below). |+<FieldTable>+ <Field name="Customer" type="reference">Who the offer is for.</Field>+ <Field name="Lines" type="list">The items quoted, each with quantity-break pricing.</Field>+ <Field name="Revision" type="number">Bumped as the quote is reworked, so history isn't overwritten.</Field>+ <Field name="Expiration" type="date">When the offer lapses.</Field>+ <Field name="Status" type="enum">Where the quote is in its lifecycle (below).</Field>+</FieldTable>## Status lifecycle-| Status | Meaning |-| --- | --- |-| Draft | Being prepared; pricing still in progress. |-| Sent | Finalized and issued to the customer — the state that unlocks digital acceptance. |-| Ordered | Converted into a sales order. |-| Partial | Some lines converted to an order, others not. |-| Lost | The customer declined. |-| Cancelled | Withdrawn before a decision. |-| Expired | Lapsed past its expiration date. |+<StatusFlow entity="quote">+ <Status name="Draft">Being prepared; pricing still in progress.</Status>+ <Status name="Sent" accent>Finalized and issued to the customer — the state that unlocks digital acceptance.</Status>+ <Status name="Ordered">Converted into a sales order.</Status>+ <Status name="Partial">Some lines converted to an order, others not.</Status>+ <Status name="Lost" terminal>The customer declined.</Status>+ <Status name="Cancelled" terminal>Withdrawn before a decision.</Status>+ <Status name="Expired" terminal>Lapsed past its expiration date.</Status>+</StatusFlow>Each line tracks its own progress too — **Not Started**, **In Progress**, **Complete**, or **No Quote** for a line you decline to bid. Finalizing a quote moves it to **Sent** and marks its lines **Complete**.diff --git a/docs/content/docs/reference/receipts.mdx b/docs/content/docs/reference/receipts.mdxindex bb1422545c..5dc13d224a 100644--- a/docs/content/docs/reference/receipts.mdx+++ b/docs/content/docs/reference/receipts.mdx@@ -9,21 +9,21 @@ A receipt line soft-links back to the purchase order line it fulfills. Posting a## Fields-| Field | Type | Description |-| --- | --- | --- |-| Source document | reference | The purchase order (or transfer) being received. |-| Received quantity | number | Units on this receipt, per line. |-| Conversion factor | number | Converts the supplier's purchase unit to the stock unit. |-| Location | reference | Where the goods land. |+<FieldTable>+ <Field name="Source document" type="reference">The purchase order (or transfer) being received.</Field>+ <Field name="Received quantity" type="number">Units on this receipt, per line.</Field>+ <Field name="Conversion factor" type="number">Converts the supplier's purchase unit to the stock unit.</Field>+ <Field name="Location" type="reference">Where the goods land.</Field>+</FieldTable>## Status-| Status | Meaning |-| --- | --- |-| Draft | Being prepared; nothing posted. |-| Pending | Queued to post. |-| Posted | Inventory increased and the order advanced. |-| Voided | Reversed after posting. |+<StatusFlow entity="receipt">+ <Status name="Draft">Being prepared; nothing posted.</Status>+ <Status name="Pending" branch>Queued to post.</Status>+ <Status name="Posted" accent>Inventory increased and the order advanced.</Status>+ <Status name="Voided" terminal>Reversed after posting.</Status>+</StatusFlow><Callout type="info">Receive an item flagged for inspection and its units land **On Hold**, with an inbound inspection opened at *Pending* — they don't become available stock until the inspection clears.diff --git a/docs/content/docs/reference/reordering.mdx b/docs/content/docs/reference/reordering.mdxindex 24f2153382..e126b1f628 100644--- a/docs/content/docs/reference/reordering.mdx+++ b/docs/content/docs/reference/reordering.mdx@@ -17,14 +17,14 @@ Every part carries a **reordering policy** that tells planning how to replenish## Fields-| Field | Applies to | Description |-| --- | --- | --- |-| Reorder point | Fixed Reorder Quantity, Maximum Quantity | On-hand level that triggers a new order. |-| Reorder quantity | Fixed Reorder Quantity | Fixed amount to order each time. |-| Maximum inventory quantity | Maximum Quantity | Level to top stock back up to. |-| Minimum / maximum order quantity | all | Clamp each suggested order into an orderable range. |-| Lot size | all | Round an order up to a multiple. |-| Demand accumulation period | Demand-Based Reorder | Window that groups demand into a single order. |+<FieldTable>+ <Field name="Reorder point">On-hand level that triggers a new order. *(applies to: Fixed Reorder Quantity, Maximum Quantity)*</Field>+ <Field name="Reorder quantity">Fixed amount to order each time. *(applies to: Fixed Reorder Quantity)*</Field>+ <Field name="Maximum inventory quantity">Level to top stock back up to. *(applies to: Maximum Quantity)*</Field>+ <Field name="Minimum / maximum order quantity">Clamp each suggested order into an orderable range. *(applies to: all)*</Field>+ <Field name="Lot size">Round an order up to a multiple. *(applies to: all)*</Field>+ <Field name="Demand accumulation period">Window that groups demand into a single order. *(applies to: Demand-Based Reorder)*</Field>+</FieldTable><Callout type="info">Policies are set per part, and planning can run per location — so the same part can use demand-baseddiff --git a/docs/content/docs/reference/routings.mdx b/docs/content/docs/reference/routings.mdxindex d226b96e7b..010c2f1591 100644--- a/docs/content/docs/reference/routings.mdx+++ b/docs/content/docs/reference/routings.mdx@@ -13,13 +13,13 @@ nothing to estimate run time from. The routing is the bridge between *what* you'## Fields-| Field | Type | Description |-| --- | --- | --- |-| Operation | text | The step performed, in sequence (e.g. *Cut*, *Weld*, *Inspect*). |-| Work center | reference | Where the operation runs; supplies the rates used for scheduling. |-| Setup time | minutes | Fixed time to prepare the operation, independent of quantity. |-| Run time | minutes/unit | Time per unit produced. |-| Sequence | number | Order of operations; lower runs first. |+<FieldTable>+ <Field name="Operation" type="text">The step performed, in sequence (e.g. *Cut*, *Weld*, *Inspect*).</Field>+ <Field name="Work center" type="reference">Where the operation runs; supplies the rates used for scheduling.</Field>+ <Field name="Setup time" type="minutes">Fixed time to prepare the operation, independent of quantity.</Field>+ <Field name="Run time" type="minutes/unit">Time per unit produced.</Field>+ <Field name="Sequence" type="number">Order of operations; lower runs first.</Field>+</FieldTable>## Per-revision routingsdiff --git a/docs/content/docs/reference/sales-orders.mdx b/docs/content/docs/reference/sales-orders.mdxindex 9f1ad65286..f0167015c3 100644--- a/docs/content/docs/reference/sales-orders.mdx+++ b/docs/content/docs/reference/sales-orders.mdx@@ -9,28 +9,29 @@ The order line is where fulfillment is scored. Each line tracks how much was sol## Line fields-| Field | Type | Description |-| --- | --- | --- |-| Item | reference | What's being sold. |-| Sale quantity | number | Ordered quantity. |-| Quantity sent | number | Shipped so far; `quantity to send` is the remainder. |-| Quantity invoiced | number | Billed so far; `quantity to invoice` is the remainder. |-| Unit price | number | Price per unit, net of discounts. |-| Method | enum | How the line is fulfilled — *Make to Order*, *Pull from Inventory*, or *Purchase to Order*. |+<FieldTable>+ <Field name="Item" type="reference">What's being sold.</Field>+ <Field name="Sale quantity" type="number">Ordered quantity.</Field>+ <Field name="Quantity sent" type="number">Shipped so far; `quantity to send` is the remainder.</Field>+ <Field name="Quantity invoiced" type="number">Billed so far; `quantity to invoice` is the remainder.</Field>+ <Field name="Unit price" type="number">Price per unit, net of discounts.</Field>+ <Field name="Method" type="enum">How the line is fulfilled — *Make to Order*, *Pull from Inventory*, or *Purchase to Order*.</Field>+</FieldTable>## StatusThe stored status reflects what's outstanding, and the order list shows a computed **display status** on top of it.-| Status | Meaning |-| --- | --- |-| Draft | Being built; not yet committed. |-| Needs Approval | Held for sign-off (amount-gated). |-| To Ship and Invoice | Confirmed; nothing shipped or billed yet. |-| To Ship | Fully invoiced, still owes shipment. |-| To Invoice | Fully shipped, still owes invoice. |-| Completed | Every line shipped and invoiced. |-| Closed / Cancelled | Ended early or abandoned. |+<StatusFlow entity="salesOrder">+ <Status name="Draft">Being built; not yet committed.</Status>+ <Status name="Needs Approval" branch>Held for sign-off (amount-gated).</Status>+ <Status name="To Ship and Invoice" accent>Confirmed; nothing shipped or billed yet.</Status>+ <Status name="To Ship">Fully invoiced, still owes shipment.</Status>+ <Status name="To Invoice">Fully shipped, still owes invoice.</Status>+ <Status name="Completed">Every line shipped and invoiced.</Status>+ <Status name="Closed" terminal>Ended early.</Status>+ <Status name="Cancelled" terminal>Abandoned.</Status>+</StatusFlow><Callout type="note">The order list can read **In Progress** even while the stored status is *To Ship and Invoice* — that's the display status reflecting a <Term id="make-to-order">make-to-order</Term> line whose jobs aren't finished yet. The stored status still drives the flow.diff --git a/docs/content/docs/reference/shelf-life.mdx b/docs/content/docs/reference/shelf-life.mdxindex a1ebf8aaf3..e02952cae5 100644--- a/docs/content/docs/reference/shelf-life.mdx+++ b/docs/content/docs/reference/shelf-life.mdx@@ -48,13 +48,13 @@ inputs that themselves carry a shelf-life policy is the company's *calculated inThe policy lives on the item's pick method:-| Field | Applies to | Description |-| --- | --- | --- |-| Mode | all | *Fixed Duration*, *Calculated*, or *Set on Receipt*. |-| Days | Fixed Duration | The shelf-life length added to the start event. |-| Trigger process | Fixed Duration (made) | The operation that starts the clock; blank means any operation. |-| Timing | Fixed Duration (made) | Whether the clock starts **Before** or **After** that process. |-| Calculate from BOM | Fixed Duration | Also cap the date at the earliest expiry of the consumed components. |+<FieldTable>+ <Field name="Mode">*Fixed Duration*, *Calculated*, or *Set on Receipt*. *(applies to: all)*</Field>+ <Field name="Days">The shelf-life length added to the start event. *(applies to: Fixed Duration)*</Field>+ <Field name="Trigger process">The operation that starts the clock; blank means any operation. *(applies to: Fixed Duration (made))*</Field>+ <Field name="Timing">Whether the clock starts **Before** or **After** that process. *(applies to: Fixed Duration (made))*</Field>+ <Field name="Calculate from BOM">Also cap the date at the earliest expiry of the consumed components. *(applies to: Fixed Duration)*</Field>+</FieldTable><Callout type="note">The expiration date is only ever written once, where it was blank — Carbon never silently overwrites a date a@@ -87,12 +87,12 @@ lists; set its lead time (in days) in company settings — leaving it blank turnSet company-wide in **Settings → Inventory**:-| Setting | Description |-| --- | --- |-| Expired-entity policy | *Warn*, *Block*, or *BlockWithOverride* for issues and transfers. |-| Near-expiry warning (days) | Lead time for the amber "expiring soon" badges; blank disables them. |-| Default shelf-life days | Fallback length when a policy needs a default. |-| Calculated input scope | `AllInputs` or `ManagedInputsOnly` for *Calculated* mode. |+<FieldTable>+ <Field name="Expired-entity policy">*Warn*, *Block*, or *BlockWithOverride* for issues and transfers.</Field>+ <Field name="Near-expiry warning (days)">Lead time for the amber "expiring soon" badges; blank disables them.</Field>+ <Field name="Default shelf-life days">Fallback length when a policy needs a default.</Field>+ <Field name="Calculated input scope">`AllInputs` or `ManagedInputsOnly` for *Calculated* mode.</Field>+</FieldTable>## Where you set itdiff --git a/docs/content/docs/reference/shipments.mdx b/docs/content/docs/reference/shipments.mdxindex b971d17ddd..6770d68dff 100644--- a/docs/content/docs/reference/shipments.mdx+++ b/docs/content/docs/reference/shipments.mdx@@ -9,20 +9,20 @@ Creating a shipment changes nothing on hand. **<Term id="posting">Posting</Term>## Fields-| Field | Type | Description |-| --- | --- | --- |-| Source document | reference | The order, return, or transfer being shipped. |-| Shipped quantity | number | Units on this shipment, per line. |-| Fulfillment | enum | Where a line is sourced — *Inventory* (from stock) or *Job* (from a production job). |+<FieldTable>+ <Field name="Source document" type="reference">The order, return, or transfer being shipped.</Field>+ <Field name="Shipped quantity" type="number">Units on this shipment, per line.</Field>+ <Field name="Fulfillment" type="enum">Where a line is sourced — *Inventory* (from stock) or *Job* (from a production job).</Field>+</FieldTable>## Status-| Status | Meaning |-| --- | --- |-| Draft | Being prepared; nothing posted. |-| Pending | Queued to post. |-| Posted | Inventory relieved and the source document advanced. |-| Voided | Reversed after posting. |+<StatusFlow entity="shipment">+ <Status name="Draft">Being prepared; nothing posted.</Status>+ <Status name="Pending" branch>Queued to post.</Status>+ <Status name="Posted" accent>Inventory relieved and the source document advanced.</Status>+ <Status name="Voided" terminal>Reversed after posting.</Status>+</StatusFlow><Callout type="info">Posting decrements inventory and bumps the source line's sent quantity; a sales order line's *sent complete* flag flips only once the cumulative shipped quantity reaches the ordered quantity. Posting a shipment does **not** create the <Term id="invoice">invoice</Term> — billing is a separate step.diff --git a/docs/content/docs/reference/storage-rules.mdx b/docs/content/docs/reference/storage-rules.mdxindex d2f03bece8..3fb048a300 100644--- a/docs/content/docs/reference/storage-rules.mdx+++ b/docs/content/docs/reference/storage-rules.mdx@@ -87,16 +87,16 @@ A rule reaches the lines it applies to in one of two ways:## Rule fields-| Field | Description |-| --- | --- |-| Name | A unique name for the rule. |-| Severity | `error` (block) or `warn` (acknowledge and continue). |-| Conditions | The match kind plus the field / operator / value rows. |-| Message | Shown on a violation; supports `{token}` interpolation. |-| Surfaces | Which transactions the rule fires on. |-| Target | `item` or `workCenter`. |-| Item filters | Item types and/or groups to scope an item rule (empty = all items). |-| Active | Whether the rule is currently evaluated. |+<FieldTable>+ <Field name="Name">A unique name for the rule.</Field>+ <Field name="Severity">`error` (block) or `warn` (acknowledge and continue).</Field>+ <Field name="Conditions">The match kind plus the field / operator / value rows.</Field>+ <Field name="Message">Shown on a violation; supports `{token}` interpolation.</Field>+ <Field name="Surfaces">Which transactions the rule fires on.</Field>+ <Field name="Target">`item` or `workCenter`.</Field>+ <Field name="Item filters">Item types and/or groups to scope an item rule (empty = all items).</Field>+ <Field name="Active">Whether the rule is currently evaluated.</Field>+</FieldTable>## Where to manage themdiff --git a/docs/content/docs/reference/traceability.mdx b/docs/content/docs/reference/traceability.mdxindex 053bf26c1a..9b29e7d387 100644--- a/docs/content/docs/reference/traceability.mdx+++ b/docs/content/docs/reference/traceability.mdx@@ -9,13 +9,13 @@ For items that need it, Carbon tracks individual units and lots as **<Term id="tA **tracked entity** is a tracked quantity of an item. A **<Term id="serial">Serial</Term>** item gets one entity per unit (quantity 1); a **<Term id="batch">Batch</Term>** item gets one entity per lot. The serial or batch number, and where it came from, live on the entity's attributes. An entity carries a status as it moves:-| Status | Meaning |-| --- | --- |-| Available | In stock, free to pick or consume. |-| Reserved | Allocated — e.g. a job's output before it's made. |-| On Hold | Received but not yet released (awaiting inspection). |-| Consumed | Issued to a job or shipped out. |-| Rejected | Failed inspection. |+<StatusFlow entity="trackedEntity">+ <Status name="Available">In stock, free to pick or consume.</Status>+ <Status name="Reserved" branch>Allocated — e.g. a job's output before it's made.</Status>+ <Status name="On Hold" branch>Received but not yet released (awaiting inspection).</Status>+ <Status name="Consumed" accent>Issued to a job or shipped out.</Status>+ <Status name="Rejected" terminal>Failed inspection.</Status>+</StatusFlow>## Where entities come fromdiff --git a/docs/content/docs/reference/work-centers.mdx b/docs/content/docs/reference/work-centers.mdxindex 44584e2999..311a087ed7 100644--- a/docs/content/docs/reference/work-centers.mdx+++ b/docs/content/docs/reference/work-centers.mdx@@ -9,15 +9,15 @@ A **work center** is a place on the floor where <Term id="operation">operations<## Fields-| Field | Type | Description |-| --- | --- | --- |-| Name | text | Unique within its location. |-| Location | reference | The site it belongs to. |-| Labor rate | rate | Cost per labor hour. |-| Machine rate | rate | Cost per machine hour. |-| Overhead rate | rate | Cost per hour of overhead. |-| Default standard factor | enum | How time is expressed (e.g. *Minutes/Piece*). |-| Required ability | reference | A skill an operator must hold to run it. |+<FieldTable>+ <Field name="Name" type="text">Unique within its location.</Field>+ <Field name="Location" type="reference">The site it belongs to.</Field>+ <Field name="Labor rate" type="rate">Cost per labor hour.</Field>+ <Field name="Machine rate" type="rate">Cost per machine hour.</Field>+ <Field name="Overhead rate" type="rate">Cost per hour of overhead.</Field>+ <Field name="Default standard factor" type="enum">How time is expressed (e.g. *Minutes/Piece*).</Field>+ <Field name="Required ability" type="reference">A skill an operator must hold to run it.</Field>+</FieldTable>## Processesdiff --git a/docs/next.config.mjs b/docs/next.config.mjsindex dfab51a2f7..50e6e086bc 100644--- a/docs/next.config.mjs+++ b/docs/next.config.mjs@@ -5,6 +5,9 @@ const withMDX = createMDX();/** @type {import('next').NextConfig} */const config = {reactStrictMode: true,+ // Consume the shared status→color constants (@carbon/utils/status-colors) — a pure-TS+ // workspace module, so Next must transpile it.+ transpilePackages: ["@carbon/utils"],// The monorepo pins React 18 (catalog) while this app runs React 19, so two// @types/react versions coexist and `next build` trips on the ReactNode /// ReactPortal type skew (a types-only artifact, not a runtime bug). Skip Next's@@ -15,7 +18,6 @@ const config = {// internals (RSC navigation, HMR) unless the tunnel origin is whitelisted,// which otherwise breaks client-side navigation while SSR still renders.allowedDevOrigins: [- "grown-outgoing-shad.ngrok-free.app","*.ngrok-free.app","*.ngrok.app","*.ngrok.io",diff --git a/docs/package.json b/docs/package.jsonindex b5eabe24ca..91ec0e354d 100644--- a/docs/package.json+++ b/docs/package.json@@ -15,6 +15,7 @@"typecheck": "node scripts/generate-api-docs.mjs && fumadocs-mdx && tsc --noEmit"},"dependencies": {+ "@carbon/utils": "workspace:*","@radix-ui/react-dialog": "1.1.15","@radix-ui/react-popover": "1.1.15","motion": "^12",diff --git a/packages/utils/package.json b/packages/utils/package.jsonindex 249c8c4aa1..f9f9028da6 100644--- a/packages/utils/package.json+++ b/packages/utils/package.json@@ -25,7 +25,8 @@"vitest": "catalog:"},"exports": {- ".": "./src/index.ts"+ ".": "./src/index.ts",+ "./status-colors": "./src/status-colors.ts"},"private": true,"scripts": {diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.tsindex d906c78fed..7b7fbf7de7 100644--- a/packages/utils/src/index.ts+++ b/packages/utils/src/index.ts@@ -20,6 +20,7 @@ export * from "./math";export * from "./object";export * from "./ssr";export * from "./status";+export * from "./status-colors";export * from "./storageRules";export * from "./string";export * from "./supabase";diff --git a/packages/utils/src/status-colors.ts b/packages/utils/src/status-colors.tsnew file mode 100644index 0000000000..7fb34fa8ff--- /dev/null+++ b/packages/utils/src/status-colors.ts@@ -0,0 +1,239 @@+/* Single source of truth for status enum → UI color across Carbon. The ERP renders+ * these via `@carbon/react`'s <Status color> (and Badge variants); the docs site renders+ * a colored dot from the same map, so the documentation can't drift from the app.+ *+ * Colors are the 7 semantic names the Status/Badge components accept — framework-agnostic,+ * so the standalone docs site can consume them too. `STATUS_COLOR_HEX` gives a representative+ * solid hex per name (matching the Status/Badge hues) for a dot/indicator.+ *+ * Each entity's map is grounded in its ERP `*Status.tsx` component; that component imports its+ * map from here (keeping its own icon / display-text / conditional logic). */++export type StatusColor =+ | "green"+ | "orange"+ | "red"+ | "yellow"+ | "blue"+ | "gray"+ | "purple";++export const STATUS_COLOR_HEX: Record<StatusColor, string> = {+ green: "#10b981",+ orange: "#f97316",+ red: "#ef4444",+ yellow: "#eab308",+ blue: "#3b82f6",+ gray: "#8b8985",+ purple: "#8b5cf6"+};++export const JOB_STATUS_COLOR_MAP = {+ Draft: "gray",+ Planned: "yellow",+ Ready: "blue",+ "In Progress": "orange",+ Paused: "orange",+ "Due Today": "orange",+ Completed: "green",+ Closed: "gray",+ Overdue: "red",+ Cancelled: "red"+} as const satisfies Record<string, StatusColor>;++export const QUOTE_STATUS_COLOR_MAP = {+ Draft: "gray",+ Sent: "blue",+ Ordered: "green",+ Partial: "green",+ Cancelled: "red",+ Expired: "red",+ Lost: "orange"+} as const satisfies Record<string, StatusColor>;++// salesOrderStatus — kept named SALES_STATUS_COLOR_MAP to match the existing ERP export.+export const SALES_STATUS_COLOR_MAP = {+ Draft: "gray",+ Cancelled: "red",+ Closed: "red",+ "To Ship and Invoice": "orange",+ "To Ship": "orange",+ "To Invoice": "blue",+ Confirmed: "blue",+ "Needs Approval": "yellow",+ "In Progress": "yellow",+ Invoiced: "gray",+ Completed: "green"+} as const satisfies Record<string, StatusColor>;++export const PURCHASE_ORDER_STATUS_COLOR_MAP = {+ Draft: "gray",+ Planned: "yellow",+ "To Review": "yellow",+ "Needs Approval": "yellow",+ "To Receive": "orange",+ "To Receive and Invoice": "orange",+ "To Invoice": "blue",+ Completed: "green",+ Closed: "red",+ Rejected: "red"+} as const satisfies Record<string, StatusColor>;++export const RECEIPT_STATUS_COLOR_MAP = {+ Draft: "gray",+ Pending: "orange",+ Posted: "green",+ Voided: "red"+} as const satisfies Record<string, StatusColor>;++// Shipment adds a conditional "Invoiced" (blue) the component derives from a flag.+export const SHIPMENT_STATUS_COLOR_MAP = {+ Draft: "gray",+ Pending: "orange",+ Posted: "green",+ Voided: "red",+ Invoiced: "blue"+} as const satisfies Record<string, StatusColor>;++export const MAINTENANCE_DISPATCH_STATUS_COLOR_MAP = {+ Open: "gray",+ Assigned: "yellow",+ "In Progress": "blue",+ Completed: "green",+ Cancelled: "red"+} as const satisfies Record<string, StatusColor>;++export const FIXED_ASSET_STATUS_COLOR_MAP = {+ Draft: "gray",+ Active: "green",+ "Fully Depreciated": "yellow",+ Disposed: "red"+} as const satisfies Record<string, StatusColor>;++export const TRACKED_ENTITY_STATUS_COLOR_MAP = {+ Available: "green",+ Reserved: "gray",+ "On Hold": "orange",+ Rejected: "red",+ Consumed: "blue"+} as const satisfies Record<string, StatusColor>;++export const SALES_INVOICE_STATUS_COLOR_MAP = {+ Draft: "gray",+ Return: "gray",+ Submitted: "blue",+ Pending: "yellow",+ "Partially Paid": "yellow",+ Voided: "red",+ Overdue: "orange",+ "Credit Note Issued": "green",+ Paid: "green"+} as const satisfies Record<string, StatusColor>;++export const PURCHASE_INVOICE_STATUS_COLOR_MAP = {+ Draft: "gray",+ Open: "blue",+ Pending: "orange",+ "Partially Paid": "orange",+ Overdue: "red",+ Voided: "red",+ "Debit Note Issued": "green",+ Paid: "green"+} as const satisfies Record<string, StatusColor>;++export const SALES_RFQ_STATUS_COLOR_MAP = {+ Draft: "gray",+ "Ready for Quote": "green",+ Quoted: "blue",+ Closed: "red"+} as const satisfies Record<string, StatusColor>;++export const SUPPLIER_QUOTE_STATUS_COLOR_MAP = {+ Active: "green",+ Draft: "gray",+ Declined: "orange",+ Expired: "red",+ Cancelled: "red"+} as const satisfies Record<string, StatusColor>;++export const PURCHASING_RFQ_STATUS_COLOR_MAP = {+ Draft: "gray",+ Requested: "green",+ Closed: "red"+} as const satisfies Record<string, StatusColor>;++export const ISSUE_STATUS_COLOR_MAP = {+ Registered: "gray",+ "In Progress": "blue",+ Closed: "green"+} as const satisfies Record<string, StatusColor>;++export const JOURNAL_ENTRY_STATUS_COLOR_MAP = {+ Draft: "gray",+ Posted: "green",+ Reversed: "red"+} as const satisfies Record<string, StatusColor>;++export const RISK_STATUS_COLOR_MAP = {+ Open: "gray",+ "In Review": "blue",+ Mitigating: "orange",+ Accepted: "green",+ Closed: "red"+} as const satisfies Record<string, StatusColor>;++export const STOCK_TRANSFER_STATUS_COLOR_MAP = {+ Draft: "gray",+ Released: "orange",+ "In Progress": "blue",+ Completed: "green"+} as const satisfies Record<string, StatusColor>;++export const GAUGE_STATUS_COLOR_MAP = {+ Active: "gray",+ Inactive: "red"+} as const satisfies Record<string, StatusColor>;++export const GAUGE_CALIBRATION_STATUS_COLOR_MAP = {+ Pending: "orange",+ "In-Calibration": "green",+ "Out-of-Calibration": "red"+} as const satisfies Record<string, StatusColor>;++export const GAUGE_ROLE_COLOR_MAP = {+ Master: "blue",+ Standard: "gray"+} as const satisfies Record<string, StatusColor>;++/* Registry keyed by a short entity id — lets a generic consumer (e.g. the docs StatusFlow)+ * resolve a status name to its color without importing each map by hand. */+export const statusColorMaps = {+ job: JOB_STATUS_COLOR_MAP,+ quote: QUOTE_STATUS_COLOR_MAP,+ salesOrder: SALES_STATUS_COLOR_MAP,+ purchaseOrder: PURCHASE_ORDER_STATUS_COLOR_MAP,+ receipt: RECEIPT_STATUS_COLOR_MAP,+ shipment: SHIPMENT_STATUS_COLOR_MAP,+ maintenanceDispatch: MAINTENANCE_DISPATCH_STATUS_COLOR_MAP,+ fixedAsset: FIXED_ASSET_STATUS_COLOR_MAP,+ trackedEntity: TRACKED_ENTITY_STATUS_COLOR_MAP+} as const;++export type StatusEntity = keyof typeof statusColorMaps;++/** The semantic color for a status, or undefined if the status isn't in the entity's map. */+export function statusColor(+ entity: StatusEntity,+ status: string+): StatusColor | undefined {+ return (statusColorMaps[entity] as Record<string, StatusColor>)[status];+}++/** The solid hex for a status's dot/indicator, or undefined if unknown. */+export function statusColorHex(+ entity: StatusEntity,+ status: string+): string | undefined {+ const color = statusColor(entity, status);+ return color ? STATUS_COLOR_HEX[color] : undefined;+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 77e145eb82..885ae2d7af 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1448,6 +1448,9 @@ importers:docs:dependencies:+ '@carbon/utils':+ specifier: workspace:*+ version: link:../packages/utils'@radix-ui/react-dialog':specifier: 1.1.15version: 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])