@harpercollins/harpercollins-design-system 1.25.0 → 1.27.0

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.
@@ -7,5 +7,5 @@ declare module "@tanstack/react-table" {
7
7
  noSortButton?: boolean;
8
8
  }
9
9
  }
10
- declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, }: TableProps<TData>): import("react/jsx-runtime").JSX.Element;
10
+ declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, footer, isError, errorMessage, }: TableProps<TData>): import("react/jsx-runtime").JSX.Element;
11
11
  export default Table;
@@ -18,3 +18,5 @@ export declare const InfiniteScroll: Story;
18
18
  export declare const RowSelection: Story;
19
19
  export declare const ColumnHeaderTooltip: Story;
20
20
  export declare const WithExportToExcelButton: Story;
21
+ export declare const WithFooter: Story;
22
+ export declare const WithError: Story;
@@ -6,7 +6,7 @@ export declare const SortButton: import("styled-components/dist/types").IStyledC
6
6
  export declare const ColumnHeaderContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
7
7
  export declare const HeaderContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
8
  export declare const LoadingOverlay: typeof Box;
9
- export declare const getTableStyles: (columnSizeVars: Record<string, number>, totalTableWidth: number, wrapText: boolean, headerSticky: boolean) => {
9
+ export declare const getTableStyles: (columnSizeVars: Record<string, number>, totalTableWidth: number, wrapText: boolean, headerSticky: boolean, maxHeight: boolean) => {
10
10
  tableLayout: string;
11
11
  width: string;
12
12
  minWidth: string;
@@ -22,6 +22,11 @@ export declare const getTableStyles: (columnSizeVars: Record<string, number>, to
22
22
  zIndex: number;
23
23
  top: string | number;
24
24
  };
25
+ "& tfoot": {
26
+ position: string;
27
+ zIndex: number;
28
+ bottom: number;
29
+ };
25
30
  "& td, & td>div, & td>a": {
26
31
  whiteSpace: string;
27
32
  overflow: string;
@@ -8,8 +8,10 @@ export interface InfiniteScrollOptions {
8
8
  enabled: boolean;
9
9
  hasNextPage?: boolean;
10
10
  isFetchingNextPage?: boolean;
11
- fetchNextPage?: () => Promise<unknown> | void;
11
+ fetchNextPage?: () => Promise<void>;
12
12
  loadingText?: string;
13
+ /** Estimated row height in px used by the row virtualizer. Defaults to 40. */
14
+ estimateRowHeight?: number;
13
15
  }
14
16
  export interface TableProps<TData = unknown> {
15
17
  id: string;
@@ -28,4 +30,7 @@ export interface TableProps<TData = unknown> {
28
30
  stickyHeaderOffset?: number;
29
31
  infiniteScroll?: InfiniteScrollOptions;
30
32
  toolbar?: TableToolbarOptions;
33
+ footer?: boolean;
34
+ isError?: boolean;
35
+ errorMessage?: string;
31
36
  }
@@ -1,4 +1,5 @@
1
1
  import { ColumnDef, Row } from "@tanstack/react-table";
2
+ import { VirtualItem } from "@tanstack/react-virtual";
2
3
  interface TableBodyProps<TData> {
3
4
  rows: Row<TData>[];
4
5
  columns: ColumnDef<TData, unknown>[];
@@ -6,9 +7,12 @@ interface TableBodyProps<TData> {
6
7
  key: string;
7
8
  }) => JSX.Element;
8
9
  loading: boolean;
9
- tableId: string;
10
10
  rowSelectionState?: Record<string, boolean>;
11
+ virtualItems?: VirtualItem[];
12
+ paddingTop?: number;
13
+ paddingBottom?: number;
14
+ measureElement?: (node: Element | null) => void;
11
15
  }
12
- declare function TableBodyInner<TData>({ rows, columns, rowRender, loading, tableId, rowSelectionState: _rowSelectionState, }: TableBodyProps<TData>): import("react/jsx-runtime").JSX.Element;
16
+ declare function TableBodyInner<TData>({ rows, columns, rowRender, loading, rowSelectionState: _rowSelectionState, virtualItems, paddingTop, paddingBottom, measureElement, }: TableBodyProps<TData>): import("react/jsx-runtime").JSX.Element;
13
17
  export declare const TableBody: typeof TableBodyInner;
14
18
  export {};
@@ -1,7 +1,11 @@
1
+ import { VirtualItem } from "@tanstack/react-virtual";
1
2
  import React from "react";
2
3
  import { InfiniteScrollOptions } from "../Table.types";
3
- /**
4
- * Hook to manage infinite scroll behavior using IntersectionObserver
5
- * Automatically fetches next page when sentinel element is visible
6
- */
7
- export declare function useInfiniteScroll(infiniteScroll: InfiniteScrollOptions | undefined, observerTargetRef: React.RefObject<HTMLDivElement>): void;
4
+ export interface UseInfiniteScrollResult {
5
+ enabled: boolean;
6
+ virtualItems: VirtualItem[];
7
+ paddingTop: number;
8
+ paddingBottom: number;
9
+ measureElement: (node: Element | null) => void;
10
+ }
11
+ export declare function useInfiniteScroll(rowCount: number, infiniteScroll: InfiniteScrollOptions | undefined, scrollElementRef: React.RefObject<HTMLDivElement>): UseInfiniteScrollResult;