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.

refactor: select component - part 3

Brad Barbin49c3538fa4f3
diff --git a/apps/carbon/app/components/Combobox.tsx b/apps/carbon/app/components/Combobox.tsx
index 6c54a4946a..e383ae3f0d 100644
--- a/apps/carbon/app/components/Combobox.tsx
+++ b/apps/carbon/app/components/Combobox.tsx
@@ -1,10 +1,10 @@
import {
- Button,
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
+ CommandTrigger,
HStack,
IconButton,
Popover,
@@ -15,10 +15,13 @@ import {
import type { ComponentPropsWithoutRef } from "react";
import { forwardRef } from "react";
import { MdClose } from "react-icons/md";
-import { RxCaretSort, RxCheck } from "react-icons/rx";
+import { RxCheck } from "react-icons/rx";
-type ComboboxProps = Omit<ComponentPropsWithoutRef<"button">, "onChange"> & {
- size: "sm" | "md" | "lg";
+export type ComboboxProps = Omit<
+ ComponentPropsWithoutRef<"button">,
+ "onChange"
+> & {
+ size?: "sm" | "md" | "lg";
value?: string;
options: {
label: string;
@@ -27,7 +30,7 @@ type ComboboxProps = Omit<ComponentPropsWithoutRef<"button">, "onChange"> & {
isClearable?: boolean;
isReadOnly?: boolean;
placeholder?: string;
- onChange: (selected: string) => void;
+ onChange?: (selected: string) => void;
};
const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
@@ -48,24 +51,19 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
<HStack spacing={1}>
<Popover>
<PopoverTrigger asChild>
- <Button
- size={size === "sm" ? "md" : size}
- variant="secondary"
+ <CommandTrigger
+ size={size}
role="combobox"
- className={cn(
- "min-w-[160px] justify-between hover:bg-background font-normal",
- !value && "text-muted-foreground"
- )}
+ className={cn("min-w-[160px]", !value && "text-muted-foreground")}
ref={ref}
{...props}
>
{value
? options.find((option) => option.value === value)?.label
: placeholder ?? "Select"}
- <RxCaretSort className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
+ </CommandTrigger>
</PopoverTrigger>
- <PopoverContent className="w-[200px] p-0">
+ <PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0">
<Command>
<CommandInput placeholder="Search..." className="h-9" />
<CommandEmpty>No option found.</CommandEmpty>
@@ -75,7 +73,7 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
value={option.label}
key={option.value}
onSelect={() => {
- onChange(option.value);
+ onChange?.(option.value);
}}
>
{option.label}
@@ -96,7 +94,7 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
variant="ghost"
aria-label="Clear"
icon={<MdClose />}
- onClick={() => onChange("")}
+ onClick={() => onChange?.("")}
size={size === "sm" ? "md" : size}
/>
)}
diff --git a/apps/carbon/app/components/Editable/EditablePurchaseInvoiceLineNumber.tsx b/apps/carbon/app/components/Editable/EditablePurchaseInvoiceLineNumber.tsx
index 168658f1fe..bf65bbd342 100644
--- a/apps/carbon/app/components/Editable/EditablePurchaseInvoiceLineNumber.tsx
+++ b/apps/carbon/app/components/Editable/EditablePurchaseInvoiceLineNumber.tsx
@@ -1,10 +1,10 @@
/* eslint-disable react/display-name */
import type { Database } from "@carbon/database";
-import { ReactSelect } from "@carbon/react";
import type {
PostgrestSingleResponse,
SupabaseClient,
} from "@supabase/supabase-js";
+import { Combobox } from "~/components";
import type { EditableTableCellComponentProps } from "~/components/Editable";
import type { PurchaseInvoiceLine } from "~/modules/invoicing";
@@ -19,6 +19,7 @@ const EditablePurchaseInvoiceLineNumber =
client?: SupabaseClient<Database>;
parts: { label: string; value: string }[];
accounts: { label: string; value: string }[];
+ services: { label: string; value: string }[];
defaultLocationId: string | null;
userId: string;
}
@@ -30,46 +31,34 @@ const EditablePurchaseInvoiceLineNumber =
onError,
onUpdate,
}: EditableTableCellComponentProps<PurchaseInvoiceLine>) => {
- const { client, parts, accounts, userId } = options;
+ const { client, parts, services, accounts, userId } = options;
const selectOptions =
row.invoiceLineType === "Part"
? parts
+ : row.invoiceLineType === "Service"
+ ? services
: row.invoiceLineType === "G/L Account"
? accounts
: [];
- const onAccountChange = async ({
- value,
- label,
- }: {
- value: string;
- label: string;
- }) => {
+ const onAccountChange = async (accountNumber: string) => {
if (!client) throw new Error("Supabase client not found");
const account = await client
.from("account")
.select("name")
- .eq("number", value)
+ .eq("number", accountNumber)
.single();
onUpdate("description", account.data?.name ?? "");
- onUpdate("partId", null);
- onUpdate("assetId", null);
- onUpdate("accountNumber", value);
- onUpdate("unitOfMeasureCode", null);
- onUpdate("shelfId", null);
+ onUpdate("accountNumber", accountNumber);
try {
const { error } = await client
.from("purchaseInvoiceLine")
.update({
- partId: null,
- assetId: null,
- accountNumber: value,
+ accountNumber: accountNumber,
description: account.data?.name ?? "",
- unitOfMeasureCode: null,
- shelfId: null,
updatedBy: userId,
})
.eq("id", row.id);
@@ -81,12 +70,7 @@ const EditablePurchaseInvoiceLineNumber =
}
};
- const onPartChange = async ({
- value: partId,
- }: {
- value: string;
- label: string;
- }) => {
+ const onPartChange = async (partId: string) => {
if (!client) throw new Error("Supabase client not found");
const [part, shelf, cost] = await Promise.all([
client
@@ -114,8 +98,6 @@ const EditablePurchaseInvoiceLineNumber =
onUpdate("partId", partId);
onUpdate("description", part.data?.name);
- onUpdate("assetId", null);
- onUpdate("accountNumber", null);
onUpdate("unitOfMeasureCode", part.data?.unitOfMeasureCode ?? null);
onUpdate("locationId", options.defaultLocationId);
onUpdate("shelfId", shelf.data?.defaultShelfId ?? null);
@@ -144,29 +126,60 @@ const EditablePurchaseInvoiceLineNumber =
}
};
- const onChange = (newValue: { value: string; label: string } | null) => {
+ const onServiceChange = async (serviceId: string) => {
+ if (!client) throw new Error("Supabase client not found");
+ const service = await client
+ .from("service")
+ .select("name")
+ .eq("id", serviceId)
+ .single();
+
+ if (service.error) {
+ onError();
+ return;
+ }
+
+ onUpdate("serviceId", serviceId);
+ onUpdate("description", service.data?.name);
+
+ try {
+ const { error } = await client
+ .from("purchaseInvoiceLine")
+ .update({
+ serviceId: serviceId,
+ updatedBy: userId,
+ })
+ .eq("id", row.id);
+
+ if (error) onError();
+ } catch (error) {
+ console.error(error);
+ onError();
+ }
+ };
+
+ const onChange = (newValue: string | null) => {
if (!newValue) return;
if (row.invoiceLineType === "Part") {
onPartChange(newValue);
} else if (row.invoiceLineType === "G/L Account") {
onAccountChange(newValue);
+ } else if (row.invoiceLineType === "Service") {
+ onServiceChange(newValue);
}
};
- const controlledValue = selectOptions.find(
- (option) => option.value === value
- );
+ const selectedValue = getValue(row);
return (
- <ReactSelect
+ <Combobox
autoFocus
- value={controlledValue}
+ value={selectedValue ?? ""}
options={selectOptions}
onChange={onChange}
- // @ts-ignore
- borderRadius="none"
size="sm"
+ className="border-0 rounded-none w-full"
/>
);
};
@@ -174,3 +187,18 @@ const EditablePurchaseInvoiceLineNumber =
EditablePurchaseInvoiceLineNumber.displayName =
"EditablePurchaseInvoiceLineNumber";
export default EditablePurchaseInvoiceLineNumber;
+
+function getValue(row: PurchaseInvoiceLine) {
+ switch (row.invoiceLineType) {
+ case "Part":
+ return row.partId;
+ case "Service":
+ return row.serviceId;
+ case "G/L Account":
+ return row.accountNumber;
+ case "Fixed Asset":
+ return row.assetId;
+ default:
+ return null;
+ }
+}
diff --git a/apps/carbon/app/components/Editable/EditablePurchaseOrderLineNumber.tsx b/apps/carbon/app/components/Editable/EditablePurchaseOrderLineNumber.tsx
index 95d1c402e4..90c56a589a 100644
--- a/apps/carbon/app/components/Editable/EditablePurchaseOrderLineNumber.tsx
+++ b/apps/carbon/app/components/Editable/EditablePurchaseOrderLineNumber.tsx
@@ -1,10 +1,10 @@
/* eslint-disable react/display-name */
import type { Database } from "@carbon/database";
-import { ReactSelect } from "@carbon/react";
import type {
PostgrestSingleResponse,
SupabaseClient,
} from "@supabase/supabase-js";
+import { Combobox } from "~/components";
import type { EditableTableCellComponentProps } from "~/components/Editable";
import type { PurchaseOrderLine } from "~/modules/purchasing";
@@ -18,6 +18,7 @@ const EditablePurchaseOrderLineNumber =
options: {
client?: SupabaseClient<Database>;
parts: { label: string; value: string }[];
+ services: { label: string; value: string }[];
accounts: { label: string; value: string }[];
defaultLocationId: string | null;
userId: string;
@@ -30,50 +31,37 @@ const EditablePurchaseOrderLineNumber =
onError,
onUpdate,
}: EditableTableCellComponentProps<PurchaseOrderLine>) => {
- const { client, parts, accounts, userId } = options;
+ const { client, parts, services, accounts, userId } = options;
const selectOptions =
row.purchaseOrderLineType === "Part"
? parts
+ : row.purchaseOrderLineType === "Service"
+ ? services
: row.purchaseOrderLineType === "G/L Account"
? accounts
: [];
- const onAccountChange = async ({
- value,
- label,
- }: {
- value: string;
- label: string;
- }) => {
+ const onAccountChange = async (accountNumber: string) => {
if (!client) throw new Error("Supabase client not found");
const account = await client
.from("account")
.select("name")
- .eq("number", value)
+ .eq("number", accountNumber)
.single();
onUpdate("description", account.data?.name ?? "");
- onUpdate("partId", null);
- onUpdate("assetId", null);
- onUpdate("accountNumber", value);
- onUpdate("unitOfMeasureCode", null);
- onUpdate("shelfId", null);
+ onUpdate("accountNumber", accountNumber);
try {
- if (!row.id) throw new Error("Purchase Order Line ID not found");
const { error } = await client
.from("purchaseOrderLine")
.update({
- partId: null,
- assetId: null,
- accountNumber: value,
+ accountNumber: accountNumber,
description: account.data?.name ?? "",
- unitOfMeasureCode: null,
- shelfId: null,
updatedBy: userId,
})
- .eq("id", row.id);
+ .eq("id", row.id!);
if (error) onError();
} catch (error) {
@@ -82,12 +70,7 @@ const EditablePurchaseOrderLineNumber =
}
};
- const onPartChange = async ({
- value: partId,
- }: {
- value: string;
- label: string;
- }) => {
+ const onPartChange = async (partId: string) => {
if (!client) throw new Error("Supabase client not found");
const [part, shelf, cost] = await Promise.all([
client
@@ -115,15 +98,12 @@ const EditablePurchaseOrderLineNumber =
onUpdate("partId", partId);
onUpdate("description", part.data?.name);
- onUpdate("assetId", null);
- onUpdate("accountNumber", null);
onUpdate("unitOfMeasureCode", part.data?.unitOfMeasureCode ?? null);
onUpdate("locationId", options.defaultLocationId);
onUpdate("shelfId", shelf.data?.defaultShelfId ?? null);
onUpdate("unitPrice", cost.data?.unitCost ?? null);
try {
- if (!row.id) throw new Error("Purchase Order Line ID not found");
const { error } = await client
.from("purchaseOrderLine")
.update({
@@ -134,10 +114,42 @@ const EditablePurchaseOrderLineNumber =
unitOfMeasureCode: part.data?.unitOfMeasureCode ?? null,
locationId: options.defaultLocationId,
shelfId: shelf.data?.defaultShelfId ?? null,
- unitPrice: cost.data?.unitCost ?? null,
+ unitPrice: cost.data?.unitCost,
+ updatedBy: userId,
+ })
+ .eq("id", row.id!);
+
+ if (error) onError();
+ } catch (error) {
+ console.error(error);
+ onError();
+ }
+ };
+
+ const onServiceChange = async (serviceId: string) => {
+ if (!client) throw new Error("Supabase client not found");
+ const service = await client
+ .from("service")
+ .select("name")
+ .eq("id", serviceId)
+ .single();
+
+ if (service.error) {
+ onError();
+ return;
+ }
+
+ onUpdate("serviceId", serviceId);
+ onUpdate("description", service.data?.name);
+
+ try {
+ const { error } = await client
+ .from("purchaseOrderLine")
+ .update({
+ serviceId: serviceId,
updatedBy: userId,
})
- .eq("id", row.id);
+ .eq("id", row.id!);
if (error) onError();
} catch (error) {
@@ -146,31 +158,46 @@ const EditablePurchaseOrderLineNumber =
}
};
- const onChange = (newValue: { value: string; label: string } | null) => {
+ const onChange = (newValue: string | null) => {
if (!newValue) return;
if (row.purchaseOrderLineType === "Part") {
onPartChange(newValue);
} else if (row.purchaseOrderLineType === "G/L Account") {
onAccountChange(newValue);
+ } else if (row.purchaseOrderLineType === "Service") {
+ onServiceChange(newValue);
}
};
- const controlledValue = selectOptions.find(
- (option) => option.value === value
- );
+ const selectedValue = getValue(row);
return (
- <ReactSelect
+ <Combobox
autoFocus
- value={controlledValue}
+ value={selectedValue ?? ""}
options={selectOptions}
onChange={onChange}
- // @ts-ignore
- borderRadius="none"
size="sm"
+ className="border-0 rounded-none w-full"
/>
);
};
+EditablePurchaseOrderLineNumber.displayName = "EditablePurchaseOrderLineNumber";
export default EditablePurchaseOrderLineNumber;
+
+function getValue(row: PurchaseOrderLine) {
+ switch (row.purchaseOrderLineType) {
+ case "Part":
+ return row.partId;
+ case "Service":
+ return row.serviceId;
+ case "G/L Account":
+ return row.accountNumber;
+ case "Fixed Asset":
+ return row.assetId;
+ default:
+ return null;
+ }
+}
diff --git a/apps/carbon/app/components/Form/Ability.tsx b/apps/carbon/app/components/Form/Ability.tsx
index ca866f51cf..86004fe9f7 100644
--- a/apps/carbon/app/components/Form/Ability.tsx
+++ b/apps/carbon/app/components/Form/Ability.tsx
@@ -1,42 +1,16 @@
-import type { SingleValue } from "@carbon/react";
-import {
- FormControl,
- FormErrorMessage,
- FormHelperText,
- FormLabel,
- ReactSelect,
- useMount,
-} from "@carbon/react";
+import { useMount } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useMemo } from "react";
-import { useControlField, useField } from "remix-validated-form";
import type { getAbilitiesList } from "~/modules/resources";
import { path } from "~/utils/path";
-import type { SelectProps } from "./Select";
-type AbilitySelectProps = Omit<SelectProps, "options" | "onChange"> & {
- onChange?: (
- selection: SingleValue<{
- value: string | number;
- label: string;
- }>
- ) => void;
-};
+import type { ComboboxProps } from "./Combobox";
+import Combobox from "./Combobox";
-const Ability = ({
- name,
- label = "Ability",
- helperText,
- isLoading,
- isReadOnly,
- placeholder = "Select Ability",
- onChange,
- ...props
-}: AbilitySelectProps) => {
- const { error } = useField(name);
- const [value, setValue] = useControlField<string | undefined>(name);
+type AbilitySelectProps = Omit<ComboboxProps, "options">;
+const Ability = (props: AbilitySelectProps) => {
const abilityFetcher =
useFetcher<Awaited<ReturnType<typeof getAbilitiesList>>>();
@@ -55,40 +29,8 @@ const Ability = ({
[abilityFetcher.data]
);
- const handleChange = (
- selection: SingleValue<{
- value: string | number;
- label: string;
- }>
- ) => {
- const newValue = (selection?.value as string) || undefined;
- setValue(newValue);
- onChange?.(selection);
- };
-
- const controlledValue = useMemo(
- () => options.find((option) => option.value === value),
- [value, options]
- );
-
return (
- <FormControl isInvalid={!!error}>
- {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- <input type="hidden" name={name} id={name} value={value} />
- <ReactSelect
- {...props}
- value={controlledValue}
- isLoading={isLoading}
- options={options}
- placeholder={placeholder}
- onChange={handleChange}
- />
- {error ? (
- <FormErrorMessage>{error}</FormErrorMessage>
- ) : (
- helperText && <FormHelperText>{helperText}</FormHelperText>
- )}
- </FormControl>
+ <Combobox options={options} {...props} label={props?.label ?? "Ability"} />
);
};
diff --git a/apps/carbon/app/components/Form/Account.tsx b/apps/carbon/app/components/Form/Account.tsx
index 91a06427a9..f25731ec46 100644
--- a/apps/carbon/app/components/Form/Account.tsx
+++ b/apps/carbon/app/components/Form/Account.tsx
@@ -1,36 +1,16 @@
-import {
- FormControl,
- FormErrorMessage,
- FormHelperText,
- FormLabel,
- ReactSelect,
- useMount,
-} from "@carbon/react";
+import { useMount } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useMemo } from "react";
-import { useControlField, useField } from "remix-validated-form";
import type { AccountClass, getAccountsList } from "~/modules/accounting";
import { path } from "~/utils/path";
-import type { SelectProps } from "./Select";
+import type { ComboboxProps } from "./Combobox";
+import Combobox from "./Combobox";
-type AccountSelectProps = Omit<SelectProps, "options"> & {
- classes: AccountClass[];
+type AccountSelectProps = Omit<ComboboxProps, "options"> & {
+ classes?: AccountClass[];
};
-const Account = ({
- name,
- label = "Account",
- helperText,
- isLoading,
- isReadOnly,
- placeholder = "Select Account",
- classes,
- onChange,
- ...props
-}: AccountSelectProps) => {
- const { error } = useField(name);
- const [value, setValue] = useControlField<string | undefined>(name);
-
+const Account = ({ classes, ...props }: AccountSelectProps) => {
const accountFetcher =
useFetcher<Awaited<ReturnType<typeof getAccountsList>>>();
@@ -52,40 +32,8 @@ const Account = ({
[accountFetcher.data]
);
- const handleChange = (selection: {
- value: string | number;
- label: string;
- }) => {
- const newValue = (selection.value as string) || undefined;
- setValue(newValue);
- onChange?.(selection);
- };
-
- const controlledValue = useMemo(
- // @ts-ignore
- () => options.find((option) => option.value === value),
- [value, options]
- );
-
return (
- <FormControl isInvalid={!!error}>
- {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- <input type="hidden" name={name} id={name} value={value} />
- <ReactSelect
- {...props}
- value={controlledValue}
- isLoading={isLoading}
- options={options}
- placeholder={placeholder}
- // @ts-ignore
- onChange={handleChange}
- />
- {error ? (
- <FormErrorMessage>{error}</FormErrorMessage>
- ) : (
- helperText && <FormHelperText>{helperText}</FormHelperText>
- )}
- </FormControl>
+ <Combobox options={options} {...props} label={props?.label ?? "Account"} />
);
};
diff --git a/apps/carbon/app/components/Form/Combobox.tsx b/apps/carbon/app/components/Form/Combobox.tsx
new file mode 100644
index 0000000000..4e686f95d7
--- /dev/null
+++ b/apps/carbon/app/components/Form/Combobox.tsx
@@ -0,0 +1,64 @@
+import {
+ FormControl,
+ FormErrorMessage,
+ FormHelperText,
+ FormLabel,
+} from "@carbon/react";
+
+import { useControlField, useField } from "remix-validated-form";
+import { Combobox as ComboboxBase } from "~/components";
+import type { ComboboxProps as ComboboxBaseProps } from "~/components/Combobox";
+
+export type ComboboxProps = Omit<ComboboxBaseProps, "onChange"> & {
+ name: string;
+ label?: string;
+ helperText?: string;
+ onChange?: (newValue: { value: string; label: string } | null) => void;
+};
+
+const Combobox = ({ name, label, helperText, ...props }: ComboboxProps) => {
+ const { getInputProps, error } = useField(name);
+ const [value, setValue] = useControlField<string | undefined>(name);
+
+ const onChange = (value: string) => {
+ if (value) {
+ props?.onChange?.(props.options.find((o) => o.value === value) ?? null);
+ } else {
+ props?.onChange?.(null);
+ }
+ };
+
+ return (
+ <FormControl isInvalid={!!error}>
+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
+ <input
+ {...getInputProps({
+ id: name,
+ })}
+ type="hidden"
+ name={name}
+ id={name}
+ value={value}
+ />
+ <ComboboxBase
+ {...props}
+ value={value}
+ onChange={(newValue) => {
+ setValue(newValue ?? "");
+ onChange(newValue ?? "");
+ }}
+ className="w-full"
+ />
+
+ {error ? (
+ <FormErrorMessage>{error}</FormErrorMessage>
+ ) : (
+ helperText && <FormHelperText>{helperText}</FormHelperText>
+ )}
+ </FormControl>
+ );
+};
+
+Combobox.displayName = "Combobox";
+
+export default Combobox;
diff --git a/apps/carbon/app/components/Form/Currency.tsx b/apps/carbon/app/components/Form/Currency.tsx
index 02921dd2b6..251a51ce66 100644
--- a/apps/carbon/app/components/Form/Currency.tsx
+++ b/apps/carbon/app/components/Form/Currency.tsx
@@ -1,33 +1,15 @@
-import {
- FormControl,
- FormErrorMessage,
- FormHelperText,
- FormLabel,
- ReactSelect,
- useMount,
-} from "@carbon/react";
+import { useMount } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useMemo } from "react";
-import { useControlField, useField } from "remix-validated-form";
import type { getCurrenciesList } from "~/modules/accounting";
import { path } from "~/utils/path";
-import type { SelectProps } from "./Select";
-type CurrencySelectProps = Omit<SelectProps, "options"> & {};
+import type { ComboboxProps } from "./Combobox";
+import Combobox from "./Combobox";
-const Currency = ({
- name,
- label = "Currency",
- helperText,
- isLoading,
- isReadOnly,
- placeholder = "Select Currency",
- onChange,
- ...props
-}: CurrencySelectProps) => {
- const { error } = useField(name);
- const [value, setValue] = useControlField<string | undefined>(name);
+type CurrencySelectProps = Omit<ComboboxProps, "options">;
+const Currency = ({ ...props }: CurrencySelectProps) => {
const currencyFetcher =
useFetcher<Awaited<ReturnType<typeof getCurrenciesList>>>();
@@ -46,42 +28,8 @@ const Currency = ({
[currencyFetcher.data]
);
- const handleChange = (selection: {
- value: string | number;
- label: string;
- }) => {
- const newValue = (selection.value as string) || undefined;
- setValue(newValue);
- if (onChange && typeof onChange === "function") {
- onChange(selection);
- }
- };
-
- const controlledValue = useMemo(
- // @ts-ignore
- () => options.find((option) => option.value === value),
- [value, options]
- );
-
return (
- <FormControl isInvalid={!!error}>
- {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- <input type="hidden" name={name} id={name} value={value} />
- <ReactSelect
- {...props}
- value={controlledValue}
- isLoading={isLoading}
- options={options}
- placeholder={placeholder}
- // @ts-ignore
- onChange={handleChange}
- />
- {error ? (
- <FormErrorMessage>{error}</FormErrorMessage>
- ) : (
- helperText && <FormHelperText>{helperText}</FormHelperText>
- )}
- </FormControl>
+ <Combobox {...props} options={options} label={props?.label ?? "Currency"} />
);
};
diff --git a/apps/carbon/app/components/Form/Customer.tsx b/apps/carbon/app/components/Form/Customer.tsx
index 47572322a8..85d1c965e0 100644
--- a/apps/carbon/app/components/Form/Customer.tsx
+++ b/apps/carbon/app/components/Form/Customer.tsx
@@ -1,30 +1,11 @@
-import {
- FormControl,
- FormErrorMessage,
- FormHelperText,
- FormLabel,
- ReactSelect,
-} from "@carbon/react";
import { useMemo } from "react";
-import { useControlField, useField } from "remix-validated-form";
import { useCustomers } from "~/stores";
-import type { SelectProps } from "./Select";
+import type { ComboboxProps } from "./Combobox";
+import Combobox from "./Combobox";
-type CustomerSelectProps = Omit<SelectProps, "options">;
-
-const Customer = ({
- name,
- label = "Customer",
- helperText,
- isLoading,
- isReadOnly,
- placeholder = "Select Customer",
- onChange,
- ...props
-}: CustomerSelectProps) => {
- const { getInputProps, error } = useField(name);
- const [value, setValue] = useControlField<string | undefined>(name);
+type CustomerSelectProps = Omit<ComboboxProps, "options">;
+const Customer = (props: CustomerSelectProps) => {
const [customers] = useCustomers();
const options = useMemo(
@@ -36,47 +17,8 @@ const Customer = ({
[customers]
);
- const handleChange = (selection: {
- value: string | number;
- label: string;
- }) => {
- const newValue = (selection.value as string) || undefined;
- setValue(newValue);
- if (onChange && typeof onChange === "function") {
- onChange(selection);
- }
- };
-
- const controlledValue = useMemo(
- // @ts-ignore
- () => options.find((option) => option.value === value),
- [value, options]
- );
-
return (
- <FormControl isInvalid={!!error}>
- {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- <ReactSelect
- {...getInputProps({
- // @ts-ignore
- id: name,
- })}
- {...props}
- value={controlledValue}
- isLoading={isLoading}
- options={options}
- placeholder={placeholder}
- // @ts-ignore
- w="full"
- isReadOnly={isReadOnly}
- onChange={handleChange}
- />
- {error ? (
- <FormErrorMessage>{error}</FormErrorMessage>
- ) : (
- helperText && <FormHelperText>{helperText}</FormHelperText>
- )}
- </FormControl>
+ <Combobox options={options} {...props} label={props?.label ?? "Customer"} />
);
};
diff --git a/apps/carbon/app/components/Form/Select.tsx b/apps/carbon/app/components/Form/Select.tsx
index c0613caf29..e143410184 100644
--- a/apps/carbon/app/components/Form/Select.tsx
+++ b/apps/carbon/app/components/Form/Select.tsx
@@ -3,69 +3,52 @@ import {
FormErrorMessage,
FormHelperText,
FormLabel,
- ReactSelect as SelectBase,
} from "@carbon/react";
-import { useMemo } from "react";
-import { useField } from "remix-validated-form";
-export type SelectProps = {
+import { useControlField, useField } from "remix-validated-form";
+import { Select as SelectBase } from "~/components";
+import type { SelectProps as SelectBaseProps } from "~/components/Select";
+
+export type SelectProps = Omit<SelectBaseProps, "onChange"> & {
name: string;
label?: string;
- options: { value: string | number; label: string }[];
helperText?: string;
- isClearable?: boolean;
- isLoading?: boolean;
- isReadOnly?: boolean;
- placeholder?: string;
- onChange?: (newValue: { value: string | number; label: string }) => void;
+ onChange?: (newValue: { value: string; label: string } | null) => void;
};
-const Select = ({
- name,
- label,
- options,
- helperText,
- isClearable,
- isLoading,
- isReadOnly,
- placeholder,
- onChange,
- ...props
-}: SelectProps) => {
- const { getInputProps, error, defaultValue } = useField(name);
- const initialValue = useMemo(
- () => options.find((option) => option.value === defaultValue),
- [defaultValue, options]
- );
+const Select = ({ name, label, helperText, ...props }: SelectProps) => {
+ const { getInputProps, error } = useField(name);
+ const [value, setValue] = useControlField<string | undefined>(name);
+
+ const onChange = (value: string) => {
+ if (value) {
+ props?.onChange?.(props.options.find((o) => o.value === value) ?? null);
+ } else {
+ props?.onChange?.(null);
+ }
+ };
return (
<FormControl isInvalid={!!error}>
{label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- {options?.length > 0 ? (
- <SelectBase
- {...getInputProps({
- // @ts-ignore
- id: name,
- })}
- {...props}
- defaultValue={initialValue}
- isClearable={isClearable}
- isLoading={isLoading}
- isReadOnly={isReadOnly}
- options={options}
- placeholder={placeholder}
- w="full"
- // @ts-ignore
- onChange={onChange ?? undefined}
- />
- ) : (
- <SelectBase
- isLoading={isLoading}
- isReadOnly={isReadOnly}
- options={[]}
- w="full"
- />
- )}
+ <input
+ {...getInputProps({
+ id: name,
+ })}
+ type="hidden"
+ name={name}
+ id={name}
+ value={value ?? undefined}
+ />
+ <SelectBase
+ {...props}
+ value={value}
+ onChange={(newValue) => {
+ setValue(newValue ?? "");
+ onChange(newValue ?? "");
+ }}
+ className="w-full"
+ />
{error ? (
<FormErrorMessage>{error}</FormErrorMessage>
diff --git a/apps/carbon/app/components/Form/Supplier.tsx b/apps/carbon/app/components/Form/Supplier.tsx
index 146728f036..1c5c05fa86 100644
--- a/apps/carbon/app/components/Form/Supplier.tsx
+++ b/apps/carbon/app/components/Form/Supplier.tsx
@@ -1,30 +1,11 @@
-import {
- FormControl,
- FormErrorMessage,
- FormHelperText,
- FormLabel,
- ReactSelect,
-} from "@carbon/react";
import { useMemo } from "react";
-import { useControlField, useField } from "remix-validated-form";
import { useSuppliers } from "~/stores";
-import type { SelectProps } from "./Select";
+import type { ComboboxProps } from "./Combobox";
+import Combobox from "./Combobox";
-type SupplierSelectProps = Omit<SelectProps, "options">;
-
-const Supplier = ({
- name,
- label = "Supplier",
- helperText,
- isLoading,
- isReadOnly,
- placeholder = "Select Supplier",
- onChange,
- ...props
-}: SupplierSelectProps) => {
- const { getInputProps, error } = useField(name);
- const [value, setValue] = useControlField<string | undefined>(name);
+type SupplierSelectProps = Omit<ComboboxProps, "options">;
+const Supplier = (props: SupplierSelectProps) => {
const [suppliers] = useSuppliers();
const options = useMemo(
@@ -36,47 +17,8 @@ const Supplier = ({
[suppliers]
);
- const handleChange = (selection: {
- value: string | number;
- label: string;
- }) => {
- const newValue = (selection.value as string) || undefined;
- setValue(newValue);
- if (onChange && typeof onChange === "function") {
- onChange(selection);
- }
- };
-
- const controlledValue = useMemo(
- // @ts-ignore
- () => options.find((option) => option.value === value),
- [value, options]
- );
-
return (
- <FormControl isInvalid={!!error}>
- {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
- <ReactSelect
- {...getInputProps({
- // @ts-ignore
- id: name,
- })}
- {...props}
- value={controlledValue}
- isLoading={isLoading}
- options={options}
- placeholder={placeholder}
- // @ts-ignore
- w="full"
- isReadOnly={isReadOnly}
- onChange={handleChange}
- />
- {error ? (
- <FormErrorMessage>{error}</FormErrorMessage>
- ) : (
- helperText && <FormHelperText>{helperText}</FormHelperText>
- )}
- </FormControl>
+ <Combobox options={options} {...props} label={props?.label ?? "Supplier"} />
);
};
diff --git a/apps/carbon/app/components/Form/index.ts b/apps/carbon/app/components/Form/index.ts
index 9d19677a99..38d5dd1fa4 100644
--- a/apps/carbon/app/components/Form/index.ts
+++ b/apps/carbon/app/components/Form/index.ts
@@ -6,6 +6,7 @@ import AccountSubcategory from "./AccountSubcategory";
import Array from "./Array";
import Boolean from "./Boolean";
import Color from "./Color";
+import Combobox from "./Combobox";
import CreatableMultiSelect from "./CreatableMultiSelect";
import CreatableSelect from "./CreatableSelect";
import Currency from "./Currency";
@@ -50,6 +51,7 @@ export {
Array,
Boolean,
Color,
+ Combobox,
CreatableMultiSelect,
CreatableSelect,
Currency,
diff --git a/apps/carbon/app/components/Grid/components/Cell/Cell.tsx b/apps/carbon/app/components/Grid/components/Cell/Cell.tsx
index 40b5356fcb..b8e22ef066 100644
--- a/apps/carbon/app/components/Grid/components/Cell/Cell.tsx
+++ b/apps/carbon/app/components/Grid/components/Cell/Cell.tsx
@@ -1,4 +1,4 @@
-import { Box, Td } from "@chakra-ui/react";
+import { Td } from "@chakra-ui/react";
import type { Cell as CellType } from "@tanstack/react-table";
import { flexRender } from "@tanstack/react-table";
import { memo, useState } from "react";
@@ -78,7 +78,7 @@ const Cell = <T extends object>({
onFocus={onFocus}
>
{isSelected && isEditing && hasEditableTableCellComponent ? (
- <Box position="absolute" w="full" left={0} top="2px">
+ <div className="mx-[-1rem] my-[-0.5rem]">
{hasEditableTableCellComponent
? flexRender(editableCell, {
accessorKey,
@@ -92,7 +92,7 @@ const Cell = <T extends object>({
},
})
: null}
- </Box>
+ </div>
) : (
<div ref={ref}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
diff --git a/apps/carbon/app/components/Select.tsx b/apps/carbon/app/components/Select.tsx
index 3c3e31bf70..2f790ad962 100644
--- a/apps/carbon/app/components/Select.tsx
+++ b/apps/carbon/app/components/Select.tsx
@@ -11,8 +11,11 @@ import type { ComponentPropsWithoutRef } from "react";
import { forwardRef } from "react";
import { MdClose } from "react-icons/md";
-type SelectProps = Omit<ComponentPropsWithoutRef<"button">, "onChange"> & {
- size: "sm" | "md" | "lg";
+export type SelectProps = Omit<
+ ComponentPropsWithoutRef<"button">,
+ "onChange"
+> & {
+ size?: "sm" | "md" | "lg";
value?: string;
options: {
label: string;
diff --git a/apps/carbon/app/modules/accounting/accounting.service.ts b/apps/carbon/app/modules/accounting/accounting.service.ts
index 7166a86a3f..2d0e08f3c2 100644
--- a/apps/carbon/app/modules/accounting/accounting.service.ts
+++ b/apps/carbon/app/modules/accounting/accounting.service.ts
@@ -153,7 +153,7 @@ export async function getAccountsList(
query = query.eq("incomeBalance", args.incomeBalance);
}
- if (args?.classes) {
+ if (args?.classes && args.classes.length > 0) {
query = query.in("class", args.classes);
}
diff --git a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsx
index 4a4f4caf40..9794635507 100644
--- a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermForm/PaymentTermForm.tsx
@@ -74,9 +74,9 @@ const PaymentTermForm = ({ initialValues }: PaymentTermFormProps) => {
name="calculationMethod"
label="After"
options={calculationMethodOptions}
- onChange={({ value }) => {
+ onChange={(value) => {
setSelectedCalculationMethod(
- value as PaymentTermCalculationMethod
+ value?.value as PaymentTermCalculationMethod
);
}}
/>
diff --git a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm/PurchaseInvoiceLineForm.tsx b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm/PurchaseInvoiceLineForm.tsx
index fd11f7099c..41f53c509f 100644
--- a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm/PurchaseInvoiceLineForm.tsx
+++ b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm/PurchaseInvoiceLineForm.tsx
@@ -240,8 +240,8 @@ const PurchaseInvoiceLineForm = ({
name="invoiceLineType"
label="Type"
options={purchaseInvoiceLineTypeOptions}
- onChange={({ value }) => {
- onTypeChange(value as PurchaseInvoiceLineType);
+ onChange={(value) => {
+ onTypeChange(value?.value as PurchaseInvoiceLineType);
}}
/>
{type === "Part" && (
@@ -249,8 +249,8 @@ const PurchaseInvoiceLineForm = ({
name="partId"
label="Part"
partReplenishmentSystem="Buy"
- onChange={({ value }) => {
- onPartChange(value as string);
+ onChange={(value) => {
+ onPartChange(value?.value as string);
}}
/>
)}
@@ -260,8 +260,8 @@ const PurchaseInvoiceLineForm = ({
name="serviceId"
label="Service"
serviceType="External"
- onChange={({ value }) => {
- onServiceChange(value as string);
+ onChange={(value) => {
+ onServiceChange(value?.value as string);
}}
/>
)}
@@ -271,11 +271,11 @@ const PurchaseInvoiceLineForm = ({
name="accountNumber"
label="Account"
classes={["Expense", "Asset"]}
- onChange={({ label }) => {
+ onChange={(value) => {
setPartData((d) => ({
...d,
partId: "",
- description: label,
+ description: value?.label!,
uom: "EA",
shelfId: "",
}));
diff --git a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/PurchaseInvoiceLines.tsx b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/PurchaseInvoiceLines.tsx
index 9e46f47bc5..8cd6de0375 100644
--- a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/PurchaseInvoiceLines.tsx
+++ b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/PurchaseInvoiceLines.tsx
@@ -51,6 +51,7 @@ const PurchaseInvoiceLines = () => {
canDelete,
supabase,
partOptions,
+ serviceOptions,
accountOptions,
onCellEdit,
} = usePurchaseInvoiceLines();
@@ -178,6 +179,7 @@ const PurchaseInvoiceLines = () => {
partId: EditablePurchaseInvoiceLineNumber(onCellEdit, {
client: supabase,
parts: partOptions,
+ services: serviceOptions,
accounts: accountOptions,
defaultLocationId: defaults.locationId,
userId: userId,
@@ -187,6 +189,7 @@ const PurchaseInvoiceLines = () => {
onCellEdit,
supabase,
partOptions,
+ serviceOptions,
accountOptions,
defaults.locationId,
userId,
diff --git a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/usePurchaseInvoiceLines.tsx b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/usePurchaseInvoiceLines.tsx
index 434554fe72..47c2f4f089 100644
--- a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/usePurchaseInvoiceLines.tsx
+++ b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLines/usePurchaseInvoiceLines.tsx
@@ -5,6 +5,7 @@ import { usePermissions, useUser } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
import type { getAccountsList } from "~/modules/accounting";
import type { PurchaseInvoiceLine } from "~/modules/invoicing";
+import type { getServicesList } from "~/modules/parts";
import { usePurchasedParts } from "~/stores/parts";
import { path } from "~/utils/path";
@@ -17,13 +18,6 @@ export default function usePurchaseInvoiceLines() {
const canDelete = permissions.can("delete", "invoicing");
const parts = usePurchasedParts();
- const accountsFetcher =
- useFetcher<Awaited<ReturnType<typeof getAccountsList>>>();
-
- useMount(() => {
- accountsFetcher.load(`${path.to.api.accounts}?type=Posting`);
- });
-
const partOptions = useMemo(
() =>
parts.map((p) => ({
@@ -33,17 +27,41 @@ export default function usePurchaseInvoiceLines() {
[parts]
);
+ const accountsFetcher =
+ useFetcher<Awaited<ReturnType<typeof getAccountsList>>>();
+ useMount(() => {
+ accountsFetcher.load(
+ `${path.to.api.accounts}?type=Posting&class=Expense&class=Asset`
+ );
+ });
const accountOptions = useMemo(
() =>
accountsFetcher.data?.data
- ? accountsFetcher.data?.data.map((c) => ({
- value: c.number,
- label: c.number,
+ ? accountsFetcher.data?.data.map((a) => ({
+ value: a.number,
+ label: a.number,
}))
: [],
[accountsFetcher.data]
);
+ const servicesFetcher =
+ useFetcher<Awaited<ReturnType<typeof getServicesList>>>();
+ useMount(() => {
+ servicesFetcher.load(`${path.to.api.services}?type=External`);
+ });
+
+ const serviceOptions = useMemo(
+ () =>
+ servicesFetcher.data?.data
+ ? servicesFetcher.data?.data.map((s) => ({
+ value: s.id,
+ label: s.id,
+ }))
+ : [],
+ [servicesFetcher.data]
+ );
+
const onCellEdit = useCallback(
async (id: string, value: unknown, row: PurchaseInvoiceLine) => {
if (!supabase) throw new Error("Supabase client not found");
@@ -63,6 +81,7 @@ export default function usePurchaseInvoiceLines() {
canDelete,
canEdit,
partOptions,
+ serviceOptions,
supabase,
onCellEdit,
};
diff --git a/apps/carbon/app/modules/parts/parts.models.ts b/apps/carbon/app/modules/parts/parts.models.ts
index 455b5e6cfb..0d7049263a 100644
--- a/apps/carbon/app/modules/parts/parts.models.ts
+++ b/apps/carbon/app/modules/parts/parts.models.ts
@@ -40,7 +40,7 @@ export const partValidator = withZod(
message: "Replenishment system is required",
}),
}),
- partGroupId: z.string().optional(),
+ partGroupId: zfd.text(z.string().optional()),
partType: z.enum(partTypes, {
errorMap: (issue, ctx) => ({
message: "Part type is required",
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsx
index 2dab6c952f..9507dc59ad 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartForm/PartForm.tsx
@@ -12,6 +12,7 @@ import { useState } from "react";
import { ValidatedForm } from "remix-validated-form";
import {
Boolean,
+ Combobox,
Input,
InputControlled,
Select,
@@ -165,14 +166,14 @@ const PartForm = ({ initialValues }: PartFormProps) => {
label="Part Type"
options={partTypeOptions}
/>
- <Select
+ <Combobox
name="unitOfMeasureCode"
label="Unit of Measure"
options={unitOfMeasureOptions}
/>
</VStack>
<VStack>
- <Select
+ <Combobox
name="partGroupId"
label="Part Group"
options={partGroupOptions}
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsx
index 8914f23bc5..d3dd42e6cc 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartManufacturingForm/PartManufacturingForm.tsx
@@ -55,11 +55,11 @@ const PartManufacturingForm = ({
label="Manufacturing Policy"
options={partManufacturingPolicyOptions}
/>
- <Select
+ {/* <Select
name="routingId"
label="Routing ID"
options={[{ label: "", value: "" }]}
- />
+ /> */}
</VStack>
<VStack>
<Number name="manufacturingLeadTime" label="Lead Time (Days)" />
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsx
index 215a8c882f..318304eca7 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartPurchasingForm/PartPurchasingForm.tsx
@@ -10,9 +10,9 @@ import { Grid } from "@chakra-ui/react";
import { ValidatedForm } from "remix-validated-form";
import {
Boolean,
+ Combobox,
Hidden,
Number,
- Select,
Submit,
Supplier,
} from "~/components/Form";
@@ -60,7 +60,7 @@ const PartPurchasingForm = ({
<Number name="purchasingLeadTime" label="Lead Time (Days)" />
</VStack>
<VStack>
- <Select
+ <Combobox
name="purchasingUnitOfMeasureCode"
label="Purchasing Unit of Measure"
options={unitOfMeasureOptions}
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsx
index 3906e6e846..1252b99c09 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartSalePriceForm/PartSalePriceForm.tsx
@@ -10,10 +10,10 @@ import { Grid } from "@chakra-ui/react";
import { ValidatedForm } from "remix-validated-form";
import {
Boolean,
+ Combobox,
Currency,
Hidden,
Number,
- Select,
Submit,
} from "~/components/Form";
import { usePermissions } from "~/hooks";
@@ -60,7 +60,7 @@ const PartSalePriceForm = ({
<Currency name="currencyCode" label="Currency" />
</VStack>
<VStack>
- <Select
+ <Combobox
name="salesUnitOfMeasureCode"
label="Sales Unit of Measure"
options={unitOfMeasureOptions}
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsx
index c35b7e36d3..52826b62f5 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartSupplierForm/PartSupplierForm.tsx
@@ -13,10 +13,10 @@ import { useNavigate, useParams } from "@remix-run/react";
import { useMemo } from "react";
import { ValidatedForm } from "remix-validated-form";
import {
+ Combobox,
Hidden,
Input,
Number,
- Select,
Submit,
Supplier,
} from "~/components/Form";
@@ -44,7 +44,7 @@ const PartSupplierForm = ({ initialValues }: PartSupplierFormProps) => {
const unitOfMeasureOptions = useMemo(() => {
return (
sharedPartData?.unitOfMeasures.map((unitOfMeasure) => ({
- label: unitOfMeasure.code,
+ label: unitOfMeasure.name,
value: unitOfMeasure.code,
})) ?? []
);
@@ -88,7 +88,7 @@ const PartSupplierForm = ({ initialValues }: PartSupplierFormProps) => {
<VStack spacing={4}>
<Supplier name="supplierId" label="Supplier" />
<Input name="supplierPartId" label="Supplier Part ID" />
- <Select
+ <Combobox
name="supplierUnitOfMeasureCode"
label="Unit of Measure"
options={unitOfMeasureOptions}
diff --git a/apps/carbon/app/modules/parts/ui/Service/ServiceForm/ServiceForm.tsx b/apps/carbon/app/modules/parts/ui/Service/ServiceForm/ServiceForm.tsx
index c488c9e537..e13010a5c3 100644
--- a/apps/carbon/app/modules/parts/ui/Service/ServiceForm/ServiceForm.tsx
+++ b/apps/carbon/app/modules/parts/ui/Service/ServiceForm/ServiceForm.tsx
@@ -12,6 +12,7 @@ import { useState } from "react";
import { ValidatedForm } from "remix-validated-form";
import {
Boolean,
+ Combobox,
Input,
InputControlled,
Select,
@@ -142,7 +143,7 @@ const ServiceForm = ({ initialValues }: ServiceFormProps) => {
label="Service Type"
options={serviceTypeOptions}
/>
- <Select
+ <Combobox
name="partGroupId"
label="Part Group"
options={partGroupOptions}
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsx
index 8c2bca8a0d..3fc0d4ce36 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm/PurchaseOrderDeliveryForm.tsx
@@ -111,7 +111,7 @@ const PurchaseOrderDeliveryForm = ({
<Customer
name="customerId"
label="Customer"
- onChange={({ value }) => setCustomer(value as string)}
+ onChange={(value) => setCustomer(value?.value as string)}
/>
<CustomerLocation
name="customerLocationId"
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsx
index e765f396de..28e266d8ef 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm/PurchaseOrderLineForm.tsx
@@ -238,8 +238,8 @@ const PurchaseOrderLineForm = ({
name="purchaseOrderLineType"
label="Type"
options={purchaseOrderLineTypeOptions}
- onChange={({ value }) => {
- onTypeChange(value as PurchaseOrderLineType);
+ onChange={(value) => {
+ onTypeChange(value?.value as PurchaseOrderLineType);
}}
/>
{type === "Part" && (
@@ -247,8 +247,8 @@ const PurchaseOrderLineForm = ({
name="partId"
label="Part"
partReplenishmentSystem="Buy"
- onChange={({ value }) => {
- onPartChange(value as string);
+ onChange={(value) => {
+ onPartChange(value?.value as string);
}}
/>
)}
@@ -258,8 +258,8 @@ const PurchaseOrderLineForm = ({
name="serviceId"
label="Service"
serviceType="External"
- onChange={({ value }) => {
- onServiceChange(value as string);
+ onChange={(value) => {
+ onServiceChange(value?.value as string);
}}
/>
)}
@@ -269,10 +269,10 @@ const PurchaseOrderLineForm = ({
name="accountNumber"
label="Account"
classes={["Expense", "Asset"]}
- onChange={({ label }) => {
+ onChange={(value) => {
setPartData({
partId: "",
- description: label,
+ description: value?.label ?? "",
unitPrice: "0",
uom: "EA",
shelfId: "",
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsx
index 998875bef2..f416a3cd7b 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/PurchaseOrderLines.tsx
@@ -53,6 +53,7 @@ const PurchaseOrderLines = () => {
canDelete,
supabase,
partOptions,
+ serviceOptions,
accountOptions,
onCellEdit,
} = usePurchaseOrderLines();
@@ -265,6 +266,7 @@ const PurchaseOrderLines = () => {
partId: EditablePurchaseOrderLineNumber(onCellEdit, {
client: supabase,
parts: partOptions,
+ services: serviceOptions,
accounts: accountOptions,
defaultLocationId: defaults.locationId,
userId: userId,
@@ -274,6 +276,7 @@ const PurchaseOrderLines = () => {
onCellEdit,
supabase,
partOptions,
+ serviceOptions,
accountOptions,
defaults.locationId,
userId,
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsx
index d9f081b28f..e3f53da73a 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLines/usePurchaseOrderLines.tsx
@@ -4,6 +4,7 @@ import { useCallback, useMemo } from "react";
import { usePermissions, useUser } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
import type { getAccountsList } from "~/modules/accounting";
+import type { getServicesList } from "~/modules/parts";
import type { PurchaseOrderLine } from "~/modules/purchasing";
import { usePurchasedParts } from "~/stores/parts";
import { path } from "~/utils/path";
@@ -17,13 +18,6 @@ export default function usePurchaseOrderLines() {
const canDelete = permissions.can("delete", "purchasing");
const parts = usePurchasedParts();
- const accountsFetcher =
- useFetcher<Awaited<ReturnType<typeof getAccountsList>>>();
-
- useMount(() => {
- accountsFetcher.load(`${path.to.api.accounts}?type=Posting`);
- });
-
const partOptions = useMemo(
() =>
parts.map((p) => ({
@@ -33,17 +27,41 @@ export default function usePurchaseOrderLines() {
[parts]
);
+ const accountsFetcher =
+ useFetcher<Awaited<ReturnType<typeof getAccountsList>>>();
+ useMount(() => {
+ accountsFetcher.load(
+ `${path.to.api.accounts}?type=Posting&class=Expense&class=Asset`
+ );
+ });
const accountOptions = useMemo(
() =>
accountsFetcher.data?.data
- ? accountsFetcher.data?.data.map((c) => ({
- value: c.number,
- label: c.number,
+ ? accountsFetcher.data?.data.map((a) => ({
+ value: a.number,
+ label: a.number,
}))
: [],
[accountsFetcher.data]
);
+ const servicesFetcher =
+ useFetcher<Awaited<ReturnType<typeof getServicesList>>>();
+ useMount(() => {
+ servicesFetcher.load(`${path.to.api.services}?type=External`);
+ });
+
+ const serviceOptions = useMemo(
+ () =>
+ servicesFetcher.data?.data
+ ? servicesFetcher.data?.data.map((s) => ({
+ value: s.id,
+ label: s.id,
+ }))
+ : [],
+ [servicesFetcher.data]
+ );
+
const onCellEdit = useCallback(
async (id: string, value: unknown, row: PurchaseOrderLine) => {
if (!supabase) throw new Error("Supabase client not found");
@@ -53,7 +71,7 @@ export default function usePurchaseOrderLines() {
[id]: value,
updatedBy: userId,
})
- .eq("id", row.id);
+ .eq("id", row.id!);
},
[supabase, userId]
);
@@ -63,6 +81,7 @@ export default function usePurchaseOrderLines() {
canDelete,
canEdit,
partOptions,
+ serviceOptions,
supabase,
onCellEdit,
};
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsx
index e6fc9557a9..c79efe8313 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm/PurchaseOrderPaymentForm.tsx
@@ -66,7 +66,7 @@ const PurchaseOrderPaymentForm = ({
<Supplier
name="invoiceSupplierId"
label="Invoice Supplier"
- onChange={({ value }) => setSupplier(value as string)}
+ onChange={(value) => setSupplier(value?.value as string)}
/>
<SupplierLocation
name="invoiceSupplierLocationId"
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm/SupplierPaymentForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm/SupplierPaymentForm.tsx
index 000f1bc73b..c23386a61d 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm/SupplierPaymentForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm/SupplierPaymentForm.tsx
@@ -69,7 +69,7 @@ const SupplierPaymentForm = ({ initialValues }: SupplierPaymentFormProps) => {
<Supplier
name="invoiceSupplierId"
label="Invoice Supplier"
- onChange={({ value }) => setSupplier(value as string)}
+ onChange={(value) => setSupplier(value?.value as string)}
/>
<SupplierLocation
name="invoiceSupplierLocationId"
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierShippingForm/SupplierShippingForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierShippingForm/SupplierShippingForm.tsx
index 35cadb34e6..b13aec0e3f 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierShippingForm/SupplierShippingForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierShippingForm/SupplierShippingForm.tsx
@@ -75,7 +75,7 @@ const SupplierShippingForm = ({ initialValues }: SupplierShippingFormProps) => {
<Supplier
name="shippingSupplierId"
label="Shipping Supplier"
- onChange={({ value }) => setSupplier(value as string)}
+ onChange={(value) => setSupplier(value?.value as string)}
/>
<SupplierLocation
name="shippingSupplierLocationId"
diff --git a/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsx b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsx
index 2841790b4b..3d8b483a81 100644
--- a/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/Abilities/EmployeeAbilityForm/EmployeeAbilityForm.tsx
@@ -91,8 +91,10 @@ const EmployeeAbilityForm = ({
<Select
name="trainingStatus"
label="Training Status"
- onChange={({ value }) => {
- setInProgress(value === AbilityEmployeeStatus.InProgress);
+ onChange={(value) => {
+ setInProgress(
+ value?.value === AbilityEmployeeStatus.InProgress
+ );
}}
options={[
{
diff --git a/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsx
index 9231afb51f..99eb5efdb5 100644
--- a/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/Contractors/ContractorForm/ContractorForm.tsx
@@ -72,7 +72,7 @@ const ContractorForm = ({ initialValues }: ContractorFormProps) => {
name="supplierId"
label="Supplier"
isReadOnly={isEditing}
- onChange={({ value }) => setSupplier(value as string)}
+ onChange={(value) => setSupplier(value?.value as string)}
/>
<SupplierContact
name="id"
diff --git a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsx
index 21f4db62cf..7aedfffc75 100644
--- a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypeForm/EquipmentTypeForm.tsx
@@ -68,7 +68,11 @@ const EquipmentTypeForm = ({
<Input name="name" label="Name" />
<TextArea name="description" label="Description" />
<Color name="color" label="Color" />
- <Ability name="requiredAbility" label="Required Ability" />
+ <Ability
+ name="requiredAbility"
+ label="Required Ability"
+ isClearable
+ />
</VStack>
</DrawerBody>
<DrawerFooter>
diff --git a/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsx
index 342d5b8792..b4d8037e67 100644
--- a/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypeForm/WorkCellTypeForm.tsx
@@ -68,7 +68,11 @@ const WorkCellTypeForm = ({
<Input name="name" label="Name" />
<TextArea name="description" label="Description" />
<Color name="color" label="Color" />
- <Ability name="requiredAbility" label="Required Ability" />
+ <Ability
+ name="requiredAbility"
+ label="Required Ability"
+ isClearable
+ />
</VStack>
</DrawerBody>
<DrawerFooter>
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerForm/CustomerForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerForm/CustomerForm.tsx
index 9bd001184f..fc5f52f0c0 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerForm/CustomerForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerForm/CustomerForm.tsx
@@ -10,7 +10,14 @@ import {
} from "@carbon/react";
import { Grid } from "@chakra-ui/react";
import { ValidatedForm } from "remix-validated-form";
-import { Employee, Hidden, Input, Select, Submit } from "~/components/Form";
+import {
+ Combobox,
+ Employee,
+ Hidden,
+ Input,
+ Select,
+ Submit,
+} from "~/components/Form";
import { usePermissions, useRouteData } from "~/hooks";
import type { CustomerStatus, CustomerType } from "~/modules/sales";
import { customerValidator } from "~/modules/sales";
@@ -79,7 +86,7 @@ const CustomerForm = ({ initialValues }: CustomerFormProps) => {
<Input name="taxId" label="Tax ID" />
</VStack>
<VStack>
- <Select
+ <Combobox
name="customerTypeId"
label="Customer Type"
options={customerTypeOptions}
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm/CustomerPaymentForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm/CustomerPaymentForm.tsx
index 34a254e8e6..b2277c42ac 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm/CustomerPaymentForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm/CustomerPaymentForm.tsx
@@ -69,7 +69,7 @@ const CustomerPaymentForm = ({ initialValues }: CustomerPaymentFormProps) => {
<Customer
name="invoiceCustomerId"
label="Invoice Customer"
- onChange={({ value }) => setCustomer(value as string)}
+ onChange={(value) => setCustomer(value?.value as string)}
/>
<CustomerLocation
name="invoiceCustomerLocationId"
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerShippingForm/CustomerShippingForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerShippingForm/CustomerShippingForm.tsx
index 953d80343f..e045848002 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerShippingForm/CustomerShippingForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerShippingForm/CustomerShippingForm.tsx
@@ -75,7 +75,7 @@ const CustomerShippingForm = ({ initialValues }: CustomerShippingFormProps) => {
<Customer
name="shippingCustomerId"
label="Shipping Customer"
- onChange={({ value }) => setCustomer(value as string)}
+ onChange={(value) => setCustomer(value?.value as string)}
/>
<CustomerLocation
name="shippingCustomerLocationId"
diff --git a/apps/carbon/app/routes/api+/accounting.accounts.ts b/apps/carbon/app/routes/api+/accounting.accounts.ts
index 5f5d800acd..05730e04eb 100644
--- a/apps/carbon/app/routes/api+/accounting.accounts.ts
+++ b/apps/carbon/app/routes/api+/accounting.accounts.ts
@@ -10,13 +10,13 @@ export async function loader({ request }: LoaderFunctionArgs) {
const searchParams = new URLSearchParams(url.search);
const type = searchParams.get("type");
const classes = searchParams.getAll("class");
+
const incomeBalance = searchParams.get("incomeBalance");
+ const result = await getAccountsList(authorized.client, {
+ type,
+ incomeBalance,
+ classes,
+ });
- return json(
- await getAccountsList(authorized.client, {
- type,
- incomeBalance,
- classes,
- })
- );
+ return json(result);
}
diff --git a/apps/carbon/app/routes/x+/part+/new.tsx b/apps/carbon/app/routes/x+/part+/new.tsx
index 90e371abac..389d7104d5 100644
--- a/apps/carbon/app/routes/x+/part+/new.tsx
+++ b/apps/carbon/app/routes/x+/part+/new.tsx
@@ -33,6 +33,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
const partId = createPart.data?.id;
+ if (!partId) throw new Error("Part ID not found");
return redirect(path.to.part(partId));
}
diff --git a/apps/carbon/app/routes/x+/person+/$personId.job.tsx b/apps/carbon/app/routes/x+/person+/$personId.job.tsx
index 11ea7b56b4..705c70c6c5 100644
--- a/apps/carbon/app/routes/x+/person+/$personId.job.tsx
+++ b/apps/carbon/app/routes/x+/person+/$personId.job.tsx
@@ -52,8 +52,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- console.log({ data: validation.data });
-
const updateJob = await upsertEmployeeJob(client, personId, validation.data);
if (updateJob.error) {
return redirect(
diff --git a/apps/carbon/app/routes/x+/person+/$personId.private.tsx b/apps/carbon/app/routes/x+/person+/$personId.private.tsx
index 8e93803106..fe564c2939 100644
--- a/apps/carbon/app/routes/x+/person+/$personId.private.tsx
+++ b/apps/carbon/app/routes/x+/person+/$personId.private.tsx
@@ -53,8 +53,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- console.log({ data: validation.data });
-
const updateJob = await upsertEmployeeJob(client, personId, validation.data);
if (updateJob.error) {
return redirect(
diff --git a/apps/carbon/app/routes/x+/person+/$personId.public.tsx b/apps/carbon/app/routes/x+/person+/$personId.public.tsx
index 638f98c815..f100d075e1 100644
--- a/apps/carbon/app/routes/x+/person+/$personId.public.tsx
+++ b/apps/carbon/app/routes/x+/person+/$personId.public.tsx
@@ -53,8 +53,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- console.log({ data: validation.data });
-
const updateJob = await upsertEmployeeJob(client, personId, validation.data);
if (updateJob.error) {
return redirect(
diff --git a/packages/react/src/Command.tsx b/packages/react/src/Command.tsx
index b13b285e8f..3d31164668 100644
--- a/packages/react/src/Command.tsx
+++ b/packages/react/src/Command.tsx
@@ -171,6 +171,46 @@ const CommandShortcut = ({
};
CommandShortcut.displayName = "CommandShortcut";
+const commandTriggerVariants = cva(
+ "bg-background flex w-full items-center justify-between whitespace-nowrap rounded-md border border-input shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
+ {
+ variants: {
+ size: {
+ lg: "h-12 px-4 py-3 rounded-lg text-base space-x-4",
+ md: "h-10 px-3 py-2 rounded-md text-base space-x-3",
+ sm: "h-8 px-3 py-2 rounded text-sm space-x-2",
+ },
+ },
+ defaultVariants: {
+ size: "md",
+ },
+ }
+);
+
+interface CommandTriggerProps
+ extends ComponentPropsWithoutRef<"button">,
+ VariantProps<typeof commandTriggerVariants> {}
+
+const CommandTrigger = forwardRef<ElementRef<"button">, CommandTriggerProps>(
+ ({ size, className, children, ...props }, ref) => (
+ <button
+ ref={ref}
+ className={cn(
+ commandTriggerVariants({
+ size,
+ }),
+ className
+ )}
+ {...props}
+ >
+ {children}
+
+ <MagnifyingGlassIcon className="h-4 w-4 opacity-50" />
+ </button>
+ )
+);
+CommandTrigger.displayName = "CommandTrigger";
+
export {
Command,
CommandDialog,
@@ -181,4 +221,5 @@ export {
CommandList,
CommandSeparator,
CommandShortcut,
+ CommandTrigger,
};
diff --git a/packages/react/src/ReactSelect/useSelectProps.ts b/packages/react/src/ReactSelect/useSelectProps.ts
index f536cb5ab8..e6bc466220 100644
--- a/packages/react/src/ReactSelect/useSelectProps.ts
+++ b/packages/react/src/ReactSelect/useSelectProps.ts
@@ -23,7 +23,6 @@ const useSelectProps = <
menuIsOpen,
...props
}: Props<Option, IsMulti, Group>): Props<Option, IsMulti, Group> => {
- console.log({ isReadOnly });
const inputProps = {
id: inputId,
disabled: isDisabled,
@@ -36,8 +35,6 @@ const useSelectProps = <
onBlur,
};
- console.log({ inputProps });
-
// Unless `menuIsOpen` is controlled, disable it if the select is readonly
const realMenuIsOpen =
menuIsOpen ?? (inputProps.readOnly ? false : undefined);
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index cdb427b806..caa22a3708 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -21,6 +21,7 @@ import {
CommandList,
CommandSeparator,
CommandShortcut,
+ CommandTrigger,
} from "./Command";
import { ContextMenu } from "./ContextMenu";
import { Count } from "./Count";
@@ -150,6 +151,7 @@ export {
CommandList,
CommandSeparator,
CommandShortcut,
+ CommandTrigger,
ContextMenu,
Count,
CreatableSelect,