@harpercollins/harpercollins-design-system 1.34.0 → 1.35.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.
- package/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -0
- package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -0
- package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
- package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -1
- package/dist/cjs/components/data-display/Table/TableLayout.cjs +1 -0
- package/dist/cjs/hooks/useServerSideTableState.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/data-display/DataGrid/DataGrid.js +70 -0
- package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +189 -0
- package/dist/esm/components/data-display/Table/Table.js +51 -295
- package/dist/esm/components/data-display/Table/TableHeader.js +1 -1
- package/dist/esm/components/data-display/Table/TableLayout.js +112 -0
- package/dist/esm/hooks/useServerSideTableState.js +1 -1
- package/dist/esm/index.js +221 -214
- package/dist/index.d.ts +51 -24
- package/package.json +1 -1
- package/dist/cjs/components/data-display/Table/index.cjs +0 -1
- package/dist/esm/components/data-display/Table/index.js +0 -4
- /package/dist/cjs/components/data-display/{Table → DataGrid}/ExportToExcelButton.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/FilterChipsSection.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/TableToolbar.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/filters/FilterComponents.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/filters/filterFunctions.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/hooks/useInfiniteScroll.cjs +0 -0
- /package/dist/cjs/components/data-display/{Table → DataGrid}/tableUrlUtils.cjs +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/ExportToExcelButton.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/FilterChipsSection.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/TableToolbar.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/filters/FilterComponents.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/filters/filterFunctions.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/hooks/useInfiniteScroll.js +0 -0
- /package/dist/esm/components/data-display/{Table → DataGrid}/tableUrlUtils.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ import { SwitchProps } from '@mui/joy';
|
|
|
89
89
|
import { SyntheticEvent } from 'react';
|
|
90
90
|
import { default as Tab } from '@mui/joy/Tab';
|
|
91
91
|
import { tabClasses } from '@mui/joy/Tab';
|
|
92
|
+
import { Table as Table_2 } from '@tanstack/react-table';
|
|
92
93
|
import { TableOptions } from '@tanstack/react-table';
|
|
93
94
|
import { default as TabList } from '@mui/joy/TabList';
|
|
94
95
|
import { tabListClasses } from '@mui/joy/TabList';
|
|
@@ -99,6 +100,7 @@ import { TextareaProps } from '@mui/joy';
|
|
|
99
100
|
import { TextField } from '@mui/joy';
|
|
100
101
|
import { TooltipProps as TooltipProps_2 } from '@mui/joy';
|
|
101
102
|
import { TypographyProps } from '@mui/joy';
|
|
103
|
+
import { VirtualItem } from '@tanstack/react-virtual';
|
|
102
104
|
|
|
103
105
|
export declare function Accordion(props: AccordionProps): JSX_2.Element;
|
|
104
106
|
|
|
@@ -216,6 +218,54 @@ export declare function CircularProgress(props: CircularProgressProps): JSX_2.El
|
|
|
216
218
|
|
|
217
219
|
export declare function Container(props: ContainerProps): JSX_2.Element;
|
|
218
220
|
|
|
221
|
+
/** Core data-management options shared by DataGrid and Table. */
|
|
222
|
+
declare interface DataGridCoreOptions<TData = unknown> {
|
|
223
|
+
id: string;
|
|
224
|
+
loading?: boolean;
|
|
225
|
+
reactTableOptions: Partial<TableOptions<TData>> & Pick<TableOptions<TData>, "data" | "columns">;
|
|
226
|
+
gridCheckboxes?: boolean;
|
|
227
|
+
allSelected?: boolean;
|
|
228
|
+
onSelectionChange?: (selection: RowSelectionState) => void;
|
|
229
|
+
infiniteScroll?: InfiniteScrollOptions;
|
|
230
|
+
syncUrl?: boolean;
|
|
231
|
+
urlParamPrefix?: string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The context object passed to the `renderLayout` render prop.
|
|
236
|
+
* Contains everything a layout needs to render filtered/sorted data with
|
|
237
|
+
* infinite scroll support.
|
|
238
|
+
*/
|
|
239
|
+
declare interface DataGridLayoutContext<TData = unknown> {
|
|
240
|
+
id: string;
|
|
241
|
+
table: Table_2<TData>;
|
|
242
|
+
rows: Row<TData>[];
|
|
243
|
+
isVirtual: boolean;
|
|
244
|
+
virtualItems: VirtualItem[];
|
|
245
|
+
paddingTop: number;
|
|
246
|
+
paddingBottom: number;
|
|
247
|
+
measureElement: (node: Element | null) => void;
|
|
248
|
+
/** Attach this ref to the layout's scroll container. */
|
|
249
|
+
wrapperRef: default_2.RefObject<HTMLDivElement>;
|
|
250
|
+
/** Attach this ref to the toolbar element (used for sticky-header calculations). */
|
|
251
|
+
toolbarRef: default_2.RefObject<HTMLDivElement>;
|
|
252
|
+
loading: boolean;
|
|
253
|
+
fetchMoreOnBottomReached: (container: HTMLDivElement | null) => void;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare interface DataGridProps<TData = unknown> extends DataGridCoreOptions<TData> {
|
|
257
|
+
/**
|
|
258
|
+
* Render prop that receives the processed data context and returns the
|
|
259
|
+
* layout to display. Use the built-in `TableLayout` for a standard table,
|
|
260
|
+
* or supply your own (e.g. an image grid) to reuse all data-management
|
|
261
|
+
* features with a different visual layout.
|
|
262
|
+
*/
|
|
263
|
+
renderLayout: (ctx: DataGridLayoutContext<TData>) => default_2.ReactNode;
|
|
264
|
+
toolbar?: TableToolbarOptions;
|
|
265
|
+
isError?: boolean;
|
|
266
|
+
errorMessage?: string | JSX.Element;
|
|
267
|
+
}
|
|
268
|
+
|
|
219
269
|
declare type DateInputProps = ReactDatePickerProps;
|
|
220
270
|
|
|
221
271
|
export declare const DatePicker: default_2.ForwardRefExoticComponent<DateInputProps & default_2.RefAttributes<default_3<undefined, undefined>>>;
|
|
@@ -534,39 +584,16 @@ export { tabClasses }
|
|
|
534
584
|
|
|
535
585
|
export declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, footer, isError, errorMessage, syncUrl, urlParamPrefix, }: TableProps<TData>): JSX_2.Element;
|
|
536
586
|
|
|
537
|
-
export declare interface TableProps<TData = unknown> {
|
|
538
|
-
id: string;
|
|
539
|
-
loading?: boolean;
|
|
587
|
+
export declare interface TableProps<TData = unknown> extends Omit<DataGridProps<TData>, "renderLayout"> {
|
|
540
588
|
maxHeight?: boolean;
|
|
541
589
|
wrapText?: boolean;
|
|
542
590
|
rowRender?: (row: Row<TData>, props: {
|
|
543
591
|
key: string;
|
|
544
592
|
}) => JSX.Element;
|
|
545
|
-
reactTableOptions: Partial<TableOptions<TData>> & Pick<TableOptions<TData>, "data" | "columns">;
|
|
546
|
-
gridCheckboxes?: boolean;
|
|
547
|
-
allSelected?: boolean;
|
|
548
|
-
onSelectionChange?: (selection: RowSelectionState) => void;
|
|
549
593
|
showStickyScrollbar?: boolean;
|
|
550
594
|
enableStickyHeader?: boolean;
|
|
551
595
|
stickyHeaderOffset?: number;
|
|
552
|
-
infiniteScroll?: InfiniteScrollOptions;
|
|
553
|
-
toolbar?: TableToolbarOptions;
|
|
554
596
|
footer?: boolean;
|
|
555
|
-
isError?: boolean;
|
|
556
|
-
errorMessage?: string | JSX.Element;
|
|
557
|
-
/**
|
|
558
|
-
* When true, the table's sort and filter state is read from and written to
|
|
559
|
-
* the browser's URL query string via `window.history.replaceState`.
|
|
560
|
-
* Intended for client-side tables — for server-side tables use
|
|
561
|
-
* `useServerSideTableState({ syncUrl: true })` instead.
|
|
562
|
-
*/
|
|
563
|
-
syncUrl?: boolean;
|
|
564
|
-
/**
|
|
565
|
-
* Namespace prefix for URL params when `syncUrl` is true. Required when
|
|
566
|
-
* more than one table on the same page needs URL sync to avoid key
|
|
567
|
-
* collisions. e.g. prefix "products" turns "sort_by" → "products_sort_by".
|
|
568
|
-
*/
|
|
569
|
-
urlParamPrefix?: string;
|
|
570
597
|
}
|
|
571
598
|
|
|
572
599
|
export declare interface TableToolbarOptions {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./Table.cjs");module.exports=e;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|