Skip to content

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.

feat: implement isClearable on ItemPostingGroup

Brad Barbin1c9b3dcd3b94
diff --git a/apps/erp/app/components/Form/ItemPostingGroup.tsx b/apps/erp/app/components/Form/ItemPostingGroup.tsx
index 3f095acc1c..362978fd37 100644
--- a/apps/erp/app/components/Form/ItemPostingGroup.tsx
+++ b/apps/erp/app/components/Form/ItemPostingGroup.tsx
@@ -1,4 +1,4 @@
-import type { ComboboxProps } from "@carbon/form";
+import type { CreatableComboboxProps } from "@carbon/form";
import { CreatableCombobox } from "@carbon/form";
import { useDisclosure, useMount } from "@carbon/react";
import { useMemo, useRef, useState } from "react";
@@ -8,7 +8,10 @@ import ItemPostingGroupForm from "~/modules/items/ui/ItemPostingGroups/ItemPosti
import { path } from "~/utils/path";
import { Enumerable } from "../Enumerable";
-type ItemPostingGroupSelectProps = Omit<ComboboxProps, "options" | "inline"> & {
+type ItemPostingGroupSelectProps = Omit<
+ CreatableComboboxProps,
+ "options" | "inline"
+> & {
inline?: boolean;
};
diff --git a/packages/form/src/components/CreatableCombobox.tsx b/packages/form/src/components/CreatableCombobox.tsx
index c6c0292785..7c793d6a0d 100644
--- a/packages/form/src/components/CreatableCombobox.tsx
+++ b/packages/form/src/components/CreatableCombobox.tsx
@@ -16,6 +16,7 @@ export type CreatableComboboxProps = Omit<
"onChange"
> & {
autoSelectSingleOption?: boolean;
+ isClearable?: boolean;
name: string;
label?: string | JSX.Element;
helperText?: string;
@@ -35,6 +36,7 @@ const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(
(
{
autoSelectSingleOption = false,
+ isClearable,
name,
label,
helperText,
@@ -96,7 +98,7 @@ const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(
ref={ref}
{...props}
value={value?.replace(/"/g, '\\"')}
- isClearable={isOptional && !props.isReadOnly}
+ isClearable={isClearable ?? (isOptional && !props.isReadOnly)}
label={label}
className="w-full"
onChange={(newValue) => {