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: remove old code

Brad Barbin6a891534aee9
diff --git a/apps/carbon/app/components/TableOld/Table.tsx b/apps/carbon/app/components/TableOld/Table.tsx
deleted file mode 100644
index facefc90cf..0000000000
--- a/apps/carbon/app/components/TableOld/Table.tsx
+++ /dev/null
@@ -1,733 +0,0 @@
-import {
- ActionMenu,
- ContextMenu,
- ContextMenuContent,
- ContextMenuTrigger,
- Menu,
- Table as TableBase,
- Tbody,
- Th,
- Thead,
- Tr,
- VStack,
- cn,
- useEscape,
- useMount,
-} from "@carbon/react";
-import { clip } from "@carbon/utils";
-import type {
- ColumnDef,
- ColumnOrderState,
- ColumnPinningState,
- RowSelectionState,
-} from "@tanstack/react-table";
-import {
- flexRender,
- getCoreRowModel,
- useReactTable,
-} from "@tanstack/react-table";
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { FaSort, FaSortDown, FaSortUp } from "react-icons/fa";
-import type {
- EditableTableCellComponent,
- Position,
-} from "~/components/Editable";
-import {
- IndeterminateCheckbox,
- Pagination,
- Row,
- TableHeader,
- usePagination,
- useSort,
-} from "./components";
-import type { TableAction } from "./types";
-import { getAccessorKey, updateNestedProperty } from "./utils";
-
-interface TableProps<T extends object> {
- columns: ColumnDef<T>[];
- data: T[];
- actions?: TableAction<T>[];
- count?: number;
- defaultColumnOrder?: string[];
- defaultColumnPinning?: ColumnPinningState;
- defaultColumnVisibility?: Record<string, boolean>;
- editableComponents?: Record<string, EditableTableCellComponent<T>>;
- withColumnOrdering?: boolean;
- withInlineEditing?: boolean;
- withFilters?: boolean;
- withPagination?: boolean;
- withSelectableRows?: boolean;
- withSimpleSorting?: boolean;
- onSelectedRowsChange?: (selectedRows: T[]) => void;
- renderContextMenu?: (row: T) => JSX.Element | null;
-}
-
-const Table = <T extends object>({
- data,
- columns,
- actions = [],
- count = 0,
- editableComponents,
- defaultColumnOrder,
- defaultColumnPinning = {
- left: ["Select"],
- },
- defaultColumnVisibility,
- withFilters = false,
- withInlineEditing = false,
- withColumnOrdering = false,
- withPagination = true,
- withSelectableRows = false,
- withSimpleSorting = true,
- onSelectedRowsChange,
- renderContextMenu,
-}: TableProps<T>) => {
- const tableContainerRef = useRef<HTMLDivElement>(null);
-
- /* Data for Optimistic Updates */
- const [internalData, setInternalData] = useState<T[]>(data);
- useEffect(() => {
- setInternalData(data);
- }, [data]);
-
- /* Seletable Rows */
- const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
-
- /* Pagination */
- const pagination = usePagination(count, setRowSelection);
-
- /* Column Visibility */
- const [columnVisibility, setColumnVisibility] = useState(
- defaultColumnVisibility ?? {}
- );
-
- /* Column Ordering */
- const [columnOrder, setColumnOrder] = useState<ColumnOrderState>(
- defaultColumnOrder ?? []
- );
- const [columnPinning, setColumnPinning] = useState<ColumnPinningState>(
- withColumnOrdering ? defaultColumnPinning : {}
- );
-
- /* Sorting */
- const { isSorted, toggleSortBy } = useSort();
-
- const columnAccessors = useMemo(
- () =>
- columns.reduce<Record<string, string>>((acc, column) => {
- const accessorKey: string | undefined = getAccessorKey(column);
- if (accessorKey?.includes("_"))
- throw new Error(
- `Invalid accessorKey ${accessorKey}. Cannot contain '_'`
- );
- if (accessorKey && column.header && typeof column.header === "string") {
- return {
- ...acc,
- [accessorKey]: column.header,
- };
- }
- return acc;
- }, {}),
- [columns]
- );
-
- const internalColumns = useMemo(() => {
- let result: ColumnDef<T>[] = [];
- if (withSelectableRows) {
- result.push(...getRowSelectionColumn<T>());
- }
- result.push(...columns);
- if (renderContextMenu) {
- result.push(...getActionColumn<T>(renderContextMenu));
- }
- return result;
- }, [columns, renderContextMenu, withSelectableRows]);
-
- const table = useReactTable({
- data: internalData,
- columns: internalColumns,
- state: {
- columnVisibility,
- columnOrder,
- columnPinning,
- rowSelection,
- },
- onColumnVisibilityChange: setColumnVisibility,
- onColumnOrderChange: setColumnOrder,
- onColumnPinningChange: setColumnPinning,
- onRowSelectionChange: setRowSelection,
- getCoreRowModel: getCoreRowModel(),
- meta: {
- // These are not part of the standard API, but are accessible via table.options.meta
- editableComponents,
- updateData: (rowIndex, updates) => {
- setInternalData((previousData) =>
- previousData.map((row, index) => {
- if (index === rowIndex) {
- let newRow = { ...row };
- Object.entries(updates).forEach(([columnId, value]) => {
- if (columnId.includes("_") && !(columnId in newRow)) {
- updateNestedProperty(newRow, columnId, value);
- return newRow;
- } else {
- return {
- ...newRow,
- [columnId]: value,
- };
- }
- });
- return newRow;
- }
- return row;
- })
- );
- },
- },
- });
-
- const selectedRows = withSelectableRows
- ? table.getSelectedRowModel().flatRows.map((row) => row.original)
- : [];
-
- useEffect(() => {
- if (typeof onSelectedRowsChange === "function") {
- onSelectedRowsChange(selectedRows);
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [rowSelection, onSelectedRowsChange]);
-
- const [editMode, setEditMode] = useState(false);
- const [isEditing, setIsEditing] = useState(false);
- const [selectedCell, setSelectedCell] = useState<Position>(null);
-
- const focusOnSelectedCell = useCallback(() => {
- if (selectedCell == null) return;
- const cell = tableContainerRef.current?.querySelector(
- `[data-row="${selectedCell.row}"][data-column="${selectedCell.column}"]`
- ) as HTMLDivElement;
- if (cell) cell.focus();
- }, [selectedCell, tableContainerRef]);
-
- useEscape(() => {
- setIsEditing(false);
- focusOnSelectedCell();
- });
-
- const onSelectedCellChange = useCallback(
- (position: Position) => {
- if (
- selectedCell == null ||
- position == null ||
- selectedCell.row !== position?.row ||
- selectedCell.column !== position.column
- )
- setSelectedCell(position);
- },
- [selectedCell]
- );
-
- const isColumnEditable = useCallback(
- (selectedColumn: number) => {
- if (!withInlineEditing) return false;
-
- const tableColumns = [
- ...table.getLeftVisibleLeafColumns(),
- ...table.getCenterVisibleLeafColumns(),
- ];
-
- const column =
- tableColumns[withSelectableRows ? selectedColumn + 1 : selectedColumn];
- if (!column) return false;
-
- const accessorKey = getAccessorKey(column.columnDef);
- return (
- accessorKey && editableComponents && accessorKey in editableComponents
- );
- },
- [table, editableComponents, withInlineEditing, withSelectableRows]
- );
-
- const onCellClick = useCallback(
- (row: number, column: number) => {
- // ignore row select checkbox column
- if (
- selectedCell?.row === row &&
- selectedCell?.column === column &&
- isColumnEditable(column)
- ) {
- setIsEditing(true);
- return;
- }
- // ignore row select checkbox column
- if (column === -1) return;
- setIsEditing(false);
- onSelectedCellChange({ row, column });
- },
- [selectedCell, isColumnEditable, onSelectedCellChange]
- );
-
- const onCellUpdate = useCallback(
- (rowIndex: number) => (updates: Record<string, unknown>) =>
- table.options.meta?.updateData
- ? table.options.meta?.updateData(rowIndex, updates)
- : undefined,
- [table]
- );
-
- const onKeyDown = useCallback(
- (event: React.KeyboardEvent<HTMLDivElement>) => {
- if (!selectedCell) return;
-
- const { code, shiftKey } = event;
-
- const commandCodes: {
- [key: string]: [number, number];
- } = {
- Tab: [0, 1],
- Enter: [1, 0],
- };
-
- const navigationCodes: {
- [key: string]: [number, number];
- } = {
- ArrowRight: [0, 1],
- ArrowLeft: [0, -1],
- ArrowDown: [1, 0],
- ArrowUp: [-1, 0],
- };
-
- const lastRow = table.getRowModel().rows.length - 1;
- const lastColumn =
- table.getVisibleLeafColumns().length - 1 - (withSelectableRows ? 1 : 0);
-
- const navigate = (
- delta: [number, number],
- tabWrap = false
- ): [number, number] => {
- const x0 = selectedCell?.column || 0;
- const y0 = selectedCell?.row || 0;
-
- let x1 = x0 + delta[1];
- let y1 = y0 + delta[0];
-
- if (tabWrap) {
- if (delta[1] > 0) {
- // wrap to the next row if we're on the last column
- if (x1 > lastColumn) {
- x1 = 0;
- y1 += 1;
- }
- // don't wrap to the next row if we're on the last row
- if (y1 > lastRow) {
- x1 = x0;
- y1 = y0;
- }
- } else {
- // reverse tab wrap
- if (x1 < 0) {
- x1 = lastColumn;
- y1 -= 1;
- }
-
- if (y1 < 0) {
- x1 = x0;
- y1 = y0;
- }
- }
- } else {
- x1 = clip(x1, 0, lastColumn);
- }
-
- y1 = clip(y1, 0, lastRow);
-
- return [x1, y1];
- };
-
- if (code in commandCodes) {
- event.preventDefault();
-
- if (
- !isEditing &&
- code === "Enter" &&
- !shiftKey &&
- isColumnEditable(selectedCell.column)
- ) {
- setIsEditing(true);
- return;
- }
-
- let direction = commandCodes[code];
- if (shiftKey) direction = [-direction[0], -direction[1]];
- const [x1, y1] = navigate(direction, code === "Tab");
- setSelectedCell({
- row: y1,
- column: x1,
- });
- if (isEditing) {
- setIsEditing(false);
- }
- } else if (code in navigationCodes) {
- // arrow key navigation should't work if we're editing
- if (isEditing) return;
- event.preventDefault();
- const [x1, y1] = navigate(navigationCodes[code], code === "Tab");
- setIsEditing(false);
- setSelectedCell({
- row: y1,
- column: x1,
- });
- // any other key (besides shift) activates editing
- // if the column is editable and a cell is selected
- } else if (
- !["ShiftLeft", "ShiftRight"].includes(code) &&
- !isEditing &&
- selectedCell &&
- isColumnEditable(selectedCell.column)
- ) {
- setIsEditing(true);
- }
- },
- [
- isColumnEditable,
- isEditing,
- selectedCell,
- setSelectedCell,
- table,
- withSelectableRows,
- ]
- );
-
- // reset the selected cell when the table data changes
- useEffect(() => {
- setSelectedCell(null);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [
- editMode,
- pagination.pageIndex,
- pagination.pageSize,
- columnOrder,
- columnVisibility,
- ]);
-
- useMount(() => {
- setColumnOrder(table.getAllLeafColumns().map((column) => column.id));
- });
-
- const rows = table.getRowModel().rows;
-
- return (
- <VStack spacing={0} className="h-full">
- {(withColumnOrdering ||
- withFilters ||
- withSelectableRows ||
- withInlineEditing) && (
- <TableHeader
- actions={actions}
- columnAccessors={columnAccessors}
- columnOrder={columnOrder}
- columns={table.getAllLeafColumns()}
- editMode={editMode}
- selectedRows={selectedRows}
- setColumnOrder={setColumnOrder}
- setEditMode={setEditMode}
- pagination={pagination}
- withInlineEditing={withInlineEditing}
- withColumnOrdering={withColumnOrdering}
- withFilters={withFilters}
- withPagination={withPagination}
- withSelectableRows={withSelectableRows}
- />
- )}
- <div
- className="w-full h-full bg-card overflow-scroll"
- style={{ contain: "strict" }}
- ref={tableContainerRef}
- onKeyDown={editMode ? onKeyDown : undefined}
- >
- <div
- className={cn(
- "grid w-full",
- withColumnOrdering ? "grid-cols-[auto_1fr]" : "grid-cols-1"
- )}
- >
- {/* Pinned left columns */}
- {withColumnOrdering ? (
- <TableBase className="bg-background border-r-4 border-border sticky left-0 z-50">
- <Thead>
- {table.getLeftHeaderGroups().map((headerGroup) => (
- <Tr key={headerGroup.id} className="h-10">
- {headerGroup.headers.map((header) => {
- const accessorKey = getAccessorKey(
- header.column.columnDef
- );
- const sortable =
- withSimpleSorting &&
- accessorKey &&
- !accessorKey.endsWith(".id") &&
- header.column.columnDef.enableSorting !== false;
-
- const sorted = isSorted(accessorKey ?? "");
-
- return (
- <Th
- key={header.id}
- // layout
- onClick={
- sortable && !editMode
- ? () => toggleSortBy(accessorKey ?? "")
- : undefined
- }
- className={cn(
- "px-4 py-2 whitespace-nowrap",
- editMode && "cursor-pointer border-r border-border"
- )}
- colSpan={header.colSpan}
- >
- {header.isPlaceholder ? null : (
- <div className="flex justify-start items-center text-xs text-muted-foreground">
- {flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
- <span className="pl-4">
- {sorted ? (
- sorted === -1 ? (
- <FaSortDown aria-label="sorted descending" />
- ) : (
- <FaSortUp aria-label="sorted ascending" />
- )
- ) : sortable ? (
- <FaSort aria-label="sort" />
- ) : null}
- </span>
- </div>
- )}
- </Th>
- );
- })}
- </Tr>
- ))}
- </Thead>
- <Tbody>
- {rows.map((row) => {
- return renderContextMenu ? (
- <Menu type="context" key={row.index}>
- <ContextMenu>
- <ContextMenuTrigger asChild>
- <Row
- editableComponents={editableComponents}
- isEditing={isEditing}
- isEditMode={editMode}
- isFrozenColumn
- isRowSelected={
- row.index in rowSelection &&
- !!rowSelection[row.index]
- }
- selectedCell={selectedCell}
- row={row}
- rowIsSelected={selectedCell?.row === row.index}
- withColumnOrdering={withColumnOrdering}
- onCellClick={onCellClick}
- onCellUpdate={onCellUpdate}
- />
- </ContextMenuTrigger>
- <ContextMenuContent className="w-128">
- {renderContextMenu(row.original)}
- </ContextMenuContent>
- </ContextMenu>
- </Menu>
- ) : (
- <Row
- key={row.id}
- editableComponents={editableComponents}
- isEditing={isEditing}
- isEditMode={editMode}
- isFrozenColumn
- isRowSelected={
- row.index in rowSelection && !!rowSelection[row.index]
- }
- selectedCell={selectedCell}
- row={row}
- rowIsSelected={selectedCell?.row === row.index}
- withColumnOrdering={withColumnOrdering}
- onCellClick={onCellClick}
- onCellUpdate={onCellUpdate}
- />
- );
- })}
- </Tbody>
- </TableBase>
- ) : null}
-
- {/* Unpinned columns */}
- <TableBase>
- <Thead>
- {(withColumnOrdering
- ? table.getCenterHeaderGroups()
- : table.getHeaderGroups()
- ).map((headerGroup) => (
- <Tr key={headerGroup.id} className="h-10">
- {headerGroup.headers.map((header) => {
- const accessorKey = getAccessorKey(header.column.columnDef);
-
- const sortable =
- withSimpleSorting &&
- accessorKey &&
- !accessorKey.endsWith(".id") &&
- header.column.columnDef.enableSorting !== false;
- const sorted = isSorted(accessorKey ?? "");
-
- return (
- <Th
- key={header.id}
- colSpan={header.colSpan}
- onClick={
- sortable
- ? () => toggleSortBy(accessorKey ?? "")
- : undefined
- }
- className={cn(
- "px-4 py-3 whitespace-nowrap",
- editMode && "border-r-1 border-border",
- sortable && "cursor-pointer"
- )}
- style={{ width: header.getSize() }}
- >
- {header.isPlaceholder ? null : (
- <div className="flex justify-start items-center text-xs text-muted-foreground">
- {flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
- <span className="pl-4">
- {sorted ? (
- sorted === -1 ? (
- <FaSortDown aria-label="sorted descending" />
- ) : (
- <FaSortUp aria-label="sorted ascending" />
- )
- ) : sortable ? (
- <FaSort
- aria-label="sort"
- style={{ opacity: 0.4 }}
- />
- ) : null}
- </span>
- </div>
- )}
- </Th>
- );
- })}
- </Tr>
- ))}
- </Thead>
- <Tbody>
- {rows.map((row) => {
- return renderContextMenu ? (
- <Menu type="context" key={row.index}>
- <ContextMenu>
- <ContextMenuTrigger asChild>
- <Row
- editableComponents={editableComponents}
- isEditing={isEditing}
- isEditMode={editMode}
- isRowSelected={
- row.index in rowSelection &&
- !!rowSelection[row.index]
- }
- pinnedColumns={
- columnPinning?.left
- ? columnPinning.left?.length -
- (withSelectableRows ? 1 : 0)
- : 0
- }
- selectedCell={selectedCell}
- row={row}
- rowIsSelected={selectedCell?.row === row.index}
- withColumnOrdering={withColumnOrdering}
- onCellClick={onCellClick}
- onCellUpdate={onCellUpdate}
- />
- </ContextMenuTrigger>
- <ContextMenuContent className="w-128">
- {renderContextMenu(row.original)}
- </ContextMenuContent>
- </ContextMenu>
- </Menu>
- ) : (
- <Row
- key={row.id}
- editableComponents={editableComponents}
- isEditing={isEditing}
- isEditMode={editMode}
- isRowSelected={
- row.index in rowSelection && !!rowSelection[row.index]
- }
- pinnedColumns={
- columnPinning?.left
- ? columnPinning.left?.length -
- (withSelectableRows ? 1 : 0)
- : 0
- }
- selectedCell={selectedCell}
- row={row}
- rowIsSelected={selectedCell?.row === row.index}
- withColumnOrdering={withColumnOrdering}
- onCellClick={onCellClick}
- onCellUpdate={onCellUpdate}
- />
- );
- })}
- </Tbody>
- </TableBase>
- </div>
- </div>
- {withPagination && <Pagination {...pagination} />}
- </VStack>
- );
-};
-
-function getRowSelectionColumn<T>(): ColumnDef<T>[] {
- return [
- {
- id: "Select",
- size: 40,
- header: ({ table }) => (
- <IndeterminateCheckbox
- {...{
- checked: table.getIsAllRowsSelected(),
- indeterminate: table.getIsSomeRowsSelected(),
- onChange: table.getToggleAllRowsSelectedHandler(),
- }}
- />
- ),
- cell: ({ row }) => (
- <IndeterminateCheckbox
- {...{
- checked: row.getIsSelected(),
- indeterminate: row.getIsSomeSelected(),
- onChange: row.getToggleSelectedHandler(),
- }}
- />
- ),
- },
- ];
-}
-
-function getActionColumn<T>(
- renderContextMenu: (item: T) => JSX.Element | null
-): ColumnDef<T>[] {
- return [
- {
- id: "Actions",
- header: () => <span className="sr-only">Actions</span>,
- cell: (item) => (
- <div className="flex justify-end">
- <ActionMenu>{renderContextMenu(item.row.original)}</ActionMenu>
- </div>
- ),
- },
- ];
-}
-
-export default Table;
diff --git a/apps/carbon/app/components/TableOld/components/Actions.tsx b/apps/carbon/app/components/TableOld/components/Actions.tsx
deleted file mode 100644
index 8de66cbf35..0000000000
--- a/apps/carbon/app/components/TableOld/components/Actions.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuIcon,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@carbon/react";
-import { IoMdCheckboxOutline } from "react-icons/io";
-import type { TableAction } from "../types";
-
-type ActionsProps<T> = {
- actions: TableAction<T>[];
- selectedRows: T[];
-};
-
-const Actions = <T extends Object>({
- actions,
- selectedRows,
-}: ActionsProps<T>) => {
- const disabled = selectedRows.length === 0;
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button leftIcon={<IoMdCheckboxOutline />} variant="ghost">
- Actions
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="w-48">
- {actions.map((action) => (
- <DropdownMenuItem
- key={action.label}
- onClick={() => action.onClick(selectedRows)}
- disabled={disabled || action.disabled}
- >
- {action.icon && <DropdownMenuIcon icon={action.icon} />}
- {action.label}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- );
-};
-
-export default Actions;
diff --git a/apps/carbon/app/components/TableOld/components/Animations.tsx b/apps/carbon/app/components/TableOld/components/Animations.tsx
deleted file mode 100644
index e328843c10..0000000000
--- a/apps/carbon/app/components/TableOld/components/Animations.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Td as TdBase, Th as ThBase, Tr as TrBase } from "@carbon/react";
-import { motion } from "framer-motion";
-
-export const spring = {
- type: "spring",
- damping: 10,
- stiffness: 30,
-};
-
-export const Th = motion(ThBase);
-export const Tr = motion(TrBase);
-export const Td = motion(TdBase);
diff --git a/apps/carbon/app/components/TableOld/components/Cell.tsx b/apps/carbon/app/components/TableOld/components/Cell.tsx
deleted file mode 100644
index 55420cad00..0000000000
--- a/apps/carbon/app/components/TableOld/components/Cell.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import { Td, cn } from "@carbon/react";
-import type { Cell as CellType } from "@tanstack/react-table";
-import { flexRender } from "@tanstack/react-table";
-import { memo, useState } from "react";
-import type { EditableTableCellComponent } from "~/components/Editable";
-import { useMovingCellRef } from "~/hooks";
-import { getAccessorKey } from "../utils";
-
-type CellProps<T> = {
- cell: CellType<T, unknown>;
- columnIndex: number;
- editableComponents?: Record<string, EditableTableCellComponent<T>>;
- editedCells?: string[];
- isEditing: boolean;
- isEditMode: boolean;
- isRowSelected: boolean;
- isSelected: boolean;
- onClick?: () => void;
- onUpdate?: (updates: Record<string, unknown>) => void;
-};
-
-const Cell = <T extends object>({
- cell,
- columnIndex,
- editableComponents,
- editedCells,
- isEditing,
- isEditMode,
- isSelected,
- onClick,
- onUpdate,
-}: CellProps<T>) => {
- const { ref, tabIndex, onFocus } = useMovingCellRef(isSelected);
- const [hasError, setHasError] = useState(false);
- const accessorKey = getAccessorKey(cell.column.columnDef);
-
- const wasEdited =
- !!editedCells && !!accessorKey && editedCells.includes(accessorKey);
-
- const hasEditableTableCellComponent =
- accessorKey !== undefined &&
- editableComponents &&
- accessorKey in editableComponents;
-
- const editableCell = hasEditableTableCellComponent
- ? editableComponents[accessorKey]
- : null;
-
- return (
- <Td
- className={cn(
- "relative px-4 whitespace-nowrap text-sm outline-none",
- wasEdited && "bg-yellow-100 dark:bg-yellow-900",
- isEditing && !hasEditableTableCellComponent && "bg-muted/50",
- isEditMode && "border-border border-r",
- hasError && "ring-inset ring-2 ring-red-500",
- isSelected && "ring-inset ring-2 ring-ring"
- )}
- ref={ref}
- data-row={cell.row.index}
- data-column={columnIndex}
- tabIndex={tabIndex}
- onClick={onClick}
- onFocus={onFocus}
- >
- {isSelected && isEditing && hasEditableTableCellComponent ? (
- <div className="mx-[-0.65rem] my-[-0.25rem]">
- {hasEditableTableCellComponent
- ? flexRender(editableCell, {
- accessorKey,
- value: cell.renderValue(),
- row: cell.row.original,
- onUpdate: onUpdate
- ? onUpdate
- : () => console.error("No update function provided"),
- onError: () => {
- setHasError(true);
- },
- })
- : null}
- </div>
- ) : (
- <div ref={ref}>
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- </div>
- )}
- </Td>
- );
-};
-
-const MemoizedCell = memo(
- Cell,
- (prev, next) =>
- next.isRowSelected === prev.isRowSelected &&
- next.isSelected === prev.isSelected &&
- next.isEditing === prev.isEditing &&
- next.isEditMode === prev.isEditMode &&
- next.cell.getValue() === prev.cell.getValue() &&
- next.cell.getContext() === prev.cell.getContext()
-) as typeof Cell;
-
-export default MemoizedCell;
diff --git a/apps/carbon/app/components/TableOld/components/Columns.tsx b/apps/carbon/app/components/TableOld/components/Columns.tsx
deleted file mode 100644
index 4ec8728807..0000000000
--- a/apps/carbon/app/components/TableOld/components/Columns.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import {
- Button,
- HStack,
- IconButton,
- Popover,
- PopoverContent,
- PopoverHeader,
- PopoverTrigger,
-} from "@carbon/react";
-import type { Column, ColumnOrderState } from "@tanstack/react-table";
-import { Reorder } from "framer-motion";
-import {
- BsEyeFill,
- BsEyeSlash,
- BsLayoutThreeColumns,
- BsPin,
- BsPinFill,
-} from "react-icons/bs";
-import { MdOutlineDragIndicator } from "react-icons/md";
-
-type ColumnsProps<T> = {
- columns: Column<T, unknown>[];
- columnOrder: ColumnOrderState;
- withSelectableRows: boolean;
- setColumnOrder: (newOrder: ColumnOrderState) => void;
-};
-
-const Columns = <T extends object>({
- columns,
- columnOrder,
- withSelectableRows,
- setColumnOrder,
-}: ColumnsProps<T>) => {
- return (
- <Popover>
- <PopoverTrigger asChild>
- <Button variant="ghost" leftIcon={<BsLayoutThreeColumns />}>
- Columns
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-96">
- <PopoverHeader>
- <p className="text-sm">Edit column view</p>
- <p className="text-xs text-muted-foreground">
- Manage and reorder columns
- </p>
- </PopoverHeader>
-
- <div className="max-h-48 overflow-y-auto">
- <Reorder.Group
- axis="y"
- values={columnOrder}
- onReorder={(newOrder: ColumnOrderState) => {
- if (withSelectableRows) newOrder.unshift("select");
- setColumnOrder(newOrder);
- }}
- className="space-y-2"
- >
- {columns.reduce<JSX.Element[]>((acc, column) => {
- if (isColumnToggable(column))
- acc.push(
- <Reorder.Item
- key={column.id}
- value={column.id}
- className="rounded-lg"
- >
- <HStack>
- <IconButton
- aria-label="Drag handle"
- icon={<MdOutlineDragIndicator />}
- variant="ghost"
- />
- <span className="text-sm flex-grow">
- <>{column.columnDef.header}</>
- </span>
- <IconButton
- aria-label="Toggle column"
- icon={column.getIsPinned() ? <BsPinFill /> : <BsPin />}
- onClick={(e) => {
- if (column.getIsPinned()) {
- column.pin(false);
- } else {
- column.pin("left");
- // when a column is pinned, we assure that it's visible
- if (!column.getIsVisible()) {
- column.getToggleVisibilityHandler()(e);
- }
- }
- }}
- variant="ghost"
- />
- <IconButton
- aria-label="Toggle column"
- icon={
- column.getIsVisible() ? <BsEyeFill /> : <BsEyeSlash />
- }
- onClick={column.getToggleVisibilityHandler()}
- variant="ghost"
- />
- </HStack>
- </Reorder.Item>
- );
- return acc;
- }, [])}
- </Reorder.Group>
- </div>
- </PopoverContent>
- </Popover>
- );
-};
-
-function isColumnToggable<T>(column: Column<T, unknown>): boolean {
- return (
- column.columnDef.id !== "select" &&
- typeof column.columnDef.header === "string" &&
- column.columnDef.header !== ""
- );
-}
-
-export default Columns;
diff --git a/apps/carbon/app/components/TableOld/components/Filter/Filter.tsx b/apps/carbon/app/components/TableOld/components/Filter/Filter.tsx
deleted file mode 100644
index b82408589b..0000000000
--- a/apps/carbon/app/components/TableOld/components/Filter/Filter.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import {
- Button,
- Popover,
- PopoverContent,
- PopoverFooter,
- PopoverHeader,
- PopoverTrigger,
- VStack,
-} from "@carbon/react";
-import { BsFilter, BsPlus } from "react-icons/bs";
-import { useUrlParams } from "~/hooks";
-import FilterRow from "./FilterRow";
-
-type FilterProps = {
- columnAccessors: Record<string, string>;
-};
-
-const Filter = ({ columnAccessors }: FilterProps) => {
- const [params, setParams] = useUrlParams();
- const filters = params.getAll("filter");
-
- const addFilter = () => {
- const defaultFilter = `${Object.keys(columnAccessors)[0]}:contains:`;
- setParams({ filter: filters.concat(defaultFilter) });
- };
-
- const removeFilter = (filterIndex: number) => {
- setParams({
- filter: filters.filter((_, index) => index !== filterIndex),
- });
- };
-
- const updateFilter = (filterIndex: number, newFilter: string) => {
- setParams({
- filter: filters.map((filter, index) =>
- index === filterIndex ? newFilter : filter
- ),
- });
- };
-
- return (
- <Popover>
- <PopoverTrigger asChild>
- <Button
- variant={filters.length === 0 ? "ghost" : "primary"}
- leftIcon={<BsFilter />}
- >
- {filters.length === 0 ? "Filter" : "Filtered"}
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-[520px]">
- {filters.length === 0 && (
- <PopoverHeader>
- <p className="text-sm">No filters applied to this view</p>
- <p className="text-xs text-muted-foreground">
- Add a column below to sort the view
- </p>
- </PopoverHeader>
- )}
-
- {filters.length > 0 && (
- <VStack>
- {filters.reduce<JSX.Element[]>((acc, filter, index) => {
- const [column, operator, searchValue] = filter.split(":");
- if (!column || !operator) return acc;
- acc.push(
- <FilterRow
- key={`filter-${column}-${[index]}`}
- column={column}
- columnAccessors={columnAccessors}
- operator={operator}
- searchValue={searchValue}
- onRemove={() => removeFilter(index)}
- onUpdate={(newFilter) => updateFilter(index, newFilter)}
- />
- );
- return acc;
- }, [])}
- </VStack>
- )}
- <PopoverFooter>
- <Button variant="secondary" leftIcon={<BsPlus />} onClick={addFilter}>
- Add Filter
- </Button>
- </PopoverFooter>
- </PopoverContent>
- </Popover>
- );
-};
-
-export default Filter;
diff --git a/apps/carbon/app/components/TableOld/components/Filter/FilterRow.tsx b/apps/carbon/app/components/TableOld/components/Filter/FilterRow.tsx
deleted file mode 100644
index 8d697c9b2b..0000000000
--- a/apps/carbon/app/components/TableOld/components/Filter/FilterRow.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { IconButton, Input, useDebounce } from "@carbon/react";
-import { useEffect, useState } from "react";
-import { IoMdClose } from "react-icons/io";
-import { Select } from "~/components";
-import { filterOperatorLabels } from "~/utils/query";
-
-type FilterRowProps = {
- column: string;
- columnAccessors: Record<string, string>;
- operator: string;
- searchValue: string;
- onRemove: () => void;
- onUpdate: (newFilter: string) => void;
-};
-
-const FilterRow = ({
- column,
- columnAccessors,
- operator,
- searchValue,
- onRemove,
- onUpdate,
-}: FilterRowProps) => {
- const [value, setValue] = useState(searchValue || "");
- const [debouncedQuery] = useDebounce(value, 500);
-
- useEffect(() => {
- const newFilter = `${column}:${operator}:${debouncedQuery}`;
- onUpdate(newFilter);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [debouncedQuery]);
-
- const onColumnChange = (value: string) => {
- const newFilter = `${value}:${operator}:${searchValue}`;
- onUpdate(newFilter);
- };
-
- const onOperatorChange = (value: string) => {
- const newFilter = `${column}:${value}:${searchValue}`;
- onUpdate(newFilter);
- };
-
- return (
- <div className="grid gap-x-2 grid-cols-[1fr_1fr_1fr_auto]">
- <Select
- size="sm"
- defaultValue={column}
- placeholder="Column"
- onChange={onColumnChange}
- options={Object.entries(columnAccessors).map(([accessor, title]) => ({
- label: title,
- value: accessor,
- }))}
- className="w-[100px]"
- />
- <Select
- size="sm"
- placeholder="Operator"
- defaultValue={operator}
- onChange={onOperatorChange}
- options={filterOperatorLabels.map(({ operator, label }) => ({
- label,
- value: operator,
- }))}
- className="w-[100px]"
- />
- <Input
- defaultValue={searchValue}
- onChange={(e) => setValue(e.target.value)}
- size="sm"
- placeholder="Value"
- />
- <IconButton
- aria-label="Remove filter"
- icon={<IoMdClose />}
- onClick={onRemove}
- variant="ghost"
- />
- </div>
- );
-};
-
-export default FilterRow;
diff --git a/apps/carbon/app/components/TableOld/components/Filter/index.ts b/apps/carbon/app/components/TableOld/components/Filter/index.ts
deleted file mode 100644
index 0cea50296e..0000000000
--- a/apps/carbon/app/components/TableOld/components/Filter/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Filter from "./Filter";
-
-export default Filter;
diff --git a/apps/carbon/app/components/TableOld/components/IndeterminateCheckbox.tsx b/apps/carbon/app/components/TableOld/components/IndeterminateCheckbox.tsx
deleted file mode 100644
index bd4faf3360..0000000000
--- a/apps/carbon/app/components/TableOld/components/IndeterminateCheckbox.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Checkbox } from "@carbon/react";
-import type { MouseEvent } from "react";
-
-type IndeterminateCheckboxProps = {
- checked: boolean;
- indeterminate: boolean;
- onChange: (e: MouseEvent<HTMLInputElement>) => void;
- [key: string]: any;
-};
-
-const IndeterminateCheckbox = ({
- indeterminate,
- checked,
- onChange,
- ...rest
-}: IndeterminateCheckboxProps) => {
- const handleChange = (checked: boolean) => {
- onChange({
- target: { checked },
- } as unknown as MouseEvent<HTMLInputElement>);
- };
-
- return (
- <Checkbox
- isChecked={!!checked || !!indeterminate}
- isIndeterminate={indeterminate}
- className="ml-2"
- onCheckedChange={handleChange}
- {...rest}
- >
- <span className="sr-only">Select Row</span>
- </Checkbox>
- );
-};
-
-IndeterminateCheckbox.displayName = "IndeterminateCheckbox";
-
-export default IndeterminateCheckbox;
diff --git a/apps/carbon/app/components/TableOld/components/Pagination/Pagination.tsx b/apps/carbon/app/components/TableOld/components/Pagination/Pagination.tsx
deleted file mode 100644
index 09e7fff041..0000000000
--- a/apps/carbon/app/components/TableOld/components/Pagination/Pagination.tsx
+++ /dev/null
@@ -1,182 +0,0 @@
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuLabel,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
- HStack,
- IconButton,
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
- useKeyboardShortcuts,
-} from "@carbon/react";
-import { useRef } from "react";
-import { BsChevronLeft, BsChevronRight } from "react-icons/bs";
-
-export type PaginationProps = {
- count: number;
- offset: number;
- pageIndex: number;
- pageSize: number;
- canPreviousPage: boolean;
- canNextPage: boolean;
- pageCount: number;
- gotoPage: (page: number) => void;
- nextPage: () => void;
- previousPage: () => void;
- setPageSize: (size: number) => void;
-};
-
-const Pagination = (props: PaginationProps) => {
- const { pageSize, setPageSize } = props;
-
- const pageSizes = [15, 25, 50, 100];
- const pageSizeLabel = "results per page";
- if (!pageSizes.includes(pageSize)) {
- pageSizes.push(pageSize);
- pageSizes.sort();
- }
-
- return (
- <HStack
- className="text-center bg-background border-t border-border justify-between px-4 py-2 w-full z-[1]"
- spacing={6}
- >
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost">
- {pageSize} {pageSizeLabel}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="w-48">
- <DropdownMenuLabel>Results per page</DropdownMenuLabel>
- <DropdownMenuSeparator />
- <DropdownMenuRadioGroup value={`${pageSize}`}>
- {pageSizes.map((size) => (
- <DropdownMenuRadioItem
- key={`${size}`}
- value={`${size}`}
- onClick={() => {
- setPageSize(size);
- }}
- >
- {size} {pageSizeLabel}
- </DropdownMenuRadioItem>
- ))}
- </DropdownMenuRadioGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- <HStack>
- <PaginationButtons {...props} />
- </HStack>
- </HStack>
- );
-};
-
-export const PaginationButtons = ({
- condensed = false,
- canNextPage,
- canPreviousPage,
- count,
- nextPage,
- offset,
- pageSize,
- previousPage,
-}: PaginationProps & { condensed?: boolean }) => {
- const nextButtonRef = useRef<HTMLButtonElement>(null);
- const previousButtonRef = useRef<HTMLButtonElement>(null);
-
- useKeyboardShortcuts({
- j: (event: KeyboardEvent) => {
- event.stopPropagation();
- nextButtonRef.current?.click();
- },
- f: (event: KeyboardEvent) => {
- event.stopPropagation();
- previousButtonRef.current?.click();
- },
- });
-
- return (
- <>
- {condensed ? (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger>
- <IconButton
- aria-label="Previous"
- icon={<BsChevronLeft />}
- isDisabled={!canPreviousPage}
- onClick={previousPage}
- variant="secondary"
- />
- </TooltipTrigger>
- <TooltipContent>
- <HStack>F</HStack>
- </TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger>
- <IconButton
- aria-label="Next"
- icon={<BsChevronRight />}
- isDisabled={!canNextPage}
- onClick={nextPage}
- variant="secondary"
- />
- </TooltipTrigger>
- <TooltipContent>
- <HStack>J</HStack>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- ) : (
- <TooltipProvider>
- <div className="text-foreground flex text-sm font-medium align-center">
- {count > 0 ? offset + 1 : 0} - {Math.min(offset + pageSize, count)}{" "}
- of {count}
- </div>
- <Tooltip>
- <TooltipTrigger>
- <Button
- ref={previousButtonRef}
- variant="secondary"
- isDisabled={!canPreviousPage}
- onClick={previousPage}
- leftIcon={<BsChevronLeft />}
- >
- Previous
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <HStack>F</HStack>
- </TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger>
- <Button
- ref={nextButtonRef}
- variant="secondary"
- isDisabled={!canNextPage}
- onClick={nextPage}
- rightIcon={<BsChevronRight />}
- >
- Next
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <HStack>J</HStack>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
- </>
- );
-};
-
-export default Pagination;
diff --git a/apps/carbon/app/components/TableOld/components/Pagination/index.ts b/apps/carbon/app/components/TableOld/components/Pagination/index.ts
deleted file mode 100644
index 6b12b9ba4d..0000000000
--- a/apps/carbon/app/components/TableOld/components/Pagination/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import Pagination, { PaginationButtons } from "./Pagination";
-import type { PaginationProps } from "./Pagination";
-import { usePagination } from "./usePagination";
-
-export { Pagination, PaginationButtons, usePagination };
-export type { PaginationProps };
diff --git a/apps/carbon/app/components/TableOld/components/Pagination/usePagination.tsx b/apps/carbon/app/components/TableOld/components/Pagination/usePagination.tsx
deleted file mode 100644
index fc04a6bc20..0000000000
--- a/apps/carbon/app/components/TableOld/components/Pagination/usePagination.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import type { RowSelectionState } from "@tanstack/react-table";
-import type { Dispatch, SetStateAction } from "react";
-import { flushSync } from "react-dom";
-import { useUrlParams } from "~/hooks";
-import { parseNumberFromUrlParam } from "~/utils/http";
-
-export function usePagination(
- count: number,
- setRowSelections: Dispatch<SetStateAction<RowSelectionState>>
-) {
- const [params, setParams] = useUrlParams();
- const pageSize = parseNumberFromUrlParam(params, "limit", 15);
- const offset = parseNumberFromUrlParam(params, "offset", 0);
-
- const pageIndex = Math.floor(offset / pageSize) + 1;
- const pageCount = Math.ceil(count / pageSize);
- const canPreviousPage = pageIndex > 1;
- const canNextPage = pageIndex < Math.ceil(count / pageSize);
-
- const gotoPage = (page: number) => {
- flushSync(() => {
- setRowSelections({});
- setParams({
- ...Object.fromEntries(params),
- offset: (page - 1) * pageSize,
- limit: pageSize,
- });
- });
-
- window?.scrollTo({ top: 0, behavior: "smooth" });
- };
-
- const previousPage = () => {
- gotoPage(pageIndex - 1);
- };
-
- const nextPage = () => {
- gotoPage(pageIndex + 1);
- };
-
- const setPageSize = (pageSize: number) => {
- setParams({
- offset: 0,
- limit: pageSize,
- });
- };
-
- return {
- count,
- offset,
- pageIndex,
- pageCount,
- pageSize,
- canPreviousPage,
- canNextPage,
- gotoPage,
- nextPage,
- previousPage,
- setPageSize,
- };
-}
diff --git a/apps/carbon/app/components/TableOld/components/Row.tsx b/apps/carbon/app/components/TableOld/components/Row.tsx
deleted file mode 100644
index a2e8953ea8..0000000000
--- a/apps/carbon/app/components/TableOld/components/Row.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { Tr, cn } from "@carbon/react";
-import type { Row as RowType } from "@tanstack/react-table";
-import type { ComponentProps } from "react";
-import { memo } from "react";
-import type {
- EditableTableCellComponent,
- Position,
-} from "~/components/Editable";
-import Cell from "./Cell";
-
-type RowProps<T> = ComponentProps<typeof Tr> & {
- editableComponents?: Record<string, EditableTableCellComponent<T> | object>;
- editedCells?: string[];
- isEditing: boolean;
- isEditMode: boolean;
- isFrozenColumn?: boolean;
- isRowSelected?: boolean;
- pinnedColumns?: number;
- selectedCell: Position;
- row: RowType<T>;
- rowIsSelected: boolean;
- withColumnOrdering: boolean;
- onCellClick: (row: number, column: number) => void;
- onCellUpdate: (row: number) => (updates: Record<string, unknown>) => void;
-};
-
-const Row = <T extends object>({
- editableComponents,
- editedCells,
- isEditing,
- isEditMode,
- isFrozenColumn = false,
- isRowSelected = false,
- pinnedColumns = 0,
- row,
- rowIsSelected,
- selectedCell,
- withColumnOrdering,
- onCellClick,
- onCellUpdate,
- ...props
-}: RowProps<T>) => {
- const onUpdate = isEditMode ? onCellUpdate(row.index) : undefined;
-
- return (
- <Tr
- key={row.id}
- className={cn(
- "border-b border-border transition-colors",
- isFrozenColumn && "bg-card"
- )}
- {...props}
- >
- {(isFrozenColumn
- ? row.getLeftVisibleCells()
- : withColumnOrdering
- ? row.getCenterVisibleCells()
- : row.getVisibleCells()
- ).map((cell, columnIndex) => {
- const isSelected = isFrozenColumn
- ? selectedCell?.row === cell.row.index &&
- selectedCell?.column === columnIndex - 1
- : selectedCell?.row === cell.row.index &&
- selectedCell?.column === columnIndex + pinnedColumns;
-
- return (
- <Cell<T>
- key={cell.id}
- cell={cell}
- columnIndex={columnIndex}
- // @ts-ignore
- editableComponents={editableComponents}
- editedCells={editedCells}
- isRowSelected={isRowSelected}
- isSelected={isSelected}
- isEditing={isEditing}
- isEditMode={isEditMode}
- onClick={
- isEditMode
- ? () =>
- onCellClick(
- cell.row.index,
- isFrozenColumn
- ? columnIndex - 1
- : columnIndex + pinnedColumns
- )
- : undefined
- }
- onUpdate={onUpdate}
- />
- );
- })}
- </Tr>
- );
-};
-
-const MemoizedRow = memo(
- Row,
- (prev, next) =>
- next.rowIsSelected === false &&
- prev.rowIsSelected === false &&
- next.isRowSelected === prev.isRowSelected &&
- next.selectedCell?.row === prev.row.index &&
- next.row.index === prev.selectedCell?.row &&
- next.selectedCell?.column === prev.selectedCell?.column &&
- next.isEditing === prev.isEditing &&
- next.isEditMode === prev.isEditMode
-) as typeof Row;
-
-export default MemoizedRow;
diff --git a/apps/carbon/app/components/TableOld/components/Sort/Sort.tsx b/apps/carbon/app/components/TableOld/components/Sort/Sort.tsx
deleted file mode 100644
index 9565255b90..0000000000
--- a/apps/carbon/app/components/TableOld/components/Sort/Sort.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuIcon,
- DropdownMenuItem,
- DropdownMenuTrigger,
- HStack,
- IconButton,
- Popover,
- PopoverContent,
- PopoverFooter,
- PopoverHeader,
- PopoverTrigger,
- Switch,
-} from "@carbon/react";
-import { Reorder } from "framer-motion";
-import { BsChevronDown, BsListUl } from "react-icons/bs";
-import { IoMdClose } from "react-icons/io";
-import { MdOutlineDragIndicator } from "react-icons/md";
-import { useSort } from "./useSort";
-
-type SortProps = {
- columnAccessors: Record<string, string>;
-};
-
-const Sort = ({ columnAccessors }: SortProps) => {
- const {
- sorts,
- removeSortBy,
- reorderSorts,
- toggleSortBy,
- toggleSortByDirection,
- } = useSort();
- const hasNoSorts = sorts.length === 0;
-
- return (
- <Popover>
- <PopoverTrigger asChild>
- <Button
- variant={hasNoSorts ? "ghost" : "primary"}
- leftIcon={<BsListUl />}
- >
- {hasNoSorts ? "Sort" : "Sorted"}
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-[420px]">
- {hasNoSorts && (
- <PopoverHeader>
- <p className="text-sm">No sorts applied to this view</p>
- <p className="text-xs text-muted-foreground">
- Add a column below to sort the view
- </p>
- </PopoverHeader>
- )}
-
- {!hasNoSorts && (
- <Reorder.Group
- axis="y"
- values={sorts}
- onReorder={reorderSorts}
- className="space-y-2"
- >
- {sorts.map((sort) => {
- const [column, direction] = sort.split(":");
- return (
- <Reorder.Item key={sort} value={sort} className="rounded-lg">
- <HStack>
- <IconButton
- aria-label="Drag handle"
- icon={<MdOutlineDragIndicator />}
- variant="ghost"
- />
- <span className="text-sm flex-grow">
- <>{columnAccessors[column] ?? ""}</>
- </span>
- <Switch
- checked={direction === "asc"}
- onCheckedChange={() => toggleSortByDirection(column)}
- />
- <span className="text-sm text-muted-foreground">
- Ascending
- </span>
- <IconButton
- aria-label="Remove sort by column"
- icon={<IoMdClose />}
- onClick={() => removeSortBy(sort)}
- variant="ghost"
- />
- </HStack>
- </Reorder.Item>
- );
- })}
- </Reorder.Group>
- )}
-
- <PopoverFooter>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button rightIcon={<BsChevronDown />} variant="secondary">
- Pick a column to sort by
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="w-48">
- {Object.keys(columnAccessors)
- .filter((columnAccessor) => {
- return !sorts
- .map((sort) => sort.split(":")[0])
- .includes(columnAccessor);
- })
- .map((columnAccessor) => {
- return (
- <DropdownMenuItem
- key={columnAccessor}
- onClick={() => toggleSortBy(columnAccessor)}
- >
- <DropdownMenuIcon icon={<BsListUl />} />
- {columnAccessors[columnAccessor]}
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- </PopoverFooter>
- </PopoverContent>
- </Popover>
- );
-};
-
-export default Sort;
diff --git a/apps/carbon/app/components/TableOld/components/Sort/index.ts b/apps/carbon/app/components/TableOld/components/Sort/index.ts
deleted file mode 100644
index 684f8ac27f..0000000000
--- a/apps/carbon/app/components/TableOld/components/Sort/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import Sort from "./Sort";
-import { useSort } from "./useSort";
-
-export default Sort;
-export { useSort };
diff --git a/apps/carbon/app/components/TableOld/components/Sort/useSort.tsx b/apps/carbon/app/components/TableOld/components/Sort/useSort.tsx
deleted file mode 100644
index e92dbf9c52..0000000000
--- a/apps/carbon/app/components/TableOld/components/Sort/useSort.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { useUrlParams } from "~/hooks";
-
-export function useSort() {
- const [params, setParams] = useUrlParams();
- const sorts = params.getAll("sort");
-
- const isSorted = (columnId: string): -1 | null | 1 => {
- if (sorts.includes(`${columnId}:asc`)) return 1;
- if (sorts.includes(`${columnId}:desc`)) return -1;
- return null;
- };
-
- const reorderSorts = (newOrder: string[]) => {
- setParams({ sort: newOrder });
- };
-
- const removeSortBy = (sort: string) => {
- setParams({ sort: sorts.filter((s) => s !== sort) });
- };
-
- const toggleSortBy = (columnId: string) => {
- const existingSort = [...sorts];
- const sortAsc = `${columnId}:asc`;
- const sortDesc = `${columnId}:desc`;
-
- if (existingSort.includes(sortAsc)) {
- setParams({
- sort: existingSort.filter((s) => s !== sortAsc).concat(sortDesc),
- });
- } else if (existingSort.includes(sortDesc)) {
- setParams({ sort: existingSort.filter((s) => s !== sortDesc) });
- } else {
- setParams({ sort: existingSort.concat(sortAsc) });
- }
- };
-
- const toggleSortByDirection = (columnId: string) => {
- const existingSort = [...sorts];
- const sortAsc = `${columnId}:asc`;
- const sortDesc = `${columnId}:desc`;
-
- if (existingSort.includes(sortAsc)) {
- setParams({
- sort: existingSort.map((s) => (s === sortAsc ? sortDesc : s)),
- });
- } else if (existingSort.includes(sortDesc)) {
- setParams({
- sort: existingSort.map((s) => (s === sortDesc ? sortAsc : s)),
- });
- }
- };
-
- return {
- sorts,
- isSorted,
- reorderSorts,
- removeSortBy,
- toggleSortBy,
- toggleSortByDirection,
- };
-}
diff --git a/apps/carbon/app/components/TableOld/components/TableHeader.tsx b/apps/carbon/app/components/TableOld/components/TableHeader.tsx
deleted file mode 100644
index 9365a8ecd3..0000000000
--- a/apps/carbon/app/components/TableOld/components/TableHeader.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import { Button, HStack } from "@carbon/react";
-import type { Column, ColumnOrderState } from "@tanstack/react-table";
-import { BsFillCheckCircleFill } from "react-icons/bs";
-import { MdOutlineEditNote } from "react-icons/md";
-import type { TableAction } from "../types";
-import Actions from "./Actions";
-import Columns from "./Columns";
-import Filter from "./Filter";
-import type { PaginationProps } from "./Pagination";
-import { PaginationButtons } from "./Pagination";
-import Sort from "./Sort";
-
-type HeaderProps<T> = {
- actions: TableAction<T>[];
- columnAccessors: Record<string, string>;
- columnOrder: ColumnOrderState;
- columns: Column<T, unknown>[];
- editMode: boolean;
- pagination: PaginationProps;
- selectedRows: T[];
- setColumnOrder: (newOrder: ColumnOrderState) => void;
- setEditMode: (editMode: boolean) => void;
- withColumnOrdering: boolean;
- withFilters: boolean;
- withInlineEditing: boolean;
- withPagination: boolean;
- withSelectableRows: boolean;
-};
-
-const TableHeader = <T extends object>({
- actions,
- columnAccessors,
- columnOrder,
- columns,
- editMode,
- pagination,
- selectedRows,
- setColumnOrder,
- setEditMode,
- withColumnOrdering,
- withFilters,
- withInlineEditing,
- withPagination,
- withSelectableRows,
-}: HeaderProps<T>) => {
- return (
- <HStack className="px-4 py-1.5 justify-between bg-background border-b border-border w-full">
- <HStack>
- {withSelectableRows && actions.length > 0 && (
- <Actions actions={actions} selectedRows={selectedRows} />
- )}
- {withInlineEditing &&
- (editMode ? (
- <Button
- leftIcon={<BsFillCheckCircleFill />}
- onClick={() => setEditMode(false)}
- >
- Finish Editing
- </Button>
- ) : (
- <Button
- leftIcon={<MdOutlineEditNote />}
- variant="ghost"
- onClick={() => setEditMode(true)}
- >
- Edit
- </Button>
- ))}
- </HStack>
- <HStack>
- {withFilters && (
- <>
- <Filter columnAccessors={columnAccessors} />
- <Sort columnAccessors={columnAccessors} />
- </>
- )}
-
- {withColumnOrdering && (
- <Columns
- columnOrder={columnOrder}
- columns={columns}
- setColumnOrder={setColumnOrder}
- withSelectableRows={withSelectableRows}
- />
- )}
- {withPagination && <PaginationButtons {...pagination} condensed />}
- </HStack>
- </HStack>
- );
-};
-
-export default TableHeader;
diff --git a/apps/carbon/app/components/TableOld/components/index.ts b/apps/carbon/app/components/TableOld/components/index.ts
deleted file mode 100644
index ef990dded6..0000000000
--- a/apps/carbon/app/components/TableOld/components/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Td, Th, Tr, spring } from "./Animations";
-import Cell from "./Cell";
-import TableHeader from "./TableHeader";
-import IndeterminateCheckbox from "./IndeterminateCheckbox";
-import { Pagination, usePagination } from "./Pagination";
-import Row from "./Row";
-import { useSort } from "./Sort";
-
-export {
- Cell,
- IndeterminateCheckbox,
- Pagination,
- Row,
- TableHeader,
- Tr,
- Td,
- Th,
- spring,
- usePagination,
- useSort,
-};
diff --git a/apps/carbon/app/components/TableOld/index.ts b/apps/carbon/app/components/TableOld/index.ts
deleted file mode 100644
index ec5c448a93..0000000000
--- a/apps/carbon/app/components/TableOld/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Table from "./Table";
-
-export default Table;
diff --git a/apps/carbon/app/components/TableOld/types.ts b/apps/carbon/app/components/TableOld/types.ts
deleted file mode 100644
index 473bbe3da2..0000000000
--- a/apps/carbon/app/components/TableOld/types.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export interface TableAction<T> {
- label: string;
- onClick: (rows: T[]) => void;
- disabled?: boolean;
- icon?: JSX.Element;
-}
diff --git a/apps/carbon/app/components/TableOld/utils.ts b/apps/carbon/app/components/TableOld/utils.ts
deleted file mode 100644
index 278ebdc510..0000000000
--- a/apps/carbon/app/components/TableOld/utils.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import type { ColumnDef } from "@tanstack/react-table";
-
-export function getAccessorKey<T>(columnDef: ColumnDef<T, unknown>) {
- return "accessorKey" in columnDef
- ? columnDef?.accessorKey.toString()
- : undefined;
-}
-
-export function updateNestedProperty(
- obj: object,
- path: string | string[],
- value: unknown
-): unknown {
- if (typeof path == "string")
- return updateNestedProperty(obj, path.split("_"), value);
- else if (path.length == 1 && value !== undefined)
- // @ts-ignore
- return (obj[path[0]] = value);
- else if (path.length == 0) return obj;
- // @ts-ignore
- else return updateNestedProperty(obj[path[0]], path.slice(1), value);
-}
diff --git a/apps/carbon/app/components/index.ts b/apps/carbon/app/components/index.ts
index db7d7a7488..8d8fa51559 100644
--- a/apps/carbon/app/components/index.ts
+++ b/apps/carbon/app/components/index.ts
@@ -7,8 +7,7 @@ import CreatableCombobox from "./CreateableCombobox";
import MultiSelect from "./MultiSelect";
import New from "./New";
import Select from "./Select";
-import TableNew from "./Table";
-import Table from "./TableOld";
+import Table from "./Table";
export {
Address,
@@ -23,5 +22,4 @@ export {
New,
Select,
Table,
- TableNew,
};
diff --git a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
index bbf86d4d58..e91bea8bf2 100644
--- a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
@@ -12,7 +12,7 @@ import { memo, useCallback, useMemo, useState } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsFillPenFill, BsListUl } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
import {
@@ -162,7 +162,7 @@ const AccountCategoriesTable = memo(
return (
<>
- <TableNew<AccountCategory>
+ <Table<AccountCategory>
data={data}
columns={columns}
count={count ?? 0}
diff --git a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
index 6b5fbb5ae7..00f51b955d 100644
--- a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Currency } from "~/modules/accounting";
import { path } from "~/utils/path";
@@ -83,7 +83,7 @@ const CurrenciesTable = memo(({ data, count }: CurrenciesTableProps) => {
);
return (
- <TableNew<Currency>
+ <Table<Currency>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
index d9b01e1ad3..a894f70d20 100644
--- a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import {
paymentTermsCalculationMethod,
@@ -98,7 +98,7 @@ const PaymentTermsTable = memo(({ data, count }: PaymentTermsTableProps) => {
);
return (
- <TableNew<PaymentTerm>
+ <Table<PaymentTerm>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
index f5bd26cf9d..e3e11e53f8 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
@@ -1,7 +1,7 @@
import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
-import { TableNew } from "~/components";
+import { Table } from "~/components";
import { EditableList } from "~/components/Editable";
import type {
AccountListItem,
@@ -217,7 +217,7 @@ const InventoryPostingGroupsTable = ({
);
return (
- <TableNew<InventoryPostingGroup>
+ <Table<InventoryPostingGroup>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
index fe7ce2cfcd..4e8faf1636 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
@@ -1,7 +1,7 @@
import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
-import { TableNew } from "~/components";
+import { Table } from "~/components";
import { EditableList } from "~/components/Editable";
import type {
AccountListItem,
@@ -146,7 +146,7 @@ const PurchasingPostingGroupsTable = ({
);
return (
- <TableNew<PurchasingPostingGroup>
+ <Table<PurchasingPostingGroup>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
index 72d328a862..48a1e5ead3 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
@@ -1,7 +1,7 @@
import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
-import { TableNew } from "~/components";
+import { Table } from "~/components";
import { EditableList } from "~/components/Editable";
import type { AccountListItem, SalesPostingGroup } from "~/modules/accounting";
import type { ListItem } from "~/types";
@@ -140,7 +140,7 @@ const SalesPostingGroupsTable = ({
);
return (
- <TableNew<SalesPostingGroup>
+ <Table<SalesPostingGroup>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable.tsx
index b3a0826c1a..f1d0177601 100644
--- a/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable.tsx
+++ b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable.tsx
@@ -27,7 +27,7 @@ import { BsFillPenFill, BsPin, BsPinFill } from "react-icons/bs";
import { IoMdAdd, IoMdTrash } from "react-icons/io";
import { RxCheck } from "react-icons/rx";
import { VscOpenPreview } from "react-icons/vsc";
-import { Avatar, TableNew } from "~/components";
+import { Avatar, Table } from "~/components";
import { Confirm, ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Document, DocumentLabel } from "~/modules/documents";
@@ -441,7 +441,7 @@ const DocumentsTable = memo(
return (
<>
- <TableNew<Document>
+ <Table<Document>
actions={actions}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable.tsx
index e33f735cee..241c99c12b 100644
--- a/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable.tsx
+++ b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptsTable.tsx
@@ -12,7 +12,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useRealtime, useUrlParams } from "~/hooks";
import type { Receipt } from "~/modules/inventory";
import {
@@ -240,7 +240,7 @@ const ReceiptsTable = memo(({ data, count, locations }: ReceiptsTableProps) => {
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
index 12b85194de..5da7b37ad5 100644
--- a/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
+++ b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import { shippingCarrierType, type ShippingMethod } from "~/modules/inventory";
import { path } from "~/utils/path";
@@ -109,7 +109,7 @@ const ShippingMethodsTable = memo(
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoices/PurchaseInvoicesTable.tsx b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoices/PurchaseInvoicesTable.tsx
index b6f495082b..78a36df13c 100644
--- a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoices/PurchaseInvoicesTable.tsx
+++ b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoices/PurchaseInvoicesTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo, useState } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useRealtime } from "~/hooks";
import type { PurchaseInvoice } from "~/modules/invoicing";
@@ -168,7 +168,7 @@ const PurchaseInvoicesTable = memo(
return (
<>
- <TableNew<PurchaseInvoice>
+ <Table<PurchaseInvoice>
count={count}
columns={columns}
data={data}
diff --git a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx
index 617f915718..5f60aee96f 100644
--- a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx
+++ b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { PartGroup } from "~/modules/parts";
import { path } from "~/utils/path";
@@ -78,7 +78,7 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/parts/ui/Parts/PartsTable.tsx b/apps/carbon/app/modules/parts/ui/Parts/PartsTable.tsx
index 7adcfd9eaa..8e4cc69aa4 100644
--- a/apps/carbon/app/modules/parts/ui/Parts/PartsTable.tsx
+++ b/apps/carbon/app/modules/parts/ui/Parts/PartsTable.tsx
@@ -3,7 +3,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Part } from "~/modules/parts";
import { partReplenishmentSystems, partTypes } from "~/modules/parts";
@@ -100,7 +100,7 @@ const PartsTable = memo(({ data, count, partGroups }: PartsTableProps) => {
return (
<>
- <TableNew<Part>
+ <Table<Part>
count={count}
columns={columns}
data={data}
diff --git a/apps/carbon/app/modules/parts/ui/Services/ServicesTable.tsx b/apps/carbon/app/modules/parts/ui/Services/ServicesTable.tsx
index fe3d046f7f..140c20b9d1 100644
--- a/apps/carbon/app/modules/parts/ui/Services/ServicesTable.tsx
+++ b/apps/carbon/app/modules/parts/ui/Services/ServicesTable.tsx
@@ -3,7 +3,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import { serviceType, type Service } from "~/modules/parts";
import type { ListItem } from "~/types";
@@ -89,7 +89,7 @@ const ServicesTable = memo(
return (
<>
- <TableNew<Service>
+ <Table<Service>
count={count}
columns={columns}
data={data}
diff --git a/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable.tsx b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable.tsx
index 411a64b075..09006c2ea8 100644
--- a/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable.tsx
+++ b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasuresTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { UnitOfMeasure } from "~/modules/parts";
import { path } from "~/utils/path";
@@ -69,7 +69,7 @@ const UnitOfMeasuresTable = memo(
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable.tsx
index 7a32313a22..d47e8c1631 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrders/PurchaseOrdersTable.tsx
@@ -13,7 +13,7 @@ import { memo, useMemo, useState } from "react";
import { BsFillPenFill, BsPin, BsPinFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
import { MdCallReceived } from "react-icons/md";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions } from "~/hooks";
import type { PurchaseOrder } from "~/modules/purchasing";
@@ -262,7 +262,7 @@ const PurchaseOrdersTable = memo(
return (
<>
- <TableNew<PurchaseOrder>
+ <Table<PurchaseOrder>
count={count}
columns={columns}
data={rows}
diff --git a/apps/carbon/app/modules/purchasing/ui/RequestForQuotes/RequestForQuotesTable.tsx b/apps/carbon/app/modules/purchasing/ui/RequestForQuotes/RequestForQuotesTable.tsx
index 3315f6f1fb..024722f743 100644
--- a/apps/carbon/app/modules/purchasing/ui/RequestForQuotes/RequestForQuotesTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/RequestForQuotes/RequestForQuotesTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo, useState } from "react";
import { BsFillPenFill, BsPin, BsPinFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, TableNew } from "~/components";
+import { Avatar, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions } from "~/hooks";
import {
@@ -242,7 +242,7 @@ const RequestForQuotesTable = memo(
return (
<>
- <TableNew<RequestForQuote>
+ <Table<RequestForQuote>
count={count}
columns={columns}
data={rows}
diff --git a/apps/carbon/app/modules/purchasing/ui/SupplierStatuses/SupplierStatusesTable.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierStatuses/SupplierStatusesTable.tsx
index 5ee3894d07..79fe8a9328 100644
--- a/apps/carbon/app/modules/purchasing/ui/SupplierStatuses/SupplierStatusesTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/SupplierStatuses/SupplierStatusesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill, BsPeopleFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { SupplierStatus } from "~/modules/purchasing";
import { path } from "~/utils/path";
@@ -78,7 +78,7 @@ const SupplierStatusesTable = memo(
);
return (
- <TableNew<SupplierStatus>
+ <Table<SupplierStatus>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable.tsx
index 97e88dd681..31309aad22 100644
--- a/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill, BsPeopleFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { SupplierType } from "~/modules/purchasing";
import { path } from "~/utils/path";
@@ -74,7 +74,7 @@ const SupplierTypesTable = memo(({ data, count }: SupplierTypesTableProps) => {
);
return (
- <TableNew<SupplierType>
+ <Table<SupplierType>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
index 9c93358d20..318eff80db 100644
--- a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
@@ -9,7 +9,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions } from "~/hooks";
import type {
Supplier,
@@ -118,7 +118,7 @@ const SuppliersTable = memo(
return (
<>
- <TableNew<Supplier>
+ <Table<Supplier>
count={count}
columns={columns}
data={data}
diff --git a/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable.tsx
index 1e0db7f741..55ff4fffa8 100644
--- a/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Abilities/AbilitiesTable.tsx
@@ -11,7 +11,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Abilities, AbilityDatum } from "~/modules/resources";
import { path } from "~/utils/path";
@@ -143,7 +143,7 @@ const AbilitiesTable = memo(({ data, count }: AbilitiesTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable.tsx
index e65b9778e3..b98b6b6655 100644
--- a/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions } from "~/hooks";
import type { AbilityEmployees } from "~/modules/resources";
import { AbilityEmployeeStatus } from "~/modules/resources";
@@ -147,7 +147,7 @@ const AbilityEmployeesTable = ({
if (!abilityId) return null;
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={rows.length}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable.tsx
index 56015d9d11..764f2daa91 100644
--- a/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoriesTable.tsx
@@ -12,7 +12,7 @@ import { memo, useCallback, useMemo, useState } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsFillPenFill, BsListUl } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
import type { AttributeCategory } from "~/modules/resources";
@@ -151,7 +151,7 @@ const AttributeCategoriesTable = memo(
return (
<>
- <TableNew<AttributeCategory>
+ <Table<AttributeCategory>
data={data}
columns={columns}
count={count ?? 0}
diff --git a/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
index bbadbe6e42..d5804c800c 100644
--- a/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
@@ -11,7 +11,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Ability, Contractor } from "~/modules/resources";
import { useSuppliers } from "~/stores";
@@ -159,7 +159,7 @@ const ContractorsTable = memo(
);
return (
- <TableNew<Contractor>
+ <Table<Contractor>
data={data}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable.tsx b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable.tsx
index ab9544233a..0f4a5b5edd 100644
--- a/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Departments/DepartmentsTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Department } from "~/modules/resources";
import { path } from "~/utils/path";
@@ -83,7 +83,7 @@ const DepartmentsTable = memo(({ data, count }: DepartmentsTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable.tsx
index 4ecc2d4572..5fa5c3adfc 100644
--- a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable.tsx
@@ -12,7 +12,7 @@ import { memo, useCallback, useMemo, useState } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsFillCheckCircleFill, BsFillPenFill, BsListUl } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
import type { EquipmentType } from "~/modules/resources";
@@ -140,7 +140,7 @@ const EquipmentTypesTable = memo(
return (
<>
- <TableNew<EquipmentType>
+ <Table<EquipmentType>
data={data}
columns={columns}
count={count ?? 0}
diff --git a/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx
index f2983f39a9..f110fc33a7 100644
--- a/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Holidays/HolidaysTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Holiday } from "~/modules/resources";
import { path } from "~/utils/path";
@@ -85,7 +85,7 @@ const HolidaysTable = memo(({ data, count, years }: HolidaysTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Locations/LocationsTable.tsx b/apps/carbon/app/modules/resources/ui/Locations/LocationsTable.tsx
index 7f4e413878..32c0c59f0f 100644
--- a/apps/carbon/app/modules/resources/ui/Locations/LocationsTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Locations/LocationsTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { ShiftLocation } from "~/modules/resources";
import { path } from "~/utils/path";
@@ -90,7 +90,7 @@ const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Partners/PartnersTable.tsx b/apps/carbon/app/modules/resources/ui/Partners/PartnersTable.tsx
index 29a62a1ebe..441bc59c88 100644
--- a/apps/carbon/app/modules/resources/ui/Partners/PartnersTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Partners/PartnersTable.tsx
@@ -11,7 +11,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Ability, Partner } from "~/modules/resources";
import { useSuppliers } from "~/stores";
@@ -125,7 +125,7 @@ const PartnersTable = memo(({ data, count, abilities }: PartnersTableProps) => {
);
return (
- <TableNew<Partner>
+ <Table<Partner>
data={data}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx b/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx
index 050cb5c9df..ce1c43ad1c 100644
--- a/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/People/PeopleTable.tsx
@@ -10,7 +10,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { AttributeCategory, Person } from "~/modules/resources";
import { DataType } from "~/modules/shared";
@@ -142,7 +142,7 @@ const PeopleTable = memo(
type: "static",
options: employeeTypes.map((type) => ({
value: type.name!,
- label: type.name!,
+ label: <Enumerable value={type.name!} />,
})),
},
},
@@ -206,7 +206,7 @@ const PeopleTable = memo(
return (
<>
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
// actions={actions}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable.tsx b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable.tsx
index f223937b7f..844051c2da 100644
--- a/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Shifts/ShiftsTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Shift, ShiftLocation } from "~/modules/resources";
import { path } from "~/utils/path";
@@ -116,7 +116,7 @@ const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
);
return (
- <TableNew<Shift>
+ <Table<Shift>
data={data}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable.tsx b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable.tsx
index d2901c135a..2d45570bc0 100644
--- a/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/WorkCells/WorkCellTypesTable.tsx
@@ -12,7 +12,7 @@ import { memo, useCallback, useMemo, useState } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsFillCheckCircleFill, BsFillPenFill, BsListUl } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
import type { WorkCellType } from "~/modules/resources";
@@ -141,7 +141,7 @@ const WorkCellTypesTable = memo(({ data, count }: WorkCellTypesTableProps) => {
return (
<>
- <TableNew<WorkCellType>
+ <Table<WorkCellType>
data={data}
columns={columns}
count={count ?? 0}
diff --git a/apps/carbon/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx b/apps/carbon/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
index e01e19cc32..7fc748848d 100644
--- a/apps/carbon/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill, BsPeopleFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { CustomerStatus } from "~/modules/sales";
import { path } from "~/utils/path";
@@ -76,7 +76,7 @@ const CustomerStatusesTable = memo(
);
return (
- <TableNew<CustomerStatus>
+ <Table<CustomerStatus>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable.tsx b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable.tsx
index 866507c249..a70987094a 100644
--- a/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill, BsPeopleFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { CustomerType } from "~/modules/sales";
import { path } from "~/utils/path";
@@ -74,7 +74,7 @@ const CustomerTypesTable = memo(({ data, count }: CustomerTypesTableProps) => {
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
index 75cf9f1c55..6a6281c66f 100644
--- a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
@@ -3,7 +3,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions } from "~/hooks";
import type { Customer, CustomerStatus, CustomerType } from "~/modules/sales";
import { path } from "~/utils/path";
@@ -93,7 +93,7 @@ const CustomersTable = memo(
return (
<>
- <TableNew<Customer>
+ <Table<Customer>
count={count}
columns={columns}
data={data}
diff --git a/apps/carbon/app/modules/sales/ui/Quotations/QuotationsTable.tsx b/apps/carbon/app/modules/sales/ui/Quotations/QuotationsTable.tsx
index f2770048aa..2cacbf4948 100644
--- a/apps/carbon/app/modules/sales/ui/Quotations/QuotationsTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotations/QuotationsTable.tsx
@@ -11,7 +11,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo, useState } from "react";
import { BsFillPenFill, BsPin, BsPinFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions } from "~/hooks";
import type { Quotation } from "~/modules/sales";
@@ -250,7 +250,7 @@ const QuotationsTable = memo(({ data, count }: QuotationsTableProps) => {
return (
<>
- <TableNew<Quotation>
+ <Table<Quotation>
count={count}
columns={columns}
data={rows}
diff --git a/apps/carbon/app/modules/settings/ui/CustomFields/CustomFieldsTable.tsx b/apps/carbon/app/modules/settings/ui/CustomFields/CustomFieldsTable.tsx
index 80ce643e8b..88e3d279fa 100644
--- a/apps/carbon/app/modules/settings/ui/CustomFields/CustomFieldsTable.tsx
+++ b/apps/carbon/app/modules/settings/ui/CustomFields/CustomFieldsTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsListUl } from "react-icons/bs";
-import { TableNew } from "~/components";
+import { Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import { modulesType, type CustomFieldsTableType } from "~/modules/settings";
import { path } from "~/utils/path";
@@ -103,7 +103,7 @@ const CustomFieldsTable = memo(({ data, count }: CustomFieldsTableProps) => {
return (
<>
- <TableNew<CustomFieldsTableType>
+ <Table<CustomFieldsTableType>
data={data}
columns={columns}
count={count ?? 0}
diff --git a/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable.tsx b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable.tsx
index 3742ac3a71..300e6aeb4e 100644
--- a/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable.tsx
+++ b/apps/carbon/app/modules/settings/ui/Sequences/SequencesTable.tsx
@@ -3,7 +3,7 @@ import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
-import { TableNew } from "~/components";
+import { Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Sequence } from "~/modules/settings";
import { path } from "~/utils/path";
@@ -79,7 +79,7 @@ const SequencesTable = memo(({ data, count }: SequencesTableProps) => {
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
index b2cd3b4559..1b085b8fa5 100644
--- a/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
+++ b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
import { BsEnvelope } from "react-icons/bs";
import { FaBan } from "react-icons/fa";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Customer } from "~/modules/users";
import { DeactivateUsersModal, ResendInviteModal } from "~/modules/users";
@@ -226,7 +226,7 @@ const CustomerAccountsTable = memo(
return (
<>
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
actions={actions}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable.tsx b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable.tsx
index a4cc0cb7c5..ac4f312351 100644
--- a/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable.tsx
+++ b/apps/carbon/app/modules/users/ui/EmployeeTypes/EmployeeTypesTable.tsx
@@ -4,7 +4,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill, BsPeopleFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { New, TableNew } from "~/components";
+import { New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { EmployeeType } from "~/modules/users";
import { path } from "~/utils/path";
@@ -80,7 +80,7 @@ const EmployeeTypesTable = memo(({ data, count }: EmployeeTypesTableProps) => {
);
return (
- <TableNew<(typeof data)[number]>
+ <Table<(typeof data)[number]>
data={data}
columns={columns}
count={count}
diff --git a/apps/carbon/app/modules/users/ui/Employees/EmployeesTable.tsx b/apps/carbon/app/modules/users/ui/Employees/EmployeesTable.tsx
index 6cb1fcc714..d439966ab6 100644
--- a/apps/carbon/app/modules/users/ui/Employees/EmployeesTable.tsx
+++ b/apps/carbon/app/modules/users/ui/Employees/EmployeesTable.tsx
@@ -12,7 +12,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
import { BsEnvelope, BsFillPenFill, BsShieldLock } from "react-icons/bs";
import { FaBan } from "react-icons/fa";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Employee } from "~/modules/users";
import {
@@ -243,7 +243,7 @@ const EmployeesTable = memo(
return (
<>
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
actions={actions}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/users/ui/Groups/GroupsTable.tsx b/apps/carbon/app/modules/users/ui/Groups/GroupsTable.tsx
index de065b9817..52b07526bd 100644
--- a/apps/carbon/app/modules/users/ui/Groups/GroupsTable.tsx
+++ b/apps/carbon/app/modules/users/ui/Groups/GroupsTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
import { BsFillPenFill } from "react-icons/bs";
import { IoMdTrash } from "react-icons/io";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Group } from "~/modules/users";
import { path } from "~/utils/path";
@@ -114,7 +114,7 @@ const GroupsTable = memo(({ data, count }: GroupsTableProps) => {
);
return (
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
data={rows}
count={count}
columns={columns}
diff --git a/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
index 9b7f6f2424..2655cf591e 100644
--- a/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
+++ b/apps/carbon/app/modules/users/ui/Suppliers/SupplierAccountsTable/SuppliersAccountsTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
import { BsEnvelope } from "react-icons/bs";
import { FaBan } from "react-icons/fa";
-import { Avatar, New, TableNew } from "~/components";
+import { Avatar, New, Table } from "~/components";
import { usePermissions, useUrlParams } from "~/hooks";
import type { Supplier } from "~/modules/users";
import { DeactivateUsersModal, ResendInviteModal } from "~/modules/users";
@@ -219,7 +219,7 @@ const SupplierAccountsTable = memo(
return (
<>
- <TableNew<(typeof rows)[number]>
+ <Table<(typeof rows)[number]>
actions={actions}
count={count}
columns={columns}