@toteat-eng/ds-react 2026.8.1 → 2026.8.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { type ColumnDef } from "@tanstack/react-table";
1
+ import { type ColumnDef, type ColumnFiltersState } from "@tanstack/react-table";
2
2
  import { type ReactNode } from "react";
3
3
  export interface DataTableProps<T> {
4
4
  data: T[];
@@ -11,6 +11,9 @@ export interface DataTableProps<T> {
11
11
  paginated?: boolean;
12
12
  emptyMessage?: ReactNode;
13
13
  searchPlaceholder?: string;
14
+ filterable?: boolean;
15
+ filterPlaceholder?: string;
16
+ clearFiltersLabel?: string;
14
17
  previousLabel?: string;
15
18
  nextLabel?: string;
16
19
  onRowClick?: (row: T) => void;
@@ -20,6 +23,9 @@ export interface DataTableProps<T> {
20
23
  pageCount?: number;
21
24
  /** Wrap with useCallback in the parent to avoid redundant fetches on re-render. */
22
25
  onPageChange?: (pageIndex: number, pageSize: number) => void;
26
+ /** A fresh inline callback is safe: the effect guards on the previous filters value, so
27
+ * re-running it fires nothing unless the filters actually changed. */
28
+ onColumnFiltersChange?: (filters: ColumnFiltersState) => void;
23
29
  "data-testid"?: string;
24
30
  }
25
- export declare function DataTable<T>({ data, columns, isLoading, loadingSlot, pageSize, searchable, sortable, paginated, emptyMessage, searchPlaceholder, previousLabel, nextLabel, onRowClick, selectable, onSelectionChange, manualPagination, pageCount, onPageChange, "data-testid": testId, }: DataTableProps<T>): React.ReactElement;
31
+ export declare function DataTable<T>({ data, columns, isLoading, loadingSlot, pageSize, searchable, sortable, paginated, emptyMessage, searchPlaceholder, filterable, filterPlaceholder, clearFiltersLabel, onColumnFiltersChange, previousLabel, nextLabel, onRowClick, selectable, onSelectionChange, manualPagination, pageCount, onPageChange, "data-testid": testId, }: DataTableProps<T>): React.ReactElement;
@@ -18,3 +18,4 @@ export declare const Loading: Story;
18
18
  export declare const Empty: Story;
19
19
  export declare const WithRowClick: Story;
20
20
  export declare const FullFeatured: Story;
21
+ export declare const Filterable: Story;
@@ -1,3 +1,3 @@
1
- export type { ColumnDef, PaginationState, Row, RowData, RowSelectionState, SortingState, } from "@tanstack/react-table";
1
+ export type { ColumnDef, ColumnFiltersState, PaginationState, Row, RowData, RowSelectionState, SortingState, } from "@tanstack/react-table";
2
2
  export type { DataTableProps } from "./DataTable";
3
3
  export { DataTable } from "./DataTable";
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export type { ComingSoonProps } from "./components/ComingSoon";
25
25
  export { ComingSoon } from "./components/ComingSoon";
26
26
  export type { ConfigRowProps } from "./components/ConfigRow";
27
27
  export { ConfigRow } from "./components/ConfigRow";
28
- export type { ColumnDef, DataTableProps, PaginationState, Row, RowData, SortingState, } from "./components/DataTable";
28
+ export type { ColumnDef, ColumnFiltersState, DataTableProps, PaginationState, Row, RowData, SortingState, } from "./components/DataTable";
29
29
  export { DataTable } from "./components/DataTable";
30
30
  export type { DatePickerProps } from "./components/DatePicker";
31
31
  export { DatePicker } from "./components/DatePicker";