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.

style: open bom/bop on click

Brad Barbin198e64578ef3
diff --git a/apps/carbon/app/components/Search/Search/Search.tsx b/apps/carbon/app/components/Layout/Topbar/Search.tsx
similarity index 100%
rename from apps/carbon/app/components/Search/Search/Search.tsx
rename to apps/carbon/app/components/Layout/Topbar/Search.tsx
diff --git a/apps/carbon/app/components/Layout/Topbar/Topbar.tsx b/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
index b62449f72f..586fcb40e3 100644
--- a/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/Topbar.tsx
@@ -1,11 +1,11 @@
import { HStack } from "@carbon/react";
-import { Search } from "~/components/Search";
import { usePermissions } from "~/hooks";
import AvatarMenu from "./AvatarMenu";
import Breadcrumbs from "./Breadcrumbs";
import CreateMenu from "./CreateMenu";
import HelpMenu from "./HelpMenu";
import ModeSwitcher from "./ModeSwitcher";
+import Search from "./Search";
const Topbar = () => {
const permissions = usePermissions();
diff --git a/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx b/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx
deleted file mode 100644
index 1176111815..0000000000
--- a/apps/carbon/app/components/Search/DebouncedInput/DebouncedInput.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import type { InputProps } from "@carbon/react";
-import { Input, useDebounce } from "@carbon/react";
-import { useState } from "react";
-import { useUrlParams } from "~/hooks";
-
-type DebounceInputProps = InputProps & {
- param: string;
-};
-
-const DebouncedInput = ({ param, ...props }: DebounceInputProps) => {
- const [params, setParams] = useUrlParams();
- const [query, setQuery] = useState(params.get(param) || "");
- const debounceQuery = useDebounce((q: string) => {
- setParams({ [param]: q });
- }, 500);
-
- return (
- <Input
- value={query}
- onChange={(e) => {
- setQuery(e.target.value);
- debounceQuery(e.target.value);
- }}
- className="w-[100px] sm:w-[200px]"
- {...props}
- />
- );
-};
-
-export default DebouncedInput;
diff --git a/apps/carbon/app/components/Search/DebouncedInput/index.ts b/apps/carbon/app/components/Search/DebouncedInput/index.ts
deleted file mode 100644
index acfe979284..0000000000
--- a/apps/carbon/app/components/Search/DebouncedInput/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import DebouncedInput from "./DebouncedInput";
-
-export default DebouncedInput;
diff --git a/apps/carbon/app/components/Search/Search/index.ts b/apps/carbon/app/components/Search/Search/index.ts
deleted file mode 100644
index c00d9e1f6d..0000000000
--- a/apps/carbon/app/components/Search/Search/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Search from "./Search";
-
-export default Search;
diff --git a/apps/carbon/app/components/Search/index.ts b/apps/carbon/app/components/Search/index.ts
deleted file mode 100644
index 8bbc11da43..0000000000
--- a/apps/carbon/app/components/Search/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import DebouncedInput from "./DebouncedInput";
-import Search from "./Search";
-
-export { DebouncedInput, Search };
diff --git a/apps/carbon/app/components/SearchFilter.tsx b/apps/carbon/app/components/SearchFilter.tsx
new file mode 100644
index 0000000000..94dc4eb74b
--- /dev/null
+++ b/apps/carbon/app/components/SearchFilter.tsx
@@ -0,0 +1,41 @@
+import type { InputProps } from "@carbon/react";
+import {
+ Input,
+ InputGroup,
+ InputLeftElement,
+ useDebounce,
+} from "@carbon/react";
+import { useState } from "react";
+import { LuSearch } from "react-icons/lu";
+import { useUrlParams } from "~/hooks";
+
+type SearchFilterProps = InputProps & {
+ param: string;
+};
+
+const SearchFilter = ({ param, size, ...props }: SearchFilterProps) => {
+ const [params, setParams] = useUrlParams();
+ const [query, setQuery] = useState(params.get(param) || "");
+ const debounceQuery = useDebounce((q: string) => {
+ setParams({ [param]: q });
+ }, 500);
+
+ return (
+ <InputGroup size={size}>
+ <InputLeftElement>
+ <LuSearch className="text-muted-foreground w-3.5 h-3.5" />
+ </InputLeftElement>
+ <Input
+ value={query}
+ onChange={(e) => {
+ setQuery(e.target.value);
+ debounceQuery(e.target.value);
+ }}
+ className="w-[100px] sm:w-[200px]"
+ {...props}
+ />
+ </InputGroup>
+ );
+};
+
+export default SearchFilter;
diff --git a/apps/carbon/app/components/SortableList.tsx b/apps/carbon/app/components/SortableList.tsx
index 18859541f6..799ce0bc56 100644
--- a/apps/carbon/app/components/SortableList.tsx
+++ b/apps/carbon/app/components/SortableList.tsx
@@ -24,6 +24,7 @@ interface SortableListItemProps<T> {
item: SortableItem<T>;
items: SortableItem<T>[];
order: number;
+ onSelectItem: (id: string) => void;
onToggleItem: (id: string) => void;
onRemoveItem: (id: string) => void;
renderExtra?: (item: SortableItem<T>) => React.ReactNode;
@@ -36,6 +37,7 @@ function SortableListItem<T>({
item,
items,
order,
+ onSelectItem,
onToggleItem,
onRemoveItem,
renderExtra,
@@ -113,7 +115,9 @@ function SortableListItem<T>({
{/* List Title */}
<div
key={`${item.checked}`}
- className="px-1 flex flex-grow truncate"
+ className="px-1 flex flex-grow truncate cursor-pointer"
+ role="button"
+ onClick={() => onSelectItem(item.id)}
>
<HStack className="w-full justify-between">
{typeof item.title === "string" ? (
diff --git a/apps/carbon/app/components/Table/components/TableHeader.tsx b/apps/carbon/app/components/Table/components/TableHeader.tsx
index 6509302cfc..03d61089cd 100644
--- a/apps/carbon/app/components/Table/components/TableHeader.tsx
+++ b/apps/carbon/app/components/Table/components/TableHeader.tsx
@@ -3,7 +3,7 @@ import type { Column, ColumnOrderState } from "@tanstack/react-table";
import { type ReactNode } from "react";
import { BsFillCheckCircleFill } from "react-icons/bs";
import { MdOutlineEditNote } from "react-icons/md";
-import { DebouncedInput } from "~/components/Search";
+import { SearchFilter } from "~/components";
import { useUrlParams } from "~/hooks";
import type { TableAction } from "../types";
import Actions from "./Actions";
@@ -57,7 +57,7 @@ const TableHeader = <T extends object>({
<HStack className="px-4 py-2 justify-between bg-card border-b border-border w-full">
<HStack>
{withSearch && (
- <DebouncedInput param="search" size="sm" placeholder="Search" />
+ <SearchFilter param="search" size="sm" placeholder="Search" />
)}
{!!filters?.length && <Filter filters={filters} />}
</HStack>
diff --git a/apps/carbon/app/components/index.ts b/apps/carbon/app/components/index.ts
index a1cf76b132..9a876a47ba 100644
--- a/apps/carbon/app/components/index.ts
+++ b/apps/carbon/app/components/index.ts
@@ -11,6 +11,7 @@ import FileDropzone from "./FileDropzone";
import Hyperlink from "./Hyperlink";
import Location from "./Location";
import New from "./New";
+import SearchFilter from "./SearchFilter";
import Select from "./Select";
import SupplierAvatar from "./SupplierAvatar";
import Table from "./Table";
@@ -31,6 +32,7 @@ export {
Hyperlink,
Location,
New,
+ SearchFilter,
Select,
SupplierAvatar,
Table,
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
index f72d3cacba..43bb2f355e 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -231,6 +231,7 @@ const BillOfMaterial = ({
order={order}
key={item.id}
isExpanded={isOpen}
+ onSelectItem={setSelectedItemId}
onToggleItem={onToggleItem}
onRemoveItem={onRemoveItem}
handleDrag={onCloseOnDrag}
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
index b587751104..3f1524f6e3 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -368,6 +368,7 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {
order={order}
key={item.id}
isExpanded={isOpen}
+ onSelectItem={setSelectedItemId}
onToggleItem={onToggleItem}
onRemoveItem={onRemoveItem}
handleDrag={onCloseOnDrag}
diff --git a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
index 321848846a..d4e1f18b57 100644
--- a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
@@ -45,7 +45,7 @@ const BoMExplorer = ({ itemType, methods, selectedId }: BoMExplorerProps) => {
selectedId,
// collapsedIds,
onSelectedIdChanged: () => {},
- estimatedRowHeight: () => 32,
+ estimatedRowHeight: () => 40,
parentRef,
filter: {
value: { text: filterText },
@@ -197,8 +197,10 @@ export default BoMExplorer;
function NodeText({ node }: { node: FlatTreeItem<Method> }) {
return (
- <div className="flex items-center gap-1">
- <span className="text-sm font-mono">{node.data.itemReadableId}</span>
+ <div className="flex flex-col items-start gap-0">
+ <span className="text-sm font-mono line-clamp-1">
+ {node.data.itemReadableId}
+ </span>
</div>
);
}
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 54fa9ec3e2..001005b01c 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -239,6 +239,7 @@ const QuoteBillOfMaterial = ({
order={order}
key={item.id}
isExpanded={isOpen}
+ onSelectItem={setSelectedItemId}
onToggleItem={onToggleItem}
onRemoveItem={onRemoveItem}
handleDrag={onCloseOnDrag}
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 03f7e77ec4..f2cab93f05 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -380,6 +380,7 @@ const QuoteBillOfProcess = ({
order={order}
key={item.id}
isExpanded={isOpen}
+ onSelectItem={setSelectedItemId}
onToggleItem={onToggleItem}
onRemoveItem={onRemoveItem}
handleDrag={onCloseOnDrag}
diff --git a/apps/carbon/app/routes/x+/scheduling+/kanban.tsx b/apps/carbon/app/routes/x+/scheduling+/kanban.tsx
index 209c1e6bc5..ec485ba625 100644
--- a/apps/carbon/app/routes/x+/scheduling+/kanban.tsx
+++ b/apps/carbon/app/routes/x+/scheduling+/kanban.tsx
@@ -12,9 +12,9 @@ import { useRevalidator } from "@remix-run/react";
import { HiOutlineAdjustmentsHorizontal } from "react-icons/hi2";
import { LuListFilter, LuRefreshCcw } from "react-icons/lu";
import { typedjson, useTypedLoaderData } from "remix-typedjson";
+import { SearchFilter } from "~/components";
import type { Column, DisplaySettings, Item } from "~/components/Kanban";
import { Kanban } from "~/components/Kanban";
-import { DebouncedInput } from "~/components/Search";
export async function loader({ request }: LoaderFunctionArgs) {
return typedjson({
@@ -200,7 +200,7 @@ export default function KanbanView() {
<div className="flex flex-col h-full max-h-full overflow-auto relative">
<HStack className="px-4 py-2 justify-between bg-card border-b border-border">
<HStack>
- <DebouncedInput param="search" size="sm" placeholder="Search" />
+ <SearchFilter param="search" size="sm" placeholder="Search" />
{/* <Filter filters={filters} /> */}
<Button
rightIcon={<LuListFilter />}